WIP: Switching from Premake to CMake build system
This commit is contained in:
parent
7349c0eb16
commit
391fd5a8a8
21
CmakeLists.txt
Normal file
21
CmakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
CMAKE_MINIMUM_REQUIRED (VERSION 4.0)
|
||||||
|
project(Yoggie)
|
||||||
|
set(EXPORT_COMPILE_COMMANDS_JSON ON)
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4099")
|
||||||
|
else()
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wclass-struct-conversion")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||||
|
add_compile_definitions(GLFW_STATIC)
|
||||||
|
|
||||||
|
add_subdirectory(Editor)
|
||||||
|
add_subdirectory(SandboxApp)
|
||||||
|
include(libraries.cmake)
|
||||||
|
add_subdirectory(YoggieEngine)
|
||||||
|
|
||||||
|
|
17
Editor/CMakeLists.txt
Normal file
17
Editor/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
file(GLOB SOURCE_FILES "src/*.cpp")
|
||||||
|
file(GLOB HEADER_FILES "src/*.h")
|
||||||
|
add_executable(Editor ${SOURCE_FILES} "../libs/glad/src/glad.c" ${HEADER_FILES})
|
||||||
|
|
||||||
|
target_include_directories(Editor PRIVATE
|
||||||
|
"../YoggieEngine/src"
|
||||||
|
"../libs/guizmo"
|
||||||
|
)
|
||||||
|
target_link_directories(Editor PRIVATE
|
||||||
|
"../libs/ImGui/build/Release"
|
||||||
|
"../libs/guizmo/build/Release" )
|
||||||
|
target_link_libraries(Editor
|
||||||
|
thirdparty_tools
|
||||||
|
YoggieEngine
|
||||||
|
ImGui
|
||||||
|
ImGuizmo
|
||||||
|
)
|
@ -1,51 +0,0 @@
|
|||||||
project "Editor"
|
|
||||||
kind "ConsoleApp"
|
|
||||||
|
|
||||||
buildmessage "Building editor ..."
|
|
||||||
|
|
||||||
links{
|
|
||||||
"YoggieEngine",
|
|
||||||
"ImGuizmo",
|
|
||||||
"nfd"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
targetdir "%{wks.location}/%{prj.name}/build/%{cfg.buildcfg}"
|
|
||||||
objdir "%{wks.location}/%{prj.name}/build/%{cfg.buildcfg}/intermediates/"
|
|
||||||
|
|
||||||
includedirs{
|
|
||||||
|
|
||||||
"../YoggieEngine/build/Debug",
|
|
||||||
|
|
||||||
-- I'd prefer if didn't need these..
|
|
||||||
-- We'll figure that out some time later
|
|
||||||
"../libs/physx/physx/include",
|
|
||||||
"../libs/physx/pxshared/include",
|
|
||||||
incfolder["lua"],
|
|
||||||
incfolder["spdlog"],
|
|
||||||
incfolder["glm"],
|
|
||||||
incfolder["assimp"],
|
|
||||||
incfolder["glad"],
|
|
||||||
incfolder["glfw"],
|
|
||||||
|
|
||||||
incfolder["imgui"],
|
|
||||||
incfolder["imguizmo"],
|
|
||||||
incfolder["entt"],
|
|
||||||
incfolder["yamlcpp"],
|
|
||||||
incfolder["nativefiledialog"],
|
|
||||||
incfolder["mINI"]
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
libdirs {
|
|
||||||
staticlib["yoggie"],
|
|
||||||
staticlib["nativefiledialog"]
|
|
||||||
}
|
|
||||||
|
|
||||||
files {
|
|
||||||
"../libs/glad/src/glad.c",
|
|
||||||
"./src/**.h",
|
|
||||||
"./src/**.cpp"
|
|
||||||
}
|
|
@ -1,27 +1,17 @@
|
|||||||
#include "../../YoggieEngine/src/EntryPoint.h"
|
|
||||||
#include <stack>
|
|
||||||
#include "EditorLayer.h"
|
#include "EditorLayer.h"
|
||||||
|
#include "EntryPoint.h"
|
||||||
|
#include <stack>
|
||||||
|
|
||||||
using namespace YoggieEngine;
|
using namespace YoggieEngine;
|
||||||
|
|
||||||
class Editor : public Application {
|
class Editor : public Application {
|
||||||
public:
|
public:
|
||||||
Editor() : Application("Editor"){}
|
Editor() : Application("Editor") {}
|
||||||
|
|
||||||
void Run() override
|
|
||||||
{
|
|
||||||
PushLayer(new EditorLayer());
|
|
||||||
Application::Run();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
void Run() override {
|
||||||
|
PushLayer(new EditorLayer());
|
||||||
|
Application::Run();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
YoggieEngine::Application* CreateApplication() {
|
YoggieEngine::Application *CreateApplication() { return new Editor(); }
|
||||||
|
|
||||||
return new Editor();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
6
SandboxApp/CMakeLists.txt
Normal file
6
SandboxApp/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
file(GLOB SOURCE_FILES "src/*.cpp")
|
||||||
|
file(GLOB HEADER_FILES "src/*.h")
|
||||||
|
add_executable(SandboxApp ${SOURCE_FILES} ${HEADER_FILES} )
|
||||||
|
target_link_directories(SandboxApp PRIVATE "../build/YoggieEngine/Debug")
|
||||||
|
target_link_libraries(SandboxApp YoggieEngine)
|
||||||
|
target_include_directories(SandboxApp PRIVATE "../YoggieEngine/src")
|
@ -1,40 +0,0 @@
|
|||||||
project "SandboxApp"
|
|
||||||
kind "ConsoleApp"
|
|
||||||
|
|
||||||
buildmessage "Building SandboxApp ..."
|
|
||||||
|
|
||||||
links{
|
|
||||||
"YoggieEngine"
|
|
||||||
}
|
|
||||||
|
|
||||||
includedirs{
|
|
||||||
"./../YoggieEngine/Include",
|
|
||||||
|
|
||||||
-- I'd prefer if didn't need these..
|
|
||||||
-- We'll figure that out some time later
|
|
||||||
"./../libs/lua/include",
|
|
||||||
"./../libs/spdlog/include",
|
|
||||||
"./../libs/glm",
|
|
||||||
"./../libs/GorillaAudio/include",
|
|
||||||
|
|
||||||
"./../libs/assimp/include",
|
|
||||||
"./../libs/glad/include",
|
|
||||||
"./../libs/glfw/include",
|
|
||||||
"./../libs/tinygltf",
|
|
||||||
"./../libs/glew/include",
|
|
||||||
"./../libs/glm",
|
|
||||||
"./../libs/ImGui",
|
|
||||||
|
|
||||||
"../libs/entt/src",
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
libdirs {
|
|
||||||
'./../YoggieEngine/build/Debug'
|
|
||||||
}
|
|
||||||
|
|
||||||
files {
|
|
||||||
"./src/*.h",
|
|
||||||
"./src/*.cpp"
|
|
||||||
}
|
|
@ -1,11 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "YoggieEngine.h"
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "../../YoggieEngine/src/BarinkEngine.h"
|
|
||||||
#include "../../YoggieEngine/src/Graphics/Memory/Framebuffer.h"
|
|
||||||
|
|
||||||
void CameraTool();
|
void CameraTool();
|
||||||
void ScriptingTool(char* code);
|
void ScriptingTool(char *code);
|
||||||
///void transformWindow(Transform& transform, std::string PanelName);
|
/// void transformWindow(Transform& transform, std::string PanelName);
|
||||||
void materialWindow(Material& material, std::string PanelName);
|
void materialWindow(Material &material, std::string PanelName);
|
||||||
void SceneExplorer(const std::string& PanelName);
|
void SceneExplorer(const std::string &PanelName);
|
||||||
void SceneView(Framebuffer& framebuffer);
|
void SceneView(Framebuffer &framebuffer);
|
||||||
|
@ -1,123 +1,102 @@
|
|||||||
#include <imgui.h>
|
|
||||||
#include "GUI.h"
|
#include "GUI.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include <entt/entt.hpp>
|
#include <entt/entt.hpp>
|
||||||
|
#include <imgui.h>
|
||||||
|
|
||||||
#include "../../YoggieEngine/src/BarinkEngine.h"
|
#include "YoggieEngine.h"
|
||||||
#include "../../YoggieEngine/src/Scene/Components.h"
|
|
||||||
#include "../../YoggieEngine/src/Scene/Scene.h"
|
|
||||||
#include "../../YoggieEngine/src/Scene/Entity.h"
|
|
||||||
#include "../../YoggieEngine/src/AssetManager/ModelImporter.h"
|
|
||||||
#include "../../YoggieEngine/src/PerfCounter.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define globals
|
* Define globals
|
||||||
*/
|
*/
|
||||||
Scene scene;
|
Scene scene;
|
||||||
|
|
||||||
BarinkEngine::Renderable* renderable;
|
BarinkEngine::Renderable *renderable;
|
||||||
BarinkEngine::SceneObject* object;
|
BarinkEngine::SceneObject *object;
|
||||||
Entity cube;
|
Entity cube;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Runs once at startup
|
* Runs once at startup
|
||||||
* - USe to initialize the game/sandbox/demo
|
* - USe to initialize the game/sandbox/demo
|
||||||
*/
|
*/
|
||||||
void Start() {
|
void Start() {
|
||||||
auto importer = BarinkEngine::ModelImporter();
|
auto importer = BarinkEngine::ModelImporter();
|
||||||
|
|
||||||
// Load in asset(S)
|
// Load in asset(S)
|
||||||
object = importer.Import("build/Debug/Models/Cube.obj");
|
object = importer.Import("build/Debug/Models/Cube.obj");
|
||||||
renderable = object->renderable;
|
renderable = object->renderable;
|
||||||
|
|
||||||
|
// Add Entities to the scene
|
||||||
|
cube = scene.AddEntity("cube");
|
||||||
|
auto &render3DComponent =
|
||||||
|
cube.AddComponent<BarinkEngine::Render3DComponent>();
|
||||||
|
render3DComponent.mesh = *renderable->mesh;
|
||||||
|
cube.GetComponent<BarinkEngine::TransformComponent>().transform =
|
||||||
|
glm::rotate(glm::mat4(1.0f), 32.0f, glm::vec3(0.5f, 1.0f, 0.0f));
|
||||||
|
|
||||||
// Add Entities to the scene
|
// Create a second cube
|
||||||
cube = scene.AddEntity("cube");
|
|
||||||
auto& render3DComponent = cube.AddComponent<BarinkEngine::Render3DComponent>();
|
|
||||||
render3DComponent.mesh = *renderable->mesh;
|
|
||||||
cube.GetComponent<BarinkEngine::TransformComponent>()
|
|
||||||
.transform = glm::rotate(glm::mat4(1.0f), 32.0f, glm::vec3(0.5f,1.0f,0.0f));
|
|
||||||
|
|
||||||
|
auto cube2 = scene.AddEntity("Cube2");
|
||||||
|
auto &cube2Render = cube2.AddComponent<BarinkEngine::Render3DComponent>();
|
||||||
|
cube2Render.mesh = *renderable->mesh;
|
||||||
|
cube2Render.color = glm::vec3(0.0f, 1.0f, 0.0f);
|
||||||
|
auto &cube2Trans = cube2.GetComponent<BarinkEngine::TransformComponent>();
|
||||||
|
cube2Trans.transform =
|
||||||
|
glm::translate(glm::mat4(1.0f), glm::vec3(1.0f, 0.0f, 5.0f));
|
||||||
|
|
||||||
// Create a second cube
|
// Create a light
|
||||||
|
auto AmbientLight = scene.AddEntity("AmbientLight");
|
||||||
auto cube2 = scene.AddEntity("Cube2");
|
AmbientLight.AddComponent<BarinkEngine::LightComponent>();
|
||||||
auto& cube2Render = cube2.AddComponent<BarinkEngine::Render3DComponent>();
|
|
||||||
cube2Render.mesh = *renderable->mesh;
|
|
||||||
cube2Render.color = glm::vec3(0.0f, 1.0f, 0.0f);
|
|
||||||
auto& cube2Trans = cube2.GetComponent<BarinkEngine::TransformComponent>();
|
|
||||||
cube2Trans.transform = glm::translate( glm::mat4(1.0f), glm::vec3(1.0f,0.0f, 5.0f));
|
|
||||||
|
|
||||||
// Create a light
|
|
||||||
auto AmbientLight = scene.AddEntity("AmbientLight");
|
|
||||||
AmbientLight.AddComponent<BarinkEngine::LightComponent>();
|
|
||||||
|
|
||||||
renderer.Prepare(scene);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Runs every frame
|
|
||||||
* - Use to draw Immediate mode graphics (Not meant for HUD's )
|
|
||||||
*/
|
|
||||||
void ImmediateGraphicsDraw()
|
|
||||||
{
|
|
||||||
// Show internal BarinkEngine stats
|
|
||||||
EngineInstrumentation::ShowStats();
|
|
||||||
|
|
||||||
ImGui::Begin("Scene view");
|
|
||||||
auto group = scene.getReg().view<BarinkEngine::IdentifierComponent>();
|
|
||||||
group.each([](auto entity, BarinkEngine::IdentifierComponent& identifier) {
|
|
||||||
|
|
||||||
ImGui::Text("%s", identifier.name.c_str());
|
|
||||||
|
|
||||||
});
|
|
||||||
ImGui::End();
|
|
||||||
|
|
||||||
ImGui::ShowMetricsWindow();
|
|
||||||
|
|
||||||
ImGui::Begin("Settings");
|
|
||||||
|
|
||||||
|
|
||||||
auto& a = cube.GetComponent<BarinkEngine::Render3DComponent>();
|
|
||||||
|
|
||||||
auto& b = cube.GetComponent<BarinkEngine::TransformComponent>();
|
|
||||||
|
|
||||||
ImGui::DragFloat3("Color", &a.color[0], 0.01f, 0.0f, 1.0f);
|
|
||||||
|
|
||||||
ImGui::DragFloat3("Position", &b.transform[3][0], 0.01f, 0.0f, 16.0f);
|
|
||||||
|
|
||||||
auto l = scene.getReg().view<BarinkEngine::LightComponent>();
|
|
||||||
l.each([](auto entity, BarinkEngine::LightComponent& light) {
|
|
||||||
ImGui::Text("Lighting");
|
|
||||||
ImGui::SliderFloat("Intensity", &light.Strength, 0.0f, 1.0f);
|
|
||||||
ImGui::SliderFloat3("l-Color", &light.Color[0], 0.0f, 1.0f);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
ImGui::End();
|
|
||||||
|
|
||||||
|
renderer.Prepare(scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Runs every frame
|
* Runs every frame
|
||||||
* - Meant for game logic ( non-physics related)
|
* - Use to draw Immediate mode graphics (Not meant for HUD's )
|
||||||
*/
|
*/
|
||||||
void Update()
|
void ImmediateGraphicsDraw() {
|
||||||
{
|
// Show internal BarinkEngine stats
|
||||||
}
|
EngineInstrumentation::ShowStats();
|
||||||
|
|
||||||
void Render()
|
ImGui::Begin("Scene view");
|
||||||
{
|
auto group = scene.getReg().view<BarinkEngine::IdentifierComponent>();
|
||||||
renderer.Render(scene);
|
group.each([](auto entity, BarinkEngine::IdentifierComponent &identifier) {
|
||||||
|
ImGui::Text("%s", identifier.name.c_str());
|
||||||
|
});
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
|
ImGui::ShowMetricsWindow();
|
||||||
|
|
||||||
|
ImGui::Begin("Settings");
|
||||||
|
|
||||||
|
auto &a = cube.GetComponent<BarinkEngine::Render3DComponent>();
|
||||||
|
|
||||||
|
auto &b = cube.GetComponent<BarinkEngine::TransformComponent>();
|
||||||
|
|
||||||
|
ImGui::DragFloat3("Color", &a.color[0], 0.01f, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
ImGui::DragFloat3("Position", &b.transform[3][0], 0.01f, 0.0f, 16.0f);
|
||||||
|
|
||||||
|
auto l = scene.getReg().view<BarinkEngine::LightComponent>();
|
||||||
|
l.each([](auto entity, BarinkEngine::LightComponent &light) {
|
||||||
|
ImGui::Text("Lighting");
|
||||||
|
ImGui::SliderFloat("Intensity", &light.Strength, 0.0f, 1.0f);
|
||||||
|
ImGui::SliderFloat3("l-Color", &light.Color[0], 0.0f, 1.0f);
|
||||||
|
});
|
||||||
|
|
||||||
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Runs at the end of the program
|
* Runs every frame
|
||||||
* - Meant for cleanup
|
* - Meant for game logic ( non-physics related)
|
||||||
*/
|
*/
|
||||||
void Stop()
|
void Update() {}
|
||||||
{
|
|
||||||
}
|
void Render() { renderer.Render(scene); }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Runs at the end of the program
|
||||||
|
* - Meant for cleanup
|
||||||
|
*/
|
||||||
|
void Stop() {}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "../../YoggieEngine/src/BarinkEngine.h"
|
#include "YoggieEngine.h"
|
||||||
|
|
||||||
//void PrintSceneTree(Node& node, int depth);
|
// void PrintSceneTree(Node& node, int depth);
|
||||||
|
|
||||||
//glm::mat4 CalculateModelMat(Transform& transform);
|
// glm::mat4 CalculateModelMat(Transform& transform);
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
#include <YoggieEngine.h>
|
|
||||||
#include <ImGuizmo.h>
|
|
||||||
#include <gtest/gtest.h>
|
|
||||||
|
|
||||||
|
|
||||||
TEST(HelloTDD, MyFirstTest) {
|
|
||||||
EXPECT_EQ(1, 1);
|
|
||||||
};
|
|
||||||
|
|
||||||
TEST(TRANSFORM_COMPONENT_TESTS , CAN_EXTRACT_TRANSLATION_FROM_TRANSFORM_MATRIX) {
|
|
||||||
|
|
||||||
auto component = YoggieEngine::TransformComponent{};
|
|
||||||
|
|
||||||
component.Position = glm::vec3(1.0f, 2.0f, 3.0f);
|
|
||||||
auto transformationMatrix = component.GetTransform();
|
|
||||||
|
|
||||||
auto newComponent = YoggieEngine::TransformComponent{};
|
|
||||||
|
|
||||||
newComponent.Decompose(transformationMatrix);
|
|
||||||
|
|
||||||
EXPECT_EQ(newComponent.Position.x, component.Position.x);
|
|
||||||
EXPECT_EQ(newComponent.Position.y, component.Position.y);
|
|
||||||
EXPECT_EQ(newComponent.Position.z, component.Position.z);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(TRANSFORM_COMPONENT_TESTS, CAN_EXTRACT_SCALE_FROM_TRANSFORM_MATRIX) {
|
|
||||||
auto component = YoggieEngine::TransformComponent{};
|
|
||||||
|
|
||||||
component.Scale = glm::vec3(1.0f, 2.0f, 3.0f);
|
|
||||||
|
|
||||||
auto tranformationMatrix = component.GetTransform();
|
|
||||||
|
|
||||||
auto newComponent = YoggieEngine::TransformComponent{};
|
|
||||||
|
|
||||||
newComponent.Decompose(tranformationMatrix);
|
|
||||||
|
|
||||||
EXPECT_EQ(newComponent.Scale.x, component.Scale.x);
|
|
||||||
EXPECT_EQ(newComponent.Scale.y, component.Scale.y);
|
|
||||||
EXPECT_EQ(newComponent.Scale.z, component.Scale.z);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TEST(TRANSFORM_COMPONENT_TESTS, CAN_EXTRACT_ROTATION_FROM_TRANSFORM_MATRIX) {
|
|
||||||
auto component = YoggieEngine::TransformComponent{};
|
|
||||||
component.Rotation = glm::vec3(2.0f, 10.0f, 20.0f);
|
|
||||||
|
|
||||||
auto transformMatrix = component.GetTransform();
|
|
||||||
|
|
||||||
auto newComponent = YoggieEngine::TransformComponent{};
|
|
||||||
|
|
||||||
newComponent.Decompose(transformMatrix);
|
|
||||||
|
|
||||||
|
|
||||||
EXPECT_EQ(newComponent.Rotation.x, component.Rotation.x);
|
|
||||||
EXPECT_EQ(newComponent.Rotation.y, component.Rotation.y);
|
|
||||||
EXPECT_EQ(newComponent.Rotation.z, component.Rotation.z);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
|
||||||
|
|
||||||
|
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
|
||||||
return RUN_ALL_TESTS();
|
|
||||||
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
project "EngineTests"
|
|
||||||
kind "ConsoleApp"
|
|
||||||
language "C++"
|
|
||||||
|
|
||||||
|
|
||||||
targetdir "%{wks.location}/%{prj.name}/build/%{cfg.buildcfg}"
|
|
||||||
objdir "%{wks.location}/%{prj.name}/build/%{cfg.buildcfg}/intermediates/"
|
|
||||||
|
|
||||||
files{"**.h", "**.cpp"}
|
|
||||||
|
|
||||||
includedirs{
|
|
||||||
"../YoggieEngine/src",
|
|
||||||
incfolder["lua"],
|
|
||||||
incfolder["spdlog"],
|
|
||||||
incfolder["glm"],
|
|
||||||
incfolder["glad"],
|
|
||||||
incfolder["glfw"],
|
|
||||||
incfolder["imgui"],
|
|
||||||
incfolder["imguizmo"],
|
|
||||||
incfolder["entt"],
|
|
||||||
"../libs/physx/physx/include",
|
|
||||||
"../libs/physx/pxshared/include",
|
|
||||||
incfolder["GoogleTest"]
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
libdirs {
|
|
||||||
staticlib["yoggie"],
|
|
||||||
staticlib["GoogleTest"]
|
|
||||||
}
|
|
||||||
|
|
||||||
links{
|
|
||||||
"YoggieEngine",
|
|
||||||
"gtest"
|
|
||||||
}
|
|
22
YoggieEngine/CMakeLists.txt
Normal file
22
YoggieEngine/CMakeLists.txt
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
file(GLOB SOURCE_FILES src/*.cpp)
|
||||||
|
add_library(YoggieEngine ${SOURCE_FILES} )
|
||||||
|
#target_precompile_headers(YoggieEngine PUBLIC src/YoggieEngine.h )
|
||||||
|
|
||||||
|
target_link_directories(YoggieEngine PUBLIC
|
||||||
|
"../libs/physx/physx/bin/win.x86_64.vc142.md/debug"
|
||||||
|
)
|
||||||
|
target_link_libraries(YoggieEngine
|
||||||
|
thirdparty_tools
|
||||||
|
PhysX_64
|
||||||
|
PhysXCooking_64
|
||||||
|
PhysXCommon_64
|
||||||
|
PhysXFoundation_64
|
||||||
|
PhysXPvdSDK_static_64
|
||||||
|
PhysXExtensions_static_64
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(YoggieEngine PUBLIC
|
||||||
|
"../libs/physx/pxshared/include"
|
||||||
|
"../libs/physx/physx/include"
|
||||||
|
)
|
||||||
|
|
@ -1,90 +0,0 @@
|
|||||||
project "YoggieEngine"
|
|
||||||
kind "StaticLib"
|
|
||||||
|
|
||||||
pchheader "YoggieEngine.h"
|
|
||||||
pchsource "src/YoggieEngine.cpp"
|
|
||||||
|
|
||||||
|
|
||||||
targetdir "%{wks.location}/%{prj.name}/build/%{cfg.buildcfg}"
|
|
||||||
objdir "%{wks.location}/%{prj.name}/build/%{cfg.buildcfg}/intermediates/"
|
|
||||||
buildmessage "Building Yoggie Engine"
|
|
||||||
disablewarnings{
|
|
||||||
"4099" -- Ignore the missing debug signals for GLFW warning
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
filter "system:Windows"
|
|
||||||
defines{
|
|
||||||
"GLFW"
|
|
||||||
}
|
|
||||||
|
|
||||||
includedirs {
|
|
||||||
"./src",
|
|
||||||
"../libs/spdlog/include",
|
|
||||||
"../libs/glm",
|
|
||||||
|
|
||||||
"../libs/glfw/include",
|
|
||||||
"../libs/glew/include",
|
|
||||||
"../libs/glad/include",
|
|
||||||
|
|
||||||
|
|
||||||
"../libs/assimp/include",
|
|
||||||
"../libs/entt/src",
|
|
||||||
|
|
||||||
"../libs/physx/pxshared/include",
|
|
||||||
"../libs/physx/physx/include",
|
|
||||||
|
|
||||||
"../libs/lua/include",
|
|
||||||
|
|
||||||
"../libs/GorillaAudio/include",
|
|
||||||
"../libs/steam-audio/include",
|
|
||||||
|
|
||||||
"../libs/ImGui",
|
|
||||||
"../libs/yaml-cpp/include"
|
|
||||||
}
|
|
||||||
|
|
||||||
links {
|
|
||||||
-- This needs to fall under the filter as the names can differ on different platforms
|
|
||||||
"phonon",
|
|
||||||
"lua54",
|
|
||||||
"spdlog",
|
|
||||||
"assimp-vc143-mtd",
|
|
||||||
"glfw3",
|
|
||||||
"ImGui",
|
|
||||||
"yaml-cpp",
|
|
||||||
|
|
||||||
"PhysX_64",
|
|
||||||
"PhysXCooking_64",
|
|
||||||
"PhysXCommon_64",
|
|
||||||
"PhysXFoundation_64",
|
|
||||||
"PhysXPvdSDK_static_64",
|
|
||||||
"PhysXExtensions_static_64"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
libdirs {
|
|
||||||
"../libs/steam-audio/lib/windows-x64",
|
|
||||||
"../libs/lua",
|
|
||||||
"../libs/spdlog/build/Release",
|
|
||||||
"../libs/assimp/lib/Debug",
|
|
||||||
"../libs/glfw/build/src/Debug",
|
|
||||||
"../libs/physx/physx/bin/win.x86_64.vc142.md/debug",
|
|
||||||
}
|
|
||||||
|
|
||||||
files {
|
|
||||||
|
|
||||||
"src/**.cpp",
|
|
||||||
"src/**.h"
|
|
||||||
}
|
|
||||||
|
|
||||||
prebuildcommands
|
|
||||||
{
|
|
||||||
ok,err = os.copyfile("YoggieEngine/src/Graphics/shaders/*" ,"SandboxApp/build/Debug/")
|
|
||||||
}
|
|
||||||
|
|
||||||
postbuildcommands
|
|
||||||
{
|
|
||||||
ok,err = os.copyfile("YoggieEngine/build/Debug/intermediates/YoggieEngine.pch", "YoggieEngine/build/Debug/YoggieEngine.pch")
|
|
||||||
}
|
|
||||||
|
|
@ -1,72 +1,67 @@
|
|||||||
#include <YoggieEngine.h>
|
|
||||||
#include "PerfCounter.h"
|
#include "PerfCounter.h"
|
||||||
|
#include <YoggieEngine.h>
|
||||||
|
|
||||||
namespace YoggieEngine {
|
namespace YoggieEngine {
|
||||||
uint64_t EngineInstrumentation::GetPrecisionTime() {
|
uint64_t EngineInstrumentation::GetPrecisionTime() {
|
||||||
using namespace std::chrono; // REMINDER: This is kinda ugly but safes line width
|
using namespace std::chrono; // REMINDER: This is kinda ugly but safes line
|
||||||
return duration_cast<milliseconds>(high_resolution_clock::now().time_since_epoch()).count();
|
// width
|
||||||
}
|
return duration_cast<milliseconds>(
|
||||||
|
high_resolution_clock::now().time_since_epoch())
|
||||||
void EngineInstrumentation::PerfomanceSamplerInit() {
|
.count();
|
||||||
|
|
||||||
spdlog::info( "Initialize perf sampler" );
|
|
||||||
/*EngineInstrumentation::frames = 0;
|
|
||||||
EngineInstrumentation::lastSampleTime = GetPrecisionTime();*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void EngineInstrumentation::Update() {
|
|
||||||
|
|
||||||
/* uint64_t MilliSecondsPast = GetPrecisionTime() - EngineInstrumentation::lastSampleTime;
|
|
||||||
|
|
||||||
if (MilliSecondsPast >= 1000) {
|
|
||||||
|
|
||||||
EngineInstrumentation::frameTime = (float)1000 / EngineInstrumentation::frames;
|
|
||||||
EngineInstrumentation::FPS = frames;
|
|
||||||
EngineInstrumentation::frames = 0;
|
|
||||||
EngineInstrumentation::lastSampleTime = GetPrecisionTime();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void EngineInstrumentation::ShowStats() {
|
|
||||||
ImGui::Begin("Statistics", false, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize);
|
|
||||||
|
|
||||||
ImGui::Text("Currently not available");
|
|
||||||
/* ImGui::Text("FPS: %i", ES.FPS);
|
|
||||||
ImGui::Text("Frame Time: %f", ES.frameTime);
|
|
||||||
ImGui::Text("Verts: %i", ES.verts);
|
|
||||||
ImGui::Text("Draw Calls: %i", ES.DC);
|
|
||||||
*/
|
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PerfSampler::PerfSampler(const std::string& name)
|
|
||||||
: name(name)
|
|
||||||
{
|
|
||||||
using namespace std::chrono;
|
|
||||||
startTime = high_resolution_clock::now();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
PerfSampler::~PerfSampler()
|
|
||||||
{
|
|
||||||
Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PerfSampler::Stop()
|
|
||||||
{
|
|
||||||
using namespace std::chrono;
|
|
||||||
auto end = high_resolution_clock::now();
|
|
||||||
auto durationInuSeconds =
|
|
||||||
duration_cast<nanoseconds>(end.time_since_epoch()).count() -
|
|
||||||
duration_cast<nanoseconds>(startTime.time_since_epoch()).count();
|
|
||||||
|
|
||||||
auto ms = durationInuSeconds * 0.001f;
|
|
||||||
|
|
||||||
// std::cout << "[" << name << "]" << "Took: " << durationInuSeconds << " us (" << ms << " ms)" << std::endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EngineInstrumentation::PerfomanceSamplerInit() {
|
||||||
|
|
||||||
|
spdlog::info("Initialize perf sampler");
|
||||||
|
/*EngineInstrumentation::frames = 0;
|
||||||
|
EngineInstrumentation::lastSampleTime = GetPrecisionTime();*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void EngineInstrumentation::Update() {
|
||||||
|
|
||||||
|
/* uint64_t MilliSecondsPast = GetPrecisionTime() -
|
||||||
|
EngineInstrumentation::lastSampleTime;
|
||||||
|
|
||||||
|
if (MilliSecondsPast >= 1000) {
|
||||||
|
|
||||||
|
EngineInstrumentation::frameTime = (float)1000 /
|
||||||
|
EngineInstrumentation::frames; EngineInstrumentation::FPS = frames;
|
||||||
|
EngineInstrumentation::frames = 0;
|
||||||
|
EngineInstrumentation::lastSampleTime =
|
||||||
|
GetPrecisionTime();
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void EngineInstrumentation::ShowStats() {
|
||||||
|
// ImGui::Begin("Statistics", false, ImGuiWindowFlags_NoCollapse |
|
||||||
|
//ImGuiWindowFlags_NoResize);
|
||||||
|
|
||||||
|
// ImGui::Text("Currently not available");
|
||||||
|
/* ImGui::Text("FPS: %i", ES.FPS);
|
||||||
|
ImGui::Text("Frame Time: %f", ES.frameTime);
|
||||||
|
ImGui::Text("Verts: %i", ES.verts);
|
||||||
|
ImGui::Text("Draw Calls: %i", ES.DC);
|
||||||
|
*/
|
||||||
|
// ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
PerfSampler::PerfSampler(const std::string &name) : name(name) {
|
||||||
|
using namespace std::chrono;
|
||||||
|
startTime = high_resolution_clock::now();
|
||||||
|
}
|
||||||
|
|
||||||
|
PerfSampler::~PerfSampler() { Stop(); }
|
||||||
|
|
||||||
|
void PerfSampler::Stop() {
|
||||||
|
using namespace std::chrono;
|
||||||
|
auto end = high_resolution_clock::now();
|
||||||
|
auto durationInuSeconds =
|
||||||
|
duration_cast<nanoseconds>(end.time_since_epoch()).count() -
|
||||||
|
duration_cast<nanoseconds>(startTime.time_since_epoch()).count();
|
||||||
|
|
||||||
|
auto ms = durationInuSeconds * 0.001f;
|
||||||
|
|
||||||
|
// std::cout << "[" << name << "]" << "Took: " << durationInuSeconds << "
|
||||||
|
//us (" << ms << " ms)" << std::endl;
|
||||||
|
}
|
||||||
|
} // namespace YoggieEngine
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
@echo off
|
|
||||||
echo Clean up ..
|
|
||||||
REM Does nothing for now
|
|
||||||
REM In the future we might want to remove certain files, if they exist, when re-generating the solution
|
|
||||||
echo Creating Solution for Yoggie engine...
|
|
||||||
|
|
||||||
.\tools\premake5.exe vs2022
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pause
|
|
33
libraries.cmake
Normal file
33
libraries.cmake
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
add_library( thirdparty_tools INTERFACE)
|
||||||
|
add_subdirectory(libs/ImGui)
|
||||||
|
target_link_directories(thirdparty_tools INTERFACE
|
||||||
|
"libs/glfw/build/src"
|
||||||
|
"libs/physx/physx/bin/win.x86_64.vc142.mt/release"
|
||||||
|
"libs/nativefiledialog/build/lib/Release/x64"
|
||||||
|
"libs/googletest/build/lib/Debug"
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(thirdparty_tools INTERFACE
|
||||||
|
nfd
|
||||||
|
YoggieEngine
|
||||||
|
)
|
||||||
|
target_include_directories(thirdparty_tools INTERFACE
|
||||||
|
"YoggieEngine/src"
|
||||||
|
"libs/spdlog/include"
|
||||||
|
"libs/assimp/include"
|
||||||
|
"libs/glm"
|
||||||
|
"libs/entt/src"
|
||||||
|
"libs/yaml-cpp/include"
|
||||||
|
"libs/mINI/src"
|
||||||
|
"libs/googletest/googletest/include"
|
||||||
|
"libs/glad/include"
|
||||||
|
"libs/glfw/include"
|
||||||
|
"libs/glew/include"
|
||||||
|
"libs/lua/include"
|
||||||
|
"libs/guizmo"
|
||||||
|
"libs/nativefiledialog/src/include"
|
||||||
|
"libs/ImGui"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
incfolder = {}
|
|
||||||
|
|
||||||
--Utils
|
|
||||||
incfolder["spdlog"] = "%{wks.location}/libs/spdlog/include"
|
|
||||||
incfolder["assimp"] = "%{wks.location}/libs/assimp/include"
|
|
||||||
incfolder["glm"] = "%{wks.location}/libs/glm"
|
|
||||||
incfolder["entt"] = "%{wks.location}/libs/entt/src"
|
|
||||||
incfolder["yamlcpp"] = "%{wks.location}/libs/yaml-cpp/include"
|
|
||||||
incfolder["mINI"] = "%{wks.location}/libs/mINI/src"
|
|
||||||
incfolder["GoogleTest"] = "%{wks.location}/libs/googletest/googletest/include"
|
|
||||||
|
|
||||||
-- Graphics
|
|
||||||
incfolder["glad"] = "%{wks.location}/libs/glad/include"
|
|
||||||
incfolder["glfw"] = "%{wks.location}/libs/glfw/include"
|
|
||||||
incfolder["glew"] = "%{wks.location}/libs/glew/include"
|
|
||||||
-- Physics
|
|
||||||
|
|
||||||
-- Scripting
|
|
||||||
incfolder["lua"] = "%{wks.location}/libs/lua/include"
|
|
||||||
|
|
||||||
|
|
||||||
-- Audio
|
|
||||||
incfolder["gorillaaudio"] = "%{wks.location}/libs/GorillaAudio/include"
|
|
||||||
|
|
||||||
-- Immediate Mode GUI
|
|
||||||
incfolder["imgui"] = "%{wks.location}/libs/ImGui"
|
|
||||||
incfolder["imguizmo"] = "%{wks.location}/libs/guizmo"
|
|
||||||
incfolder["nativefiledialog"] = "%{wks.location}/libs/nativefiledialog/src/include"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
staticlib = {}
|
|
||||||
|
|
||||||
staticlib["yoggie"] = "Yoggie/build/Debug"
|
|
||||||
staticlib["nativefiledialog"]= "%{wks.location}/libs/nativefiledialog/build/lib/Release/x64"
|
|
||||||
staticlib["GoogleTest"] = "%{wks.location}/libs/googletest/build/lib/Debug"
|
|
@ -1 +1 @@
|
|||||||
Subproject commit d666a1d4737739274449dbe0e8558454bba82ec4
|
Subproject commit c191faf0ba478e9c58a69c63306986a21ebfb6e4
|
44
premake5.lua
44
premake5.lua
@ -1,44 +0,0 @@
|
|||||||
include("libraries")
|
|
||||||
print("Using Premake version ", _PREMAKE_VERSION)
|
|
||||||
|
|
||||||
workspace "Yoggie GameEngine"
|
|
||||||
configurations { "Debug", "Release" }
|
|
||||||
|
|
||||||
language "C++"
|
|
||||||
cppdialect "C++17"
|
|
||||||
architecture "x86_64"
|
|
||||||
|
|
||||||
targetdir "%{wks.location}/libs/%{prj.name}/build/%{cfg.buildcfg}"
|
|
||||||
objdir "%{wks.location}/libs/%{prj.name}/build/%{cfg.buildcfg}/intermediates/"
|
|
||||||
|
|
||||||
startproject("Editor")
|
|
||||||
|
|
||||||
|
|
||||||
defines{
|
|
||||||
" _CRT_SECURE_NO_WARNINGS",
|
|
||||||
"GLFW_STATIC"
|
|
||||||
}
|
|
||||||
|
|
||||||
filter "configurations:Debug"
|
|
||||||
defines {"DEBUG", "_DEBUG"}
|
|
||||||
symbols "On"
|
|
||||||
|
|
||||||
filter "configurations:Release"
|
|
||||||
defines {"NDEBUG", "_DEBUG"}
|
|
||||||
optimize "On"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
include("./YoggieEngine")
|
|
||||||
include ("./Editor")
|
|
||||||
include ("./Tests")
|
|
||||||
|
|
||||||
group("Other")
|
|
||||||
include("./SandboxApp")
|
|
||||||
|
|
||||||
group("Libraries")
|
|
||||||
include('libs/ImGui')
|
|
||||||
include("libs/guizmo")
|
|
||||||
include("libs/yaml-cpp")
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user