[SOLVED] Exception in impostorTexture

Willy

01-01-2008 10:00:19

Hi, i'm using ogre with pagedGeometry, but got a problem with imposorPage
When i add a new detailLevel with impostorPage, i got an exception in std::Tree
The last call in pagedgeometry was ImpostorTexture::getTexture

//Search for an existing impostor texture for the given entity
std::map<ResourceHandle, ImpostorTexture *>::iterator iter;
iter = selfList.find(entity->getMesh()->getHandle());

selfList is empty, visual studio report its value as [0]()
EDIT: i've forgotten to tell you
_Nodeptr _Lbound(const key_type& _Keyval) const
{ // find leftmost node not less than _Keyval
_Nodeptr _Pnode = _Root();
_Nodeptr _Wherenode = _Myhead; // end() if search fails
.............

_Nodeptr& _Root() const
{ // return root of nonmutable tree
return (_Parent(_Myhead));
}

_MyHead has no valid member



any suggestion is apprecieted :)

Thx

P.S.: happy new year :wink:

JohnJ

03-01-2008 02:51:01

There shouldn't be any problems when selfList is empty - in that case it should simply return a blank iterator and a new texture will be created. Could you post your PagedGeometry setup code so I can reproduce and fix?

Willy

03-01-2008 15:24:22

Thx for the reply

below is the code, but i didn't think it's a bug in pagedgeometry, i've done the same as the example and the example in the zip run just fine.

the setup code:


//bushes
Ogre::Degree yaw;
Ogre::Real scale;
Vector2 position;
bushes = new PagedGeometry(mCamera, 50);
bushes->addDetailLevel<BatchPage>(80, 50);
TreeLoader2D *bushLoader = new TreeLoader2D(bushes, TBounds(0, 0, 1500, 1500));
bushes->setPageLoader(bushLoader);
HeightFunction::initialize(mSceneManager);
bushLoader->setHeightFunction(&HeightFunction::getTerrainHeight);
Entity *myBush = mSceneManager->createEntity("Bush", myClass.findConfigValue("BushTree"));
for (int i = 0; i < myClass.findIntConfigValue("numberOfBush"); i++){
yaw = Degree(Math::RangeRandom(0, 360));
position.x = Math::RangeRandom(0, 1500);
position.y = Math::RangeRandom(0, 1500);
scale = Math::RangeRandom(myClass.findfloatConfigValue("BushScaleMin"), myClass.findfloatConfigValue("BushScaleMax"));
bushLoader->addTree(myBush, position, yaw, scale);
}
//trees
trees = new PagedGeometry();
trees->setCamera(mCamera);
trees->setPageSize(80);
trees->setInfinite();
trees->addDetailLevel<BatchPage>(150, 50);
//trees->addDetailLevel<ImpostorPage>(500,50);
TreeLoader2D *treeLoader = new TreeLoader2D(trees, TBounds(0, 0, 1500, 1500));
trees->setPageLoader(treeLoader);
HeightFunction::initialize(mSceneManager);
treeLoader->setHeightFunction(&HeightFunction::getTerrainHeight);
Entity *myTree = mSceneManager->createEntity("Tree", myClass.findConfigValue("TreeMesh"));
for (int i = 0; i < myClass.findIntConfigValue("numberOfTree"); i++){
yaw = Degree(Math::RangeRandom(0, 360));
position.x = Math::RangeRandom(0, 1500);
position.y = Math::RangeRandom(0, 1500);
scale = Math::RangeRandom(myClass.findfloatConfigValue("TreeScaleMin"), myClass.findfloatConfigValue("TreeScaleMin"));

treeLoader->addTree(myTree, position, yaw, scale);
}

with the line for the 2 AddDetailLevel decommented, it generate the exception
bushes work fine
i use the HeightFunction show in the example

and in the frameListener after processing the input, it simple call a function that do


trees->update();
bushes->update();


The stack trace

> std::_Tree<std::_Tmap_traits<unsigned long,ImpostorTexture *,std::less<unsigned long>,std::allocator<std::pair<unsigned long const ,ImpostorTexture *> >,0> >::_Root() Riga 1231 C++
std::_Tree<std::_Tmap_traits<unsigned long,ImpostorTexture *,std::less<unsigned long>,std::allocator<std::pair<unsigned long const ,ImpostorTexture *> >,0> >::_Lbound(const unsigned long & _Keyval=5) Riga 1170 + 0x8 byte C++
std::_Tree<std::_Tmap_traits<unsigned long,ImpostorTexture *,std::less<unsigned long>,std::allocator<std::pair<unsigned long const ,ImpostorTexture *> >,0> >::lower_bound(const unsigned long & _Keyval=5) Riga 987 + 0x10 byte C++
std::_Tree<std::_Tmap_traits<unsigned long,ImpostorTexture *,std::less<unsigned long>,std::allocator<std::pair<unsigned long const ,ImpostorTexture *> >,0> >::find(const unsigned long & _Keyval=5) Riga 961 + 0x10 byte C++
ImpostorTexture::getTexture(ImpostorPage * group=0x04eb1b30, Ogre::Entity * entity=0x04ec9b28) Riga 541 + 0x52 byte C++
ImpostorBatch::ImpostorBatch(ImpostorPage * group=0x04eb1b30, Ogre::Entity * entity=0x04ec9b28) Riga 188 + 0xd byte C++
ImpostorBatch::getBatch(ImpostorPage * group=0x04eb1b30, Ogre::Entity * entity=0x04ec9b28) Riga 228 + 0x30 byte C++
ImpostorPage::addEntity(Ogre::Entity * ent=0x04ec9b28, const Ogre::Vector3 & position={...}, const Ogre::Quaternion & rotation={...}, const Ogre::Vector3 & scale={...}, const Ogre::ColourValue & color={...}) Riga 79 + 0xd byte C++
PageLoader::addEntity(Ogre::Entity * ent=0x04ec9b28, const Ogre::Vector3 & position={...}, const Ogre::Quaternion & rotation={...}, const Ogre::Vector3 & scale={...}, const Ogre::ColourValue & color={...}) Riga 988 + 0x29 byte C++
TreeLoader2D::loadPage(PageInfo & page={...}) Riga 249 C++
GeometryPageManager::_loadPage(GeometryPage * page=0x04eb1b30) Riga 550 + 0x28 byte C++
GeometryPageManager::update(unsigned long deltaTime=430, Ogre::Vector3 & camPos={...}, Ogre::Vector3 & camSpeed={...}, bool & enableCache=false, GeometryPageManager * prevManager=0x04ea22a0) Riga 313 C++
PagedGeometry::update() Riga 163 C++
Scene::update(Ogre::Camera * mCamera=0x00c7b028) Riga 127 C++
.............................

SOLVED

i miss the /clr option in th eproject specification

JohnJ

08-01-2008 00:14:52

SOLVED

i miss the /clr option in th eproject specification

Ok, thanks for letting me know :)