Changeset 568 for trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp
- Timestamp:
- 01/23/06 15:44:19 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp
r566 r568 1980 1980 bool isAdjacent = true; 1981 1981 1982 if (1)1982 /* if (1) 1983 1983 { 1984 1984 // test all planes of current node if still adjacent … … 2014 2014 } 2015 2015 } 2016 } 2016 }*/ 2017 2017 // neighbor was found 2018 2018 if (isAdjacent) … … 3092 3092 int VspBspTree::RefineViewCells(const VssRayContainer &rays, const ObjectContainer &objects) 3093 3093 { 3094 int shuffled = 0;3095 3096 3094 Debug << "refining " << (int)mMergeQueue.size() << " candidates " << endl; 3095 3097 3096 BspLeaf::NewMail(); 3098 3097 … … 3116 3115 queue<BspMergeCandidate> *backQueue = &queue2; 3117 3116 3117 #if 1 3118 3118 Exporter *exporter = Exporter::GetExporter("neighors.x3d"); 3119 3119 … … 3125 3125 3126 3126 // HACK for visualization 3127 /*ViewCellContainer viewCells; 3128 ViewCell::NewMail(); 3129 CollectViewCells(mRoot, true, viewCells, true); 3130 for (int i = 0; i < viewCells.size(); ++i) 3131 viewCells[i]->SetId((int)RandomValue(0, Real(256*256*256))); 3132 */ 3133 Material m; 3134 m.mDiffuseColor.r = 0; 3135 m.mDiffuseColor.g = 0; 3136 m.mDiffuseColor.b = 0; 3137 3127 //ViewCellContainer viewCells; 3128 //ViewCell::NewMail(); 3129 //CollectViewCells(mRoot, true, viewCells, true); 3130 //for (int i = 0; i < viewCells.size(); ++i) 3131 // viewCells[i]->SetId((int)RandomValue(0, Real(256*256*256))); 3132 3133 3138 3134 while (!mMergeQueue.empty()) 3139 3135 { … … 3142 3138 mMergeQueue.pop(); 3143 3139 3144 3145 3140 // visualize neighbors 3146 m = RandomMaterial();3141 Material m = RandomMaterial(); 3147 3142 exporter->SetForcedMaterial(m); 3148 3149 BspNodeGeometry geom1, geom2; 3150 3151 ConstructGeometry(mc.GetLeaf1(), geom1); 3152 ConstructGeometry(mc.GetLeaf1(), geom2); 3153 3154 //m.mDiffuseColor.r = (mc.GetLeaf1()->GetViewCell()->GetId() & 256)/ 255.0f; 3155 //m.mDiffuseColor.g = ((mc.GetLeaf1()->GetViewCell()->GetId()>>8) & 256)/ 255.0f; 3156 //m.mDiffuseColor.b = ((mc.GetLeaf1()->GetViewCell()->GetId()>>16) & 256)/ 255.0f; 3157 exporter->SetForcedMaterial(m); 3158 exporter->ExportPolygons(geom1.mPolys); 3159 3160 //m.mDiffuseColor.r = (mc.GetLeaf2()->GetViewCell()->GetId() & 256)/ 255.0f; 3161 //m.mDiffuseColor.g = ((mc.GetLeaf2()->GetViewCell()->GetId()>>8) & 256)/ 255.0f; 3162 //m.mDiffuseColor.b = ((mc.GetLeaf2()->GetViewCell()->GetId()>>16) & 256)/ 255.0f; 3163 //exporter->SetForcedMaterial(m); 3164 exporter->ExportPolygons(geom2.mPolys); 3143 3144 3145 if (!mc.GetLeaf1()->Mailed()) 3146 { 3147 BspNodeGeometry geom1; 3148 ConstructGeometry(mc.GetLeaf1(), geom1); 3149 //m.mDiffuseColor.r = (mc.GetLeaf1()->GetViewCell()->GetId() & 256)/ 255.0f; 3150 //m.mDiffuseColor.g = ((mc.GetLeaf1()->GetViewCell()->GetId()>>8) & 256)/ 255.0f; 3151 //m.mDiffuseColor.b = ((mc.GetLeaf1()->GetViewCell()->GetId()>>16) & 256)/ 255.0f; 3152 //exporter->SetForcedMaterial(m); 3153 exporter->ExportPolygons(geom1.mPolys); 3154 mc.GetLeaf1()->Mail(); 3155 } 3156 3157 if (!mc.GetLeaf2()->Mailed()) 3158 { 3159 BspNodeGeometry geom2; 3160 ConstructGeometry(mc.GetLeaf2(), geom2); 3161 //m.mDiffuseColor.r = (mc.GetLeaf2()->GetViewCell()->GetId() & 256)/ 255.0f; 3162 //m.mDiffuseColor.g = ((mc.GetLeaf2()->GetViewCell()->GetId()>>8) & 256)/ 255.0f; 3163 //m.mDiffuseColor.b = ((mc.GetLeaf2()->GetViewCell()->GetId()>>16) & 256)/ 255.0f; 3164 //exporter->SetForcedMaterial(m); 3165 exporter->ExportPolygons(geom2.mPolys); 3166 mc.GetLeaf2()->Mail(); 3167 } 3165 3168 } 3166 3169 … … 3170 3173 delete exporter; 3171 3174 } 3172 3175 #else 3176 while (!mMergeQueue.empty()) 3177 { 3178 BspMergeCandidate mc = mMergeQueue.top(); 3179 shuffleQueue->push(mc); 3180 mMergeQueue.pop(); 3181 } 3182 #endif 3173 3183 const int numPasses = 5; 3174 3184 int pass = 0; 3175 3185 int passShuffled = 0; 3176 3186 int shuffled = 0; 3187 3188 BspLeaf::NewMail(); 3177 3189 3178 3190 do … … 3220 3232 } 3221 3233 3222 /*inline int SubtractedPvsSize(BspViewCell *vc, BspLeaf *l, const ObjectPvs &pvs2) 3234 3235 // recomputes pvs size minus pvs of leaf l 3236 #if 0 3237 inline int SubtractedPvsSize(BspViewCell *vc, BspLeaf *l, const ObjectPvs &pvs2) 3223 3238 { 3224 3239 ObjectPvs pvs; … … 3228 3243 pvs.AddPvs(*(*it)->mPvs); 3229 3244 return pvs.GetSize(); 3230 }*/ 3231 3245 } 3246 #endif 3247 3248 // computes pvs1 minus pvs2 3232 3249 inline int SubtractedPvsSize(ObjectPvs pvs1, const ObjectPvs &pvs2) 3233 3250 { … … 3240 3257 //const int pvs1 = SubtractedPvsSize(vc1, leaf, *leaf->mPvs); 3241 3258 const int pvs1 = SubtractedPvsSize(vc1->GetPvs(), *leaf->mPvs); 3259 3242 3260 const int pvs2 = AddedPvsSize(vc2->GetPvs(), *leaf->mPvs); 3243 3261 3244 // don t'shuffle leaves with pvs > max3262 // don't shuffle leaves with pvs > max 3245 3263 if (pvs1 + pvs2 > mViewCellsManager->GetMaxPvsSize()) 3246 3264 return 1e15f;
Note: See TracChangeset
for help on using the changeset viewer.