Adding a pulse to our model is quite easy and only needs some changes to our code.
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 materialMyMaterial17
, but useMyFragmentShader2
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 } } } }
The new vertex shader is the same as the ones we've seen before; just add a new parameter in the
default_params
block calledpulseTime
that gets the value from thetime
keyword:vertex_program MyVertexShader5 cg { source Ogre3DBeginnerGuideShaders.cg entry_point MyVertexShader5 profiles vs_1_1 arbvp1 default_params { param_named_auto worldViewMatrix worldviewproj_matrix param_named_auto pulseTime time } }
We don't need to change...