WIP: add 3d render inside imguiwindow

This commit is contained in:
SweetId
2023-11-21 20:06:04 +05:30
parent 2b9b4f6df8
commit e79a629257
6 changed files with 69 additions and 19 deletions

View File

@@ -80,11 +80,16 @@ namespace Nz
inline Nz::Window* GetWindow() { return m_window; }
inline const Nz::Window* GetWindow() const { return m_window; }
inline Nz::Texture* GetEngineTexture() { return m_engineTexture.get(); }
inline const Nz::Texture* GetEngineTexture() const { return m_engineTexture.get(); }
private:
static EditorBaseApplication* s_instance;
Nz::Window* m_window;
std::unique_ptr<Nz::WindowSwapchain> m_windowSwapchain;
std::unique_ptr<Nz::Camera> m_editorCamera;
std::shared_ptr<Nz::Texture> m_engineTexture;
std::vector<std::unique_ptr<Nz::EditorWindow>> m_windows;
std::filesystem::path m_resourceFolder;

View File

@@ -2,17 +2,21 @@
#include <NazaraEditor/Core/Core.hpp>
#include <Nazara/Core/Clock.hpp>
#include <Nazara/Platform/WindowEventHandler.hpp>
#include <Nazara/Math/Ray.hpp>
namespace Nz
{
class Camera;
class DebugDrawer;
class NodeComponent;
class WindowEventHandler;
class NAZARAEDITOR_CORE_API EditorCameraComponent
{
public:
EditorCameraComponent();
EditorCameraComponent(Nz::Camera& camera, Nz::DebugDrawer& debug);
EditorCameraComponent(const EditorCameraComponent&) = delete;
EditorCameraComponent(EditorCameraComponent&&);
@@ -27,13 +31,21 @@ namespace Nz
inline const Nz::EulerAnglesf& GetOrientation() const { return m_targetAngles; }
private:
void RaycastSelection(int x, int y);
NazaraSlot(Nz::WindowEventHandler, OnMouseButtonReleased, m_onMouseClicked);
NazaraSlot(Nz::WindowEventHandler, OnMouseMoved, m_onMouseMoved);
Nz::Camera& m_camera;
Nz::EulerAnglesf m_targetAngles;
Nz::Vector3f m_targetPosition;
Nz::Vector3f m_currentVelocity;
float m_moveSpeed;
float m_smoothSpeed;
Nz::Rayf m_lastRay;
Nz::DebugDrawer& m_debugDrawer;
Nz::MillisecondClock m_debugClock;
};
}