Problem load .osm file

Allfreeware

24-09-2007 22:29:41

Hi all.
I've a proble importing my scene in the project,i've read the tutorial of Ofusion so i've create a project with the code in the tutorial but i give some error,this's the code:

#include "ExampleApplication.h"
#include "OgreOSMScene.h"
#include "tinyxml.h"

class TutorialApplication : public ExampleApplication
{
protected:
public:
TutorialApplication()
{
}

~TutorialApplication()
{
}
protected:
void createScene(void)
{
OSMScene oScene;
oSceneCallback oe_Callback
oScene.initialise("C:\****\file.osm", &oe_Callback);
oScene.createScene();
mSceneMgr = oScene.getSceneManager();
}
};

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"

INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char **argv)
#endif
{
// Create application object
TutorialApplication app;

try {
app.go();
} catch( Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
fprintf(stderr, "An exception has occurred: %s\n",
e.getFullDescription().c_str());
#endif
}

return 0;
}


Include file:
-ExampleApplication.h
-OgreOSMScene.h
-tinyxml.h

When i try to generate this i give this error:


1>------ Inizio generazione: Progetto: prova_world, Configurazione: Debug Win32 ------
1>Compilazione in corso...
1>prova_world_1.cpp
1>c:\documents and settings\jacopo\documenti\visual studio 2005\projects\prova_world\prova_world\prova_world_1.cpp(21) : warning C4129: 'D': sequenza di caratteri di escape sconosciuta
1>c:\documents and settings\jacopo\documenti\visual studio 2005\projects\prova_world\prova_world\prova_world_1.cpp(21) : warning C4129: 'J': sequenza di caratteri di escape sconosciuta
1>c:\documents and settings\jacopo\documenti\visual studio 2005\projects\prova_world\prova_world\prova_world_1.cpp(21) : warning C4129: 'D': sequenza di caratteri di escape sconosciuta
1>c:\documents and settings\jacopo\documenti\visual studio 2005\projects\prova_world\prova_world\prova_world_1.cpp(21) : error C2065: 'oSceneCallback': identificatore non dichiarato
1>c:\documents and settings\jacopo\documenti\visual studio 2005\projects\prova_world\prova_world\prova_world_1.cpp(21) : error C2146: errore di sintassi: ';' mancante prima dell'identificatore 'oe_Callback'
1>c:\documents and settings\jacopo\documenti\visual studio 2005\projects\prova_world\prova_world\prova_world_1.cpp(21) : error C2065: 'oe_Callback': identificatore non dichiarato
1>c:\documents and settings\jacopo\documenti\visual studio 2005\projects\prova_world\prova_world\prova_world_1.cpp(21) : error C2146: errore di sintassi: ';' mancante prima dell'identificatore 'oScene'
1>Il log di generazione è stato salvato in 'file://c:\Documents and Settings\Jacopo\Documenti\Visual Studio 2005\Projects\prova_world\prova_world\obj\Debug\BuildLog.htm'
1>prova_world - 4 errore/i, 3 avviso/i
========== Generazione: 0 completate, 1 non riuscite, 0 aggiornate, 0 ignorate ==========


What i've wrong?
Thanks.

mr.Zog

25-09-2007 08:07:13

I think I found two things:

oSceneCallback oe_Callback
";" at the end is missing.


Second, if you use a oSceneCallback, you have to create one yourself (I remember it being an interface...)

Allfreeware

25-09-2007 15:40:16

I think I found two things:

oSceneCallback oe_Callback
";" at the end is missing.


Second, if you use a oSceneCallback, you have to create one yourself (I remember it being an interface...)


How can i do it?

