Remove quake map. Add terrain and models.
Posted: Tue Jan 05, 2010 7:54 pm
So basically, I've been playing around with the supplied demo, and I've managed to accomplish a few things. However, there's a few things that I can't do and are driving me nuts.
1) Remove the quake map. That's right. The demo loads a bsp file, which is a pre-light terrain+object mesh. I want to remove this from the demo. If I comment out the
2) Add coordinates to the infobox. Currently there's a
that runs just before device->drop, which prints on screen some basic data (driver, fps, triangles). I want to add the coordinates position to this. I try loading it via
which makes the program crash. I don't comprehend why, but I've tested it extensively.
3) Add a terrain. Like for instance something like this :
Nothing too fancy. No matter where I place this (either in the sm or the smgr scene managers, - I still haven't comprehended why there's two of them running) the system crashes. I don't mean the program crashes, I mean the system does, I have to do a cold reboot, obviously I can't read any of the debug stack (not that it does me any good in the other cases) etc. I live in fear of this insane frozen death by now.
4) Add an object. Even if you don't have a terrain, you should be able in principle to load an extra object. Or so I'd think. Something like
crashes the program.
I've been working for a few days trying to grasp what I'm doing wrong with all these, but I'm not getting very far. I'm pretty well convinced by now it's ridiculously obvious stuff that I'll notice on my own probably in 2011, so if somebody would take the time to point it out it'd be much appreciated. Thanks.
1) Remove the quake map. That's right. The demo loads a bsp file, which is a pre-light terrain+object mesh. I want to remove this from the demo. If I comment out the
line, the demo starts normally, there's no terrain or castle loaded (as you'd expect), but the fireball shooting doesn't work anymore (pressing space or clicking mouse does nothing. No sound, no graphics). I can't for the life of me figure out why.quakeLevelMesh = (scene::IQ3LevelMesh*) sm->getMesh("maps/20kdm2.bsp");
2) Add coordinates to the infobox. Currently there's a
Code: Select all
swprintf(tmp, 255, L"%ls fps:%3d triangles:%0.3f mio",
driver->getName(),
driver->getFPS(),
(f32) driver->getPrimitiveCountDrawn( 1 ) * ( 1.f / 1000000.f )
);
Code: Select all
core::vector3df camPosTest = smgr->getActiveCamera()->getAbsolutePosition();
3) Add a terrain. Like for instance something like this :
Code: Select all
scene::ITerrainSceneNode* terrain = smgr->addTerrainSceneNode(path+"terrain.bmp",
0, // parent node
-1, // node id
core::vector3df(0.f, 0.f, 0.f), // position
core::vector3df(0.f, 0.f, 0.f), // rotation
core::vector3df(1.f, 1.f, 1.f), // scale
video::SColor ( 255, 255, 255, 255 ), // vertexColor
5, // maxLOD
scene::ETPS_17, // patchSize
8 // smoothFactor
);
terrain->setMaterialFlag(video::EMF_LIGHTING, true);
terrain->setMaterialTexture(0,
driver->getTexture(path+"texture.jpg"));
terrain->setMaterialTexture(1,
driver->getTexture(path+"details.png"));
terrain->setMaterialType(video::EMT_DETAIL_MAP);
terrain->scaleTexture(1.0f,20.0f);
terrain->setMaterialTexture(2,
driver->getTexture(path+"lightmap.jpg"));
4) Add an object. Even if you don't have a terrain, you should be able in principle to load an extra object. Or so I'd think. Something like
Code: Select all
scene::IMesh* newtowerm;
scene::IMeshSceneNode* newtower;
newtowerm =smgr->getMesh("newtower.x");
newtower = smgr->addOctTreeSceneNode(newtowerm);
newtower->setPosition(core::vector3df(70,35,510));
newtower->setRotation(core::vector3df(0,30,0));
newtower->setMaterialFlag(video::EMF_LIGHTING, true);
I've been working for a few days trying to grasp what I'm doing wrong with all these, but I'm not getting very far. I'm pretty well convinced by now it's ridiculously obvious stuff that I'll notice on my own probably in 2011, so if somebody would take the time to point it out it'd be much appreciated. Thanks.