Game Development Community

WorldEditor::renderObjectBox() - MRenderBoxIntersect ?

by Orion Elenzil · in Torque Game Engine · 05/29/2007 (12:04 pm) · 1 replies

There's this following bit of commented-out code in the TGE 1.3.5 codebase,
and it sounds really interesting.
i'd really love to have some visual indicator when object boxes are overlapping.

anyone know the story ?

//   // render the collision polys?
//   // jff - this is using the worldbox... use obj box? which sides?
//   if(mRenderBoxIntersect)
//   {
//      obj->disableCollision();
//      Box3F bBox = obj->getWorldBox();
//
//      bBox.min.z -= mProjectDistance;
//      bBox.max.z += mProjectDistance;
//
//      ClippedPolyList polyList;
//      polyList.mPlaneList.clear();
//      polyList.mNormal.set(0,0,0);
//      polyList.mPlaneList.setSize(4);
//      polyList.mPlaneList[0].set(bBox.min, VectorF(-1,0,0));
//      polyList.mPlaneList[1].set(bBox.max, VectorF(0,1,0));
//      polyList.mPlaneList[2].set(bBox.max, VectorF(1,0,0));
//      polyList.mPlaneList[3].set(bBox.min, VectorF(0,-1,0));
//
//      // build the poly list
//      if(gServerContainer.buildPolyList(bBox, -1, &polyList))
//      {
//         glEnable(GL_CULL_FACE);
//         glDisable(GL_DEPTH_TEST);
//         glVertexPointer(3,GL_FLOAT,sizeof(ClippedPolyList::Vertex), polyList.mVertexList.address());
//         glEnableClientState(GL_VERTEX_ARRAY);
//
//         glColor4ub(mBoxIntersectColor.red, mBoxIntersectColor.green, mBoxIntersectColor.blue, mBoxIntersectColor.alpha);
//
//         glEnable(GL_BLEND);
//         glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//
//         // render em...
//         ClippedPolyList::Poly * p;
//         for (p = polyList.mPolyList.begin(); p < polyList.mPolyList.end(); p++) {
//            glDrawElements(GL_POLYGON,p->vertexCount,
//               GL_UNSIGNED_INT,&polyList.mIndexList[p->vertexStart]);
//         }
//
//         glDisableClientState(GL_VERTEX_ARRAY);
//         glEnable(GL_DEPTH_TEST);
//         glDisable(GL_CULL_FACE);
//      }
//      obj->enableCollision();
//   }

#1
05/29/2007 (12:50 pm)
This does indeed seem to be related to showing which polygond of one object overlap with the bounding box of another. however i'm not convinced yet that it's accurate, nor can i tell Exactly what info it's providing.