Changeset 3246
- Timestamp:
- 01/04/09 21:48:45 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp
r3161 r3246 122 122 } 123 123 124 ++ dummy;125 124 if (!texcoords.empty()) 126 125 { -
GTP/trunk/App/Demos/Vis/FriendlyCulling/MainApp.vcproj
r3238 r3246 154 154 GenerateDebugInformation="true" 155 155 SubSystem="1" 156 LargeAddressAware="2" 156 157 OptimizeReferences="2" 157 158 EnableCOMDATFolding="2" -
GTP/trunk/App/Demos/Vis/FriendlyCulling/VisibilitySolutionConverter/VisibilitySolutionConverter.cpp
r3243 r3246 20 20 #define TYPE_LEAF -3 21 21 22 //const int maxVertices = 20000000; 23 22 23 static const float sScale = 0.05f; 24 24 25 25 … … 125 125 126 126 127 if (!normals.empty())127 /*if (!normals.empty()) 128 128 { 129 129 faceNormals.push_back(normals[nIndices[idx1]]); … … 144 144 faceNormals.push_back(n); 145 145 faceNormals.push_back(n); 146 } 146 }*/ 147 147 148 148 if (!texCoords.empty()) … … 196 196 { 197 197 // convert to our camera system: change y and z 198 geom->mVertices[i].x = vertices[i].x; 199 geom->mVertices[i].y = -vertices[i].z; 200 geom->mVertices[i].z = vertices[i].y; 201 202 geom->mNormals[i].x = normals[i].x; 203 geom->mNormals[i].y = -normals[i].z; 204 geom->mNormals[i].z = normals[i].y; 205 198 geom->mVertices[i] = vertices[i]; 199 geom->mNormals[i] = normals[i]; 200 206 201 if (i < geom->mTexcoordCount) 207 202 { … … 249 244 UpdateBvh(mRoot); 250 245 251 cout << " bvh: " << mRoot->first << " " << mRoot->last << "bb: " << mRoot->box << endl;246 cout << "loading bvh, bb: " << mRoot->box << endl; 252 247 253 248 cout << "writing scene" << endl; … … 277 272 vector<TexCoord> texCoords; 278 273 279 if (ReadSimpleObj(filename, vertices, normals, texCoords))280 //if (ReadObj(filename, vertices, normals, texCoords))274 //if (ReadSimpleObj(filename, vertices, normals, texCoords)) 275 if (ReadObj(filename, vertices, normals, texCoords)) 281 276 { 282 277 ConstructBvhObjects(vertices, normals, texCoords); … … 297 292 if ((file = fopen(filename.c_str(), "r")) == NULL) return false; 298 293 299 VertexArray tempVertices; 294 VertexArray tempVertices; 295 //tempVertices.reserve(11000000); 296 //tempVertices.reserve(13000000 * 3); 297 300 298 VertexArray tempNormals; 301 299 vector<TexCoord> tempTexcoords; … … 307 305 char str[len]; 308 306 309 while (fgets(str, len, file) != NULL)310 {311 if (line % 500000 == 0)312 cout << line << " " << str << endl;313 314 ++ line;315 316 switch (str[0])317 {318 case 'v': // vertex or normal319 {320 float x, y, z;321 322 //if (tempVertices.size() >= maxVertices * 3) continue;323 324 switch (str[1])325 {326 case 'n' :327 sscanf(str + 2, "%f %f %f", &x, &y, &z);328 tempNormals.push_back(CHCDemoEngine::Vector3(x, y, z));329 break;330 case 't':331 sscanf(str + 2, "%f %f", &x, &y);332 tempTexcoords.push_back(pair<float, float>(x, y));333 break;334 default:335 sscanf(str + 1, "%f %f %f", &x, &y, &z);336 const float scale = 1.0f;337 //const float scale = 0.1f;338 tempVertices.push_back(CHCDemoEngine::Vector3(x * scale, y * scale, z * scale));339 //cout <<"v " << x << " " << y << " "<< z << " ";340 }341 break;342 }343 case 'f':344 {345 //////////346 //-- indices in the current line347 348 //if (tempVertices.size() >= maxVertices * 3) continue;349 LoadIndices(str,350 tempVertices, tempNormals, tempTexcoords,351 vertices, normals, texcoords);352 353 break;354 }355 break;356 default:357 // throw away line358 break;359 }360 }361 362 fclose(file);363 364 return !vertices.empty();365 }366 367 368 bool VisibilitySolutionConverter::ReadSimpleObj(const string &filename,369 VertexArray &vertices,370 VertexArray &normals,371 vector<TexCoord> &texcoords)372 {373 307 const string binFilename = ReplaceSuffix(filename, ".obj", ".bn"); 374 308 375 if (!ReadBinObj(binFilename, vertices , 1))309 if (!ReadBinObj(binFilename, vertices)) 376 310 { 377 311 cout << "binary dump " << binFilename << " not available, loading ascii obj" << endl; 378 379 FILE *file;380 if ((file = fopen(filename.c_str(), "r")) == NULL) return false;381 382 int line = 0;383 const int len = 10000;384 char str[len];385 312 386 313 while (fgets(str, len, file) != NULL) 387 314 { 388 315 if (line % 500000 == 0) 389 cout << line << " " << str << endl;316 cout << line << " " << str; 390 317 391 318 ++ line; … … 397 324 float x, y, z; 398 325 399 sscanf(str + 1, "%f %f %f", &x, &y, &z); 400 const float scale = 1.0f; 401 vertices.push_back(CHCDemoEngine::Vector3(x * scale, y * scale, z * scale)); 326 //if (tempVertices.size() >= maxVertices * 3) continue; 327 328 switch (str[1]) 329 { 330 case 'n' : 331 sscanf(str + 2, "%f %f %f", &x, &y, &z); 332 tempNormals.push_back(CHCDemoEngine::Vector3(x, -z, y)); 333 break; 334 case 't': 335 sscanf(str + 2, "%f %f", &x, &y); 336 tempTexcoords.push_back(pair<float, float>(x, y)); 337 break; 338 default: 339 sscanf(str + 1, "%f %f %f", &x, &y, &z); 340 341 CHCDemoEngine::Vector3 v = CHCDemoEngine::Vector3(x, -z, y) * sScale; 342 tempVertices.push_back(v); 343 //cout <<"v " << x << " " << y << " "<< z << " "; 344 } 402 345 break; 403 346 } 347 case 'f': 348 { 349 ////////// 350 //-- indices in the current line 351 352 //if (tempVertices.size() >= maxVertices * 3) continue; 353 LoadIndices(str, 354 tempVertices, tempNormals, tempTexcoords, 355 vertices, normals, texcoords); 356 357 break; 358 } 359 break; 404 360 default: 405 361 // throw away line … … 408 364 } 409 365 410 fclose(file);411 412 cout << "dumping " << vertices.size() << " to binary " << binFilename << endl;413 366 ExportBinObj(binFilename, vertices); 414 367 } 415 416 for (size_t i = 0; i < vertices.size(); i += 3) 417 { 418 // no face normals? => create normals 419 const CHCDemoEngine::Triangle3 420 tri(vertices[i], vertices[i + 1], vertices[i + 2]); 421 422 const CHCDemoEngine::Vector3 n = tri.GetNormal(); 423 424 normals.push_back(n); 425 normals.push_back(n); 426 normals.push_back(n); 427 } 368 else if (0) 369 { 370 cout << "creating normals" << endl; 371 normals.reserve(vertices.size()); 372 373 for (size_t i = 0; i < vertices.size(); i += 3) 374 { 375 // no face normals? => create normals 376 const CHCDemoEngine::Triangle3 377 tri(vertices[i], vertices[i + 1], vertices[i + 2]); 378 379 const CHCDemoEngine::Vector3 n = tri.GetNormal(); 380 381 normals.push_back(n); 382 normals.push_back(n); 383 normals.push_back(n); 384 } 385 } 386 387 cout << "finished creating normals" << endl; 388 389 fclose(file); 428 390 429 391 return !vertices.empty(); 430 392 } 431 432 393 433 394 … … 554 515 const vector<TexCoord> &texCoords) 555 516 { 556 VertexArray _vertices;557 VertexArray _normals;558 vector<TexCoord> _texCoords;559 560 517 CHCDemoEngine::AxisAlignedBox3 testBox; 561 518 testBox.Initialize(); … … 566 523 } 567 524 568 cout << " testbox: " << testBox << endl;525 cout << "geometry bounds: " << testBox << endl; 569 526 570 527 mGeometry.reserve(mBvhLeaves.size()); … … 576 533 BvhLeaf *node = mBvhLeaves[i]; 577 534 535 VertexArray _vertices; 536 VertexArray _normals; 537 vector<TexCoord> _texCoords; 538 539 const int size = node->last - node->first + 1; 540 541 _vertices.reserve(size); 542 _normals.reserve(size); 543 544 //cout << "vtx: " << size << endl; 578 545 for (int j = node->first; j <= node->last; ++ j) 579 546 { … … 583 550 { 584 551 _vertices.push_back(vertices[idx + k]); 585 _normals.push_back(normals[idx + k]);552 //_normals.push_back(normals[idx + k]); 586 553 //_texCoords.push_back(texCoords[idx + k]); 587 554 } 555 556 // no face normals? => create normals 557 const CHCDemoEngine::Triangle3 558 tri(vertices[idx], vertices[idx + 1], vertices[idx + 2]); 559 560 const CHCDemoEngine::Vector3 n = tri.GetNormal(); 561 562 _normals.push_back(n); 563 _normals.push_back(n); 564 _normals.push_back(n); 588 565 } 589 566 … … 595 572 node->last = (int)mGeometry.size() - 1; 596 573 597 _vertices.clear();598 _normals.clear();599 _texCoords.clear();574 //_vertices.clear(); 575 //_normals.clear(); 576 //_texCoords.clear(); 600 577 } 601 578 } … … 621 598 // load triangle ids 622 599 size_t numTriangles = buffer[2]; 600 mGlobalTriangleIds.reserve(numTriangles); 623 601 624 602 for (size_t i = 0; i < numTriangles; ++i) … … 778 756 779 757 bool VisibilitySolutionConverter::ReadBinObj(const string &filename, 780 VertexArray &vertices ,781 float scale)758 VertexArray &vertices 759 ) 782 760 { 783 761 igzstream inStream(filename.c_str()); … … 862 840 stream.write(reinterpret_cast<char *>(&nodeType), sizeof(int)); 863 841 864 CHCDemoEngine::Vector3 bMin = node->box.Min(); 865 CHCDemoEngine::Vector3 bMax = node->box.Max(); 842 CHCDemoEngine::AxisAlignedBox3 box = node->box; 843 //box.Scale(sScale); 844 845 CHCDemoEngine::Vector3 bMin = box.Min(); 846 CHCDemoEngine::Vector3 bMax = box.Max(); 866 847 867 848 stream.write(reinterpret_cast<char *>(&(node->first)), sizeof(int)); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/VisibilitySolutionConverter/VisibilitySolutionConverter.h
r3243 r3246 120 120 VertexArray &normals, 121 121 std::vector<TexCoord> &texcoords); 122 123 bool ReadSimpleObj(const std::string &filename,124 VertexArray &vertices,125 VertexArray &normals,126 std::vector<TexCoord> &texcoords);127 122 128 123 bool ReadBinObj(const std::string &filename, 129 VertexArray &vertices, 130 float scale); 124 VertexArray &vertices); 131 125 132 126 bool WriteBinObj(const std::string &filename, -
GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
r3245 r3246 7 7 # misc stuff 8 8 9 filename=vienna_full_hp9 #filename=vienna_full_hp 10 10 useLODs=1 11 11 # shadow map size … … 16 16 statsFilename=mystats.log 17 17 18 # use potentially viible sets? 19 usePvs=0 20 21 # if using pvs, this specifies the name of the visibility solutin 18 22 #visibilitySolution=vienna_full-8x3-refu 19 23 visibilitySolution=vienna_full-8x3-pgv 20 #visibilitySolution=vienna_full-8x3-spgvu 24 25 21 26 22 27 ############ … … 35 40 36 41 # move speed 37 keyForwardMotion=5.0f38 keyRotation=0.5f42 #keyForwardMotion=5.0f 43 #keyRotation=0.5f 39 44 #keyForwardMotion=20.0f 40 #keyRotation=1.5f45 keyRotation=1.5f 41 46 42 47 # initial camera position … … 50 55 #lightDirection=-0.8f 1.0f -0.7f 51 56 lightDirection=-0.3f 0.2f -0.7f 57 58 ########################### 59 ## powerplant options 60 61 filename=PowerPlantM 62 63 keyForwardMotion=200.0f 64 mouseMotion=1.0f; 65 visibilitySolution=power-plant-2c-xx-1000b-pgv2 66 camPosition=-1320.57 -6306.34 3603 67 camDirection=0.292156 0.9556 0.0383878 52 68 53 69 … … 93 109 94 110 # use full resolution ssao (vs. half resoltion) 95 ssaoUseFullResolution= 1111 ssaoUseFullResolution=0 96 112 # ssao kernel radius 97 113 #ssaoKernelRadius=8e-1f -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3242 r3246 73 73 74 74 // ssao random spherical samples 75 //static Sample2 samples2[NUM_SAMPLES];76 #define NUM_PRECOMPUTED_SAMPLES 24077 static Sample2 samples2[NUM_PRECOMPUTED_SAMPLES];75 static Sample2 samples2[NUM_SAMPLES]; 76 //#define NUM_PRECOMPUTED_SAMPLES 240 77 //static Sample2 samples2[NUM_PRECOMPUTED_SAMPLES]; 78 78 // pcf samples 79 79 static Sample2 pcfSamples[NUM_PCF_TABS]; … … 210 210 case DeferredRenderer::SAMPLING_QUADRATIC: 211 211 { 212 static QuadraticDiscSampleGenerator2D g(NUM_PRECOMPUTED_SAMPLES, 1.0f); 212 //static QuadraticDiscSampleGenerator2D g(NUM_PRECOMPUTED_SAMPLES, 1.0f); 213 static QuadraticDiscSampleGenerator2D g(NUM_SAMPLES, 1.0f); 213 214 g.Generate((float *)samples2); 214 215 } … … 753 754 // in the first case, the sample patterns look nicer, but the kernel 754 755 // needs longer to converge 755 if (currentPos + NUM_SAMPLES >= NUM_PRECOMPUTED_SAMPLES) 756 { 756 //if (currentPos + NUM_SAMPLES >= NUM_PRECOMPUTED_SAMPLES) { 757 757 currentPos = 0; 758 758 GenerateSamples(mSamplingMethod); 759 }759 //} 760 760 761 761 //if (mSortSamples) { SortSamples(); } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.cpp
r3193 r3246 108 108 Vector3 position = camera->GetPosition(); 109 109 110 const float scaleFactor = 80.0f; 111 //const float scaleFactor = 5.0f; 110 // scale the sky dome so no intersection with the scene is visible 111 //const float scaleFactor = 80.0f; 112 const float scaleFactor = 200.0f; 112 113 113 114 position.z -= 3.0f * scaleFactor; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ViewCellsTree.cpp
r3245 r3246 13 13 14 14 #define VIEWCELLS_VERSION 1.0f 15 16 static const float sScale = 0.05f; 17 15 18 16 19 namespace CHCDemoEngine … … 75 78 } 76 79 80 AxisAlignedBox3 box; 77 81 // get the bounding box 78 82 // exchange x and y coordinates and recompute box 79 fread(& mBox, sizeof(AxisAlignedBox3), 1, fr);83 fread(&box, sizeof(AxisAlignedBox3), 1, fr); 80 84 81 Vector3 v1(mBox.Min().x, -mBox.Min().z, mBox.Min().y); 82 Vector3 v2(mBox.Max().x, -mBox.Max().z, mBox.Max().y); 85 box.Scale(sScale); 86 87 Vector3 v1(box.Min().x, -box.Min().z, box.Min().y); 88 Vector3 v2(box.Max().x, -box.Max().z, box.Max().y); 83 89 84 90 mBox.Initialize(); … … 119 125 float mypos; 120 126 fread(&mypos, sizeof(float), 1, fr); 127 128 mypos *= sScale; 129 121 130 // changed coordinate system must be considered also here 122 131 if (node->mAxis == 1) -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.cpp
r3245 r3246 175 175 { 176 176 vcTechnique.Render(mRenderState); 177 Visualization::RenderBoxForViz(mViewCell->GetBox());177 RenderBoxForViz(mViewCell->GetBox()); 178 178 } 179 179 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3245 r3246 113 113 /// max depth where candidates for tighter bounds are searched 114 114 int maxDepthForTestingChildren = 3; 115 115 /// use full resolution for ssao or half 116 116 bool ssaoUseFullResolution = false; 117 117 … … 140 140 141 141 ViewCellsTree *viewCellsTree = NULL; 142 ViewCell *viewCell = NULL; 142 143 143 144 static int globalVisibleId = 0; 144 145 145 ViewCell *viewCell = NULL;146 146 147 147 … … 255 255 bool useLenseFlare = true; 256 256 257 bool usePvs = false; 258 259 257 260 PerfTimer frameTimer, algTimer; 258 261 /// the performance graph window … … 263 266 static Matrix4x4 invTrafo = IdentityMatrix(); 264 267 268 float mouseMotion = 0.2f; 269 265 270 266 271 ////////////// 267 //-- algorithm parameters272 //-- chc++ algorithm parameters 268 273 269 274 /// the pixel threshold where a node is still considered invisible … … 356 361 SceneQuery *GetOrCreateSceneQuery(); 357 362 358 void RenderPvs(); 363 void LoadPvs(); 364 365 void LoadVisibilitySolution(); 366 367 void RenderViewCell(); 359 368 360 369 … … 419 428 env.GetFloatParam(string("keyForwardMotion"), keyForwardMotion); 420 429 env.GetFloatParam(string("keyRotation"), keyRotation); 430 env.GetFloatParam(string("mouseMotion"), mouseMotion); 421 431 env.GetFloatParam(string("tempCohFactor"), ssaoTempCohFactor); 422 432 env.GetFloatParam(string("turbitity"), turbitity); … … 443 453 env.GetStringParam(string("filename"), filename); 444 454 env.GetStringParam(string("visibilitySolution"), visibilitySolution); 455 456 env.GetBoolParam(string("usePvs"), usePvs); 445 457 446 458 //env.GetStringParam(string("modelPath"), model_path); … … 474 486 cout << "stats filename: " << statsFilename << endl; 475 487 cout << "filename: " << filename << endl; 488 cout << "use PVS: " << usePvs << endl; 476 489 cout << "visibilitySolution: " << visibilitySolution << endl; 477 490 … … 558 571 559 572 //LoadModel("fisch.dem", dynamicObjects); 560 LoadModel("hbuddha.dem", dynamicObjects);573 //LoadModel("hbuddha.dem", dynamicObjects); 561 574 562 575 //LoadModel("venusm.dem", dynamicObjects); … … 568 581 resourceManager->mUseSpecialColors = false; 569 582 583 /* 570 584 buddha = dynamicObjects.back(); 571 585 … … 594 608 dynamicObjects.push_back(ent); 595 609 } 596 610 */ 597 611 598 612 /* int cityEntities = LoadModel("vienna_full_hp.dem", dynamicObjects); … … 619 633 /// set the depth of the bvh depending on the triangles per leaf node 620 634 bvh->SetVirtualLeaves(trianglesPerVirtualLeaf); 621 622 ///////////623 //-- load the visibility solution624 625 const string vis_filename =626 string(model_path + visibilitySolution + ".vis");627 628 VisibilitySolutionLoader visLoader;629 630 viewCellsTree = visLoader.Load(vis_filename, bvh);631 632 635 633 636 // set far plane based on scene extent … … 753 756 void InitGLstate() 754 757 { 755 glClearColor(0.4f, 0.4f, 0.4f, 1 .0f);758 glClearColor(0.4f, 0.4f, 0.4f, 1e20f); 756 759 757 760 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); … … 1063 1066 void MainLoop() 1064 1067 { 1065 Matrix4x4 oldTrafo = buddha->GetTransform()->GetMatrix(); 1066 Vector3 buddhaPos = motionPath->GetCurrentPosition(); 1067 Matrix4x4 trafo = TranslationMatrix(buddhaPos); 1068 1069 buddha->GetTransform()->SetMatrix(trafo); 1070 1071 #if TODO 1072 /*for (int i = 0; i < 10; ++ i) 1073 { 1074 SceneEntity *ent = dynamicObjects[i]; 1075 Vector3 newPos = ent->GetWorldCenter(); 1076 1077 if (GetOrCreateSceneQuery()->CalcIntersection(newPos)) 1068 if (buddha) 1069 { 1070 Matrix4x4 oldTrafo = buddha->GetTransform()->GetMatrix(); 1071 Vector3 buddhaPos = motionPath->GetCurrentPosition(); 1072 Matrix4x4 trafo = TranslationMatrix(buddhaPos); 1073 1074 buddha->GetTransform()->SetMatrix(trafo); 1075 1076 #if TODO // drop objects on ground floor 1077 for (int i = 0; i < 10; ++ i) 1078 1078 { 1079 Matrix4x4 mat = TranslationMatrix(newPos - ent->GetCenter()); 1080 ent->GetTransform()->SetMatrix(mat); 1079 SceneEntity *ent = dynamicObjects[i]; 1080 Vector3 newPos = ent->GetWorldCenter(); 1081 1082 if (GetOrCreateSceneQuery()->CalcIntersection(newPos)) 1083 { 1084 Matrix4x4 mat = TranslationMatrix(newPos - ent->GetCenter()); 1085 ent->GetTransform()->SetMatrix(mat); 1086 } 1081 1087 } 1082 }*/1083 1088 #endif 1084 1089 1085 1090 1086 /////////////////////////1087 //-- update animations1088 1089 //const float rotAngle = M_PI * 1e-3f;1090 const float rotAngle = 1.0f * M_PI / 180.0f;1091 1092 Matrix4x4 rotMatrix = RotationZMatrix(rotAngle);1093 dynamicObjects[1]->GetTransform()->MultMatrix(rotMatrix);1094 1095 motionPath->Move(0.01f);1096 1091 ///////////////////////// 1092 //-- update animations 1093 1094 //const float rotAngle = M_PI * 1e-3f; 1095 const float rotAngle = 1.0f * M_PI / 180.0f; 1096 1097 Matrix4x4 rotMatrix = RotationZMatrix(rotAngle); 1098 dynamicObjects[1]->GetTransform()->MultMatrix(rotMatrix); 1099 1100 motionPath->Move(0.01f); 1101 } 1097 1102 1098 1103 … … 1181 1186 glEnableClientState(GL_VERTEX_ARRAY); 1182 1187 1188 if (usePvs) 1189 { 1190 if (!viewCellsTree) LoadVisibilitySolution(); 1191 LoadPvs(); 1192 } 1193 1183 1194 // render with the specified method (forward rendering, forward + depth, deferred) 1184 1195 switch (renderMethod) … … 1260 1271 else 1261 1272 { 1262 RenderPvs();1263 1264 1273 // actually render the scene geometry using the specified algorithm 1265 1274 traverser->RenderScene(); … … 1283 1292 const int sunVisiblePixels = useLenseFlare && useDeferred ? TestSunVisible() : 0; 1284 1293 1294 1285 1295 1286 1296 /////////////// … … 1574 1584 // make a snapshot of the current frame 1575 1585 makeSnapShot = true; 1586 break; 1587 case '.': 1588 // enable / disable view cells 1589 usePvs = !usePvs; 1590 if (!usePvs) SceneEntity::SetGlobalVisibleId(-1); 1576 1591 break; 1577 1592 default: … … 1829 1844 camera->Pitch(eyeXAngle); 1830 1845 1831 pos += horView * (yMotionBegin - y) * 0.2f;1846 pos += horView * (yMotionBegin - y) * mouseMotion; 1832 1847 1833 1848 camera->SetPosition(pos); … … 1897 1912 rVec = rot * rVec; 1898 1913 1899 pos -= rVec * (x - horizontalMotionBegin) * 0.1f;1900 pos[2] += (verticalMotionBegin - y) * 0.1f;1914 pos -= rVec * (x - horizontalMotionBegin) * mouseMotion; 1915 pos[2] += (verticalMotionBegin - y) * mouseMotion; 1901 1916 1902 1917 camera->SetPosition(pos); … … 1960 1975 void DisplayVisualization() 1961 1976 { 1977 // render current view cell 1978 if (usePvs) RenderViewCell(); 1979 1980 visualization->SetViewCell(usePvs ? viewCell : NULL); 1962 1981 visualization->SetFrameId(traverser->GetCurrentFrameId()); 1963 visualization->SetViewCell(viewCell);1982 1964 1983 1965 1984 Begin2D(); … … 2229 2248 sprintf(msg[i ++], "multiqueries: %d, tight bounds: %d, render queue: %d", 2230 2249 useMultiQueries, useTightBounds, useRenderQueue); 2231 sprintf(msg[i ++], "render technique: %s, SSAO: %d", renderMethodStr[renderMethod], useAdvancedShading);2250 sprintf(msg[i ++], "render technique: %s, use pvss: %d", renderMethodStr[renderMethod], usePvs); 2232 2251 sprintf(msg[i ++], "triangles per virtual leaf: %5d", trianglesPerVirtualLeaf); 2233 2252 sprintf(msg[i ++], "assumed visible frames: %4d, max batch size: %4d", … … 2267 2286 sprintf(msg[i ++], "traversed: %5d, frustum culled: %5d, query culled: %5d", 2268 2287 traversedNodes, frustumCulledNodes, queryCulledNodes); 2269 sprintf(msg[i ++], "issued queries: %5d, render State changes: %5d, render batches: %5d",2288 sprintf(msg[i ++], "issued queries: %5d, renderstate changes: %5d, render batches: %5d", 2270 2289 issuedQueries, stateChanges, numBatches); 2271 2290 … … 2531 2550 tech.Init(); 2532 2551 2533 //tech.SetLightingEnabled(false);2534 //tech.SetDepthWriteEnabled(false);2535 2536 2552 tech.SetEmmisive(RgbaColor(1.0f, 1.0f, 1.0f, 1.0f)); 2537 2553 tech.SetDiffuse(RgbaColor(1.0f, 1.0f, 1.0f, 1.0f)); … … 2542 2558 2543 2559 2544 void RenderPvs()2560 void LoadPvs() 2545 2561 { 2546 2562 viewCell = viewCellsTree->GetViewCell(camera->GetPosition()); … … 2551 2567 { 2552 2568 SceneEntity *ent = viewCell->mPvs.GetEntry(i); 2553 //ent->Render(&renderState);2554 2569 ent->SetVisibleId(globalVisibleId); 2555 2570 … … 2558 2573 2559 2574 SceneEntity::SetGlobalVisibleId(globalVisibleId ++); 2560 2575 } 2576 2577 2578 void LoadVisibilitySolution() 2579 { 2580 /////////// 2581 //-- load the visibility solution 2582 2583 const string vis_filename = 2584 string(model_path + visibilitySolution + ".vis"); 2585 2586 VisibilitySolutionLoader visLoader; 2587 2588 viewCellsTree = visLoader.Load(vis_filename, bvh); 2589 } 2590 2591 2592 void RenderViewCell() 2593 { 2561 2594 // render current view cell 2562 2595 static Technique vcTechnique = GetVizTechnique(); … … 2564 2597 vcTechnique.Render(&renderState); 2565 2598 Visualization::RenderBoxForViz(viewCell->GetBox()); 2566 2567 visualization->SetViewCell(viewCell); 2568 2569 //cout << "pvs: " << vc->mPvs.Size() << " triangles: " << numTriangles << endl; 2570 } 2599 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3232 r3246 6 6 //-- ssao + gi parameters 7 7 8 #define NUM_SAMPLES 88 //#define NUM_SAMPLES 8 9 9 //#define NUM_SAMPLES 16 10 //#define NUM_SAMPLES 2410 #define NUM_SAMPLES 24 11 11 //#define NUM_SAMPLES 48 12 12 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
r3232 r3246 115 115 float4 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 116 116 117 #if 0 // use half size117 #if 1 // use half resolution 118 118 119 119 // the following has to be done for half resolution ssao:
Note: See TracChangeset
for help on using the changeset viewer.