why trees of PagedGeometry isn't displayed in Ogitor?

disney

18-01-2010 11:59:26

have tried to add the trees of PagedGeometry in Ogitor, I put the following code behind code of "the grass layer" as previous versions 's OgPagedGrass

why trees of PagedGeometry isn't displayed in Ogitor?

….

bool CPagedGrassEditor::InitLayers(CTerrainEditor *terrain, Ogre::Camera *cam, int pagesize, int detaildistance)
{
Ogre::ResourceGroupManager *resmngr = Ogre::ResourceGroupManager::getSingletonPtr();
Ogre::String value = OgitorsRoot::getSingletonPtr()->GetProjectOptions()->ProjectDir + OgitorsRoot::getSingletonPtr()->GetProjectOptions()->PagedGeometryDirectory;
resmngr->addResourceLocation(value,"FileSystem","PagedGeometry");
resmngr->initialiseResourceGroup("PagedGeometry");

if(m_GrassLoader) delete m_GrassLoader;
if(m_Handle) delete m_Handle;

m_PageSize = pagesize;
m_DetailDistance = detaildistance;

m_Handle = new PagedGeometry(cam, pagesize);
m_Handle->addDetailLevel<GrassPage>(detaildistance);

//Create a GrassLoader object
m_GrassLoader = new GrassLoader(m_Handle);
//Assign the "grassLoader" to be used to load geometry for the PagedGrass instance
m_Handle->setPageLoader(m_GrassLoader);

//Supply a height function to GrassLoader so it can calculate grass Y values
m_GrassLoader->setHeightFunction(terrain->GetHeightFunction());

TBounds bounds(terrain->GetSize().getMinimum().x, terrain->GetSize().getMinimum().z, terrain->GetSize().getMaximum().x, terrain->GetSize().getMaximum().z);
Ogre::Vector2 v1(2.0f, 0.6f);
Ogre::Vector2 v2(2.5f, 1.0f);
if(m_Layers.size() == 0)
AddGrassLayer(true, "grass", v1, v2, true, 10.0f, 0.2f, 0.5f, 3.0f, "pgr_density1.png",
FADETECH_GROW, GRASSTECH_CROSSQUADS,"yellow_grass.png",bounds);
else
{
for(unsigned int i = 0;i < m_Layers.size();i++)
{
CreateGrassLayer(i);
}
}



trees = new PagedGeometry();
trees->setCamera(camera); //Set the camera so PagedGeometry knows how to calculate LODs
trees->setPageSize(pagesize); //Set the size of each page of geometry
trees->setInfinite(); //Use infinite paging mode

#ifdef WIND
//WindBatchPage is a variation of BatchPage which includes a wind animation shader
trees->addDetailLevel<WindBatchPage>(90, 30); //Use batches up to 150 units away, and fade for 30 more units
#else
trees->addDetailLevel<BatchPage>(90, 30); //Use batches up to 150 units away, and fade for 30 more units
#endif
trees->addDetailLevel<ImpostorPage>(400, 50); //Use impostors up to 400 units, and for for 50 more units

//Create a new TreeLoader2D object
TreeLoader2D *treeLoader = new TreeLoader2D(trees, bounds);
trees->setPageLoader(treeLoader); //Assign the "treeLoader" to be used to load geometry for the PagedGeometry instance

//Supply a height function to TreeLoader2D so it can calculate tree Y values
HeightFunction::initialize(sceneMgr);
treeLoader->setHeightFunction(terrain->GetHeightFunction());

treeLoader->setColorMap("terrain_lightmap.jpg");

Entity *tree1 = GetSceneMgr()->createEntity("Tree1″, "fir05_30.mesh");

Entity *tree2 = GetSceneMgr()->->createEntity("Tree2″, "fir14_25.mesh");

#ifdef WIND
trees->setCustomParam(tree1->getName(), "windFactorX", 15);
trees->setCustomParam(tree1->getName(), "windFactorY", 0.01);
trees->setCustomParam(tree2->getName(), "windFactorX", 22);
trees->setCustomParam(tree2->getName(), "windFactorY", 0.013);
#endif

//Randomly place 1000 copies of the tree on the terrain
Ogre::Vector3 position = Ogre::Vector3::ZERO;
Radian yaw;
Real scale;
for (int i = 0; i < 1000; i++){
yaw = Degree(Math::RangeRandom(0, 360));

position.x = Math::RangeRandom(0, 1500);
position.z = Math::RangeRandom(0, 1500);

scale = Math::RangeRandom(0.07f, 0.12f);

float rnd = Math::UnitRandom();
if (rnd < 0.5f)
{
if (Math::UnitRandom() < 0.5f)
treeLoader->addTree(tree1, position, yaw, scale);
}
else
treeLoader->addTree(tree2, position, yaw, scale);
}

return true;
}

Fish

19-01-2010 01:29:57

I'm not sure how Ogitor handles PG. Perhaps your post in the Ogitor forum will soon get a response. However, it appears that Ogitor has stopped development with PG in favor of the Paging Component that is being integrated into Ogre.

-Fish

jacmoe

24-01-2010 15:28:32

I intend to put it back, as I think it's due to a misunderstanding.
Paged Geometry is different from the paging component, and I need it in my own projects.
If I can get it to work with Ogre 1.7, that is. :)

stealth977

04-02-2010 23:08:40

Maybe a bit late, but current Ogre::Terrain implementation in Ogitor doesnt return a working heightfunction (didnt implement it since not using PG till its fully Ogre::Paging compliant) thats probably why it is not rendering anything in Ogitor :)

tdev

27-03-2010 14:36:37

uhm, as i saw you stopped supporting PG in Ogitor for now.

Do you work on your own PG replacement using Ogre 1.7 or should i still have a go at porting the 'classic' PG that we have now towards the new 1.7 paging?