Can post an example code please?
Thanks. :( :?

mr.Zog

25-09-2007 22:41:30

It depends if you really need the custom callbacks.
if not, simply leave it away. (just write oScene.initialise("scene.osm"); )


If you do need it, create a class something like this one:


#ifndef __OSMSCENEGRAPHICSCREATECALLBACK_H__
#define __OSMSCENEGRAPHICSCREATECALLBACK_H__

#include "IOSMSceneCallbacks.h"

class OSMSceneGraphicsCreateCallback : public OSMSceneCallbacks
{
public:
OSMSceneGraphicsCreateCallback();
~OSMSceneGraphicsCreateCallback();

//------------------------------------------
//OSM specific callbacks:
// Called when a node has been created
virtual void OnEntityCreate(Ogre::Entity *pEntity, TiXmlElement* pEntityDesc);

// Called when a node has been created
virtual void OnNodeCreate(Ogre::SceneNode *pNode, TiXmlElement* pNodeDesc);
//------------------------------------------
};

#endif



The implementation file would look something like this:

#include <ogreentity.h>
#include <ogrescenenode.h>

#include "OSMSceneGraphicsCreateCallback.h"


OSMSceneGraphicsCreateCallback::OSMSceneGraphicsCreateCallback()
{
}

OSMSceneGraphicsCreateCallback::~OSMSceneGraphicsCreateCallback()
{
}


void OSMSceneGraphicsCreateCallback::OnEntityCreate(Ogre::Entity *pEntity, TiXmlElement* pEntityDesc)
{
//do something
}

void OSMSceneGraphicsCreateCallback::OnNodeCreate(Ogre::SceneNode *pNode, TiXmlElement* pNodeDesc)
{
//do something
}


In the help doc, you can see what callbacks there are.
Some of them are for the pro version only (like the helper callback - since the communityversion cannot export helper object - which is one main reason for me to try to convince my university for getting some licenses ;) )


Then, load the osm like this:

.
.
.
OSMSceneGraphicsCreateCallback *osmCallback = new OSMSceneGraphicsCreateCallback();

oScene->initialise( "level.osm", osmCallback );
.
.
.



But as I said, you don't need callbacks!

Allfreeware

26-09-2007 14:25:53

Thanks for the quick replay.
So for the moment i've remove the Callback.
But now appear another error :D

Now this's the code

#include "ExampleApplication.h"
#include "OgreOSMScene.h"
#include "tinyxml.h"

class TutorialApplication : public ExampleApplication
{
protected:
public:
TutorialApplication()
{
}

~TutorialApplication()
{
}
protected:
void createScene(void)
{
OSMScene oScene;
oScene.initialise("scenario.osm");
oScene.createScene();
mSceneMgr = oScene.getSceneManager();
}
};

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"

INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char **argv)
#endif
{
// Create application object
TutorialApplication app;

try {
app.go();
} catch( Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
fprintf(stderr, "An exception has occurred: %s\n",
e.getFullDescription().c_str());
#endif
}

return 0;
}


When i try to run it i give this error:


1>prova_3.obj : error LNK2019: riferimento al simbolo esterno "public: __thiscall OSMScene::~OSMScene(void)" (??1OSMScene@@QAE@XZ) non risolto nella funzione "protected: virtual void __thiscall TutorialApplication::createScene(void)" (?createScene@TutorialApplication@@MAEXXZ)
1>prova_3.obj : error LNK2019: riferimento al simbolo esterno "public: bool __thiscall OSMScene::createScene(class Ogre::SceneNode *)" (?createScene@OSMScene@@QAE_NPAVSceneNode@Ogre@@@Z) non risolto nella funzione "protected: virtual void __thiscall TutorialApplication::createScene(void)" (?createScene@TutorialApplication@@MAEXXZ)
1>prova_3.obj : error LNK2019: riferimento al simbolo esterno "public: bool __thiscall OSMScene::initialise(char const *,class OSMSceneCallbacks *)" (?initialise@OSMScene@@QAE_NPBDPAVOSMSceneCallbacks@@@Z) non risolto nella funzione "protected: virtual void __thiscall TutorialApplication::createScene(void)" (?createScene@TutorialApplication@@MAEXXZ)
1>prova_3.obj : error LNK2019: riferimento al simbolo esterno "public: __thiscall OSMScene::OSMScene(class Ogre::SceneManager *,class Ogre::RenderWindow *)" (??0OSMScene@@QAE@PAVSceneManager@Ogre@@PAVRenderWindow@2@@Z) non risolto nella funzione "protected: virtual void __thiscall TutorialApplication::createScene(void)" (?createScene@TutorialApplication@@MAEXXZ)
1>bin\Debug\prova_3.exe : fatal error LNK1120: 4 esterni non risolti

