Initial Windows Support

This commit is contained in:
2024-06-30 20:48:54 -04:00
parent 7c0b91d8cc
commit d9928dde76
11 changed files with 46 additions and 36 deletions

View File

@@ -20,7 +20,6 @@ file(GLOB_RECURSE HEADERS "include/*")
file(GLOB_RECURSE SOURCES "src/*")
file(GLOB_RECURSE ASSETS "assets/*")
#Move all libraries to lib after building.
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
@@ -38,10 +37,10 @@ CPMAddPackage(
URL https://git.redacted.cc/josh/Event/archive/Release-6.zip
)
CPMAddPackage(
NAME ReHardwareID
URL https://git.redacted.cc/Redacted/ReHardwareID/archive/Prerelease-1.zip
)
#CPMAddPackage(
# NAME ReHardwareID
# URL https://git.redacted.cc/Redacted/ReHardwareID/archive/Prerelease-1.zip
#)
CPMAddPackage(
NAME J3ML
@@ -60,7 +59,7 @@ CPMAddPackage(
CPMAddPackage(
NAME UUID
URL https://git.redacted.cc/Redacted/uuid/archive/v1.zip
URL https://git.redacted.cc/Redacted/uuid/archive/Release-1.zip
)
CPMAddPackage(
@@ -68,22 +67,28 @@ CPMAddPackage(
URL https://git.redacted.cc/Redacted/glad/archive/v2.1ext_mt.zip
)
CPMAddPackage(
NAME archive
URL https://git.redacted.cc/Redacted/archive/archive/v1.0.zip
)
#CPMAddPackage(
# NAME archive
# URL https://git.redacted.cc/Redacted/archive/archive/v1.0.zip
#)
CPMAddPackage(
NAME Collage
URL https://git.redacted.cc/Redacted/Collage/archive/v0.4.zip
URL https://git.redacted.cc/Redacted/Collage/archive/v0.5.zip
)
CPMAddPackage(
NAME jlog
URL https://git.redacted.cc/josh/jlog/archive/Prerelease-8.zip
URL https://git.redacted.cc/josh/jlog/archive/Prerelease-12.zip
)
add_library(Re3D SHARED ${SOURCES})
if (UNIX AND NOT APPLE)
add_library(Re3D SHARED ${SOURCES})
endif()
if (WIN32)
add_library(Re3D STATIC ${SOURCES})
endif()
target_include_directories(Re3D PUBLIC
${PROJECT_SOURCE_DIR}/include
@@ -95,7 +100,7 @@ target_include_directories(Re3D PUBLIC
${ReTexture_SOURCE_DIR}/include
${glad_SOURCE_DIR}/include
${UUID_SOURCE_DIR}/include
${archive_SOURCE_DIR}/include
#${archive_SOURCE_DIR}/include
${Collage_SOURCE_DIR}/include
${Event_SOURCE_DIR}/include
)
@@ -103,9 +108,14 @@ target_include_directories(Re3D PUBLIC
# Why god???
set_target_properties(Re3D PROPERTIES LINKER_LANGUAGE CXX)
find_package(OpenGL REQUIRED)
if (UNIX AND NOT APPLE)
find_package(OpenGL REQUIRED)
target_link_libraries(Re3D PUBLIC Event ReWindowLibrary ReTexture J3ML GL glad Collage JGL jlog)
endif()
target_link_libraries(Re3D PUBLIC Event ReWindowLibrary ReTexture J3ML GL glad Collage JGL archive jlog)
if (WIN32)
target_link_libraries(Re3D PUBLIC Event ReWindowLibrary ReTexture J3ML glad Collage JGL jlog)
endif()
include(src/demo/RuntimeTest/CMakeLists.txt)

View File

@@ -2,5 +2,6 @@
#include <Redacted3D/types/entity/camera.h>
namespace Occlusion {
bool frustumCull(Camera* camera, Entity* entity);
//TODO
bool frustumCull(Camera* camera, Entity* entity) { return false; }
}

View File

@@ -5,7 +5,7 @@
#include <J3ML/LinearAlgebra/Matrix4x4.h>
#include <J3ML/LinearAlgebra/Vector3.h>
#include <Redacted3D/engine/collision.h>
#include <archive.h>
//#include <archive.h>
using J3ML::LinearAlgebra::Matrix4x4;
using J3ML::LinearAlgebra::Vector3;
@@ -35,7 +35,7 @@ public:
bool alive;
virtual std::vector<std::string> GetEntityUUIDList() const {}
virtual std::vector<std::string> GetEntityUUIDList() const { return std::vector<std::string> { "" }; }
template <class T>
void SerializeMemberData(T& archive)

View File

@@ -1,9 +1,8 @@
#pragma once
#include <vector>
#include <iostream>
#include <fstream>
#include <Collage/types/animation.h>
#include <Collage/types/model.h>
#include <J3ML/LinearAlgebra/Vector3.h>
#include <J3ML/LinearAlgebra/Vector2.h>
#include <J3ML/Geometry/OBB.h>
@@ -12,6 +11,7 @@
///Forward declaration of entity.
class Entity;
typedef Vector2 TextureCoordinate;
using J3ML::LinearAlgebra::Vector3;
using J3ML::LinearAlgebra::Vector2;
using J3ML::Geometry::OBB;
@@ -19,7 +19,6 @@ using J3ML::Geometry::OBB;
///A point which makes up a model in 3D space.
typedef Vector3 Vertex;
///Determines how your texture is wrapped around the model.
typedef Vector2 TextureCoordinate;
///Drawable type. Models are stored in these.
class VertexArray {

View File

@@ -2,7 +2,10 @@ include_directories("src/demo/RuntimeTest/include")
add_executable(Re3D-RuntimeTest "src/demo/RuntimeTest/main.cpp")
#Link based on the relative path *so you can copy the game around*
set_target_properties(Re3D-RuntimeTest PROPERTIES LINK_FLAGS "-Wl,-rpath,./lib")
if (UNIX AND NOT APPLE)
set_target_properties(Re3D-RuntimeTest PROPERTIES LINK_FLAGS "-Wl,-rpath,./lib")
endif()
#Copy the assets to the build directory.
file(COPY "assets" DESTINATION "${PROJECT_BINARY_DIR}")

View File

@@ -8,8 +8,8 @@
using namespace J3ML;
std::array<float, 16> perspective(float fov, float aspect, float nearPlane, float farPlane) {
std::array<float, 16> result{};
std::vector<float> perspective(float fov, float aspect, float nearPlane, float farPlane) {
std::vector<float> result(16);
float f = 1.0f / tan(fov * 0.5f * M_PI / 180.0f);
result[0] = f / aspect;
result[5] = f;
@@ -20,7 +20,7 @@ std::array<float, 16> perspective(float fov, float aspect, float nearPlane, floa
}
void Engine::quit() const {
window->destroyWindow();
//window->destroyWindow();
exit(0);
}
@@ -225,7 +225,7 @@ EngineError Engine::getError() {
}
void Engine::quit(ENGINE_ERROR_CODE code) const {
window->destroyWindow();
//window->destroyWindow();
exit((int) code);
}

View File

@@ -2,6 +2,4 @@
#include <Redacted3D/types/entity/entity.h>
bool Occlusion::frustumCull(Camera* camera, Entity* entity) {
}
//bool Occlusion::frustumCull(Camera* camera, Entity* entity) {}

View File

@@ -28,8 +28,9 @@ void Camera::post_render() {
ticksAlive++;
}
/*
bool Camera::raycast(Entity *entity) {
Vector3 rayOrigin = position;
Vector3 rayAngle = getAngle();
}
*/

View File

@@ -178,9 +178,7 @@ void Entity::render() {
}
}
bool Entity::isCollidingWith(Entity *entity) {
}
//bool Entity::isCollidingWith(Entity *entity) {}
Texture* Entity::getTexture() {
if (engine->world->textureList.empty())

View File

@@ -59,7 +59,7 @@ void Texture::erase(Texture* texture) const {
MultiTexture::MultiTexture(Entity* entity, const char* pathContainingTextures, bool storeOnTextureList) {
for (const auto& entry : std::filesystem::directory_iterator(pathContainingTextures))
if (entry.is_regular_file() && entry.path().extension() == ".png") {
Texture texture(entity, entry.path().c_str(), false);
Texture texture(entity, (const char*) entry.path().c_str(), false);
//The base texture *must* go in the first slot.
if (entry.path().filename() == "default.png")

View File

@@ -33,7 +33,7 @@ void VertexArray::load (const std::string& filename) {
}
//Cached OBB.
this->cachedOBB = Collision::genMinimallyEnclosingOBB(this, (Vector3) {0, 0, 0});
this->cachedOBB = Collision::genMinimallyEnclosingOBB(this, {0, 0, 0});
}
void VertexArray::draw() {