RapidXML Dotscene Loader

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

RapidXML Dotscene Loader

Post by jacmoe »

I put the RapidXML Dotscene Loader up on the wiki:
RapidXML Dotscene Loader

This is going to be it's support forum topic. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Nick Taylor
Gnoblar
Posts: 17
Joined: Thu Jun 17, 2010 1:47 am

Re: RapidXML Dotscene Loader

Post by Nick Taylor »

Looks good, adds some features that I was going to add myself, so you saved me some time. Thank you!
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Re: RapidXML Dotscene Loader

Post by tuan kuranes »

Great work,Thanks for sharing !
RapidXML is very similar to TinyXML in use, but it's only a single header - and thus extremely lightweight.
Better memory allocation, less bugs, etc. => rapidXML is much more "production ready".
not speaking if the 30-60x faster than TinyXml
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: RapidXML Dotscene Loader

Post by jacmoe »

Thanks Tuan - interesting facts about RapidXML - I'll be adding to the article.
It's not surprising, since it's used by many. Boost.PropertyTree uses it as the default XML parser.
And it's an in-place parser, and focused on performance (and embedding) rather than features.

((Heh - the wiki page is no. 7 in Google for 'rapidxml' :) ))
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: RapidXML Dotscene Loader

Post by betajaen »

I have never seen RapidXML before, and I want to use it in something. And I hate XML!

Thanks Jacmoe!

YAML FTW!
soravis
Gnoblar
Posts: 2
Joined: Wed Jul 07, 2010 6:46 pm

Re: RapidXML Dotscene Loader

Post by soravis »

Hi! I'm learning ogre now; and sadly recognized, that there is a big mess around this dotScene format. I'm reading through the ogre forums almost for a whole day now... I found so many versions, updates, patches, etc.. now I have no idea what's the situation. As far as I know, there is a dotScene DTD (who knows when was it updated), but there aren't any official parsers. A found your loader jacmoe, it seems to me, that this is the latest and best maintained attempt to a dotScene loader. But... I've exported a scene with the exporter here: http://www.ogre3d.org/forums/viewtopic.php?f=8&t=45922, and the syntax is not quite the way as the loader understands. For example the orientation parameter is nor "rotation", but "quaternion", and the entity block also seems to differ.

Thanks for your help!
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: RapidXML Dotscene Loader

Post by jacmoe »

Uhuh - but do *read* the source for the dotscene loader and you'll see that it supports most alternative dotscene dialects.
Just look at the source, will ya? :)

It does indeed know how to handle orientation/rotation/qx/x..
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: RapidXML Dotscene Loader

Post by jacmoe »

soravis wrote:Hi! I'm learning ogre now; and sadly recognized, that there is a big mess around this dotScene format.
Er, what dotscene format?
You need to know that there's about as many 'formats' as there are exporters..
No standard.
Unfortunately.

But, having said that, it's just a very simple scene/xml implementation.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
soravis
Gnoblar
Posts: 2
Joined: Wed Jul 07, 2010 6:46 pm

Re: RapidXML Dotscene Loader

Post by soravis »

Then this DTD is really just decoration: http://www.ogre3d.org/tikiwiki/DotSceneFormat (I know it's over 4 year old).

Ok, I get that. No valid standard. But I DID read the source, and the parser only looks for "rotation". Yes, once it found that, it supports "qx, qy...", "angleX, angleY...". But this dialect uses "quaternion" instead of "rotation".
Ok, I can modify the parser for my needs, and I will, I just thought I would ask about it.
And don't think I'm insulting your parser, or ogre, I'm grateful for you work, at least there's something to lean on, when it comes to loading a .scene. :)
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: RapidXML Dotscene Loader

Post by jacmoe »

Er, sorry about that. I didn't realise it does indeed not handle quaternion tags.
Which is odd because I could have sworn it was there at some point in time. :)
Feel free to patch it up.
That way it can be made to support the most common dotscene dialects.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Rhynedahll
Halfling
Posts: 77
Joined: Thu Jan 08, 2009 2:03 am
x 1

Re: RapidXML Dotscene Loader

Post by Rhynedahll »

I'm not a C++ programmer so sorry in advance for the newby questions.

As a learning/hobby exercise, I'm trying to add the RapidXML Dotscene Loader to an application generated by Jacmoe's Appwizard for MSVC++ 2008 Express.

I have added the two files, .h and .cpp, from the wiki to the project and the line as indicated below:

Code: Select all

