Back to index

nux  3.0.0
Public Member Functions | Public Attributes
nux::MeshData Class Reference

#include <MeshData.h>

List of all members.

Public Member Functions

 MeshData ()
 ~MeshData ()
bool Allocate (int num_mesh_primitive, NuxMeshPrimitiveType primitive_type, int num_elements, int element_size)

Public Attributes

unsigned char * _vertex_data
unsigned char * _index_data
NuxMeshPrimitiveType _mesh_primitive_type
int _num_element
int _element_size
int _num_index
int _index_size

Detailed Description

Definition at line 20 of file MeshData.h.


Constructor & Destructor Documentation

Definition at line 7 of file MeshData.cpp.


Member Function Documentation

bool nux::MeshData::Allocate ( int  num_mesh_primitive,
NuxMeshPrimitiveType  primitive_type,
int  num_elements,
int  element_size 
)

Definition at line 22 of file MeshData.cpp.

  {
    NUX_RETURN_VALUE_IF_FALSE(num_element > 0, false);
    NUX_RETURN_VALUE_IF_FALSE(element_size > 0, false);

    NUX_SAFE_DELETE_ARRAY(_vertex_data);
    NUX_SAFE_DELETE_ARRAY(_index_data);

    _num_element = num_element;
    _element_size = element_size;

    _mesh_primitive_type = primitive_type;
    switch(primitive_type)
    {
    case NUX_MESH_TRIANGLE:
      _num_index = num_mesh_primitive * 3;
      break;

    case NUX_MESH_TRIANGLE_STRIP:
    case NUX_MESH_TRIANGLE_FAN:
      _num_index = num_mesh_primitive + 2;
      break;

    case NUX_MESH_LINE:
        _num_index = num_mesh_primitive * 2;
      break;

    case NUX_MESH_LINE_STRIP:
    case NUX_MESH_LINE_LOOP:
      _num_index = num_mesh_primitive + 1;
      break;

    case NUX_MESH_QUAD:
      _num_index = num_mesh_primitive * 4;
      break;

    case NUX_MESH_QUAD_STRIP:
      _num_index = num_mesh_primitive + 2;
      break;

    case NUX_MESH_POINT:
      _num_index = num_mesh_primitive;
      break;
    }
    _index_size = 4;

    _vertex_data = new unsigned char[num_element * element_size];
    _index_data = new unsigned char[_num_index * _index_size];

    return true;
  }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 33 of file MeshData.h.

Definition at line 30 of file MeshData.h.

Definition at line 35 of file MeshData.h.

Definition at line 31 of file MeshData.h.

Definition at line 32 of file MeshData.h.

Definition at line 34 of file MeshData.h.

Definition at line 29 of file MeshData.h.


The documentation for this class was generated from the following files: