Game Development Reference
In-Depth Information
The Camera class also provides functions to retrieve the frustrum width, height, and depth (see
Listing 4-28).
Listing 4-28. Camera Frustrum Parameters
// Camera Dimensions
float GetCameraViewportWidth() {return (Math.abs(m_Projleft-m_Projright));}
float GetCameraViewportHeight(){return (Math.abs(m_Projtop-m_Projbottom));}
float GetCameraViewportDepth(){return (Math.abs(m_Projfar-m_Projnear));}
There are also many functions to access private variables within the Camera class, such as variables
related to orientation, camera vectors, camera frustrum information, and the camera's projection and
view matrices (see Listing 4-29).
Listing 4-29. Functions to Access Private Variables
// Get Orientation
Orientation GetOrientation() {return m_Orientation;}
// Camera Vectors
Vector3 GetCameraEye() {return m_Eye;}
Vector3 GetCameraLookAtCenter() {return m_Center;}
Vector3 GetCameraUp(){return m_Up;}
// Camera Frustrum
float GetProjLeft(){return m_Projleft;}
float GetProjRight(){return m_Projright;}
float GetProjBottom() {return m_Projbottom;}
float GetProjTop(){return m_Projtop;}
float GetProjNear(){return m_Projnear;}
float GetProjFar(){return m_Projfar;}
// Camera Matrices
float[] GetProjectionMatrix(){return m_ProjectionMatrix;}
float[] GetViewMatrix(){return m_ViewMatrix;}
The 3D Object Mesh
In this section, I discuss in detail the individual components of a 3D object, such as an object's
vertices, and how exactly these vertices are rendered using OpenGL ES for Android.
Mesh Vertex Data
A 3D object in OpenGL is composed of vertices. Each vertex can have various attributes, such as
vertex position, vertex texture coordinates, and a vertex normal (see Figure 4-17 ).
 
Search WWH ::




Custom Search