mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 12:27:43 +00:00
Merge branch 'master' into urde-tags
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "ViewManager.hpp"
|
||||
#include "Specter/Control.hpp"
|
||||
#include "Specter/Space.hpp"
|
||||
#include "Specter/Menu.hpp"
|
||||
#include "specter/Control.hpp"
|
||||
#include "specter/Space.hpp"
|
||||
#include "specter/Menu.hpp"
|
||||
#include "SplashScreen.hpp"
|
||||
#include "locale/locale.hpp"
|
||||
#include "ResourceBrowser.hpp"
|
||||
@@ -9,25 +9,25 @@
|
||||
#include "Runtime/Particle/CGenDescription.hpp"
|
||||
#include "Runtime/Particle/CElectricDescription.hpp"
|
||||
#include "Runtime/Particle/CSwooshDescription.hpp"
|
||||
#include "Runtime/CModel.hpp"
|
||||
#include "Runtime/CGraphics.hpp"
|
||||
#include "Runtime/Graphics/CModel.hpp"
|
||||
#include "Runtime/Graphics/CGraphics.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
using YAMLNode = Athena::io::YAMLNode;
|
||||
using YAMLNode = athena::io::YAMLNode;
|
||||
|
||||
namespace URDE
|
||||
namespace urde
|
||||
{
|
||||
|
||||
void ViewManager::BuildTestPART(pshag::IObjectStore& objStore)
|
||||
void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
|
||||
{
|
||||
//m_partGenDesc = objStore.GetObj({HECL::FOURCC('PART'), 0x972A5CD2});
|
||||
//m_partGenDesc = objStore.GetObj({hecl::FOURCC('PART'), 0x972A5CD2});
|
||||
m_partGenDesc = objStore.GetObj("BusterSparks");
|
||||
m_partGen.reset(new pshag::CElementGen(m_partGenDesc,
|
||||
pshag::CElementGen::EModelOrientationType::Normal,
|
||||
pshag::CElementGen::EOptionalSystemFlags::None));
|
||||
m_partGen.reset(new urde::CElementGen(m_partGenDesc,
|
||||
urde::CElementGen::EModelOrientationType::Normal,
|
||||
urde::CElementGen::EOptionalSystemFlags::None));
|
||||
m_partGen->SetGlobalScale({5.f, 5.f, 5.f});
|
||||
m_particleView.reset(new ParticleView(*this, m_viewResources, *m_rootView));
|
||||
m_lineRenderer.reset(new pshag::CLineRenderer(pshag::CLineRenderer::EPrimitiveMode::LineStrip, 4, nullptr, true));
|
||||
m_lineRenderer.reset(new urde::CLineRenderer(urde::CLineRenderer::EPrimitiveMode::LineStrip, 4, nullptr, true));
|
||||
|
||||
//m_rootView->accessContentViews().clear();
|
||||
m_rootView->accessContentViews().push_back(m_particleView.get());
|
||||
@@ -36,8 +36,8 @@ void ViewManager::BuildTestPART(pshag::IObjectStore& objStore)
|
||||
|
||||
void ViewManager::ParticleView::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
||||
{
|
||||
Specter::View::resized(root, sub);
|
||||
pshag::CGraphics::SetViewportResolution({sub.size[0], sub.size[1]});
|
||||
specter::View::resized(root, sub);
|
||||
urde::CGraphics::SetViewportResolution({sub.size[0], sub.size[1]});
|
||||
}
|
||||
|
||||
void ViewManager::ParticleView::draw(boo::IGraphicsCommandQueue *gfxQ)
|
||||
@@ -49,35 +49,35 @@ void ViewManager::ParticleView::draw(boo::IGraphicsCommandQueue *gfxQ)
|
||||
if (m_vm.m_partGen->IsSystemDeletable())
|
||||
m_vm.m_partGen->Reset();
|
||||
|
||||
pshag::CGraphics::SetModelMatrix(Zeus::CTransform::Identity());
|
||||
pshag::CGraphics::SetViewPointMatrix(Zeus::CTransform::Identity() + Zeus::CVector3f(0.f, -10.f, 0.f));
|
||||
urde::CGraphics::SetModelMatrix(zeus::CTransform::Identity());
|
||||
urde::CGraphics::SetViewPointMatrix(zeus::CTransform::Identity() + zeus::CVector3f(0.f, -10.f, 0.f));
|
||||
boo::SWindowRect windowRect = m_vm.m_mainWindow->getWindowFrame();
|
||||
float aspect = windowRect.size[0] / float(windowRect.size[1]);
|
||||
pshag::CGraphics::SetPerspective(55.0, aspect, 0.001f, 1000.f);
|
||||
urde::CGraphics::SetPerspective(55.0, aspect, 0.001f, 1000.f);
|
||||
//gfxQ->clearTarget(false, true);
|
||||
m_vm.m_partGen->Render();
|
||||
|
||||
/*
|
||||
m_vm.m_lineRenderer->Reset();
|
||||
m_vm.m_lineRenderer->AddVertex({-0.5f, 0.f, -0.5f}, Zeus::CColor::skBlue, 1.f);
|
||||
m_vm.m_lineRenderer->AddVertex({-0.5f, 0.f, 0.5f}, Zeus::CColor::skBlue, 1.f);
|
||||
m_vm.m_lineRenderer->AddVertex({0.5f, 10.f, 0.5f}, Zeus::CColor::skRed, 3.f);
|
||||
m_vm.m_lineRenderer->AddVertex({0.5f, 0.f, -0.5f}, Zeus::CColor::skBlue, 1.f);
|
||||
m_vm.m_lineRenderer->AddVertex({-0.5f, 0.f, -0.5f}, zeus::CColor::skBlue, 1.f);
|
||||
m_vm.m_lineRenderer->AddVertex({-0.5f, 0.f, 0.5f}, zeus::CColor::skBlue, 1.f);
|
||||
m_vm.m_lineRenderer->AddVertex({0.5f, 10.f, 0.5f}, zeus::CColor::skRed, 3.f);
|
||||
m_vm.m_lineRenderer->AddVertex({0.5f, 0.f, -0.5f}, zeus::CColor::skBlue, 1.f);
|
||||
m_vm.m_lineRenderer->Render();
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
Specter::View* ViewManager::BuildSpaceViews()
|
||||
specter::View* ViewManager::BuildSpaceViews()
|
||||
{
|
||||
m_rootSpaceView = m_rootSpace->buildSpaceView(m_viewResources);
|
||||
return m_rootSpaceView;
|
||||
}
|
||||
|
||||
Specter::RootView* ViewManager::SetupRootView()
|
||||
specter::RootView* ViewManager::SetupRootView()
|
||||
{
|
||||
m_rootView.reset(new Specter::RootView(*this, m_viewResources, m_mainWindow.get()));
|
||||
m_rootView->setBackground(Zeus::CColor::skBlack);
|
||||
m_rootView.reset(new specter::RootView(*this, m_viewResources, m_mainWindow.get()));
|
||||
m_rootView->setBackground(zeus::CColor::skBlack);
|
||||
return m_rootView.get();
|
||||
}
|
||||
|
||||
@@ -89,9 +89,9 @@ SplashScreen* ViewManager::SetupSplashView()
|
||||
return m_splash.get();
|
||||
}
|
||||
|
||||
void ViewManager::RootSpaceViewBuilt(Specter::View *view)
|
||||
void ViewManager::RootSpaceViewBuilt(specter::View *view)
|
||||
{
|
||||
std::vector<Specter::View*>& cViews = m_rootView->accessContentViews();
|
||||
std::vector<specter::View*>& cViews = m_rootView->accessContentViews();
|
||||
cViews.clear();
|
||||
cViews.push_back(view);
|
||||
cViews.push_back(m_splash.get());
|
||||
@@ -102,7 +102,7 @@ void ViewManager::SetupEditorView()
|
||||
{
|
||||
m_rootSpace.reset(new RootSpace(*this));
|
||||
|
||||
SplitSpace* split = new SplitSpace(*this, nullptr, Specter::SplitView::Axis::Horizontal);
|
||||
SplitSpace* split = new SplitSpace(*this, nullptr, specter::SplitView::Axis::Horizontal);
|
||||
m_rootSpace->setChild(std::unique_ptr<Space>(split));
|
||||
split->setChildSlot(0, std::make_unique<ResourceBrowser>(*this, split));
|
||||
split->setChildSlot(1, std::make_unique<ResourceBrowser>(*this, split));
|
||||
@@ -131,39 +131,39 @@ void ViewManager::DismissSplash()
|
||||
m_splash->close();
|
||||
}
|
||||
|
||||
ViewManager::ViewManager(HECL::Runtime::FileStoreManager& fileMgr, HECL::CVarManager& cvarMgr)
|
||||
ViewManager::ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarManager& cvarMgr)
|
||||
: m_fileStoreManager(fileMgr), m_cvarManager(cvarMgr), m_projManager(*this),
|
||||
m_fontCache(fileMgr), m_translator(URDE::SystemLocaleOrEnglish()),
|
||||
m_recentProjectsPath(HECL::SysFormat(_S("%s/recent_projects.txt"), fileMgr.getStoreRoot().c_str())),
|
||||
m_recentFilesPath(HECL::SysFormat(_S("%s/recent_files.txt"), fileMgr.getStoreRoot().c_str()))
|
||||
m_fontCache(fileMgr), m_translator(urde::SystemLocaleOrEnglish()),
|
||||
m_recentProjectsPath(hecl::SysFormat(_S("%s/recent_projects.txt"), fileMgr.getStoreRoot().c_str())),
|
||||
m_recentFilesPath(hecl::SysFormat(_S("%s/recent_files.txt"), fileMgr.getStoreRoot().c_str()))
|
||||
{
|
||||
Space::SpaceMenuNode::InitializeStrings(*this);
|
||||
char path[2048];
|
||||
HECL::Sstat theStat;
|
||||
hecl::Sstat theStat;
|
||||
|
||||
FILE* fp = HECL::Fopen(m_recentProjectsPath.c_str(), _S("r"), HECL::FileLockType::Read);
|
||||
FILE* fp = hecl::Fopen(m_recentProjectsPath.c_str(), _S("r"), hecl::FileLockType::Read);
|
||||
if (fp)
|
||||
{
|
||||
while (fgets(path, 2048, fp))
|
||||
{
|
||||
std::string pathStr(path);
|
||||
pathStr.pop_back();
|
||||
HECL::SystemStringView pathStrView(pathStr);
|
||||
if (!HECL::Stat(pathStrView.c_str(), &theStat) && S_ISDIR(theStat.st_mode))
|
||||
hecl::SystemStringView pathStrView(pathStr);
|
||||
if (!hecl::Stat(pathStrView.c_str(), &theStat) && S_ISDIR(theStat.st_mode))
|
||||
m_recentProjects.push_back(pathStrView);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
fp = HECL::Fopen(m_recentFilesPath.c_str(), _S("r"), HECL::FileLockType::Read);
|
||||
fp = hecl::Fopen(m_recentFilesPath.c_str(), _S("r"), hecl::FileLockType::Read);
|
||||
if (fp)
|
||||
{
|
||||
while (fgets(path, 2048, fp))
|
||||
{
|
||||
std::string pathStr(path);
|
||||
pathStr.pop_back();
|
||||
HECL::SystemStringView pathStrView(pathStr);
|
||||
if (!HECL::Stat(pathStrView.c_str(), &theStat) && S_ISDIR(theStat.st_mode))
|
||||
hecl::SystemStringView pathStrView(pathStr);
|
||||
if (!hecl::Stat(pathStrView.c_str(), &theStat) && S_ISDIR(theStat.st_mode))
|
||||
m_recentFiles.push_back(pathStrView);
|
||||
}
|
||||
fclose(fp);
|
||||
@@ -172,36 +172,36 @@ ViewManager::ViewManager(HECL::Runtime::FileStoreManager& fileMgr, HECL::CVarMan
|
||||
|
||||
ViewManager::~ViewManager() {}
|
||||
|
||||
void ViewManager::pushRecentProject(const HECL::SystemString& path)
|
||||
void ViewManager::pushRecentProject(const hecl::SystemString& path)
|
||||
{
|
||||
for (HECL::SystemString& testPath : m_recentProjects)
|
||||
for (hecl::SystemString& testPath : m_recentProjects)
|
||||
{
|
||||
if (path == testPath)
|
||||
return;
|
||||
}
|
||||
m_recentProjects.push_back(path);
|
||||
FILE* fp = HECL::Fopen(m_recentProjectsPath.c_str(), _S("w"), HECL::FileLockType::Write);
|
||||
FILE* fp = hecl::Fopen(m_recentProjectsPath.c_str(), _S("w"), hecl::FileLockType::Write);
|
||||
if (fp)
|
||||
{
|
||||
for (HECL::SystemString& pPath : m_recentProjects)
|
||||
fprintf(fp, "%s\n", HECL::SystemUTF8View(pPath).c_str());
|
||||
for (hecl::SystemString& pPath : m_recentProjects)
|
||||
fprintf(fp, "%s\n", hecl::SystemUTF8View(pPath).c_str());
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewManager::pushRecentFile(const HECL::SystemString& path)
|
||||
void ViewManager::pushRecentFile(const hecl::SystemString& path)
|
||||
{
|
||||
for (HECL::SystemString& testPath : m_recentFiles)
|
||||
for (hecl::SystemString& testPath : m_recentFiles)
|
||||
{
|
||||
if (path == testPath)
|
||||
return;
|
||||
}
|
||||
m_recentFiles.push_back(path);
|
||||
FILE* fp = HECL::Fopen(m_recentFilesPath.c_str(), _S("w"), HECL::FileLockType::Write);
|
||||
FILE* fp = hecl::Fopen(m_recentFilesPath.c_str(), _S("w"), hecl::FileLockType::Write);
|
||||
if (fp)
|
||||
{
|
||||
for (HECL::SystemString& pPath : m_recentFiles)
|
||||
fprintf(fp, "%s\n", HECL::SystemUTF8View(pPath).c_str());
|
||||
for (hecl::SystemString& pPath : m_recentFiles)
|
||||
fprintf(fp, "%s\n", hecl::SystemUTF8View(pPath).c_str());
|
||||
fclose(fp);
|
||||
}}
|
||||
|
||||
@@ -217,16 +217,16 @@ void ViewManager::init(boo::IApplication* app)
|
||||
m_viewResources.init(gf, &m_fontCache, &m_themeData, pixelFactor);
|
||||
m_iconsToken = InitializeIcons(m_viewResources);
|
||||
m_viewResources.prepFontCacheAsync(m_mainWindow.get());
|
||||
Specter::RootView* root = SetupRootView();
|
||||
specter::RootView* root = SetupRootView();
|
||||
m_showSplash = true;
|
||||
root->accessContentViews().push_back(SetupSplashView());
|
||||
root->updateSize();
|
||||
|
||||
m_mainWindow->setWaitCursor(false);
|
||||
|
||||
pshag::CGraphics::InitializeBoo(gf, m_mainWindow->getCommandQueue(), root->renderTex());
|
||||
pshag::CElementGen::Initialize();
|
||||
pshag::CLineRenderer::Initialize();
|
||||
urde::CGraphics::InitializeBoo(gf, m_mainWindow->getCommandQueue(), root->renderTex());
|
||||
urde::CElementGen::Initialize();
|
||||
urde::CLineRenderer::Initialize();
|
||||
}
|
||||
|
||||
bool ViewManager::proc()
|
||||
@@ -238,12 +238,12 @@ bool ViewManager::proc()
|
||||
if (m_updatePf)
|
||||
{
|
||||
m_viewResources.resetPixelFactor(m_reqPf);
|
||||
Specter::RootView* root = SetupRootView();
|
||||
specter::RootView* root = SetupRootView();
|
||||
if (m_rootSpace)
|
||||
BuildSpaceViews();
|
||||
else
|
||||
{
|
||||
std::vector<Specter::View*>& cViews = m_rootView->accessContentViews();
|
||||
std::vector<specter::View*>& cViews = m_rootView->accessContentViews();
|
||||
cViews.push_back(SetupSplashView());
|
||||
}
|
||||
root->updateSize();
|
||||
@@ -266,7 +266,7 @@ bool ViewManager::proc()
|
||||
|
||||
++m_editorFrames;
|
||||
if (m_rootSpaceView && m_editorFrames <= 30)
|
||||
m_rootSpaceView->setMultiplyColor(Zeus::CColor::lerp({1,1,1,0}, {1,1,1,1}, m_editorFrames / 30.0));
|
||||
m_rootSpaceView->setMultiplyColor(zeus::CColor::lerp({1,1,1,0}, {1,1,1,1}, m_editorFrames / 30.0));
|
||||
|
||||
m_rootView->draw(gfxQ);
|
||||
gfxQ->execute();
|
||||
@@ -277,8 +277,8 @@ bool ViewManager::proc()
|
||||
|
||||
void ViewManager::stop()
|
||||
{
|
||||
pshag::CElementGen::Shutdown();
|
||||
pshag::CLineRenderer::Shutdown();
|
||||
urde::CElementGen::Shutdown();
|
||||
urde::CLineRenderer::Shutdown();
|
||||
m_iconsToken.doDestroy();
|
||||
m_viewResources.destroyResData();
|
||||
m_fontCache.destroyAtlases();
|
||||
|
||||
Reference in New Issue
Block a user