Time for action — adding a pulse

Adding a pulse to our model is quite easy and only needs some changes to our code.

  1. This time, we only need a new vertex shader because we are going to use the existing fragment shader. Create a new vertex shader named MyVertexShader5 and use it in the new material MyMaterial17, but use MyFragmentShader2 because this shader only textures our model and nothing more:
    material MyMaterial17
    {
    technique
    {
    pass
    {
    vertex_program_ref MyVertexShader5
    {
    }
    fragment_program_ref MyFragmentShader2
    {
    }
    texture_unit
    {
    texture terr_rock6.jpg
    }
    }
    }
    }
    
  2. The new vertex shader is the same as the ones we've seen before; just add a new parameter in the default_params block called pulseTime that gets the value from the time keyword:
    vertex_program ...

Get Ogre 3D 1.7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.