mr.Zog

26-09-2007 15:05:04

Ok, I don't really understand the language of the errors, but could it be that you only included the OgreOSMScene.h in your project and forgot the OgreOSMScene.cpp?

Allfreeware

26-09-2007 15:18:40

Yes,i forget it but now,other errors :(
1>OgreOSMScene.obj : error LNK2019: riferimento al simbolo esterno "public: char const * __thiscall TiXmlElement::Attribute(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (?Attribute@TiXmlElement@@QBEPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) non risolto nella funzione "public: bool __thiscall OSMScene::initialise(char const *,class OSMSceneCallbacks *)" (?initialise@OSMScene@@QAE_NPBDPAVOSMSceneCallbacks@@@Z)
1>OgreOSMScene.obj : error LNK2019: riferimento al simbolo esterno "public: class TiXmlElement * __thiscall TiXmlNode::NextSiblingElement(void)const " (?NextSiblingElement@TiXmlNode@@QBEPAVTiXmlElement@@XZ) non risolto nella funzione "public: bool __thiscall OSMScene::initialise(char const *,class OSMSceneCallbacks *)" (?initialise@OSMScene@@QAE_NPBDPAVOSMSceneCallbacks@@@Z)
1>OgreOSMScene.obj : error LNK2019: riferimento al simbolo esterno "public: class TiXmlElement * __thiscall TiXmlNode::FirstChildElement(void)const " (?FirstChildElement@TiXmlNode@@QBEPAVTiXmlElement@@XZ) non risolto nella funzione "public: bool __thiscall OSMScene::initialise(char const *,class OSMSceneCallbacks *)" (?initialise@OSMScene@@QAE_NPBDPAVOSMSceneCallbacks@@@Z)
1>OgreOSMScene.obj : error LNK2019: riferimento al simbolo esterno "public: class TiXmlElement * __thiscall TiXmlNode::FirstChildElement(char const *)const " (?FirstChildElement@TiXmlNode@@QBEPAVTiXmlElement@@PBD@Z) non risolto nella funzione "public: bool __thiscall OSMScene::initialise(char const *,class OSMSceneCallbacks *)" (?initialise@OSMScene@@QAE_NPBDPAVOSMSceneCallbacks@@@Z)


riferimento al simbolo esterno: reference at an extern symbol
non risolto nella funzione : not resolve in the function

mr.Zog

26-09-2007 15:28:25

Ok, this time you need tinyxml.

I remember that in an older sdk of ogre it was in the package, but it doesnt seem to be there anymore - anyway, you can download it from here:
http://www.grinninglizard.com/tinyxml/

Everytime the compiler says something like "unresolved external symbol" bla bla bla... this mostly means you're trying to use something which you only declared, but not defined.

Lioric

26-09-2007 15:55:48

The TinyXML files are in the oSceneLoader downloaded files (the library or the demo), add the .cpp files to your project

It would be better if you read the User's Guide documentation, there is a chapter about using the Scene Loader lib

Allfreeware

26-09-2007 17:50:19

Really thanks at all,now i don't give any errors :D .
However now i don't see never in the window.
I've read 4-5 post of people with the same problem,but i don't think how to fix this,i've the last version of ogre.
This's the OexporterLog.log and this's the Ogre.log file.

Really thanks for the help and for the patience.

Lioric

26-09-2007 18:05:18

Do you have a light in the scene?

Do you have a camera in the scene?
Is the camera actually pointing to the scene contents?

As a rule, start your tests with simple scenes, then go from there, it will save you more time than starting with a scene with 129 materials and 50+ meshes (as your scene) and debugging it

Allfreeware

26-09-2007 18:12:30

Do you have a light in the scene?

Do you have a camera in the scene?
Is the camera actually pointing to the scene contents?

As a rule, start your tests with simple scenes, then go from there, it will save you more time than starting with a scene with 129 materials and 50+ meshes (as your scene) and debugging it


Yes,i've a skylight.Now i've add a camera pointing to the scene (only a cube :D ).
Export it but i don't see never.

mr.Zog

26-09-2007 21:01:53

Is that the ogre.log from ofusion/3dsmax folder?

I'd take a look at the application ogre.log instead.

But as Lioric said, there are tons of mistakes you can make while creating your app. Start small with one of the samples from the media folder (manually create a light or set the ambient hight enough, load an entity by hand), then if you're sure this works, load the osm.

Also the samples from the ogre SDK give a good starting point!

Evak

26-09-2007 21:30:09

does skylight even work with Ofusion and ogre?

Ogre only supports point/Omni Parallel/direct and Spot/cone lights.

It's possible skylights won't register as lights as its not standard for realtime 3D.

NOTE: I just stuck a skyliight in my scene and Ofusion didn't recognise it as a light. So Skylight does nothing.

Paulov

26-09-2007 22:12:43

Hey .

Hey evak, for me the skylight works as a normal light. In the shader scenes I´ve been testing recently if the sky light is near the floor (somethign usual) the floor is lit by this light.

Remember that your shaders takes the nearest light? so, if the skylight is the nearest to the floor it works with that.

Probably not as a skylight buat a omni or a directional sport but it works.

just this.

Allfreeware

27-09-2007 14:05:52

I've try to put a spotlight in the scene but i don't see never :(

Allfreeware

27-09-2007 14:46:08

I've try to load the box01.mesh alone.
And i can see this.But the if i load the .osm file no.

This's the .som file:

<oe_scene>
<sceneManager type="1" />
<bkgcolor r="0" g="0" b="0" />
<lightColor r="0.5" g="0.5" b="0.5" />
<shadowTechnique type="18" tex_size="512" tex_count="0">
<color r="0" g="0" b="0" />
</shadowTechnique>
<entities>
<entity name="Box01" hidden="false" filename="Box01.mesh" CastShadows="yes" ReceiveShadows="yes">
<position x="-41.188477" y="0" z="6.4810143" />
<rotation x="0" y="0" z="-0" w="-1" />
<scale x="1" y="1" z="1" />
</entity>
</entities>
<cameras>
<camera name="Camera01" FOV="0.785398">
<position x="143.05846" y="87.69558" z="-6.4381838" />
<rotation x="-0.37704292" y="-0.60620612" z="0.39556038" w="-0.57782763" />
<scale x="1" y="1" z="1" />
</camera>
</cameras>
<lights>
<light name="Omni01" type="omni" on="true" CastShadows="no" intensity="59.2455">
<position x="-8.1542168" y="50.526115" z="6.7343783" />
<rotation x="0" y="0" z="-0" w="-1" />
<scale x="1" y="1" z="1" />
<color r="1" g="1" b="1" />
<specular r="1" g="1" b="1" />
</light>
</lights>
</oe_scene>

Allfreeware

28-09-2007 19:28:57

Can post a visual studio project for load the .osm file so i can control where i've do the errors.
Thanks.

Lioric

29-09-2007 03:42:24

Download the demo application for the downloads page, it is a sample for using the oScene Loader lib

Allfreeware

29-09-2007 16:40:32

Download the demo application for the downloads page, it is a sample for using the oScene Loader lib

I've download the stonehenge example but in the source not use ofusion.
And the other demos there aren't source code.

Evak

29-09-2007 17:34:27

Lioric means from the Ofusion Web Site. Ofusion is a third party product and has its own web site.

The downloads section is at:

http://www.ofusiontechnologies.com/downloads.html

There you should have gotten your scene loader library source code, beneath that link is a demo app.

http://www.ofusiontechnologies.com/oFus ... emo_ce.zip

The scene loader works very well, and in our case were using it with our Ogre wrapper for blitzmax which adds an extra layer for possible frustration. So far its been no trouble whatsoever.