realityplayground-of/zoneb/bin/data/shaders/particles/draw.vert

40 lines
994 B
GLSL
Raw Normal View History

2020-10-20 12:02:10 +00:00
uniform mat4 modelViewProjectionMatrix;
2020-10-31 17:40:31 +00:00
uniform mat4 modelViewMatrix;
2020-10-20 12:02:10 +00:00
uniform sampler2DRect particles0;
uniform sampler2DRect particles1;
uniform sampler2DRect particles2;
uniform sampler2DRect particles3;
2020-10-31 19:59:19 +00:00
uniform sampler2DRect particles4; // prev
uniform sampler2DRect particles5; // org
uniform int uEnergy;
2020-10-20 12:02:10 +00:00
in vec4 position;
in vec2 texcoord;
2020-10-31 17:40:31 +00:00
out vec2 vTexCoord;
2020-10-26 11:22:40 +00:00
out vec3 vPos;
out vec4 vTarget;
2020-10-20 12:50:26 +00:00
out float vTemperature;
2020-10-20 12:55:48 +00:00
out float vAge;
2020-10-31 17:40:31 +00:00
out vec4 vPosition;
2020-10-31 18:47:59 +00:00
out vec4 vPrevPosition;
2020-10-20 12:02:10 +00:00
void main()
{
2020-10-31 19:59:19 +00:00
// vTexCoord = vec2(gl_InstanceID % 512, gl_InstanceID / 512);
vTexCoord = texcoord;
vec4 misc = texture(particles2, vTexCoord);
vec4 vTarget = texture(particles3, vTexCoord);
vTemperature = misc.x;
vAge = misc.y;
if(uEnergy > 0) {
2020-10-31 17:40:31 +00:00
vPos = texture(particles0, vTexCoord).xyz;
2020-10-31 19:59:19 +00:00
}
else {
vPos = texture(particles5, vTexCoord).xyz;
}
vPosition = modelViewMatrix * vec4(vPos, 1.0);
vPrevPosition = modelViewMatrix * vec4(texture(particles4, vTexCoord).xyz, 1.0);
2020-10-20 12:02:10 +00:00
}