2016-01-05 09:53:16 +00:00
|
|
|
#ifndef URDE_VIEW_MANAGER_HPP
|
|
|
|
#define URDE_VIEW_MANAGER_HPP
|
2015-12-06 01:27:02 +00:00
|
|
|
|
2016-03-08 07:10:52 +00:00
|
|
|
#include "hecl/CVarManager.hpp"
|
|
|
|
#include "boo/audiodev/IAudioVoiceAllocator.hpp"
|
|
|
|
#include "boo/audiodev/AudioMatrix.hpp"
|
2015-12-13 21:01:32 +00:00
|
|
|
#include "ProjectManager.hpp"
|
2015-12-11 02:37:54 +00:00
|
|
|
#include "Space.hpp"
|
2015-12-06 01:27:02 +00:00
|
|
|
|
2016-02-16 05:50:41 +00:00
|
|
|
#include "Runtime/Particle/CElementGen.hpp"
|
2016-02-18 02:42:32 +00:00
|
|
|
#include "Runtime/Graphics/CLineRenderer.hpp"
|
2016-03-07 03:12:32 +00:00
|
|
|
#include "Runtime/Graphics/CMoviePlayer.hpp"
|
2016-02-16 05:50:41 +00:00
|
|
|
|
2016-03-05 00:03:41 +00:00
|
|
|
namespace urde
|
2015-12-06 01:27:02 +00:00
|
|
|
{
|
2015-12-13 02:27:34 +00:00
|
|
|
class SplashScreen;
|
2015-12-06 01:27:02 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
class ViewManager : public specter::IViewManager
|
2015-12-06 01:27:02 +00:00
|
|
|
{
|
2016-01-04 05:31:02 +00:00
|
|
|
friend class ProjectManager;
|
2016-01-11 02:17:08 +00:00
|
|
|
friend class Space;
|
|
|
|
friend class RootSpace;
|
2016-02-01 01:13:45 +00:00
|
|
|
friend class SplitSpace;
|
2016-01-04 05:31:02 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
hecl::Runtime::FileStoreManager& m_fileStoreManager;
|
|
|
|
hecl::CVarManager& m_cvarManager;
|
2015-12-13 21:01:32 +00:00
|
|
|
ProjectManager m_projManager;
|
2016-03-04 23:04:53 +00:00
|
|
|
specter::FontCache m_fontCache;
|
|
|
|
specter::DefaultThemeData m_themeData;
|
|
|
|
specter::ViewResources m_viewResources;
|
2016-01-18 23:33:23 +00:00
|
|
|
boo::GraphicsDataToken m_iconsToken;
|
2016-03-04 23:04:53 +00:00
|
|
|
specter::Translator m_translator;
|
2015-12-06 01:27:02 +00:00
|
|
|
std::unique_ptr<boo::IWindow> m_mainWindow;
|
2016-01-04 05:31:02 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
std::unique_ptr<specter::RootView> m_rootView;
|
2015-12-13 02:27:34 +00:00
|
|
|
std::unique_ptr<SplashScreen> m_splash;
|
2016-01-10 06:42:58 +00:00
|
|
|
std::unique_ptr<RootSpace> m_rootSpace;
|
2016-03-04 23:04:53 +00:00
|
|
|
specter::View* m_rootSpaceView = nullptr;
|
2015-12-09 01:04:50 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
class ParticleView : public specter::View
|
2016-02-16 05:50:41 +00:00
|
|
|
{
|
|
|
|
ViewManager& m_vm;
|
|
|
|
public:
|
2016-03-04 23:04:53 +00:00
|
|
|
ParticleView(ViewManager& vm, specter::ViewResources& res, specter::View& parent)
|
2016-03-08 23:38:00 +00:00
|
|
|
: View(res, parent), m_vm(vm) {commitResources(res);}
|
2016-02-18 02:42:32 +00:00
|
|
|
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
|
|
|
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
2016-02-16 05:50:41 +00:00
|
|
|
};
|
|
|
|
std::unique_ptr<ParticleView> m_particleView;
|
2016-03-08 22:51:13 +00:00
|
|
|
urde::TLockedToken<CGenDescription> m_partGenDesc;
|
|
|
|
std::unique_ptr<CElementGen> m_partGen;
|
|
|
|
std::unique_ptr<CLineRenderer> m_lineRenderer;
|
|
|
|
std::unique_ptr<CMoviePlayer> m_moviePlayer;
|
|
|
|
std::unique_ptr<u8[]> m_rsfBuf;
|
2016-03-08 07:10:52 +00:00
|
|
|
std::unique_ptr<boo::IAudioVoiceAllocator> m_voiceAllocator;
|
2016-03-09 20:03:35 +00:00
|
|
|
boo::AudioChannelSet m_audioSet = boo::AudioChannelSet::Unknown;
|
2016-03-08 07:10:52 +00:00
|
|
|
std::unique_ptr<boo::IAudioVoice> m_videoVoice;
|
|
|
|
boo::AudioMatrixStereo m_stereoMatrix;
|
|
|
|
struct AudioVoiceCallback : boo::IAudioVoiceCallback
|
|
|
|
{
|
|
|
|
ViewManager& m_vm;
|
|
|
|
std::vector<s16> m_stereoBuf;
|
|
|
|
void needsNextBuffer(boo::IAudioVoice& voice, size_t frames)
|
|
|
|
{
|
|
|
|
m_stereoBuf.clear();
|
|
|
|
m_stereoBuf.resize(frames * 2);
|
|
|
|
if (m_vm.m_moviePlayer)
|
|
|
|
m_vm.m_moviePlayer->MixAudio(m_stereoBuf.data(), nullptr, frames);
|
2016-03-08 22:51:13 +00:00
|
|
|
CMoviePlayer::MixStaticAudio(m_stereoBuf.data(), m_stereoBuf.data(), frames);
|
2016-03-08 07:10:52 +00:00
|
|
|
m_vm.m_stereoMatrix.bufferStereoSampleData(voice, m_stereoBuf.data(), frames);
|
|
|
|
}
|
|
|
|
AudioVoiceCallback(ViewManager& vm) : m_vm(vm) {}
|
|
|
|
} m_voiceCallback;
|
2016-02-16 05:50:41 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
hecl::SystemString m_recentProjectsPath;
|
|
|
|
std::vector<hecl::SystemString> m_recentProjects;
|
|
|
|
hecl::SystemString m_recentFilesPath;
|
|
|
|
std::vector<hecl::SystemString> m_recentFiles;
|
2016-01-02 02:27:46 +00:00
|
|
|
|
2015-12-09 01:04:50 +00:00
|
|
|
bool m_updatePf = false;
|
|
|
|
float m_reqPf;
|
2015-12-06 01:27:02 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
specter::View* BuildSpaceViews();
|
|
|
|
specter::RootView* SetupRootView();
|
2016-01-05 00:01:02 +00:00
|
|
|
SplashScreen* SetupSplashView();
|
2016-03-04 23:04:53 +00:00
|
|
|
void RootSpaceViewBuilt(specter::View* view);
|
2016-03-07 03:12:32 +00:00
|
|
|
void ProjectChanged(hecl::Database::Project& proj);
|
2015-12-13 02:27:34 +00:00
|
|
|
void SetupEditorView();
|
2016-01-05 00:01:02 +00:00
|
|
|
void SetupEditorView(ConfigReader& r);
|
|
|
|
void SaveEditorView(ConfigWriter& w);
|
2015-12-13 02:27:34 +00:00
|
|
|
|
|
|
|
bool m_showSplash = false;
|
2016-01-05 00:01:02 +00:00
|
|
|
void DismissSplash();
|
|
|
|
|
|
|
|
unsigned m_editorFrames = 120;
|
|
|
|
void FadeInEditors() {m_editorFrames = 0;}
|
2015-12-12 00:37:32 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void BuildTestPART(urde::IObjectStore& objStore);
|
2016-02-16 05:50:41 +00:00
|
|
|
|
2016-01-11 02:17:08 +00:00
|
|
|
Space* m_deferSplit = nullptr;
|
2016-03-04 23:04:53 +00:00
|
|
|
specter::SplitView::Axis m_deferSplitAxis;
|
2016-01-11 02:17:08 +00:00
|
|
|
int m_deferSplitThisSlot;
|
2016-01-12 00:46:27 +00:00
|
|
|
boo::SWindowCoord m_deferSplitCoord;
|
2016-01-11 02:17:08 +00:00
|
|
|
|
2016-01-04 05:31:02 +00:00
|
|
|
public:
|
2016-03-04 23:04:53 +00:00
|
|
|
ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarManager& cvarMgr);
|
2015-12-13 02:27:34 +00:00
|
|
|
~ViewManager();
|
2015-12-12 00:37:32 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
specter::RootView& rootView() const {return *m_rootView;}
|
2016-01-03 04:06:18 +00:00
|
|
|
void requestPixelFactor(float pf)
|
2015-12-12 00:37:32 +00:00
|
|
|
{
|
|
|
|
m_reqPf = pf;
|
|
|
|
m_updatePf = true;
|
|
|
|
}
|
|
|
|
|
2015-12-13 21:01:32 +00:00
|
|
|
ProjectManager& projectManager() {return m_projManager;}
|
2016-03-04 23:04:53 +00:00
|
|
|
hecl::Database::Project* project() {return m_projManager.project();}
|
|
|
|
const specter::Translator* getTranslator() const {return &m_translator;}
|
2015-12-13 21:01:32 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void deferSpaceSplit(specter::ISpaceController* split, specter::SplitView::Axis axis, int thisSlot,
|
2016-01-12 00:46:27 +00:00
|
|
|
const boo::SWindowCoord& coord)
|
2016-01-11 02:17:08 +00:00
|
|
|
{
|
|
|
|
m_deferSplit = static_cast<Space*>(split);
|
|
|
|
m_deferSplitAxis = axis;
|
|
|
|
m_deferSplitThisSlot = thisSlot;
|
2016-01-12 00:46:27 +00:00
|
|
|
m_deferSplitCoord = coord;
|
2016-01-11 02:17:08 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
const std::vector<hecl::SystemString>* recentProjects() const {return &m_recentProjects;}
|
|
|
|
void pushRecentProject(const hecl::SystemString& path);
|
2016-01-02 02:27:46 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
const std::vector<hecl::SystemString>* recentFiles() const {return &m_recentFiles;}
|
|
|
|
void pushRecentFile(const hecl::SystemString& path);
|
2016-01-02 02:27:46 +00:00
|
|
|
|
2015-12-12 00:37:32 +00:00
|
|
|
void init(boo::IApplication* app);
|
|
|
|
bool proc();
|
|
|
|
void stop();
|
2015-12-06 01:27:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-01-05 09:53:16 +00:00
|
|
|
#endif // URDE_VIEW_MANAGER_HPP
|