adding materials, adding serialization for meshes and materials, random fixes

This commit is contained in:
Erris
2026-03-03 08:51:02 +01:00
parent b7e5ceb1d1
commit 4a624cfe70
16 changed files with 222 additions and 22 deletions

View File

@@ -1,7 +1,6 @@
#ifndef EDITOR_HPP
#define EDITOR_HPP
#include <X11/X.h>
#include <open_engine.hpp>
#include "open_engine/renderer/renderer3d.hpp"
@@ -92,9 +91,11 @@ namespace OpenEngine {
editor_camera = EditorCamera(30.0f, 1920.0f/1080.0f, 0.1f, 1000.0f);
// TODO: Add license
icons["play"] = Texture2D::Create("resources/textures/icons/play.png");
icons["stop"] = Texture2D::Create("resources/textures/icons/stop.png");
// =============================================
Entity cube = scene->CreateEntity("cube");
@@ -104,6 +105,7 @@ namespace OpenEngine {
cube.AddComponent<MeshComponent>(mesh);
// =============================================
Entity quad = scene->CreateEntity("quad");
quad.AddComponent<TransformComponent>();
quad.GetComponents<TransformComponent>().translation = {0, 0, 0};
@@ -112,6 +114,7 @@ namespace OpenEngine {
quad.AddComponent<MeshComponent>(quad_mesh);
// =============================================
Entity cube2 = scene->CreateEntity("cube2");
cube2.AddComponent<TransformComponent>();
cube2.GetComponents<TransformComponent>().translation = {2, 0, 0};
@@ -129,7 +132,6 @@ namespace OpenEngine {
}
*/
// TODO: Add file texture. Get free icons and add license
//icons["folder"] = Texture2D::Create("resources/textures/icons/folder.png");
/*
for (float i = 0; i < 200; i++) {
@@ -352,7 +354,7 @@ namespace OpenEngine {
bool was_focused = viewport_focused;
viewport_focused = ImGui::IsWindowFocused(ImGuiFocusedFlags_RootWindow);
viewport_hovered = ImGui::IsWindowHovered(ImGuiHoveredFlags_RootWindow);
Application::Get().GetImGuiLayer()->SetBlockEvents((!viewport_focused && !viewport_hovered) || ImGui::IsAnyItemActive());
Application::Get().GetImGuiLayer()->SetBlockEvents(ImGui::IsAnyItemActive());
if (viewport_focused && !was_focused)
editor_camera.ResetMousePosition();