- Timestamp:
- 11/03/05 16:43:51 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp
r372 r374 28 28 VssPreprocessor::SetupRay(Ray &ray, 29 29 const Vector3 &point, 30 const Vector3 &direction ,31 const int type)30 const Vector3 &direction 31 ) 32 32 { 33 33 ray.intersections.clear(); 34 ray.kdLeaves.clear(); 35 ray.meshes.clear(); 36 34 // do not store anything else then intersections at the ray 35 ray.kdLeaves.clear(); 36 ray.mFlags = Ray::STORE_KDLEAVES; 37 37 38 // cout<<point<<" "<<direction<<endl; 38 ray.Init(point, direction, type);39 ray.Init(point, direction, Ray::LOCAL_RAY); 39 40 } 40 41 … … 51 52 int 52 53 VssPreprocessor::AddNodeSamples(const Ray &ray, 53 54 55 54 Intersectable *sObject, 55 Intersectable *tObject 56 ) 56 57 { 57 58 int contributingSamples = 0; … … 62 63 if (tObject) 63 64 objects++; 64 65 65 66 if (objects) { 66 67 for (j=0; j < ray.kdLeaves.size(); j++) { … … 123 124 KdNode *nodeToSample = NULL; 124 125 125 bool samplePvsBoundary = false; 126 if (pvsSize && samplePvsBoundary) { 127 // this samples the nodes from the boundary of the current PVS 128 // mail all nodes from the pvs 129 Intersectable::NewMail(); 130 KdPvsMap::iterator i = object->mKdPvs.mEntries.begin(); 131 132 for (; i != object->mKdPvs.mEntries.end(); i++) { 133 KdNode *node = (*i).first; 134 node->Mail(); 135 } 136 137 int maxTries = 2*pvsSize; 138 Debug << "Finding random neighbour" << endl; 139 for (int tries = 0; tries < 10; tries++) { 140 int index = RandomValue(0, pvsSize - 1); 141 KdPvsData data; 142 KdNode *node; 143 object->mKdPvs.GetData(index, node, data); 144 nodeToSample = mKdTree->FindRandomNeighbor(node, true); 145 if (nodeToSample) 146 break; 147 } 148 } else { 149 // just pickup a random node 150 // nodeToSample = mKdTree->GetRandomLeaf(Plane3(normal, point)); 151 nodeToSample = mKdTree->GetRandomLeaf(); 152 } 126 // just pickup a random node 127 nodeToSample = mKdTree->GetRandomLeaf(); 153 128 return nodeToSample; 154 129 } … … 229 204 230 205 // construct a ray 231 SetupRay(ray, point, direction , Ray::LOCAL_RAY);206 SetupRay(ray, point, direction); 232 207 233 208 sampleContributions = CastRay(reverseSample ? NULL : object, ray); … … 298 273 } 299 274 300 if (ViewCell::sHierarchy == ViewCell::KD) 301 cout << "#totalPvsSize=" << mKdTree->CollectLeafPvs() << endl; 302 303 304 // HoleSamplingPass(); 275 cout << "#totalPvsSize=" << mKdTree->CollectLeafPvs() << endl; 276 277 305 278 if (0) { 306 279 Exporter *exporter = Exporter::GetExporter("ray-density.x3d");
Note: See TracChangeset
for help on using the changeset viewer.