void TestAug25No2::createScene(void)
{
    Ogre::Entity* ogreHead = mSceneMgr->createEntity("Head", "ogrehead.mesh");

    Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    headNode->attachObject(ogreHead);

    // Set ambient light
    mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));

    // Create a light
    Ogre::Light* l = mSceneMgr->createLight("MainLight");
    l->setPosition(20,80,50);

	[i]Ogre::DotSceneLoader loader;
		loader.parseDotScene("SampleScene2.xml","General", mSceneMgr);[/i]}
When I try to build, I get this error:

Code: Select all

1>------ Build started: Project: TestAug25No2, Configuration: Debug Win32 ------
1>Compiling...
1>TestAug25No2.cpp
1>g:\documents and settings\david\my documents\visual studio 2008\projects\testaug25no2\testaug25no2\src\testaug25no2.cpp(48) : error C2039: 'DotSceneLoader' : is not a member of 'Ogre'
1>Build log was saved at "file://g:\Documents and Settings\David\My Documents\Visual Studio 2008\Projects\TestAug25No2\TestAug25No2\obj\Debug\BuildLog.htm"
1>TestAug25No2 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========]
Any suggestions as to what I am screwing up or hopefully links to helpful articles?
The Key to Magic -- Book One: ORPHAN
An epic fantasy by H. Jonas Rhynedahll available on Kindle.
The Key to Magic
Whitebear
Greenskin
Posts: 147
Joined: Mon Oct 25, 2004 5:22 am
Location: RF
x 1

Re: RapidXML Dotscene Loader

Post by Whitebear »

Have you added the line:
#include "thefile.h" (where thefile.h - is the name of the header file of DotSceneLoader class - I don't know its exact name) in the beginning of your TestAug25No2.cpp file?
\_ :roll:_/
Rhynedahll
Halfling
Posts: 77
Joined: Thu Jan 08, 2009 2:03 am
x 1

Re: RapidXML Dotscene Loader

Post by Rhynedahll »

Whitebear wrote:Have you added the line:
#include "thefile.h" (where thefile.h - is the name of the header file of DotSceneLoader class - I don't know its exact name) in the beginning of your TestAug25No2.cpp file?
Yes. :(

Code: Select all

/*
-----------------------------------------------------------------------------
Filename:    TestAug25No2.cpp
-----------------------------------------------------------------------------


This source file is generated by the
   ___                   _              __    __ _                  _ 
  /___\__ _ _ __ ___    /_\  _ __  _ __/ / /\ \ (_)______ _ _ __ __| |
 //  // _` | '__/ _ \  //_\\| '_ \| '_ \ \/  \/ / |_  / _` | '__/ _` |
/ \_// (_| | | |  __/ /  _  \ |_) | |_) \  /\  /| |/ / (_| | | | (_| |
\___/ \__, |_|  \___| \_/ \_/ .__/| .__/ \/  \/ |_/___\__,_|_|  \__,_|
      |___/                 |_|   |_|                                 
      Ogre 1.7.x Application Wizard for VC9 (June 2010)
      http://code.google.com/p/ogreappwizards/
-----------------------------------------------------------------------------
*/

#include "TestAug25No2.h"

#include "G:\Documents and Settings\David\My Documents\Visual Studio 2008\Projects\TestAug25No2\TestAug25No2\DotSceneLoader.h"


//-------------------------------------------------------------------------------------
TestAug25No2::TestAug25No2(void)
{
}
//-------------------------------------------------------------------------------------
TestAug25No2::~TestAug25No2(void)
{
}

//-------------------------------------------------------------------------------------
void TestAug25No2::createScene(void)
{
    Ogre::Entity* ogreHead = mSceneMgr->createEntity("Head", "ogrehead.mesh");

    Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    headNode->attachObject(ogreHead);

    // Set ambient light
    mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));

    // Create a light
    Ogre::Light* l = mSceneMgr->createLight("MainLight");
    l->setPosition(20,80,50);

	Ogre::DotSceneLoader loader;
		loader.parseDotScene("SampleScene2.xml","General", mSceneMgr);
}



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

#ifdef __cplusplus
extern "C" {
#endif

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
    INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
    int main(int argc, char *argv[])
#endif
    {
        // Create application object
        TestAug25No2 app;

        try {
            app.go();
        } catch( Ogre::Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
            MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
            std::cerr << "An exception has occured: " <<
                e.getFullDescription().c_str() << std::endl;
#endif
        }

        return 0;
    }

#ifdef __cplusplus
}
#endif
The Key to Magic -- Book One: ORPHAN
An epic fantasy by H. Jonas Rhynedahll available on Kindle.
The Key to Magic
MaTTze
Gnoblar
Posts: 7
Joined: Sun May 09, 2010 12:40 pm

