VR-Forces 4.0.4 Class Documentation
Classes | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Friends
makVrv::DtOsgFileCache Class Reference

The OSG implementation of makVrv::DtOsgFileCache. More...

Inheritance diagram for makVrv::DtOsgFileCache:
Inheritance graph
[legend]

List of all members.

Classes

class  TextureCollection

Public Member Functions

virtual ~DtOsgFileCache ()
 CTOR.
virtual void releaseResources ()
 Release all rendering resources.
virtual void releaseResources (osg::State *state)
 Release all rendering resources.
osg::Node * readNodeFile (const std::string &inputFilename, const LoadFileOptions &loadFileOptions)
 Read a node file, provides options for controlling This is call is equivalent to osg::readNodeFile function with the options encoded in a options string.
osg::ref_ptr< osg::Node > findNodeFile (const std::string &inputFilename)
 Find a node file.
osg::Image * readImageFile (const std::string &inputFilename, const LoadFileOptions &loadFileOptions)
 Read a node file, provides options for controlling This is call is equivalent to osg::readImageFile function with the options encoded in a options string.
virtual osg::Texture * getTextureInstance (const std::string &filePath, osg::Texture::FilterMode minFilter, osg::Texture::FilterMode magFilter, osg::Texture::WrapMode s, osg::Texture::WrapMode t, const LoadFileOptions &loadFileOptions)
 Returns a cached texture instance, or a new copy of a texture if instancing is disabled; returns 0 if file failed to load.
virtual void encodeOptionsString (const LoadFileOptions &loadFileOptions, osgDB::ReaderWriter::Options &options) const
 Encode load file options into reader write options.
virtual void decodeOptions (const osgDB::ReaderWriter::Options &options, LoadFileOptions &loadFileOptions) const
 Decode reader write options into load file options.

Public Attributes

boost::signals2::signal< void(osg::Node
*, const std::string
&origFileName, const
std::string &actualFileName)> 
signal_nodeFileLoaded
 Signal emitted whenever a Node file is loaded from disk.
boost::signals2::signal< void(osg::Image
*, const std::string
&origFileName, const
std::string &actualFileName)> 
signal_imageFileLoaded
 Signal emitted whenever an image file is loaded from disk.
boost::signals2::signal< void(const
std::string &filename,
osgDB::ReaderWriter::ReadResult
&, const
osgDB::ReaderWriter::Options *)> 
signal_readNodeCallback
 Signaled emitted when osg calls readNodeFile.
boost::signals2::signal< void(const
std::string &filename,
osgDB::ReaderWriter::ReadResult
&, const
osgDB::ReaderWriter::Options *)> 
signal_readImageCallback
 Signaled emitted when osg calls readImageFile.

Protected Types

typedef boost::unordered_map
< std::string, std::string > 
RelativePathCache

Protected Member Functions

virtual osg::ref_ptr< osg::Node > ts_readNodeFile (const std::string &inputFilename, const LoadFileOptions &loadFileOptions)
 Thread safe Implementation of readNodeFile.
virtual osg::ref_ptr< osg::Node > ts_findNodeFile (const std::string &inputFilename)
 Thread safe Implementation of findNodeFile.
virtual osg::ref_ptr< osg::Image > ts_readImageFile (const std::string &inputFilename, const LoadFileOptions &loadFileOptions)
 Thread safe Implementation of readImageFile.
void ts_encryptImage (const std::string &inputFileName, const std::string &outputFilename, bool printToConsole)
 Thread safe implementation of encrypting an image.
bool ts_resolveRelativeFilename (const LoadFileOptions &loadFileOptions, std::string &absoluteInputFilename)
 Attempt to resolve the absolute input filename.
virtual void ts_clearInstancingCache ()
 Clear the model instance cache.
virtual void ts_flushInstancingCache (bool multipass, bool flushNodes, bool flushTextures, bool flushImages)
 Flush the instancing cache.
 DtOsgFileCache (DtDe &de)
 Protected CTOR. Must be called by creator.
