Changeset 1520


Ignore:
Timestamp:
09/27/06 16:24:39 (18 years ago)
Author:
mattausch
Message:

moved raycasting out of preprocessor into specific ray casting interface

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
6 added
12 edited

Legend:

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

    r1500 r1520  
    12811281 
    12821282 
     1283 
    12831284  /***********************************************************************************/ 
    12841285  /*                         View cells related options                              */ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp

    r1501 r1520  
    198198        // establish visibility 
    199199        VssRayContainer vssRays; 
    200         CastRays(simpleRays, vssRays); 
     200        CastRays(simpleRays, vssRays, false); 
    201201        // add to ray queue 
    202202        EnqueueRays(vssRays); 
     
    273273        // generate vss rays 
    274274        VssRayContainer samples; 
    275         CastRays(simpleRays, samples); 
     275        CastRays(simpleRays, samples, true); 
    276276         
    277277        // add to ray queue 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r1486 r1520  
    1919#include "HierarchyManager.h" 
    2020#include "VssRay.h" 
    21  
    22  
    23 #ifdef GTP_INTERNAL 
    24 #include "ArchModeler2MLRT.hxx" 
    25 #endif 
     21#include "IntelRayCaster.h" 
     22#include "InternalRayCaster.h" 
     23 
     24 
    2625 
    2726#define DEBUG_RAYCAST 0 
     
    3130 
    3231const static bool ADDITIONAL_GEOMETRY_HACK = false; 
    33  
    34 //Preprocessor *preprocessor; 
    3532 
    3633 
     
    135132mRenderSimulator(NULL), 
    136133mPass(0), 
    137 mRayCastMethod(0), 
    138 mSceneGraph(NULL) 
     134mSceneGraph(NULL), 
     135mRayCaster(NULL) 
    139136{ 
    140137        Environment::GetSingleton()->GetBoolValue("Preprocessor.useGlRenderer", mUseGlRenderer); 
     
    149146        Environment::GetSingleton()->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace); 
    150147        Environment::GetSingleton()->GetBoolValue("Preprocessor.exportVisibility", mExportVisibility ); 
    151         Environment::GetSingleton()->GetIntValue("Preprocessor.rayCastMethod", mRayCastMethod); 
    152  
     148         
    153149        char buffer[256]; 
    154150        Environment::GetSingleton()->GetStringValue("Preprocessor.visibilityFile",  buffer); 
     
    162158        Debug << "detect empty view space=" << mDetectEmptyViewSpace << endl; 
    163159        Debug << "load meshes: " << mLoadMeshes << endl; 
    164  
    165         if (mRayCastMethod == 0) 
    166                 cout << "ray cast method: internal" << endl; 
    167         else 
    168                 cout << "ray cast method: intel" << endl; 
    169160} 
    170161 
     
    237228 
    238229        // intel ray caster can only trace triangles 
    239         vector<FaceParentInfo> *fi = (mRayCastMethod == Preprocessor::INTEL_RAYCASTER) ? 
     230        int rayCastMethod; 
     231        Environment::GetSingleton()->GetIntValue("Preprocessor.rayCastMethod", rayCastMethod); 
     232        vector<FaceParentInfo> *fi = (rayCastMethod == RayCaster::INTEL_RAYCASTER) ? 
    240233                &mFaceParents : NULL; 
    241234 
     
    759752        switch (strategyId) 
    760753        { 
    761         case OBJECT_BASED_DISTRIBUTION:  
     754        case SamplingStrategy::OBJECT_BASED_DISTRIBUTION:  
    762755                return new ObjectBasedDistribution(*this); 
    763         case OBJECT_DIRECTION_BASED_DISTRIBUTION: 
     756        case SamplingStrategy::OBJECT_DIRECTION_BASED_DISTRIBUTION: 
    764757                return new ObjectDirectionBasedDistribution(*this); 
    765         case DIRECTION_BASED_DISTRIBUTION: 
     758        case SamplingStrategy::DIRECTION_BASED_DISTRIBUTION: 
    766759                return new DirectionBasedDistribution(*this); 
    767         case DIRECTION_BOX_BASED_DISTRIBUTION:  
     760        case SamplingStrategy::DIRECTION_BOX_BASED_DISTRIBUTION:  
    768761                return new DirectionBoxBasedDistribution(*this); 
    769         case SPATIAL_BOX_BASED_DISTRIBUTION: 
     762        case SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION: 
    770763                return new SpatialBoxBasedDistribution(*this); 
    771764        //case OBJECTS_INTERIOR_DISTRIBUTION: 
     
    819812        } 
    820813 
    821         switch (mRayCastMethod) // use intel ray tracing 
    822         { 
    823         case INTEL_RAYCASTER: 
    824 #ifdef GTP_INTERNAL 
    825           cout<<"Ray Cast file: " << externKdTree << endl; 
    826           return mlrtaLoadAS(externKdTree.c_str()); 
    827 #endif 
    828         case INTERNAL_RAYCASTER: 
    829         default: 
    830                 break; 
     814        int rayCastMethod; 
     815        Environment::GetSingleton()->GetIntValue("Preprocessor.rayCastMethod", rayCastMethod); 
     816 
     817        if (rayCastMethod == 0) 
     818        { 
     819                mRayCaster = new InternalRayCaster(*this, mKdTree); 
     820                cout << "ray cast method: internal" << endl; 
     821        } 
     822        else 
     823        { 
     824                mRayCaster = new IntelRayCaster(*this, externKdTree); 
     825                cout << "ray cast method: intel" << endl; 
    831826        } 
    832827 
     
    834829} 
    835830 
    836  
    837 int Preprocessor::CastIntelDoubleRay( 
    838                                                                          const Vector3 &viewPoint, 
    839                                                                          const Vector3 &direction, 
    840                                                                          const float probability, 
    841                                                                          VssRayContainer &vssRays, 
    842                                                                          const AxisAlignedBox3 &box 
    843                                                                          ) 
    844 { 
    845 #ifdef GTP_INTERNAL 
    846         //cout << "intel ray" << endl; 
    847         VssRay *vssRay  = NULL; 
    848         int hits = 0; 
    849         int hittriangle; 
    850         Vector3 pointA, pointB; 
    851         Vector3 normalA, normalB; 
    852         Intersectable *objectA = NULL, *objectB = NULL; 
    853         float dist; 
    854         double normal[3]; 
    855  
    856         hittriangle = mlrtaIntersectAS(&viewPoint.x, 
    857                 &direction.x, 
    858                 normal, 
    859                 dist); 
    860  
    861         if (hittriangle != -1 ) { 
    862                 if (hittriangle >= mFaceParents.size()) 
    863                         cerr<<"Warning: triangle index out of range! "<<hittriangle<<endl; 
    864                 else { 
    865                         objectA = mFaceParents[hittriangle].mObject; 
    866                         normalA = Vector3(normal[0], normal[1], normal[2]); 
    867                         // Get the normal of that face 
    868                         //              Mesh *mesh = ((MeshInstance *)objectA)->GetMesh(); 
    869                         //              normalA = mesh->GetFacePlane(mFaceParents[forward_hit_triangles[i]].mFaceIndex).mNormal; 
    870                         //-rays[index+i].mDirection; // $$ temporary 
    871                         pointA = viewPoint + direction*dist; 
    872                 } 
    873         } 
    874  
    875  
    876         Vector3 dir = -direction; 
    877         hittriangle = mlrtaIntersectAS(&viewPoint.x, 
    878                 &dir.x, 
    879                 normal, 
    880                 dist); 
    881  
    882         if (hittriangle != -1 ) { 
    883                 if (hittriangle >= mFaceParents.size()) 
    884                         cerr<<"Warning: triangle index out of range! "<<hittriangle<<endl; 
    885                 else { 
    886                         objectB = mFaceParents[hittriangle].mObject; 
    887                         normalB = Vector3(normal[0], normal[1], normal[2]); 
    888                         // Get the normal of that face 
    889                         //              Mesh *mesh = ((MeshInstance *)objectB)->GetMesh(); 
    890                         //              normalA = mesh->GetFacePlane(mFaceParents[forward_hit_triangles[i]].mFaceIndex).mNormal; 
    891                         //-rays[index+i].mDirection; // $$ temporary 
    892                         pointB = viewPoint + dir * dist; 
    893                 } 
    894         } 
    895  
    896         return ProcessRay(viewPoint, 
    897                 direction, 
    898                 objectA, pointA, normalA, 
    899                 objectB, pointB, normalB, 
    900                 probability, 
    901                 vssRays, 
    902                 box 
    903                 ); 
    904 #else 
    905         return -1; 
    906 #endif 
    907 } 
    908  
    909  
    910 Intersectable *Preprocessor::CastIntelSingleRay(const Vector3 &viewPoint, 
    911                                                                                                 const Vector3 &direction, 
    912                                                                                                 //const float probability, 
    913                                                                                                 Vector3 &tPoint, 
    914                                                                                                 const AxisAlignedBox3 &box 
    915                                                                                                 ) 
    916 { 
    917         AxisAlignedBox3 sbox = box; 
    918         sbox.Enlarge(Vector3(-Limits::Small)); 
    919  
    920         if (!sbox.IsInside(viewPoint)) 
    921                 return 0; 
    922          
    923 #ifdef GTP_INTERNAL 
    924         float pforg[3]; 
    925         float pfdir[3]; 
    926         double pfnorm[3]; 
    927  
    928         pforg[0] = viewPoint[0]; pforg[1] = viewPoint[1]; pforg[2] = viewPoint[2]; 
    929         pfdir[0] = direction[0]; pfdir[1] = direction[1]; pfdir[2] = direction[2]; 
    930  
    931         float dist; 
    932         const int hittriangle = mlrtaIntersectAS(pforg, pfdir, pfnorm, dist); 
    933  
    934         if (hittriangle == -1) 
    935           { 
    936                 static Ray ray; 
    937                 SetupRay(ray, viewPoint, direction); 
    938                  
    939                 float tmin = 0, tmax; 
    940                 if (box.ComputeMinMaxT(ray, &tmin, &tmax) && tmin < tmax) 
    941                   { 
    942                         tPoint = ray.Extrap(tmax); 
    943                   } 
    944                  
    945                 return NULL; 
    946           } 
    947         else { 
    948           if (hittriangle >= mFaceParents.size()) { 
    949                 cerr<<"Warning: triangle index out of range! "<<hittriangle<<endl; 
    950                 return NULL; 
    951           } 
    952           else { 
    953                  
    954                 tPoint[0] = pforg[0] + pfdir[0] * dist; 
    955                 tPoint[1] = pforg[1] + pfdir[1] * dist; 
    956                 tPoint[2] = pforg[2] + pfdir[2] * dist; 
    957                  
    958                 return mFaceParents[hittriangle].mObject; 
    959           } 
    960         } 
    961  
    962 #else 
    963         const int hittriangle = -1; 
    964         return NULL; 
    965 #endif 
    966  
    967 } 
    968  
    969  
    970 int Preprocessor::CastInternalRay( 
    971                                                                   const Vector3 &viewPoint, 
    972                                                                   const Vector3 &direction, 
    973                                                                   const float probability, 
    974                                                                   VssRayContainer &vssRays, 
    975                                                                   const AxisAlignedBox3 &box 
    976                                                                   ) 
    977 { 
    978   //cout << "internal ray" << endl; 
    979   int hits = 0; 
    980   static Ray ray; 
    981   Intersectable *objectA, *objectB; 
    982   Vector3 pointA, pointB; 
    983  
    984   //  AxisAlignedBox3 box = Union(mKdTree->GetBox(), mViewCellsManager->GetViewSpaceBox()); 
    985   AxisAlignedBox3 sbox = box; 
    986   sbox.Enlarge(Vector3(-Limits::Small)); 
    987   if (!sbox.IsInside(viewPoint)) 
    988         return 0; 
    989          
    990   SetupRay(ray, viewPoint, direction); 
    991   ray.mFlags &= ~Ray::CULL_BACKFACES; 
    992  
    993   // cast ray to KD tree to find intersection with other objects 
    994   float bsize = Magnitude(box.Size()); 
    995    
    996    
    997   if (mKdTree->CastRay(ray)) { 
    998         objectA = ray.intersections[0].mObject; 
    999         pointA = ray.Extrap(ray.intersections[0].mT); 
    1000         if (mDetectEmptyViewSpace) 
    1001           if (DotProd(ray.intersections[0].mNormal, direction) >= 0) { 
    1002                 // discard the sample 
    1003                 return 0; 
    1004           } 
    1005          
    1006   } else { 
    1007         objectA = NULL; 
    1008         // compute intersection with the scene bounding box 
    1009         float tmin, tmax; 
    1010         if (box.ComputeMinMaxT(ray, &tmin, &tmax) && tmin < tmax) 
    1011           pointA = ray.Extrap(tmax); 
    1012         else 
    1013           return 0; 
    1014   } 
    1015  
    1016   SetupRay(ray, viewPoint, -direction); 
    1017   ray.mFlags &= ~Ray::CULL_BACKFACES; 
    1018    
    1019   if (mKdTree->CastRay(ray)) { 
    1020         objectB = ray.intersections[0].mObject; 
    1021         pointB = ray.Extrap(ray.intersections[0].mT); 
    1022         if (mDetectEmptyViewSpace) 
    1023           if (DotProd(ray.intersections[0].mNormal, direction) <= 0) { 
    1024                 // discard the sample 
    1025                 return 0; 
    1026           } 
    1027   } else { 
    1028         objectB = NULL; 
    1029         float tmin, tmax; 
    1030         if (box.ComputeMinMaxT(ray, &tmin, &tmax) && tmin < tmax) 
    1031           pointB = ray.Extrap(tmax); 
    1032         else 
    1033           return 0; 
    1034   } 
    1035    
    1036    
    1037   VssRay *vssRay  = NULL; 
    1038   bool validSample = (objectA != objectB); 
    1039   if (validSample) { 
    1040         if (objectA) { 
    1041           vssRay = new VssRay(pointB, 
    1042                                                   pointA, 
    1043                                                   objectB, 
    1044                                                   objectA, 
    1045                                                   mPass, 
    1046                                                   probability 
    1047                                                   ); 
    1048           vssRays.push_back(vssRay); 
    1049           //cout << "ray: " << *vssRay << endl; 
    1050           hits ++; 
    1051         } 
    1052          
    1053         if (objectB) { 
    1054           vssRay = new VssRay(pointA, 
    1055                                                   pointB, 
    1056                                                   objectA, 
    1057                                                   objectB, 
    1058                                                   mPass, 
    1059                                                   probability 
    1060                                                   ); 
    1061           vssRays.push_back(vssRay); 
    1062           //cout << "ray: " << *vssRay << endl; 
    1063           hits ++; 
    1064         } 
    1065   } 
    1066    
    1067   return hits; 
    1068 } 
    1069  
    1070  
    1071 int 
    1072 Preprocessor::ProcessRay( 
    1073                                                  const Vector3 &viewPoint, 
    1074                                                  const Vector3 &direction, 
    1075                                                  Intersectable *objectA, 
    1076                                                  Vector3 &pointA, 
    1077                                                  const Vector3 &normalA, 
    1078                                                  Intersectable *objectB, 
    1079                                                  Vector3 &pointB, 
    1080                                                  const Vector3 &normalB, 
    1081                                                  const float probability, 
    1082                                                  VssRayContainer &vssRays, 
    1083                                                  const AxisAlignedBox3 &box 
    1084                                                  ) 
    1085 { 
    1086   int hits=0; 
    1087 #if DEBUG_RAYCAST 
    1088   Debug<<"PR "; 
    1089 #endif 
    1090   if (objectA == NULL && objectB == NULL) 
    1091         return 0; 
    1092    
    1093   AxisAlignedBox3 sbox = box; 
    1094   sbox.Enlarge(Vector3(-Limits::Small)); 
    1095  
    1096   if (!sbox.IsInside(viewPoint)) 
    1097         return 0; 
    1098  
    1099   if (objectA == NULL) { 
    1100         // compute intersection with the scene bounding box 
    1101         static Ray ray; 
    1102         SetupRay(ray, viewPoint, direction); 
    1103          
    1104         float tmin, tmax; 
    1105         if (box.ComputeMinMaxT(ray, &tmin, &tmax) && tmin < tmax) 
    1106           pointA = ray.Extrap(tmax); 
    1107         else 
    1108           return 0; 
    1109   } else { 
    1110         if (mDetectEmptyViewSpace) 
    1111           if (DotProd(normalA, direction) >= 0) { 
    1112                 // discard the sample 
    1113                 return 0; 
    1114           } 
    1115   } 
    1116  
    1117   if (objectB == NULL) { 
    1118         // compute intersection with the scene bounding box 
    1119         static Ray ray; 
    1120         SetupRay(ray, viewPoint, -direction); 
    1121  
    1122         float tmin, tmax; 
    1123         if (box.ComputeMinMaxT(ray, &tmin, &tmax) && tmin < tmax) 
    1124           pointB = ray.Extrap(tmax); 
    1125         else 
    1126           return 0; 
    1127   } else { 
    1128         if (mDetectEmptyViewSpace) 
    1129           if (DotProd(normalB, direction) <= 0) { 
    1130                 // discard the sample 
    1131                 return 0; 
    1132           } 
    1133   } 
    1134    
    1135   VssRay *vssRay  = NULL; 
    1136   bool validSample = (objectA != objectB); 
    1137   if (validSample) { 
    1138         if (objectA) { 
    1139           vssRay = new VssRay(pointB, 
    1140                                                   pointA, 
    1141                                                   objectB, 
    1142                                                   objectA, 
    1143                                                   mPass, 
    1144                                                   probability 
    1145                                                   ); 
    1146           vssRays.push_back(vssRay); 
    1147           //cout << "ray: " << *vssRay << endl; 
    1148           hits ++; 
    1149         } 
    1150          
    1151         if (objectB) { 
    1152           vssRay = new VssRay(pointA, 
    1153                                                   pointB, 
    1154                                                   objectA, 
    1155                                                   objectB, 
    1156                                                   mPass, 
    1157                                                   probability 
    1158                                                   ); 
    1159           vssRays.push_back(vssRay); 
    1160           //cout << "ray: " << *vssRay << endl; 
    1161           hits ++; 
    1162         } 
    1163   } 
    1164  
    1165  
    1166   return hits; 
    1167 } 
    1168  
    1169 void 
    1170 Preprocessor::CastRays16(const int index, 
    1171                                                  SimpleRayContainer &rays,  
    1172                                                  VssRayContainer &vssRays, 
    1173                                                  const AxisAlignedBox3 &sbox) 
    1174 { 
    1175   int i; 
    1176   const int num = 16; 
    1177  
    1178 #if DEBUG_RAYCAST 
    1179   Debug<<"C16 "<<flush; 
    1180 #endif 
    1181   if (mRayCastMethod == INTEL_RAYCASTER) { 
    1182 #ifdef GTP_INTERNAL 
    1183  
    1184   int forward_hit_triangles[16]; 
    1185   float forward_dist[16]; 
    1186  
    1187   int backward_hit_triangles[16]; 
    1188   float backward_dist[16]; 
    1189  
    1190  
    1191   Vector3 min = sbox.Min(); 
    1192   Vector3 max = sbox.Max(); 
    1193    
    1194   for (i=0; i < num; i++) { 
    1195         mlrtaStoreRayAS16(&rays[index + i].mOrigin.x, 
    1196                                           &rays[index + i].mDirection.x, 
    1197                                           i); 
    1198   } 
    1199    
    1200   mlrtaTraverseGroupAS16(&min.x, 
    1201                                                  &max.x, 
    1202                                                  forward_hit_triangles, 
    1203                                                  forward_dist); 
    1204  
    1205   for (i=0; i < num; i++) { 
    1206         Vector3 dir = -rays[index + i].mDirection; 
    1207         mlrtaStoreRayAS16(&rays[index+i].mOrigin.x, 
    1208                                           &dir.x, 
    1209                                           i); 
    1210   } 
    1211    
    1212   mlrtaTraverseGroupAS16(&min.x, 
    1213                                                  &max.x, 
    1214                                                  backward_hit_triangles, 
    1215                                                  backward_dist); 
    1216    
    1217  
    1218   for (i=0; i < num; i++) { 
    1219         Intersectable *objectA = NULL, *objectB = NULL; 
    1220         Vector3 pointA, pointB; 
    1221         Vector3 normalA, normalB; 
    1222  
    1223         if (forward_hit_triangles[i] != -1 ) { 
    1224           if (forward_hit_triangles[i] >= mFaceParents.size()) 
    1225                 cerr<<"Warning: triangle index out of range! "<<forward_hit_triangles[i]<<endl; 
    1226           else {  
    1227                 objectA = mFaceParents[forward_hit_triangles[i]].mObject; 
    1228                 // Get the normal of that face 
    1229                 normalA = objectA->GetNormal(mFaceParents[forward_hit_triangles[i]].mFaceIndex); 
    1230                 //-rays[index+i].mDirection; // $$ temporary 
    1231                 pointA = rays[index+i].Extrap(forward_dist[i]); 
    1232           } 
    1233         } 
    1234           
    1235         if (backward_hit_triangles[i]!=-1) { 
    1236           if (backward_hit_triangles[i] >= mFaceParents.size()) 
    1237                 cerr<<"Warning: triangle  index out of range! "<<backward_hit_triangles[i]<<endl; 
    1238           else {  
    1239                 objectB = mFaceParents[backward_hit_triangles[i]].mObject; 
    1240                 normalB = objectB->GetNormal(mFaceParents[forward_hit_triangles[i]].mFaceIndex); 
    1241                  
    1242                 // normalB = rays[index+i].mDirection; // $$ temporary 
    1243                 pointB = rays[index+i].Extrap(-backward_dist[i]); 
    1244           } 
    1245         } 
    1246   
    1247         ProcessRay(rays[index+i].mOrigin, 
    1248                            rays[index+i].mDirection, 
    1249                            objectA, pointA, normalA, 
    1250                            objectB, pointB, normalB, 
    1251                            rays[index+i].mPdf, 
    1252                            vssRays, 
    1253                            sbox 
    1254                            ); 
    1255   } 
    1256    
    1257 #endif 
    1258    
    1259   } else { 
    1260  
    1261         for (i=index; i < index + num; i++) { 
    1262           CastRay(rays[i].mOrigin, 
    1263                           rays[i].mDirection, 
    1264                           rays[i].mPdf, 
    1265                           vssRays, 
    1266                           sbox); 
    1267         } 
    1268   } 
    1269 #if DEBUG_RAYCAST 
    1270   Debug<<"C16F\n"<<flush; 
    1271 #endif 
    1272 } 
    1273831 
    1274832void 
    1275833Preprocessor::CastRays( 
    1276834                                           SimpleRayContainer &rays, 
    1277                                            VssRayContainer &vssRays 
     835                                           VssRayContainer &vssRays, 
     836                                           const bool castDoubleRays 
    1278837                                           ) 
    1279838{ 
    1280   long t1 = GetTime(); 
    1281    
    1282   for (int i = 0; i < (int)rays.size(); ) { 
    1283           // method only available for intel raycaster yet 
    1284         if (i + 16 < (int)rays.size()) { 
    1285  
    1286           CastRays16( 
    1287                                  i, 
    1288                                  rays, 
    1289                                  vssRays, 
    1290                                  mViewCellsManager->GetViewSpaceBox()); 
    1291           i += 16; 
    1292         } else { 
    1293           CastRay(rays[i].mOrigin, 
    1294                           rays[i].mDirection, 
    1295                           rays[i].mPdf, 
    1296                           vssRays, 
    1297                           mViewCellsManager->GetViewSpaceBox()); 
    1298           i++; 
    1299         } 
    1300         if (i % 10000 == 0) 
    1301           cout<<"."; 
    1302   } 
    1303  
    1304   long t2 = GetTime(); 
    1305   cout<<2*rays.size()/(1e3*TimeDiff(t1, t2))<<"M rays/s"<<endl; 
    1306 } 
    1307  
    1308 Intersectable * 
    1309 Preprocessor::CastSimpleRay( 
    1310                                                         const Vector3 &viewPoint, 
    1311                                                         const Vector3 &direction, 
    1312                                                         const AxisAlignedBox3 &box, 
    1313                                                         Vector3 &point, 
    1314                                                         Vector3 &normal 
    1315                                                         ) 
    1316 { 
    1317   Intersectable *result = NULL; 
    1318   switch (mRayCastMethod) 
    1319         { 
    1320         case INTEL_RAYCASTER: { 
    1321           
    1322           int hittriangle; 
    1323  
    1324 #ifdef GTP_INTERNAL 
    1325           float dist;  
    1326           double n[3]; 
    1327  
    1328           hittriangle = mlrtaIntersectAS(&viewPoint.x, 
    1329                                                                          &direction.x, 
    1330                                                                          n, 
    1331                                                                          dist); 
    1332  
    1333            if (hittriangle !=-1 ) { 
    1334                 if (hittriangle >= mFaceParents.size()) 
    1335                   cerr<<"Warning: triangle index out of range! "<<hittriangle<<endl; 
    1336                 else { 
    1337                   result = mFaceParents[hittriangle].mObject; 
    1338                   normal = Vector3(n[0], n[1], n[2]); 
    1339                   point = viewPoint + direction*dist; 
    1340                 } 
    1341           } 
    1342 #else 
    1343           hittriangle = -1; 
    1344 #endif 
    1345  
    1346           break; 
    1347         } 
    1348         case INTERNAL_RAYCASTER: 
    1349         default: { 
    1350           static Ray ray; 
    1351            
    1352           ray.intersections.clear(); 
    1353           // do not store anything else then intersections at the ray 
    1354           ray.Init(viewPoint, direction, Ray::LOCAL_RAY); 
    1355            
    1356           ray.mFlags &= ~Ray::CULL_BACKFACES; 
    1357            
    1358           if (mKdTree->CastRay(ray)) { 
    1359                 result = ray.intersections[0].mObject; 
    1360                 point = ray.Extrap(ray.intersections[0].mT); 
    1361                 normal = ray.intersections[0].mNormal; 
    1362           } 
    1363           break; 
    1364         } 
    1365         } 
    1366   return result; 
    1367 } 
    1368  
    1369 int 
    1370 Preprocessor::CastRay( 
    1371                                           const Vector3 &viewPoint, 
    1372                                           const Vector3 &direction, 
    1373                                           const float probability, 
    1374                                           VssRayContainer &vssRays, 
    1375                                           const AxisAlignedBox3 &box 
    1376                                           ) 
    1377 { 
    1378 #if DEBUG_RAYCAST 
    1379   Debug<<"CR "<<flush; 
    1380 #endif 
    1381   switch (mRayCastMethod) 
    1382         { 
    1383         case INTEL_RAYCASTER: 
    1384                 return CastIntelDoubleRay(viewPoint, direction, probability, vssRays, box); 
    1385         case INTERNAL_RAYCASTER: 
    1386         default: 
    1387                 return CastInternalRay(viewPoint, direction, probability, vssRays, box); 
    1388         } 
    1389 #if DEBUG_RAYCAST        
    1390   Debug<<"CRF "<<flush; 
    1391 #endif   
     839        long t1 = GetTime(); 
     840 
     841        if (castDoubleRays) 
     842        { 
     843                for (int i = 0; i < (int)rays.size(); )  
     844                { 
     845                        if (i + 16 < (int)rays.size())  
     846                        { 
     847                                mRayCaster->CastRays16( 
     848                                        i, 
     849                                        rays,                            
     850                                        vssRays, 
     851                                        mViewCellsManager->GetViewSpaceBox(), 
     852                                        castDoubleRays); 
     853                                i += 16; 
     854                        }  
     855                        else  
     856                        { 
     857                                mRayCaster->CastRay( 
     858                                        rays[i].mOrigin, 
     859                                        rays[i].mDirection, 
     860                                        rays[i].mPdf, 
     861                                        vssRays, 
     862                                        mViewCellsManager->GetViewSpaceBox(), 
     863                                        castDoubleRays); 
     864                                i++; 
     865                        } 
     866                         
     867                        if (i % 10000 == 0) 
     868                                cout<<"."; 
     869                } 
     870 
     871                long t2 = GetTime(); 
     872 
     873                if (castDoubleRays) 
     874                        cout << 2 * rays.size() / (1e3f * TimeDiff(t1, t2)) << "M rays/s" << endl; 
     875                else 
     876                        cout << rays.size() / (1e3f * TimeDiff(t1, t2)) << "M rays/s" << endl; 
     877        } 
     878         
    1392879} 
    1393880 
     
    1429916                                                        const Vector3 &point, 
    1430917                                                        const Vector3 &direction 
    1431                                                         ) 
     918                                                        ) const 
    1432919{ 
    1433920        ray.Clear(); 
     
    1436923} 
    1437924 
    1438 } 
     925 
     926} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h

    r1486 r1520  
    88#include "KdTree.h" 
    99 
    10 // matt: remove qt dependencies 
    11 //#include <QObject> 
     10 
    1211 
    1312namespace GtpVisibilityPreprocessor { 
     
    2928class Intersectable; 
    3029class VssRay; 
     30class RayCaster; 
     31 
    3132 
    3233/** Namespace for the external visibility preprocessor 
     
    4546{ 
    4647  //Q_OBJECT 
    47  
     48        friend class RayCaster; 
     49        friend class IntelRayCaster; 
     50        friend class InternalRayCaster; 
     51         
    4852public: 
    4953        /** Default constructor initialising e.g., KD tree and BSP tree. 
     
    5155        Preprocessor(); 
    5256 
    53    virtual ~Preprocessor(); 
     57        virtual ~Preprocessor(); 
    5458 
    5559  /** Load the input scene.  
     
    123127  bool ExportKdTree(const string filename); 
    124128 
    125   /** Get Sample rays of particular type, returns false if this 
    126           type of rays is not supported by the preprocessor 
    127   */ 
    128   enum { 
    129         OBJECT_BASED_DISTRIBUTION, 
    130         DIRECTION_BASED_DISTRIBUTION, 
    131         DIRECTION_BOX_BASED_DISTRIBUTION, 
    132         SPATIAL_BOX_BASED_DISTRIBUTION, 
    133         RSS_BASED_DISTRIBUTION, 
    134         RSS_SILHOUETTE_BASED_DISTRIBUTION, 
    135         VSS_BASED_DISTRIBUTION, 
    136         OBJECT_DIRECTION_BASED_DISTRIBUTION, 
    137         OBJECTS_INTERIOR_DISTRIBUTION 
    138   }; 
    139    
    140   enum { 
    141           INTERNAL_RAYCASTER = 0, 
    142           INTEL_RAYCASTER 
    143   }; 
    144  
    145129  virtual bool 
    146130  GenerateRays( 
     
    157141 
    158142  virtual void CastRays(SimpleRayContainer &rays, 
    159                                                 VssRayContainer &vssRays); 
     143                                                VssRayContainer &vssRays, 
     144                                                const bool castDoubleRays); 
    160145 
    161146  /** Returns a view cells manager of the given name. 
     
    178163          ); 
    179164 
    180   Intersectable * 
    181   CastSimpleRay( 
    182                                 const Vector3 &viewPoint, 
    183                                 const Vector3 &direction, 
    184                                 const AxisAlignedBox3 &box, 
    185                                 Vector3 &point, 
    186                                 Vector3 &normal 
    187                                 ); 
    188165   
    189166  //////////////////////////////////////////////// 
     
    234211  float mVisibilityFilterWidth; 
    235212  
    236   int GetRayCastMethod() { return mRayCastMethod; } 
    237   void SetRayCastMethod(int rayCastMethod) { mRayCastMethod = rayCastMethod; } 
     213  //int GetRayCastMethod() { return mRayCastMethod; } 
     214  //void SetRayCastMethod(int rayCastMethod) { mRayCastMethod = rayCastMethod; } 
    238215 
    239216  int mPass; 
     
    241218protected: 
    242219 
    243         void SetupRay(Ray &ray, const Vector3 &point, const Vector3 &direction); 
    244  
    245   int 
    246   ProcessRay( 
    247                          const Vector3 &viewPoint, 
    248                          const Vector3 &direction, 
    249                          Intersectable *objectA, 
    250                          Vector3 &pointA, 
    251                          const Vector3 &normalA, 
    252                          Intersectable *objectB, 
    253                          Vector3 &pointB, 
    254                          const Vector3 &normalB, 
    255                          const float probability, 
    256                          VssRayContainer &vssRays, 
    257                          const AxisAlignedBox3 &box); 
    258    
    259   int CastInternalRay( 
    260                                           const Vector3 &viewPoint, 
    261                                           const Vector3 &direction, 
    262                                           const float probability, 
    263                                           VssRayContainer &vssRays, 
    264                                           const AxisAlignedBox3 &box); 
    265    
    266   int CastIntelDoubleRay( 
    267                                                  const Vector3 &viewPoint, 
    268                                                  const Vector3 &direction, 
    269                                                  const float probability, 
    270                                                  VssRayContainer &vssRays, 
    271                                                  const AxisAlignedBox3 &box); 
    272    
    273   Intersectable *CastIntelSingleRay( 
    274                                                                         const Vector3 &viewPoint, 
    275                                                                         const Vector3 &direction, 
    276                                                                         Vector3 &tPoint, 
    277                                                                         const AxisAlignedBox3 &box); 
    278    
    279   ///////////////////////// 
    280  
    281   int mRayCastMethod; 
     220        void SetupRay(Ray &ray, const Vector3 &point, const Vector3 &direction) const; 
     221 
     222        // matt: previously was a signal 
     223        void EvalPvsStat(); 
     224 
     225        ///////////////////////// 
     226 
     227  RayCaster *mRayCaster; 
    282228  /// samples used for construction of the BSP view cells tree. 
    283229  int mBspConstructionSamples; 
     
    287233  */ 
    288234  RenderSimulator *mRenderSimulator; 
    289  
    290235   
    291236  vector<FaceParentInfo> mFaceParents; 
    292    
     237 
    293238  GlRendererBuffer *renderer; 
    294 // matt: remove qt dependencies  
    295 //signals: 
    296   void EvalPvsStat(); 
    297  
    298   protected: 
    299  
    300    
    301   void CastRays16(const int i, 
    302                                   SimpleRayContainer &rays,  
    303                                   VssRayContainer &vssRays, 
    304                                   const AxisAlignedBox3 &sbox); 
     239 
    305240   
    306241}; 
    307242 
    308 //extern Preprocessor *preprocessor; 
    309243 
    310244} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj

    r1501 r1520  
    217217                                OptimizeForProcessor="3" 
    218218                                OptimizeForWindowsApplication="TRUE" 
    219                                 AdditionalIncludeDirectories="..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;..\MultiLevelRayTracing;&quot;$(QTDIR)\include\QtCore&quot;" 
     219                                AdditionalIncludeDirectories="..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;..\MultiLevelRayTracing;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(QTDIR)\include&quot;" 
    220220                                PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL" 
    221221                                ExceptionHandling="TRUE" 
     
    364364                        <File 
    365365                                RelativePath=".\HierarchyManager.h"> 
     366                        </File> 
     367                        <File 
     368                                RelativePath=".\IntelRayCaster.cpp"> 
     369                        </File> 
     370                        <File 
     371                                RelativePath=".\IntelRayCaster.h"> 
     372                        </File> 
     373                        <File 
     374                                RelativePath=".\InternalRayCaster.cpp"> 
     375                        </File> 
     376                        <File 
     377                                RelativePath=".\InternalRayCaster.h"> 
    366378                        </File> 
    367379                        <File 
     
    556568                        </File> 
    557569                        <File 
     570                                RelativePath=".\QtPreprocessorThread.cpp"> 
     571                        </File> 
     572                        <File 
     573                                RelativePath=".\QtPreprocessorThread.h"> 
     574                        </File> 
     575                        <File 
    558576                                RelativePath="..\src\Ray.cpp"> 
    559577                        </File> 
    560578                        <File 
    561579                                RelativePath="..\src\Ray.h"> 
     580                        </File> 
     581                        <File 
     582                                RelativePath=".\RayCaster.cpp"> 
     583                        </File> 
     584                        <File 
     585                                RelativePath=".\RayCaster.h"> 
    562586                        </File> 
    563587                        <File 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.vcproj

    r1270 r1520  
    103103                                Name="VCMIDLTool"/> 
    104104                        <Tool 
    105                                 Name="VCPostBuildEventTool"/> 
     105                                Name="VCPostBuildEventTool" 
     106                                Description="&quot;copy dll to preprocessor dir&quot;" 
     107                                CommandLine="copy $(OutDir)\*.dll ..\..\bin\"/> 
    106108                        <Tool 
    107109                                Name="VCPreBuildEventTool"/> 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtPreprocessorThread.cpp

    r1457 r1520  
     1#ifdef GTP_INTERNAL 
    12#include <QApplication> 
    2  
    33#include "QtPreprocessorThread.h" 
    44#include "Camera.h" 
     
    1717{ 
    1818  if (p->mQuitOnFinish) 
    19         connect(this, SIGNAL(finished()), qApp, SLOT(closeAllWindows(void))); 
     19  { 
     20          connect(this, SIGNAL(finished()), qApp, SLOT(closeAllWindows(void))); 
     21  } 
    2022} 
    2123 
     
    2830} 
    2931 
     32#endif 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp

    r1454 r1520  
    1212#include "RenderSimulator.h" 
    1313#include "GlRenderer.h" 
     14#include "SamplingStrategy.h" 
     15 
    1416 
    1517namespace GtpVisibilityPreprocessor { 
     
    6264 
    6365  switch (sampleType) { 
    64   case RSS_BASED_DISTRIBUTION: 
    65   case RSS_SILHOUETTE_BASED_DISTRIBUTION: 
     66  case SamplingStrategy::RSS_BASED_DISTRIBUTION: 
     67  case SamplingStrategy::RSS_SILHOUETTE_BASED_DISTRIBUTION: 
    6668        if (mRssTree) { 
    6769          GenerateImportanceRays(mRssTree, number, rays); 
     
    554556 
    555557        if (mUseImportanceSampling) { 
    556           GenerateRays(mInitialSamples/3, SPATIAL_BOX_BASED_DISTRIBUTION, rays); 
    557           GenerateRays(mInitialSamples/3, OBJECT_BASED_DISTRIBUTION, rays); 
    558           GenerateRays(mInitialSamples/3, DIRECTION_BASED_DISTRIBUTION, rays); 
     558          GenerateRays(mInitialSamples/3, SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION, rays); 
     559          GenerateRays(mInitialSamples/3, SamplingStrategy::OBJECT_BASED_DISTRIBUTION, rays); 
     560          GenerateRays(mInitialSamples/3, SamplingStrategy::DIRECTION_BASED_DISTRIBUTION, rays); 
    559561          //    GenerateRays(mInitialSamples/4, OBJECT_DIRECTION_BASED_DISTRIBUTION, rays); 
    560562        } else { 
    561           int rayType = SPATIAL_BOX_BASED_DISTRIBUTION; 
     563                int rayType = SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION; 
    562564          if (mObjectBasedSampling) 
    563                 rayType = OBJECT_BASED_DISTRIBUTION; 
     565                rayType = SamplingStrategy::OBJECT_BASED_DISTRIBUTION; 
    564566          else 
    565567                if (mDirectionalSampling) 
    566                   rayType = DIRECTION_BASED_DISTRIBUTION; 
     568                  rayType = SamplingStrategy::DIRECTION_BASED_DISTRIBUTION; 
    567569          cout<<"Generating rays..."<<endl; 
    568570          GenerateRays(mRssSamplesPerPass, rayType, rays); 
     
    571573         
    572574        cout<<"Casting initial rays..."<<endl<<flush; 
    573         CastRays(rays, mVssRays); 
     575        CastRays(rays, mVssRays, true); 
    574576 
    575577        ExportObjectRays(mVssRays, 1546); 
     
    690692          t1 = GetTime(); 
    691693           
    692           GenerateRays(int(mRssSamplesPerPass*ratios[0]), RSS_BASED_DISTRIBUTION, rays); 
     694          GenerateRays(int(mRssSamplesPerPass*ratios[0]), SamplingStrategy::RSS_BASED_DISTRIBUTION, rays); 
    693695 
    694696          rays.NormalizePdf((float)rays.size()); 
    695697           
    696           CastRays(rays, tmpVssRays); 
     698          CastRays(rays, tmpVssRays, true); 
    697699          castRays += (int)rays.size(); 
    698700#if ADD_RAYS_IN_PLACE  
     
    711713          if (ratios[1]!=0.0f) { 
    712714                t1 = GetTime(); 
    713                 GenerateRays(int(mRssSamplesPerPass*ratios[1]), SPATIAL_BOX_BASED_DISTRIBUTION, rays); 
    714                 CastRays(rays, tmpVssRays); 
     715                GenerateRays(int(mRssSamplesPerPass*ratios[1]), SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION, rays); 
     716                CastRays(rays, tmpVssRays, true); 
    715717                castRays += (int)rays.size(); 
    716718#if ADD_RAYS_IN_PLACE  
     
    733735          if (ratios[2]!=0.0f) { 
    734736                t1 = GetTime(); 
    735                 GenerateRays(int(mRssSamplesPerPass*ratios[2]), DIRECTION_BASED_DISTRIBUTION, rays); 
    736                 CastRays(rays, tmpVssRays); 
     737                GenerateRays(int(mRssSamplesPerPass*ratios[2]), SamplingStrategy::DIRECTION_BASED_DISTRIBUTION, rays); 
     738                CastRays(rays, tmpVssRays, true); 
    737739                castRays += (int)rays.size(); 
    738740#if ADD_RAYS_IN_PLACE  
     
    775777        } 
    776778        else { 
    777           int rayType = SPATIAL_BOX_BASED_DISTRIBUTION; 
     779                int rayType = SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION; 
    778780          if (mObjectBasedSampling) 
    779                 rayType = OBJECT_BASED_DISTRIBUTION; 
     781                  rayType = SamplingStrategy::OBJECT_BASED_DISTRIBUTION; 
    780782          else 
    781783                if (mDirectionalSampling) 
    782                   rayType = DIRECTION_BASED_DISTRIBUTION; 
     784                        rayType = SamplingStrategy::DIRECTION_BASED_DISTRIBUTION; 
    783785 
    784786          cout<<"Generating rays..."<<endl; 
     
    788790 
    789791          cout<<"Casting rays..."<<endl; 
    790           CastRays(rays, vssRays); 
     792          CastRays(rays, vssRays, true); 
    791793          cout<<"done."<<endl; 
    792794          castRays += (int)rays.size(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp

    r1486 r1520  
    4747 
    4848  // cast ray to KD tree to find intersection with other objects 
     49#if 0 
    4950  object = CastSimpleRay(origin, 
    5051                                                 direction, 
     
    5354                                                 normal 
    5455                                                 ); 
    55    
     56#endif 
     57 
    5658  if (mDetectEmptyViewSpace && DotProd(normal, direction) >= 0) { 
    5759        object = NULL; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp

    r1297 r1520  
    88 
    99namespace GtpVisibilityPreprocessor { 
     10 
     11 
     12SamplingStrategy::SamplingStrategy(const Preprocessor &preprocessor):  
     13mPreprocessor(preprocessor) 
     14{ 
     15} 
     16 
     17 
     18SamplingStrategy::~SamplingStrategy()  
     19{ 
     20} 
     21 
    1022 
    1123 
     
    142154} 
    143155 
    144 /* 
     156#if 0 
    145157bool ObjectsInteriorDistribution::GenerateSample(SimpleRay &ray) const 
    146158{ 
     
    170182 
    171183        return true; 
    172 }*/ 
    173  
    174184} 
     185#endif 
     186} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.h

    r1021 r1520  
    1515 public: 
    1616 
     17         /** Sample rays of particular type 
     18         */ 
     19         enum  
     20         { 
     21                 OBJECT_BASED_DISTRIBUTION, 
     22                 DIRECTION_BASED_DISTRIBUTION, 
     23                 DIRECTION_BOX_BASED_DISTRIBUTION, 
     24                 SPATIAL_BOX_BASED_DISTRIBUTION, 
     25                 RSS_BASED_DISTRIBUTION, 
     26                 RSS_SILHOUETTE_BASED_DISTRIBUTION, 
     27                 VSS_BASED_DISTRIBUTION, 
     28                 OBJECT_DIRECTION_BASED_DISTRIBUTION, 
     29                 OBJECTS_INTERIOR_DISTRIBUTION 
     30         }; 
     31 
    1732         /** Default constructor 
    1833     */ 
    19          SamplingStrategy(const Preprocessor &preprocessor): mPreprocessor(preprocessor) 
    20          {} 
     34         SamplingStrategy(const Preprocessor &preprocessor); 
    2135 
    22          virtual ~SamplingStrategy() {}; 
     36         virtual ~SamplingStrategy(); 
    2337 
    2438         /** Each strategy has to implement this function. 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1486 r1520  
    2222#include "OspTree.h" 
    2323#include "BvHierarchy.h" 
     24#include "SamplingStrategy.h" 
    2425 
    2526 
     
    110111        if (strcmp(buf, "box") == 0) 
    111112        { 
    112                 mSamplingType = Preprocessor::SPATIAL_BOX_BASED_DISTRIBUTION; 
     113                mSamplingType = SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION; 
    113114        } 
    114115        else if (strcmp(buf, "directional") == 0) 
    115116        { 
    116                 mSamplingType = Preprocessor::DIRECTION_BASED_DISTRIBUTION; 
     117                mSamplingType = SamplingStrategy::DIRECTION_BASED_DISTRIBUTION; 
    117118        } 
    118119        else if (strcmp(buf, "object_directional") == 0) 
    119120        { 
    120                 mSamplingType = Preprocessor::OBJECT_DIRECTION_BASED_DISTRIBUTION; 
     121                mSamplingType = SamplingStrategy::OBJECT_DIRECTION_BASED_DISTRIBUTION; 
    121122        } 
    122123        /*else if (strcmp(buf, "interior") == 0) 
     
    135136        if (strcmp(buf, "box") == 0) 
    136137        { 
    137                 mEvaluationSamplingType = Preprocessor::SPATIAL_BOX_BASED_DISTRIBUTION; 
     138                mEvaluationSamplingType = SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION; 
    138139        } 
    139140        else if (strcmp(buf, "directional") == 0) 
    140141        { 
    141                 mEvaluationSamplingType = Preprocessor::DIRECTION_BASED_DISTRIBUTION; 
     142                mEvaluationSamplingType = SamplingStrategy::DIRECTION_BASED_DISTRIBUTION; 
    142143        } 
    143144        else if (strcmp(buf, "object_directional") == 0) 
    144145        { 
    145                 mEvaluationSamplingType = Preprocessor::OBJECT_DIRECTION_BASED_DISTRIBUTION; 
     146                mEvaluationSamplingType = SamplingStrategy::OBJECT_DIRECTION_BASED_DISTRIBUTION; 
    146147        } 
    147148        /*else if (strcmp(buf, "interior") == 0) 
    148149        { 
    149                 mEvaluationSamplingType = Preprocessor::OBJECTS_INTERIOR_DISTRIBUTION; 
     150                mEvaluationSamplingType = SamplingStrategy::OBJECTS_INTERIOR_DISTRIBUTION; 
    150151        }*/ 
    151152        else 
     
    271272 
    272273        // shoot simple ray and add it to importance samples 
    273         mPreprocessor->CastRays(simpleRays, passSamples); 
     274        mPreprocessor->CastRays(simpleRays, passSamples, true); 
    274275        Debug << "cast " <<  samplesPerPass << " samples in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
    275276 
     
    394395        const int n = mConstructionSamples; //+initialSamples; 
    395396        // should we use directional samples? 
    396         bool dirSamples = (mSamplingType == Preprocessor::DIRECTION_BASED_DISTRIBUTION); 
     397        bool dirSamples = (mSamplingType == SamplingStrategy::DIRECTION_BASED_DISTRIBUTION); 
    397398 
    398399        while (numSamples < n) 
     
    489490                VssRayContainer visualizationSamples; 
    490491 
     492                //////// 
    491493                //-- visualization rays, e.g., to show some samples in the scene 
    492494                CastPassSamples(mVisualizationSamples, 
    493                                             Preprocessor::DIRECTION_BASED_DISTRIBUTION,  
     495                                            SamplingStrategy::DIRECTION_BASED_DISTRIBUTION,  
    494496                                                visualizationSamples); 
    495497 
     
    841843 
    842844        // should directional sampling be used? 
    843         bool dirSamples = (mEvaluationSamplingType == Preprocessor::DIRECTION_BASED_DISTRIBUTION); 
     845        bool dirSamples = (mEvaluationSamplingType == SamplingStrategy::DIRECTION_BASED_DISTRIBUTION); 
    844846 
    845847        cout << "reseting pvs ... "; 
Note: See TracChangeset for help on using the changeset viewer.