Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 9, 2018, 1:06:05 PM (5 years ago)
Author:
wiesep
Message:

Updated programs and adjusted Material to work with GLSL>150

File:
1 edited

Legend:

Unmodified
Added
Removed
  • data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_DisplayVS.glsl

    r12083 r12091  
    44// Explanation of different particle types
    55//
    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
    1116#define P_SHELLLIFE 3.0
    1217#define P_EMBER1LIFE 2.5
     
    1419#define P_EMBER3LIFE 2.0
    1520
    16 in vec4 position;
    17 uniform float inTimer;
    18 uniform float inType;
    19 uniform vec3 inVelocity;
     21in vec3 position;
     22// timer
     23in float uv0;
     24// type
     25in float uv1;
     26// velocity
     27in vec3 uv2;
    2028
    2129out block {
    22         vec3    pos;
    23     vec4        color;
    24         float   radius;
    25 } ColoredFirework;
     30    vec3 pos;
     31    vec4 colour;
     32    float radius;
     33} ColouredFirework;
    2634
    2735uniform mat4 worldViewProj;
     
    3038void main()
    3139{
     40    float inTimer = uv0;
     41    float inType = uv1;
     42   
    3243    //
    3344    // Pass the point through
    3445    //
    35     ColoredFirework.pos = position.xyz; //Multiply by world matrix?
    36     ColoredFirework.radius = 1.5;
     46    ColouredFirework.pos = position; // Multiply by world matrix?
     47    ColouredFirework.radius = 1.5;
    3748   
    3849    // 
    39     // calculate the color
     50    // calculate the colour
    4051    //
    41     if( inType == PT_LAUNCHER )
     52    if (inType == PT_LAUNCHER)
    4253    {
    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;
    4557    }
    46     else if( inType == PT_SHELL )
     58    else if (inType == PT_SHELL)
    4759    {
    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;
    5063    }
    51     else if( inType == PT_EMBER1 )
     64    else if (inType == PT_EMBER1)
    5265    {
    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);
    5569    }
    56     else if( inType == PT_EMBER2 )
     70    else if (inType == PT_EMBER2)
    5771    {
    58         ColoredFirework.color = vec4(1,0.1,1,1);
     72        // fuschia
     73        ColouredFirework.colour = vec4(1, 0.1, 1, 1);
    5974    }
    60     else if( inType == PT_EMBER3 )
     75    else if (inType == PT_EMBER3)
    6176    {
    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);
    6480    }
    6581}
Note: See TracChangeset for help on using the changeset viewer.