mirror of https://github.com/AxioDL/metaforce.git
Initial ModelViewer view
This commit is contained in:
parent
5a0fb04e03
commit
b34b6a735f
|
@ -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({});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -26,13 +26,20 @@ class ModelViewer : public ViewerSpace
|
||||||
} m_state;
|
} m_state;
|
||||||
|
|
||||||
const Space::State& spaceState() const { return m_state; }
|
const Space::State& spaceState() const { return m_state; }
|
||||||
|
std::unique_ptr<pshag::CLineRenderer> m_lineRenderer;
|
||||||
struct View : Specter::View
|
struct View : Specter::View
|
||||||
{
|
{
|
||||||
ModelViewer& m_mv;
|
ModelViewer& m_mv;
|
||||||
|
boo::SWindowRect m_scissorRect;
|
||||||
|
|
||||||
View(ModelViewer& mv, Specter::ViewResources& res)
|
View(ModelViewer& mv, Specter::ViewResources& res)
|
||||||
: Specter::View(res, mv.m_vm.rootView()), m_mv(mv)
|
: 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;
|
Camera m_camera;
|
||||||
|
@ -43,6 +50,7 @@ public:
|
||||||
: ViewerSpace(vm, Class::ModelViewer, parent)
|
: ViewerSpace(vm, Class::ModelViewer, parent)
|
||||||
{
|
{
|
||||||
reloadState();
|
reloadState();
|
||||||
|
m_lineRenderer.reset(new pshag::CLineRenderer(pshag::CLineRenderer::EPrimitiveMode::LineStrip, 4, nullptr, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelViewer(ViewManager& vm, Space* parent, const ModelViewer& other)
|
ModelViewer(ViewManager& vm, Space* parent, const ModelViewer& other)
|
||||||
|
|
Loading…
Reference in New Issue