I thought I create all SceneNodes at startup and let irrlicht do the rest. But it looks like that this isn't working.
I've load a Model and want to create 150000 SceneNodes with this Model. But I get a exception after 238 scenenodes in a debug build and 245 scenenodes in a release build. Looks like I hit the 2 GB barrier.
Code: Select all
//That's some code to show how I create the SceneNodes
irr::core::vector3df starPosition = itStars->first;
GameObjects::PTR_STARSYSTEM star = itStars->second;
irr::scene::ISceneNode * sceneNodeStar = Helper::IrrlichtHelper::GetInstance()->Device()->getSceneManager()->addOctreeSceneNode(genericMesh->getMesh(0));
sceneNodeStar->setPosition(starPosition);
sceneNodeStar->setMaterialFlag(irr::video::EMF_LIGHTING, false);
sceneNodeStar->setMaterialFlag(irr::video::EMF_NORMALIZE_NORMALS, false);
sceneNodeStar->setDebugDataVisible(irr::scene::EDS_OFF);
sceneNodeStar->setParent(sceneNodeRoot);
GameObjectHelper::GetInstance().AttachObjectToSceneNode(sceneNodeStar, star);
sceneNodeRoot->addChild(sceneNodeStar);
// light per star
irr::scene::ISceneNode *sceneNodeLight = sceneManager->addLightSceneNode(0, starPosition + irr::core::vector3df(200, 200, 200), irr::video::SColorf(1.0f, 1.0f, 1.0f), 2000);
sceneManager->setAmbientLight(irr::video::SColorf(0.3f, 0.3f, 0.3f));
Maybe I misunderstood the scenegraph but I thought I just create all nodes and irrlicht does the rest. So how do I get 150000 scenenodes working without switching to x64 build? 150000 is more like a test 1500 Stars * (max) 10 Planets per Star + (Ship's Spacestations and other fancy stuff)
Do I have to create scenenodes and delete them depending on what is visible by the user? Sounds wrong to me.