28 lines
736 B
GLSL
28 lines
736 B
GLSL
#version 450
|
|
|
|
layout(location = 0) in vec3 inPosition;
|
|
layout(location = 1) in vec3 inColor;
|
|
layout(location = 2) in vec3 inLineStart;
|
|
layout(location = 3) in vec3 inLineEnd;
|
|
|
|
layout(location = 0) out vec3 fragColor;
|
|
layout(location = 1) out vec3 fragLineStart;
|
|
layout(location = 2) out vec3 fragLineEnd;
|
|
|
|
|
|
layout(binding = 0) uniform UniformBufferObject {
|
|
mat4 proj;
|
|
mat4 model;
|
|
mat4 view;
|
|
} ubo;
|
|
|
|
void main() {
|
|
mat4 worldviewproj = ubo.proj * ubo.view * ubo.model;
|
|
gl_Position = worldviewproj * vec4(inPosition, 1.0);
|
|
|
|
fragColor = inColor;
|
|
|
|
// 传递裁剪空间坐标
|
|
fragLineStart = (worldviewproj * vec4(inLineStart, 1.0)).xyz;
|
|
fragLineEnd = (worldviewproj * vec4(inLineEnd, 1.0)).xyz;
|
|
} |