Initial ModelViewer view

This commit is contained in:
Phillip Stephens 2016-02-18 00:56:11 -08:00
parent 5a0fb04e03
commit b34b6a735f
2 changed files with 35 additions and 2 deletions

View File

@ -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({});
}
}

View File

@ -26,13 +26,20 @@ class ModelViewer : public ViewerSpace
} m_state;
const Space::State& spaceState() const { return m_state; }
std::unique_ptr<pshag::CLineRenderer> 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)