NvModel Class Reference
Non-rendering geometry model. More...
#include <NvModel.h>
Public Member Functions | |
const float * | getCompiledVertices () const |
Get the array of compiled vertices. | |
const uint32_t * | getCompiledIndices (NvModelPrimType::Enum &prim) const |
Get the array of compiled indices for the given prim type. | |
int32_t | getCompiledVertexSize () const |
Get the size of a compiled vertex. | |
int32_t | getCompiledVertexCount () const |
Get the count of vertices in the compiled array. | |
int32_t | getCompiledIndexCount (NvModelPrimType::Enum &prim) const |
The rendering index count. | |
void | getBoundingBox (nv::vec3f &minVal, nv::vec3f &maxVal) |
bool | WritePreprocessedModel (const char *filename) |
Write a loaded model to NVM format (Windows Only!). | |
bool | LoadPreprocessedModel (uint8_t *data) |
Load a preprocessed NVM model from preloaded data. | |
bool | LoadFromData (const float *verts, uint32_t vertCount, uint32_t vertSize, const uint32_t *indices, uint32_t indexCount, uint32_t posSize, int32_t posOffset, int32_t normOffset=-1, uint32_t uvSize=0, int32_t uvOffset=-1, int32_t tanOffset=-1, uint32_t colorSize=0, int32_t colorOffset=-1) |
Load model data into a model object (assumed to be triangle list). | |
int32_t | getPositionSize () const |
int32_t | getNormalSize () const |
int32_t | getTexCoordSize () const |
int32_t | getTangentSize () const |
int32_t | getColorSize () const |
int32_t | getCompiledPositionOffset () const |
int32_t | getCompiledNormalOffset () const |
int32_t | getCompiledTexCoordOffset () const |
int32_t | getCompiledTangentOffset () const |
int32_t | getCompiledColorOffset () const |
Static Public Member Functions | |
static NvModel * | CreateFromObj (uint8_t *data, float scale, bool computeNormals=false, bool computeTangents=false) |
Create a model from OBJ data. | |
static NvModel * | CreateFromPreprocessed (uint8_t *data) |
Create a model from a preprocessed "NVM" file, which is much faster and more efficient to load than OBJ. | |
static NvModel * | CreateFromData (const float *verts, uint32_t vertCount, uint32_t vertSize, const uint32_t *indices, uint32_t indexCount, uint32_t posSize, int32_t posOffset, int32_t normOffset=-1, uint32_t uvSize=0, int32_t uvOffset=-1, int32_t tanOffset=-1, uint32_t colorSize=0, int32_t colorOffset=-1) |
Protected Attributes | |
uint32_t * | _indices |
float * | _vertices |
int32_t | _pOffset |
int32_t | _nOffset |
int32_t | _tcOffset |
int32_t | _sTanOffset |
int32_t | _cOffset |
int32_t | _posSize |
int32_t | _tcSize |
int32_t | _cSize |
int32_t | _vtxSize |
int32_t | _vertexCount |
int32_t | _indexCount |
nv::vec3f | m_minExtent |
nv::vec3f | m_maxExtent |
Detailed Description
Non-rendering geometry model.Graphics-API-agnostic geometric model class, including model loading from OBJ file data, optimization, bounding volumes and rescaling. Can compute addition items such as facet normals and tangents as needed.
Member Function Documentation
static NvModel* NvModel::CreateFromObj | ( | uint8_t * | data, | |
float | scale, | |||
bool | computeNormals = false , |
|||
bool | computeTangents = false | |||
) | [static] |
Create a model from OBJ data.
- Parameters:
-
[in] data pointer to OBJ file data [in] scale the target radius to which we want the model scaled, or <0 if no scaling should be done [in] computeNormals indicate whether per-vertex normals should be estimated and added [in] computeTangents indicate whether per-vertex tangent vectors should be estimated and added
- Returns:
- a pointer to the new model
static NvModel* NvModel::CreateFromPreprocessed | ( | uint8_t * | data | ) | [static] |
Create a model from a preprocessed "NVM" file, which is much faster and more efficient to load than OBJ.
- Parameters:
-
[in] data pointer to NVM file data
- Returns:
- a pointer to the new model
int32_t NvModel::getColorSize | ( | ) | const |
Vertex data size queries.
- Returns:
- the number of elements per vertex for the given attribute (e.g. xyz positions are 3)
int32_t NvModel::getCompiledColorOffset | ( | ) | const |
Get the offset within the vertex of each attrib.
- Returns:
- the offset (in number of floats) of each attrib from the base of the vertex
int32_t NvModel::getCompiledIndexCount | ( | NvModelPrimType::Enum & | prim | ) | const |
The rendering index count.
- Parameters:
-
[out] prim the primitive type of the array whose length was returned
- Returns:
- the number of indices in the given array
const uint32_t* NvModel::getCompiledIndices | ( | NvModelPrimType::Enum & | prim | ) | const |
Get the array of compiled indices for the given prim type.
Computes and returns the array of indices with the cached primitive type
- Parameters:
-
[out] prim the primitive type for which indices have been generated
- Returns:
- pointer to the array of indices
int32_t NvModel::getCompiledNormalOffset | ( | ) | const |
Get the offset within the vertex of each attrib.
- Returns:
- the offset (in number of floats) of each attrib from the base of the vertex
int32_t NvModel::getCompiledPositionOffset | ( | ) | const |
Get the offset within the vertex of each attrib.
- Returns:
- the offset (in number of floats) of each attrib from the base of the vertex
int32_t NvModel::getCompiledTangentOffset | ( | ) | const |
Get the offset within the vertex of each attrib.
- Returns:
- the offset (in number of floats) of each attrib from the base of the vertex
int32_t NvModel::getCompiledTexCoordOffset | ( | ) | const |
Get the offset within the vertex of each attrib.
- Returns:
- the offset (in number of floats) of each attrib from the base of the vertex
int32_t NvModel::getCompiledVertexCount | ( | ) | const |
Get the count of vertices in the compiled array.
- Returns:
- the vertex count in the compiled (renderable) array
int32_t NvModel::getCompiledVertexSize | ( | ) | const |
Get the size of a compiled vertex.
- Returns:
- the size of the merged vertex (in number of floats)
const float* NvModel::getCompiledVertices | ( | ) | const |
Get the array of compiled vertices.
The array of the optimized, compiled vertices for rendering
- Returns:
- the pointer to the start of the first vertex
int32_t NvModel::getNormalSize | ( | ) | const |
Vertex data size queries.
- Returns:
- the number of elements per vertex for the given attribute (e.g. xyz positions are 3)
int32_t NvModel::getPositionSize | ( | ) | const |
Vertex data size queries.
- Returns:
- the number of elements per vertex for the given attribute (e.g. xyz positions are 3)
int32_t NvModel::getTangentSize | ( | ) | const |
Vertex data size queries.
- Returns:
- the number of elements per vertex for the given attribute (e.g. xyz positions are 3)
int32_t NvModel::getTexCoordSize | ( | ) | const |
Vertex data size queries.
- Returns:
- the number of elements per vertex for the given attribute (e.g. xyz positions are 3)
bool NvModel::LoadFromData | ( | const float * | verts, | |
uint32_t | vertCount, | |||
uint32_t | vertSize, | |||
const uint32_t * | indices, | |||
uint32_t | indexCount, | |||
uint32_t | posSize, | |||
int32_t | posOffset, | |||
int32_t | normOffset = -1 , |
|||
uint32_t | uvSize = 0 , |
|||
int32_t | uvOffset = -1 , |
|||
int32_t | tanOffset = -1 , |
|||
uint32_t | colorSize = 0 , |
|||
int32_t | colorOffset = -1 | |||
) |
Load model data into a model object (assumed to be triangle list).
- Parameters:
-
[in] verts pointer to an array of floats containing all vertex data [in] vertCount vertex count [in] vertSize size of vertex in floats [in] indices pointer to an array of 32-bit indices [in] indexCount index count [in] posSize size of each vertex position in floats [in] posOffset offset of the positions in floats within a vertex [in] normOffset offset of the normals in floats within a vertex (normals are assumed to be 3-vec) [in] uvSize size of each vertex UV in floats [in] uvOffset offset of the UVs in floats within a vertex [in] tanOffset offset of the tangents in floats within a vertex (tangents are assumed to be 3-vec) [in] colorSize size of each vertex color in floats [in] colorOffset offset of the colors in floats within a vertex
- Returns:
- true on success and false on failure
bool NvModel::LoadPreprocessedModel | ( | uint8_t * | data | ) |
Load a preprocessed NVM model from preloaded data.
- Parameters:
-
[in] data pointer to the model data
- Returns:
- true on success and false on failure
bool NvModel::WritePreprocessedModel | ( | const char * | filename | ) |
Write a loaded model to NVM format (Windows Only!).
- Parameters:
-
[in] filename the name/path to the file to be created
- Returns:
- true on success and false on failure
The documentation for this class was generated from the following file: