WIP: Switching from Premake to CMake build system

This commit is contained in:
2025-06-15 20:55:15 +02:00
parent 7349c0eb16
commit 391fd5a8a8
19 changed files with 257 additions and 573 deletions

View 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")

View File

@ -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"
}

View File

@ -1,11 +1,10 @@
#pragma once
#include "YoggieEngine.h"
#include "imgui.h"
#include "../../YoggieEngine/src/BarinkEngine.h"
#include "../../YoggieEngine/src/Graphics/Memory/Framebuffer.h"
void CameraTool();
void ScriptingTool(char* code);
///void transformWindow(Transform& transform, std::string PanelName);
void materialWindow(Material& material, std::string PanelName);
void SceneExplorer(const std::string& PanelName);
void SceneView(Framebuffer& framebuffer);
void ScriptingTool(char *code);
/// void transformWindow(Transform& transform, std::string PanelName);
void materialWindow(Material &material, std::string PanelName);
void SceneExplorer(const std::string &PanelName);
void SceneView(Framebuffer &framebuffer);

View File

@ -1,123 +1,102 @@
#include <imgui.h>
#include "GUI.h"
#include "Util.h"
#include <entt/entt.hpp>
#include <imgui.h>
#include "../../YoggieEngine/src/BarinkEngine.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"
#include "YoggieEngine.h"
/*
* Define globals
*/
* Define globals
*/
Scene scene;
BarinkEngine::Renderable* renderable;
BarinkEngine::SceneObject* object;
BarinkEngine::Renderable *renderable;
BarinkEngine::SceneObject *object;
Entity cube;
/*
* Runs once at startup
* - USe to initialize the game/sandbox/demo
*/
* Runs once at startup
* - USe to initialize the game/sandbox/demo
*/
void Start() {
auto importer = BarinkEngine::ModelImporter();
auto importer = BarinkEngine::ModelImporter();
// Load in asset(S)
object = importer.Import("build/Debug/Models/Cube.obj");
renderable = object->renderable;
// Load in asset(S)
object = importer.Import("build/Debug/Models/Cube.obj");
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
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));
// Create a second cube
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
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 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();
// Create a light
auto AmbientLight = scene.AddEntity("AmbientLight");
AmbientLight.AddComponent<BarinkEngine::LightComponent>();
renderer.Prepare(scene);
}
/*
* Runs every frame
* - Meant for game logic ( non-physics related)
*/
void Update()
{
}
* Runs every frame
* - Use to draw Immediate mode graphics (Not meant for HUD's )
*/
void ImmediateGraphicsDraw() {
// Show internal BarinkEngine stats
EngineInstrumentation::ShowStats();
void Render()
{
renderer.Render(scene);
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();
}
/*
* Runs at the end of the program
* - Meant for cleanup
*/
void Stop()
{
}
* Runs every frame
* - Meant for game logic ( non-physics related)
*/
void Update() {}
void Render() { renderer.Render(scene); }
/*
* Runs at the end of the program
* - Meant for cleanup
*/
void Stop() {}

View File

@ -1,6 +1,6 @@
#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);