ShaderProgram QML Type

Encapsulates a Shader Program. 更多...

import 语句: import Qt3D.Render 2.15
Since: Qt 5.5
实例化: QShaderProgram

特性

方法

详细描述

ShaderProgram class encapsulates a shader program. A shader program consists of several different shaders, such as vertex and fragment shaders.

Qt3D will automatically populate a set of default uniforms if they are encountered during the shader instrospection phase.

Default Uniform Associated Qt3D Parameter name GLSL declaration
ModelMatrix modelMatrix uniform mat4 modelMatrix;
ViewMatrix viewMatrix uniform mat4 viewMatrix;
ProjectionMatrix projectionMatrix uniform mat4 projectionMatrix;
ModelViewMatrix modelView uniform mat4 modelView;
ViewProjectionMatrix viewProjectionMatrix uniform mat4 viewProjectionMatrix;
ModelViewProjectionMatrix modelViewProjection
mvp
uniform mat4 modelViewProjection;
uniform mat4 mvp;
InverseModelMatrix inverseModelMatrix uniform mat4 inverseModelMatrix;
InverseViewMatrix inverseViewMatrix uniform mat4 inverseViewMatrix;
InverseProjectionMatrix inverseProjectionMatrix uniform mat4 inverseProjectionMatrix;
InverseModelViewMatrix inverseModelView uniform mat4 inverseModelView;
InverseViewProjectionMatrix inverseViewProjectionMatrix uniform mat4 inverseViewProjectionMatrix;
InverseModelViewProjectionMatrix inverseModelViewProjection uniform mat4 inverseModelViewProjection;
ModelNormalMatrix modelNormalMatrix uniform mat3 modelNormalMatrix;
ModelViewNormalMatrix modelViewNormal uniform mat3 modelViewNormal;
ViewportMatrix viewportMatrix uniform mat4 viewportMatrix;
InverseViewportMatrix inverseViewportMatrix uniform mat4 inverseViewportMatrix;
AspectRatio
(surface width / surface height)
aspectRatio uniform float aspectRatio;
Exposure exposure uniform float exposure;
Gamma gamma uniform float gamma;
时间
(in nano seconds)
time uniform float time;
EyePosition eyePosition uniform vec3 eyePosition;
SkinningPalette skinningPalette[0] const int maxJoints = 100;
uniform mat4 skinningPalette[maxJoints];

特性文档编制

computeShaderCode : string

Holds the compute shader code used by this shader program.

computeShaderGraph : string

Holds the URL to the compute shader graph used by this shader program builder.

format : enumeration

Holds the format of the code provided on the ShaderProgram 。默认为 ShaderProgram .GLSL

该特性在 Qt 5.15 引入。

fragmentShaderCode : string

Holds the fragment shader code used by this shader program.

fragmentShaderGraph : string

Holds the URL to the fragment shader graph used by this shader program builder.

geometryShaderCode : string

Holds the geometry shader code used by this shader program.

geometryShaderGraph : string

Holds the URL to the geometry shader graph used by this shader program builder.

log : string

Holds the log of the current shader program. This is useful to diagnose a compilation failure of the shader program.

status : enumeration

Holds the status of the current shader program.

tessellationControlShaderCode : string

Holds the tesselation control shader code used by this shader program.

tessellationControlShaderGraph : string

Holds the URL to the tesselation control shader graph used by this shader program builder.

tessellationEvaluationShaderCode : string

Holds the tesselation evaluation shader code used by this shader program.

tessellationEvaluationShaderGraph : string

Holds the URL to the tesselation evaluation shader graph used by this shader program builder.

vertexShaderCode : string

Holds the vertex shader code used by this shader program.

vertexShaderGraph : string

Holds the URL to the vertex shader graph used by this shader program builder.

方法文档编制

string loadSource ( url sourceUrl )

Returns the shader code loaded from sourceUrl .