mirror of https://github.com/AxioDL/metaforce.git
CModelData imps
This commit is contained in:
parent
f6c35bfc9b
commit
8608b52774
|
@ -5,6 +5,7 @@
|
|||
namespace urde
|
||||
{
|
||||
static logvisor::Module Log("URDE::ProjectManager");
|
||||
ProjectManager* ProjectManager::g_SharedManager = nullptr;
|
||||
|
||||
CToken ProjectResourcePool::GetObj(const char* name)
|
||||
{
|
||||
|
@ -45,6 +46,7 @@ ProjectManager::ProjectManager(ViewManager &vm)
|
|||
HECLRegisterDataSpecs();
|
||||
m_registeredSpecs = true;
|
||||
}
|
||||
g_SharedManager = this;
|
||||
}
|
||||
|
||||
bool ProjectManager::newProject(const hecl::SystemString& path)
|
||||
|
|
|
@ -34,10 +34,13 @@ class ProjectManager
|
|||
ProjectResourcePool m_objStore;
|
||||
|
||||
public:
|
||||
static ProjectManager* g_SharedManager;
|
||||
ProjectManager(ViewManager& vm);
|
||||
operator bool() const {return m_proj.operator bool();}
|
||||
|
||||
hecl::Database::Project* project() {return m_proj.get();}
|
||||
ProjectResourcePool& objectStore() {return m_objStore;}
|
||||
ProjectResourceFactoryMP1& resourceFactoryMP1() {return m_factoryMP1;}
|
||||
|
||||
bool newProject(const hecl::SystemString& path);
|
||||
bool openProject(const hecl::SystemString& path);
|
||||
|
|
|
@ -609,6 +609,33 @@ const urde::SObjectTag* ProjectResourceFactoryBase::GetResourceIdByName(const ch
|
|||
return &search->second;
|
||||
}
|
||||
|
||||
FourCC ProjectResourceFactoryBase::GetResourceTypeById(ResId id) const
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(((ProjectResourceFactoryBase*)this)->m_backgroundIndexMutex);
|
||||
SObjectTag searchTag = {FourCC(), id};
|
||||
auto search = m_tagToPath.find(searchTag);
|
||||
if (search == m_tagToPath.end())
|
||||
{
|
||||
if (m_backgroundRunning)
|
||||
{
|
||||
while (m_backgroundRunning)
|
||||
{
|
||||
lk.unlock();
|
||||
lk.lock();
|
||||
search = m_tagToPath.find(searchTag);
|
||||
if (search != m_tagToPath.end())
|
||||
break;
|
||||
}
|
||||
if (search == m_tagToPath.end())
|
||||
return {};
|
||||
}
|
||||
else
|
||||
return {};
|
||||
}
|
||||
|
||||
return search->first.type;
|
||||
}
|
||||
|
||||
void ProjectResourceFactoryBase::AsyncIdle()
|
||||
{
|
||||
/* Consume completed transactions, they will be processed this cycle at the latest */
|
||||
|
|
|
@ -93,6 +93,7 @@ public:
|
|||
void CancelBuild(const urde::SObjectTag&);
|
||||
bool CanBuild(const urde::SObjectTag&);
|
||||
const urde::SObjectTag* GetResourceIdByName(const char*) const;
|
||||
FourCC GetResourceTypeById(ResId id) const;
|
||||
|
||||
void AsyncIdle();
|
||||
void Shutdown() {CancelBackgroundIndex();}
|
||||
|
|
|
@ -46,6 +46,11 @@ public:
|
|||
return x4_loader.GetResourceIdByName(name);
|
||||
}
|
||||
|
||||
FourCC GetResourceTypeById(ResId id) const
|
||||
{
|
||||
return x4_loader.GetResourceTypeById(id);
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::string, SObjectTag>> GetResourceIdToNameList() const
|
||||
{
|
||||
std::vector<std::pair<std::string, SObjectTag>> retval;
|
||||
|
|
|
@ -131,7 +131,7 @@ bool CResLoader::ResourceExists(const SObjectTag& tag)
|
|||
return FindResource(tag.id);
|
||||
}
|
||||
|
||||
FourCC CResLoader::GetResourceTypeById(u32 id)
|
||||
FourCC CResLoader::GetResourceTypeById(u32 id) const
|
||||
{
|
||||
if (FindResource(id))
|
||||
return x50_cachedResInfo->x0_type;
|
||||
|
@ -170,10 +170,10 @@ void CResLoader::AsyncIdlePakLoading()
|
|||
}
|
||||
}
|
||||
|
||||
bool CResLoader::FindResource(u32 id)
|
||||
bool CResLoader::FindResource(u32 id) const
|
||||
{
|
||||
for (const std::unique_ptr<CPakFile>& file : x1c_pakLoadedList)
|
||||
if (CacheFromPak(*file, id))
|
||||
if (((CResLoader*)this)->CacheFromPak(*file, id))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -34,11 +34,11 @@ public:
|
|||
bool GetResourceCompression(const SObjectTag& tag);
|
||||
u32 ResourceSize(const SObjectTag& tag);
|
||||
bool ResourceExists(const SObjectTag& tag);
|
||||
FourCC GetResourceTypeById(u32 id);
|
||||
FourCC GetResourceTypeById(u32 id) const;
|
||||
const SObjectTag* GetResourceIdByName(const char* name) const;
|
||||
bool AreAllPaksLoaded() const;
|
||||
void AsyncIdlePakLoading();
|
||||
bool FindResource(u32 id);
|
||||
bool FindResource(u32 id) const;
|
||||
CPakFile* FindResourceForLoad(u32 id);
|
||||
CPakFile* FindResourceForLoad(const SObjectTag& tag);
|
||||
bool CacheFromPakForLoad(CPakFile& file, u32 id);
|
||||
|
|
|
@ -14,12 +14,15 @@ class CWorldTransManager;
|
|||
|
||||
class CStateManager
|
||||
{
|
||||
std::shared_ptr<CPlayerState> x8b8_playerState;
|
||||
public:
|
||||
CStateManager(const std::weak_ptr<CScriptMailbox>&,
|
||||
const std::weak_ptr<CMapWorldInfo>&,
|
||||
const std::weak_ptr<CPlayerState>&,
|
||||
const std::weak_ptr<CWorldTransManager>&);
|
||||
|
||||
const std::shared_ptr<CPlayerState> GetPlayerState() const {return x8b8_playerState;}
|
||||
|
||||
void GetObjectListById() const
|
||||
{
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef __URDE_CACTORLIGHTS_HPP__
|
||||
#define __URDE_CACTORLIGHTS_HPP__
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CActorLights
|
||||
{
|
||||
public:
|
||||
void ActivateLights() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CACTORLIGHTS_HPP__
|
|
@ -5,6 +5,7 @@
|
|||
#include "CCharacterFactory.hpp"
|
||||
#include "CAnimationManager.hpp"
|
||||
#include "CTransitionManager.hpp"
|
||||
#include "IAnimReader.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -17,7 +18,7 @@ void CAnimData::InitializeCache()
|
|||
{
|
||||
}
|
||||
|
||||
CAnimData::CAnimData(TResId id, const CCharacterInfo& character, int a, int b, bool c,
|
||||
CAnimData::CAnimData(ResId id, const CCharacterInfo& character, int a, int b, bool c,
|
||||
const TLockedToken<CCharLayoutInfo>& layout,
|
||||
const TToken<CSkinnedModel>& model,
|
||||
const std::weak_ptr<CAnimSysContext>& ctx,
|
||||
|
@ -34,13 +35,13 @@ CAnimData::CAnimData(TResId id, const CCharacterInfo& character, int a, int b, b
|
|||
x1fc_transMgr(transMgr),
|
||||
x204_b(b),
|
||||
x208_a(a),
|
||||
x21c_25_c(c),
|
||||
x21c_25_loop(c),
|
||||
x220_pose(layout->GetSegIdList().GetList().size()),
|
||||
x2f8_poseBuilder(layout)
|
||||
{
|
||||
}
|
||||
|
||||
TResId CAnimData::GetEventResourceIdForAnimResourceId(TResId) const
|
||||
ResId CAnimData::GetEventResourceIdForAnimResourceId(ResId) const
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -88,7 +89,8 @@ void CAnimData::Touch(const CSkinnedModel& model, int) const
|
|||
{
|
||||
}
|
||||
|
||||
zeus::CVector3f CAnimData::GetAdvancementDeltas(const CCharAnimTime& a, const CCharAnimTime& b) const
|
||||
SAdvancementDeltas CAnimData::GetAdvancementDeltas(const CCharAnimTime& a,
|
||||
const CCharAnimTime& b) const
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -185,11 +187,11 @@ void CAnimData::DoAdvance(float, bool&, CRandom16&, bool)
|
|||
{
|
||||
}
|
||||
|
||||
void CAnimData::Advance(float, const zeus::CVector3f&, CStateManager& stateMgr, bool)
|
||||
SAdvancementDeltas CAnimData::Advance(float, const zeus::CVector3f&, CStateManager& stateMgr, bool)
|
||||
{
|
||||
}
|
||||
|
||||
void CAnimData::AdvanceIgnoreParticles(float, CRandom16&, bool)
|
||||
SAdvancementDeltas CAnimData::AdvanceIgnoreParticles(float, CRandom16&, bool)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -35,9 +35,11 @@ class CSkinRules;
|
|||
class CAnimTreeNode;
|
||||
class CSegIdList;
|
||||
class CSegStatementSet;
|
||||
struct SAdvancementDeltas;
|
||||
|
||||
class CAnimData
|
||||
{
|
||||
friend class CModelData;
|
||||
TLockedToken<CCharacterFactory> x0_charFactory;
|
||||
CCharacterInfo xc_charInfo;
|
||||
TLockedToken<CCharLayoutInfo> xcc_layoutData;
|
||||
|
@ -50,7 +52,7 @@ class CAnimData
|
|||
u32 x104_ = 0;
|
||||
zeus::CAABox x108_aabb;
|
||||
CParticleDatabase x120_particleDB;
|
||||
TResId x1d8_selfId;
|
||||
ResId x1d8_selfId;
|
||||
zeus::CVector3f x1dc_;
|
||||
zeus::CQuaternion x1e8_;
|
||||
std::shared_ptr<IMetaAnim> x1f8_animRoot;
|
||||
|
@ -69,8 +71,8 @@ class CAnimData
|
|||
u32 x21c_flags = 0;
|
||||
struct
|
||||
{
|
||||
bool x21c_24_ : 1;
|
||||
bool x21c_25_c : 1;
|
||||
bool x21c_24_animating : 1;
|
||||
bool x21c_25_loop : 1;
|
||||
bool x21c_26_ : 1;
|
||||
bool x21c_27_ : 1;
|
||||
bool x21c_28_ : 1;
|
||||
|
@ -96,7 +98,7 @@ class CAnimData
|
|||
u32 x1044_ = 0;
|
||||
|
||||
public:
|
||||
CAnimData(TResId, const CCharacterInfo& character, int a, int b, bool c,
|
||||
CAnimData(ResId, const CCharacterInfo& character, int a, int b, bool c,
|
||||
const TLockedToken<CCharLayoutInfo>& layout,
|
||||
const TToken<CSkinnedModel>& model,
|
||||
const std::weak_ptr<CAnimSysContext>& ctx,
|
||||
|
@ -104,7 +106,7 @@ public:
|
|||
const std::shared_ptr<CTransitionManager>& transMgr,
|
||||
const TLockedToken<CCharacterFactory>& charFactory);
|
||||
|
||||
TResId GetEventResourceIdForAnimResourceId(TResId) const;
|
||||
ResId GetEventResourceIdForAnimResourceId(ResId) const;
|
||||
void AddAdditiveSegData(const CSegIdList& list, CSegStatementSet& stSet);
|
||||
void AdvanceAdditiveAnims(float);
|
||||
void UpdateAdditiveAnims(float);
|
||||
|
@ -115,8 +117,8 @@ public:
|
|||
void AddAdditiveAnimation(u32, float, bool, bool);
|
||||
std::shared_ptr<CAnimationManager> GetAnimationManager();
|
||||
void SetPhase(float);
|
||||
void Touch(const CSkinnedModel& model, int) const;
|
||||
zeus::CVector3f GetAdvancementDeltas(const CCharAnimTime& a, const CCharAnimTime& b) const;
|
||||
void Touch(const CSkinnedModel& model, int shaderIdx) const;
|
||||
SAdvancementDeltas GetAdvancementDeltas(const CCharAnimTime& a, const CCharAnimTime& b) const;
|
||||
CCharAnimTime GetTimeOfUserEvent(EUserEventType, const CCharAnimTime& time) const;
|
||||
void MultiplyPlaybackRate(float);
|
||||
void SetPlaybackRate(float);
|
||||
|
@ -128,6 +130,9 @@ public:
|
|||
bool IsAnimTimeRemaining(float, const std::string& name) const;
|
||||
float GetAnimTimeRemaining(const std::string& name) const;
|
||||
float GetAnimationDuration(int) const;
|
||||
bool GetIsLoop() const {return x21c_25_loop;}
|
||||
void EnableLooping(bool val) {x21c_25_loop = val; x21c_24_animating = true;}
|
||||
bool IsAnimating() const {return x21c_24_animating;}
|
||||
std::shared_ptr<CAnimSysContext> GetAnimSysContext() const;
|
||||
std::shared_ptr<CAnimationManager> GetAnimationManager() const;
|
||||
void RecalcPoseBuilder(const CCharAnimTime*) const;
|
||||
|
@ -144,8 +149,8 @@ public:
|
|||
void GetAnimationPrimitives(const CAnimPlaybackParms& parms, std::set<CPrimitive>& primsOut) const;
|
||||
void SetAnimation(const CAnimPlaybackParms& parms, bool);
|
||||
void DoAdvance(float, bool&, CRandom16&, bool);
|
||||
void Advance(float, const zeus::CVector3f&, CStateManager& stateMgr, bool);
|
||||
void AdvanceIgnoreParticles(float, CRandom16&, bool);
|
||||
SAdvancementDeltas Advance(float, const zeus::CVector3f&, CStateManager& stateMgr, bool);
|
||||
SAdvancementDeltas AdvanceIgnoreParticles(float, CRandom16&, bool);
|
||||
void AdvanceAnim(CCharAnimTime& time, zeus::CVector3f&, zeus::CQuaternion&);
|
||||
void SetXRayModel(const TLockedToken<CModel>& model, const TLockedToken<CSkinRules>& skinRules);
|
||||
void SetInfraModel(const TLockedToken<CModel>& model, const TLockedToken<CSkinRules>& skinRules);
|
||||
|
@ -153,7 +158,7 @@ public:
|
|||
void PoseSkinnedModel(const CSkinnedModel& model, const CPoseAsTransforms& pose,
|
||||
const std::experimental::optional<CVertexMorphEffect>& morphEffect,
|
||||
const float* morphMagnitudes) const;
|
||||
void AdvanceParticles(const zeus::CTransform& xf, float,
|
||||
void AdvanceParticles(const zeus::CTransform& xf, float dt,
|
||||
const zeus::CVector3f&, CStateManager& stateMgr);
|
||||
void GetAverageVelocity(int) const;
|
||||
void ResetPOILists();
|
||||
|
|
|
@ -57,7 +57,7 @@ class CAnimSource
|
|||
std::vector<u8> x20_rotationChannels;
|
||||
std::vector<u8> x30_translationChannels;
|
||||
RotationAndOffsetStorage x40_data;
|
||||
TResId x54_evntId;
|
||||
ResId x54_evntId;
|
||||
TCachedToken<CAnimPOIData> x58_evntData;
|
||||
float x60_averageVelocity;
|
||||
|
||||
|
|
|
@ -45,8 +45,8 @@ CAnimationSet::CAnimationSet(CInputStream& in)
|
|||
x50_animRes.reserve(animResourcesCount);
|
||||
for (u32 i=0 ; i<animResourcesCount ; ++i)
|
||||
{
|
||||
TResId anim = in.readUint32Big();
|
||||
TResId evnt = in.readUint32Big();
|
||||
ResId anim = in.readUint32Big();
|
||||
ResId evnt = in.readUint32Big();
|
||||
x50_animRes.emplace_back(anim, evnt);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class CAnimationSet
|
|||
std::vector<std::pair<u32, CAdditiveAnimationInfo>> x28_additiveInfo;
|
||||
CAdditiveAnimationInfo x38_defaultAdditiveInfo;
|
||||
std::vector<CHalfTransition> x40_halfTransitions;
|
||||
std::vector<std::pair<TResId, TResId>> x50_animRes;
|
||||
std::vector<std::pair<ResId, ResId>> x50_animRes;
|
||||
|
||||
public:
|
||||
CAnimationSet(CInputStream& in);
|
||||
|
@ -45,7 +45,7 @@ public:
|
|||
GetAdditiveInfo() const {return x28_additiveInfo;}
|
||||
const CAdditiveAnimationInfo&
|
||||
GetDefaultAdditiveInfo() const {return x38_defaultAdditiveInfo;}
|
||||
const std::vector<std::pair<TResId, TResId>>&
|
||||
const std::vector<std::pair<ResId, ResId>>&
|
||||
GetAnimResIds() const {return x50_animRes;}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
#ifndef __URDE_CASSETFACTORY_HPP__
|
||||
#define __URDE_CASSETFACTORY_HPP__
|
||||
|
||||
#include "../IFactory.hpp"
|
||||
#include "../IObj.hpp"
|
||||
#include "IFactory.hpp"
|
||||
#include "IObj.hpp"
|
||||
#include "CToken.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CCharacterFactory;
|
||||
class CAnimRes;
|
||||
|
||||
class CCharacterFactoryBuilder : public IFactory
|
||||
{
|
||||
public:
|
||||
|
@ -14,7 +18,10 @@ public:
|
|||
void CancelBuild(const SObjectTag&) {}
|
||||
bool CanBuild(const SObjectTag&) {return false;}
|
||||
const SObjectTag* GetResourceIdByName(const char*) const {return nullptr;}
|
||||
FourCC GetResourceTypeById(ResId id) const {return {};}
|
||||
TToken<CCharacterFactory> GetFactory(const CAnimRes& res);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CASSETFACTORY_HPP__
|
||||
|
|
|
@ -34,7 +34,11 @@ const SObjectTag* CCharacterFactory::CDummyFactory::GetResourceIdByName(const ch
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
TResId CCharacterFactory::GetEventResourceIdForAnimResourceId(TResId) const
|
||||
FourCC CCharacterFactory::CDummyFactory::GetResourceTypeById(ResId id) const
|
||||
{
|
||||
}
|
||||
|
||||
ResId CCharacterFactory::GetEventResourceIdForAnimResourceId(ResId) const
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -62,7 +66,7 @@ CCharacterFactory::GetCharLayoutInfoDB(CSimplePool& store,
|
|||
|
||||
CCharacterFactory::CCharacterFactory(CSimplePool& store,
|
||||
const CAnimCharacterSet& ancs,
|
||||
TResId selfId)
|
||||
ResId selfId)
|
||||
: x4_charInfoDB(GetCharacterInfoDB(ancs)),
|
||||
x14_charLayoutInfoDB(GetCharLayoutInfoDB(store, x4_charInfoDB)),
|
||||
x24_sysContext(std::make_shared<CAnimSysContext>(
|
||||
|
|
|
@ -18,6 +18,7 @@ class CTransitionDatabaseGame;
|
|||
class CAnimationManager;
|
||||
class CTransitionManager;
|
||||
class CAllFormatsAnimSource;
|
||||
class CAnimData;
|
||||
|
||||
class CCharacterFactory : public IObjFactory
|
||||
{
|
||||
|
@ -30,6 +31,7 @@ public:
|
|||
void CancelBuild(const SObjectTag&);
|
||||
bool CanBuild(const SObjectTag&);
|
||||
const SObjectTag* GetResourceIdByName(const char*) const;
|
||||
FourCC GetResourceTypeById(ResId id) const;
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -41,8 +43,8 @@ private:
|
|||
std::vector<TCachedToken<CAllFormatsAnimSource>> x30_animSourceDB;
|
||||
std::vector<std::pair<u32, CAdditiveAnimationInfo>> x40_additiveInfo;
|
||||
CAdditiveAnimationInfo x50_defaultAdditiveInfo;
|
||||
std::vector<std::pair<TResId, TResId>> x58_animResources;
|
||||
TResId x68_selfId;
|
||||
std::vector<std::pair<ResId, ResId>> x58_animResources;
|
||||
ResId x68_selfId;
|
||||
CDummyFactory x6c_dummyFactory;
|
||||
CSimplePool x70_cacheResPool;
|
||||
|
||||
|
@ -52,10 +54,10 @@ private:
|
|||
const std::vector<CCharacterInfo>& chars);
|
||||
|
||||
public:
|
||||
CCharacterFactory(CSimplePool& store, const CAnimCharacterSet& ancs, TResId);
|
||||
CCharacterFactory(CSimplePool& store, const CAnimCharacterSet& ancs, ResId);
|
||||
|
||||
void CreateCharacter(int, bool, const TLockedToken<CCharacterFactory>& factory, int) const;
|
||||
TResId GetEventResourceIdForAnimResourceId(TResId animId) const;
|
||||
std::unique_ptr<CAnimData> CreateCharacter(int, bool, const TLockedToken<CCharacterFactory>& factory, int) const;
|
||||
ResId GetEventResourceIdForAnimResourceId(ResId animId) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -14,18 +14,18 @@ class CCharacterInfo
|
|||
public:
|
||||
struct CParticleResData
|
||||
{
|
||||
std::vector<TResId> x0_part;
|
||||
std::vector<TResId> x10_swhc;
|
||||
std::vector<TResId> x20_;
|
||||
std::vector<TResId> x30_elsc;
|
||||
std::vector<ResId> x0_part;
|
||||
std::vector<ResId> x10_swhc;
|
||||
std::vector<ResId> x20_;
|
||||
std::vector<ResId> x30_elsc;
|
||||
CParticleResData(CInputStream& in, u16 tableCount);
|
||||
};
|
||||
private:
|
||||
u16 x0_tableCount;
|
||||
std::string x4_name;
|
||||
TResId x14_cmdl;
|
||||
TResId x18_cskr;
|
||||
TResId x1c_cinf;
|
||||
ResId x14_cmdl;
|
||||
ResId x18_cskr;
|
||||
ResId x1c_cinf;
|
||||
std::vector<std::pair<u32, std::pair<std::string, std::string>>> x20_animInfo;
|
||||
CPASDatabase x30_pasDatabase;
|
||||
CParticleResData x44_partRes;
|
||||
|
@ -33,15 +33,15 @@ private:
|
|||
std::vector<std::pair<std::string, zeus::CAABox>> x88_aabbs;
|
||||
std::vector<std::pair<std::string, std::vector<CEffectComponent>>> x98_effects;
|
||||
|
||||
TResId xa8_cmdlOverlay = 0;
|
||||
TResId xac_cskrOverlay = 0;
|
||||
ResId xa8_cmdlOverlay = 0;
|
||||
ResId xac_cskrOverlay = 0;
|
||||
|
||||
std::vector<u32> xb0_animIdxs;
|
||||
|
||||
public:
|
||||
CCharacterInfo(CInputStream& in);
|
||||
|
||||
TResId GetCharLayoutInfoId() const {return x1c_cinf;}
|
||||
ResId GetCharLayoutInfoId() const {return x1c_cinf;}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -71,5 +71,6 @@ add_library(RuntimeCommonCharacter
|
|||
CAnimSource.hpp CAnimSource.cpp
|
||||
CAllFormatsAnimSource.hpp CAllFormatsAnimSource.cpp
|
||||
CSegStatementSet.hpp CSegStatementSet.cpp
|
||||
CActorLights.hpp CActorLights.cpp
|
||||
CAnimSysContext.hpp
|
||||
CBodyState.hpp)
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
#include "CModelData.hpp"
|
||||
#include "CAnimData.hpp"
|
||||
#include "IAnimReader.hpp"
|
||||
#include "Graphics/CGraphics.hpp"
|
||||
#include "Graphics/CSkinnedModel.hpp"
|
||||
#include "Graphics/CFrustumPlanes.hpp"
|
||||
#include "Graphics/CVertexMorphEffect.hpp"
|
||||
#include "Editor/ProjectManager.hpp"
|
||||
#include "CActorLights.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
#include "CPlayerState.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "CAssetFactory.hpp"
|
||||
#include "CCharacterFactory.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -7,132 +19,352 @@ namespace urde
|
|||
CModelData::CModelData() {}
|
||||
|
||||
CModelData::CModelData(const CStaticRes& res)
|
||||
: x0_particleScale(res.x4_particleScale)
|
||||
{
|
||||
IObjectStore& objStore = ProjectManager::g_SharedManager->objectStore();
|
||||
x1c_normalModel = objStore.GetObj({SBIG('CMDL'), res.x0_cmdlId});
|
||||
}
|
||||
|
||||
CModelData::CModelData(const CAnimRes& res)
|
||||
: x0_particleScale(res.x8_particleScale)
|
||||
{
|
||||
TToken<CCharacterFactory> factory = g_CharFactoryBuilder->GetFactory(res);
|
||||
xc_animData = factory->CreateCharacter(res.x4_charIdx, res.x14_, factory, res.x1c_);
|
||||
}
|
||||
|
||||
zeus::CVector3f CModelData::GetAdvancementDeltas(const CCharAnimTime& a,
|
||||
SAdvancementDeltas CModelData::GetAdvancementDeltas(const CCharAnimTime& a,
|
||||
const CCharAnimTime& b) const
|
||||
{
|
||||
if (xc_animData)
|
||||
return xc_animData->GetAdvancementDeltas(a, b);
|
||||
else
|
||||
return {};
|
||||
}
|
||||
|
||||
void CModelData::Render(const CStateManager& stateMgr, const zeus::CTransform& xf,
|
||||
const CActorLights* lights, const CModelFlags& drawFlags) const
|
||||
{
|
||||
Render(GetRenderingModel(stateMgr), xf, lights, drawFlags);
|
||||
}
|
||||
|
||||
void CModelData::GetRenderingModel(const CStateManager& stateMgr)
|
||||
CModelData::EWhichModel CModelData::GetRenderingModel(const CStateManager& stateMgr) const
|
||||
{
|
||||
switch (stateMgr.GetPlayerState()->GetActiveVisor(stateMgr))
|
||||
{
|
||||
case CPlayerState::EPlayerVisor::XRay:
|
||||
return CModelData::EWhichModel::XRay;
|
||||
case CPlayerState::EPlayerVisor::Thermal:
|
||||
return CModelData::EWhichModel::Thermal;
|
||||
default:
|
||||
return CModelData::EWhichModel::Normal;
|
||||
}
|
||||
}
|
||||
|
||||
void CModelData::PickAnimatedModel(EWhichModel) const
|
||||
const CSkinnedModel& CModelData::PickAnimatedModel(EWhichModel which) const
|
||||
{
|
||||
const CSkinnedModel* ret = nullptr;
|
||||
switch (which)
|
||||
{
|
||||
case EWhichModel::XRay:
|
||||
ret = xc_animData->xf4_xrayModel.get();
|
||||
case EWhichModel::Thermal:
|
||||
ret = xc_animData->xf8_infraModel.get();
|
||||
default: break;
|
||||
}
|
||||
if (ret)
|
||||
return *ret;
|
||||
return *xc_animData->xd8_modelData.GetObj();
|
||||
}
|
||||
|
||||
void CModelData::PickStaticModel(EWhichModel) const
|
||||
const TLockedToken<CModel>& CModelData::PickStaticModel(EWhichModel which) const
|
||||
{
|
||||
const TLockedToken<CModel>* ret = nullptr;
|
||||
switch (which)
|
||||
{
|
||||
case EWhichModel::XRay:
|
||||
ret = &x2c_xrayModel;
|
||||
case EWhichModel::Thermal:
|
||||
ret = &x3c_infraModel;
|
||||
default: break;
|
||||
}
|
||||
if (ret)
|
||||
return *ret;
|
||||
return x1c_normalModel;
|
||||
}
|
||||
|
||||
void CModelData::SetXRayModel(const std::pair<TResId, TResId>& modelSkin)
|
||||
void CModelData::SetXRayModel(const std::pair<ResId, ResId>& modelSkin)
|
||||
{
|
||||
if (modelSkin.first)
|
||||
{
|
||||
IObjectStore& objStore = ProjectManager::g_SharedManager->objectStore();
|
||||
IFactory& resFactory = ProjectManager::g_SharedManager->resourceFactoryMP1();
|
||||
if (resFactory.GetResourceTypeById(modelSkin.first) == SBIG('CMDL'))
|
||||
{
|
||||
if (xc_animData && modelSkin.second &&
|
||||
resFactory.GetResourceTypeById(modelSkin.second) == SBIG('CSKR'))
|
||||
{
|
||||
xc_animData->SetXRayModel(objStore.GetObj({SBIG('CMDL'), modelSkin.first}),
|
||||
objStore.GetObj({SBIG('CSKR'), modelSkin.second}));
|
||||
}
|
||||
else
|
||||
{
|
||||
x2c_xrayModel = objStore.GetObj({SBIG('CMDL'), modelSkin.first});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CModelData::SetInfraModel(const std::pair<TResId, TResId>& modelSkin)
|
||||
void CModelData::SetInfraModel(const std::pair<ResId, ResId>& modelSkin)
|
||||
{
|
||||
if (modelSkin.first)
|
||||
{
|
||||
IObjectStore& objStore = ProjectManager::g_SharedManager->objectStore();
|
||||
IFactory& resFactory = ProjectManager::g_SharedManager->resourceFactoryMP1();
|
||||
if (resFactory.GetResourceTypeById(modelSkin.first) == SBIG('CMDL'))
|
||||
{
|
||||
if (xc_animData && modelSkin.second &&
|
||||
resFactory.GetResourceTypeById(modelSkin.second) == SBIG('CSKR'))
|
||||
{
|
||||
xc_animData->SetInfraModel(objStore.GetObj({SBIG('CMDL'), modelSkin.first}),
|
||||
objStore.GetObj({SBIG('CSKR'), modelSkin.second}));
|
||||
}
|
||||
else
|
||||
{
|
||||
x3c_infraModel = objStore.GetObj({SBIG('CMDL'), modelSkin.first});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CModelData::IsDefinitelyOpaque(EWhichModel) const
|
||||
bool CModelData::IsDefinitelyOpaque(EWhichModel which) const
|
||||
{
|
||||
if (xc_animData)
|
||||
{
|
||||
const CSkinnedModel& model = PickAnimatedModel(which);
|
||||
return model.GetModel()->GetInstance().IsOpaque();
|
||||
}
|
||||
else
|
||||
{
|
||||
const TLockedToken<CModel>& model = PickStaticModel(which);
|
||||
return model->GetInstance().IsOpaque();
|
||||
}
|
||||
}
|
||||
|
||||
bool CModelData::GetIsLoop() const
|
||||
{
|
||||
if (!xc_animData)
|
||||
return false;
|
||||
return xc_animData->GetIsLoop();
|
||||
}
|
||||
|
||||
float CModelData::GetAnimationDuration(int) const
|
||||
float CModelData::GetAnimationDuration(int idx) const
|
||||
{
|
||||
if (!xc_animData)
|
||||
return 0.f;
|
||||
return xc_animData->GetAnimationDuration(idx);
|
||||
}
|
||||
|
||||
void CModelData::EnableLooping(bool)
|
||||
void CModelData::EnableLooping(bool enable)
|
||||
{
|
||||
if (!xc_animData)
|
||||
return;
|
||||
xc_animData->EnableLooping(enable);
|
||||
}
|
||||
|
||||
void CModelData::AdvanceParticles(const zeus::CTransform& xf, float,
|
||||
void CModelData::AdvanceParticles(const zeus::CTransform& xf, float dt,
|
||||
CStateManager& stateMgr)
|
||||
{
|
||||
if (!xc_animData)
|
||||
return;
|
||||
xc_animData->AdvanceParticles(xf, dt, x0_particleScale, stateMgr);
|
||||
}
|
||||
|
||||
zeus::CAABox CModelData::GetBounds() const
|
||||
{
|
||||
if (xc_animData)
|
||||
{
|
||||
return xc_animData->GetBoundingBox(zeus::CTransform::Scale(x0_particleScale));
|
||||
}
|
||||
else
|
||||
{
|
||||
const zeus::CAABox& aabb = x1c_normalModel->GetAABB();
|
||||
return zeus::CAABox(aabb.m_min * x0_particleScale, aabb.m_max * x0_particleScale);
|
||||
}
|
||||
}
|
||||
|
||||
zeus::CAABox CModelData::GetBounds(const zeus::CTransform& xf) const
|
||||
{
|
||||
zeus::CTransform xf2 = xf * zeus::CTransform::Scale(x0_particleScale);
|
||||
if (xc_animData)
|
||||
return xc_animData->GetBoundingBox(xf2);
|
||||
else
|
||||
return x1c_normalModel->GetAABB().getTransformedAABox(xf2);
|
||||
}
|
||||
|
||||
zeus::CTransform CModelData::GetScaledLocatorTransformDynamic(const std::string& name,
|
||||
const CCharAnimTime* time) const
|
||||
{
|
||||
zeus::CTransform xf = GetLocatorTransformDynamic(name, time);
|
||||
xf.m_origin *= x0_particleScale;
|
||||
return xf;
|
||||
}
|
||||
|
||||
zeus::CTransform CModelData::GetScaledLocatorTransform(const std::string& name) const
|
||||
{
|
||||
zeus::CTransform xf = GetLocatorTransform(name);
|
||||
xf.m_origin *= x0_particleScale;
|
||||
return xf;
|
||||
}
|
||||
|
||||
zeus::CTransform CModelData::GetLocatorTransformDynamic(const std::string& name,
|
||||
const CCharAnimTime* time) const
|
||||
{
|
||||
if (xc_animData)
|
||||
return xc_animData->GetLocatorTransform(name, time);
|
||||
else
|
||||
return {};
|
||||
}
|
||||
|
||||
zeus::CTransform CModelData::GetLocatorTransform(const std::string& name) const
|
||||
{
|
||||
if (xc_animData)
|
||||
return xc_animData->GetLocatorTransform(name, nullptr);
|
||||
else
|
||||
return {};
|
||||
}
|
||||
|
||||
void CModelData::AdvanceAnimationIgnoreParticles(float dt, CRandom16&, bool)
|
||||
SAdvancementDeltas CModelData::AdvanceAnimationIgnoreParticles(float dt, CRandom16& rand, bool flag)
|
||||
{
|
||||
if (xc_animData)
|
||||
return xc_animData->AdvanceIgnoreParticles(dt, rand, flag);
|
||||
else
|
||||
return {};
|
||||
}
|
||||
|
||||
void CModelData::AdvanceAnimation(float dt, CStateManager& stateMgr, bool)
|
||||
SAdvancementDeltas CModelData::AdvanceAnimation(float dt, CStateManager& stateMgr, bool flag)
|
||||
{
|
||||
if (xc_animData)
|
||||
return xc_animData->Advance(dt, x0_particleScale, stateMgr, flag);
|
||||
else
|
||||
return {};
|
||||
}
|
||||
|
||||
bool CModelData::IsAnimating() const
|
||||
{
|
||||
if (!xc_animData)
|
||||
return false;
|
||||
return xc_animData->IsAnimating();
|
||||
}
|
||||
|
||||
bool CModelData::IsInFrustum(const zeus::CTransform& xf,
|
||||
const CFrustumPlanes& frustum) const
|
||||
{
|
||||
if (!xc_animData && !x1c_normalModel)
|
||||
return true;
|
||||
return frustum.BoxInFrustumPlanes(GetBounds(xf));
|
||||
}
|
||||
|
||||
void CModelData::RenderParticles(const CFrustumPlanes& frustum) const
|
||||
{
|
||||
if (xc_animData)
|
||||
xc_animData->RenderAuxiliary(frustum);
|
||||
}
|
||||
|
||||
void CModelData::Touch(EWhichModel, int) const
|
||||
void CModelData::Touch(EWhichModel which, int shaderIdx) const
|
||||
{
|
||||
if (xc_animData)
|
||||
xc_animData->Touch(PickAnimatedModel(which), shaderIdx);
|
||||
else
|
||||
PickStaticModel(which)->Touch(shaderIdx);
|
||||
}
|
||||
|
||||
void CModelData::Touch(const CStateManager& stateMgr, int) const
|
||||
void CModelData::Touch(const CStateManager& stateMgr, int shaderIdx) const
|
||||
{
|
||||
Touch(GetRenderingModel(stateMgr), shaderIdx);
|
||||
}
|
||||
|
||||
void CModelData::RenderThermal(const zeus::CTransform& xf,
|
||||
const zeus::CColor& a, const zeus::CColor& b) const
|
||||
{
|
||||
CGraphics::SetModelMatrix(xf * zeus::CTransform::Scale(x0_particleScale));
|
||||
CGraphics::DisableAllLights();
|
||||
CModelFlags drawFlags;
|
||||
drawFlags.m_extendedShaderIdx = 3;
|
||||
|
||||
if (xc_animData)
|
||||
{
|
||||
const CSkinnedModel& model = PickAnimatedModel(EWhichModel::Thermal);
|
||||
xc_animData->SetupRender(model, {}, nullptr);
|
||||
model.Draw(drawFlags);
|
||||
}
|
||||
else
|
||||
{
|
||||
const TLockedToken<CModel>& model = PickStaticModel(EWhichModel::Thermal);
|
||||
model->Draw(drawFlags);
|
||||
}
|
||||
}
|
||||
|
||||
void CModelData::RenderUnsortedParts(EWhichModel, const zeus::CTransform& xf,
|
||||
void CModelData::RenderUnsortedParts(EWhichModel which, const zeus::CTransform& xf,
|
||||
const CActorLights* lights, const CModelFlags& drawFlags) const
|
||||
{
|
||||
if ((x14_25_sortThermal && which == EWhichModel::Thermal) ||
|
||||
xc_animData || !x1c_normalModel || drawFlags.m_blendMode > 2)
|
||||
{
|
||||
((CModelData*)this)->x14_24_renderSorted = false;
|
||||
return;
|
||||
}
|
||||
|
||||
void CModelData::Render(EWhichModel, const zeus::CTransform& xf,
|
||||
CGraphics::SetModelMatrix(xf * zeus::CTransform::Scale(x0_particleScale));
|
||||
if (lights)
|
||||
lights->ActivateLights();
|
||||
else
|
||||
{
|
||||
CGraphics::DisableAllLights();
|
||||
// Also set ambient to x18_ambientColor
|
||||
}
|
||||
|
||||
PickStaticModel(which)->DrawUnsortedParts(drawFlags);
|
||||
// Set ambient to white
|
||||
CGraphics::DisableAllLights();
|
||||
((CModelData*)this)->x14_24_renderSorted = true;
|
||||
}
|
||||
|
||||
void CModelData::Render(EWhichModel which, const zeus::CTransform& xf,
|
||||
const CActorLights* lights, const CModelFlags& drawFlags) const
|
||||
{
|
||||
if (x14_25_sortThermal && which == EWhichModel::Thermal)
|
||||
{
|
||||
zeus::CColor mul(drawFlags.color.a, drawFlags.color.a, drawFlags.color.a, drawFlags.color.a);
|
||||
RenderThermal(xf, mul, {0.f, 0.f, 0.f, 0.25f});
|
||||
}
|
||||
else
|
||||
{
|
||||
CGraphics::SetModelMatrix(xf * zeus::CTransform::Scale(x0_particleScale));
|
||||
if (lights)
|
||||
lights->ActivateLights();
|
||||
else
|
||||
{
|
||||
CGraphics::DisableAllLights();
|
||||
// Also set ambient to x18_ambientColor
|
||||
}
|
||||
|
||||
if (xc_animData)
|
||||
{
|
||||
xc_animData->Render(PickAnimatedModel(which), drawFlags, {}, nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
const TLockedToken<CModel>& model = PickStaticModel(which);
|
||||
if (x14_24_renderSorted)
|
||||
model->DrawSortedParts(drawFlags);
|
||||
else
|
||||
model->Draw(drawFlags);
|
||||
}
|
||||
|
||||
// Set ambient to white
|
||||
CGraphics::DisableAllLights();
|
||||
((CModelData*)this)->x14_24_renderSorted = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "zeus/CVector3f.hpp"
|
||||
#include "zeus/CAABox.hpp"
|
||||
#include "zeus/CColor.hpp"
|
||||
#include "RetroTypes.hpp"
|
||||
#include "CToken.hpp"
|
||||
|
||||
|
@ -16,26 +17,47 @@ class CRandom16;
|
|||
class CFrustumPlanes;
|
||||
class CAnimData;
|
||||
class CModel;
|
||||
class CSkinnedModel;
|
||||
struct SAdvancementDeltas;
|
||||
|
||||
struct CStaticRes
|
||||
{
|
||||
ResId x0_cmdlId;
|
||||
zeus::CVector3f x4_particleScale;
|
||||
};
|
||||
|
||||
struct CAnimRes
|
||||
{
|
||||
zeus::CVector3f x8_scale;
|
||||
ResId x0_ancsId;
|
||||
u32 x4_charIdx;
|
||||
zeus::CVector3f x8_particleScale;
|
||||
bool x14_;
|
||||
int x1c_;
|
||||
};
|
||||
|
||||
class CModelData
|
||||
{
|
||||
zeus::CVector3f x0_particleScale;
|
||||
std::unique_ptr<CAnimData> xc_animData;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool x14_24_renderSorted : 1;
|
||||
bool x14_25_sortThermal : 1;
|
||||
};
|
||||
u32 _flags = 0;
|
||||
};
|
||||
zeus::CColor x18_ambientColor;
|
||||
TLockedToken<CModel> x1c_normalModel;
|
||||
TLockedToken<CModel> x2c_xrayModel;
|
||||
TLockedToken<CModel> x3c_infraModel;
|
||||
public:
|
||||
enum class EWhichModel
|
||||
{
|
||||
Normal,
|
||||
XRay,
|
||||
Thermal
|
||||
};
|
||||
|
||||
CModelData();
|
||||
|
@ -43,14 +65,14 @@ public:
|
|||
CModelData(const CAnimRes& res);
|
||||
CModelData CModelDataNull() {return CModelData();}
|
||||
|
||||
zeus::CVector3f GetAdvancementDeltas(const CCharAnimTime& a, const CCharAnimTime& b) const;
|
||||
SAdvancementDeltas GetAdvancementDeltas(const CCharAnimTime& a, const CCharAnimTime& b) const;
|
||||
void Render(const CStateManager& stateMgr, const zeus::CTransform& xf,
|
||||
const CActorLights* lights, const CModelFlags& drawFlags) const;
|
||||
void GetRenderingModel(const CStateManager& stateMgr);
|
||||
void PickAnimatedModel(EWhichModel) const;
|
||||
void PickStaticModel(EWhichModel) const;
|
||||
void SetXRayModel(const std::pair<TResId, TResId>& modelSkin);
|
||||
void SetInfraModel(const std::pair<TResId, TResId>& modelSkin);
|
||||
EWhichModel GetRenderingModel(const CStateManager& stateMgr) const;
|
||||
const CSkinnedModel& PickAnimatedModel(EWhichModel which) const;
|
||||
const TLockedToken<CModel>& PickStaticModel(EWhichModel which) const;
|
||||
void SetXRayModel(const std::pair<ResId, ResId>& modelSkin);
|
||||
void SetInfraModel(const std::pair<ResId, ResId>& modelSkin);
|
||||
bool IsDefinitelyOpaque(EWhichModel) const;
|
||||
bool GetIsLoop() const;
|
||||
float GetAnimationDuration(int) const;
|
||||
|
@ -62,13 +84,13 @@ public:
|
|||
zeus::CTransform GetScaledLocatorTransform(const std::string& name) const;
|
||||
zeus::CTransform GetLocatorTransformDynamic(const std::string& name, const CCharAnimTime* time) const;
|
||||
zeus::CTransform GetLocatorTransform(const std::string& name) const;
|
||||
void AdvanceAnimationIgnoreParticles(float dt, CRandom16&, bool);
|
||||
void AdvanceAnimation(float dt, CStateManager& stateMgr, bool);
|
||||
SAdvancementDeltas AdvanceAnimationIgnoreParticles(float dt, CRandom16&, bool);
|
||||
SAdvancementDeltas AdvanceAnimation(float dt, CStateManager& stateMgr, bool);
|
||||
bool IsAnimating() const;
|
||||
bool IsInFrustum(const zeus::CTransform& xf, const CFrustumPlanes& frustum) const;
|
||||
void RenderParticles(const CFrustumPlanes& frustum) const;
|
||||
void Touch(EWhichModel, int) const;
|
||||
void Touch(const CStateManager& stateMgr, int) const;
|
||||
void Touch(EWhichModel, int shaderIdx) const;
|
||||
void Touch(const CStateManager& stateMgr, int shaderIdx) const;
|
||||
void RenderThermal(const zeus::CTransform& xf, const zeus::CColor& a, const zeus::CColor& b) const;
|
||||
void RenderUnsortedParts(EWhichModel, const zeus::CTransform& xf,
|
||||
const CActorLights* lights, const CModelFlags& drawFlags) const;
|
||||
|
|
|
@ -9,12 +9,12 @@ namespace urde
|
|||
|
||||
class CPrimitive
|
||||
{
|
||||
TResId x0_animId;
|
||||
ResId x0_animId;
|
||||
u32 x4_animIdx;
|
||||
std::string x8_animName;
|
||||
public:
|
||||
CPrimitive(CInputStream& in);
|
||||
TResId GetAnimResId() const {return x0_animId;}
|
||||
ResId GetAnimResId() const {return x0_animId;}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -17,11 +17,16 @@ class CSoundPOINode;
|
|||
class CSegIdList;
|
||||
class CSegStatementSet;
|
||||
|
||||
struct SAdvancementDeltas
|
||||
{
|
||||
zeus::CVector3f x0_posDelta;
|
||||
zeus::CQuaternion xc_rotDelta;
|
||||
};
|
||||
|
||||
struct SAdvancementResults
|
||||
{
|
||||
CCharAnimTime x0_remTime;
|
||||
zeus::CVector3f x8_posDelta;
|
||||
zeus::CQuaternion x14_rotDelta;
|
||||
SAdvancementDeltas x8_deltas;
|
||||
};
|
||||
|
||||
class IAnimReader
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#include "CFrustumPlanes.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CFrustumPlanes::CFrustumPlanes(const zeus::CTransform& cameraXf, float, float, float, bool, float)
|
||||
{
|
||||
}
|
||||
|
||||
bool CFrustumPlanes::PointInFrustumPlanes(const zeus::CVector3f& point) const
|
||||
{
|
||||
}
|
||||
|
||||
bool CFrustumPlanes::SphereInFrustumPlanes(const zeus::CSphere& sphere) const
|
||||
{
|
||||
}
|
||||
|
||||
bool CFrustumPlanes::BoxInFrustumPlanes(const zeus::CAABox& box) const
|
||||
{
|
||||
}
|
||||
|
||||
bool CFrustumPlanes::BoxInFrustumPlanes(const std::experimental::optional<zeus::CAABox>& box) const
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef __URDE_CFRUSTUMPLANES_HPP__
|
||||
#define __URDE_CFRUSTUMPLANES_HPP__
|
||||
|
||||
#include "zeus/CTransform.hpp"
|
||||
#include "zeus/CAABox.hpp"
|
||||
#include "optional.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CFrustumPlanes
|
||||
{
|
||||
public:
|
||||
CFrustumPlanes(const zeus::CTransform& cameraXf, float, float, float, bool, float);
|
||||
|
||||
bool PointInFrustumPlanes(const zeus::CVector3f& point) const;
|
||||
bool SphereInFrustumPlanes(const zeus::CSphere& sphere) const;
|
||||
bool BoxInFrustumPlanes(const zeus::CAABox& box) const;
|
||||
bool BoxInFrustumPlanes(const std::experimental::optional<zeus::CAABox>& box) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CFRUSTUMPLANES_HPP__
|
|
@ -19,6 +19,7 @@ add_library(RuntimeCommonGraphics
|
|||
CModelShaders.hpp CModelShadersGLSL.cpp
|
||||
CVertexMorphEffect.hpp CVertexMorphEffect.cpp
|
||||
CMoviePlayer.hpp CMoviePlayer.cpp
|
||||
CFrustumPlanes.hpp CFrustumPlanes.cpp
|
||||
CGraphicsPalette.hpp CGraphicsPalette.cpp
|
||||
CGraphics.hpp CGraphics.cpp
|
||||
${PLAT_SRCS})
|
||||
|
|
|
@ -108,6 +108,7 @@ public:
|
|||
std::vector<TCachedToken<CTexture>>& toksOut,
|
||||
IObjectStore& store);
|
||||
|
||||
bool IsOpaque() const {return x3c_firstSortedSurface == nullptr;}
|
||||
void ActivateLights(const std::vector<CLight>& lights);
|
||||
void RemapMaterialData(SShader& shader);
|
||||
bool TryLockTextures() const;
|
||||
|
@ -154,7 +155,9 @@ public:
|
|||
void Touch(int shaderIdx) const;
|
||||
bool IsLoaded(int shaderIdx) const;
|
||||
|
||||
const zeus::CAABox& GetAABB() const {return m_aabb;}
|
||||
CBooModel& GetInstance() {return *x28_modelInst;}
|
||||
const CBooModel& GetInstance() const {return *x28_modelInst;}
|
||||
std::unique_ptr<CBooModel> MakeNewInstance(int shaderIdx);
|
||||
};
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace urde
|
|||
CSkinnedModel::CSkinnedModel(const TLockedToken<CModel>& model,
|
||||
const TLockedToken<CSkinRules>& skinRules,
|
||||
const TLockedToken<CCharLayoutInfo>& layoutInfo)
|
||||
: x4_model(model), x10_skinRules(skinRules), x1c_layoutInfo(layoutInfo)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -17,13 +17,21 @@ class IObjectStore;
|
|||
class CSkinnedModel
|
||||
{
|
||||
std::unique_ptr<CBooModel> m_modelInst;
|
||||
TLockedToken<CModel> x4_model;
|
||||
TLockedToken<CSkinRules> x10_skinRules;
|
||||
TLockedToken<CCharLayoutInfo> x1c_layoutInfo;
|
||||
public:
|
||||
CSkinnedModel(const TLockedToken<CModel>& model,
|
||||
const TLockedToken<CSkinRules>& skinRules,
|
||||
const TLockedToken<CCharLayoutInfo>& layoutInfo);
|
||||
CSkinnedModel(IObjectStore& store, TResId model, TResId skinRules, TResId layoutInfo);
|
||||
CSkinnedModel(IObjectStore& store, ResId model, ResId skinRules, ResId layoutInfo);
|
||||
|
||||
const TLockedToken<CModel>& GetModel() const {return x4_model;}
|
||||
const TLockedToken<CSkinRules>& GetSkinRules() const {return x10_skinRules;}
|
||||
const TLockedToken<CCharLayoutInfo>& GetLayoutInfo() const {return x1c_layoutInfo;}
|
||||
|
||||
void Calculate(const CPoseAsTransforms& pose, const std::experimental::optional<CVertexMorphEffect>&);
|
||||
void Draw(const CModelFlags& drawFlags) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace urde
|
||||
{
|
||||
|
||||
CGuiFrame::CGuiFrame(TResId id, const std::string& name, CGuiSys& sys, int a, int b, int c)
|
||||
CGuiFrame::CGuiFrame(ResId id, const std::string& name, CGuiSys& sys, int a, int b, int c)
|
||||
: x4_name(name), x14_id(id), x1c_transitionOpts(EFrameTransitionOptions::Zero),
|
||||
x3c_guiSys(sys), xb0_a(a), xb4_b(b), xb8_c(c), xbc_24_loaded(false)
|
||||
{
|
||||
|
@ -620,7 +620,7 @@ void CGuiFrame::LoadWidgetsInGame(CInputStream& in)
|
|||
Initialize();
|
||||
}
|
||||
|
||||
CGuiFrame* CGuiFrame::CreateFrame(TResId frmeId, CGuiSys& sys, CInputStream& in)
|
||||
CGuiFrame* CGuiFrame::CreateFrame(ResId frmeId, CGuiSys& sys, CInputStream& in)
|
||||
{
|
||||
std::string name = CreateFrameName(frmeId);
|
||||
in.readInt32Big();
|
||||
|
@ -640,7 +640,7 @@ std::unique_ptr<IObj> RGuiFrameFactoryInGame(const SObjectTag& tag, CInputStream
|
|||
return TToken<CGuiFrame>::GetIObjObjectFor(std::move(frame));
|
||||
}
|
||||
|
||||
std::string CGuiFrame::CreateFrameName(TResId frmeId)
|
||||
std::string CGuiFrame::CreateFrameName(ResId frmeId)
|
||||
{
|
||||
/* formatting token originally "frame_%x" for 32-bit ids */
|
||||
return hecl::Format("frame_%016" PRIX64, frmeId);
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
private:
|
||||
bool x0_controllerStatus[4] = {};
|
||||
std::string x4_name;
|
||||
TResId x14_id;
|
||||
ResId x14_id;
|
||||
u32 x18_ = 0;
|
||||
CGuiFrameTransitionOptions x1c_transitionOpts;
|
||||
EFrameStates x34_ = EFrameStates::Zero;
|
||||
|
@ -90,7 +90,7 @@ private:
|
|||
char& lx, char& ly, char& rx, char& ry);
|
||||
|
||||
public:
|
||||
CGuiFrame(TResId id, const std::string& name, CGuiSys& sys, int a, int b, int c);
|
||||
CGuiFrame(ResId id, const std::string& name, CGuiSys& sys, int a, int b, int c);
|
||||
|
||||
CGuiSys& GetGuiSys() {return x3c_guiSys;}
|
||||
|
||||
|
@ -129,8 +129,8 @@ public:
|
|||
|
||||
CGuiWidgetIdDB& GetWidgetIdDB() {return x64_idDB;}
|
||||
|
||||
static CGuiFrame* CreateFrame(TResId frmeId, CGuiSys& sys, CInputStream& in);
|
||||
static std::string CreateFrameName(TResId frmeId);
|
||||
static CGuiFrame* CreateFrame(ResId frmeId, CGuiSys& sys, CInputStream& in);
|
||||
static std::string CreateFrameName(ResId frmeId);
|
||||
};
|
||||
|
||||
std::unique_ptr<IObj> RGuiFrameFactoryInGame(const SObjectTag& tag, CInputStream& in,
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
namespace urde
|
||||
{
|
||||
|
||||
CGuiModel::CGuiModel(const CGuiWidgetParms& parms, TResId modelId, u32 lightMask, bool flag)
|
||||
CGuiModel::CGuiModel(const CGuiWidgetParms& parms, ResId modelId, u32 lightMask, bool flag)
|
||||
: CGuiWidget(parms), x108_modelId(modelId), x10c_lightMask(lightMask)
|
||||
{
|
||||
if (!flag || (modelId & 0xffff) == 0xffff ||
|
||||
|
@ -19,7 +19,7 @@ CGuiModel::CGuiModel(const CGuiWidgetParms& parms, TResId modelId, u32 lightMask
|
|||
xf8_model = parms.x0_frame->GetGuiSys().GetResStore().GetObj({SBIG('CMDL'), modelId});
|
||||
}
|
||||
|
||||
std::vector<TResId> CGuiModel::GetModelAssets() const
|
||||
std::vector<ResId> CGuiModel::GetModelAssets() const
|
||||
{
|
||||
return {x108_modelId};
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ CGuiModel* CGuiModel::Create(CGuiFrame* frame, CInputStream& in, bool flag)
|
|||
{
|
||||
CGuiWidgetParms parms = ReadWidgetHeader(frame, in, flag);
|
||||
|
||||
TResId model = in.readUint32Big();
|
||||
ResId model = in.readUint32Big();
|
||||
in.readUint32Big();
|
||||
u32 lightMask = in.readUint32Big();
|
||||
|
||||
|
|
|
@ -11,13 +11,13 @@ namespace urde
|
|||
class CGuiModel : public CGuiWidget
|
||||
{
|
||||
TLockedToken<CModel> xf8_model;
|
||||
TResId x108_modelId;
|
||||
ResId x108_modelId;
|
||||
u32 x10c_lightMask;
|
||||
public:
|
||||
CGuiModel(const CGuiWidgetParms& parms, TResId modelId, u32 lightMask, bool flag);
|
||||
CGuiModel(const CGuiWidgetParms& parms, ResId modelId, u32 lightMask, bool flag);
|
||||
FourCC GetWidgetTypeID() const {return FOURCC('MODL');}
|
||||
|
||||
std::vector<TResId> GetModelAssets() const;
|
||||
std::vector<ResId> GetModelAssets() const;
|
||||
bool GetIsFinishedLoadingWidgetSpecific() const;
|
||||
void Touch() const;
|
||||
void Draw(const CGuiWidgetDrawParms& parms) const;
|
||||
|
|
|
@ -14,7 +14,7 @@ CGuiStaticImage::CGuiStaticImage
|
|||
(const CGuiWidgetParms& parms, float xDim, float zDim,
|
||||
const zeus::CVector3f& scaleCenter,
|
||||
EGuiTextureClampModeHorz clampH, EGuiTextureClampModeVert clampV,
|
||||
CGuiStaticImage::EMaterialType matType, TResId txtrId1, TResId txtrId2,
|
||||
CGuiStaticImage::EMaterialType matType, ResId txtrId1, ResId txtrId2,
|
||||
const std::vector<float>& frame, bool useTexture)
|
||||
: CGuiPane(parms, xDim, zDim, scaleCenter),
|
||||
x114_materialType(matType),
|
||||
|
@ -124,9 +124,9 @@ void CGuiStaticImage::Draw(const CGuiWidgetDrawParms& parms) const
|
|||
CGuiWidget::Draw(parms);
|
||||
}
|
||||
|
||||
std::vector<TResId> CGuiStaticImage::GetTextureAssets() const
|
||||
std::vector<ResId> CGuiStaticImage::GetTextureAssets() const
|
||||
{
|
||||
std::vector<TResId> ret;
|
||||
std::vector<ResId> ret;
|
||||
ret.reserve(2);
|
||||
if ((x120_textureID1 & 0xffff) != 0xffff)
|
||||
ret.push_back(x120_textureID1);
|
||||
|
@ -145,8 +145,8 @@ CGuiStaticImage* CGuiStaticImage::Create(CGuiFrame* frame, CInputStream& in, boo
|
|||
scaleCenter.readBig(in);
|
||||
|
||||
CGuiStaticImage::EMaterialType matType = CGuiStaticImage::EMaterialType(in.readUint32Big());
|
||||
TResId txtr1 = in.readUint32Big();
|
||||
TResId txtr2 = in.readUint32Big();
|
||||
ResId txtr1 = in.readUint32Big();
|
||||
ResId txtr2 = in.readUint32Big();
|
||||
|
||||
EGuiTextureClampModeHorz clampH = EGuiTextureClampModeHorz(in.readUint32Big());
|
||||
EGuiTextureClampModeVert clampV = EGuiTextureClampModeVert(in.readUint32Big());
|
||||
|
|
|
@ -20,8 +20,8 @@ private:
|
|||
EMaterialType x114_materialType;
|
||||
TLockedToken<CTexture> x118_texture1;
|
||||
TLockedToken<CTexture> x11c_texture2;
|
||||
TResId x120_textureID1;
|
||||
TResId x124_textureID2;
|
||||
ResId x120_textureID1;
|
||||
ResId x124_textureID2;
|
||||
EGuiTextureClampModeHorz x128_clampH;
|
||||
EGuiTextureClampModeVert x12c_clampV;
|
||||
std::vector<float> x130_clampedUVs;
|
||||
|
@ -30,13 +30,13 @@ public:
|
|||
CGuiStaticImage(const CGuiWidgetParms& parms, float xDim, float zDim,
|
||||
const zeus::CVector3f& scaleCenter,
|
||||
EGuiTextureClampModeHorz clampH, EGuiTextureClampModeVert clampV,
|
||||
CGuiStaticImage::EMaterialType matType, TResId txtrId1, TResId txtrId2,
|
||||
CGuiStaticImage::EMaterialType matType, ResId txtrId1, ResId txtrId2,
|
||||
const std::vector<float>& frame, bool useTexture);
|
||||
FourCC GetWidgetTypeID() const {return FOURCC('IMAG');}
|
||||
|
||||
void ScaleDimensions(const zeus::CVector3f& scale);
|
||||
void Draw(const CGuiWidgetDrawParms& parms) const;
|
||||
std::vector<TResId> GetTextureAssets() const;
|
||||
std::vector<ResId> GetTextureAssets() const;
|
||||
|
||||
static CGuiStaticImage* Create(CGuiFrame* frame, CInputStream& in, bool flag);
|
||||
};
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace urde
|
|||
{
|
||||
|
||||
CGuiTextPane::CGuiTextPane(const CGuiWidgetParms& parms, float xDim, float zDim,
|
||||
const zeus::CVector3f& vec, TResId fontId, const CGuiTextProperties& props,
|
||||
const zeus::CVector3f& vec, ResId fontId, const CGuiTextProperties& props,
|
||||
const zeus::CColor& fontCol, const zeus::CColor& outlineCol,
|
||||
s32 extentX, s32 extentY)
|
||||
: CGuiPane(parms, xDim, zDim, vec), x114_textSupport(fontId, props, fontCol, outlineCol,
|
||||
|
|
|
@ -12,7 +12,7 @@ class CGuiTextPane : public CGuiPane
|
|||
CGuiTextSupport x114_textSupport;
|
||||
public:
|
||||
CGuiTextPane(const CGuiWidgetParms& parms, float xDim, float zDim, const zeus::CVector3f& vec,
|
||||
TResId fontId, const CGuiTextProperties& props, const zeus::CColor& col1,
|
||||
ResId fontId, const CGuiTextProperties& props, const zeus::CColor& col1,
|
||||
const zeus::CColor& col2, s32 padX, s32 padY);
|
||||
FourCC GetWidgetTypeID() const {return FOURCC('TXPN');}
|
||||
|
||||
|
@ -20,7 +20,7 @@ public:
|
|||
const CGuiTextSupport* GetTextSupport() const {return &x114_textSupport;}
|
||||
void Update(float dt);
|
||||
bool GetIsFinishedLoadingWidgetSpecific() const;
|
||||
std::vector<TResId> GetFontAssets() const {return {x114_textSupport.x50_fontId};}
|
||||
std::vector<ResId> GetFontAssets() const {return {x114_textSupport.x50_fontId};}
|
||||
void SetDimensions(const zeus::CVector2f& dim, bool initVBO);
|
||||
void ScaleDimensions(const zeus::CVector3f& scale);
|
||||
void Draw(const CGuiWidgetDrawParms& parms) const;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
namespace urde
|
||||
{
|
||||
|
||||
CGuiTextSupport::CGuiTextSupport(TResId fontId, const CGuiTextProperties& props,
|
||||
CGuiTextSupport::CGuiTextSupport(ResId fontId, const CGuiTextProperties& props,
|
||||
const zeus::CColor& fontCol, const zeus::CColor& outlineCol,
|
||||
const zeus::CColor& geomCol, s32 padX, s32 padY, CSimplePool* store)
|
||||
: x10_props(props), x1c_fontColor(fontCol), x20_outlineColor(outlineCol),
|
||||
|
|
|
@ -87,13 +87,13 @@ class CGuiTextSupport
|
|||
bool x44_typeEnable = false;
|
||||
float x48_chFadeTime = 0.1f;
|
||||
float x4c_chRate = 10.0f;
|
||||
TResId x50_fontId;
|
||||
ResId x50_fontId;
|
||||
std::experimental::optional<CTextRenderBuffer> x54_renderBuf;
|
||||
bool x2ac_active = false;
|
||||
std::vector<CToken> x2b0_assets;
|
||||
TLockedToken<CRasterFont> x2c0_font;
|
||||
public:
|
||||
CGuiTextSupport(TResId fontId, const CGuiTextProperties& props,
|
||||
CGuiTextSupport(ResId fontId, const CGuiTextProperties& props,
|
||||
const zeus::CColor& fontCol, const zeus::CColor& outlineCol,
|
||||
const zeus::CColor& geomCol, s32 extX, s32 extY, CSimplePool* store);
|
||||
float GetCurrentAnimationOverAge() const;
|
||||
|
|
|
@ -111,17 +111,17 @@ void CGuiWidget::ParseAnimations(CInputStream& in, const CGuiWidgetParms& parms)
|
|||
assert(count == 0);
|
||||
}
|
||||
|
||||
std::vector<TResId> CGuiWidget::GetTextureAssets() const
|
||||
std::vector<ResId> CGuiWidget::GetTextureAssets() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<TResId> CGuiWidget::GetModelAssets() const
|
||||
std::vector<ResId> CGuiWidget::GetModelAssets() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<TResId> CGuiWidget::GetFontAssets() const
|
||||
std::vector<ResId> CGuiWidget::GetFontAssets() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -125,9 +125,9 @@ public:
|
|||
virtual void ParseBaseInfo(CGuiFrame* frame, CInputStream& in, const CGuiWidgetParms& parms);
|
||||
virtual void ParseMessages(CInputStream& in, const CGuiWidgetParms& parms);
|
||||
virtual void ParseAnimations(CInputStream& in, const CGuiWidgetParms& parms);
|
||||
virtual std::vector<TResId> GetTextureAssets() const;
|
||||
virtual std::vector<TResId> GetModelAssets() const;
|
||||
virtual std::vector<TResId> GetFontAssets() const;
|
||||
virtual std::vector<ResId> GetTextureAssets() const;
|
||||
virtual std::vector<ResId> GetModelAssets() const;
|
||||
virtual std::vector<ResId> GetFontAssets() const;
|
||||
virtual void Initialize();
|
||||
virtual void Touch() const;
|
||||
virtual bool GetIsVisible() const;
|
||||
|
|
|
@ -283,7 +283,7 @@ CFontImageDef CTextParser::GetImage(const wchar_t* str, int len)
|
|||
return CFontImageDef(std::move(tex), zeus::CVector2f(1.f, 1.f));
|
||||
}
|
||||
|
||||
TResId CTextParser::GetAssetIdFromString(const wchar_t* str)
|
||||
ResId CTextParser::GetAssetIdFromString(const wchar_t* str)
|
||||
{
|
||||
u8 r = GetColorValue(str);
|
||||
u8 g = GetColorValue(str + 2);
|
||||
|
|
|
@ -16,7 +16,7 @@ class CTextParser
|
|||
static u8 GetColorValue(const wchar_t* str);
|
||||
static u32 FromHex(wchar_t ch);
|
||||
static s32 ParseInt(const wchar_t* str, int len, bool signVal);
|
||||
static TResId GetAssetIdFromString(const wchar_t* str);
|
||||
static ResId GetAssetIdFromString(const wchar_t* str);
|
||||
static bool Equals(const wchar_t* str, int len, const wchar_t* other);
|
||||
static bool BeginsWith(const wchar_t* str, int len, const wchar_t* other);
|
||||
void ParseTag(CTextExecuteBuffer& out, const wchar_t* str, int len);
|
||||
|
|
|
@ -26,6 +26,7 @@ public:
|
|||
virtual void CancelBuild(const SObjectTag&)=0;
|
||||
virtual bool CanBuild(const SObjectTag&)=0;
|
||||
virtual const SObjectTag* GetResourceIdByName(const char*) const=0;
|
||||
virtual FourCC GetResourceTypeById(ResId id) const=0;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ using CPF = CParticleDataFactory;
|
|||
void CCollisionResponseData::AddParticleSystemToResponse(EWeaponCollisionResponseTypes type, CInputStream &in, CSimplePool *resPool)
|
||||
{
|
||||
int i = int(type);
|
||||
std::vector<TResId> tracker;
|
||||
std::vector<ResId> tracker;
|
||||
tracker.resize(8);
|
||||
x0_generators[i].emplace(std::move(CPF::GetChildGeneratorDesc(in, resPool, tracker).m_token));
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ bool CCollisionResponseData::CheckAndAddDecalToResponse(FourCC clsId, CInputStre
|
|||
if (cls == SBIG('NONE'))
|
||||
return true;
|
||||
|
||||
TResId id = CPF::GetInt(in);
|
||||
ResId id = CPF::GetInt(in);
|
||||
if (!id)
|
||||
return true;
|
||||
|
||||
|
@ -158,7 +158,7 @@ CCollisionResponseData::CCollisionResponseData(CInputStream& in, CSimplePool* re
|
|||
x0_generators.resize(94);
|
||||
x10_sfx.resize(94);
|
||||
x20_decals.resize(94);
|
||||
for (TResId& id : x10_sfx)
|
||||
for (ResId& id : x10_sfx)
|
||||
id = ~0;
|
||||
|
||||
FourCC clsId = CPF::GetClassID(in);
|
||||
|
|
|
@ -41,7 +41,7 @@ class CCollisionResponseData
|
|||
{
|
||||
|
||||
std::vector<std::experimental::optional<TLockedToken<CGenDescription>>> x0_generators;
|
||||
std::vector<TResId> x10_sfx;
|
||||
std::vector<ResId> x10_sfx;
|
||||
std::vector<std::experimental::optional<TLockedToken<CDecalDescription>>> x20_decals;
|
||||
float x30_RNGE;
|
||||
float x34_FOFF;
|
||||
|
|
|
@ -7,7 +7,7 @@ bool CDecalManager::m_PoolInitialized = false;
|
|||
s32 CDecalManager::m_FreeIndex = 63;
|
||||
float CDecalManager::m_DeltaTimeSinceLastDecalCreation = 0.f;
|
||||
s32 CDecalManager::m_LastDecalCreatedIndex = -1;
|
||||
TResId CDecalManager::m_LastDecalCreatedAssetId = -1;
|
||||
ResId CDecalManager::m_LastDecalCreatedAssetId = -1;
|
||||
|
||||
void CDecalManager::Initialize()
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ class CDecalManager
|
|||
static s32 m_FreeIndex;
|
||||
static float m_DeltaTimeSinceLastDecalCreation;
|
||||
static s32 m_LastDecalCreatedIndex;
|
||||
static TResId m_LastDecalCreatedAssetId;
|
||||
static ResId m_LastDecalCreatedAssetId;
|
||||
static rstl::reserved_vector<SDecal, 64> m_DecalPool;
|
||||
static rstl::reserved_vector<s32, 64> m_ActiveIndexList;
|
||||
public:
|
||||
|
|
|
@ -41,25 +41,25 @@ SParticleModel CParticleDataFactory::GetModel(CInputStream& in, CSimplePool* res
|
|||
FourCC clsId = GetClassID(in);
|
||||
if (clsId == SBIG('NONE'))
|
||||
return {};
|
||||
TResId id = in.readUint32Big();
|
||||
ResId id = in.readUint32Big();
|
||||
if (!id)
|
||||
return {};
|
||||
return {std::move(resPool->GetObj({FOURCC('CMDL'), id})), true};
|
||||
}
|
||||
|
||||
SChildGeneratorDesc CParticleDataFactory::GetChildGeneratorDesc(TResId res, CSimplePool* resPool, const std::vector<TResId>& tracker)
|
||||
SChildGeneratorDesc CParticleDataFactory::GetChildGeneratorDesc(ResId res, CSimplePool* resPool, const std::vector<ResId>& tracker)
|
||||
{
|
||||
if (std::count(tracker.cbegin(), tracker.cend(), res) == 0)
|
||||
return {std::move(resPool->GetObj({FOURCC('PART'), res})), true};
|
||||
return {};
|
||||
}
|
||||
|
||||
SChildGeneratorDesc CParticleDataFactory::GetChildGeneratorDesc(CInputStream& in, CSimplePool* resPool, const std::vector<TResId>& tracker)
|
||||
SChildGeneratorDesc CParticleDataFactory::GetChildGeneratorDesc(CInputStream& in, CSimplePool* resPool, const std::vector<ResId>& tracker)
|
||||
{
|
||||
FourCC clsId = GetClassID(in);
|
||||
if (clsId == SBIG('NONE'))
|
||||
return {};
|
||||
TResId id = in.readUint32Big();
|
||||
ResId id = in.readUint32Big();
|
||||
if (!id)
|
||||
return {};
|
||||
return GetChildGeneratorDesc(id, resPool, tracker);
|
||||
|
@ -70,7 +70,7 @@ SSwooshGeneratorDesc CParticleDataFactory::GetSwooshGeneratorDesc(CInputStream&
|
|||
FourCC clsId = GetClassID(in);
|
||||
if (clsId == SBIG('NONE'))
|
||||
return {};
|
||||
TResId id = in.readUint32Big();
|
||||
ResId id = in.readUint32Big();
|
||||
if (!id)
|
||||
return {};
|
||||
return {std::move(resPool->GetObj({FOURCC('SWHC'), id})), true};
|
||||
|
@ -81,7 +81,7 @@ SElectricGeneratorDesc CParticleDataFactory::GetElectricGeneratorDesc(CInputStre
|
|||
FourCC clsId = GetClassID(in);
|
||||
if (clsId == SBIG('NONE'))
|
||||
return {};
|
||||
TResId id = in.readUint32Big();
|
||||
ResId id = in.readUint32Big();
|
||||
if (!id)
|
||||
return {};
|
||||
return {std::move(resPool->GetObj({FOURCC('ELSC'), id})), true};
|
||||
|
@ -97,7 +97,7 @@ CUVElement* CParticleDataFactory::GetTextureElement(CInputStream& in, CSimplePoo
|
|||
FourCC subId = GetClassID(in);
|
||||
if (subId == SBIG('NONE'))
|
||||
return nullptr;
|
||||
TResId id = in.readUint32Big();
|
||||
ResId id = in.readUint32Big();
|
||||
TToken<CTexture> txtr = resPool->GetObj({FOURCC('TXTR'), id});
|
||||
return new CUVEConstant(std::move(txtr));
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ CUVElement* CParticleDataFactory::GetTextureElement(CInputStream& in, CSimplePoo
|
|||
FourCC subId = GetClassID(in);
|
||||
if (subId == SBIG('NONE'))
|
||||
return nullptr;
|
||||
TResId id = in.readUint32Big();
|
||||
ResId id = in.readUint32Big();
|
||||
CIntElement* a = GetIntElement(in);
|
||||
CIntElement* b = GetIntElement(in);
|
||||
CIntElement* c = GetIntElement(in);
|
||||
|
@ -827,13 +827,13 @@ CIntElement* CParticleDataFactory::GetIntElement(CInputStream& in)
|
|||
|
||||
CGenDescription* CParticleDataFactory::GetGeneratorDesc(CInputStream& in, CSimplePool* resPool)
|
||||
{
|
||||
std::vector<TResId> tracker;
|
||||
std::vector<ResId> tracker;
|
||||
tracker.reserve(8);
|
||||
return CreateGeneratorDescription(in, tracker, 0, resPool);
|
||||
}
|
||||
|
||||
CGenDescription* CParticleDataFactory::CreateGeneratorDescription(CInputStream& in, std::vector<TResId>& tracker,
|
||||
TResId resId, CSimplePool* resPool)
|
||||
CGenDescription* CParticleDataFactory::CreateGeneratorDescription(CInputStream& in, std::vector<ResId>& tracker,
|
||||
ResId resId, CSimplePool* resPool)
|
||||
{
|
||||
if (std::count(tracker.cbegin(), tracker.cend(), resId) == 0)
|
||||
{
|
||||
|
@ -851,7 +851,7 @@ CGenDescription* CParticleDataFactory::CreateGeneratorDescription(CInputStream&
|
|||
}
|
||||
|
||||
bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& in,
|
||||
std::vector<TResId>& tracker, CSimplePool* resPool)
|
||||
std::vector<ResId>& tracker, CSimplePool* resPool)
|
||||
{
|
||||
CRandom16 rand{99};
|
||||
CGlobalRandom gr(rand);
|
||||
|
|
|
@ -72,8 +72,8 @@ class CParticleDataFactory
|
|||
friend class CProjectileWeaponDataFactory;
|
||||
|
||||
static SParticleModel GetModel(CInputStream& in, CSimplePool* resPool);
|
||||
static SChildGeneratorDesc GetChildGeneratorDesc(TResId res, CSimplePool* resPool, const std::vector<TResId>& tracker);
|
||||
static SChildGeneratorDesc GetChildGeneratorDesc(CInputStream& in, CSimplePool* resPool, const std::vector<TResId>& tracker);
|
||||
static SChildGeneratorDesc GetChildGeneratorDesc(ResId res, CSimplePool* resPool, const std::vector<ResId>& tracker);
|
||||
static SChildGeneratorDesc GetChildGeneratorDesc(CInputStream& in, CSimplePool* resPool, const std::vector<ResId>& tracker);
|
||||
static SSwooshGeneratorDesc GetSwooshGeneratorDesc(CInputStream& in, CSimplePool* resPool);
|
||||
static SElectricGeneratorDesc GetElectricGeneratorDesc(CInputStream& in, CSimplePool* resPool);
|
||||
static CUVElement* GetTextureElement(CInputStream& in, CSimplePool* resPool);
|
||||
|
@ -88,10 +88,10 @@ class CParticleDataFactory
|
|||
static int32_t GetInt(CInputStream& in);
|
||||
static bool GetBool(CInputStream& in);
|
||||
static FourCC GetClassID(CInputStream& in);
|
||||
static CGenDescription* CreateGeneratorDescription(CInputStream& in, std::vector<TResId>& tracker,
|
||||
TResId resId, CSimplePool* resPool);
|
||||
static CGenDescription* CreateGeneratorDescription(CInputStream& in, std::vector<ResId>& tracker,
|
||||
ResId resId, CSimplePool* resPool);
|
||||
static bool CreateGPSM(CGenDescription* fillDesc, CInputStream& in,
|
||||
std::vector<TResId>& tracker, CSimplePool* resPool);
|
||||
std::vector<ResId>& tracker, CSimplePool* resPool);
|
||||
static void LoadGPSMTokens(CGenDescription* desc);
|
||||
public:
|
||||
static CGenDescription* GetGeneratorDesc(CInputStream& in, CSimplePool* resPool);
|
||||
|
|
|
@ -95,14 +95,14 @@ bool CParticleElectricDataFactory::CreateELSM(CElectricDescription *desc, CInput
|
|||
break;
|
||||
case SBIG('GPSM'):
|
||||
{
|
||||
std::vector<TResId> tracker;
|
||||
std::vector<ResId> tracker;
|
||||
tracker.reserve(8);
|
||||
desc->x50_GPSM = CPF::GetChildGeneratorDesc(in, resPool, tracker);
|
||||
break;
|
||||
}
|
||||
case SBIG('EPSM'):
|
||||
{
|
||||
std::vector<TResId> tracker;
|
||||
std::vector<ResId> tracker;
|
||||
tracker.reserve(8);
|
||||
desc->x60_EPSM = CPF::GetChildGeneratorDesc(in, resPool, tracker);
|
||||
break;
|
||||
|
|
|
@ -94,14 +94,14 @@ bool CProjectileWeaponDataFactory::CreateWPSM(CWeaponDescription* desc, CInputSt
|
|||
break;
|
||||
case SBIG('APSM'):
|
||||
{
|
||||
std::vector<TResId> tracker;
|
||||
std::vector<ResId> tracker;
|
||||
tracker.reserve(8);
|
||||
desc->x34_APSM = CPF::GetChildGeneratorDesc(in, resPool, tracker);
|
||||
break;
|
||||
}
|
||||
case SBIG('APS2'):
|
||||
{
|
||||
std::vector<TResId> tracker;
|
||||
std::vector<ResId> tracker;
|
||||
tracker.reserve(8);
|
||||
desc->x44_APS2 = CPF::GetChildGeneratorDesc(in, resPool, tracker);
|
||||
break;
|
||||
|
@ -123,7 +123,7 @@ bool CProjectileWeaponDataFactory::CreateWPSM(CWeaponDescription* desc, CInputSt
|
|||
FourCC cid = CPF::GetClassID(in);
|
||||
if (cid == SBIG('NONE'))
|
||||
break;
|
||||
TResId id = CPF::GetInt(in);
|
||||
ResId id = CPF::GetInt(in);
|
||||
if (id)
|
||||
desc->x94_COLR = {resPool->GetObj({FOURCC('CRSC'), id}), true};
|
||||
break;
|
||||
|
|
|
@ -13,17 +13,17 @@ namespace urde
|
|||
{
|
||||
|
||||
using FourCC = hecl::FourCC;
|
||||
using TResId = s64;
|
||||
using ResId = s64;
|
||||
|
||||
struct SObjectTag
|
||||
{
|
||||
FourCC type;
|
||||
TResId id = -1;
|
||||
ResId id = -1;
|
||||
operator bool() const {return id != -1;}
|
||||
bool operator!=(const SObjectTag& other) const {return id != other.id;}
|
||||
bool operator==(const SObjectTag& other) const {return id == other.id;}
|
||||
SObjectTag() = default;
|
||||
SObjectTag(FourCC tp, TResId rid) : type(tp), id(rid) {}
|
||||
SObjectTag(FourCC tp, ResId rid) : type(tp), id(rid) {}
|
||||
SObjectTag(CInputStream& in)
|
||||
{
|
||||
in.readBytesToBuf(&type, 4);
|
||||
|
|
2
specter
2
specter
|
@ -1 +1 @@
|
|||
Subproject commit 1cc8a922f7e015c76f8dd071c713b09b26912a33
|
||||
Subproject commit c4d0d0e8016f2d8f0772e5ad63e2ac1ed2a07915
|
Loading…
Reference in New Issue