//This is our class extension for handling callback events- class oSceneCallback : public OSMSceneCallbacks { public: //Store our function pointers in the class- void(*nodeFunc)(Ogre::SceneNode*); void(*entityFunc)(Ogre::Entity*); void(*cameraFunc)(Ogre::Camera*); void(*lightFunc)(Ogre::Light*); void(*helperFunc)(Ogre::SceneNode*); void(*shapeFunc)(Ogre::SimpleSpline*); void(*staticGeometryFunc)(Ogre::StaticGeometry*); //Our callback methods- void OnNodeCreate(Ogre::SceneNode *pNode, TiXmlElement* pNodeDesc) { nodeFunc(pNode); } void OnEntityCreate(Ogre::Entity *pEntity, TiXmlElement* pEntityDesc) { entityFunc(pEntity); } void OnCameraCreate(Ogre::Camera *pCamera, TiXmlElement* pCameraDesc) { cameraFunc(pCamera); } void OnLightCreate(Ogre::Light *pLight, TiXmlElement* pLightDesc) { lightFunc(pLight); } void OnHelperCreated(Ogre::SceneNode* pHelper, TiXmlElement* pHelperDesc) { helperFunc(pHelper); } void OnShapeLoaded(const Ogre::SimpleSpline& spline) { //We'll backburner this for now- //When there's a need for splines, we can copy all used splines then return poitners to them- //Ogre::SimpleSpline* temp = new Ogre::SimpleSpline; //temp = spline; //shapeFunc(temp); //Need a way to detect and free, though- } bool OnStaticGeometryCreated(Ogre::StaticGeometry* pStatic, const NodeList& nodeList) { staticGeometryFunc(pStatic); return true; } }; //OSMSCENE->Create OSMScene* OSMSCENE_Create( Ogre::SceneManager* ogreSceneManager = 0 , Ogre::RenderWindow* ogreRenderWindow = 0 ) { OSMScene* scene = new OSMScene( ogreSceneManager , ogreRenderWindow ); return scene; } //OSMSCENE->Destroy void OSMSCENE_Destroy( OSMScene* scene ) { delete scene; } //OSMSCENE->initialize void OSMSCENE_initialise( const char* filename , oSceneCallback* callback , OSMScene* scene ) { scene->initialise( filename , callback ); } //OSMSCENE->createScene void OSMSCENE_createScene( OSMScene* scene , Ogre::SceneNode* ogreSceneNode = 0 ) { scene->createScene( ogreSceneNode ); } //OSMSCENE->getSceneManager Ogre::SceneManager* OSMSCENE_getSceneManager( OSMScene* scene ) { return scene->getSceneManager(); } //OSMSCENE->callback extension void OSMSCENE_registerFunctions( void (*blitzNodeFunc)(Ogre::SceneNode*) , void (*blitzEntityFunc)(Ogre::Entity*) , void (*blitzCameraFunc)(Ogre::Camera*) , void (*blitzLightFunc)(Ogre::Light*) , void (*blitzHelperFunc)(Ogre::SceneNode*) , void (*blitzShapeFunc)(Ogre::SimpleSpline* ), void (*blitzStaticGeometryFunc)(Ogre::StaticGeometry*), oSceneCallback* pointer) { pointer->nodeFunc = blitzNodeFunc; pointer->entityFunc = blitzEntityFunc; pointer->cameraFunc = blitzCameraFunc; pointer->lightFunc = blitzLightFunc; pointer->helperFunc = blitzHelperFunc; pointer->shapeFunc = blitzShapeFunc; pointer->staticGeometryFunc = blitzStaticGeometryFunc; } // Here we create an instance of our callback object- oSceneCallback* OSMSCENE_createCallback() { oSceneCallback* callback = new oSceneCallback; return callback; } // and here's the function to delete it- void OSMSCENE_deleteCallback( oSceneCallback* callback ) { delete callback; }