#include <PlugInterface.h>
Inheritance diagram for nvsg::SceneLoader:
Public Member Functions | |
virtual NVSG_API const Scene * | load (const std::string &filename, const std::vector< std::string > &searchPaths, const ViewState *&viewState)=0 |
Loading a scene. | |
Protected Member Functions | |
virtual NVSG_API | ~SceneLoader () |
Protected virtual destructor. |
User defined NVSG scene loader plug-ins must provide the SceneLoader
interface.
SceneLoader
interface should first query for a unique plug interface type ID through a call to nvutil::queryInterfaceType
. The unique plug interface type ID for a SceneLoader will be constructed from the UPITID_SCENE_SAVER
define and the actual NVSG version, which is coded in the UPITID_VERSION define, as shown in the code snippet below. A call to nvutil::queryInterfaceType
returns a list of all unique interface IDs (UPIIDSs) found at given search paths.nvutil::getInterface
.nvutil::releaseInterface:
// Example: // -------- // Get a scene loader interface capable to load 'nvb' files // vector<string> searchPathes; // Add appropriate search paths here. Not relevant for the example here. // ... // define the unique plug interface type ID for SceneLoaders const nvutil::UPITID PITID_SCENE_LOADER(UPITID_SCENE_LOADER, UPITID_VERSION); nvsg::Scene * theScene = NULL; nvsg::ViewState * viewState = NULL; nvutil::UPIID nvbLoaderInterfaceID; bool foundAppropriate = false; vector<nvutil::UPIID> piids; if ( nvutil::queryInterfaceType(searchPathes, PITID_SCENE_LOADER, piids) ) { vector<nvutil::UPIID>::iterator it = piids.begin(); for ( ; it != piids.end(); ++it ) { if ( !stricmp((*it).getPlugSpecificIDString(), ".nvb") ) { // found, copy the ID nvbLoaderInterfaceID = *it; foundAppropriate = true; break; // look no further } } if ( foundAppropriate ) { nvutil::PlugIn * plug; if ( nvutil::getInterface(searchPathes, nvbLoaderInterfaceID, plug) ) { nvsg::SceneLoader * loader = reinterpret_cast<SceneLoader*>(plug); theScene = loader->load("c:\\nvb\\sample.nvb", searchPathes, viewState); if ( theScene ) { theScene->addRef(); if ( viewState ) { viewState->addRef(); } } nvutil::releaseInterface(nvbLoaderInterfaceID); } } }
|
Protected virtual destructor. Prohibits ordinary client code from
|
|
Loading a scene. Loads an NVSG scene from a file specified by filename. The function tries to look up this file as follows:
|