Changeset 79 for trunk/VUT/work/TestCulling/TestCullingApplication.cpp
- Timestamp:
- 05/03/05 16:59:18 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/work/TestCulling/TestCullingApplication.cpp
r74 r79 12 12 #include <../CEGUIRenderer/include/OgreCEGUITexture.h> 13 13 #include <OgreMemoryMacros.h> 14 15 #include "Ogre.h" 14 #include <Ogre.h> 16 15 #include "TestCullingApplication.h" 16 #include "SceneContentGenerator.h" 17 17 18 18 #define WIN32_LEAN_AND_MEAN … … 48 48 //l->setPosition(20,80,50); 49 49 50 mMinTranslation = Vector3(-70.0f, -70.0f, 0.0f); 51 mMaxTranslation = Vector3(70.0f, 70.0f, 600.0f); 52 53 mMinAngle = Vector3(0, 0, 0); 54 mMaxAngle = Vector3(360, 360, 360); 55 56 generateScene(330); 50 SceneContentGenerator contentGenerator(); 51 contentGenerator.GenerateScene(330); 57 52 58 53 // Create a skybox … … 90 85 mSceneMgr = mRoot->getSceneManager(ST_GENERIC); 91 86 } 92 //----------------------------------------------------------------------- 93 void TestCullingApplication::generateSceneObject(const Vector3 &translationRatio, 94 const Vector3 &rotationRatio, 95 const int idx, 96 const String& entName) 97 { 98 Vector3 rotation = mMinAngle + rotationRatio * (mMaxAngle - mMinAngle); 99 Vector3 translation = mMinTranslation + 100 translationRatio * (mMaxTranslation - mMinTranslation); 101 102 char name[16]; 103 sprintf( name, "object%d", idx ); 104 105 Entity *ent = mSceneMgr->createEntity(name, entName); 106 SceneNode *node = mSceneMgr->getRootSceneNode()-> 107 createChildSceneNode(String(name) + "Node", translation); 108 node->attachObject(ent); 109 node->scale(0.1,0.1,0.1); 110 111 node->yaw(Degree(rotation.x)); 112 node->pitch(Degree(rotation.y)); 113 node->roll(Degree(rotation.z)); 114 } 115 //----------------------------------------------------------------------- 116 void TestCullingApplication::generateScene( int numObjects ) 117 { 118 srand (time (0)); 119 120 Vector3 rotationRatio; 121 Vector3 translationRatio; 122 123 for(int i=0; i < numObjects; i++) 124 { 125 rotationRatio.x = rand() / (float) RAND_MAX; 126 rotationRatio.y = rand() / (float) RAND_MAX; 127 rotationRatio.z = rand() / (float) RAND_MAX; 128 129 translationRatio.x = rand() / (float) RAND_MAX; 130 translationRatio.y = rand() / (float) RAND_MAX; 131 translationRatio.z = rand() / (float) RAND_MAX; 132 133 generateSceneObject(translationRatio, rotationRatio, i, "sphere.mesh"); 134 } 135 } 87 88 136 89 /***********************************************/ 137 90 /* MouseQueryListener implementation */
Note: See TracChangeset
for help on using the changeset viewer.