mirror of https://github.com/AxioDL/metaforce.git
Aux-info resource sharing; some rigging stubs
This commit is contained in:
parent
806cd54b75
commit
5cd372592c
|
@ -6,9 +6,39 @@ namespace urde
|
||||||
{
|
{
|
||||||
static logvisor::Module Log("URDE::ProjectManager");
|
static logvisor::Module Log("URDE::ProjectManager");
|
||||||
|
|
||||||
|
CToken ProjectResourcePool::GetObj(char const* name)
|
||||||
|
{
|
||||||
|
CToken ret = CSimplePool::GetObj(name);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
hecl::ProjectPath path(*m_parent.project(), name);
|
||||||
|
SObjectTag tag = static_cast<ProjectResourceFactoryBase&>(x30_factory).
|
||||||
|
TagFromPath(path, hecl::SharedBlenderToken);
|
||||||
|
if (tag)
|
||||||
|
return CSimplePool::GetObj(tag);
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
CToken ProjectResourcePool::GetObj(char const* name, const CVParamTransfer& pvxfer)
|
||||||
|
{
|
||||||
|
CToken ret = CSimplePool::GetObj(name, pvxfer);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
hecl::ProjectPath path(*m_parent.project(), name);
|
||||||
|
SObjectTag tag = static_cast<ProjectResourceFactoryBase&>(x30_factory).
|
||||||
|
TagFromPath(path, hecl::SharedBlenderToken);
|
||||||
|
if (tag)
|
||||||
|
return CSimplePool::GetObj(tag, pvxfer);
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
bool ProjectManager::m_registeredSpecs = false;
|
bool ProjectManager::m_registeredSpecs = false;
|
||||||
ProjectManager::ProjectManager(ViewManager &vm)
|
ProjectManager::ProjectManager(ViewManager &vm)
|
||||||
: m_vm(vm), m_clientProc(1), m_factoryMP1(m_clientProc), m_objStore(m_factoryMP1)
|
: m_vm(vm), m_clientProc(1), m_factoryMP1(m_clientProc), m_objStore(m_factoryMP1, *this)
|
||||||
{
|
{
|
||||||
if (!m_registeredSpecs)
|
if (!m_registeredSpecs)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,6 +14,16 @@ class ViewManager;
|
||||||
using ConfigReader = athena::io::YAMLDocReader;
|
using ConfigReader = athena::io::YAMLDocReader;
|
||||||
using ConfigWriter = athena::io::YAMLDocWriter;
|
using ConfigWriter = athena::io::YAMLDocWriter;
|
||||||
|
|
||||||
|
class ProjectResourcePool : public CSimplePool
|
||||||
|
{
|
||||||
|
class ProjectManager& m_parent;
|
||||||
|
public:
|
||||||
|
ProjectResourcePool(IFactory& factory, ProjectManager& parent)
|
||||||
|
: CSimplePool(factory), m_parent(parent) {}
|
||||||
|
CToken GetObj(char const*);
|
||||||
|
CToken GetObj(char const*, const CVParamTransfer&);
|
||||||
|
};
|
||||||
|
|
||||||
class ProjectManager
|
class ProjectManager
|
||||||
{
|
{
|
||||||
ViewManager& m_vm;
|
ViewManager& m_vm;
|
||||||
|
@ -21,7 +31,7 @@ class ProjectManager
|
||||||
static bool m_registeredSpecs;
|
static bool m_registeredSpecs;
|
||||||
hecl::ClientProcess m_clientProc;
|
hecl::ClientProcess m_clientProc;
|
||||||
ProjectResourceFactoryMP1 m_factoryMP1;
|
ProjectResourceFactoryMP1 m_factoryMP1;
|
||||||
urde::CSimplePool m_objStore;
|
ProjectResourcePool m_objStore;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ProjectManager(ViewManager& vm);
|
ProjectManager(ViewManager& vm);
|
||||||
|
|
|
@ -82,6 +82,17 @@ void ProjectResourceFactoryBase::BackgroundIndexRecursiveCatalogs(const hecl::Pr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void WriteTag(athena::io::YAMLDocWriter& cacheWriter,
|
||||||
|
const SObjectTag& pathTag, const hecl::ProjectPath& path)
|
||||||
|
{
|
||||||
|
char idStr[9];
|
||||||
|
snprintf(idStr, 9, "%08X", uint32_t(pathTag.id));
|
||||||
|
cacheWriter.enterSubVector(idStr);
|
||||||
|
cacheWriter.writeString(nullptr, pathTag.type.toString().c_str());
|
||||||
|
cacheWriter.writeString(nullptr, path.getRelativePathUTF8().c_str());
|
||||||
|
cacheWriter.leaveSubVector();
|
||||||
|
}
|
||||||
|
|
||||||
void ProjectResourceFactoryBase::BackgroundIndexRecursiveProc(const hecl::ProjectPath& dir,
|
void ProjectResourceFactoryBase::BackgroundIndexRecursiveProc(const hecl::ProjectPath& dir,
|
||||||
athena::io::YAMLDocWriter& cacheWriter,
|
athena::io::YAMLDocWriter& cacheWriter,
|
||||||
athena::io::YAMLDocWriter& nameWriter,
|
athena::io::YAMLDocWriter& nameWriter,
|
||||||
|
@ -115,17 +126,34 @@ void ProjectResourceFactoryBase::BackgroundIndexRecursiveProc(const hecl::Projec
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lk(m_backgroundIndexMutex);
|
std::unique_lock<std::mutex> lk(m_backgroundIndexMutex);
|
||||||
m_tagToPath[pathTag] = path;
|
m_tagToPath[pathTag] = path;
|
||||||
char idStr[9];
|
WriteTag(cacheWriter, pathTag, path);
|
||||||
snprintf(idStr, 9, "%08X", uint32_t(pathTag.id));
|
|
||||||
cacheWriter.enterSubVector(idStr);
|
|
||||||
cacheWriter.writeString(nullptr, pathTag.type.toString().c_str());
|
|
||||||
cacheWriter.writeString(nullptr, path.getRelativePathUTF8().c_str());
|
|
||||||
cacheWriter.leaveSubVector();
|
|
||||||
#if 1
|
#if 1
|
||||||
fprintf(stderr, "%s %08X %s\n",
|
fprintf(stderr, "%s %08X %s\n",
|
||||||
pathTag.type.toString().c_str(), uint32_t(pathTag.id),
|
pathTag.type.toString().c_str(), uint32_t(pathTag.id),
|
||||||
path.getRelativePathUTF8().c_str());
|
path.getRelativePathUTF8().c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Special multi-resource intermediates */
|
||||||
|
if (pathTag.type == SBIG('CMDL'))
|
||||||
|
{
|
||||||
|
hecl::ProjectPath subPath(path, ".|skin");
|
||||||
|
SObjectTag pathTag = TagFromPath(subPath, m_backgroundBlender);
|
||||||
|
if (pathTag)
|
||||||
|
{
|
||||||
|
m_tagToPath[pathTag] = path;
|
||||||
|
WriteTag(cacheWriter, pathTag, path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (pathTag.type == SBIG('ANCS'))
|
||||||
|
{
|
||||||
|
hecl::ProjectPath subPath(path, ".|layout");
|
||||||
|
SObjectTag pathTag = TagFromPath(subPath, m_backgroundBlender);
|
||||||
|
if (pathTag)
|
||||||
|
{
|
||||||
|
m_tagToPath[pathTag] = path;
|
||||||
|
WriteTag(cacheWriter, pathTag, path);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ namespace urde
|
||||||
|
|
||||||
class ProjectResourceFactoryBase : public urde::IFactory
|
class ProjectResourceFactoryBase : public urde::IFactory
|
||||||
{
|
{
|
||||||
|
friend class ProjectResourcePool;
|
||||||
hecl::ClientProcess& m_clientProc;
|
hecl::ClientProcess& m_clientProc;
|
||||||
protected:
|
protected:
|
||||||
std::unordered_map<urde::SObjectTag, hecl::ProjectPath> m_tagToPath;
|
std::unordered_map<urde::SObjectTag, hecl::ProjectPath> m_tagToPath;
|
||||||
|
|
|
@ -47,8 +47,16 @@ SObjectTag ProjectResourceFactoryMP1::TagFromPath(const hecl::ProjectPath& path,
|
||||||
switch (conn.getBlendType())
|
switch (conn.getBlendType())
|
||||||
{
|
{
|
||||||
case hecl::BlenderConnection::BlendType::Mesh:
|
case hecl::BlenderConnection::BlendType::Mesh:
|
||||||
|
if (!path.getAuxInfo().compare(_S("skin")))
|
||||||
|
{
|
||||||
|
if (!conn.getRigged())
|
||||||
|
return {};
|
||||||
|
return {SBIG('CSKR'), path.hash().val32()};
|
||||||
|
}
|
||||||
return {SBIG('CMDL'), path.hash().val32()};
|
return {SBIG('CMDL'), path.hash().val32()};
|
||||||
case hecl::BlenderConnection::BlendType::Actor:
|
case hecl::BlenderConnection::BlendType::Actor:
|
||||||
|
if (!path.getAuxInfo().compare(_S("layout")))
|
||||||
|
return {SBIG('CINF'), path.hash().val32()};
|
||||||
return {SBIG('ANCS'), path.hash().val32()};
|
return {SBIG('ANCS'), path.hash().val32()};
|
||||||
case hecl::BlenderConnection::BlendType::Area:
|
case hecl::BlenderConnection::BlendType::Area:
|
||||||
return {SBIG('MREA'), path.hash().val32()};
|
return {SBIG('MREA'), path.hash().val32()};
|
||||||
|
|
|
@ -20,7 +20,8 @@ namespace urde
|
||||||
|
|
||||||
void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
|
void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
|
||||||
{
|
{
|
||||||
m_modelTest = objStore.GetObj("CMDL_GameCube");
|
m_modelTest = objStore.GetObj("MP1/SamusGun/CMDL_0EF58656.blend");
|
||||||
|
//m_modelTest = objStore.GetObj("CMDL_GameCube");
|
||||||
m_modelTest.Lock();
|
m_modelTest.Lock();
|
||||||
|
|
||||||
//m_partGenDesc = objStore.GetObj({hecl::FOURCC('PART'), 0x972A5CD2});
|
//m_partGenDesc = objStore.GetObj({hecl::FOURCC('PART'), 0x972A5CD2});
|
||||||
|
@ -67,8 +68,9 @@ void ViewManager::ParticleView::draw(boo::IGraphicsCommandQueue *gfxQ)
|
||||||
flags.m_extendedShaderIdx = 1;
|
flags.m_extendedShaderIdx = 1;
|
||||||
|
|
||||||
m_theta += 0.01f;
|
m_theta += 0.01f;
|
||||||
CGraphics::SetModelMatrix(zeus::CTransform::RotateZ(m_theta));
|
CGraphics::SetModelMatrix(zeus::CTransform::RotateZ(m_theta) * zeus::CTransform::Scale(10.f));
|
||||||
CGraphics::SetViewPointMatrix(zeus::CTransform::Identity() + zeus::CVector3f(0.f, -10.f, 0.f));
|
//CGraphics::SetModelMatrix(zeus::CTransform::Identity());
|
||||||
|
CGraphics::SetViewPointMatrix(zeus::lookAt(zeus::CVector3f{0.f, -10.f, 4.f}, {0.f, 0.f, 0.f}));
|
||||||
boo::SWindowRect windowRect = m_vm.m_mainWindow->getWindowFrame();
|
boo::SWindowRect windowRect = m_vm.m_mainWindow->getWindowFrame();
|
||||||
float aspect = windowRect.size[0] / float(windowRect.size[1]);
|
float aspect = windowRect.size[0] / float(windowRect.size[1]);
|
||||||
CGraphics::SetPerspective(55.0, aspect, 0.001f, 1000.f);
|
CGraphics::SetPerspective(55.0, aspect, 0.001f, 1000.f);
|
||||||
|
|
|
@ -38,6 +38,8 @@ CToken CSimplePool::GetObj(char const* resourceName)
|
||||||
CToken CSimplePool::GetObj(char const* resourceName, const CVParamTransfer& paramXfer)
|
CToken CSimplePool::GetObj(char const* resourceName, const CVParamTransfer& paramXfer)
|
||||||
{
|
{
|
||||||
const SObjectTag* tag = x30_factory.GetResourceIdByName(resourceName);
|
const SObjectTag* tag = x30_factory.GetResourceIdByName(resourceName);
|
||||||
|
if (!tag)
|
||||||
|
return {};
|
||||||
return GetObj(*tag, paramXfer);
|
return GetObj(*tag, paramXfer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ class CObjectReference;
|
||||||
|
|
||||||
class CSimplePool : public IObjectStore
|
class CSimplePool : public IObjectStore
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
std::list<std::pair<SObjectTag, CObjectReference*>> x4_resources;
|
std::list<std::pair<SObjectTag, CObjectReference*>> x4_resources;
|
||||||
//std::unordered_map<SObjectTag, CObjectReference*> x4_resources;
|
//std::unordered_map<SObjectTag, CObjectReference*> x4_resources;
|
||||||
IFactory& x30_factory;
|
IFactory& x30_factory;
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#ifndef __PSHAG_CCHARLAYOUTINFO_HPP__
|
||||||
|
#define __PSHAG_CCHARLAYOUTINFO_HPP__
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
class CCharLayoutInfo
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __PSHAG_CCHARLAYOUTINFO_HPP__
|
|
@ -9,4 +9,7 @@ add_library(RuntimeCommonCharacter
|
||||||
CAnimationDatabaseGame.hpp
|
CAnimationDatabaseGame.hpp
|
||||||
CTransitionDatabase.hpp
|
CTransitionDatabase.hpp
|
||||||
CTransitionDatabaseGame.hpp
|
CTransitionDatabaseGame.hpp
|
||||||
CHierarchyPoseBuilder.hpp CHierarchyPoseBuilder.cpp)
|
CHierarchyPoseBuilder.hpp CHierarchyPoseBuilder.cpp
|
||||||
|
CPoseAsTransforms.hpp CPoseAsTransforms.cpp
|
||||||
|
CSkinRules.hpp CSkinRules.cpp
|
||||||
|
CVirtualBone.hpp CVirtualBone.cpp)
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#ifndef __PSHAG_CPOSEASTRANSFORMS_HPP__
|
||||||
|
#define __PSHAG_CPOSEASTRANSFORMS_HPP__
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
class CPoseAsTransforms
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __PSHAG_CPOSEASTRANSFORMS_HPP__
|
|
@ -0,0 +1,13 @@
|
||||||
|
#ifndef __PSHAG_CSKINRULES_HPP__
|
||||||
|
#define __PSHAG_CSKINRULES_HPP__
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
class CSkinRules
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __PSHAG_CSKINRULES_HPP__
|
|
@ -0,0 +1,11 @@
|
||||||
|
#include "CVirtualBone.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
CVirtualBone::CVirtualBone(CInputStream& in)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef __PSHAG_CVIRTUALBONE_HPP__
|
||||||
|
#define __PSHAG_CVIRTUALBONE_HPP__
|
||||||
|
|
||||||
|
#include "IOStreams.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
class CVirtualBone
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CVirtualBone(CInputStream& in);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __PSHAG_CVIRTUALBONE_HPP__
|
|
@ -365,6 +365,31 @@ void CGraphics::SetViewportResolution(const zeus::CVector2i& res)
|
||||||
g_ViewportResolutionHalf = {res.x / 2, res.y / 2};
|
g_ViewportResolutionHalf = {res.x / 2, res.y / 2};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boo::SWindowRect CachedVP;
|
||||||
|
static float CachedDepthRange[2] = {0.f, 1.f};
|
||||||
|
|
||||||
|
void CGraphics::SetViewport(int leftOff, int bottomOff, int width, int height)
|
||||||
|
{
|
||||||
|
CachedVP.location[0] = leftOff;
|
||||||
|
CachedVP.location[1] = bottomOff;
|
||||||
|
CachedVP.size[0] = width;
|
||||||
|
CachedVP.size[1] = height;
|
||||||
|
g_BooMainCommandQueue->setViewport(CachedVP, CachedDepthRange[0], CachedDepthRange[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGraphics::SetScissor(int leftOff, int bottomOff, int width, int height)
|
||||||
|
{
|
||||||
|
boo::SWindowRect rect(leftOff, bottomOff, width, height);
|
||||||
|
g_BooMainCommandQueue->setScissor(rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGraphics::SetDepthRange(float znear, float zfar)
|
||||||
|
{
|
||||||
|
CachedDepthRange[0] = znear;
|
||||||
|
CachedDepthRange[1] = zfar;
|
||||||
|
g_BooMainCommandQueue->setViewport(CachedVP, CachedDepthRange[0], CachedDepthRange[1]);
|
||||||
|
}
|
||||||
|
|
||||||
CTimeProvider* CGraphics::g_ExternalTimeProvider = nullptr;
|
CTimeProvider* CGraphics::g_ExternalTimeProvider = nullptr;
|
||||||
float CGraphics::g_DefaultSeconds;
|
float CGraphics::g_DefaultSeconds;
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,11 @@ public:
|
||||||
static SClipScreenRect ClipScreenRectFromMS(const zeus::CVector3f& p1, const zeus::CVector3f& p2);
|
static SClipScreenRect ClipScreenRectFromMS(const zeus::CVector3f& p1, const zeus::CVector3f& p2);
|
||||||
static SClipScreenRect ClipScreenRectFromVS(const zeus::CVector3f& p1, const zeus::CVector3f& p2);
|
static SClipScreenRect ClipScreenRectFromVS(const zeus::CVector3f& p1, const zeus::CVector3f& p2);
|
||||||
static zeus::CVector3f ProjectModelPointToViewportSpace(const zeus::CVector3f& point);
|
static zeus::CVector3f ProjectModelPointToViewportSpace(const zeus::CVector3f& point);
|
||||||
|
|
||||||
static void SetViewportResolution(const zeus::CVector2i& res);
|
static void SetViewportResolution(const zeus::CVector2i& res);
|
||||||
|
static void SetViewport(int leftOff, int bottomOff, int width, int height);
|
||||||
|
static void SetScissor(int leftOff, int bottomOff, int width, int height);
|
||||||
|
static void SetDepthRange(float near, float far);
|
||||||
|
|
||||||
static CTimeProvider* g_ExternalTimeProvider;
|
static CTimeProvider* g_ExternalTimeProvider;
|
||||||
static float g_DefaultSeconds;
|
static float g_DefaultSeconds;
|
||||||
|
|
|
@ -15,7 +15,9 @@ add_library(RuntimeCommonGraphics
|
||||||
CLight.hpp CLight.cpp
|
CLight.hpp CLight.cpp
|
||||||
CTexture.hpp CTextureBoo.cpp
|
CTexture.hpp CTextureBoo.cpp
|
||||||
CModel.hpp CModelBoo.cpp
|
CModel.hpp CModelBoo.cpp
|
||||||
|
CSkinnedModel.hpp CSkinnedModel.cpp
|
||||||
CModelShaders.hpp CModelShadersGLSL.cpp
|
CModelShaders.hpp CModelShadersGLSL.cpp
|
||||||
|
CVertexMorphEffect.hpp CVertexMorphEffect.cpp
|
||||||
CMoviePlayer.hpp CMoviePlayer.cpp
|
CMoviePlayer.hpp CMoviePlayer.cpp
|
||||||
CGraphicsPalette.hpp CGraphicsPalette.cpp
|
CGraphicsPalette.hpp CGraphicsPalette.cpp
|
||||||
CGraphics.hpp CGraphics.cpp
|
CGraphics.hpp CGraphics.cpp
|
||||||
|
|
|
@ -76,7 +76,6 @@ private:
|
||||||
CBooSurface* x3c_firstSortedSurface = nullptr;
|
CBooSurface* x3c_firstSortedSurface = nullptr;
|
||||||
bool x40_24_texturesLoaded : 1;
|
bool x40_24_texturesLoaded : 1;
|
||||||
bool x40_25_ : 1;
|
bool x40_25_ : 1;
|
||||||
u8 x41_shortNormals;
|
|
||||||
|
|
||||||
struct UVAnimationBuffer
|
struct UVAnimationBuffer
|
||||||
{
|
{
|
||||||
|
@ -103,8 +102,7 @@ private:
|
||||||
public:
|
public:
|
||||||
CBooModel(std::vector<CBooSurface>* surfaces, SShader& shader,
|
CBooModel(std::vector<CBooSurface>* surfaces, SShader& shader,
|
||||||
boo::IVertexFormat* vtxFmt, boo::IGraphicsBufferS* vbo, boo::IGraphicsBufferS* ibo,
|
boo::IVertexFormat* vtxFmt, boo::IGraphicsBufferS* vbo, boo::IGraphicsBufferS* ibo,
|
||||||
size_t weightVecCount, size_t skinBankCount, const zeus::CAABox& aabb,
|
size_t weightVecCount, size_t skinBankCount, const zeus::CAABox& aabb);
|
||||||
u8 shortNormals, bool texturesLoaded);
|
|
||||||
|
|
||||||
static void MakeTexuresFromMats(const MaterialSet& matSet,
|
static void MakeTexuresFromMats(const MaterialSet& matSet,
|
||||||
std::vector<TCachedToken<CTexture>>& toksOut,
|
std::vector<TCachedToken<CTexture>>& toksOut,
|
||||||
|
@ -129,8 +127,9 @@ public:
|
||||||
|
|
||||||
class CModel
|
class CModel
|
||||||
{
|
{
|
||||||
std::unique_ptr<u8[]> x0_data;
|
//std::unique_ptr<u8[]> x0_data;
|
||||||
u32 x4_dataLen;
|
//u32 x4_dataLen;
|
||||||
|
zeus::CAABox m_aabb;
|
||||||
std::vector<CBooSurface> x8_surfaces;
|
std::vector<CBooSurface> x8_surfaces;
|
||||||
std::vector<CBooModel::SShader> x18_matSets;
|
std::vector<CBooModel::SShader> x18_matSets;
|
||||||
std::unique_ptr<CBooModel> x28_modelInst;
|
std::unique_ptr<CBooModel> x28_modelInst;
|
||||||
|
@ -156,6 +155,7 @@ public:
|
||||||
bool IsLoaded(int shaderIdx) const;
|
bool IsLoaded(int shaderIdx) const;
|
||||||
|
|
||||||
CBooModel& GetInstance() {return *x28_modelInst;}
|
CBooModel& GetInstance() {return *x28_modelInst;}
|
||||||
|
std::unique_ptr<CBooModel> MakeNewInstance(int shaderIdx);
|
||||||
};
|
};
|
||||||
|
|
||||||
CFactoryFnReturn FModelFactory(const urde::SObjectTag& tag,
|
CFactoryFnReturn FModelFactory(const urde::SObjectTag& tag,
|
||||||
|
|
|
@ -16,12 +16,11 @@ static std::experimental::optional<CModelShaders> g_ModelShaders;
|
||||||
|
|
||||||
CBooModel::CBooModel(std::vector<CBooSurface>* surfaces, SShader& shader,
|
CBooModel::CBooModel(std::vector<CBooSurface>* surfaces, SShader& shader,
|
||||||
boo::IVertexFormat* vtxFmt, boo::IGraphicsBufferS* vbo, boo::IGraphicsBufferS* ibo,
|
boo::IVertexFormat* vtxFmt, boo::IGraphicsBufferS* vbo, boo::IGraphicsBufferS* ibo,
|
||||||
size_t weightVecCount, size_t skinBankCount, const zeus::CAABox& aabb, u8 shortNormals,
|
size_t weightVecCount, size_t skinBankCount, const zeus::CAABox& aabb)
|
||||||
bool texturesLoaded)
|
|
||||||
: x0_surfaces(surfaces), x4_matSet(&shader.m_matSet), m_pipelines(&shader.m_shaders),
|
: x0_surfaces(surfaces), x4_matSet(&shader.m_matSet), m_pipelines(&shader.m_shaders),
|
||||||
m_vtxFmt(vtxFmt), x8_vbo(vbo), xc_ibo(ibo), m_weightVecCount(weightVecCount),
|
m_vtxFmt(vtxFmt), x8_vbo(vbo), xc_ibo(ibo), m_weightVecCount(weightVecCount),
|
||||||
m_skinBankCount(skinBankCount), x1c_textures(&shader.x0_textures), x20_aabb(aabb),
|
m_skinBankCount(skinBankCount), x1c_textures(&shader.x0_textures), x20_aabb(aabb),
|
||||||
x40_24_texturesLoaded(texturesLoaded), x40_25_(0), x41_shortNormals(shortNormals)
|
x40_24_texturesLoaded(false), x40_25_(0)
|
||||||
{
|
{
|
||||||
for (CBooSurface& surf : *x0_surfaces)
|
for (CBooSurface& surf : *x0_surfaces)
|
||||||
surf.m_parent = this;
|
surf.m_parent = this;
|
||||||
|
@ -502,19 +501,28 @@ static const u8* MemoryFromPartData(const u8*& dataCur, const s32*& secSizeCur)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CModel::CModel(std::unique_ptr<u8[]>&& in, u32 dataLen, IObjectStore* store)
|
std::unique_ptr<CBooModel> CModel::MakeNewInstance(int shaderIdx)
|
||||||
: x0_data(std::move(in)), x4_dataLen(dataLen)
|
|
||||||
{
|
{
|
||||||
u32 version = hecl::SBig(*reinterpret_cast<u32*>(x0_data.get() + 0x4));
|
if (shaderIdx >= x18_matSets.size())
|
||||||
u32 flags = hecl::SBig(*reinterpret_cast<u32*>(x0_data.get() + 0x8));
|
shaderIdx = 0;
|
||||||
|
return std::make_unique<CBooModel>(&x8_surfaces, x18_matSets[shaderIdx],
|
||||||
|
m_vtxFmt, m_vbo, m_ibo, 0, 0, m_aabb);
|
||||||
|
}
|
||||||
|
|
||||||
|
CModel::CModel(std::unique_ptr<u8[]>&& in, u32 /* dataLen */, IObjectStore* store)
|
||||||
|
{
|
||||||
|
std::unique_ptr<u8[]> data = std::move(in);
|
||||||
|
|
||||||
|
u32 version = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x4));
|
||||||
|
u32 flags = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x8));
|
||||||
if (version != 0x10002)
|
if (version != 0x10002)
|
||||||
Log.report(logvisor::Fatal, "invalid CMDL for loading with boo");
|
Log.report(logvisor::Fatal, "invalid CMDL for loading with boo");
|
||||||
|
|
||||||
u32 secCount = hecl::SBig(*reinterpret_cast<u32*>(x0_data.get() + 0x24));
|
u32 secCount = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x24));
|
||||||
u32 matSetCount = hecl::SBig(*reinterpret_cast<u32*>(x0_data.get() + 0x28));
|
u32 matSetCount = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x28));
|
||||||
x18_matSets.reserve(matSetCount);
|
x18_matSets.reserve(matSetCount);
|
||||||
const u8* dataCur = x0_data.get() + ROUND_UP_32(0x2c + secCount * 4);
|
const u8* dataCur = data.get() + ROUND_UP_32(0x2c + secCount * 4);
|
||||||
const s32* secSizeCur = reinterpret_cast<const s32*>(x0_data.get() + 0x2c);
|
const s32* secSizeCur = reinterpret_cast<const s32*>(data.get() + 0x2c);
|
||||||
for (u32 i=0 ; i<matSetCount ; ++i)
|
for (u32 i=0 ; i<matSetCount ; ++i)
|
||||||
{
|
{
|
||||||
u32 matSetSz = hecl::SBig(*secSizeCur);
|
u32 matSetSz = hecl::SBig(*secSizeCur);
|
||||||
|
@ -573,12 +581,10 @@ CModel::CModel(std::unique_ptr<u8[]>&& in, u32 dataLen, IObjectStore* store)
|
||||||
surf.m_data.read(r);
|
surf.m_data.read(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
const float* aabbPtr = reinterpret_cast<const float*>(x0_data.get() + 0xc);
|
const float* aabbPtr = reinterpret_cast<const float*>(data.get() + 0xc);
|
||||||
zeus::CAABox aabb(hecl::SBig(aabbPtr[0]), hecl::SBig(aabbPtr[1]), hecl::SBig(aabbPtr[2]),
|
m_aabb = zeus::CAABox(hecl::SBig(aabbPtr[0]), hecl::SBig(aabbPtr[1]), hecl::SBig(aabbPtr[2]),
|
||||||
hecl::SBig(aabbPtr[3]), hecl::SBig(aabbPtr[4]), hecl::SBig(aabbPtr[5]));
|
hecl::SBig(aabbPtr[3]), hecl::SBig(aabbPtr[4]), hecl::SBig(aabbPtr[5]));
|
||||||
x28_modelInst = std::make_unique<CBooModel>(&x8_surfaces, x18_matSets[0],
|
x28_modelInst = MakeNewInstance(0);
|
||||||
m_vtxFmt, m_vbo, m_ibo, 0, 0,
|
|
||||||
aabb, flags & 0x2, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBooModel::SShader::UnlockTextures()
|
void CBooModel::SShader::UnlockTextures()
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
#include "CSkinnedModel.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
CSkinnedModel::CSkinnedModel(const TLockedToken<CModel>& model,
|
||||||
|
const TLockedToken<CSkinRules>& skinRules,
|
||||||
|
const TLockedToken<CCharLayoutInfo>& layoutInfo)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSkinnedModel::Calculate(const CPoseAsTransforms& pose,
|
||||||
|
const std::experimental::optional<CVertexMorphEffect>&)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
#ifndef __PSHAG_CSKINNEDMODEL_HPP__
|
||||||
|
#define __PSHAG_CSKINNEDMODEL_HPP__
|
||||||
|
|
||||||
|
#include "CToken.hpp"
|
||||||
|
#include "CModel.hpp"
|
||||||
|
#include "optional.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
class CModel;
|
||||||
|
class CSkinRules;
|
||||||
|
class CCharLayoutInfo;
|
||||||
|
class CPoseAsTransforms;
|
||||||
|
class CVertexMorphEffect;
|
||||||
|
class IObjectStore;
|
||||||
|
|
||||||
|
class CSkinnedModel
|
||||||
|
{
|
||||||
|
std::unique_ptr<CBooModel> m_modelInst;
|
||||||
|
public:
|
||||||
|
CSkinnedModel(const TLockedToken<CModel>& model,
|
||||||
|
const TLockedToken<CSkinRules>& skinRules,
|
||||||
|
const TLockedToken<CCharLayoutInfo>& layoutInfo);
|
||||||
|
CSkinnedModel(IObjectStore& store, TResId model, TResId skinRules, TResId layoutInfo);
|
||||||
|
|
||||||
|
void Calculate(const CPoseAsTransforms& pose, const std::experimental::optional<CVertexMorphEffect>&);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __PSHAG_CSKINNEDMODEL_HPP__
|
|
@ -0,0 +1,13 @@
|
||||||
|
#ifndef __PSHAG_CVERTEXMORPHEFFECT_HPP__
|
||||||
|
#define __PSHAG_CVERTEXMORPHEFFECT_HPP__
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
class CVertexMorphEffect
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __PSHAG_CVERTEXMORPHEFFECT_HPP__
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit a50a7ac3685ebaf5bd5c7a5c31493710a8f8f125
|
Subproject commit 97a5fb2af2b16283af8c9bb619111a49d2869c7d
|
2
specter
2
specter
|
@ -1 +1 @@
|
||||||
Subproject commit a8ae3714d2983d9faa9123151d71259c1fb9e111
|
Subproject commit ff3410b26607bca871dc15e464235c67b47770a2
|
Loading…
Reference in New Issue