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

Set uniform and animate uniform variables

Scheduled Pinned Locked Moved Solved Game Development
4 Posts 2 Posters 1.1k 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 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 last edited by
      #2

      Alright solved it

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on 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 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

          • Login

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