Newbie! Fmod with Ofusion

alexnode

05-12-2006 23:24:49

Hi i am trying to insert an ambient sound in a project that loads osm scenes. The problem is that i cannot attach the sound to a scenenode because i don't know how oFusion is naming the scene nodes. Is there any example that i could use? I used the demo Oscene loader and i added the fmod .h and .ccp files. If i create entities , scenenodes etc directly everything works but when i try to do it from the Oscene loader i can't call any scene node. And what if i want to move an object in the scene? How i could point to a mesh and have some fun?

....// Here is the code that will load the scene file
// A fixed filename "scene.osm" is implemented for this demo

// Create the scene loader
OSMScene oScene;

// Create an oE_Loader Callback object to post-process created objects
oSceneCallback oe_Callback;

// Initialises with the scene to be loaded and the callback if requiered
oScene.initialise("scene.osm", &oe_Callback);

// create and setup the scene in the root node
oScene.createScene();



int soundBoogie;
soundBoogie = soundMgr->CreateSound(String("boogie.ogg"));
int channelBoogie;
soundMgr->PlaySound(soundBoogie, sceneNode£"$^£$% , &channelBoogie);
...

any suggestions? i thought that sceneNode could work ...but it doesn't

Lioric

06-12-2006 14:49:49

In the OSMSceneCallbacks derived object that you are using, override the "OnNodeCreate" method, and your application will be notified of each scene node created, the scene node will be passed to the function, and you can get the node names

In the demo, the camera creation event is implemented, use this as example

alexnode

07-12-2006 17:27:15

Thanks Lioric...

I think that i am a bit confused ... and my C++ knowledge is quite limited


// Callback handler to post-process created objects
class oSceneCallback : public OSMSceneCallbacks {
public:

// We override the OnCreate method for cameras (See IXMLSceneCallbacks class)
void OnCameraCreate(Ogre::Camera* pCamera, TiXmlElement* pCameraDesc) {

// If a camera of name "FirstCamera" is loaded, it will be set as the default current
if(pCamera->getName() == "FirstCamera")
Ogre::Root::getSingleton().getAutoCreatedWindow()->getViewport(0)->setCamera(pCamera);


}
void OnNodeCreate(Ogre::Node* pNode, TiXmlElement* pNodeDesc); ??????????????????????????

};


should i do something like that ???

and then if(pNode->getName() == "myobject"
to get a node list ... do i have to create a getNodeList? ...

I understand that this is useful for the camera but i don't get the concept in depth ...


// Get the list of cameras loaded with the scene
OSMScene::CameraList camList = oScene.getCameraList();
if(!camList.empty()) {

// If loaded with the scene, set the first camera as the default camera
mCamera = camList[0];

// A viewport has been created and assigned to the first camera automatically
// (The TSM needs it to initialize the terrain world geometry)
}
else {

// Create a default camera in case no cameras were saved in the scene
...




I think that i have to read a bit first ...
i found this example which is interesting combining newton with osm ... i think that he does something similar.

http://www.ogre3d.org/phpBB2addons/view ... newton+osm

i will let you know when i figure out the solution ...