std::string ts_buildAcceleratedFilename (const std::string &filePathIn, const std::string &cachedDir, const std::string &cachedExtension) const
 Build the cached filename for a file to be cached.
virtual bool save (const std::string &origFilename, const std::string &cachedFilename, bool optimize)
 Returns true if origFilename was successfully written out as cachedFilename.
bool shouldSaveFile (const std::string &filename)
 Should this file be saved as an accelerated file.
bool saveToAcceleratedFile (const std::string &origFileName, osg::Node *nodeRef, const std::string &cachedFilename, bool writeExternalReferences)
 Save the node to an accelerated file.
virtual void addMetaFlightOptions (std::string &optionsString)
 Add meta flight options to the option string.

Protected Attributes

DtOsgReferencedCollection
< osg::Node > 
myNodeCollection
DtOsgReferencedCollection
< TextureCollection
myTextureCollection
DtOsgReferencedCollection
< osg::Image > 
myImageCollection
unsigned int myMaxFlushTextureCount
unsigned int myMaxFlushNodeCount
unsigned int myMaxFlushImageCount
boost::mutex myRelativePathMutex
RelativePathCache myRelativePathCache
DtMeifConvertermyImageCompressor

Friends

class DtOsgFileCacheCreator
 This allows the protected constructor to be called by the DtOsgFileCacheCreator.
class DtReadFileCallback

Detailed Description

The OSG implementation of makVrv::DtOsgFileCache.

This will cache files as .ive's for quicker load times, except for files with an extension in the excluded extensions list.


Member Typedef Documentation

typedef boost::unordered_map<std::string,std::string> makVrv::DtOsgFileCache::RelativePathCache [protected]

Constructor & Destructor Documentation

CTOR.

Protected CTOR. Must be called by creator.


Member Function Documentation

virtual void makVrv::DtOsgFileCache::releaseResources ( ) [inline, virtual]

Release all rendering resources.

Reimplemented from makVrv::DtFileCache.

virtual void makVrv::DtOsgFileCache::releaseResources ( osg::State *  state) [virtual]

Release all rendering resources.

osg::Node* makVrv::DtOsgFileCache::readNodeFile ( const std::string &  inputFilename,
const LoadFileOptions loadFileOptions 
)

Read a node file, provides options for controlling This is call is equivalent to osg::readNodeFile function with the options encoded in a options string.

osg::ref_ptr<osg::Node> makVrv::DtOsgFileCache::findNodeFile ( const std::string &  inputFilename) [inline]

Find a node file.

If the file was already cached then a copy will be returned.

osg::Image* makVrv::DtOsgFileCache::readImageFile ( const std::string &  inputFilename,
const LoadFileOptions loadFileOptions 
)

Read a node file, provides options for controlling This is call is equivalent to osg::readImageFile function with the options encoded in a options string.

virtual osg::Texture* makVrv::DtOsgFileCache::getTextureInstance ( const std::string &  filePath,
osg::Texture::FilterMode  minFilter,
osg::Texture::FilterMode  magFilter,
osg::Texture::WrapMode  s,
osg::Texture::WrapMode  t,
const LoadFileOptions loadFileOptions 
) [virtual]

Returns a cached texture instance, or a new copy of a texture if instancing is disabled; returns 0 if file failed to load.

virtual void makVrv::DtOsgFileCache::encodeOptionsString ( const LoadFileOptions loadFileOptions,
osgDB::ReaderWriter::Options &  options 
) const [virtual]

Encode load file options into reader write options.

virtual void makVrv::DtOsgFileCache::decodeOptions ( const osgDB::ReaderWriter::Options &  options,
LoadFileOptions loadFileOptions 
) const [virtual]

Decode reader write options into load file options.

virtual osg::ref_ptr<osg::Node> makVrv::DtOsgFileCache::ts_readNodeFile ( const std::string &  inputFilename,
const LoadFileOptions loadFileOptions 
) [protected, virtual]

Thread safe Implementation of readNodeFile.

