Graphics Programs Reference
In-Depth Information
Adding the Player Object
The Main class in the TANK FENCE ELEMENTS 1 application is identical to
the Main class from the TOUCH ROTATION application (Figure 2-16), inside the
source code for Chapter 2 . This class provides the angle of rotation to rotate the
rendered object.
The Renderer class ( GLES20Renderer ) is also similar to the one we created
at the beginning of this chapter. The only difference is the naming convention
(for example, _tankProgram in place of _triangleProgram ) and the field
_tankUMVPLocation . _tankUMVPLocation is the location of uniform vari-
able uMVP (of type mat4 ). Recall that this matrix is used to transform the vertices
of the rendered object, in this case, the vertices of the tank (that is, the Player object
you modeled in Blender).
Now, turn your attention to the inittank method in the Renderer class. Also
open the file tankFence5.txt (parser's output) in any text editor. In the
tankFence5.txt file, scroll down to the block “vertex:”. As mentioned previ-
ously, the mesh data in every block follows the same order as in the “color:” block.
So, the following set of vertices in the tankFence5.txt file corresponds to the
vertex float array for the Plane object:
10.000000f,-10.000000f,0.000000f,
-10.000000f,-10.000000f,0.000000f,
10.000000f,10.000000f,0.000000f,
-10.000000f,10.000000f,0.000000f,
Similarly, the set of vertices from "-1.562685f,-2.427994f,0.000000f,"
to "0.781342f,3.437026f,1.500000f," corresponds to the vertex float
array for the Player object (that is, the tank initialized in the inittank method).
The float array tankVFA (in the inittank method) is composed of these ver-
tices, and they have been copied from the “vertex:” block in the output text file.
Below this block, the “index:” block contains indices, representing triangle meshes.
The following sets of indices correspond to the index short array for the Plane ob-
ject:
Search WWH ::




Custom Search