Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Set uniform and animate uniform variables
Forum Updated to NodeBB v4.3 + New Features

Set uniform and animate uniform variables

Scheduled Pinned Locked Moved Solved Game Development
4 Posts 2 Posters 932 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cute3d
    wrote on 5 Nov 2018, 17:42 last edited by
    #1

    Hi,

    I am using Qt3D with plain C++. I can't figure out how to access uniform variables of custom materials with custom shaders.

    ```
    waveAnimation = new QPropertyAnimation(m_custom_material);
    waveAnimation->setTargetObject(m_custom_material);
    waveAnimation->setPropertyName("height");
    waveAnimation->setDuration(80);
    waveAnimation->setStartValue(QVariant::fromValue(0.f));
    waveAnimation->setEndValue(QVariant::fromValue(40.f));
    waveAnimation->setLoopCount(-1);
    waveAnimation->start();
    
    I found a class names QShaderData but the documentation was useless for me and I didn't achieve anything with try and error. 
    It would be awesome if some could give me a hint ...
    1 Reply Last reply
    0
    • C Offline
      C Offline
      Cute3d
      wrote on 5 Nov 2018, 19:28 last edited by
      #2

      Alright solved it

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 5 Nov 2018, 20:15 last edited by
        #3

        Hi and welcome to devnet,

        How did you solve it ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Cute3d
          wrote on 8 Nov 2018, 20:22 last edited by
          #4

          You can access the uniforms with the parameter classes. So for example:

          auto boneId = new Qt3DRender::QParameter();
          boneId->setName("uBoneId");
          boneId->setValue(QVariant(1));
          customMaterial->addParameter(boneId);
          
          1 Reply Last reply
          0

          1/4

          5 Nov 2018, 17:42

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved