Fix references to Angle class
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include <thread>
|
||||
#include "engine/tick.h"
|
||||
#include "engine/render.h"1
|
||||
#include "engine/render.h"
|
||||
|
||||
class App
|
||||
{
|
||||
|
@@ -50,8 +50,9 @@ void pre_render() {
|
||||
engine->initGL();
|
||||
auto* camera = new Camera();
|
||||
storeEntity(camera);
|
||||
getCamera()->position.set(0.0f,-2.0f,-5.0f);
|
||||
getCamera()->angle.y = 0.0f;
|
||||
// TODO:
|
||||
getCamera()->position = {0.0f,-2.0f,-5.0f};
|
||||
getCamera()->angle.yaw = 0.0f;
|
||||
getCamera()->scriptedMove.load("../scriptedMove/default.smov");
|
||||
auto* skybox = new Skybox();
|
||||
skybox->draw = true;
|
||||
|
@@ -65,12 +65,12 @@ public:
|
||||
|
||||
if (cameraMode == CameraMode::THIRD_PERSON) {
|
||||
if (engine->debug)
|
||||
std::cout << "Calculated Pitch: " << VectorMath::calcAngle(position,getPlayer()->position).x << " Calculated Yaw: " << VectorMath::calcAngle(position,getPlayer()->position).y << std::endl;
|
||||
std::cout << "Calculated Pitch: " << VectorMath::calcAngle(position,getPlayer()->position).pitch << " Calculated Yaw: " << VectorMath::calcAngle(position,getPlayer()->position).yaw << std::endl;
|
||||
this->position = getPlayer()->cameraPoint(2);
|
||||
//Make the camera pitch down a little bit.
|
||||
this->position.y += 0.5;
|
||||
this->angle.x = VectorMath::calcAngle(position,getPlayer()->position).x;
|
||||
this->angle.y = VectorMath::calcAngle(position,getPlayer()->position).y;
|
||||
this->angle.pitch = VectorMath::calcAngle(position,getPlayer()->position).pitch;
|
||||
this->angle.yaw = VectorMath::calcAngle(position,getPlayer()->position).yaw;
|
||||
}
|
||||
|
||||
//if (engine->frameCount == 5000)
|
||||
@@ -99,16 +99,16 @@ public:
|
||||
}
|
||||
|
||||
if (engine->keyState[SDL_SCANCODE_LEFT] == 1) {
|
||||
this->angle.y +=75.0f*engine->frameDelta;
|
||||
this->angle.yaw +=75.0f*engine->frameDelta;
|
||||
}
|
||||
if (engine->keyState[SDL_SCANCODE_RIGHT] == 1) {
|
||||
this->angle.y -=75.0f*engine->frameDelta;
|
||||
this->angle.yaw -=75.0f*engine->frameDelta;
|
||||
}
|
||||
if (engine->keyState[SDL_SCANCODE_UP] == 1) {
|
||||
this->angle.x -=75.0f*engine->frameDelta;
|
||||
this->angle.pitch -=75.0f*engine->frameDelta;
|
||||
}
|
||||
if (engine->keyState[SDL_SCANCODE_DOWN] == 1) {
|
||||
this->angle.x +=75.0f*engine->frameDelta;
|
||||
this->angle.pitch +=75.0f*engine->frameDelta;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,8 +117,8 @@ public:
|
||||
// Preferrably: Camera would return a coordinate system that GameEngine
|
||||
// would set gluLookAt() with, this helps keep objects self contained
|
||||
this->angle.clamp();
|
||||
glRotatef(angle.x,1.0f, 0.0f, 0.0f);
|
||||
glRotatef(-angle.y,0.0f, 1.0f, 0.0f);
|
||||
glRotatef(angle.pitch,1.0f, 0.0f, 0.0f);
|
||||
glRotatef(-angle.yaw,0.0f, 1.0f, 0.0f);
|
||||
|
||||
glTranslatef(0.0f, 0.0f, 0.0f);
|
||||
gluLookAt(position.x, position.y, position.z, // camera position
|
||||
|
@@ -36,7 +36,7 @@ public:
|
||||
}
|
||||
|
||||
Entity() :
|
||||
position({0,0,0}),
|
||||
position(0,0,0),
|
||||
ticksAlive(0)
|
||||
{
|
||||
}
|
||||
|
@@ -22,9 +22,9 @@ public:
|
||||
Position cameraPoint (float distance) {
|
||||
Position behindPosition = this->position;
|
||||
Angle reverseDirection = this->bAngle();
|
||||
behindPosition.x -= reverseDirection.x * distance;
|
||||
behindPosition.y -= reverseDirection.y * distance;
|
||||
behindPosition.z -= reverseDirection.z * distance;
|
||||
behindPosition.x -= reverseDirection.pitch * distance;
|
||||
behindPosition.y -= reverseDirection.yaw * distance;
|
||||
behindPosition.z -= reverseDirection.roll * distance;
|
||||
|
||||
return behindPosition;
|
||||
}
|
||||
@@ -38,16 +38,16 @@ public:
|
||||
if (engine->frameCount == 1) {
|
||||
geometry.load("../models/cube.obj");
|
||||
geometry.scale(0.25f);
|
||||
position.set(0,-2,0);
|
||||
position = {0,-2,0};
|
||||
}
|
||||
//Rotate
|
||||
this->angle.y += 200.0*engine->frameDelta;
|
||||
this->angle.yaw += 200.0*engine->frameDelta;
|
||||
}
|
||||
void render() override {
|
||||
glColor3f(0.75,0.75,0.75);
|
||||
glPushMatrix();
|
||||
glRotatef(-angle.x,1.0f, 0.0f, 0.0f);
|
||||
glRotatef(-angle.y,0.0f, 1.0f, 0.0f);
|
||||
glRotatef(-angle.pitch,1.0f, 0.0f, 0.0f);
|
||||
glRotatef(-angle.yaw,0.0f, 1.0f, 0.0f);
|
||||
glTranslatef(position.x ,position.y,position.z);
|
||||
geometry.draw();
|
||||
glPopMatrix();
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <GL/gl.h>
|
||||
#include <types/vector3.h>
|
||||
#include <types/vector.h>
|
||||
|
||||
struct Vertex {
|
||||
GLfloat x, y, z;
|
||||
|
@@ -2,9 +2,9 @@
|
||||
|
||||
inline void Moby::move(Angle a, float speed)
|
||||
{
|
||||
this->position.z += (speed*engine->frameDelta) * a.x;
|
||||
this->position.y += (speed*engine->frameDelta) * a.y;
|
||||
this->position.x += (speed*engine->frameDelta) * a.z;
|
||||
this->position.z += (speed*engine->frameDelta) * a.pitch;
|
||||
this->position.y += (speed*engine->frameDelta) * a.yaw;
|
||||
this->position.x += (speed*engine->frameDelta) * a.roll;
|
||||
}
|
||||
|
||||
inline Angle Moby::fAngle()
|
||||
@@ -29,9 +29,9 @@ Angle Moby::lAngle()
|
||||
{
|
||||
Angle f = fAngle();
|
||||
Angle a;
|
||||
a.pitch = f.pitch * upVector.z - f.z * upVector.y;
|
||||
a.yaw = f.z * upVector.x - f.pitch * upVector.z;
|
||||
a.z = f.pitch * upVector.y - f.yaw * upVector.x;
|
||||
a.pitch = f.pitch * upVector.z - f.roll * upVector.y;
|
||||
a.yaw = f.roll * upVector.x - f.pitch * upVector.z;
|
||||
a.roll = f.pitch * upVector.y - f.yaw * upVector.x;
|
||||
return a;
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ Angle Moby::rAngle()
|
||||
{
|
||||
Angle f = fAngle();
|
||||
Angle a;
|
||||
a.x = -(f.y * upVector.z - f.z * upVector.y);
|
||||
a.y = (f.z * upVector.x - f.x * upVector.z);
|
||||
a.z = -(f.x * upVector.y - f.y * upVector.x);
|
||||
a.pitch = -(f.yaw * upVector.z - f.roll * upVector.y);
|
||||
a.yaw = (f.roll * upVector.x - f.pitch * upVector.z);
|
||||
a.roll = -(f.pitch * upVector.y - f.yaw * upVector.x);
|
||||
return a;
|
||||
}
|
||||
|
||||
@@ -68,6 +68,4 @@ void Moby::doScriptedMovement()
|
||||
this->position = scriptedMove.positions[scriptedMove.index];
|
||||
scriptedMove.index++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user