In this recipe, we create a simple vertex shader that will allow us to move each individual vertex in the cube along its normal.
Load PlayStation Mobile Studio and create a new project. This example again builds heavily on the code from the previous tutorials, so the easiest thing would be to just duplicate or edit the prior recipe's project. The complete project is available as Ch7_Example5
.
Edit
AppMain.cs
; I will assume that you are working from the prior recipes source code. For this recipe we are going to also require normal information for our textured cube, so we have to make a small alteration toMakeCube()
. When we construct ourVertexBuffer
, we need to inform it of the additional normal array; this is done by adding an additional type to the constructor as follows:VertexBuffer vertexBuffer = new VertexBuffer(24, 36, VertexFormat.Float3, VertexFormat.Float2,VertexFormat.Float3);
Now we create the new array of
Float3
values. The...