Changeset 261 for trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp
- Timestamp:
- 09/08/05 18:45:51 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp
r260 r261 7 7 ViewCell::ViewCell(Mesh *mesh): mMesh(mesh), mPvs(NULL) 8 8 { 9 } 10 11 ViewCell::~ViewCell() 12 { 13 // NOTE: should I really do this here? 14 DEL_PTR(mMesh); 9 15 } 10 16 … … 77 83 } 78 84 79 ViewCell *ViewCell:: Convert2ViewCell(Face *face, float scale)85 ViewCell *ViewCell::ExtrudeViewCell(const Triangle3 &baseTri, const float height) 80 86 { 81 // TODO: delete mesh87 // one mesh per view cell 82 88 Mesh *mesh = new Mesh(); 83 mesh->mFaces.push_back(face);84 89 90 //-- construct prism 85 91 92 // bottom 93 mesh->mFaces.push_back(new Face(0,1,2)); 94 // top 95 mesh->mFaces.push_back(new Face(5,4,3)); 96 // sides 97 mesh->mFaces.push_back(new Face(0, 3, 4, 1)); 98 mesh->mFaces.push_back(new Face(1, 4, 5, 2)); 99 mesh->mFaces.push_back(new Face(0, 2, 5, 3)); 100 101 102 //--- extrude new vertices for top of prism 103 Vector3 triNorm = baseTri.GetNormal(); 104 105 Triangle3 topTri; 106 107 // add base vertices and calculate top vertices 108 for (int i = 0; i < 3; ++i) 109 { 110 mesh->mVertices.push_back(baseTri.mVertices[i]); 111 topTri.mVertices[i] = baseTri.mVertices[i] + height * triNorm; 112 } 113 114 // add top vertices 115 for (int i = 0; i < 3; ++i) 116 mesh->mVertices.push_back(topTri.mVertices[1]); 117 86 118 return new ViewCell(mesh); 87 119 }
Note: See TracChangeset
for help on using the changeset viewer.