vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
APSpacePartitioning::GeometryLoaderBase Class Reference

#include <GeometryLoaderBase.h>

Inheritance diagram for APSpacePartitioning::GeometryLoaderBase:
APSpacePartitioning::PointShellGeneric_Object_Data< _NodeType > APSpacePartitioning::SphereBVH_Object_Data APSpacePartitioning::VoxelGrid_Object_Data APSpacePartitioning::PointShellGeneric_Object_Data< PointShell_SimpleNode > APSpacePartitioning::SNCH_Object_Data APSpacePartitioning::PointShell_Object_Data

Classes

struct  FaceBase
 
struct  VertexBase
 

Public Member Functions

 GeometryLoaderBase ()
 
 ~GeometryLoaderBase ()
 
virtual bool loadXMLParameters (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node)
 
virtual bool loadGeometry (osg::Node *pNode)
 
virtual unsigned long getVertexStructureSize ()
 
virtual void allocateVertexArray (unsigned long numVertices)
 
virtual void deallocateVertexArray ()
 
virtual bool saveVerticesToFile (vrecko::BufferedFileWrite *bfile)
 
virtual bool loadVerticesFromFile (vrecko::BufferedFile *bfile)
 
virtual unsigned long getFaceStructureSize ()
 
virtual void allocateFaceArray (unsigned long numFaces)
 
virtual void deallocateFaceArray ()
 
virtual bool saveFacesToFile (vrecko::BufferedFileWrite *bfile)
 
virtual bool loadFacesFromFile (vrecko::BufferedFile *bfile)
 
void * getFace (unsigned long index)
 
void * getVertex (unsigned long index)
 
unsigned long getFaceCount ()
 
unsigned long getVertexCount ()
 
void debugWriteNormals ()
 

Protected Member Functions

bool getOSGInitCounts (osg::Node *pNode, unsigned long &pVertexCount, unsigned long &pPrimitiveCount)
 
bool loadGeometryHelper (osg::Node *pNode, osg::Matrix &transform, unsigned long &vertex_pos, unsigned long &face_pos)
 
void sortVerticesClockwise ()
 
virtual void destroyGeometry ()
 
void recalculateNormals ()
 
osg::Vec3 * getNormalByIndex (osg::Geometry::AttributeBinding normalBinding, osg::Vec3Array *pNormArray, osg::IndexArray *pNormIndices, unsigned long index)
 

Protected Attributes

void * faces
 
unsigned long face_count
 
unsigned long face_size
 
void * vertices
 
unsigned long vertex_count
 
unsigned long vertex_size
 
bool bRecalculateNormals
 

Detailed Description

Basic class to load geometry from OpenSceneGraph node

Idea : This class contains the basic loading routines. Descendant classes can create their descendant versions of VertexBase and FaceBase classes but in that case it is IMPORTANT to also override methods that take care of allocation and returns the correct size of the used structure! You have to also call destroyGeometry() in your destructor (of the GeometryLoaderBase descendant).

Constructor & Destructor Documentation

SPACEPARTITIONING_IMP_EXP APSpacePartitioning::GeometryLoaderBase::GeometryLoaderBase ( )
SPACEPARTITIONING_IMP_EXP APSpacePartitioning::GeometryLoaderBase::~GeometryLoaderBase ( )

Don't forget to call destroyGeometry() in your destructor.

Member Function Documentation

virtual void APSpacePartitioning::GeometryLoaderBase::allocateFaceArray ( unsigned long  numFaces)
inlinevirtual

allocate space required for storing the faces

Reimplemented in APSpacePartitioning::SNCH_Object_Data.

virtual void APSpacePartitioning::GeometryLoaderBase::allocateVertexArray ( unsigned long  numVertices)
inlinevirtual

allocates the memory needed for storing the vhole structure

Reimplemented in APSpacePartitioning::SNCH_Object_Data.

virtual void APSpacePartitioning::GeometryLoaderBase::deallocateFaceArray ( )
inlinevirtual

deallocate the space required for faces

Reimplemented in APSpacePartitioning::SNCH_Object_Data.

virtual void APSpacePartitioning::GeometryLoaderBase::deallocateVertexArray ( )
inlinevirtual

deallocate the unnecessary space

Reimplemented in APSpacePartitioning::SNCH_Object_Data.

SPACEPARTITIONING_IMP_EXP void APSpacePartitioning::GeometryLoaderBase::debugWriteNormals ( )

writes out the normals

SPACEPARTITIONING_IMP_EXP void APSpacePartitioning::GeometryLoaderBase::destroyGeometry ( )
protectedvirtual

