Game Development Reference
In-Depth Information
// Sets up the lighting parameters for this object
SetLighting(Cam, light, m_ModelMatrix, Cam.GetViewMatrix(), m_ModelViewMatrix,
m_NormalMatrix);
// Apply the projection and view transformation matrix to the shader
m_Shader.SetShaderVariableValueFloatMatrix4Array("uMVPMatrix", 1, false, m_MVPMatrix, 0);
// Activates texture for this object
ActivateTexture();
// Enable Hidden surface removal
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
// Draw Mesh for this Object
if (m_Mesh != null)
{
m_Mesh.DrawMesh(m_PositionHandle, m_TextureHandle, m_NormalHandle);
}
else
if (m_MeshEx != null)
{
m_MeshEx.DrawMesh(m_PositionHandle, m_TextureHandle, m_NormalHandle);
}
else
{
Log.d("class Object3d :", "No MESH in Object3d");
}
}
Modifying Other Classes That Use the Object3d Class
Other classes that use the Object3d class also will have to be modified. For example, the Cube class
that is derived from the Object3d class will have to be modified in terms of adding a Mesh input
parameter into the constructor and the call to the Object3d constructor. (See Listing 7-6.)
Listing 7-6. Modifying the Cube Class
public class Cube extends Object3d
Cube(Context iContext, Mesh iMesh , MeshEx iMeshEx, Texture[] iTextures, Material iMaterial,
Shader iShader)
{
super(iContext , iMesh , iMeshEx, iTextures, iMaterial, iShader);
}
Please download the sample project for this chapter from the Source Code/Download area of
apress.com to see other changes that have to be made to other classes.
 
Search WWH ::




Custom Search