realityplayground-of/zoneb/bin/data/shaders/particles/draw.vert
2020-11-01 16:08:56 +01:00

42 lines
1.1 KiB
GLSL
Executable file

uniform mat4 modelViewProjectionMatrix;
uniform mat4 modelViewMatrix;
uniform sampler2DRect particles0;
uniform sampler2DRect particles1;
uniform sampler2DRect particles2;
uniform sampler2DRect particles3;
uniform sampler2DRect particles4; // prev
uniform sampler2DRect particles5; // org
uniform int uEnergy;
in vec4 position;
in vec2 texcoord;
out vec2 vTexCoord;
out vec3 vPos;
out vec4 vTarget;
out float vTemperature;
out float vAge;
out vec4 vPosition;
out vec4 vPrevPosition;
out vec4 vOrgPosition;
void main()
{
// 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;
vPos = texture(particles0, vTexCoord).xyz;
// if(uEnergy > 0) {
// vPos = texture(particles0, vTexCoord).xyz;
// }
// else {
// vPos = texture(particles5, vTexCoord).xyz;
// }
vPosition = modelViewMatrix * vec4(vPos, 1.0);
vPrevPosition = modelViewMatrix * vec4(texture(particles4, vTexCoord).xyz, 1.0);
vOrgPosition = modelViewMatrix * vec4(texture(particles5, vTexCoord).xyz, 1.0);
}