org.rajawali3d / Geometry3D

Geometry3D

open class Geometry3D
open class Geometry3D

This is where the vertex, normal, texture coordinate, color and index data is stored. The data is stored in FloatBuffers, IntBuffers and ShortBuffers. The data is uploaded to the graphics card using Vertex Buffer Objects (VBOs). The data in the FloatBuffers is kept in memory in order to restore the VBOs when the OpenGL context needs to be restored (typically when the application regains focus).

An object's Geometry3D and its data can be accessed by calling the getGeometry() and its methods:

 // Get the geometry instance
  Geometry3D geom = mMyObject3D.getGeometry();
  // Get vertices (x, y, z)
  FloatBuffer verts = geom.getVertices();
  // Get normals (x, y, z)
  FloatBuffer normals = geom.getNormals();
  // Get texture coordinates (u, v)
  FloatBuffer texCoords = geom.getTextureCoords();
  // Get colors (r, g, b, a)
  FloatBuffer colors = geom.getColors();
  // Get indices.
  IntBuffer indices = geom.getIndices();
  

Author
dennis.ippel