IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Parameter QML Type

Provides storage for a name and value pair. This maps to a shader uniform.

This type was introduced in Qt 5.7.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

Parameter QML Type

  • Import Statement: import Qt3D.Render 2.4

  • Since:: Qt 5.7

  • Instantiates:: QParameter

Detailed Description

A Parameter can be referenced by a RenderPass, Technique, Effect, Material, TechniqueFilter, RenderPassFilter. At runtime, depending on which shader is selected for a given step of the rendering, the value contained in a Parameter will be converted and uploaded if the shader contains a uniform with a name matching that of the Parameter.

 
Sélectionnez
Parameter {
    name: "diffuseColor"
    value: "blue"
}

// Works with the following GLSL uniform shader declarations
// uniform vec4 diffuseColor;
// uniform vec3 diffuseColor;
// uniform vec2 diffuseColor;
// uniform float diffuseColor;

some care must be taken to ensure the value wrapped by a Parameter can actually be converted to what the real uniform expect. Giving a value stored as an int where the actual shader uniform is of type float could result in undefined behaviors.

when the targeted uniform is an array, the name should be the name of the uniform with [0] appended to it.

Parameter node can not be disabled.

 
Sélectionnez
Parameter {
    name: "diffuseValues[0]"
    value: [0.0, 1.0. 2.0, 3.0, 4.0, 883.0, 1340.0, 1584.0]
}

// Matching GLSL shader uniform  declaration
// uniform float diffuseValues[8];

When it comes to texture support, the Parameter value should be set to the appropriate texture subclass that matches the sampler type of the shader uniform.

 
Sélectionnez
Parameter {
    name: "diffuseTexture"
    value: Texture2D { ... }
}

// Works with the following GLSL uniform shader declaration
// uniform sampler2D diffuseTexture

See Also

Property Documentation

 

name : QString

Specifies the name of the parameter

value : QVariant

Specifies the value of the parameter

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+