Deallocates loaded faces/vertices

void* APSpacePartitioning::GeometryLoaderBase::getFace ( unsigned long  index)
inline

returns specified face

unsigned long APSpacePartitioning::GeometryLoaderBase::getFaceCount ( )
inline

returns total count of faces

virtual unsigned long APSpacePartitioning::GeometryLoaderBase::getFaceStructureSize ( )
inlinevirtual

returns the size of structure of stored faces

Reimplemented in APSpacePartitioning::SNCH_Object_Data.

osg::Vec3* APSpacePartitioning::GeometryLoaderBase::getNormalByIndex ( osg::Geometry::AttributeBinding  normalBinding,
osg::Vec3Array *  pNormArray,
osg::IndexArray *  pNormIndices,
unsigned long  index 
)
inlineprotected
SPACEPARTITIONING_IMP_EXP bool APSpacePartitioning::GeometryLoaderBase::getOSGInitCounts ( osg::Node *  pNode,
unsigned long &  pVertexCount,
unsigned long &  pPrimitiveCount 
)
protected

Returns counts of vertices and primitives stored in OSG node.

void* APSpacePartitioning::GeometryLoaderBase::getVertex ( unsigned long  index)
inline

returns specified vertex

unsigned long APSpacePartitioning::GeometryLoaderBase::getVertexCount ( )
inline

returns total count of vertices

virtual unsigned long APSpacePartitioning::GeometryLoaderBase::getVertexStructureSize ( )
inlinevirtual

returns the size of structure of stored vertices

Reimplemented in APSpacePartitioning::SNCH_Object_Data.

SPACEPARTITIONING_IMP_EXP bool APSpacePartitioning::GeometryLoaderBase::loadFacesFromFile ( vrecko::BufferedFile bfile)
virtual

loads the faces to separate file

Reimplemented in APSpacePartitioning::SNCH_Object_Data.

SPACEPARTITIONING_IMP_EXP bool APSpacePartitioning::GeometryLoaderBase::loadGeometry ( osg::Node *  pNode)
virtual

Fills the buffers with vertices and faces loaded from a given OSG node.

SPACEPARTITIONING_IMP_EXP bool APSpacePartitioning::GeometryLoaderBase::loadGeometryHelper ( osg::Node *  pNode,
osg::Matrix &  transform,
unsigned long &  vertex_pos,
unsigned long &  face_pos 
)
protected

For details contact Vit Kovalcik

SPACEPARTITIONING_IMP_EXP bool APSpacePartitioning::GeometryLoaderBase::loadVerticesFromFile ( vrecko::BufferedFile bfile)
virtual

load the vertice from separate file

Reimplemented in APSpacePartitioning::SNCH_Object_Data.

SPACEPARTITIONING_IMP_EXP bool APSpacePartitioning::GeometryLoaderBase::loadXMLParameters ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *  node)
virtual
SPACEPARTITIONING_IMP_EXP void APSpacePartitioning::GeometryLoaderBase::recalculateNormals ( )
protected

Ignores the old normals and creates new ones.

SPACEPARTITIONING_IMP_EXP bool APSpacePartitioning::GeometryLoaderBase::saveFacesToFile ( vrecko::BufferedFileWrite bfile)
virtual

saves the faces to separate file

Reimplemented in APSpacePartitioning::SNCH_Object_Data.

SPACEPARTITIONING_IMP_EXP bool APSpacePartitioning::GeometryLoaderBase::saveVerticesToFile ( vrecko::BufferedFileWrite bfile)
virtual

saving the vertices to separate file

Reimplemented in APSpacePartitioning::SNCH_Object_Data.

SPACEPARTITIONING_IMP_EXP void APSpacePartitioning::GeometryLoaderBase::sortVerticesClockwise ( )
protected

Iterates throught all the faces and sorts vIndex-es clockwise

Member Data Documentation

bool APSpacePartitioning::GeometryLoaderBase::bRecalculateNormals
protected

denotes whether to recalculate normals or take the one that come with the source file

unsigned long APSpacePartitioning::GeometryLoaderBase::face_count
protected

total count of faces

unsigned long APSpacePartitioning::GeometryLoaderBase::face_size
protected

cached number from getFaceStructureSize()

void* APSpacePartitioning::GeometryLoaderBase::faces
protected
unsigned long APSpacePartitioning::GeometryLoaderBase::vertex_count
protected

total count of vertices

unsigned long APSpacePartitioning::GeometryLoaderBase::vertex_size
protected

cached number from getVertexStructureSize()

void* APSpacePartitioning::GeometryLoaderBase::vertices
protected

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