mosta
16-06-2009 15:33:24
Hey all,
my Application compiles nice and runs, bud there are no trees. I can run and compile the examples and there the trees get rendered as expected. I tested my own tree in the example applications and it get rendered. When I run my application everything bud the trees get displayed.
here is the code:
the initialize part:
I changed the game loop like in the example:
I'm obviously missing something can someone please tell me what it is?
my Application compiles nice and runs, bud there are no trees. I can run and compile the examples and there the trees get rendered as expected. I tested my own tree in the example applications and it get rendered. When I run my application everything bud the trees get displayed.
here is the code:
the initialize part:
m_trees = new PagedGeometry();
m_trees->setCamera(m_camera); //Set the camera so PagedGeometry knows how to calculate LODs
m_trees->setPageSize(80); //Set the size of each page of geometry
m_trees->setInfinite(); //Use infinite paging mode
m_trees->addDetailLevel<BatchPage>(150, 50); //Use batches up to 150 units away, and fade for 30 more units
m_trees->addDetailLevel<ImpostorPage>(500, 50); //Use impostors up to 400 units, and for for 50 more units
//Create a new TreeLoader3D object
TreeLoader3D *treeLoader = new TreeLoader3D(m_trees, TBounds(0, 1000000, 15000, 1000000));
m_trees->setPageLoader(treeLoader); //Assign the "treeLoader" to be used to load geometry for the PagedGeometry instance
//Load a tree entity
Entity *myEntity = m_sceneMgr->createEntity("Tree", "fir06_30.mesh");
//Setup the height function (so the Y values of trees can be calculated when they are placed on the terrain)
//HeightFunction::initialize(sceneMgr);
//Randomly place 20,000 copies of the tree on the terrain
Vector3 position;
Radian yaw;
Real scale;
for (int i = 0; i < 200000; i++){
yaw = Degree(Math::RangeRandom(0, 360));
position.x = -(Math::RangeRandom(0, 500000));
position.y = 15000; //Math::RangeRandom(1000000, 0);
position.z = -(Math::RangeRandom(0, 500000));//HeightFunction::getTerrainHeight(position.x, position.z);
scale = 1000;//Math::RangeRandom(0.5f, 0.6f);
treeLoader->addTree(myEntity, position, yaw, scale);
}
I changed the game loop like in the example:
void OgreApplication::run(void)
{
if(!setup())
return;
//Render loop
running = true;
while(running)
{
//Handle windows events
WindowEventUtilities::messagePump();
//Update frame
processInput();
render();
//Exit immediately if the window is closed
if (m_window->isClosed())
break;
}
// clean up
destroyScene();
}
void OgreApplication::render(){
//[NOTE] PagedGeometry::update() is called every frame to keep LODs, etc. up-to-date
m_trees->update();
//Render the scene with Ogre
m_root->renderOneFrame();
}
I'm obviously missing something can someone please tell me what it is?