- Timestamp:
- 10/09/06 22:38:07 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreTypeConverter.cpp
r863 r1593 1 1 #include "OgreTypeConverter.h" 2 #include "Mesh.h" 3 #include <OgreManualObject.h> 4 #include <OgreSceneManager.h> 2 5 3 6 … … 13 16 } 14 17 18 15 19 GtpVisibilityPreprocessor::Vector3 OgreTypeConverter::ConvertFromOgre(const Vector3 &v) 16 20 { 17 21 return GtpVisibilityPreprocessor::Vector3(v.x, v.y, v.z); 18 22 } 19 23 24 20 25 AxisAlignedBox OgreTypeConverter::ConvertToOgre(const GtpVisibilityPreprocessor::AxisAlignedBox3 &box) 21 26 { … … 26 31 } 27 32 33 28 34 Vector3 OgreTypeConverter::ConvertToOgre(const GtpVisibilityPreprocessor::Vector3 &v) 29 35 { 30 36 return Vector3(v.getX(), v.getY(), v.getZ()); 31 37 } 38 39 40 ManualObject *OgreTypeConverter::ConvertToOgre(GtpVisibilityPreprocessor::Mesh *mesh, SceneManager *sceneMgr) 41 { 42 char name[100]; 43 sprintf(name, "mesh%04d", mesh->GetId()); 44 45 ManualObject* manual = sceneMgr->createManualObject(name); 46 manual->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_STRIP); 47 48 // create vertices 49 GtpVisibilityPreprocessor::VertexContainer::const_iterator vit, 50 vit_end = mesh->mVertices.end(); 51 52 for (vit = mesh->mVertices.begin(); vit != vit_end; ++ vit) 53 { 54 const GtpVisibilityPreprocessor::Vector3 vtx = *vit; 55 manual->position(vtx.x, vtx.y, vtx.z); 56 } 57 58 // create faces indices 59 GtpVisibilityPreprocessor::FaceContainer::const_iterator fit, fit_end = mesh->mFaces.end(); 60 61 for (fit = mesh->mFaces.begin(); fit != fit_end; ++ fit) 62 { 63 GtpVisibilityPreprocessor::Face *face = *fit; 64 GtpVisibilityPreprocessor::VertexIndexContainer::const_iterator 65 iit, iit_end = face->mVertexIndices.end(); 66 //GtpVisibilityPreprocessor::VertexIndexContainer::const_reverse_iterator 67 // iit, iit_end = face->mVertexIndices.rend(); 68 69 for (iit = face->mVertexIndices.begin(); iit != iit_end; ++ iit) 70 { 71 const int index = *iit; 72 manual->index(index); 73 } 74 } 75 76 manual->end(); 77 //mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(manual); 78 79 return manual; 32 80 } 81 82 83 }
Note: See TracChangeset
for help on using the changeset viewer.