diff --git a/Editor/ModelViewer.cpp b/Editor/ModelViewer.cpp index e69de29bb..2b19d1b4f 100644 --- a/Editor/ModelViewer.cpp +++ b/Editor/ModelViewer.cpp @@ -0,0 +1,25 @@ +#include "ModelViewer.hpp" + +namespace URDE +{ + +void ModelViewer::View::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub) +{ + Specter::View::resized(root, sub); + m_scissorRect = sub; +} + +void ModelViewer::View::draw(boo::IGraphicsCommandQueue* gfxQ) +{ + gfxQ->setScissor(m_scissorRect); + m_mv.m_lineRenderer->Reset(); + m_mv.m_lineRenderer->AddVertex({-0.5f, 0.f, -0.5f}, Zeus::CColor::skBlue, 1.f); + m_mv.m_lineRenderer->AddVertex({-0.5f, 0.f, 0.5f}, Zeus::CColor::skBlue, 1.f); + m_mv.m_lineRenderer->AddVertex({0.5f, 10.f, 0.5f}, Zeus::CColor::skRed, 3.f); + m_mv.m_lineRenderer->AddVertex({0.5f, 0.f, -0.5f}, Zeus::CColor::skBlue, 1.f); + m_mv.m_lineRenderer->Render(); + gfxQ->setScissor({}); +} + + +} diff --git a/Editor/ModelViewer.hpp b/Editor/ModelViewer.hpp index 33f035e5d..c35b3dc02 100644 --- a/Editor/ModelViewer.hpp +++ b/Editor/ModelViewer.hpp @@ -26,13 +26,20 @@ class ModelViewer : public ViewerSpace } m_state; const Space::State& spaceState() const { return m_state; } - + std::unique_ptr m_lineRenderer; struct View : Specter::View { ModelViewer& m_mv; + boo::SWindowRect m_scissorRect; + View(ModelViewer& mv, Specter::ViewResources& res) : Specter::View(res, mv.m_vm.rootView()), m_mv(mv) - {} + { + commitResources(res); + } + + void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub); + void draw(boo::IGraphicsCommandQueue *gfxQ); }; Camera m_camera; @@ -43,6 +50,7 @@ public: : ViewerSpace(vm, Class::ModelViewer, parent) { reloadState(); + m_lineRenderer.reset(new pshag::CLineRenderer(pshag::CLineRenderer::EPrimitiveMode::LineStrip, 4, nullptr, true)); } ModelViewer(ViewManager& vm, Space* parent, const ModelViewer& other)