Re: RapidXML Dotscene Loader

Post by MaTTze »

DotSceneLoader is not part of the Ogre namespace, so just delete the "Ogre::" in front of DotSceneLoader and it should work.
Seems to be wrong in the wiki.

MaTTze
Rhynedahll
Halfling
Posts: 77
Joined: Thu Jan 08, 2009 2:03 am
x 1

Re: RapidXML Dotscene Loader

Post by Rhynedahll »

MaTTze wrote:DotSceneLoader is not part of the Ogre namespace, so just delete the "Ogre::" in front of DotSceneLoader and it should work.
Seems to be wrong in the wiki.

MaTTze
Removing the OGRE:: allows the code to compile but then there are linking errors in reference to the Terrain:

Code: Select all

1>------ Build started: Project: TestAug25No2, Configuration: Debug Win32 ------
1>Linking...
1>DotSceneLoader.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Ogre::TerrainGlobalOptions::TerrainGlobalOptions(void)" (__imp_??0TerrainGlobalOptions@Ogre@@QAE@XZ) referenced in function "public: __thiscall DotSceneLoader::DotSceneLoader(void)" (??0DotSceneLoader@@QAE@XZ)
1>DotSceneLoader.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Ogre::TerrainGlobalOptions::~TerrainGlobalOptions(void)" (__imp_??1TerrainGlobalOptions@Ogre@@UAE@XZ) referenced in function "public: virtual void * __thiscall Ogre::TerrainGlobalOptions::`scalar deleting destructor'(unsigned int)" (??_GTerrainGlobalOptions@Ogre@@UAEPAXI@Z)
1>DotSceneLoader.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::TerrainGroup::freeTemporaryResources(void)" (__imp_?freeTemporaryResources@TerrainGroup@Ogre@@QAEXXZ) referenced in function "protected: void __thiscall DotSceneLoader::processTerrain(class rapidxml::xml_node<char> *)" (?processTerrain@DotSceneLoader@@IAEXPAV?$xml_node@D@rapidxml@@@Z)
1>DotSceneLoader.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::TerrainGroup::setResourceGroup(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?setResourceGroup@TerrainGroup@Ogre@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "protected: void __thiscall DotSceneLoader::processTerrain(class rapidxml::xml_node<char> *)" (?processTerrain@DotSceneLoader@@IAEXPAV?$xml_node@D@rapidxml@@@Z)
1>DotSceneLoader.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Ogre::TerrainGroup::TerrainGroup(class Ogre::SceneManager *,enum Ogre::Terrain::Alignment,unsigned short,float)" (__imp_??0TerrainGroup@Ogre@@QAE@PAVSceneManager@1@W4Alignment@Terrain@1@GM@Z) referenced in function "protected: void __thiscall DotSceneLoader::processTerrain(class rapidxml::xml_node<char> *)" (?processTerrain@DotSceneLoader@@IAEXPAV?$xml_node@D@rapidxml@@@Z)
1>DotSceneLoader.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::TerrainGlobalOptions::setCompositeMapDiffuse(class Ogre::ColourValue const &)" (__imp_?setCompositeMapDiffuse@TerrainGlobalOptions@Ogre@@QAEXABVColourValue@2@@Z) referenced in function "protected: void __thiscall DotSceneLoader::processTerrain(class rapidxml::xml_node<char> *)" (?processTerrain@DotSceneLoader@@IAEXPAV?$xml_node@D@rapidxml@@@Z)
1>DotSceneLoader.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::TerrainGlobalOptions::setCompositeMapAmbient(class Ogre::ColourValue const &)" (__imp_?setCompositeMapAmbient@TerrainGlobalOptions@Ogre@@QAEXABVColourValue@2@@Z) referenced in function "protected: void __thiscall DotSceneLoader::processTerrain(class rapidxml::xml_node<char> *)" (?processTerrain@DotSceneLoader@@IAEXPAV?$xml_node@D@rapidxml@@@Z)
1>DotSceneLoader.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::TerrainGlobalOptions::setLightMapDirection(class Ogre::Vector3 const &)" (__imp_?setLightMapDirection@TerrainGlobalOptions@Ogre@@QAEXABVVector3@2@@Z) referenced in function "protected: void __thiscall DotSceneLoader::processTerrain(class rapidxml::xml_node<char> *)" (?processTerrain@DotSceneLoader@@IAEXPAV?$xml_node@D@rapidxml@@@Z)
1>DotSceneLoader.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::TerrainGlobalOptions::setCompositeMapDistance(float)" (__imp_?setCompositeMapDistance@TerrainGlobalOptions@Ogre@@QAEXM@Z) referenced in function "protected: void __thiscall DotSceneLoader::processTerrain(class rapidxml::xml_node<char> *)" (?processTerrain@DotSceneLoader@@IAEXPAV?$xml_node@D@rapidxml@@@Z)
1>DotSceneLoader.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::TerrainGlobalOptions::setMaxPixelError(float)" (__imp_?setMaxPixelError@TerrainGlobalOptions@Ogre@@QAEXM@Z) referenced in function "protected: void __thiscall DotSceneLoader::processTerrain(class rapidxml::xml_node<char> *)" (?processTerrain@DotSceneLoader@@IAEXPAV?$xml_node@D@rapidxml@@@Z)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall Ogre::TerrainGroup::canHandleRequest(class Ogre::WorkQueue::Request const *,class Ogre::WorkQueue const *)" (?canHandleRequest@TerrainGroup@Ogre@@UAE_NPBVRequest@WorkQueue@2@PBV42@@Z)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual struct Ogre::WorkQueue::Response * __thiscall Ogre::TerrainGroup::handleRequest(class Ogre::WorkQueue::Request const *,class Ogre::WorkQueue const *)" (?handleRequest@TerrainGroup@Ogre@@UAEPAUResponse@WorkQueue@2@PBVRequest@42@PBV42@@Z)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual struct Ogre::Terrain::ImportData & __thiscall Ogre::TerrainGroup::getDefaultImportSettings(void)" (?getDefaultImportSettings@TerrainGroup@Ogre@@UAEAAUImportData@Terrain@2@XZ)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Ogre::TerrainGroup::setOrigin(class Ogre::Vector3 const &)" (?setOrigin@TerrainGroup@Ogre@@UAEXABVVector3@2@@Z)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual class Ogre::Vector3 const & __thiscall Ogre::TerrainGroup::getOrigin(void)const " (?getOrigin@TerrainGroup@Ogre@@UBEABVVector3@2@XZ)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual enum Ogre::Terrain::Alignment __thiscall Ogre::TerrainGroup::getAlignment(void)const " (?getAlignment@TerrainGroup@Ogre@@UBE?AW4Alignment@Terrain@2@XZ)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual float __thiscall Ogre::TerrainGroup::getTerrainWorldSize(void)const " (?getTerrainWorldSize@TerrainGroup@Ogre@@UBEMXZ)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual class Ogre::SceneManager * __thiscall Ogre::TerrainGroup::getSceneManager(void)const " (?getSceneManager@TerrainGroup@Ogre@@UBEPAVSceneManager@2@XZ)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Ogre::TerrainGroup::defineTerrain(long,long,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?defineTerrain@TerrainGroup@Ogre@@UAEXJJABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Ogre::TerrainGroup::defineTerrain(long,long,float const *,class std::vector<struct Ogre::Terrain::LayerInstance,class Ogre::STLAllocator<struct Ogre::Terrain::LayerInstance,class Ogre::CategorisedAllocPolicy<0> > > const *)" (?defineTerrain@TerrainGroup@Ogre@@UAEXJJPBMPBV?$vector@ULayerInstance@Terrain@Ogre@@V?$STLAllocator@ULayerInstance@Terrain@Ogre@@V?$CategorisedAllocPolicy@$0A@@3@@3@@std@@@Z)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Ogre::TerrainGroup::defineTerrain(long,long,class Ogre::Image const *,class std::vector<struct Ogre::Terrain::LayerInstance,class Ogre::STLAllocator<struct Ogre::Terrain::LayerInstance,class Ogre::CategorisedAllocPolicy<0> > > const *)" (?defineTerrain@TerrainGroup@Ogre@@UAEXJJPBVImage@2@PBV?$vector@ULayerInstance@Terrain@Ogre@@V?$STLAllocator@ULayerInstance@Terrain@Ogre@@V?$CategorisedAllocPolicy@$0A@@3@@3@@std@@@Z)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Ogre::TerrainGroup::defineTerrain(long,long,struct Ogre::Terrain::ImportData const *)" (?defineTerrain@TerrainGroup@Ogre@@UAEXJJPBUImportData@Terrain@2@@Z)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Ogre::TerrainGroup::defineTerrain(long,long,float)" (?defineTerrain@TerrainGroup@Ogre@@UAEXJJM@Z)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Ogre::TerrainGroup::defineTerrain(long,long)" (?defineTerrain@TerrainGroup@Ogre@@UAEXJJ@Z)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Ogre::TerrainGroup::loadAllTerrains(bool)" (?loadAllTerrains@TerrainGroup@Ogre@@UAEX_N@Z)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Ogre::TerrainGroup::loadTerrain(long,long,bool)" (?loadTerrain@TerrainGroup@Ogre@@UAEXJJ_N@Z)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Ogre::TerrainGroup::unloadTerrain(long,long)" (?unloadTerrain@TerrainGroup@Ogre@@UAEXJJ@Z)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Ogre::TerrainGroup::removeTerrain(long,long)" (?removeTerrain@TerrainGroup@Ogre@@UAEXJJ@Z)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual struct Ogre::TerrainGroup::TerrainSlotDefinition * __thiscall Ogre::TerrainGroup::getTerrainDefinition(long,long)const " (?getTerrainDefinition@TerrainGroup@Ogre@@UBEPAUTerrainSlotDefinition@12@JJ@Z)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual class Ogre::Terrain * __thiscall Ogre::TerrainGroup::getTerrain(long,long)const " (?getTerrain@TerrainGroup@Ogre@@UBEPAVTerrain@2@JJ@Z)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall Ogre::TerrainGroup::canHandleResponse(struct Ogre::WorkQueue::Response const *,class Ogre::WorkQueue const *)" (?canHandleResponse@TerrainGroup@Ogre@@UAE_NPBUResponse@WorkQueue@2@PBV42@@Z)
1>DotSceneLoader.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Ogre::TerrainGroup::handleResponse(struct Ogre::WorkQueue::Response const *,class Ogre::WorkQueue const *)" (?handleResponse@TerrainGroup@Ogre@@UAEXPBUResponse@WorkQueue@2@PBV42@@Z)
1>DotSceneLoader.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Ogre::TerrainGroup::~TerrainGroup(void)" (__imp_??1TerrainGroup@Ogre@@UAE@XZ) referenced in function "public: virtual void * __thiscall Ogre::TerrainGroup::`scalar deleting destructor'(unsigned int)" (??_GTerrainGroup@Ogre@@UAEPAXI@Z)
1>DotSceneLoader.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __thiscall Ogre::TerrainGroup::getResourceGroup(void)const " (__imp_?getResourceGroup@TerrainGroup@Ogre@@QBEABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function "protected: void __thiscall DotSceneLoader::processTerrainPage(class rapidxml::xml_node<char> *)" (?processTerrainPage@DotSceneLoader@@IAEXPAV?$xml_node@D@rapidxml@@@Z)
1>bin\Debug\TestAug25No2.exe : fatal error LNK1120: 34 unresolved externals
1>Build log was saved at "file://g:\Documents and Settings\David\My Documents\Visual Studio 2008\Projects\TestAug25No2\TestAug25No2\obj\Debug\BuildLog.htm"
1>TestAug25No2 - 35 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have encountered this problem before and I'll have to dig around and try to remember the cause.

