I can't get the hillplanemesh to draw on the screen.
Code: Select all
irr::scene::IAnimatedMesh* bgMesh =
scene->addHillPlaneMesh( "background", irr::core::dimension2df(1024,512), irr::core::dimension2du(1,1) );
if ( bgMesh )
{
irr::scene::ISceneNode* bgNode = scene->addAnimatedMeshSceneNode( bgMesh );
bgNode->setMaterialTexture( 0, driver->getTexture("../Irrlicht/media/skydome2.jpg") );
bgNode->setMaterialFlag( irr::video::EMF_LIGHTING, false );
bgNode->setMaterialType( irr::video::EMT_SOLID );
}
I set up an ortho projection as follows
Code: Select all
irr::scene::ICameraSceneNode* camera = scene->addCameraSceneNode();
scene->setActiveCamera( camera );
//! setup the projection matrix
irr::core::matrix4 projMatrix;
projMatrix.buildProjectionMatrixOrthoLH(640.f, 480.f, -1000.f, 1000.f);
camera->setProjectionMatrix(projMatrix);
//! setup the view matrix
camera->setTarget(irr::core::vector3df(0,0,0));
camera->setPosition(irr::core::vector3df(0,0,-1000));
camera->updateAbsolutePosition();
Code: Select all
billNode = scene->addBillboardSceneNode( 0, irr::core::dimension2df(50, 50) );
billNode->setMaterialFlag( irr::video::EMF_LIGHTING, false );
billNode->setMaterialType( irr::video::EMT_TRANSPARENT_ADD_COLOR );
billNode->setMaterialTexture( 0, driver->getTexture("../Irrlicht/media/particlewhite.bmp") );
I decided to start using better and available options. But it was a great learning experience. A good warm-up.
So, I am trying to create a 2D background with an IAnimatedMeshSceneNode and IAnimatedMesh.
I thought I would create it and not add it to the scene manager. Then I'll call draw on the background scene node manually, then call scene->drawAll() to ensure the background gets drawn first.
Does this sound sensible and viable?
I could use a billboard for my 2D game objects. Is that the ideal way to do it?
Or would it be more efficient if I used a mesh and mesh scene node because I will be setting up the camera as ortho projection so I actually don't need the billboard (billboard set's the projection on every draw call).