From fdfccb8fbb089669742f388c661d4d89d6743ed1 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sat, 16 Jan 2016 21:08:46 -0800 Subject: [PATCH] ModelViewer stub --- Editor/CMakeLists.txt | 3 +- Editor/ModelViewer.hpp | 68 ++++++++++++++++++++++++++++++++++++++++++ Editor/Space.hpp | 1 + libSpecter | 2 +- 4 files changed, 72 insertions(+), 2 deletions(-) diff --git a/Editor/CMakeLists.txt b/Editor/CMakeLists.txt index 0c3594666..4e8811d59 100644 --- a/Editor/CMakeLists.txt +++ b/Editor/CMakeLists.txt @@ -17,13 +17,14 @@ endif() atdna(atdna_Space.cpp Space.hpp) atdna(atdna_ResourceBrowser.cpp ResourceBrowser.hpp) +atdna(atdna_ModelViewer.cpp ModelViewer.hpp) add_executable(urde WIN32 main.cpp Space.hpp Space.cpp atdna_Space.cpp SplashScreen.hpp SplashScreen.cpp ResourceBrowser.hpp ResourceBrowser.cpp atdna_ResourceBrowser.cpp - ModelViewer.hpp ModelViewer.cpp + ModelViewer.hpp ModelViewer.cpp atdna_ModelViewer.cpp ProjectManager.hpp ProjectManager.cpp ViewManager.hpp ViewManager.cpp) diff --git a/Editor/ModelViewer.hpp b/Editor/ModelViewer.hpp index 77b21391b..103586b82 100644 --- a/Editor/ModelViewer.hpp +++ b/Editor/ModelViewer.hpp @@ -1,8 +1,76 @@ #ifndef URDE_MODEL_VIEWER_HPP #define URDE_MODEL_VIEWER_HPP +#include "Space.hpp" +#include "ViewManager.hpp" +#include "CVector3f.hpp" +#include "CProjection.hpp" + namespace URDE { +class ModelViewer : public Space +{ + struct State : Space::State + { + DECL_YAML + enum class Mode + { + Solid, + Material, + Wireframe + }; + + Value renderMode = Mode::Material; + Value cameraPosition; + } m_state; + + const Space::State& spaceState() const { return m_state; } + + struct View : Specter::View + { + Zeus::CProjection m_cameraProjection; + }; + virtual Specter::View* buildContentView(Specter::ViewResources& res) + { + return nullptr; + } + virtual Specter::View* buildSpaceView(Specter::ViewResources& res) + { + return nullptr; + } + +public: + ModelViewer(ViewManager& vm, Space* parent) + : Space(vm, Class::ModelViewer, parent) + { + reloadState(); + } + + ModelViewer(ViewManager& vm, Space* parent, const ModelViewer& other) + : ModelViewer(vm, parent) + { + m_state = other.m_state; + reloadState(); + } + + ModelViewer(ViewManager& vm, Space* parent, ConfigReader& r) + : ModelViewer(vm, parent) + { + m_state.read(r); + reloadState(); + } + + void reloadState() + {} + + Space* copy(Space *parent) const + { + return new ModelViewer(m_vm, parent, *this); + } + + bool usesToolbar() const { return true; } +}; + } #endif // URDE_MODEL_VIEWER_HPP diff --git a/Editor/Space.hpp b/Editor/Space.hpp index 616edcbd6..9cd05ae58 100644 --- a/Editor/Space.hpp +++ b/Editor/Space.hpp @@ -32,6 +32,7 @@ public: SplitSpace, TestSpace, ResourceBrowser, + ModelViewer }; struct State : Athena::io::DNAYaml {Delete _d;}; diff --git a/libSpecter b/libSpecter index 77c30bdac..0e061705b 160000 --- a/libSpecter +++ b/libSpecter @@ -1 +1 @@ -Subproject commit 77c30bdac07d4fe45cc16b239dfb9d05045c9e95 +Subproject commit 0e061705bb8d009280a1c857e0701f1f1c79b406