|
|
@@ -1,5 +1,6 @@
|
|
|
#include "engine.h"
|
|
|
#include <string>
|
|
|
+#include <math.h>
|
|
|
|
|
|
Engine::Engine(){
|
|
|
|
|
|
@@ -53,7 +54,7 @@ void Engine::mainLoop(){
|
|
|
done = FEInputManager.processInput();
|
|
|
|
|
|
//Update entities here in the future
|
|
|
- //TO DO
|
|
|
+ moveModels();
|
|
|
|
|
|
//Perform all render calculations and update screen
|
|
|
FERenderManager.render(sceneModels);
|
|
|
@@ -72,4 +73,20 @@ void Engine::loadModels(){
|
|
|
//sceneModels->describeMesh();
|
|
|
}
|
|
|
|
|
|
+void Engine::moveModels(){
|
|
|
+ float theta = 0.01;
|
|
|
+ float cosine = std::cos(theta);
|
|
|
+ float sine = std::sin(theta);
|
|
|
|
|
|
+ Mesh * modelMesh = sceneModels->getMesh();
|
|
|
+ int size = modelMesh->numVertices;
|
|
|
+ std::vector<Vector3> * vertices = &modelMesh->vertices;
|
|
|
+
|
|
|
+ for (int i = 0;i < size; ++i){
|
|
|
+ float xOld = (*vertices)[i].x;
|
|
|
+ float zOld = (*vertices)[i].z;
|
|
|
+ (*vertices)[i].x = xOld*cosine + zOld*sine;
|
|
|
+ (*vertices)[i].z = -xOld*sine + zOld*cosine;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|