Compare commits
No commits in common. "c62f3615d493a734e2567433bcc0da5a2d6c1634" and "f0984b611786cfeb23422d7c4a7cbf1a626ee319" have entirely different histories.
c62f3615d4
...
f0984b6117
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -31,6 +31,3 @@
|
|||||||
[submodule "libs/entt"]
|
[submodule "libs/entt"]
|
||||||
path = libs/entt
|
path = libs/entt
|
||||||
url = https://github.com/skypjack/entt.git
|
url = https://github.com/skypjack/entt.git
|
||||||
[submodule "libs/guizmo"]
|
|
||||||
path = libs/guizmo
|
|
||||||
url = https://github.com/CedricGuillemet/ImGuizmo.git
|
|
||||||
|
@ -60,4 +60,3 @@ project "BarinkEngine"
|
|||||||
}
|
}
|
||||||
|
|
||||||
include('../ImGui')
|
include('../ImGui')
|
||||||
include("../ImGuizmo")
|
|
@ -1,19 +1,18 @@
|
|||||||
#include "BarinkEngine.h"
|
#include "BarinkEngine.h"
|
||||||
|
|
||||||
extern EngineStatistics ES;
|
EngineStatistics ES;
|
||||||
BarinkEngine::Renderer renderer;
|
BarinkEngine::Renderer renderer;
|
||||||
const unsigned int MS_PER_UPDATE = 2;
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
// Setup performance sampler
|
// Setup performance sampler
|
||||||
EngineInstrumentation::PerfomanceSamplerInit();
|
PerfomanceSamplerInit();
|
||||||
|
|
||||||
// Startup services
|
// Startup services
|
||||||
BarinkWindow MainWindow = BarinkWindow(1200, 700);
|
BarinkWindow MainWindow = BarinkWindow(800, 600);
|
||||||
|
|
||||||
renderer = BarinkEngine::Renderer();
|
renderer = BarinkEngine::Renderer();
|
||||||
InputSystem = BarinkEngine::InputManager();
|
InputSystem = BarinkEngine::InputManager();
|
||||||
|
ES = EngineStatistics();
|
||||||
|
|
||||||
ES = EngineStatistics{};
|
|
||||||
InputSystem.attach(&MainWindow);
|
InputSystem.attach(&MainWindow);
|
||||||
|
|
||||||
GUIManager GUISystem = GUIManager(&MainWindow);
|
GUIManager GUISystem = GUIManager(&MainWindow);
|
||||||
@ -21,65 +20,26 @@ int main(int argc, char* argv[]) {
|
|||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
// First call to setup game
|
// First call to setup game
|
||||||
{
|
|
||||||
PerfSampler("Start");
|
|
||||||
Start();
|
Start();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
double previous = glfwGetTime();
|
|
||||||
double lag = 0.0;
|
|
||||||
|
|
||||||
// Runtime loop
|
// Runtime loop
|
||||||
while (!MainWindow.WindowShouldClose())
|
while (!MainWindow.WindowShouldClose()) {
|
||||||
{
|
SamplePerformance();
|
||||||
|
|
||||||
double current = glfwGetTime();
|
|
||||||
double elapsed = current - previous;
|
|
||||||
previous = current;
|
|
||||||
lag += elapsed;
|
|
||||||
|
|
||||||
//EngineInstrumentation::Update(); // Todo this does nothing right now and is therefor disabled
|
|
||||||
|
|
||||||
// Execute main logic
|
// Execute main logic
|
||||||
{
|
|
||||||
PerfSampler("PollEvents");
|
|
||||||
InputSystem.PollEvents();
|
InputSystem.PollEvents();
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
PerfSampler("Update");
|
|
||||||
while (lag >= MS_PER_UPDATE) {
|
|
||||||
Update();
|
Update();
|
||||||
lag -= MS_PER_UPDATE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
PerfSampler("Render");
|
|
||||||
Render();
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
PerfSampler("GUI-Render");
|
|
||||||
GUISystem.Render();
|
GUISystem.Render();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
PerfSampler("BufferSwap");
|
|
||||||
MainWindow.SwapBuffers();
|
MainWindow.SwapBuffers();
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shutdown game
|
// Shutdown game
|
||||||
{
|
|
||||||
PerfSampler("Stop");
|
|
||||||
Stop();
|
Stop();
|
||||||
}
|
|
||||||
|
|
||||||
// Shutdown Services
|
// Shutdown Services
|
||||||
|
|
||||||
|
@ -20,6 +20,5 @@
|
|||||||
extern BarinkEngine::Renderer renderer;
|
extern BarinkEngine::Renderer renderer;
|
||||||
extern void Start();
|
extern void Start();
|
||||||
extern void Update();
|
extern void Update();
|
||||||
extern void Render();
|
|
||||||
extern void ImmediateGraphicsDraw();
|
extern void ImmediateGraphicsDraw();
|
||||||
extern void Stop();
|
extern void Stop();
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "backends/imgui_impl_opengl3.h"
|
#include "backends/imgui_impl_opengl3.h"
|
||||||
#include <backends/imgui_impl_glfw.h>
|
#include <backends/imgui_impl_glfw.h>
|
||||||
#include "../../libs/guizmo/ImGuizmo.h"
|
|
||||||
#include "../BarinkEngine.h"
|
#include "../BarinkEngine.h"
|
||||||
|
|
||||||
GUIManager::GUIManager(BarinkWindow* window)
|
GUIManager::GUIManager(BarinkWindow* window)
|
||||||
@ -36,18 +35,9 @@ void GUIManager::Render()
|
|||||||
|
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
ImGuizmo::SetOrthographic(true);
|
|
||||||
ImGuizmo::BeginFrame();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ImmediateGraphicsDraw();
|
ImmediateGraphicsDraw();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ImGui::EndFrame();
|
|
||||||
|
|
||||||
|
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||||
|
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
#include "Buffer.h"
|
#include "Buffer.h"
|
||||||
|
|
||||||
|
|
||||||
int Buffer::getBufferID() {
|
int GpuBuffer::getBufferID() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::createBuffer() {
|
void GpuBuffer::createBuffer() {
|
||||||
glGenBuffers(1, (GLuint*) &id);
|
glGenBuffers(1, (GLuint*) &id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::setBufferData(void* data, size_t dataSize, bool elementBuffer = false ) {
|
void GpuBuffer::setBufferData(void* data, size_t dataSize, bool elementBuffer = false ) {
|
||||||
|
|
||||||
if (elementBuffer) {
|
if (elementBuffer) {
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, dataSize, data, GL_STATIC_DRAW);
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, dataSize, data, GL_STATIC_DRAW);
|
||||||
@ -21,7 +21,7 @@ void Buffer::setBufferData(void* data, size_t dataSize, bool elementBuffer = fal
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::Bind(bool elementBuffer = false ) {
|
void GpuBuffer::Bind(bool elementBuffer = false ) {
|
||||||
if (elementBuffer) {
|
if (elementBuffer) {
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, id);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, id);
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ void Buffer::Bind(bool elementBuffer = false ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::Unbind(bool elementBuffer = false) {
|
void GpuBuffer::Unbind(bool elementBuffer = false) {
|
||||||
if (elementBuffer) {
|
if (elementBuffer) {
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||||
}
|
}
|
||||||
@ -42,6 +42,6 @@ void Buffer::Unbind(bool elementBuffer = false) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::Delete() {
|
void GpuBuffer::Delete() {
|
||||||
glDeleteBuffers(1, (GLuint*) &id);
|
glDeleteBuffers(1, (GLuint*) &id);
|
||||||
}
|
}
|
@ -1,7 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
class Buffer {
|
class GpuBuffer {
|
||||||
|
private:
|
||||||
|
unsigned int id;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
int getBufferID();
|
int getBufferID();
|
||||||
@ -15,7 +16,4 @@ public:
|
|||||||
|
|
||||||
void Delete();
|
void Delete();
|
||||||
|
|
||||||
private:
|
|
||||||
unsigned int id;
|
|
||||||
|
|
||||||
};
|
};
|
@ -9,44 +9,24 @@ Framebuffer::Framebuffer()
|
|||||||
// Create a colour texture!
|
// Create a colour texture!
|
||||||
glGenTextures(1, &ColourAttachment);
|
glGenTextures(1, &ColourAttachment);
|
||||||
glBindTexture(GL_TEXTURE_2D, ColourAttachment);
|
glBindTexture(GL_TEXTURE_2D, ColourAttachment);
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 1, GL_RGB, 800, 600, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 800, 600, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
|
|
||||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, ColourAttachment, 0);
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, ColourAttachment, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Create a depth buffer
|
|
||||||
glGenTextures(1, &DepthAttachment);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, DepthAttachment);
|
|
||||||
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, 800, 600, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL);
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, DepthAttachment, 0);
|
// Create a depth buffer
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* // Render buffer
|
|
||||||
glGenRenderbuffers(1, &DepthAttachment);
|
glGenRenderbuffers(1, &DepthAttachment);
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, DepthAttachment);
|
glBindRenderbuffer(GL_RENDERBUFFER, DepthAttachment);
|
||||||
|
|
||||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 800, 600);
|
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 800, 600);
|
||||||
|
|
||||||
|
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
|
||||||
|
|
||||||
glFramebufferRenderbuffer(GL_RENDERBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, DepthAttachment);
|
glFramebufferRenderbuffer(GL_RENDERBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, DepthAttachment);
|
||||||
|
|
||||||
*/
|
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -59,8 +39,6 @@ Framebuffer::Framebuffer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Framebuffer::~Framebuffer()
|
Framebuffer::~Framebuffer()
|
||||||
|
@ -8,14 +8,13 @@ public:
|
|||||||
Framebuffer();
|
Framebuffer();
|
||||||
~Framebuffer();
|
~Framebuffer();
|
||||||
|
|
||||||
GLuint GetId() { return Id; }
|
unsigned int GetId() { return Id; }
|
||||||
GLuint GetColourAttachment() { return ColourAttachment; }
|
unsigned int GetColourAttachment() { return ColourAttachment; }
|
||||||
GLuint GetDepthAttachment() { return DepthAttachment; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GLuint Id = 0;
|
unsigned int Id = 0;
|
||||||
GLuint ColourAttachment = 0;
|
unsigned int ColourAttachment = 0;
|
||||||
GLuint DepthAttachment = 0;
|
unsigned int DepthAttachment = 0;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
@ -1,31 +0,0 @@
|
|||||||
#include "UniformBuffer.h"
|
|
||||||
#include <glad/glad.h>
|
|
||||||
UniformBuffer::UniformBuffer(unsigned int size)
|
|
||||||
{
|
|
||||||
glGenBuffers(1, &Id );
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, Id);
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, size, nullptr, GL_DYNAMIC_DRAW);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
UniformBuffer::~UniformBuffer()
|
|
||||||
{
|
|
||||||
glDeleteBuffers(1, &Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UniformBuffer::setData( unsigned int offset , unsigned int size , void* data)
|
|
||||||
{
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, Id);
|
|
||||||
glBufferSubData(GL_ARRAY_BUFFER, offset , size, data);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UniformBuffer::setDescriptor(unsigned int index, unsigned int size , unsigned int stride, void* pointer)
|
|
||||||
{
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, Id);
|
|
||||||
glVertexAttribPointer(index, size, GL_FLOAT, GL_FALSE, stride, pointer);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
class UniformBuffer {
|
|
||||||
public:
|
|
||||||
|
|
||||||
UniformBuffer (unsigned int size);
|
|
||||||
~UniformBuffer();
|
|
||||||
void setData(unsigned int offset, unsigned int size, void* data);
|
|
||||||
void setDescriptor(unsigned int index, unsigned int size, unsigned int stride, void* pointer);
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
unsigned int Id;
|
|
||||||
|
|
||||||
};
|
|
@ -22,8 +22,8 @@ private:
|
|||||||
std::vector<unsigned int > indices;
|
std::vector<unsigned int > indices;
|
||||||
|
|
||||||
|
|
||||||
Buffer vertexBuffer;
|
GpuBuffer vertexBuffer;
|
||||||
Buffer elementBuffer;
|
GpuBuffer elementBuffer;
|
||||||
|
|
||||||
VertexArray VAO;
|
VertexArray VAO;
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ void BarinkEngine::Renderer::Prepare(Scene& scene ) {
|
|||||||
auto group = scene.getReg().view<BarinkEngine::Render3DComponent>();
|
auto group = scene.getReg().view<BarinkEngine::Render3DComponent>();
|
||||||
group.each([](auto enity, BarinkEngine::Render3DComponent& renderComponent) {
|
group.each([](auto enity, BarinkEngine::Render3DComponent& renderComponent) {
|
||||||
VertexArray va = VertexArray();
|
VertexArray va = VertexArray();
|
||||||
Buffer vertexBuffer = Buffer();
|
GpuBuffer vertexBuffer = GpuBuffer();
|
||||||
Buffer elementBuffer = Buffer();
|
GpuBuffer elementBuffer = GpuBuffer();
|
||||||
|
|
||||||
va.Create();
|
va.Create();
|
||||||
va.Bind();
|
va.Bind();
|
||||||
@ -45,8 +45,6 @@ void BarinkEngine::Renderer::Prepare(Scene& scene ) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void BarinkEngine::Renderer::Render(Scene& scene)
|
void BarinkEngine::Renderer::Render(Scene& scene)
|
||||||
{
|
{
|
||||||
auto group = scene.getReg().view<TransformComponent, Render3DComponent>();
|
auto group = scene.getReg().view<TransformComponent, Render3DComponent>();
|
||||||
@ -68,7 +66,7 @@ void BarinkEngine::Renderer::Render(Scene& scene)
|
|||||||
renderComponent.shader.setUniformMat4("V", cam.GetViewMatrix());
|
renderComponent.shader.setUniformMat4("V", cam.GetViewMatrix());
|
||||||
renderComponent.shader.setUniformMat4("P", projection);
|
renderComponent.shader.setUniformMat4("P", projection);
|
||||||
|
|
||||||
//std::cout << "Draw " << renderComponent.mesh.elements.size() << " elements" << std::endl;
|
|
||||||
glDrawElements(GL_TRIANGLES, static_cast<unsigned int>(renderComponent.mesh.elements.size()) ,
|
glDrawElements(GL_TRIANGLES, static_cast<unsigned int>(renderComponent.mesh.elements.size()) ,
|
||||||
GL_UNSIGNED_INT, NULL);
|
GL_UNSIGNED_INT, NULL);
|
||||||
|
|
||||||
@ -77,17 +75,5 @@ void BarinkEngine::Renderer::Render(Scene& scene)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarinkEngine::Renderer::Render(Framebuffer& framebuffer, Scene& scene)
|
void Render(Framebuffer& framebuffer)
|
||||||
{
|
{}
|
||||||
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer.GetId());
|
|
||||||
|
|
||||||
glClearColor(.5f, .0f, .5f, 1.0f);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
||||||
|
|
||||||
Render(scene);
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -22,6 +22,6 @@ namespace BarinkEngine {
|
|||||||
void Prepare(Scene& scene);
|
void Prepare(Scene& scene);
|
||||||
void Render(Scene& scene );
|
void Render(Scene& scene );
|
||||||
|
|
||||||
void Render(Framebuffer& framebuffer, Scene& scene);
|
void Render(Framebuffer& framebuffer);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
#include "PerfCounter.h"
|
|
||||||
#include <imgui.h>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
EngineStatistics ES;
|
|
||||||
|
|
||||||
uint64_t EngineInstrumentation::GetPrecisionTime() {
|
|
||||||
using namespace std::chrono; // REMINDER: This is kinda ugly but safes line width
|
|
||||||
return duration_cast<milliseconds>(high_resolution_clock::now().time_since_epoch()).count();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EngineInstrumentation::PerfomanceSamplerInit() {
|
|
||||||
ES.frames = 0;
|
|
||||||
//EngineInstrumentation::lastSampleTime = GetPrecisionTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void EngineInstrumentation::Update() {
|
|
||||||
/*
|
|
||||||
uint64_t MilliSecondsPast = GetPrecisionTime() - EngineInstrumentation::lastSampleTime;
|
|
||||||
|
|
||||||
if (MilliSecondsPast >= 1000) {
|
|
||||||
|
|
||||||
ES.frameTime = (float)1000 / ES.frames;
|
|
||||||
ES.FPS = ES.frames;
|
|
||||||
ES.frames = 0;
|
|
||||||
//EngineInstrumentation::lastSampleTime = GetPrecisionTime();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void EngineInstrumentation::ShowStats() {
|
|
||||||
ImGui::Begin("Statistics", false, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize);
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
@ -1,37 +1,52 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
struct EngineStatistics {
|
#include <imgui.h>
|
||||||
|
|
||||||
|
struct EngineStatistics {
|
||||||
float frameTime;
|
float frameTime;
|
||||||
uint32_t verts;
|
uint32_t verts;
|
||||||
uint32_t DC;
|
uint32_t DC;
|
||||||
|
|
||||||
int64_t frames;
|
long long lastSampleTime;
|
||||||
int64_t FPS;
|
long long frames;
|
||||||
|
long long FPS;
|
||||||
};
|
};
|
||||||
|
extern EngineStatistics ES;
|
||||||
|
|
||||||
class EngineInstrumentation {
|
inline void PerfomanceSamplerInit(){
|
||||||
public:
|
|
||||||
|
|
||||||
//static int64_t lastSampleTime;
|
ES.frames = 0;
|
||||||
|
ES.lastSampleTime = 0;
|
||||||
|
ES.lastSampleTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count();
|
||||||
|
|
||||||
static uint64_t GetPrecisionTime();
|
}
|
||||||
static void PerfomanceSamplerInit();
|
|
||||||
|
|
||||||
static void Update();
|
inline void SamplePerformance(void) {
|
||||||
static void ShowStats();
|
ES.frames++;
|
||||||
|
ES.DC = 0;
|
||||||
|
ES.verts = 0;
|
||||||
|
unsigned long long now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count();
|
||||||
|
unsigned long long MilliSecondsPast = now - ES.lastSampleTime;
|
||||||
|
if (MilliSecondsPast >= 1000) {
|
||||||
|
|
||||||
};
|
ES.frameTime = (float)1000 / ES.frames;
|
||||||
|
ES.FPS = ES.frames;
|
||||||
|
ES.frames = 0;
|
||||||
|
ES.lastSampleTime = now;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class PerfSampler {
|
|
||||||
public:
|
|
||||||
|
|
||||||
PerfSampler(const std::string& name);
|
|
||||||
~PerfSampler();
|
inline void ShowStats() {
|
||||||
void Stop();
|
ImGui::Begin("Statistics", false, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize );
|
||||||
private:
|
|
||||||
const std::string& name;
|
ImGui::Text("FPS: %i", ES.FPS);
|
||||||
std::chrono::time_point<std::chrono::high_resolution_clock> startTime;
|
ImGui::Text("Frame Time: %f", ES.frameTime);
|
||||||
};
|
ImGui::Text("Verts: %i", ES.verts);
|
||||||
|
ImGui::Text("Draw Calls: %i", ES.DC);
|
||||||
|
|
||||||
|
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
|
}
|
@ -3,7 +3,6 @@
|
|||||||
#include "Components.h"
|
#include "Components.h"
|
||||||
Scene::Scene()
|
Scene::Scene()
|
||||||
{
|
{
|
||||||
m_registry = entt::basic_registry();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Scene::~Scene()
|
Scene::~Scene()
|
||||||
|
@ -4,8 +4,7 @@ kind "ConsoleApp"
|
|||||||
buildmessage "Building editor ..."
|
buildmessage "Building editor ..."
|
||||||
|
|
||||||
links{
|
links{
|
||||||
"BarinkEngine",
|
"BarinkEngine"
|
||||||
"ImGuizmo"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
includedirs{
|
includedirs{
|
||||||
@ -25,9 +24,7 @@ includedirs{
|
|||||||
"./../libs/glew/include",
|
"./../libs/glew/include",
|
||||||
"./../libs/glm",
|
"./../libs/glm",
|
||||||
"./../libs/ImGui",
|
"./../libs/ImGui",
|
||||||
"./../libs/guizmo",
|
|
||||||
|
|
||||||
"./../libs/entt/src",
|
|
||||||
|
|
||||||
"./include"
|
"./include"
|
||||||
|
|
||||||
@ -41,4 +38,3 @@ files {
|
|||||||
"./include/*.h",
|
"./include/*.h",
|
||||||
"./src/*.cpp"
|
"./src/*.cpp"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,79 +1,83 @@
|
|||||||
#include "../../BarinkEngine/src/BarinkEngine.h"
|
#include "../../BarinkEngine/src/BarinkEngine.h"
|
||||||
|
#include "../../BarinkEngine/src/Scene/SceneManager.h"
|
||||||
|
#include "../../BarinkEngine/src/Scene/SceneNodeTypes.h"
|
||||||
#include "../../BarinkEngine/src/AssetManager/ModelImporter.h"
|
#include "../../BarinkEngine/src/AssetManager/ModelImporter.h"
|
||||||
#include "../../BarinkEngine/src/Graphics/Memory/Framebuffer.h"
|
#include "../../BarinkEngine/src/Graphics/Framebuffer.h"
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
#include "../../BarinkEngine/src/PerfCounter.cpp"
|
|
||||||
#include "../../BarinkEngine/src/Scene/Entity.h"
|
|
||||||
#include "stb_image.h"
|
|
||||||
#include "../../libs/guizmo/ImGuizmo.h"
|
|
||||||
#include "../../libs/glm/glm/gtc/type_ptr.hpp"
|
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
|
||||||
#include "widgets/widgets.h"
|
|
||||||
/*
|
/*
|
||||||
* Define globals
|
* Define globals
|
||||||
*/
|
*/
|
||||||
|
Shader* shader;
|
||||||
|
|
||||||
|
char* code = new char[254];
|
||||||
|
|
||||||
|
const std::string vertexShaderSource = "build/Debug/test.vs";
|
||||||
|
const std::string fragmentShaderSource = "build/Debug/test.fs";
|
||||||
|
|
||||||
|
BarinkEngine::ModelImporter* MI = new BarinkEngine::ModelImporter();
|
||||||
Framebuffer* framebuffer;
|
Framebuffer* framebuffer;
|
||||||
Scene Level1;
|
Scene* Level1;
|
||||||
BarinkEngine::SceneObject* Model;
|
BarinkEngine::SceneObject* 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 io = ImGui::GetIO();
|
|
||||||
io.Fonts->AddFontFromFileTTF("build/Debug/Fonts/Roboto-Regular.ttf", 18);
|
|
||||||
framebuffer = new Framebuffer();
|
|
||||||
// Build a basic test scene
|
// Build a basic test scene
|
||||||
// NOTE: This will later be done through an editor
|
// NOTE: This will later be done through an editor
|
||||||
|
|
||||||
// Create a level and load it as the current level
|
// Create a level and load it as the current level
|
||||||
auto importer = BarinkEngine::ModelImporter();
|
std::string levelName("Test Level");
|
||||||
|
Level1 = SceneManager::CreateScene(levelName);
|
||||||
|
SceneManager::LoadScene(*Level1);
|
||||||
|
|
||||||
// Create a cube
|
shader = new Shader(vertexShaderSource, fragmentShaderSource);
|
||||||
Model = importer.Import("build/Debug/Models/Cube.obj");
|
|
||||||
cube = Level1.AddEntity("cube");
|
|
||||||
auto& render3DComponent = cube.AddComponent<BarinkEngine::Render3DComponent>();
|
|
||||||
render3DComponent.mesh = *(Model->renderable->mesh);
|
|
||||||
|
|
||||||
cube.GetComponent<BarinkEngine::TransformComponent>().transform = glm::translate(glm::mat4(1.0f), glm::vec3(1.0f, 0.0f, 5.0f));
|
// Create a cube node
|
||||||
renderer.Prepare(Level1);
|
|
||||||
|
|
||||||
|
cube = MI->Import("build/Debug/Models/cube.obj");
|
||||||
|
cube->renderable->material = new Material(*shader);
|
||||||
|
cube->renderable->material->Color = glm::vec3(1.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
// create an ambient light source
|
// What is in cube now ??
|
||||||
auto AmbientLight = Level1.AddEntity("AmbientLight");
|
std::cout << "mesh vertices: " << cube->renderable->mesh->vertices.size() << std::endl;
|
||||||
AmbientLight.AddComponent<BarinkEngine::LightComponent>();
|
std::cout << "mesh elements: " << cube->renderable->mesh->elements.size() << std::endl;
|
||||||
|
|
||||||
|
Level1->GetRoot().addChild(*cube);
|
||||||
|
|
||||||
|
memset(code, '\0', 254);
|
||||||
|
framebuffer = new Framebuffer();
|
||||||
|
|
||||||
std::cout << "Colour attachment id; " << framebuffer->GetColourAttachment() << std::endl;
|
std::cout << "Colour attachment id; " << framebuffer->GetColourAttachment() << std::endl;
|
||||||
|
// TODO: Move to runtime/ Engine
|
||||||
|
// NOTE: Submits should later be done through walking the sceneTree
|
||||||
|
|
||||||
renderer.Prepare(Level1);
|
renderer.Submit(cube->renderable);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Runs every frame
|
* Runs every frame
|
||||||
* - Use to draw Immediate mode graphics (Not meant for HUD's )
|
* - Use to draw Immediate mode graphics (Not meant for HUD's )
|
||||||
*/
|
*/
|
||||||
void ImmediateGraphicsDraw()
|
void ImmediateGraphicsDraw()
|
||||||
{ ImGui::DockSpaceOverViewport(ImGui::GetMainViewport());
|
{
|
||||||
|
|
||||||
|
ImGui::DockSpaceOverViewport(ImGui::GetMainViewport());
|
||||||
|
|
||||||
// Show a menu bar
|
// Show a menu bar
|
||||||
ImGui::BeginMainMenuBar();
|
ImGui::BeginMainMenuBar();
|
||||||
|
|
||||||
if (ImGui::BeginMenu("Application")) {
|
if (ImGui::BeginMenu("Application")) {
|
||||||
|
|
||||||
if (ImGui::MenuItem("Preferences")) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::MenuItem("Exit")) {
|
if (ImGui::MenuItem("Exit")) {
|
||||||
// TODO: Exit application
|
// TODO: Exit application
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,43 +85,45 @@ void ImmediateGraphicsDraw()
|
|||||||
|
|
||||||
|
|
||||||
// Show internal BarinkEngine stats
|
// Show internal BarinkEngine stats
|
||||||
//ShowStats();
|
ShowStats();
|
||||||
Viewport(*framebuffer , Level1);
|
|
||||||
Inspector();
|
|
||||||
SceneExplorer(Level1);
|
|
||||||
Settings();
|
|
||||||
AssetsFinder();
|
|
||||||
Console();
|
|
||||||
|
|
||||||
|
ImGui::Begin("Viewport");
|
||||||
|
ImGui::Image((void*)(intptr_t)framebuffer->GetColourAttachment(), ImVec2{ 800,600 });
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
|
static float Zoom = 90;
|
||||||
|
static glm::vec3 Position = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||||
|
static glm::vec3 Rotation = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
|
ImGui::Begin("Camera");
|
||||||
|
ImGui::SliderFloat("Zoom", &Zoom, 10, 190);
|
||||||
|
ImGui::InputFloat3("Position:", &Position[0]);
|
||||||
|
|
||||||
ImGui::ShowMetricsWindow();
|
ImGui::InputFloat3("Rotation:", &Rotation[0]);
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
|
ImGui::Begin("Scripting");
|
||||||
|
ImGui::Text("Lua Code");
|
||||||
|
ImGui::InputTextMultiline("##", code, 255);
|
||||||
|
bool runCode = ImGui::Button("Run");
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
|
ImGui::Begin("Scene Explorer");
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Render()
|
|
||||||
{
|
|
||||||
renderer.Render( *framebuffer, Level1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Runs every frame
|
* Runs every frame
|
||||||
* - Meant for game logic ( non-physics related)
|
* - Meant for game logic ( non-physics related)
|
||||||
*/
|
*/
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
// glBindFramebuffer(GL_FRAMEBUFFER, framebuffer->GetId());
|
||||||
|
|
||||||
}
|
renderer.Render(*framebuffer);
|
||||||
|
|
||||||
/*
|
|
||||||
* Runs every physics update
|
|
||||||
*/
|
|
||||||
void fixed_update()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
// glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -127,4 +133,6 @@ void fixed_update()
|
|||||||
void Stop()
|
void Stop()
|
||||||
{
|
{
|
||||||
delete framebuffer;
|
delete framebuffer;
|
||||||
|
delete MI;
|
||||||
|
delete shader;
|
||||||
}
|
}
|
@ -1,79 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <glm/glm.hpp>
|
|
||||||
#include <imgui.h>
|
|
||||||
|
|
||||||
inline void Inspector () {
|
|
||||||
ImGui::Begin("Inspector");
|
|
||||||
static float Zoom = 90;
|
|
||||||
static glm::vec3 Position = glm::vec3(0.0f, 0.0f, 0.0f);
|
|
||||||
static glm::vec3 Rotation = glm::vec3(0.0f, 0.0f, 0.0f);
|
|
||||||
|
|
||||||
ImGui::BeginChild("Camera");
|
|
||||||
|
|
||||||
ImGui::SliderFloat("Zoom", &Zoom, 10, 190);
|
|
||||||
ImGui::InputFloat3("Position:", &Position[0]);
|
|
||||||
|
|
||||||
ImGui::InputFloat3("Rotation:", &Rotation[0]);
|
|
||||||
ImGui::EndChild();
|
|
||||||
|
|
||||||
|
|
||||||
ImGui::BeginChild("Scripting");
|
|
||||||
ImGui::Text("Hello world!");
|
|
||||||
ImGui::EndChild();
|
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void SceneExplorer(Scene& scene)
|
|
||||||
{
|
|
||||||
|
|
||||||
ImGui::Begin("Scene Explorer");
|
|
||||||
|
|
||||||
scene.getReg().each([&](auto entity) {
|
|
||||||
auto id = scene.getReg().get<BarinkEngine::IdentifierComponent>(entity);
|
|
||||||
ImGui::LabelText("##myObject", "%s", id.name.c_str());
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void Viewport(Framebuffer& framebuffer , Scene& scene ) {
|
|
||||||
|
|
||||||
unsigned int viewportWindowFlags = ImGuiWindowFlags_NoTitleBar
|
|
||||||
| ImGuiWindowFlags_NoDecoration
|
|
||||||
| ImGuiWindowFlags_NoScrollbar
|
|
||||||
| ImGuiWindowFlags_NoMove
|
|
||||||
| ImGuiWindowFlags_NoCollapse;
|
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2{ 0,0 });
|
|
||||||
ImGui::Begin("Viewport", false, viewportWindowFlags );
|
|
||||||
ImGui::Image((void*)(intptr_t)framebuffer.GetColourAttachment(), ImVec2{ (float)800,(float)600 });
|
|
||||||
|
|
||||||
ImGuizmo::SetDrawlist();
|
|
||||||
ImGuizmo::SetRect(ImGui::GetWindowPos().x, ImGui::GetWindowPos().y, ImGui::GetWindowWidth(), ImGui::GetWindowHeight());
|
|
||||||
ImGuizmo::Enable(true);
|
|
||||||
auto cam = glm::mat4(1.0f);
|
|
||||||
//ImGuizmo::Manipulate(glm::value_ptr(static_cam), glm::value_ptr(static_projection), ImGuizmo::TRANSLATE, ImGuizmo::WORLD, glm::value_ptr(trans));
|
|
||||||
ImGuizmo::ViewManipulate(glm::value_ptr(cam), 8.0f, ImVec2{ 0.0f,0.0f }, ImVec2{ 128.0f,128.0f }, 0x10101010);
|
|
||||||
ImGui::End();
|
|
||||||
ImGui::PopStyleVar();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void Settings() {
|
|
||||||
ImGui::Begin("Settings");
|
|
||||||
ImGui::LabelText("##title-settings", "Fine grain control over your engine... ");
|
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void Console() {
|
|
||||||
ImGui::Begin("Console", false );
|
|
||||||
ImGui::Dummy(ImVec2{ 128, 128 });
|
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void AssetsFinder() {
|
|
||||||
ImGui::Begin("Asset-Finder", false );
|
|
||||||
ImGui::Dummy(ImVec2{ 128, 128 });
|
|
||||||
ImGui::End();
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
project "ImGuizmo"
|
|
||||||
kind "StaticLib"
|
|
||||||
|
|
||||||
includedirs {
|
|
||||||
"../libs/glfw/include",
|
|
||||||
"../libs/ImGui",
|
|
||||||
"../libs/guizmo"
|
|
||||||
}
|
|
||||||
|
|
||||||
files {
|
|
||||||
"../libs/guizmo/*.cpp",
|
|
||||||
}
|
|
||||||
|
|
||||||
libdirs{
|
|
||||||
"../libs/ImGui",
|
|
||||||
"../libs/glad"
|
|
||||||
}
|
|
||||||
|
|
||||||
include("../ImGui")
|
|
@ -7,7 +7,6 @@
|
|||||||
#include "GUI.h"
|
#include "GUI.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include <entt/entt.hpp>
|
#include <entt/entt.hpp>
|
||||||
#include "../../BarinkEngine/src/PerfCounter.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define globals
|
* Define globals
|
||||||
@ -17,7 +16,6 @@ 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
|
||||||
@ -51,11 +49,19 @@ void Start() {
|
|||||||
auto AmbientLight = scene.AddEntity("AmbientLight");
|
auto AmbientLight = scene.AddEntity("AmbientLight");
|
||||||
AmbientLight.AddComponent<BarinkEngine::LightComponent>();
|
AmbientLight.AddComponent<BarinkEngine::LightComponent>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
renderer.Prepare(scene);
|
renderer.Prepare(scene);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool showImGuiMetrics = false;
|
||||||
/*
|
/*
|
||||||
* Runs every frame
|
* Runs every frame
|
||||||
* - Use to draw Immediate mode graphics (Not meant for HUD's )
|
* - Use to draw Immediate mode graphics (Not meant for HUD's )
|
||||||
@ -63,7 +69,7 @@ void Start() {
|
|||||||
void ImmediateGraphicsDraw()
|
void ImmediateGraphicsDraw()
|
||||||
{
|
{
|
||||||
// Show internal BarinkEngine stats
|
// Show internal BarinkEngine stats
|
||||||
EngineInstrumentation::ShowStats();
|
ShowStats();
|
||||||
|
|
||||||
ImGui::Begin("Scene view");
|
ImGui::Begin("Scene view");
|
||||||
auto group = scene.getReg().view<BarinkEngine::IdentifierComponent>();
|
auto group = scene.getReg().view<BarinkEngine::IdentifierComponent>();
|
||||||
@ -74,11 +80,17 @@ void ImmediateGraphicsDraw()
|
|||||||
});
|
});
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
ImGui::ShowMetricsWindow();
|
|
||||||
|
|
||||||
ImGui::Begin("Settings");
|
ImGui::Begin("Settings");
|
||||||
|
|
||||||
|
|
||||||
|
if (ImGui::Button("ImGui Debug"))
|
||||||
|
{
|
||||||
|
std::cout << "Click!" << std::endl;
|
||||||
|
showImGuiMetrics = true;
|
||||||
|
}
|
||||||
|
ImGui::ShowMetricsWindow(&showImGuiMetrics);
|
||||||
|
|
||||||
auto& a = cube.GetComponent<BarinkEngine::Render3DComponent>();
|
auto& a = cube.GetComponent<BarinkEngine::Render3DComponent>();
|
||||||
|
|
||||||
auto& b = cube.GetComponent<BarinkEngine::TransformComponent>();
|
auto& b = cube.GetComponent<BarinkEngine::TransformComponent>();
|
||||||
@ -95,8 +107,12 @@ void ImmediateGraphicsDraw()
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -104,12 +120,9 @@ void ImmediateGraphicsDraw()
|
|||||||
* - Meant for game logic ( non-physics related)
|
* - Meant for game logic ( non-physics related)
|
||||||
*/
|
*/
|
||||||
void Update()
|
void Update()
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Render()
|
|
||||||
{
|
{
|
||||||
renderer.Render(scene);
|
renderer.Render(scene);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Subproject commit 664cf2d73864a36b2a8b5091d33fc4578c885eca
|
|
@ -6,7 +6,7 @@ workspace "BarinkEngine"
|
|||||||
architecture "x86_64"
|
architecture "x86_64"
|
||||||
|
|
||||||
targetdir "./%{prj.name}/build/%{cfg.buildcfg}"
|
targetdir "./%{prj.name}/build/%{cfg.buildcfg}"
|
||||||
objdir "./%{prj.name}/build/%{cfg.buildcfg}/intermediates/"
|
objdir "./%{prj.name}/%{cfg.buildcfg}/intermediates/"
|
||||||
|
|
||||||
startproject("SandboxApp")
|
startproject("SandboxApp")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user