ShaderProgram QML Type
셰이더 프로그램을 캡슐화합니다. 더 보기...
| Import Statement: | import Qt3D.Render 2.12 |
| In C++: | QShaderProgram |
| Status: | Deprecated |
이 유형은 더 이상 사용되지 않습니다. 새로운 코드에서는 이 유형을 사용하지 않는 것을 강력히 권장합니다.
속성
- computeShaderCode : string
- computeShaderGraph : string
- format : enumeration
- fragmentShaderCode : string
- fragmentShaderGraph : string
- geometryShaderCode : string
- geometryShaderGraph : string
- log : string
- status : enumeration
- tessellationControlShaderCode : string
- tessellationControlShaderGraph : string
- tessellationEvaluationShaderCode : string
- tessellationEvaluationShaderGraph : string
- vertexShaderCode : string
- vertexShaderGraph : string
방법
- string loadSource(url sourceUrl)
상세 설명
ShaderProgram 클래스는 셰이더 프로그램을 캡슐화합니다. 셰이더 프로그램은 버텍스 셰이더나 프래그먼트 셰이더와 같은 여러 가지 셰이더로 구성됩니다.
Qt3D는 셰이더 인트로스펙션 단계에서 기본 유니폼 세트가 발견되면 이를 자동으로 채웁니다.
| 기본 유니폼 | 연관된 Qt3D 매개변수 이름 | GLSL 선언 | |||
|---|---|---|---|---|---|
| ModelMatrix | modelMatrix | uniform mat4 modelMatrix; | |||
| ViewMatrix | viewMatrix | uniform mat4 viewMatrix; | |||
| 투영 행렬 | projectionMatrix | uniform mat4 투영행렬; | |||
| 모델 뷰 행렬 | modelView | uniform mat4 modelView; | |||
| ViewProjectionMatrix | viewProjectionMatrix | uniform mat4 뷰투영행렬; | |||
| ModelViewProjectionMatrix | modelViewProjection mvp | uniform mat4 modelViewProjection; uniform mat4 mvp; | |||
| InverseModelMatrix | inverseModelMatrix | uniform mat4 inverseModelMatrix; | |||
| InverseViewMatrix | 역뷰 행렬 | uniform mat4 inverseViewMatrix; | |||
| 역투영 행렬 | 역투영 행렬 | uniform mat4 inverseProjectionMatrix; | |||
| InverseModelViewMatrix | inverseModelView | uniform mat4 inverseModelView; | |||
| 역 뷰 투영 행렬 | 역 뷰 투영 행렬 | uniform mat4 inverseViewProjectionMatrix; | |||
| 역모델 뷰 투영 행렬 | 역모델뷰투영행렬 | uniform mat4 inverseModelViewProjection; | |||
| 모델 법선 행렬 | modelNormalMatrix | uniform mat3 모델법선행렬; | |||
| 모델 뷰 법선 행렬 | modelViewNormal | uniform mat3 modelViewNormal; | |||
| 뷰포트 행렬 | 뷰포트 행렬 | uniform mat4 뷰포트 행렬; | |||
| InverseViewportMatrix | inverseViewportMatrix | uniform mat4 inverseViewportMatrix; | |||
| AspectRatio (표면 너비 / 표면 높이) | aspectRatioxml-ph-0000@deepl.internal (표면 너비 / 표면 높이) uniform float aspectRatio; | uniform float aspectRatio; | |||
| 노출 | 노출 | uniform float exposure; | |||
| 감마 | 감마 | 균일한 부동소수점 감마; | |||
| 시간 (나노초 단위) | time | uniform float time; | |||
| EyePosition | eyePosition | uniform vec3 eyePosition; | |||
| 스키닝 팔레트 | skinningPalette[0] | const int maxJoints = 100; uniform mat4 skinningPalette[maxJoints]; | |||
RHI 지원
Qt 3D 의 RHI 백엔드와 함께 사용할 GLSL 450 셰이더 코드를 작성할 때, 기본 유니폼은 2개의 유니폼 버퍼 객체로 제공됩니다.
이들의 바인딩 위치는 RenderView 유니폼의 경우 0번, Command 유니폼의 경우 1번으로 설정됩니다.
#version 450 core
layout(location = 0) in vec3 vertexPosition;
layout(std140, binding = 0) uniform qt3d_render_view_uniforms {
mat4 viewMatrix;
mat4 projectionMatrix;
mat4 uncorrectedProjectionMatrix;
mat4 clipCorrectionMatrix;
mat4 viewProjectionMatrix;
mat4 inverseViewMatrix;
mat4 inverseProjectionMatrix;
mat4 inverseViewProjectionMatrix;
mat4 viewportMatrix;
mat4 inverseViewportMatrix;
vec4 textureTransformMatrix;
vec3 eyePosition;
float aspectRatio;
float gamma;
float exposure;
float time;
float yUpInNDC;
float yUpInFBO;
};
layout(std140, binding = 1) uniform qt3d_command_uniforms {
mat4 modelMatrix;
mat4 inverseModelMatrix;
mat4 modelViewMatrix;
mat3 modelNormalMatrix;
mat4 inverseModelViewMatrix;
mat4 modelViewProjection;
mat4 inverseModelViewProjectionMatrix;
};
void main()
{
gl_Position = (projectionMatrix * viewMatrix * modelMatrix * vertexPosition);
}사용자 정의 유니폼 버퍼 객체의 경우, 바인딩을 2부터 시작하거나 'auto'를 사용하여 Qt 3D 가 바인딩을 자동으로 처리하도록 하십시오. 서로 다른 셰이더 단계 간에 일관성을 유지해야 합니다.
#version 450 core
layout(std140, binding = auto) uniform my_uniforms {
vec4 myColor;
};
layout(location=0) out vec4 fragColor;
void main()
{
fragColor = myColor;
}유니폼에 값을 전달하는 방식에는 변경 사항이 없습니다.
위의 예제에서 myColor를 설정하는 방법은 다음과 같습니다.
Parameter { name: "myColor"; value: "blue" }텍스처는 여전히 독립적인 유니폼으로 정의해야 합니다.
#version 450 core
layout(binding=0) uniform sampler2D source;
layout(location=0) out vec4 fragColor;
void main()
{
fragColor = texture(source, vec2(0.5, 0.5));
}속성 설명서
computeShaderCode : string
이 셰이더 프로그램에서 사용하는 컴퓨트 셰이더 코드를 포함합니다.
computeShaderGraph : string
이 셰이더 프로그램 빌더에서 사용하는 컴퓨트 셰이더 그래프의 URL을 저장합니다.
format : enumeration
ShaderProgram 에 제공된 코드의 형식을 따릅니다. 기본값은 ShaderProgram.GLSL입니다.
fragmentShaderCode : string
이 셰이더 프로그램에서 사용하는 프래그먼트 셰이더 코드를 저장합니다.
fragmentShaderGraph : string
이 셰이더 프로그램 빌더에서 사용하는 프래그먼트 셰이더 그래프의 URL을 저장합니다.
geometryShaderCode : string
이 셰이더 프로그램에서 사용하는 지오메트리 셰이더 코드를 포함합니다.
geometryShaderGraph : string
이 셰이더 프로그램 빌더에서 사용하는 지오메트리 셰이더 그래프의 URL을 저장합니다.
log : string [read-only]
현재 셰이더 프로그램의 로그를 보관합니다. 이는 셰이더 프로그램의 컴파일 오류를 진단하는 데 유용합니다.
status : enumeration [read-only]
현재 셰이더 프로그램의 상태를 유지합니다.
tessellationControlShaderCode : string
이 셰이더 프로그램에서 사용하는 테셀레이션 제어 셰이더 코드를 포함합니다.
tessellationControlShaderGraph : string
이 셰이더 프로그램 빌더에서 사용하는 테셀레이션 컨트롤 셰이더 그래프의 URL을 저장합니다.
tessellationEvaluationShaderCode : string
이 셰이더 프로그램에서 사용하는 테셀레이션 평가 셰이더 코드를 포함합니다.
tessellationEvaluationShaderGraph : string
이 셰이더 프로그램 빌더에서 사용하는 테셀레이션 평가 셰이더 그래프의 URL을 저장합니다.
vertexShaderCode : string
이 셰이더 프로그램에서 사용하는 버텍스 셰이더 코드를 보관합니다.
vertexShaderGraph : string
이 셰이더 프로그램 빌더에서 사용하는 버텍스 셰이더 그래프의 URL을 저장합니다.
메서드 문서
string loadSource(url sourceUrl)
sourceUrl 에서 로드된 셰이더 코드를 반환합니다.
© 2026 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.