阿斯蒂芬
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 0) in vec3 fragColor;
|
||||
layout(location = 1) in float fragLinePosition;
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
void main() {
|
||||
// 硬编码虚线参数
|
||||
const float dashSize = 0.05;
|
||||
const float gapSize = 0.05;
|
||||
|
||||
// 使用时间创建动画效果(需要GL_EXT_shader_realtime_clock_speed扩展)
|
||||
// 或者使用一个简单的基于帧计数的方法
|
||||
float time = float(gl_FragCoord.x + gl_FragCoord.y) * 0.01; // 简单的伪时间
|
||||
|
||||
float patternPosition = mod(fragLinePosition, dashSize + gapSize);
|
||||
|
||||
if (patternPosition > dashSize) {
|
||||
discard;
|
||||
}
|
||||
|
||||
outColor = vec4(fragColor, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user