Thanks for the help!
The Key to Magic -- Book One: ORPHAN
An epic fantasy by H. Jonas Rhynedahll available on Kindle.
The Key to Magic
MaTTze
Gnoblar
Posts: 7
Joined: Sun May 09, 2010 12:40 pm

Re: RapidXML Dotscene Loader

Post by MaTTze »

Is OgreTerrain.lib/OgreTerrain_d.lib added to the additional Dependencies?

MaTTze
Rhynedahll
Halfling
Posts: 77
Joined: Thu Jan 08, 2009 2:03 am
x 1

Re: RapidXML Dotscene Loader

Post by Rhynedahll »

MaTTze wrote:Is OgreTerrain.lib/OgreTerrain_d.lib added to the additional Dependencies?

MaTTze
Thanks, that sorted that out. (Don't have the release version though, so didn't add OgreTerrain.lib)

Everything builds and links now. Thanks! :D

Trying to work through loading a .scene file from Ogitor now. I haven't got all the resources in the right place yet.
The Key to Magic -- Book One: ORPHAN
An epic fantasy by H. Jonas Rhynedahll available on Kindle.
The Key to Magic
Rhynedahll
Halfling
Posts: 77
Joined: Thu Jan 08, 2009 2:03 am
x 1

Re: RapidXML Dotscene Loader

