Changes to player, and mesh renderer INCOMPLETE
This commit is contained in:
37
GameObject.h
37
GameObject.h
@@ -2,13 +2,14 @@
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <InputComponent.h>
|
||||
#include <GraphicsComponent.h>
|
||||
#include <PhysicsComponent.h>
|
||||
|
||||
class GameObject
|
||||
{
|
||||
public:
|
||||
unsigned int GameObjectID;
|
||||
|
||||
glm::vec3 Position;
|
||||
|
||||
glm::vec3 Rotation;
|
||||
@@ -16,8 +17,7 @@ public:
|
||||
glm::vec3 Scale;
|
||||
|
||||
GameObject(glm::vec3 Position, glm::vec3 Rotation, glm::vec3 Scale)
|
||||
: Input(nullptr),
|
||||
Graphics(nullptr),
|
||||
: Graphics(nullptr),
|
||||
Physics(nullptr),
|
||||
Position(Position),
|
||||
Rotation(Rotation),
|
||||
@@ -27,11 +27,11 @@ public:
|
||||
Right(1.0f, 0.0f, 0.0f),
|
||||
WorldUp(0.0f, 1.0f, 0.0f)
|
||||
{
|
||||
GameObjectID = 0;
|
||||
}
|
||||
|
||||
GameObject(InputComponent* Input, GraphicsComponent* Graphics, PhysicsComponent* Physics)
|
||||
: Input(Input),
|
||||
Graphics(Graphics),
|
||||
GameObject(GraphicsComponent* Graphics, PhysicsComponent* Physics)
|
||||
: Graphics(Graphics),
|
||||
Physics(Physics),
|
||||
Position(0.0f, 0.0f, 0.0f),
|
||||
Rotation(0.0f, 0.0f, 0.0f),
|
||||
@@ -40,17 +40,17 @@ public:
|
||||
Up(0.0f, 1.0f, 0.0f),
|
||||
Right(1.0f, 0.0f, 0.0f),
|
||||
WorldUp(0.0f, 1.0f, 0.0f)
|
||||
{}
|
||||
|
||||
void Update()
|
||||
{
|
||||
Input->Update();
|
||||
Graphics->Update();
|
||||
Physics->Update();
|
||||
GameObjectID = 0;
|
||||
}
|
||||
|
||||
void Update(float DeltaTime)
|
||||
{
|
||||
//Graphics->Update();
|
||||
//Physics->Update();
|
||||
}
|
||||
|
||||
protected:
|
||||
InputComponent* Input;
|
||||
GraphicsComponent* Graphics;
|
||||
PhysicsComponent* Physics;
|
||||
|
||||
@@ -58,4 +58,15 @@ protected:
|
||||
glm::vec3 Up;
|
||||
glm::vec3 Right;
|
||||
glm::vec3 WorldUp;
|
||||
|
||||
void UpdateVectors()
|
||||
{
|
||||
glm::vec3 UpdatedFront;
|
||||
UpdatedFront.x = cos(glm::radians(Rotation.y)) * cos(glm::radians(Rotation.x));
|
||||
UpdatedFront.y = sin(glm::radians(Rotation.x));
|
||||
UpdatedFront.z = sin(glm::radians(Rotation.y)) * cos(glm::radians(Rotation.x));
|
||||
Front = glm::normalize(UpdatedFront);
|
||||
Right = glm::normalize(glm::cross(Front, WorldUp));
|
||||
Up = glm::normalize(glm::cross(Right, Front));
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user