Ignore:
Timestamp:
01/09/08 14:29:56 (16 years ago)
Author:
bittner
Message:

Havran ray caster functional except enhanced features used by mutation and object based pvs

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
14 edited

Legend:

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

    r2582 r2583  
    7070// ray shooting is computed ! 
    7171void HavranRayCaster::CastRaysPacket4(Vector3 &boxmax, 
    72                                       Vector3 &boxmin, 
    73                                       Vector3 origin4[], 
    74                                       Vector3 direction4[], 
    75                                       int     result4[], 
    76                                       float   dist4[]) 
     72                                                                          Vector3 &boxmin, 
     73                                                                          Vector3 origin4[], 
     74                                                                          Vector3 direction4[], 
     75                                                                          int     result4[], 
     76                                                                          float   dist4[]) 
    7777{ 
    7878#ifdef USE_HAVRAN_RAYCASTER  
     
    8181    raypack.SetLoc(i, origin4[i]); 
    8282    raypack.SetDir(i, direction4[i]); 
    83   }   
    84  
     83  } 
     84   
    8585  // The same operations for packets of rays, if implemented by 
    8686  // a particular ASDS, otherwise it is emulated by decomposition 
     
    9393    Intersectable* intersectable; 
    9494    if ( (intersectable = raypack.GetObject(i)) ) 
    95       result4[i] = (int)intersectable; 
    96   } 
    97      
     95          // $$JB this is very hacky - > should be replaced with fetching the index of the triangle 
     96          result4[i] = (int)intersectable; 
     97  } 
     98   
    9899  return; 
    99100#endif 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Makefile

    r2582 r2583  
    11############################################################################# 
    22# Makefile for building: preprocessor 
    3 # Generated by qmake (2.00a) (Qt 4.1.2) on: st 9. I 11:11:49 2008 
     3# Generated by qmake (2.00a) (Qt 4.1.2) on: st 9. I 13:30:43 2008 
    44# Project:  preprocessor.pro 
    55# Template: app 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.cpp

    r2582 r2583  
    2828 
    2929  // VH - commened out !!!!! 8/1/2008 
    30   // #define SORT_RAY_ENTRIES 1 
     30#define SORT_RAY_ENTRIES 1 
    3131 
    3232// use avg ray contribution as importance 
     
    278278{ 
    279279#if 0 
    280   Vector3 v; 
    281   // mutate the termination 
    282   if (d.DrivingAxis() == 0) 
    283         v = Vector3(0, r[2]-0.5f, r[3]-0.5f); 
    284   else 
    285         if (d.DrivingAxis() == 1) 
    286           v = Vector3(r[2]-0.5f, 0, r[3]-0.5f); 
    287         else 
    288           v = Vector3(r[2]-0.5f, r[3]-0.5f, 0); 
    289    
    290   //   Vector3 nv; 
    291    
    292   //   if (Magnitude(v) > Limits::Small) 
    293   //    nv = Normalize(v); 
    294   //   else 
    295   //    nv = v; 
    296    
    297   //  v = nv*size + v*size; 
    298  
    299   return v*(4.0f*radius); 
    300 #endif 
    301 #if 0 
    302280  return (U*(vr2.xx - 0.5f) + V*(vr2.yy - 0.5f))*(4.0f*radius); 
    303281#endif 
     
    388366        preprocessor->mRayCaster->CastRaysPacket4(box.Min(), 
    389367                                                                                          box.Max(), 
    390                                                                                           origs, dirs, 
     368                                                                                          origs, 
     369                                                                                          dirs, 
    391370                                                                                          hit_triangles, 
    392371                                                                                          dist);        
    393372         
    394373        for (i=0; i < packetSize; i++) { 
     374          //cout<<hit_triangles[i]<<endl; 
    395375          if (hit_triangles[i] == -1) { 
    396             // break on first passing ray 
     376                // break on first passing ray 
    397377            break; 
    398378          } 
     
    771751  Environment::GetSingleton()->GetIntValue("Preprocessor.rayCastMethod", 
    772752                                                                                   rayCaster); 
    773   useEnhancedFeatures = (rayCaster == 
    774                                                  RayCaster::INTEL_RAYCASTER); 
     753  useEnhancedFeatures = (rayCaster != 
     754                                                 RayCaster::INTERNAL_RAYCASTER); 
    775755#else 
    776756  useEnhancedFeatures = false; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2582 r2583  
     1 
    12#include "SceneGraph.h" 
    23#include "Exporter.h" 
     
    2021#include "VssRay.h" 
    2122#include "IntelRayCaster.h" 
    22 #if TODO 
    2323#include "HavranRayCaster.h" 
    24 #endif 
    2524#include "InternalRayCaster.h" 
    2625#include "GlobalLinesRenderer.h" 
     
    415414 
    416415        vector<FaceParentInfo> *fi =  
    417           ((rayCastMethod == RayCaster::INTEL_RAYCASTER) && mLoadMeshes) ? 
     416          ((rayCastMethod == RayCaster::INTEL_RAYCASTER || 
     417                rayCastMethod == RayCaster::HAVRAN_RAYCASTER 
     418                ) && mLoadMeshes) ? 
    418419          &mFaceParents : NULL; 
    419  
     420         
    420421        if (files == 1)  
    421422        { 
     
    10471048bool Preprocessor::LoadInternKdTree(const string &internKdTree) 
    10481049{ 
    1049         bool mUseKdTree = true; 
    1050  
    1051         if (!mUseKdTree) { 
    1052           // create just a dummy KdTree 
    1053           mKdTree = new KdTree; 
    1054           return true; 
    1055         } 
    1056  
    1057         int rayCastMethod; 
    1058         Environment::GetSingleton()-> 
    1059           GetIntValue("Preprocessor.rayCastMethod", rayCastMethod); 
    1060  
    1061         if (rayCastMethod == 2) { 
    1062           //HavranRayCaster *hr = 
    1063           //  dynamic_cast<HavranRayCaster*>(mRayCaster); 
    1064 #if TODO 
    1065           HavranRayCaster *hr = 
    1066             reinterpret_cast<HavranRayCaster*>(mRayCaster); 
    1067           hr->Build(this->mObjects); 
    1068 #endif 
    1069           return true; 
    1070         }        
    1071  
    1072         // always try to load the kd tree 
    1073         cout << "loading kd tree file " << internKdTree << " ... " << endl; 
    1074  
    1075         if (!LoadKdTree(internKdTree)) { 
    1076                 cout << "error loading kd tree with filename "  
    1077                         << internKdTree << ", rebuilding it instead ... " << endl; 
    1078                 // build new kd tree from scene geometry 
    1079                 BuildKdTree(); 
    1080  
    1081                 // export kd tree? 
    1082                 const long startTime = GetTime(); 
    1083                 cout << "exporting kd tree ... "; 
    1084  
    1085                 if (!ExportKdTree(internKdTree)) 
    1086                 { 
    1087                         cout << " error exporting kd tree with filename "  
    1088                                 << internKdTree << endl; 
    1089                 } 
    1090                 else 
    1091                 { 
    1092                         cout << "finished in "  
    1093                                 << TimeDiff(startTime, GetTime()) * 1e-3  
    1094                                 << " secs" << endl; 
    1095                 } 
    1096         } 
    1097  
    1098         KdTreeStatistics(cout); 
    1099         cout << mKdTree->GetBox() << endl; 
    1100  
     1050  bool mUseKdTree = true; 
     1051 
     1052 
     1053  int rayCastMethod; 
     1054  Environment::GetSingleton()-> 
     1055        GetIntValue("Preprocessor.rayCastMethod", rayCastMethod); 
     1056 
     1057  if (rayCastMethod == 2) { 
     1058        //HavranRayCaster *hr = 
     1059        //  dynamic_cast<HavranRayCaster*>(mRayCaster); 
     1060        HavranRayCaster *hr = 
     1061          reinterpret_cast<HavranRayCaster*>(mRayCaster); 
     1062        hr->Build(this->mObjects); 
     1063        // $$ do not exit here, so that the "internal" kD-tree used  
     1064        // other puroposes can be loaded 
     1065        //      return true; 
     1066  } 
     1067 
     1068   
     1069  if (!mUseKdTree) { 
     1070        // create just a dummy KdTree 
     1071        mKdTree = new KdTree; 
    11011072        return true; 
     1073  } 
     1074   
     1075   
     1076   
     1077  // always try to load the kd tree 
     1078  cout << "loading kd tree file " << internKdTree << " ... " << endl; 
     1079   
     1080  if (!LoadKdTree(internKdTree)) { 
     1081        cout << "error loading kd tree with filename "  
     1082                 << internKdTree << ", rebuilding it instead ... " << endl; 
     1083        // build new kd tree from scene geometry 
     1084        BuildKdTree(); 
     1085         
     1086        // export kd tree? 
     1087        const long startTime = GetTime(); 
     1088        cout << "exporting kd tree ... "; 
     1089         
     1090        if (!ExportKdTree(internKdTree)) 
     1091          { 
     1092                cout << " error exporting kd tree with filename "  
     1093                         << internKdTree << endl; 
     1094          } 
     1095        else 
     1096          { 
     1097                cout << "finished in "  
     1098                         << TimeDiff(startTime, GetTime()) * 1e-3  
     1099                         << " secs" << endl; 
     1100          } 
     1101  } 
     1102   
     1103  KdTreeStatistics(cout); 
     1104  cout << mKdTree->GetBox() << endl; 
     1105   
     1106  return true; 
    11021107} 
    11031108 
     
    11541159        if (rayCastMethod == 2)  
    11551160        { 
    1156 #if TODO 
    1157                 cout << "ray cast method: havran" << endl; 
     1161          cout << "ray cast method: havran" << endl <<flush; 
    11581162          mRayCaster = new HavranRayCaster(*this); 
    1159 #endif 
    11601163        } 
    11611164         
     
    12061209        cout << "reserving " << reserveRays << " rays " << endl; 
    12071210        mRayCaster->ReserveVssRayPool(reserveRays); 
    1208          
     1211        cout<<"done."<<endl<<flush; 
    12091212        return true; 
    12101213} 
     
    12231226 
    12241227        // !!!!!!!!!!!!!!!! VH no sorting 
    1225         if (0 && 
     1228        if ( 
    12261229            rays.size() > 10000) 
    12271230        { 
     
    12631266#endif 
    12641267        } 
    1265         // cerr<<"Determining PVS objects"<<endl; 
     1268 
     1269        cerr<<"Determining PVS objects"<<endl; 
    12661270        DeterminePvsObjects(vssRays); 
     1271        cerr<<"done."<<endl; 
     1272 
    12671273} 
    12681274 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.cpp

    r2575 r2583  
    1414 
    1515RayCaster::RayCaster(const Preprocessor &preprocessor): 
    16 mPreprocessor(preprocessor) 
     16  mVssRayPool(), mPreprocessor(preprocessor) 
    1717{ 
    1818} 
     
    270270int 
    271271RayCaster::ProcessRay(const SimpleRay &simpleRay, 
    272                       Intersection &hitA, 
    273                       Intersection &hitB, 
    274                       VssRayContainer &vssRays, 
    275                       const AxisAlignedBox3 &box, 
    276                       const bool castDoubleRay, 
    277                       const bool pruneInvalidRays) 
     272                                          Intersection &hitA, 
     273                                          Intersection &hitB, 
     274                                          VssRayContainer &vssRays, 
     275                                          const AxisAlignedBox3 &box, 
     276                                          const bool castDoubleRay, 
     277                                          const bool pruneInvalidRays) 
    278278{ 
    279279  int hits = 0; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.h

    r2582 r2583  
    22#define _RayCaster_H__ 
    33 
     4 
    45#include "Containers.h" 
    56#include <string> 
     7#include <iostream> 
    68#include "Vector3.h" 
    79#include "VssRay.h" 
     10 
     11using namespace std; 
    812 
    913// 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2575 r2583  
    687687 
    688688 
    689 Intersectable *ViewCellsManager::GetIntersectable(const VssRay &ray, const bool isTermination) const 
     689Intersectable *ViewCellsManager::GetIntersectable(const VssRay &ray, 
     690                                                                                                  const bool isTermination) const 
    690691{ 
    691692        if (mUseKdPvs) 
  • GTP/trunk/Lib/Vis/Preprocessing/src/common.h

    r2582 r2583  
    2929 
    3030   
    31  
     31#if defined(_MSC_VER) 
     32// define __SSE__ macro as it is not defined under MSVC 
     33#define __SSE__ 
     34#endif 
    3235 
    3336// This constant should be used for the length of the array char for filenames 
  • GTP/trunk/Lib/Vis/Preprocessing/src/default.env

    r2582 r2583  
    4040        totalSamples 250000000 
    4141#       totalSamples 2000000 
    42         samplesPerPass 1000000 
     42        samplesPerPass 500000 
    4343        samplesPerEvaluation 5000000 
    4444 
     
    5353        useGlDebugger false 
    5454# 0 = INTERNAL  1 = MLRT 2 = HAVRAN 
    55         rayCastMethod 1 
     55        rayCastMethod 2 
    5656         
    5757#       type sampling 
     
    106106#       distributions rss+spatial+object_direction 
    107107#       distributions rss+object_direction+spatial+object+direction 
    108         distributions mutation+spatial+object_direction+filter_based 
     108        distributions mutation+spatial+object_direction 
    109109#       distributions rss+object_direction 
    110110#       distributions object_direction 
     
    202202        importRandomViewCells false 
    203203 
    204         useKdPvs true 
     204        useKdPvs false 
    205205        useKdPvsAfterFiltering true 
    206206        # samples used for view cell construction 
  • GTP/trunk/Lib/Vis/Preprocessing/src/havran/ktbftrav.cpp

    r2582 r2583  
    990990      results[i].tdist; 
    991991  } // for i 
     992  return 0; 
    992993} 
    993994#endif 
     
    13381339CKTBTraversal::FindNearestI(RayPacket2x2 &rp, Vector3 &boxmin, Vector3 &boxmax) 
    13391340{ 
     1341 
    13401342  static AxisAlignedBox3 localbox; 
    13411343  localbox.SetMin(boxmin); 
    13421344  localbox.SetMax(boxmax); 
    13431345 
     1346#define USE_SIMPLE_VERSION 1 
     1347 
     1348#if !USE_SIMPLE_VERSION 
    13441349  int m1 = _mm_movemask_ps(rp.dx4); 
    13451350  if ((m1 == 0)||(m1 == 15)) { 
     
    15141519    return; 
    15151520  }}} 
    1516  
     1521#endif 
    15171522  // Trace ray by ray 
    15181523  SimpleRay ray; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/havran/ktbtrav.h

    r2582 r2583  
    311311  } 
    312312  // $$JB correction 
    313   virtual int FindNearestI_16oneDir(SimpleRayContainer &rays, int offset) { 
    314         return 0; 
    315   } 
     313  virtual int FindNearestI_16oneDir(SimpleRayContainer &rays, int offset); 
     314 
    316315  int PrecomputeData(SimpleRayContainer &rays); 
    317316  void ReverseRay(const int indexA); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/havran/raypack.h

    r2582 r2583  
    2222#include "Vector3.h" 
    2323   
    24 // $$JB __SSE__ macro not define in _WIN32 
    25 //#ifdef __SSE__ 
    26 #if 1 
     24#ifdef __SSE__ 
    2725 
    2826// System headers for SSE 
  • GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro

    r2582 r2583  
    8585CONFIG(qt) { 
    8686win32:LIBS += cg.lib cgGL.lib 
    87 #DEFINES += USE_QT 
     87DEFINES += USE_QT 
    8888} 
    8989 
  • GTP/trunk/Lib/Vis/Preprocessing/src/run_test2

    r2582 r2583  
    33 
    44#COMMAND="./release/preprocessor.exe -preprocessor_quit_on_finish+" 
    5 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=500000 -total_samples=6000000" 
     5COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish- -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=500000 -total_samples=20000000" 
    66 
    77 
Note: See TracChangeset for help on using the changeset viewer.