Post by Rhynedahll »

Okay, I've sorted out some of the problems with my Ogitor .scene file and I can get my test exercise to run.

However, I get this:
Image

when I should get this:
Image

Any suggestions as to why my terrain disappears?

Thanks in advance
The Key to Magic -- Book One: ORPHAN
An epic fantasy by H. Jonas Rhynedahll available on Kindle.
The Key to Magic
asm
Gnoblar
Posts: 3
Joined: Sun Sep 19, 2010 5:29 pm

Re: RapidXML Dotscene Loader

Post by asm »

Rhynedahll :

If you used the example from here:

Code: Select all

   Ogre::DotSceneLoader loader;
   loader.parseDotScene("SampleScene2.xml","General", mSceneMgr);
it will kill the terrain because the DotSceneLoader maintains an instance of the Ogre::TerrainGroup which it deletes upon destruction...

I solved this by adding a function to DotSceneLoader to take over the terrain group:

Code: Select all

Ogre::TerrainGroup* takeTerrainGroup() { mWeOwnTerrainGroup = false; return mTerrainGroup; }
then not deleting it in the DotSceneLoader destructor if someone else has taken control.

- Andy
Rhynedahll
Halfling
Posts: 77
Joined: Thu Jan 08, 2009 2:03 am
x 1

