Ignore:
Timestamp:
09/08/05 18:45:51 (19 years ago)
Author:
mattausch
Message:

added viewcell loader

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp

    r260 r261  
    77ViewCell::ViewCell(Mesh *mesh): mMesh(mesh), mPvs(NULL)  
    88{ 
     9} 
     10 
     11ViewCell::~ViewCell() 
     12{ 
     13        // NOTE: should I really do this here? 
     14        DEL_PTR(mMesh); 
    915} 
    1016 
     
    7783} 
    7884 
    79 ViewCell *ViewCell::Convert2ViewCell(Face *face, float scale) 
     85ViewCell *ViewCell::ExtrudeViewCell(const Triangle3 &baseTri, const float height) 
    8086{ 
    81         // TODO: delete mesh 
     87        // one mesh per view cell 
    8288        Mesh *mesh = new Mesh(); 
    83         mesh->mFaces.push_back(face); 
    84      
     89         
     90        //-- construct prism 
    8591 
     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         
    86118        return new ViewCell(mesh); 
    87119} 
Note: See TracChangeset for help on using the changeset viewer.