ImGui
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#ifndef HYDRADRAWWINDOWTASK
|
||||
#define HYDRADRAWWINDOWTASK
|
||||
#include "../HydraTask.h"
|
||||
#include "../../engine/HydraEngine.h"
|
||||
#include "../../renderer/HydraRenderer.h"
|
||||
#include "../../windowmanager/HydraWindowManager.h"
|
||||
#include "../../gui/HydraGuiWindow.h"
|
||||
#include "../../GlewIncludes.h"
|
||||
#include <GLMIncludes.h>
|
||||
#include <imgui.h>
|
||||
#include <imgui_impl_glfw.h>
|
||||
#include <imgui_impl_opengl3.h>
|
||||
|
||||
class HydraDrawWindowTask : public HydraTask
|
||||
{
|
||||
private:
|
||||
HydraGuiWindow* m_window = nullptr;
|
||||
|
||||
protected:
|
||||
public:
|
||||
void Process() override
|
||||
{
|
||||
m_window->DrawComponents();
|
||||
}
|
||||
void Initialise(HydraGuiWindow* window)
|
||||
{
|
||||
m_window = window;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* HYDRADRAWWINDOWTASK */
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef HYDRAENDGUIFRAMETASK
|
||||
#define HYDRAENDGUIFRAMETASK
|
||||
#include "../HydraTask.h"
|
||||
#include "../../engine/HydraEngine.h"
|
||||
#include "../../renderer/HydraRenderer.h"
|
||||
#include "../../windowmanager/HydraWindowManager.h"
|
||||
#include "../../GlewIncludes.h"
|
||||
#include <GLMIncludes.h>
|
||||
#include <imgui.h>
|
||||
#include <imgui_impl_glfw.h>
|
||||
#include <imgui_impl_opengl3.h>
|
||||
|
||||
class HydraEndGUIFrameTask : public HydraTask
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
protected:
|
||||
public:
|
||||
void Process() override
|
||||
{
|
||||
ImGui::Render();
|
||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||
ImGui::EndFrame();
|
||||
}
|
||||
void Initialise()
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif /* HYDRAENDGUIFRAMETASK */
|
||||
@@ -0,0 +1,41 @@
|
||||
#ifndef HYDRAINITIALISEGUITASK
|
||||
#define HYDRAINITIALISEGUITASK
|
||||
#include "../HydraTask.h"
|
||||
#include "../../engine/HydraEngine.h"
|
||||
#include "../../renderer/HydraRenderer.h"
|
||||
#include "../../windowmanager/HydraWindowManager.h"
|
||||
#include "../../GlewIncludes.h"
|
||||
#include <GLMIncludes.h>
|
||||
#include <imgui.h>
|
||||
#include <imgui_impl_glfw.h>
|
||||
#include <imgui_impl_opengl3.h>
|
||||
|
||||
class HydraInitialiseGUITask : public HydraTask
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
protected:
|
||||
public:
|
||||
void Process() override
|
||||
{
|
||||
// Setup Dear ImGui context
|
||||
IMGUI_CHECKVERSION();
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
||||
//io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // IF using Docking Branch
|
||||
|
||||
// Setup Platform/Renderer backends
|
||||
|
||||
ImGui_ImplGlfw_InitForOpenGL(GetEngine()->WindowManager()->GetWindow(), true); // Second param install_callback=true will install GLFW callbacks and chain to existing ones.
|
||||
ImGui_ImplOpenGL3_Init();
|
||||
}
|
||||
void Initialise()
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* HYDRAINITIALISEGUITASK */
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef HYDRASHUTDOWNGUITASK
|
||||
#define HYDRASHUTDOWNGUITASK
|
||||
|
||||
#include "../HydraTask.h"
|
||||
#include "../../engine/HydraEngine.h"
|
||||
#include "../../renderer/HydraRenderer.h"
|
||||
#include "../../windowmanager/HydraWindowManager.h"
|
||||
#include "../../GlewIncludes.h"
|
||||
#include <GLMIncludes.h>
|
||||
#include <imgui.h>
|
||||
#include <imgui_impl_glfw.h>
|
||||
#include <imgui_impl_opengl3.h>
|
||||
|
||||
class HydraShutdownGUITask : public HydraTask
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
protected:
|
||||
public:
|
||||
void Process() override
|
||||
{
|
||||
// Setup Dear ImGui context
|
||||
ImGui_ImplOpenGL3_Shutdown();
|
||||
ImGui_ImplGlfw_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
}
|
||||
void Initialise()
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif /* HYDRASHUTDOWNGUITASK */
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef HYDRASTARTGUIFRAMETASK
|
||||
#define HYDRASTARTGUIFRAMETASK
|
||||
|
||||
#include "../HydraTask.h"
|
||||
#include "../../engine/HydraEngine.h"
|
||||
#include "../../renderer/HydraRenderer.h"
|
||||
#include "../../windowmanager/HydraWindowManager.h"
|
||||
#include "../../GlewIncludes.h"
|
||||
#include <GLMIncludes.h>
|
||||
#include <imgui.h>
|
||||
#include <imgui_impl_glfw.h>
|
||||
#include <imgui_impl_opengl3.h>
|
||||
|
||||
class HydraStartGUIFrameTask : public HydraTask
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
protected:
|
||||
public:
|
||||
void Process() override
|
||||
{
|
||||
ImGui_ImplOpenGL3_NewFrame();
|
||||
ImGui_ImplGlfw_NewFrame();
|
||||
ImGui::NewFrame();
|
||||
}
|
||||
void Initialise()
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif /* HYDRASHUTDOWNGUITASK */
|
||||
@@ -24,8 +24,10 @@ public:
|
||||
b3BodyEvents events = b3World_GetBodyEvents(m_world_id);
|
||||
|
||||
HydraTaskScheduler* task_scheduler = GetEngine()->TaskScheduler();
|
||||
// HydraID barrier_id = task_scheduler->CreateBarrier();
|
||||
|
||||
|
||||
std::vector<HydraID> tasks;
|
||||
|
||||
uint32_t job_count = 0;
|
||||
for(uint32_t i = 0; i < events.moveCount; i ++)
|
||||
{
|
||||
HydraID task_id = task_scheduler->CreateTask<HydraSetWorldTransformTask>(HydraThreadAffinity::General);//, barrier_id);
|
||||
@@ -37,10 +39,12 @@ public:
|
||||
HydraID* entity_id = reinterpret_cast<HydraID*>(events.moveEvents[i].userData);
|
||||
|
||||
set_task->Initialise(*entity_id, position, rotation);
|
||||
//task_scheduler->StartTask(task_id);
|
||||
task_scheduler->WaitForTask(task_id);
|
||||
|
||||
|
||||
}
|
||||
//task_scheduler->WaitForBarrier(barrier_id);
|
||||
|
||||
|
||||
}
|
||||
void Initialise(b3WorldId world_id, float delta_t_seconds)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user