Re: RapidXML Dotscene Loader

Post by Rhynedahll »

asm wrote:Rhynedahll :

If you used the example from here:


- Andy
Thanks! :D

I'll start working on that!

I have question:
it will kill the terrain because the DotSceneLoader maintains an instance of the Ogre::TerrainGroup which it deletes upon destruction...
Do you know why the DotSceneLoader does this?
The Key to Magic -- Book One: ORPHAN
An epic fantasy by H. Jonas Rhynedahll available on Kindle.
The Key to Magic
peacemaker
Gnoblar
Posts: 15
Joined: Wed Sep 15, 2010 10:51 am

Re: RapidXML Dotscene Loader

Post by peacemaker »

Hmmm, I feel like I'm missing some vital information here...

Using Ogitor I end up with a .ogscene file and the dotscene example needs a .scene file yet looking at the contents it seems they are quite different. So my question is, what does the conversion? Is this something I have to write myself? Surely someone out there has already written a .ogscene to .scene converter?

I feel like this process (of getting Ogitor scenes into Ogre) should be a lot simpler so perhaps I'm missing something??
Rhynedahll
Halfling
Posts: 77
Joined: Thu Jan 08, 2009 2:03 am
x 1

Re: RapidXML Dotscene Loader

Post by Rhynedahll »

peacemaker wrote:Hmmm, I feel like I'm missing some vital information here...

I feel like this process (of getting Ogitor scenes into Ogre) should be a lot simpler so perhaps I'm missing something??
Ogitor 0.4.2 has a Dotscene exporter. Under File: Export=>DotScene Serializer.

Image
The Key to Magic -- Book One: ORPHAN
An epic fantasy by H. Jonas Rhynedahll available on Kindle.
The Key to Magic
asm
Gnoblar
Posts: 3
Joined: Sun Sep 19, 2010 5:29 pm

Re: RapidXML Dotscene Loader

Post by asm »

Rhynedahll wrote:Do you know why the DotSceneLoader does this?
No idea why this design decision was made.

Maybe because it was easier than figuring out how to do it nicely? :-)

- Andy
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: RapidXML Dotscene Loader

Post by jacmoe »

In a nutshell, Andy. :)

The dotscene loader is lifted from the Ogitor sample application, and it's was/is a lot easier to assume than anticipate - or put differently:
The dotscene loader could benefit from an overhaul which makes it more universal.
Either by making the functions static, or by using structure parameters (instead of a long parameter list passed around).

I'll revisit it some time, and probably implement a pre-process step to gather information before the actual loading.
That is: separate the parsing from the processing.
That might also take care of the single directional light issue for the terrain.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
peacemaker
Gnoblar
Posts: 15
Joined: Wed Sep 15, 2010 10:51 am

Re: RapidXML Dotscene Loader

Post by peacemaker »

Rhynedahll - thanks for pointing that out!

I used the DotSceneLoader (above) to load my Ogitor scene and the meshes are showing but not the terrain. I followed your steps above regarding taking control of the TerrainGroup but the terrain is still not being shown.

Looking through the DotSceneLoader code it seems that it manages creating the lights, terrain and so on and adding them to the root scene node so this *should* just work! ;)

Do you have any other ideas why the terrain might not show?
Post Reply