|
FloatBuffer | getBitangentBuffer () |
| Returns a buffer containing bitangents. More...
|
|
float | getBitangentX (int vertex) |
| Returns the x-coordinate of a vertex tangent. More...
|
|
float | getBitangentY (int vertex) |
| Returns the y-coordinate of a vertex tangent. More...
|
|
float | getBitangentZ (int vertex) |
| Returns the z-coordinate of a vertex tangent. More...
|
|
List< AiBone > | getBones () |
| Returns the bones of this mesh. More...
|
|
float | getColorA (int vertex, int colorset) |
| Returns the alpha color component of a color from a vertex color set. More...
|
|
float | getColorB (int vertex, int colorset) |
| Returns the blue color component of a color from a vertex color set. More...
|
|
FloatBuffer | getColorBuffer (int colorset) |
| Returns a buffer containing vertex colors for a color set. More...
|
|
float | getColorG (int vertex, int colorset) |
| Returns the green color component of a color from a vertex color set. More...
|
|
float | getColorR (int vertex, int colorset) |
| Returns the red color component of a color from a vertex color set. More...
|
|
IntBuffer | getFaceBuffer () |
| Returns a buffer containing face data. More...
|
|
int | getFaceNumIndices (int face) |
| Returns the number of vertex indices for a single face. More...
|
|
IntBuffer | getFaceOffsets () |
| Returns an index structure for the buffer returned by getFaceBuffer(). More...
|
|
int | getFaceVertex (int face, int n) |
| Returns a vertex reference from a face. More...
|
|
IntBuffer | getIndexBuffer () |
| Returns a buffer containing vertex indices for the mesh's faces. More...
|
|
int | getMaterialIndex () |
| Returns the material used by this mesh. More...
|
|
String | getName () |
| Returns the name of the mesh. More...
|
|
FloatBuffer | getNormalBuffer () |
| Returns a buffer containing normals. More...
|
|
float | getNormalX (int vertex) |
| Returns the x-coordinate of a vertex normal. More...
|
|
float | getNormalY (int vertex) |
| Returns the y-coordinate of a vertex normal. More...
|
|
float | getNormalZ (int vertex) |
| Returns the z-coordinate of a vertex normal. More...
|
|
int | getNumFaces () |
| Returns the number of faces in the mesh. More...
|
|
int | getNumUVComponents (int coords) |
| Returns the number of UV components for a texture coordinate set. More...
|
|
int | getNumVertices () |
| Returns the number of vertices in this mesh. More...
|
|
FloatBuffer | getPositionBuffer () |
| Returns a buffer containing vertex positions. More...
|
|
float | getPositionX (int vertex) |
| Returns the x-coordinate of a vertex position. More...
|
|
float | getPositionY (int vertex) |
| Returns the y-coordinate of a vertex position. More...
|
|
float | getPositionZ (int vertex) |
| Returns the z-coordinate of a vertex position. More...
|
|
Set< AiPrimitiveType > | getPrimitiveTypes () |
| Returns the primitive types used by this mesh. More...
|
|
FloatBuffer | getTangentBuffer () |
| Returns a buffer containing tangents. More...
|
|
float | getTangentX (int vertex) |
| Returns the x-coordinate of a vertex tangent. More...
|
|
float | getTangentY (int vertex) |
| Returns the y-coordinate of a vertex bitangent. More...
|
|
float | getTangentZ (int vertex) |
| Returns the z-coordinate of a vertex tangent. More...
|
|
FloatBuffer | getTexCoordBuffer (int coords) |
| Returns a buffer containing coordinates for a texture coordinate set. More...
|
|
float | getTexCoordU (int vertex, int coords) |
| Returns the u component of a coordinate from a texture coordinate set. More...
|
|
float | getTexCoordV (int vertex, int coords) |
| Returns the v component of a coordinate from a texture coordinate set. More...
|
|
float | getTexCoordW (int vertex, int coords) |
| Returns the w component of a coordinate from a texture coordinate set. More...
|
|
boolean | hasBones () |
| Tells whether the mesh has bones. More...
|
|
boolean | hasColors (int colorset) |
| Tells whether the mesh has a vertex color set. More...
|
|
boolean | hasFaces () |
| Tells whether the mesh has faces. More...
|
|
boolean | hasNormals () |
| Tells whether the mesh has normals. More...
|
|
boolean | hasPositions () |
| Tells whether the mesh has vertex positions. More...
|
|
boolean | hasTangentsAndBitangents () |
| Tells whether the mesh has tangents and bitangents. More...
|
|
boolean | hasTexCoords (int coords) |
| Tells whether the mesh has a texture coordinate set. More...
|
|
boolean | hasTexCoords () |
| Tells whether the mesh has any texture coordinate sets. More...
|
|
boolean | hasVertexColors () |
| Tells whether the mesh has any vertex colors. More...
|
|
boolean | isPureTriangle () |
| Tells whether the mesh is a pure triangle mesh, i.e., contains only triangular faces. More...
|
|
String | toString () |
|
A mesh represents a geometry or model with a single material.
Data
Meshes usually consist of a number of vertices and a series of faces referencing the vertices. In addition there might be a series of bones, each of them addressing a number of vertices with a certain weight. Vertex data is presented in channels with each channel containing a single per-vertex information such as a set of texture coordinates or a normal vector.
Faces consist of one or more references to vertices, called vertex indices. The getPrimitiveTypes() method can be used to check what face types are present in the mesh. Note that a single mesh can possess faces of different types. The number of indices used by a specific face can be retrieved with the getFaceNumIndices(int) method.
API for vertex and face data
The jassimp interface for accessing vertex and face data is not a one-to-one mapping of the c/c++ interface. The c/c++ interface uses an object-oriented approach to represent data, which provides a considerable overhead using a naive java based realization (cache locality would be unpredictable and most likely bad, bulk data transfer would be impossible).
The jassimp interface uses flat byte buffers to store vertex and face data. This data can be accessed through three APIs:
-
Buffer API: the
getXXXBuffer()
methods return raw data buffers.
-
Direct API: the
getXXX()
methods allow reading and writing of individual data values.
-
Wrapped API: the
getWrappedXXX()
methods provide an object oriented view on the data.
The Buffer API is optimized for use in conjunction with rendering APIs such as LWJGL. The returned buffers are guaranteed to have native byte order and to be direct byte buffers. They can be passed directly to LWJGL methods, e.g., to fill VBOs with data. Each invocation of a getXXXBuffer()
method will return a new view of the internal buffer, i.e., if is safe to use the relative byte buffer operations. The Buffer API provides the best performance of all three APIs, especially if large data volumes have to be processed.
The Direct API provides an easy to use interface for reading and writing individual data values. Its performance is comparable to the Buffer API's performance for these operations. The main difference to the Buffer API is the missing support for bulk operations. If you intend to retrieve or modify large subsets of the raw data consider using the Buffer API, especially if the subsets are contiguous.
The Wrapped API offers an object oriented interface for accessing and modifying mesh data. As the name implies, this interface is realized through wrapper objects that provide a view on the raw data. For each invocation of a getWrappedXXX()
method, a new wrapper object is created. Iterating over mesh data via this interface will create many short-lived wrapper objects which -depending on usage and virtual machine- may cause considerable garbage collection overhead. The Wrapped API provides the worst performance of all three APIs, which may nevertheless still be good enough to warrant its usage. See AiWrapperProvider for more details on wrappers.
API for bones
As there is no standardized way for doing skinning in different graphics engines, bones are not represented as flat buffers but as object structure. Users of this library should convert this structure to the format required by the specific graphics engine.
Changing Data
This class is designed to be mutable, i.e., the returned objects and buffers may be modified. It is not possible to add/remove vertices as this would require reallocation of the data buffers. Wrapped objects may or may not propagate changes to the underlying data buffers. Consult the documentation of your wrapper provider for details. The built in wrappers will propagate changes.
Modification of face data is theoretically possible by modifying the face buffer and the faceOffset buffer however it is strongly disadvised to do so because it might break all algorithms that depend on the internal consistency of these two data structures.