Public Types | Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes

graph::ModelCache Class Reference

Cache of 3D models (avoids re-loading the same 3D model files). More...

#include <_src_graph_model_cache.hh>

List of all members.

Public Types

enum  { LOAD_SHARED, LOAD_COPY }

Public Member Functions

 DEFINE_GetInstance (ModelCache) shptr< Graph > LoadModel(const string &modelFilename
shptr< GraphLoadModel (const string &modelFilename, const fp modelScale=1.0f, const bool loadCopy=false)
void Flush (void)

Public Attributes

const Meter modelLength
const Meter const GeoVertex & modelOffset
const Meter const GeoVertex
const RotationList
rotationList
const Meter const GeoVertex
const RotationList const fp 
modelScale = 1.0f
const Meter const GeoVertex
const RotationList const fp
const bool 
loadCopy = false )

Private Types

typedef std::map< string,
RefPtr< osg::Node > > 
ModelMap

Private Member Functions

 ModelCache (void)
 ~ModelCache ()
RefPtr< osg::Node > LoadModelIntoNode (const string &modelFilename, const bool loadCopy)
RefPtr< osg::Node > LoadModelIntoNode2 (const string &modelFilename)
RefPtr< osg::MatrixTransform > LoadModelIntoTransform (const string &modelFilename, const bool loadCopy)
RefPtr0< osg::Node > ReadNodeFile (const string &pathname)

Private Attributes

CLASS_VAR ModelCachemsInstance
ModelMap mModelMap
 maps filename and node containing 3D model

Detailed Description

Cache of 3D models (avoids re-loading the same 3D model files).

Since a 3D model may be cached, its osg::Node may be shared by multiple parents. The reason a 3D model can exist in multiple locations is because its shared node is placed under separate transform nodes.


Member Typedef Documentation

typedef std::map<string,RefPtr<osg::Node> > graph::ModelCache::ModelMap [private]

Member Enumeration Documentation

anonymous enum
Enumerator:
LOAD_SHARED 
LOAD_COPY 

Constructor & Destructor Documentation

graph::ModelCache::ModelCache ( void   )  [private]

ctor/dtor.

graph::ModelCache::~ModelCache (  )  [private]

Member Function Documentation

graph::ModelCache::DEFINE_GetInstance ( ModelCache   )  const
void graph::ModelCache::Flush ( void   ) 

Flush the cache of 3D models. Cache should be flushed before reloading the scene when any 3D models were modified externally.

shptr< Graph > graph::ModelCache::LoadModel ( const string &  modelFilename,
const fp  scale = 1.0f,
const bool  loadCopy = false 
)

Directly load a cached 3D model else THROW EXCEPTION.

RefPtr< osg::Node > graph::ModelCache::LoadModelIntoNode ( const string &  modelFilename,
const bool  loadCopy 
) [private]

Private subroutines.

RefPtr< osg::Node > graph::ModelCache::LoadModelIntoNode2 ( const string &  modelFilename  )  [private]
RefPtr< osg::MatrixTransform > graph::ModelCache::LoadModelIntoTransform ( const string &  modelFilename,
const bool  loadCopy 
) [private]
RefPtr0< osg::Node > graph::ModelCache::ReadNodeFile ( const string &  pathname  )  [private]

Low-level function to read a compressed/uncompressed model file.


Member Data Documentation

const Meter const GeoVertex const RotationList const fp const bool graph::ModelCache::loadCopy = false )

maps filename and node containing 3D model

const Meter const GeoVertex& graph::ModelCache::modelOffset
const Meter const GeoVertex const RotationList const fp graph::ModelCache::modelScale = 1.0f
const Meter const GeoVertex const RotationList& graph::ModelCache::rotationList

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Palomino Flight Simulator documents generated by doxygen 1.7.1 on Tue May 15 2012 22:40:11