
staringmonkey
Code: Select all
float* GetVerticesPtr( int MeshIndex );
int* GetIndexPtr( int MeshIndex );
int GetNumVertices( int MeshIndex );
int GetNumIndex( int MeshIndex );
Code: Select all
int totalMeshes = m_pDotSceneMgr->GetNumMeshes(NULL);
for (int CurMesh = 0; CurMesh < totalMeshes; CurMesh++)
{
TriMesh* pTrimesh_debug = Simulation::getSingleton().createTriMesh(
"Terrain" + StringConverter::toString(CurMesh),
String::BLANK, "TestLevel.material",
Vector3(0.0f, 0.0f, 0.0f), Quaternion::IDENTITY,
String::BLANK, m_pDotSceneMgr->GetVertexDataPtr(NULL, CurMesh), m_pDotSceneMgr->GetIndexDataPtr(NULL, CurMesh));
}
Well the basic idea is that since the Octree pre-divides the mesh, you can use those divisions to cull potential collisions, thus vastly reducing the number of per-poly collision checks.tenkei wrote: What I have trouble understanding is how exactly does the logic behind this concept of having a trimes that works with the octree.
You shouldn't ever really have to deal with active/inactive TriMeshes, unless your dealing with a very large map and you want to "page" in and out the colliding sections. For the moment the OgreTok only takes advantage of the Octree at the "highest" level, that is doing a bounding-box check against each component. If your project is very speed critical it would be much more effective to simply build the Octree into OgreTok, thus further refining the collision culling. I chose not to do this and leave it open to user-defined methods of culling, rather than forcing an Octree on them.tenkei wrote: I understand (please correct me if I'm wrong) that you're supposed to generate a trimesh from your scene's geometry, then subdivide the trimesh according to the octree and only "activate" the appropriate part of it. Am I following so far?
The Octree generator has already done it.tenkei wrote: But how exactly do I subdivide it?
You only have to create it once, unless your terrain is dynamic, something which OgreTok won't handle well at all. (No point in even trying it.)tenkei wrote: Do I have to recreate the "active" trimesh each frame using the vertices from SceneOctree and delete the unused trimesh? Wouldn't that be horribly resources-consuming?
I hope Sramsby and I cleared it up.tenkei wrote: Or am I completely misunderstanding something?
Code: Select all
int totalMeshes = m_pDotSceneMgr->GetNumMeshes(NULL);
for (int CurMesh = 0; CurMesh < totalMeshes; CurMesh++)
{
TriMesh* pTrimesh_debug = Simulation::getSingleton().createTriMesh(
"Terrain" + StringConverter::toString(CurMesh),
String::BLANK, "TestLevel.material",
Vector3(0.0f, 0.0f, 0.0f), Quaternion::IDENTITY,
String::BLANK, m_pDotSceneMgr->GetVertexDataPtr(NULL, CurMesh), m_pDotSceneMgr->GetIndexDataPtr(NULL, CurMesh));
}