Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 116 vs 117 for /trunk/Source Code/Scenes/PhysXScene/PhysXScene.cpp

Diff revisions: vs.
  @@ -1,15 +1,16 @@
1 1 #include "Headers/PhysXScene.h"
2 2 #include "Headers/PhysXImplementation.h"
3 - #include "Rendering/RenderPass/Headers/RenderQueue.h"
3 +
4 4 #include "GUI/Headers/GUI.h"
5 5 #include "Environment/Sky/Headers/Sky.h"
6 - #include "Managers/Headers/CameraManager.h"
6 + #include "Rendering/Camera/Headers/Camera.h"
7 + #include "Rendering/RenderPass/Headers/RenderQueue.h"
7 8
8 9 //begin copy-paste: randarea scenei
9 10 void PhysXScene::render(){
10 11 Sky& sky = Sky::getInstance();
11 12
12 - sky.setParams(CameraManager::getInstance().getActiveCamera()->getEye(),_sunVector, false,true,true);
13 + sky.setParams(_camera->getEye(),_sunVector, false,true,true);
13 14 sky.draw();
14 15
15 16 _sceneGraph->render();
  @@ -37,18 +38,10 @@
37 38 void PhysXScene::processInput(){
38 39 Scene::processInput();
39 40
40 - Camera* cam = CameraManager::getInstance().getActiveCamera();
41 - moveFB = Application::getInstance().moveFB;
42 - moveLR = Application::getInstance().moveLR;
43 - angleLR = Application::getInstance().angleLR;
44 - angleUD = Application::getInstance().angleUD;
45 -
46 - if(angleLR) cam->RotateX(angleLR * Framerate::getInstance().getSpeedfactor()/5);
47 - if(angleUD) cam->RotateY(angleUD * Framerate::getInstance().getSpeedfactor()/5);
48 - if(moveFB || moveLR){
49 - if(moveFB) cam->PlayerMoveForward(moveFB * Framerate::getInstance().getSpeedfactor());
50 - if(moveLR) cam->PlayerMoveStrafe(moveLR * Framerate::getInstance().getSpeedfactor());
51 - }
41 + if(_angleLR) _camera->RotateX(_angleLR * Framerate::getInstance().getSpeedfactor());
42 + if(_angleUD) _camera->RotateY(_angleUD * Framerate::getInstance().getSpeedfactor());
43 + if(_moveFB) _camera->MoveForward(_moveFB * (Framerate::getInstance().getSpeedfactor()/5));
44 + if(_moveLR) _camera->MoveStrafe(_moveLR * (Framerate::getInstance().getSpeedfactor()/5));
52 45 }
53 46
54 47 bool PhysXScene::load(const std::string& name){
  @@ -71,7 +64,6 @@
71 64
72 65 bool PhysXScene::loadResources(bool continueOnErrors){
73 66 _mousePressed = false;
74 - angleLR=0.0f,angleUD=0.0f,moveFB=0.0f,moveLR=0.0f;
75 67
76 68 GUI::getInstance().addText("fpsDisplay", //Unique ID
77 69 vec3<F32>(60,20,0), //Position
  @@ -90,9 +82,9 @@
90 82 _physx = static_cast<PhysXImplementation* >(PHYSICS_DEVICE.NewSceneInterface(this));
91 83 //Initialize the physics scene
92 84 _physx->init();
93 - CameraManager::getInstance().getActiveCamera()->RotateX(RADIANS(-75));
94 - CameraManager::getInstance().getActiveCamera()->RotateY(RADIANS(25));
95 - CameraManager::getInstance().getActiveCamera()->setEye(vec3<F32>(0,30,-40));
85 + _camera->RotateX(RADIANS(-75));
86 + _camera->RotateY(RADIANS(25));
87 + _camera->setEye(vec3<F32>(0,30,-40));
96 88 return true;
97 89 }
98 90
  @@ -126,16 +118,16 @@
126 118 Scene::onKeyDown(key);
127 119 switch(key.key) {
128 120 case OIS::KC_W:
129 - Application::getInstance().moveFB = 0.25f;
121 + _moveFB = 0.25f;
130 122 break;
131 123 case OIS::KC_A:
132 - Application::getInstance().moveLR = 0.25f;
124 + _moveLR = 0.25f;
133 125 break;
134 126 case OIS::KC_S:
135 - Application::getInstance().moveFB = -0.25f;
127 + _moveFB = -0.25f;
136 128 break;
137 129 case OIS::KC_D:
138 - Application::getInstance().moveLR = -0.25f;
130 + _moveLR = -0.25f;
139 131 break;
140 132 case OIS::KC_1:
141 133 PHYSICS_DEVICE.createPlane(_physx,vec3<F32>(0,0,0),random(0.5f,2.0f));
  @@ -178,11 +170,11 @@
178 170 switch(key.key) {
179 171 case OIS::KC_W:
180 172 case OIS::KC_S:
181 - Application::getInstance().moveFB = 0;
173 + _moveFB = 0;
182 174 break;
183 175 case OIS::KC_A:
184 176 case OIS::KC_D:
185 - Application::getInstance().moveLR = 0;
177 + _moveLR = 0;
186 178 break;
187 179 case OIS::KC_F1:
188 180 _sceneGraph->print();
  @@ -198,18 +190,18 @@
198 190 Scene::onMouseMove(key);
199 191 if(_mousePressed){
200 192 if(_prevMouse.x - key.state.X.abs > 1 )
201 - Application::getInstance().angleLR = -0.15f;
193 + _angleLR = -0.15f;
202 194 else if(_prevMouse.x - key.state.X.abs < -1 )
203 - Application::getInstance().angleLR = 0.15f;
195 + _angleLR = 0.15f;
204 196 else
205 - Application::getInstance().angleLR = 0;
197 + _angleLR = 0;
206 198
207 199 if(_prevMouse.y - key.state.Y.abs > 1 )
208 - Application::getInstance().angleUD = -0.1f;
200 + _angleUD = -0.1f;
209 201 else if(_prevMouse.y - key.state.Y.abs < -1 )
210 - Application::getInstance().angleUD = 0.1f;
202 + _angleUD = 0.1f;
211 203 else
212 - Application::getInstance().angleUD = 0;
204 + _angleUD = 0;
213 205 }
214 206
215 207 _prevMouse.x = key.state.X.abs;
  @@ -226,7 +218,7 @@
226 218 Scene::onMouseClickUp(key,button);
227 219 if(button == 0) {
228 220 _mousePressed = false;
229 - Application::getInstance().angleUD = 0;
230 - Application::getInstance().angleLR = 0;
221 + _angleUD = 0;
222 + _angleLR = 0;
231 223 }
232 224 }