Ignore:
Timestamp:
01/10/08 02:43:33 (16 years ago)
Author:
mattausch
Message:

worked on ray viz

File:
1 edited

Legend:

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

    r2586 r2587  
    1313#include "BvHierarchy.h" 
    1414#include "KdTree.h" 
     15#include "SamplingStrategy.h" 
     16 
    1517 
    1618#ifdef USE_CG 
     
    200202 
    201203 
    202 void GlRenderer::RenderRays(const VssRayContainer &rays) 
     204void GlRenderer::RenderRays(const VssRayContainer &rays, int colorType) 
    203205{ 
    204206        VssRayContainer::const_iterator it = rays.begin(), it_end = rays.end(); 
     
    206208        glBegin(GL_LINES); 
    207209         
     210        float importance; 
     211 
    208212        for (; it != it_end; ++it)  
    209213        { 
    210214                VssRay *ray = *it; 
    211                 const float importance = log10(1e3*ray->mWeightedPvsContribution)/3.0f; 
    212                  
    213                 //glColor3f(1.0f, 0.0f, 0.0f); 
    214                 glColor3f(importance, importance, importance); 
     215 
     216                switch (colorType) 
     217                { 
     218                case 0: 
     219                        glColor3f(1.0f, 0.0f, 0.0f); 
     220                        break; 
     221 
     222                case 1: 
     223                        importance = 1.0f * ray->Length() /  Magnitude(mViewCellsManager->GetViewSpaceBox().Diagonal()); 
     224                        glColor3f(importance, importance, importance); 
     225                        break; 
     226 
     227                case 2: 
     228                        importance = log10(1e3 * ray->mPvsContribution) / 3.0f; 
     229                        glColor3f(importance, importance, importance); 
     230                        break; 
     231 
     232                case 3: 
     233                        { 
     234                                // nested switches ok? 
     235                                switch (ray->mDistribution) 
     236                                { 
     237                                case SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION: 
     238                                        glColor3f(1, 0, 0); 
     239                                        break; 
     240                                case SamplingStrategy::MUTATION_BASED_DISTRIBUTION: 
     241                                        glColor3f(0, 1, 0); 
     242                                        break; 
     243                                case SamplingStrategy::DIRECTION_BASED_DISTRIBUTION: 
     244                                        glColor3f(0, 1, 1); 
     245                                        break; 
     246                                        case SamplingStrategy::OBJECT_DIRECTION_BASED_DISTRIBUTION: 
     247                                        glColor3f(1, 1, 0); 
     248                                        break; 
     249                                } 
     250                        } 
     251                }                
     252 
    215253                glVertex3fv(&ray->mOrigin.x); 
    216254                glVertex3fv(&ray->mTermination.x); 
Note: See TracChangeset for help on using the changeset viewer.