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; 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; 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); }