- Timestamp:
- 10/18/05 14:21:26 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
r335 r339 27 27 void 28 28 SamplingPreprocessor::SetupRay(Ray &ray, 29 30 31 29 const Vector3 &point, 30 const Vector3 &direction, 31 const int type) 32 32 { 33 33 ray.intersections.clear(); … … 148 148 149 149 int 150 SamplingPreprocessor::CastRay(Intersectable *object, Ray &ray) 150 SamplingPreprocessor::CastRay(Intersectable *object, 151 Ray &ray) 151 152 { 152 153 int sampleContributions = 0; 153 154 155 long t1 = GetTime(); 154 156 // cast ray to KD tree to find intersection with other objects 155 157 mKdTree->CastRay(ray); 156 158 long t2 = GetTime(); 159 160 cout<<object->GetId()<<" "<<TimeDiff(t1, t2); 161 157 162 if (mViewCellsType == BSP_VIEW_CELLS) 158 {159 // cast ray to BSP tree to get intersection with view cells160 if (mBspTree)161 163 { 162 mBspTree->CastRay(ray); 163 164 sampleContributions += AddObjectSamples(object, ray); 164 // cast ray to BSP tree to get intersection with view cells 165 if (mBspTree) 166 { 167 mBspTree->CastRay(ray); 168 169 sampleContributions += AddObjectSamples(object, ray); 165 170 166 if (!ray.intersections.empty()) // second intersection found 167 { 168 sampleContributions += 169 AddObjectSamples(ray.intersections[0].mObject, ray); 170 } 171 if (!ray.intersections.empty()) // second intersection found 172 { 173 sampleContributions += 174 AddObjectSamples(ray.intersections[0].mObject, ray); 175 } 176 } 171 177 } 172 }173 178 else 174 {175 if (ray.leaves.size()) {176 sampleContributions += AddNodeSamples(object, ray);177 178 if (ray.intersections.size()) {179 sampleContributions += AddNodeSamples(ray.intersections[0].mObject, ray);180 }181 }182 }179 { 180 if (ray.leaves.size()) { 181 sampleContributions += AddNodeSamples(object, ray); 182 183 if (ray.intersections.size()) { 184 sampleContributions += AddNodeSamples(ray.intersections[0].mObject, ray); 185 } 186 } 187 } 183 188 184 189 return sampleContributions;
Note: See TracChangeset
for help on using the changeset viewer.