Changeset 3316 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
- Timestamp:
- 02/17/09 19:21:52 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3315 r3316 286 286 float viewCellsScaleFactor = 1.0f; 287 287 288 float maxConvergence = 2000.0f; 289 290 288 291 289 292 ////////////// … … 377 380 inline float KeyShift() { return keyForwardMotion * elapsedTime * 1e-3f; } 378 381 379 void CreateAnimation( );382 void CreateAnimation(const Vector3 &pos); 380 383 381 384 SceneQuery *GetOrCreateSceneQuery(); … … 390 393 391 394 void LoadOrUpdatePVSs(const Vector3 &pos); 395 396 void CreateNewInstance(SceneEntity *parent, const Vector3 &pos); 397 398 399 ///////////// 392 400 393 401 string envFileName = "default.env"; … … 626 634 627 635 #if 1 628 const Vector3 sceneCenter(470.398f, 240.364f, 181.7f); 636 637 #if 0 638 VertexArray positions; 639 positions.push_back(Vector3(478.398f, 268.0f, 181.3)); 640 positions.push_back(Vector3(470.461, 268.543, 181.7)); 641 positions.push_back(Vector3(499.648, 264.358, 181.7)); 642 positions.push_back(Vector3(487.913, 285.162, 181.7)); 643 644 #else 645 646 VertexArray positions; 647 //positions.push_back(Vector3(6.07307, 8.20723, 6.7)); 648 positions.push_back(Vector3(6.07307, 8.20723, 6.62)); 649 positions.push_back(Vector3(-17.1935, 11.1687, 8.8781)); 650 //positions.push_back(Vector3(499.648, 264.358, 181.7)); 651 //positions.push_back(Vector3(487.913, 285.162, 181.7)); 652 653 #endif 654 629 655 //const Vector3 sceneCenter(470.398f, 240.364f, 180.3); 630 Matrix4x4 transl = TranslationMatrix( sceneCenter);656 Matrix4x4 transl = TranslationMatrix(positions[0]); 631 657 632 658 LoadModel("hbuddha.dem", dynamicObjects); … … 635 661 buddha->GetTransform()->SetMatrix(transl); 636 662 637 for (int i = 0; i < 10; ++ i) 638 { 639 SceneEntity *ent = new SceneEntity(*buddha); 640 resourceManager->AddSceneEntity(ent); 641 642 Vector3 offs = Vector3::ZERO(); 643 644 offs.x = RandomValue(.0f, 50.0f); 645 offs.y = RandomValue(.0f, 50.0f); 646 647 Vector3 newPos = sceneCenter + offs; 648 649 transl = TranslationMatrix(newPos); 650 Transform3 *transform = resourceManager->CreateTransform(transl); 651 652 ent->SetTransform(transform); 653 dynamicObjects.push_back(ent); 654 } 663 664 for (size_t i = 1; i < positions.size(); ++ i) 665 { 666 CreateNewInstance(buddha, positions[i]); 667 } 668 655 669 #endif 656 670 … … 706 720 preetham = new SkyPreetham(turbitity, skyDome); 707 721 708 CreateAnimation( );722 CreateAnimation(positions[0]); 709 723 710 724 … … 1151 1165 1152 1166 //const float rotAngle = M_PI * 1e-3f; 1153 const float rotAngle = 0.3f * M_PI / 180.0f;1154 //const float rotAngle = 1.0f * M_PI / 180.0f;1167 //const float rotAngle = 0.3f * M_PI / 180.0f; 1168 const float rotAngle = 0.6f * M_PI / 180.0f; 1155 1169 1156 1170 Matrix4x4 rotMatrix = RotationZMatrix(rotAngle); 1171 // hack: second buddha 1157 1172 dynamicObjects[1]->GetTransform()->MultMatrix(rotMatrix); 1158 1173 1159 const float moveSpeed = 5e-3f; 1174 //const float moveSpeed = 5e-3f; 1175 const float moveSpeed = 1e-1f; 1160 1176 motionPath->Move(moveSpeed); 1161 1177 } … … 1412 1428 deferredShader->SetUseToneMapping(useHDR); 1413 1429 deferredShader->SetUseAntiAliasing(useAntiAliasing); 1430 deferredShader->SetMaxConvergence(maxConvergence); 1414 1431 1415 1432 … … 1582 1599 traverser->SetUseOptimization(useOptimization); 1583 1600 break;*/ 1601 case 'o': 1602 case 'O': 1603 if (maxConvergence > 100.0f) 1604 maxConvergence = 1.0f; 1605 else 1606 maxConvergence = 5000.0f; 1607 1608 cout << "max convergence: " << maxConvergence << endl; 1609 1610 break; 1584 1611 case 'l': 1585 1612 case 'L': … … 2595 2622 2596 2623 2597 void CreateAnimation() 2598 { 2599 const float radius = 5.0f; 2600 //const Vector3 center(480.398f, 268.364f, 181.3); 2601 const Vector3 center(480.398f, 269.364f, 181.3); 2624 void CreateAnimation(const Vector3 &pos) 2625 { 2626 //const float b = 5.0f; const float a = 1.5f; 2627 const float a = 5.0f; const float b = 1.5f; 2602 2628 2603 2629 VertexArray vertices; 2604 2630 2605 /*for (int i = 0; i < 360; ++ i) 2606 { 2607 float angle = (float)i * M_PI / 180.0f; 2608 2609 Vector3 offs = Vector3(cos(angle) * radius, sin(angle) * radius, 0); 2631 for (int i = 0; i < 360; ++ i) 2632 { 2633 const float angle = (float)i * M_PI / 180.0f; 2634 2635 Vector3 offs = Vector3(cos(angle) * a, sin(angle) * b, 0); 2636 vertices.push_back(pos + offs); 2637 } 2638 2639 /*for (int i = 0; i < 5; ++ i) 2640 { 2641 Vector3 offs = Vector3(i, 0, 0); 2642 vertices.push_back(center + offs); 2643 } 2644 2645 for (int i = 0; i < 5; ++ i) 2646 { 2647 Vector3 offs = Vector3(4 - i, 0, 0); 2610 2648 vertices.push_back(center + offs); 2611 2649 }*/ 2612 2650 2613 for (int i = 0; i < 5; ++ i)2614 {2615 Vector3 offs = Vector3(i, 0, 0);2616 vertices.push_back(center + offs);2617 }2618 2619 2620 for (int i = 0; i < 5; ++ i)2621 {2622 Vector3 offs = Vector3(4 -i, 0, 0);2623 vertices.push_back(center + offs);2624 }2625 2626 2651 motionPath = new MotionPath(vertices); 2627 2652 } 2653 2628 2654 2629 2655 /** This function returns the number of visible pixels of a … … 2805 2831 if (viewCellsTree) UpdatePvs(pos); 2806 2832 } 2833 2834 2835 void CreateNewInstance(SceneEntity *parent, const Vector3 &pos) 2836 { 2837 SceneEntity *ent = new SceneEntity(*parent); 2838 resourceManager->AddSceneEntity(ent); 2839 2840 Matrix4x4 transl = TranslationMatrix(pos); 2841 Transform3 *transform = resourceManager->CreateTransform(transl); 2842 2843 ent->SetTransform(transform); 2844 dynamicObjects.push_back(ent); 2845 //Debug << "positions: " << newPos << endl; 2846 }
Note: See TracChangeset
for help on using the changeset viewer.