virtual osg::ref_ptr<osg::Node> makVrv::DtOsgFileCache::ts_findNodeFile ( const std::string &  inputFilename) [protected, virtual]

Thread safe Implementation of findNodeFile.

virtual osg::ref_ptr<osg::Image> makVrv::DtOsgFileCache::ts_readImageFile ( const std::string &  inputFilename,
const LoadFileOptions loadFileOptions 
) [protected, virtual]

Thread safe Implementation of readImageFile.

void makVrv::DtOsgFileCache::ts_encryptImage ( const std::string &  inputFileName,
const std::string &  outputFilename,
bool  printToConsole 
) [protected]

Thread safe implementation of encrypting an image.

bool makVrv::DtOsgFileCache::ts_resolveRelativeFilename ( const LoadFileOptions loadFileOptions,
std::string &  absoluteInputFilename 
) [protected]

Attempt to resolve the absolute input filename.

virtual void makVrv::DtOsgFileCache::ts_clearInstancingCache ( ) [protected, virtual]

Clear the model instance cache.

Reimplemented from makVrv::DtFileCache.

virtual void makVrv::DtOsgFileCache::ts_flushInstancingCache ( bool  multipass,
bool  flushNodes,
bool  flushTextures,
bool  flushImages 
) [protected, virtual]

Flush the instancing cache.

Reimplemented from makVrv::DtFileCache.

std::string makVrv::DtOsgFileCache::ts_buildAcceleratedFilename ( const std::string &  filePathIn,
const std::string &  cachedDir,
const std::string &  cachedExtension 
) const [protected]

Build the cached filename for a file to be cached.

Takes the path of the file being cached, and the extension that the cached version will have.

virtual bool makVrv::DtOsgFileCache::save ( const std::string &  origFilename,
const std::string &  cachedFilename,
bool  optimize 
) [protected, virtual]

Returns true if origFilename was successfully written out as cachedFilename.

bool makVrv::DtOsgFileCache::shouldSaveFile ( const std::string &  filename) [protected]

Should this file be saved as an accelerated file.

bool makVrv::DtOsgFileCache::saveToAcceleratedFile ( const std::string &  origFileName,
osg::Node *  nodeRef,
const std::string &  cachedFilename,
bool  writeExternalReferences 
) [protected]

Save the node to an accelerated file.

virtual void makVrv::DtOsgFileCache::addMetaFlightOptions ( std::string &  optionsString) [protected, virtual]

Add meta flight options to the option string.


Friends And Related Function Documentation

friend class DtOsgFileCacheCreator [friend]

This allows the protected constructor to be called by the DtOsgFileCacheCreator.

friend class DtReadFileCallback [friend]

Member Data Documentation

boost::signals2::signal<void (osg::Node*, const std::string& origFileName, const std::string& actualFileName)> makVrv::DtOsgFileCache::signal_nodeFileLoaded

Signal emitted whenever a Node file is loaded from disk.

When instancing is enabled then each file will only ever be loaded from disk once. Passes the node loaded, the original filename requested, and the actual filename loaded.

boost::signals2::signal<void (osg::Image*, const std::string& origFileName, const std::string& actualFileName)> makVrv::DtOsgFileCache::signal_imageFileLoaded

Signal emitted whenever an image file is loaded from disk.

When instancing is enabled then each file will only ever be loaded from disk once. Passes the node loaded, the original filename requested, and the actual filename loaded.

boost::signals2::signal<void (const std::string& filename, osgDB::ReaderWriter::ReadResult&,const osgDB::ReaderWriter::Options*)> makVrv::DtOsgFileCache::signal_readNodeCallback

Signaled emitted when osg calls readNodeFile.

This signal is emitted every time read image is called regardless of if the image was actually loaded or found in a cache.

boost::signals2::signal<void (const std::string& filename, osgDB::ReaderWriter::ReadResult&,const osgDB::ReaderWriter::Options*)> makVrv::DtOsgFileCache::signal_readImageCallback

Signaled emitted when osg calls readImageFile.

This signal is emitted every time read image is called regardless of if the image was actually loaded or found in a cache.


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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)