3d renderer
This commit is contained in:
@@ -1,14 +1,9 @@
|
||||
#ifndef EDITOR_HPP
|
||||
#define EDITOR_HPP
|
||||
|
||||
#include <filesystem>
|
||||
#include <open_engine.hpp>
|
||||
|
||||
#include "open_engine/application.hpp"
|
||||
#include "open_engine/logging.hpp"
|
||||
#include "open_engine/renderer/texture.hpp"
|
||||
#include "open_engine/scene/entity.hpp"
|
||||
#include "open_engine/scene/scene_serializer.hpp"
|
||||
#include "open_engine/scene/components.hpp"
|
||||
#include "panels/content_browser.hpp"
|
||||
#include "panels/scene_hierarchy.hpp"
|
||||
|
||||
@@ -19,6 +14,7 @@
|
||||
#include <glad/glad.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <ImGuizmo.h>
|
||||
#include <filesystem>
|
||||
#include <cstdint>
|
||||
#include <imgui.h>
|
||||
#include <vector>
|
||||
@@ -95,6 +91,34 @@ namespace OpenEngine {
|
||||
|
||||
icons["play"] = Texture2D::Create("resources/textures/icons/play.png");
|
||||
icons["stop"] = Texture2D::Create("resources/textures/icons/stop.png");
|
||||
|
||||
Entity cube = scene->CreateEntity("cube");
|
||||
|
||||
|
||||
cube.AddComponent<TransformComponent>();
|
||||
|
||||
Ref<Mesh> mesh = CreateCube(cube);
|
||||
|
||||
cube.AddComponent<MeshComponent>(mesh);
|
||||
|
||||
Entity cube2 = scene->CreateEntity("cube2");
|
||||
cube2.AddComponent<TransformComponent>();
|
||||
cube2.GetComponents<TransformComponent>().translation = {2, 0, 0};
|
||||
|
||||
Ref<Mesh> mesh2 = CreateCube(cube2);
|
||||
|
||||
cube2.AddComponent<MeshComponent>(mesh2);
|
||||
OE_DEBUG("cubes is like {} {}", (uint32_t)cube, (uint32_t)cube2);
|
||||
|
||||
/*
|
||||
auto view = scene->GetRegistry().view<TagComponent>();
|
||||
|
||||
for (auto& entity : view) {
|
||||
auto tag = view->get(entity);
|
||||
OE_DEBUG("entity: {}, tag: {}", (uint32_t)entity, tag.tag);
|
||||
}
|
||||
*/
|
||||
|
||||
// TODO: Add file texture. Get free icons and add license
|
||||
//icons["folder"] = Texture2D::Create("resources/textures/icons/folder.png");
|
||||
/*
|
||||
@@ -140,7 +164,7 @@ namespace OpenEngine {
|
||||
}
|
||||
|
||||
framebuffer->Bind();
|
||||
Renderer2D::ResetStats();
|
||||
//Renderer2D::ResetStats();
|
||||
RenderCommand::SetClearColor({0.11f, 0.11f, 0.15f, 1.0f});
|
||||
RenderCommand::Clear();
|
||||
framebuffer->ClearBufferI(1, -1);
|
||||
@@ -318,7 +342,7 @@ namespace OpenEngine {
|
||||
|
||||
void DrawStats()
|
||||
{
|
||||
auto stats = Renderer2D::GetStats();
|
||||
//auto stats = Renderer2D::GetStats();
|
||||
static float time = 0;
|
||||
|
||||
time += Time::DeltaTime();
|
||||
@@ -330,17 +354,17 @@ namespace OpenEngine {
|
||||
ImGui::Begin("Statistics");
|
||||
ImGui::SeparatorText("Performance");
|
||||
ImGui::Text("FPS: %0.0f", 1 / Time::DeltaTime());
|
||||
ImGui::Text("Renderer2D:");
|
||||
ImGui::Text("\t\tDraw calls: %d", stats.draw_calls);
|
||||
ImGui::Text("\t\tQuad count: %d", stats.quad_count);
|
||||
ImGui::Text("\t\tVertices count: %d", stats.GetTotalVertexCount());
|
||||
ImGui::Text("\t\tIndices count: %d", stats.GetTotalIndexCount());
|
||||
if (selected_entity) {
|
||||
ImGui::SeparatorText("Entities");
|
||||
ImGui::Text("Selected entity:");
|
||||
ImGui::Text("\t\tname: %s", selected_entity.GetComponents<TagComponent>().tag.c_str());
|
||||
ImGui::Text("\t\tid: %d", (uint32_t)selected_entity);
|
||||
}
|
||||
//ImGui::Text("Renderer2D:");
|
||||
//ImGui::Text("\t\tDraw calls: %d", stats.draw_calls);
|
||||
//ImGui::Text("\t\tQuad count: %d", stats.quad_count);
|
||||
//ImGui::Text("\t\tVertices count: %d", stats.GetTotalVertexCount());
|
||||
//ImGui::Text("\t\tIndices count: %d", stats.GetTotalIndexCount());
|
||||
//if (selected_entity) {
|
||||
// ImGui::SeparatorText("Entities");
|
||||
// ImGui::Text("Selected entity:");
|
||||
// ImGui::Text("\t\tname: %s", selected_entity.GetComponents<TagComponent>().tag.c_str());
|
||||
// ImGui::Text("\t\tid: %d", (uint32_t)selected_entity);
|
||||
//}
|
||||
ImGui::End();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user