Parameter QML Type
为名称和值对提供存储空间。它映射到着色器统一标识。更多
Import Statement: | import Qt3D.Render 2.9 |
In C++: | QParameter |
Status: | Deprecated |
属性
详细说明
参数可被RenderPass 、技术、效果、材质、TechniqueFilter 、RenderPassFilter 引用。在运行时,如果着色器包含名称与参数一致的制服,那么参数中包含的值将被转换和上传,具体取决于渲染的特定步骤选择了哪个着色器。
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;
注意: 必须小心谨慎,以确保参数所封装的值能被转换为真正的均匀所期望的值。如果提供的值存储为 int,而实际着色器 uniform 的类型为 float,则可能导致未定义的行为。
注: 当目标均匀是一个数组时,名称应为均匀的名称,并附加 [0]。
注意: 不能禁用参数节点。
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];
在纹理支持方面,参数值应设置为与着色器统一采样器类型相匹配的texture 子类。
Parameter { name: "diffuseTexture" value: Texture2D { ... } } // Works with the following GLSL uniform shader declaration // uniform sampler2D diffuseTexture
另请参阅 Qt3DRender::QAbstractTexture 。
属性文档
name : string |
指定参数名称
value : QVariant |
指定参数值
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.