Remove glm ;)
This commit is contained in:
@@ -17,7 +17,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|||||||
|
|
||||||
# Enable Package Managers
|
# Enable Package Managers
|
||||||
include(cmake/CPM.cmake)
|
include(cmake/CPM.cmake)
|
||||||
include(cmake/glm.cmake)
|
|
||||||
|
|
||||||
file(GLOB_RECURSE HEADERS "include/*")
|
file(GLOB_RECURSE HEADERS "include/*")
|
||||||
file(GLOB_RECURSE SOURCES "src/*")
|
file(GLOB_RECURSE SOURCES "src/*")
|
||||||
@@ -25,13 +24,6 @@ file(GLOB_RECURSE ASSETS "assets/*")
|
|||||||
|
|
||||||
include_directories("include")
|
include_directories("include")
|
||||||
|
|
||||||
CPMAddPackage(
|
|
||||||
NAME glm
|
|
||||||
GITHUB_REPOSITORY g-truc/glm
|
|
||||||
OPTIONS "GLM_STATIC_LIBRARY_ENABLE"
|
|
||||||
GIT_TAG 0.9.9.8
|
|
||||||
)
|
|
||||||
|
|
||||||
#Move all libraries to lib after building.
|
#Move all libraries to lib after building.
|
||||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
|
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
|
||||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
|
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
|
||||||
@@ -70,7 +62,6 @@ set_target_properties(Re3D_Demo PROPERTIES LINK_FLAGS "-Wl,-rpath,./lib")
|
|||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${PROJECT_SOURCE_DIR}/include
|
${PROJECT_SOURCE_DIR}/include
|
||||||
#${glm_SOURCE_DIR}
|
|
||||||
${ReWindow_SOURCE_DIR}/include
|
${ReWindow_SOURCE_DIR}/include
|
||||||
${ReHardwareID_SOURCE_DIR}/include
|
${ReHardwareID_SOURCE_DIR}/include
|
||||||
${J3ML_SOURCE_DIR}/include
|
${J3ML_SOURCE_DIR}/include
|
||||||
|
@@ -1,64 +0,0 @@
|
|||||||
|
|
||||||
#-----------------------------------------------------------------------
|
|
||||||
# CPM configuration
|
|
||||||
#-----------------------------------------------------------------------
|
|
||||||
set(CPM_MODULE_NAME iauns_cpm_glm)
|
|
||||||
set(CPM_LIB_TARGET_NAME ${CPM_MODULE_NAME})
|
|
||||||
|
|
||||||
if ((DEFINED CPM_DIR) AND (DEFINED CPM_UNIQUE_ID) AND (DEFINED CPM_TARGET_NAME))
|
|
||||||
set(CPM_LIB_TARGET_NAME ${CPM_TARGET_NAME})
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CPM_DIR})
|
|
||||||
include(CPM)
|
|
||||||
else()
|
|
||||||
set(CPM_DIR "${CMAKE_CURRENT_BINARY_DIR}/cpm-packages" CACHE TYPE STRING)
|
|
||||||
find_package(Git)
|
|
||||||
if(NOT GIT_FOUND)
|
|
||||||
message(FATAL_ERROR "CPM requires Git.")
|
|
||||||
endif()
|
|
||||||
if (NOT EXISTS ${CPM_DIR}/CPM.cmake)
|
|
||||||
execute_process(
|
|
||||||
COMMAND "${GIT_EXECUTABLE}" clone https://github.com/iauns/cpm ${CPM_DIR}
|
|
||||||
RESULT_VARIABLE error_code
|
|
||||||
OUTPUT_VARIABLE head_sha)
|
|
||||||
if(error_code)
|
|
||||||
message(FATAL_ERROR "CPM failed to get the hash for HEAD")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
include(${CPM_DIR}/CPM.cmake)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# All externals *must* define this.
|
|
||||||
CPM_ForceOnlyOneModuleVersion()
|
|
||||||
|
|
||||||
CPM_InitModule(${CPM_MODULE_NAME})
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
# GLM
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# We manually download GLM into our source directory so the user can access
|
|
||||||
# glm through 'glm/...'. There is no build step since this is a header only
|
|
||||||
# library.
|
|
||||||
set(REPO_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/glm")
|
|
||||||
CPM_EnsureRepoIsCurrent(
|
|
||||||
TARGET_DIR ${REPO_SOURCE_DIR}
|
|
||||||
GIT_REPOSITORY "https://github.com/g-truc/glm.git"
|
|
||||||
GIT_TAG "0.9.4.6"
|
|
||||||
USE_CACHING TRUE
|
|
||||||
)
|
|
||||||
CPM_ExportAdditionalIncludeDir("${REPO_SOURCE_DIR}")
|
|
||||||
|
|
||||||
# Enable a number of useful GLM options.
|
|
||||||
if (NOT DEFINED CPM_GLM_NO_SWIZZLE)
|
|
||||||
CPM_ExportAdditionalDefinition("-DGLM_SWIZZLE")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT DEFINED CPM_GLM_CPP11)
|
|
||||||
CPM_ExportAdditionalDefinition("-DGLM_FORCE_CXX03")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT DEFINED CPM_GLM_DEGREES)
|
|
||||||
CPM_ExportAdditionalDefinition("-DGLM_FORCE_RADIANS")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
@@ -2,10 +2,8 @@
|
|||||||
#include "moby.h"
|
#include "moby.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "../engine/engine.h"
|
#include "../engine/engine.h"
|
||||||
#include <glm/glm.hpp>
|
|
||||||
#include "entityList.h"
|
#include "entityList.h"
|
||||||
#include <GL/glu.h>
|
#include <GL/glu.h>
|
||||||
#include "glm/ext/matrix_transform.hpp"
|
|
||||||
|
|
||||||
enum class CameraMode: uint8_t {
|
enum class CameraMode: uint8_t {
|
||||||
THIRD_PERSON = 0,
|
THIRD_PERSON = 0,
|
||||||
@@ -13,13 +11,13 @@ enum class CameraMode: uint8_t {
|
|||||||
SCRIPTED_MOVE = 2
|
SCRIPTED_MOVE = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
const glm::vec3 UP = {0, 1, 0};
|
const LinearAlgebra::Vector3 UP = {0, 1, 0};
|
||||||
|
|
||||||
class Camera : public Moby {
|
class Camera : public Moby {
|
||||||
protected:
|
protected:
|
||||||
public:
|
public:
|
||||||
|
|
||||||
glm::mat4x4 GetViewMatrix()
|
LinearAlgebra::Matrix4x4 GetViewMatrix()
|
||||||
{
|
{
|
||||||
//return glm::lookAt(position, position + angle, UP);
|
//return glm::lookAt(position, position + angle, UP);
|
||||||
}
|
}
|
||||||
@@ -30,9 +28,9 @@ public:
|
|||||||
void TurnLeft(float deg = 90);
|
void TurnLeft(float deg = 90);
|
||||||
void TurnRight(float deg = 90);
|
void TurnRight(float deg = 90);
|
||||||
|
|
||||||
void LookAt(glm::vec3 pos, glm::vec3 target, glm::vec3 upaxis = UP) {}
|
void LookAt(LinearAlgebra::Vector3 pos, LinearAlgebra::Vector3 target, LinearAlgebra::Vector3 upaxis = UP) {}
|
||||||
void Rotate(float amt, glm::vec3 axis) { }
|
void Rotate(float amt, LinearAlgebra::Vector3 axis) { }
|
||||||
void Translate(glm::vec3 dir) { }
|
void Translate(LinearAlgebra::Vector3 dir) { }
|
||||||
|
|
||||||
float fov;
|
float fov;
|
||||||
Camera() : Moby(), fov(60)
|
Camera() : Moby(), fov(60)
|
||||||
|
@@ -1,20 +1,21 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <glm/glm.hpp>
|
|
||||||
#include <types/vector.h>
|
#include <types/vector.h>
|
||||||
|
#include <J3ML/LinearAlgebra/Matrix4x4.h>
|
||||||
|
#include <J3ML/LinearAlgebra/Vector3.h>
|
||||||
|
|
||||||
class Entity {
|
class Entity {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
glm::mat4x4 coordinates;
|
LinearAlgebra::Matrix4x4 coordinates;
|
||||||
public:
|
public:
|
||||||
Position position; //X Y Z
|
Position position; //X Y Z
|
||||||
uint32_t ticksAlive; //At 64tps it'd take 776 days to overflow.
|
uint32_t ticksAlive; //At 64tps it'd take 776 days to overflow.
|
||||||
|
|
||||||
glm::vec3 GetPos() const;
|
LinearAlgebra::Vector3 GetPos() const;
|
||||||
void SetPos(const glm::vec3& rhs);
|
void SetPos(const LinearAlgebra::Vector3& rhs);
|
||||||
glm::mat4 GetMatrix() const;
|
LinearAlgebra::Matrix4x4 GetMatrix() const;
|
||||||
void SetMatrix(const glm::mat4& rhs);
|
void SetMatrix(const LinearAlgebra::Matrix4x4& rhs);
|
||||||
//Angle GetRotation() const { return glm::eulerAngles(); }
|
//Angle GetRotation() const { return glm::eulerAngles(); }
|
||||||
//void SetRotation(Angle&const rhs);
|
//void SetRotation(Angle&const rhs);
|
||||||
bool draw = true;
|
bool draw = true;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <types/entity.h>
|
#include <types/entity.h>
|
||||||
#include "animation/scriptedMove.h"
|
#include "animation/scriptedMove.h"
|
||||||
|
#include "J3ML/LinearAlgebra/Vector3.h"
|
||||||
|
|
||||||
|
|
||||||
//Movable Object.
|
//Movable Object.
|
||||||
@@ -14,8 +14,8 @@ public:
|
|||||||
}
|
}
|
||||||
Angle angle = {0,0,0}; //Pitch Yaw Roll, The orientation of the entity in the world,
|
Angle angle = {0,0,0}; //Pitch Yaw Roll, The orientation of the entity in the world,
|
||||||
Angle velAngle = {0,0,0}; //The angle of an entities velocity.
|
Angle velAngle = {0,0,0}; //The angle of an entities velocity.
|
||||||
glm::vec3 Velocity;
|
LinearAlgebra::Vector3 Velocity;
|
||||||
vector3 upVector = {0.0f,1.0f,0.0f};
|
LinearAlgebra::Vector3 upVector = {0.0f,1.0f,0.0f};
|
||||||
ScriptedMove scriptedMove;
|
ScriptedMove scriptedMove;
|
||||||
void move(Angle a, float speed);
|
void move(Angle a, float speed);
|
||||||
Angle fAngle(); // forward angle
|
Angle fAngle(); // forward angle
|
||||||
|
@@ -4,8 +4,9 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <glm/glm.hpp>
|
#include <J3ML/LinearAlgebra.h>
|
||||||
#include <glm/ext/scalar_constants.hpp>
|
#include <J3ML/LinearAlgebra/Matrix4x4.h>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
inline float lerp(float a, float b, float t) {
|
inline float lerp(float a, float b, float t) {
|
||||||
|
|
||||||
@@ -138,9 +139,9 @@ public:
|
|||||||
|
|
||||||
Angle movementAngle() {
|
Angle movementAngle() {
|
||||||
Angle a;
|
Angle a;
|
||||||
a.pitch = (cos(glm::radians(yaw)) * cos(glm::radians(pitch)));
|
a.pitch = (cos(Math::Radians(yaw)) * cos(Math::Radians(pitch)));
|
||||||
a.yaw = -sin(glm::radians(pitch));
|
a.yaw = -sin(Math::Radians(pitch));
|
||||||
a.roll = (sin(glm::radians(yaw)) * cos(glm::radians(pitch)));
|
a.roll = (sin(Math::Radians(yaw)) * cos(Math::Radians(pitch)));
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -198,7 +199,7 @@ public:
|
|||||||
// The CFrame is fundamentally 4 vectors (position, forward, right, up vector)
|
// The CFrame is fundamentally 4 vectors (position, forward, right, up vector)
|
||||||
class CoordinateFrame
|
class CoordinateFrame
|
||||||
{
|
{
|
||||||
glm::mat4x4 matrix;
|
LinearAlgebra::Matrix4x4 matrix;
|
||||||
vector3 getPosition();
|
vector3 getPosition();
|
||||||
vector3 getLookVector();
|
vector3 getLookVector();
|
||||||
vector3 getRightVector();
|
vector3 getRightVector();
|
||||||
@@ -219,7 +220,7 @@ inline namespace VectorMath {
|
|||||||
|
|
||||||
//Basically an aimbot.
|
//Basically an aimbot.
|
||||||
inline Angle calcAngle(Position sP, Position eP) {
|
inline Angle calcAngle(Position sP, Position eP) {
|
||||||
const auto pi = glm::pi<float>();
|
const auto pi = Math::Pi;
|
||||||
//returned.x = -(asinf((eP.y - sP.y) / distance(sP, eP)) * 180.0f / M_PI);
|
//returned.x = -(asinf((eP.y - sP.y) / distance(sP, eP)) * 180.0f / M_PI);
|
||||||
//returned.y = (atan2f(eP.x - sP.x,eP.z - sP.z) / M_PI * 180.0f);
|
//returned.y = (atan2f(eP.x - sP.x,eP.z - sP.z) / M_PI * 180.0f);
|
||||||
return {static_cast<float>((-(asinf((eP.y - sP.y) / distance(sP, eP)) * 180.0f / pi ))),static_cast<float>((atan2f(eP.x - sP.x,eP.z - sP.z) / pi * 180.0f)),0};
|
return {static_cast<float>((-(asinf((eP.y - sP.y) / distance(sP, eP)) * 180.0f / pi ))),static_cast<float>((atan2f(eP.x - sP.x,eP.z - sP.z) / pi * 180.0f)),0};
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
#include <types/entity.h>
|
#include <types/entity.h>
|
||||||
|
|
||||||
inline glm::vec3 Entity::GetPos() const
|
//inline LinearAlgebra::Vector3 Entity::GetPos() const
|
||||||
{ return glm::vec3(coordinates[1]); }
|
//{ return LinearAlgebra::Vector3(coordinates[1]); }
|
||||||
|
|
||||||
void Entity::SetPos(const glm::vec3& rhs)
|
//void Entity::SetPos(const LinearAlgebra::Vector3& rhs)
|
||||||
{ coordinates[1] = glm::vec4(rhs.x, rhs.y, rhs.z, 0); }
|
//{ coordinates[1] = LinearAlgebra::Vector4(rhs.x, rhs.y, rhs.z, 0); }
|
||||||
|
|
||||||
glm::mat4 Entity::GetMatrix() const
|
//glm::mat4 Entity::GetMatrix() const
|
||||||
{ return coordinates;}
|
//{ return coordinates;}
|
||||||
|
|
||||||
void Entity::SetMatrix(const glm::mat4& rhs)
|
void Entity::SetMatrix(const LinearAlgebra::Matrix4x4& rhs)
|
||||||
{ coordinates = rhs; }
|
{ coordinates = rhs; }
|
||||||
|
@@ -19,18 +19,18 @@ Position Moby::simulateMove(Angle a, float speed) {
|
|||||||
inline Angle Moby::fAngle()
|
inline Angle Moby::fAngle()
|
||||||
{
|
{
|
||||||
Angle a;
|
Angle a;
|
||||||
a.pitch = (cos(glm::radians(this->angle.yaw)) * cos(glm::radians(this->angle.pitch)));
|
a.pitch = (cos(Math::Radians(this->angle.yaw)) * cos(Math::Radians(this->angle.pitch)));
|
||||||
a.yaw = -sin(glm::radians(this->angle.pitch));
|
a.yaw = -sin(Math::Radians(this->angle.pitch));
|
||||||
a.roll = (sin(glm::radians(this->angle.yaw)) * cos(glm::radians(this->angle.pitch)));
|
a.roll = (sin(Math::Radians(this->angle.yaw)) * cos(Math::Radians(this->angle.pitch)));
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
Angle Moby::bAngle()
|
Angle Moby::bAngle()
|
||||||
{
|
{
|
||||||
Angle a;
|
Angle a;
|
||||||
a.pitch = -(cos(glm::radians(this->angle.yaw)) * cos(glm::radians(this->angle.pitch)));
|
a.pitch = -(cos(Math::Radians(this->angle.yaw)) * cos(Math::Radians(this->angle.pitch)));
|
||||||
a.yaw = sin(glm::radians(this->angle.pitch));
|
a.yaw = sin(Math::Radians(this->angle.pitch));
|
||||||
a.roll = -(sin(glm::radians(this->angle.yaw)) * cos(glm::radians(this->angle.pitch)));
|
a.roll = -(sin(Math::Radians(this->angle.yaw)) * cos(Math::Radians(this->angle.pitch)));
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user