- Timestamp:
- Nov 9, 2018, 1:06:05 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_DisplayVS.glsl
r12083 r12091 4 4 // Explanation of different particle types 5 5 // 6 #define PT_LAUNCHER 0 //Firework Launcher - launches a PT_SHELL every so many seconds 7 #define PT_SHELL 1 //Unexploded shell - flies from the origin and explodes into many PT_EMBERXs 8 #define PT_EMBER1 2 //basic particle - after it's emitted from the shell, it dies 9 #define PT_EMBER2 3 //after it's emitted, it explodes again into many PT_EMBER1s 10 #define PT_EMBER3 4 //just a differently colored ember1 6 // Firework Launcher - launches a PT_SHELL every so many seconds. 7 #define PT_LAUNCHER 0 8 // Unexploded shell - flies from the origin and explodes into many PT_EMBERX's. 9 #define PT_SHELL 1 10 // Basic particle - after it's emitted from the shell, it dies. 11 #define PT_EMBER1 2 12 // After it's emitted, it explodes again into many PT_EMBER1's. 13 #define PT_EMBER2 3 14 // Just a differently colored ember1. 15 #define PT_EMBER3 4 11 16 #define P_SHELLLIFE 3.0 12 17 #define P_EMBER1LIFE 2.5 … … 14 19 #define P_EMBER3LIFE 2.0 15 20 16 in vec4 position; 17 uniform float inTimer; 18 uniform float inType; 19 uniform vec3 inVelocity; 21 in vec3 position; 22 // timer 23 in float uv0; 24 // type 25 in float uv1; 26 // velocity 27 in vec3 uv2; 20 28 21 29 out block { 22 vec3pos;23 vec4 color;24 floatradius;25 } Colo redFirework;30 vec3 pos; 31 vec4 colour; 32 float radius; 33 } ColouredFirework; 26 34 27 35 uniform mat4 worldViewProj; … … 30 38 void main() 31 39 { 40 float inTimer = uv0; 41 float inType = uv1; 42 32 43 // 33 44 // Pass the point through 34 45 // 35 Colo redFirework.pos = position.xyz; //Multiply by world matrix?36 Colo redFirework.radius = 1.5;46 ColouredFirework.pos = position; // Multiply by world matrix? 47 ColouredFirework.radius = 1.5; 37 48 38 49 // 39 // calculate the colo r50 // calculate the colour 40 51 // 41 if ( inType == PT_LAUNCHER)52 if (inType == PT_LAUNCHER) 42 53 { 43 ColoredFirework.color = vec4(1,0.1,0.1,1); 44 ColoredFirework.radius = 1.0; 54 // red 55 ColouredFirework.colour = vec4(1, 0.1, 0.1, 1); 56 ColouredFirework.radius = 1.0; 45 57 } 46 else if ( inType == PT_SHELL)58 else if (inType == PT_SHELL) 47 59 { 48 ColoredFirework.color = vec4(0.1,1,1,1); 49 ColoredFirework.radius = 1.0; 60 // cyan 61 ColouredFirework.colour = vec4(0.1, 1, 1, 1); 62 ColouredFirework.radius = 1.0; 50 63 } 51 else if ( inType == PT_EMBER1)64 else if (inType == PT_EMBER1) 52 65 { 53 ColoredFirework.color = vec4(1,1,0.1,1); 54 ColoredFirework.color *= (inTimer / P_EMBER1LIFE ); 66 // yellow 67 ColouredFirework.colour = vec4(1, 1, 0.1, 1); 68 ColouredFirework.colour *= (inTimer / P_EMBER1LIFE); 55 69 } 56 else if ( inType == PT_EMBER2)70 else if (inType == PT_EMBER2) 57 71 { 58 ColoredFirework.color = vec4(1,0.1,1,1); 72 // fuschia 73 ColouredFirework.colour = vec4(1, 0.1, 1, 1); 59 74 } 60 else if ( inType == PT_EMBER3)75 else if (inType == PT_EMBER3) 61 76 { 62 ColoredFirework.color = vec4(1,0.1,0.1,1); 63 ColoredFirework.color *= (inTimer / P_EMBER3LIFE ); 77 // red 78 ColouredFirework.colour = vec4(1, 0.1, 0.1, 1); 79 ColouredFirework.colour *= (inTimer / P_EMBER3LIFE); 64 80 } 65 81 }
Note: See TracChangeset
for help on using the changeset viewer.