Ignore:
Timestamp:
06/05/06 23:14:04 (18 years ago)
Author:
mattausch
Message:

added mesh instance support
improved support for occlusion queries + other extensions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp

    r863 r1001  
    2424} 
    2525 
     26 
    2627VrmlExporter::~VrmlExporter() 
    2728{ 
     
    3132 
    3233bool VrmlExporter::ExportRays(const RayContainer &rays, 
    33                                                 const float length, 
    34                                                 const RgbColor &color) 
     34                                                          const float length, 
     35                                                          const RgbColor &color) 
    3536{ 
    3637  RayContainer::const_iterator ri = rays.begin(); 
     
    115116  for (; ri != rays.end(); ri++) { 
    116117    const Vector3 a = (*ri)->GetOrigin(); 
    117         //const Vector3 b = (*ri)->mTerminationObject ? (*ri)->GetTermination() : a + 1000 * Normalize((*ri)->GetDir()); 
    118         const Vector3 b = (*ri)->GetTermination(); // matt: change again!! 
     118        const Vector3 b = (*ri)->mTerminationObject ? (*ri)->GetTermination() : a + 1000 * Normalize((*ri)->GetDir()); 
     119        //const Vector3 b = (*ri)->GetTermination(); // matt: change back!! 
    119120 
    120121    stream<<a.x<<" "<<a.y<<" "<<a.z<<" ,"; 
     
    152153} 
    153154 
     155 
    154156void VrmlExporter::ExportIntersectable(Intersectable *object) 
    155157{ 
    156158        switch (object->Type())  
    157159        { 
    158          
    159160        case Intersectable::MESH_INSTANCE: 
     161                ExportMeshInstance((MeshInstance *)object); 
     162                break; 
    160163        case Intersectable::TRANSFORMED_MESH_INSTANCE: 
    161                 ExportMeshInstance((MeshInstance *)object); 
     164                ExportTransformedMeshInstance(dynamic_cast<TransformedMeshInstance *>(object)); 
    162165                break; 
    163166        case Intersectable::VIEW_CELL: 
     
    180183 
    181184 
     185void VrmlExporter::ExportTransformedMeshInstance(TransformedMeshInstance *mi) 
     186{ 
     187        Mesh mesh(*mi->GetMesh()); 
     188 
     189        Matrix4x4 m; 
     190        mi->GetWorldTransform(m); 
     191        mesh.ApplyTransformation(m); 
     192 
     193        ExportMesh(&mesh); 
     194} 
     195 
     196 
    182197void VrmlExporter::ExportViewCells(const ViewCellContainer &viewCells) 
    183198{ 
     
    189204        } 
    190205} 
     206 
    191207 
    192208void VrmlExporter::ExportBspLeaves(const BspTree &tree, const int maxPvs) 
     
    290306        stream << "}" << endl; // end material 
    291307        stream << "}" << endl; // end apperance 
    292         //stream << "}" << endl; // end shape 
    293  
     308         
    294309 
    295310        // wireframe modes => set indexed lines 
     
    314329        { 
    315330                Face *face = *fi; 
    316            
     331          
    317332                VertexIndexContainer::const_iterator vi = face->mVertexIndices.begin(); 
    318            
    319                 for (; vi != face->mVertexIndices.end(); vi++) 
     333          
     334                for (; vi != face->mVertexIndices.end(); ++ vi) 
    320335                { 
    321336                        stream << *vi << " "; 
     
    331346 
    332347        stream << "]" << endl; // end coordIndex 
    333          
     348 
    334349 
    335350        stream << "coord Coordinate {" << endl; 
     
    385400        stream << "}" << endl; // end material 
    386401        stream << "}" << endl; // end apperance 
    387         //stream << "}" << endl; // end shape 
    388  
     402         
    389403 
    390404        // wireframe modes => set indexed lines 
Note: See TracChangeset for help on using the changeset viewer.