All pastes #261939 Raw Edit

Unnamed

public cpp v1 · immutable
#261939 ·published 2006-11-30 00:03 UTC
rendered paste body
//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->CreateOSMScene* OSMSCENE_Create( Ogre::SceneManager* ogreSceneManager = 0 , Ogre::RenderWindow* ogreRenderWindow = 0 ){	OSMScene* scene = new OSMScene( ogreSceneManager , ogreRenderWindow );	return scene;}//OSMSCENE->Destroyvoid OSMSCENE_Destroy( OSMScene* scene ){	delete scene;}//OSMSCENE->initializevoid OSMSCENE_initialise( const char* filename , oSceneCallback* callback , OSMScene* scene ){	scene->initialise( filename , callback );}//OSMSCENE->createScenevoid OSMSCENE_createScene( OSMScene* scene , Ogre::SceneNode* ogreSceneNode = 0 ){	scene->createScene( ogreSceneNode );}//OSMSCENE->getSceneManagerOgre::SceneManager* OSMSCENE_getSceneManager( OSMScene* scene ){	return scene->getSceneManager();}//OSMSCENE->callback extensionvoid 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;}