General: Remove unnecessary inline specifiers and add overrides
This commit is contained in:
parent
2d76c5865a
commit
012da6fb6d
|
@ -35,12 +35,12 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int LightLayerIndex() const
|
int LightLayerIndex() const
|
||||||
{
|
{
|
||||||
return mLightLayer.IsValid() ? mLightLayer.Get() : 0;
|
return mLightLayer.IsValid() ? mLightLayer.Get() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline EWorldLightingOptions WorldLightingOptions() const
|
EWorldLightingOptions WorldLightingOptions() const
|
||||||
{
|
{
|
||||||
return mWorldLightingOptions.IsValid() ? mWorldLightingOptions.Get() : eNormalLighting;
|
return mWorldLightingOptions.IsValid() ? mWorldLightingOptions.Get() : eNormalLighting;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,21 +22,21 @@ public:
|
||||||
|
|
||||||
class CMayaSpline
|
class CMayaSpline
|
||||||
{
|
{
|
||||||
uint mPreInfinity; // 0x00
|
uint mPreInfinity = 0; // 0x00
|
||||||
uint mPostInfinity; // 0x04
|
uint mPostInfinity = 0; // 0x04
|
||||||
std::vector<CMayaSplineKnot> mKnots; // 0x08, 0x0C, 0x10
|
std::vector<CMayaSplineKnot> mKnots; // 0x08, 0x0C, 0x10
|
||||||
uint mClampMode; // 0x14 - clamp mode
|
uint mClampMode = 0; // 0x14 - clamp mode
|
||||||
float mMinAmplitude; // 0x18
|
float mMinAmplitude = 0.0f; // 0x18
|
||||||
float mMaxAmplitude; // 0x1C
|
float mMaxAmplitude = 0.0f; // 0x1C
|
||||||
|
|
||||||
mutable int mCachedKnotIndex; // 0x20
|
mutable int mCachedKnotIndex = 0; // 0x20
|
||||||
mutable int mUnknown1; // 0x24
|
mutable int mUnknown1 = 0; // 0x24
|
||||||
mutable uint8 mDirtyFlags; // 0x28
|
mutable uint8 mDirtyFlags = 0; // 0x28
|
||||||
mutable float mCachedMinTime; // 0x2C
|
mutable float mCachedMinTime = 0.0f; // 0x2C
|
||||||
mutable float mCachedHermiteCoefficients[4]; // 0x30, 0x34, 0x38, 0x3C
|
mutable float mCachedHermiteCoefficients[4] = {}; // 0x30, 0x34, 0x38, 0x3C
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMayaSpline() {}
|
CMayaSpline() = default;
|
||||||
uint GetKnotCount() const;
|
uint GetKnotCount() const;
|
||||||
const std::vector<CMayaSplineKnot>& GetKnots() const;
|
const std::vector<CMayaSplineKnot>& GetKnots() const;
|
||||||
float GetMinTime() const;
|
float GetMinTime() const;
|
||||||
|
|
|
@ -45,18 +45,18 @@ public:
|
||||||
static IDependencyNode* ArchiveConstructor(EDependencyNodeType Type);
|
static IDependencyNode* ArchiveConstructor(EDependencyNodeType Type);
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline uint NumChildren() const { return mChildren.size(); }
|
uint NumChildren() const { return mChildren.size(); }
|
||||||
inline IDependencyNode* ChildByIndex(uint Index) const { return mChildren[Index]; }
|
IDependencyNode* ChildByIndex(uint Index) const { return mChildren[Index]; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Basic dependency tree; this class is sufficient for most resource types.
|
// Basic dependency tree; this class is sufficient for most resource types.
|
||||||
class CDependencyTree : public IDependencyNode
|
class CDependencyTree : public IDependencyNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CDependencyTree() {}
|
CDependencyTree() = default;
|
||||||
|
|
||||||
virtual EDependencyNodeType Type() const;
|
EDependencyNodeType Type() const override;
|
||||||
virtual void Serialize(IArchive& rArc);
|
void Serialize(IArchive& rArc) override;
|
||||||
|
|
||||||
void AddChild(IDependencyNode *pNode);
|
void AddChild(IDependencyNode *pNode);
|
||||||
void AddDependency(const CAssetID& rkID, bool AvoidDuplicates = true);
|
void AddDependency(const CAssetID& rkID, bool AvoidDuplicates = true);
|
||||||
|
@ -71,17 +71,17 @@ protected:
|
||||||
CAssetID mID;
|
CAssetID mID;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CResourceDependency() {}
|
CResourceDependency() = default;
|
||||||
CResourceDependency(const CAssetID& rkID) : mID(rkID) {}
|
CResourceDependency(const CAssetID& rkID) : mID(rkID) {}
|
||||||
|
|
||||||
virtual EDependencyNodeType Type() const;
|
EDependencyNodeType Type() const override;
|
||||||
virtual void Serialize(IArchive& rArc);
|
void Serialize(IArchive& rArc) override;
|
||||||
virtual void GetAllResourceReferences(std::set<CAssetID>& rOutSet) const;
|
void GetAllResourceReferences(std::set<CAssetID>& rOutSet) const override;
|
||||||
virtual bool HasDependency(const CAssetID& rkID) const;
|
bool HasDependency(const CAssetID& rkID) const override;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline CAssetID ID() const { return mID; }
|
CAssetID ID() const { return mID; }
|
||||||
inline void SetID(const CAssetID& rkID) { mID = rkID; }
|
void SetID(const CAssetID& rkID) { mID = rkID; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Node representing a single resource dependency referenced by a script property.
|
// Node representing a single resource dependency referenced by a script property.
|
||||||
|
@ -90,58 +90,53 @@ class CPropertyDependency : public CResourceDependency
|
||||||
TString mIDString;
|
TString mIDString;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CPropertyDependency()
|
CPropertyDependency() = default;
|
||||||
: CResourceDependency()
|
|
||||||
{}
|
|
||||||
|
|
||||||
CPropertyDependency(const TString& rkPropID, const CAssetID& rkAssetID)
|
CPropertyDependency(const TString& rkPropID, const CAssetID& rkAssetID)
|
||||||
: CResourceDependency(rkAssetID)
|
: CResourceDependency(rkAssetID)
|
||||||
, mIDString(rkPropID)
|
, mIDString(rkPropID)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual EDependencyNodeType Type() const;
|
EDependencyNodeType Type() const override;
|
||||||
virtual void Serialize(IArchive& rArc);
|
void Serialize(IArchive& rArc) override;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline TString PropertyID() const { return mIDString; }
|
TString PropertyID() const { return mIDString; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Node representing a single animset dependency referenced by a script property. Indicates which character is being used.
|
// Node representing a single animset dependency referenced by a script property. Indicates which character is being used.
|
||||||
class CCharPropertyDependency : public CPropertyDependency
|
class CCharPropertyDependency : public CPropertyDependency
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
int mUsedChar;
|
int mUsedChar = -1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CCharPropertyDependency()
|
CCharPropertyDependency() = default;
|
||||||
: CPropertyDependency()
|
|
||||||
, mUsedChar(-1)
|
|
||||||
{}
|
|
||||||
|
|
||||||
CCharPropertyDependency(const TString& rkPropID, const CAssetID& rkAssetID, int UsedChar)
|
CCharPropertyDependency(const TString& rkPropID, const CAssetID& rkAssetID, int UsedChar)
|
||||||
: CPropertyDependency(rkPropID, rkAssetID)
|
: CPropertyDependency(rkPropID, rkAssetID)
|
||||||
, mUsedChar(UsedChar)
|
, mUsedChar(UsedChar)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual EDependencyNodeType Type() const;
|
EDependencyNodeType Type() const override;
|
||||||
virtual void Serialize(IArchive& rArc);
|
void Serialize(IArchive& rArc) override;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline int UsedChar() const { return mUsedChar; }
|
int UsedChar() const { return mUsedChar; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Node representing a script object. Indicates the type of object.
|
// Node representing a script object. Indicates the type of object.
|
||||||
class CScriptInstanceDependency : public IDependencyNode
|
class CScriptInstanceDependency : public IDependencyNode
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
uint mObjectType;
|
uint mObjectType = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual EDependencyNodeType Type() const;
|
EDependencyNodeType Type() const override;
|
||||||
virtual void Serialize(IArchive& rArc);
|
void Serialize(IArchive& rArc) override;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline uint ObjectType() const { return mObjectType; }
|
uint ObjectType() const { return mObjectType; }
|
||||||
|
|
||||||
// Static
|
// Static
|
||||||
static CScriptInstanceDependency* BuildTree(CScriptObject *pInstance);
|
static CScriptInstanceDependency* BuildTree(CScriptObject *pInstance);
|
||||||
|
@ -151,17 +146,17 @@ public:
|
||||||
class CSetCharacterDependency : public CDependencyTree
|
class CSetCharacterDependency : public CDependencyTree
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
uint32 mCharSetIndex;
|
uint32 mCharSetIndex = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSetCharacterDependency() : CDependencyTree() {}
|
CSetCharacterDependency() = default;
|
||||||
CSetCharacterDependency(uint32 SetIndex) : CDependencyTree(), mCharSetIndex(SetIndex) {}
|
CSetCharacterDependency(uint32 SetIndex) : mCharSetIndex(SetIndex) {}
|
||||||
|
|
||||||
virtual EDependencyNodeType Type() const;
|
EDependencyNodeType Type() const override;
|
||||||
virtual void Serialize(IArchive& rArc);
|
void Serialize(IArchive& rArc) override;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline uint32 CharSetIndex() const { return mCharSetIndex; }
|
uint32 CharSetIndex() const { return mCharSetIndex; }
|
||||||
|
|
||||||
// Static
|
// Static
|
||||||
static CSetCharacterDependency* BuildTree(const SSetCharacter& rkChar);
|
static CSetCharacterDependency* BuildTree(const SSetCharacter& rkChar);
|
||||||
|
@ -174,14 +169,14 @@ protected:
|
||||||
std::set<uint32> mCharacterIndices;
|
std::set<uint32> mCharacterIndices;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSetAnimationDependency() : CDependencyTree() {}
|
CSetAnimationDependency() = default;
|
||||||
|
|
||||||
virtual EDependencyNodeType Type() const;
|
EDependencyNodeType Type() const override;
|
||||||
virtual void Serialize(IArchive& rArc);
|
void Serialize(IArchive& rArc) override;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline bool IsUsedByCharacter(uint32 CharIdx) const { return mCharacterIndices.find(CharIdx) != mCharacterIndices.end(); }
|
bool IsUsedByCharacter(uint32 CharIdx) const { return mCharacterIndices.find(CharIdx) != mCharacterIndices.end(); }
|
||||||
inline bool IsUsedByAnyCharacter() const { return !mCharacterIndices.empty(); }
|
bool IsUsedByAnyCharacter() const { return !mCharacterIndices.empty(); }
|
||||||
|
|
||||||
// Static
|
// Static
|
||||||
static CSetAnimationDependency* BuildTree(const CAnimSet *pkOwnerSet, uint32 AnimIndex);
|
static CSetAnimationDependency* BuildTree(const CAnimSet *pkOwnerSet, uint32 AnimIndex);
|
||||||
|
@ -191,18 +186,18 @@ public:
|
||||||
class CAnimEventDependency : public CResourceDependency
|
class CAnimEventDependency : public CResourceDependency
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
uint32 mCharIndex;
|
uint32 mCharIndex = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAnimEventDependency() : CResourceDependency() {}
|
CAnimEventDependency() = default;
|
||||||
CAnimEventDependency(const CAssetID& rkID, uint32 CharIndex)
|
CAnimEventDependency(const CAssetID& rkID, uint32 CharIndex)
|
||||||
: CResourceDependency(rkID), mCharIndex(CharIndex) {}
|
: CResourceDependency(rkID), mCharIndex(CharIndex) {}
|
||||||
|
|
||||||
virtual EDependencyNodeType Type() const;
|
EDependencyNodeType Type() const override;
|
||||||
virtual void Serialize(IArchive& rArc);
|
void Serialize(IArchive& rArc) override;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline uint32 CharIndex() const { return mCharIndex; }
|
uint32 CharIndex() const { return mCharIndex; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Node representing an area. Tracks dependencies on a per-instance basis and can separate dependencies of different script layers.
|
// Node representing an area. Tracks dependencies on a per-instance basis and can separate dependencies of different script layers.
|
||||||
|
@ -212,17 +207,17 @@ protected:
|
||||||
std::vector<uint32> mLayerOffsets;
|
std::vector<uint32> mLayerOffsets;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAreaDependencyTree() : CDependencyTree() {}
|
CAreaDependencyTree() = default;
|
||||||
|
|
||||||
virtual EDependencyNodeType Type() const;
|
EDependencyNodeType Type() const override;
|
||||||
virtual void Serialize(IArchive& rArc);
|
void Serialize(IArchive& rArc) override;
|
||||||
|
|
||||||
void AddScriptLayer(CScriptLayer *pLayer, const std::vector<CAssetID>& rkExtraDeps);
|
void AddScriptLayer(CScriptLayer *pLayer, const std::vector<CAssetID>& rkExtraDeps);
|
||||||
void GetModuleDependencies(EGame Game, std::vector<TString>& rModuleDepsOut, std::vector<uint32>& rModuleLayerOffsetsOut) const;
|
void GetModuleDependencies(EGame Game, std::vector<TString>& rModuleDepsOut, std::vector<uint32>& rModuleLayerOffsetsOut) const;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline uint32 NumScriptLayers() const { return mLayerOffsets.size(); }
|
uint32 NumScriptLayers() const { return mLayerOffsets.size(); }
|
||||||
inline uint32 ScriptLayerOffset(uint32 LayerIdx) const { return mLayerOffsets[LayerIdx]; }
|
uint32 ScriptLayerOffset(uint32 LayerIdx) const { return mLayerOffsets[LayerIdx]; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CDEPENDENCYTREE
|
#endif // CDEPENDENCYTREE
|
||||||
|
|
|
@ -78,7 +78,7 @@ public:
|
||||||
void LoadResource(const CAssetID& rkID, std::vector<uint8>& rBuffer);
|
void LoadResource(const CAssetID& rkID, std::vector<uint8>& rBuffer);
|
||||||
bool ShouldExportDiscNode(const nod::Node *pkNode, bool IsInRoot);
|
bool ShouldExportDiscNode(const nod::Node *pkNode, bool IsInRoot);
|
||||||
|
|
||||||
inline TString ProjectPath() const { return mProjectPath; }
|
TString ProjectPath() const { return mProjectPath; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool ExtractDiscData();
|
bool ExtractDiscData();
|
||||||
|
@ -91,7 +91,7 @@ protected:
|
||||||
TString MakeWorldName(CAssetID WorldID);
|
TString MakeWorldName(CAssetID WorldID);
|
||||||
|
|
||||||
// Convenience Functions
|
// Convenience Functions
|
||||||
inline SResourceInstance* FindResourceInstance(const CAssetID& rkID)
|
SResourceInstance* FindResourceInstance(const CAssetID& rkID)
|
||||||
{
|
{
|
||||||
uint64 IntegralID = rkID.ToLongLong();
|
uint64 IntegralID = rkID.ToLongLong();
|
||||||
auto Found = mResourceMap.find(IntegralID);
|
auto Found = mResourceMap.find(IntegralID);
|
||||||
|
|
|
@ -82,34 +82,34 @@ public:
|
||||||
static CGameProject* LoadProject(const TString& rkProjPath, IProgressNotifier *pProgress);
|
static CGameProject* LoadProject(const TString& rkProjPath, IProgressNotifier *pProgress);
|
||||||
|
|
||||||
// Directory Handling
|
// Directory Handling
|
||||||
inline TString ProjectRoot() const { return mProjectRoot; }
|
TString ProjectRoot() const { return mProjectRoot; }
|
||||||
inline TString ProjectPath() const { return mProjectRoot + FileUtil::SanitizeName(mProjectName, false) + ".prj"; }
|
TString ProjectPath() const { return mProjectRoot + FileUtil::SanitizeName(mProjectName, false) + ".prj"; }
|
||||||
inline TString HiddenFilesDir() const { return mProjectRoot + ".project/"; }
|
TString HiddenFilesDir() const { return mProjectRoot + ".project/"; }
|
||||||
inline TString DiscDir(bool Relative) const { return Relative ? "Disc/" : mProjectRoot + "Disc/"; }
|
TString DiscDir(bool Relative) const { return Relative ? "Disc/" : mProjectRoot + "Disc/"; }
|
||||||
inline TString PackagesDir(bool Relative) const { return Relative ? "Packages/" : mProjectRoot + "Packages/"; }
|
TString PackagesDir(bool Relative) const { return Relative ? "Packages/" : mProjectRoot + "Packages/"; }
|
||||||
inline TString ResourcesDir(bool Relative) const { return Relative ? "Resources/" : mProjectRoot + "Resources/"; }
|
TString ResourcesDir(bool Relative) const { return Relative ? "Resources/" : mProjectRoot + "Resources/"; }
|
||||||
|
|
||||||
// Disc Filesystem Management
|
// Disc Filesystem Management
|
||||||
inline TString DiscFilesystemRoot(bool Relative) const { return DiscDir(Relative) + (IsWiiBuild() ? "DATA/" : "") + "files/"; }
|
TString DiscFilesystemRoot(bool Relative) const { return DiscDir(Relative) + (IsWiiBuild() ? "DATA/" : "") + "files/"; }
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline void SetProjectName(const TString& rkName) { mProjectName = rkName; }
|
void SetProjectName(const TString& rkName) { mProjectName = rkName; }
|
||||||
|
|
||||||
inline TString Name() const { return mProjectName; }
|
TString Name() const { return mProjectName; }
|
||||||
inline uint32 NumPackages() const { return mPackages.size(); }
|
uint32 NumPackages() const { return mPackages.size(); }
|
||||||
inline CPackage* PackageByIndex(uint32 Index) const { return mPackages[Index]; }
|
CPackage* PackageByIndex(uint32 Index) const { return mPackages[Index]; }
|
||||||
inline void AddPackage(CPackage *pPackage) { mPackages.push_back(pPackage); }
|
void AddPackage(CPackage *pPackage) { mPackages.push_back(pPackage); }
|
||||||
inline CResourceStore* ResourceStore() const { return mpResourceStore.get(); }
|
CResourceStore* ResourceStore() const { return mpResourceStore.get(); }
|
||||||
inline CGameInfo* GameInfo() const { return mpGameInfo.get(); }
|
CGameInfo* GameInfo() const { return mpGameInfo.get(); }
|
||||||
inline CAudioManager* AudioManager() const { return mpAudioManager.get(); }
|
CAudioManager* AudioManager() const { return mpAudioManager.get(); }
|
||||||
inline CTweakManager* TweakManager() const { return mpTweakManager.get(); }
|
CTweakManager* TweakManager() const { return mpTweakManager.get(); }
|
||||||
inline EGame Game() const { return mGame; }
|
EGame Game() const { return mGame; }
|
||||||
inline ERegion Region() const { return mRegion; }
|
ERegion Region() const { return mRegion; }
|
||||||
inline TString GameID() const { return mGameID; }
|
TString GameID() const { return mGameID; }
|
||||||
inline float BuildVersion() const { return mBuildVersion; }
|
float BuildVersion() const { return mBuildVersion; }
|
||||||
inline bool IsWiiBuild() const { return mBuildVersion >= 3.f; }
|
bool IsWiiBuild() const { return mBuildVersion >= 3.f; }
|
||||||
inline bool IsTrilogy() const { return mGame <= EGame::Corruption && mBuildVersion >= 3.593f; }
|
bool IsTrilogy() const { return mGame <= EGame::Corruption && mBuildVersion >= 3.593f; }
|
||||||
inline bool IsWiiDeAsobu() const { return mGame <= EGame::Corruption && mBuildVersion >= 3.570f && mBuildVersion < 3.593f; }
|
bool IsWiiDeAsobu() const { return mGame <= EGame::Corruption && mBuildVersion >= 3.570f && mBuildVersion < 3.593f; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CGAMEPROJECT_H
|
#endif // CGAMEPROJECT_H
|
||||||
|
|
|
@ -13,7 +13,7 @@ class COpeningBanner
|
||||||
bool mWii;
|
bool mWii;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
COpeningBanner(CGameProject *pProj);
|
explicit COpeningBanner(CGameProject *pProj);
|
||||||
TString EnglishGameName() const;
|
TString EnglishGameName() const;
|
||||||
void SetEnglishGameName(const TString& rkName);
|
void SetEnglishGameName(const TString& rkName);
|
||||||
void Save();
|
void Save();
|
||||||
|
|
|
@ -34,24 +34,22 @@ struct SNamedResource
|
||||||
|
|
||||||
class CPackage
|
class CPackage
|
||||||
{
|
{
|
||||||
CGameProject *mpProject;
|
CGameProject *mpProject = nullptr;
|
||||||
TString mPakName;
|
TString mPakName;
|
||||||
TString mPakPath;
|
TString mPakPath;
|
||||||
std::vector<SNamedResource> mResources;
|
std::vector<SNamedResource> mResources;
|
||||||
bool mNeedsRecook;
|
bool mNeedsRecook = false;
|
||||||
|
|
||||||
// Cached dependency list; used to figure out if a given resource is in this package
|
// Cached dependency list; used to figure out if a given resource is in this package
|
||||||
mutable bool mCacheDirty;
|
mutable bool mCacheDirty = false;
|
||||||
mutable std::set<CAssetID> mCachedDependencies;
|
mutable std::set<CAssetID> mCachedDependencies;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CPackage() {}
|
CPackage() = default;
|
||||||
|
|
||||||
CPackage(CGameProject *pProj, const TString& rkName, const TString& rkPath)
|
CPackage(CGameProject *pProj, const TString& rkName, const TString& rkPath)
|
||||||
: mpProject(pProj)
|
: mpProject(pProj)
|
||||||
, mPakName(rkName)
|
, mPakName(rkName)
|
||||||
, mPakPath(rkPath)
|
, mPakPath(rkPath)
|
||||||
, mNeedsRecook(false)
|
|
||||||
, mCacheDirty(true)
|
, mCacheDirty(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -70,14 +68,14 @@ public:
|
||||||
TString CookedPackagePath(bool Relative) const;
|
TString CookedPackagePath(bool Relative) const;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline TString Name() const { return mPakName; }
|
TString Name() const { return mPakName; }
|
||||||
inline TString Path() const { return mPakPath; }
|
TString Path() const { return mPakPath; }
|
||||||
inline CGameProject* Project() const { return mpProject; }
|
CGameProject* Project() const { return mpProject; }
|
||||||
inline uint32 NumNamedResources() const { return mResources.size(); }
|
uint32 NumNamedResources() const { return mResources.size(); }
|
||||||
inline const SNamedResource& NamedResourceByIndex(uint32 Idx) const { return mResources[Idx]; }
|
const SNamedResource& NamedResourceByIndex(uint32 Idx) const { return mResources[Idx]; }
|
||||||
inline bool NeedsRecook() const { return mNeedsRecook; }
|
bool NeedsRecook() const { return mNeedsRecook; }
|
||||||
|
|
||||||
inline void SetPakName(TString NewName) { mPakName = NewName; }
|
void SetPakName(TString NewName) { mPakName = std::move(NewName); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CPACKAGE
|
#endif // CPACKAGE
|
||||||
|
|
|
@ -41,7 +41,7 @@ class CResourceEntry
|
||||||
mutable TString mCachedUppercaseName; // This is used to speed up case-insensitive sorting and filtering.
|
mutable TString mCachedUppercaseName; // This is used to speed up case-insensitive sorting and filtering.
|
||||||
|
|
||||||
// Private constructor
|
// Private constructor
|
||||||
CResourceEntry(CResourceStore *pStore);
|
explicit CResourceEntry(CResourceStore *pStore);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static CResourceEntry* CreateNewResource(CResourceStore *pStore, const CAssetID& rkID,
|
static CResourceEntry* CreateNewResource(CResourceStore *pStore, const CAssetID& rkID,
|
||||||
|
@ -86,27 +86,27 @@ public:
|
||||||
void ClearFlag(EResEntryFlag Flag);
|
void ClearFlag(EResEntryFlag Flag);
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline void SetFlagEnabled(EResEntryFlag Flag, bool Enabled) { Enabled ? SetFlag(Flag) : ClearFlag(Flag); }
|
void SetFlagEnabled(EResEntryFlag Flag, bool Enabled) { Enabled ? SetFlag(Flag) : ClearFlag(Flag); }
|
||||||
|
|
||||||
inline void SetDirty() { SetFlag(EResEntryFlag::NeedsRecook); }
|
void SetDirty() { SetFlag(EResEntryFlag::NeedsRecook); }
|
||||||
inline void SetHidden(bool Hidden) { SetFlagEnabled(EResEntryFlag::Hidden, Hidden); }
|
void SetHidden(bool Hidden) { SetFlagEnabled(EResEntryFlag::Hidden, Hidden); }
|
||||||
inline bool HasFlag(EResEntryFlag Flag) const { return mFlags.HasFlag(Flag); }
|
bool HasFlag(EResEntryFlag Flag) const { return mFlags.HasFlag(Flag); }
|
||||||
inline bool IsHidden() const { return HasFlag(EResEntryFlag::Hidden); }
|
bool IsHidden() const { return HasFlag(EResEntryFlag::Hidden); }
|
||||||
inline bool IsMarkedForDeletion() const { return HasFlag(EResEntryFlag::MarkedForDeletion); }
|
bool IsMarkedForDeletion() const { return HasFlag(EResEntryFlag::MarkedForDeletion); }
|
||||||
|
|
||||||
inline bool IsLoaded() const { return mpResource != nullptr; }
|
bool IsLoaded() const { return mpResource != nullptr; }
|
||||||
inline bool IsCategorized() const { return mpDirectory && !mpDirectory->FullPath().CaseInsensitiveCompare( mpStore->DefaultResourceDirPath() ); }
|
bool IsCategorized() const { return mpDirectory && !mpDirectory->FullPath().CaseInsensitiveCompare( mpStore->DefaultResourceDirPath() ); }
|
||||||
inline bool IsNamed() const { return mName != mID.ToString(); }
|
bool IsNamed() const { return mName != mID.ToString(); }
|
||||||
inline CResource* Resource() const { return mpResource; }
|
CResource* Resource() const { return mpResource; }
|
||||||
inline CResTypeInfo* TypeInfo() const { return mpTypeInfo; }
|
CResTypeInfo* TypeInfo() const { return mpTypeInfo; }
|
||||||
inline CResourceStore* ResourceStore() const { return mpStore; }
|
CResourceStore* ResourceStore() const { return mpStore; }
|
||||||
inline CDependencyTree* Dependencies() const { return mpDependencies; }
|
CDependencyTree* Dependencies() const { return mpDependencies; }
|
||||||
inline CAssetID ID() const { return mID; }
|
CAssetID ID() const { return mID; }
|
||||||
inline CVirtualDirectory* Directory() const { return mpDirectory; }
|
CVirtualDirectory* Directory() const { return mpDirectory; }
|
||||||
inline TString DirectoryPath() const { return mpDirectory->FullPath(); }
|
TString DirectoryPath() const { return mpDirectory->FullPath(); }
|
||||||
inline TString Name() const { return mName; }
|
TString Name() const { return mName; }
|
||||||
inline const TString& UppercaseName() const { return mCachedUppercaseName; }
|
const TString& UppercaseName() const { return mCachedUppercaseName; }
|
||||||
inline EResourceType ResourceType() const { return mpTypeInfo->Type(); }
|
EResourceType ResourceType() const { return mpTypeInfo->Type(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CResource* InternalLoad(IInputStream& rInput);
|
CResource* InternalLoad(IInputStream& rInput);
|
||||||
|
|
|
@ -20,7 +20,7 @@ enum class EDatabaseVersion
|
||||||
// Add new versions before this line
|
// Add new versions before this line
|
||||||
|
|
||||||
Max,
|
Max,
|
||||||
Current = EDatabaseVersion::Max - 1
|
Current = Max - 1
|
||||||
};
|
};
|
||||||
|
|
||||||
class CResourceStore
|
class CResourceStore
|
||||||
|
@ -39,8 +39,8 @@ class CResourceStore
|
||||||
bool mDatabasePathExists;
|
bool mDatabasePathExists;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CResourceStore(const TString& rkDatabasePath);
|
explicit CResourceStore(const TString& rkDatabasePath);
|
||||||
CResourceStore(CGameProject *pProject);
|
explicit CResourceStore(CGameProject *pProject);
|
||||||
~CResourceStore();
|
~CResourceStore();
|
||||||
bool SerializeDatabaseCache(IArchive& rArc);
|
bool SerializeDatabaseCache(IArchive& rArc);
|
||||||
bool LoadDatabaseCache();
|
bool LoadDatabaseCache();
|
||||||
|
@ -78,19 +78,19 @@ public:
|
||||||
static TString StaticDefaultResourceDirPath(EGame Game);
|
static TString StaticDefaultResourceDirPath(EGame Game);
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline CGameProject* Project() const { return mpProj; }
|
CGameProject* Project() const { return mpProj; }
|
||||||
inline EGame Game() const { return mGame; }
|
EGame Game() const { return mGame; }
|
||||||
inline TString DatabaseRootPath() const { return mDatabasePath; }
|
TString DatabaseRootPath() const { return mDatabasePath; }
|
||||||
inline bool DatabasePathExists() const { return mDatabasePathExists; }
|
bool DatabasePathExists() const { return mDatabasePathExists; }
|
||||||
inline TString ResourcesDir() const { return IsEditorStore() ? DatabaseRootPath() : DatabaseRootPath() + "Resources/"; }
|
TString ResourcesDir() const { return IsEditorStore() ? DatabaseRootPath() : DatabaseRootPath() + "Resources/"; }
|
||||||
inline TString DatabasePath() const { return DatabaseRootPath() + "ResourceDatabaseCache.bin"; }
|
TString DatabasePath() const { return DatabaseRootPath() + "ResourceDatabaseCache.bin"; }
|
||||||
inline CVirtualDirectory* RootDirectory() const { return mpDatabaseRoot; }
|
CVirtualDirectory* RootDirectory() const { return mpDatabaseRoot; }
|
||||||
inline uint32 NumTotalResources() const { return mResourceEntries.size(); }
|
uint32 NumTotalResources() const { return mResourceEntries.size(); }
|
||||||
inline uint32 NumLoadedResources() const { return mLoadedResources.size(); }
|
uint32 NumLoadedResources() const { return mLoadedResources.size(); }
|
||||||
inline bool IsCacheDirty() const { return mDatabaseCacheDirty; }
|
bool IsCacheDirty() const { return mDatabaseCacheDirty; }
|
||||||
|
|
||||||
inline void SetCacheDirty() { mDatabaseCacheDirty = true; }
|
void SetCacheDirty() { mDatabaseCacheDirty = true; }
|
||||||
inline bool IsEditorStore() const { return mpProj == nullptr; }
|
bool IsEditorStore() const { return mpProj == nullptr; }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TString gDataDir;
|
extern TString gDataDir;
|
||||||
|
|
|
@ -19,7 +19,7 @@ class CVirtualDirectory
|
||||||
std::vector<CResourceEntry*> mResources;
|
std::vector<CResourceEntry*> mResources;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CVirtualDirectory(CResourceStore *pStore);
|
explicit CVirtualDirectory(CResourceStore *pStore);
|
||||||
CVirtualDirectory(const TString& rkName, CResourceStore *pStore);
|
CVirtualDirectory(const TString& rkName, CResourceStore *pStore);
|
||||||
CVirtualDirectory(CVirtualDirectory *pParent, const TString& rkName, CResourceStore *pStore);
|
CVirtualDirectory(CVirtualDirectory *pParent, const TString& rkName, CResourceStore *pStore);
|
||||||
~CVirtualDirectory();
|
~CVirtualDirectory();
|
||||||
|
@ -48,14 +48,14 @@ public:
|
||||||
static bool IsValidDirectoryPath(TString Path);
|
static bool IsValidDirectoryPath(TString Path);
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline CVirtualDirectory* Parent() const { return mpParent; }
|
CVirtualDirectory* Parent() const { return mpParent; }
|
||||||
inline bool IsRoot() const { return !mpParent; }
|
bool IsRoot() const { return !mpParent; }
|
||||||
inline TString Name() const { return mName; }
|
TString Name() const { return mName; }
|
||||||
|
|
||||||
inline uint32 NumSubdirectories() const { return mSubdirectories.size(); }
|
uint32 NumSubdirectories() const { return mSubdirectories.size(); }
|
||||||
inline CVirtualDirectory* SubdirectoryByIndex(uint32 Index) { return mSubdirectories[Index]; }
|
CVirtualDirectory* SubdirectoryByIndex(uint32 Index) { return mSubdirectories[Index]; }
|
||||||
inline uint32 NumResources() const { return mResources.size(); }
|
uint32 NumResources() const { return mResources.size(); }
|
||||||
inline CResourceEntry* ResourceByIndex(uint32 Index) { return mResources[Index]; }
|
CResourceEntry* ResourceByIndex(uint32 Index) { return mResources[Index]; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CVIRTUALDIRECTORY
|
#endif // CVIRTUALDIRECTORY
|
||||||
|
|
|
@ -12,14 +12,14 @@ class CCharacterUsageMap
|
||||||
{
|
{
|
||||||
std::map<CAssetID, std::vector<bool>> mUsageMap;
|
std::map<CAssetID, std::vector<bool>> mUsageMap;
|
||||||
std::set<CAssetID> mStillLookingIDs;
|
std::set<CAssetID> mStillLookingIDs;
|
||||||
CResourceStore *mpStore;
|
CResourceStore *mpStore = nullptr;
|
||||||
uint32 mLayerIndex;
|
uint32 mLayerIndex = UINT32_MAX;
|
||||||
bool mIsInitialArea;
|
bool mIsInitialArea = true;
|
||||||
bool mCurrentAreaAllowsDupes;
|
bool mCurrentAreaAllowsDupes = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CCharacterUsageMap(CResourceStore *pStore)
|
explicit CCharacterUsageMap(CResourceStore *pStore)
|
||||||
: mpStore(pStore), mLayerIndex(-1), mIsInitialArea(true), mCurrentAreaAllowsDupes(false)
|
: mpStore(pStore)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool IsCharacterUsed(const CAssetID& rkID, uint32 CharacterIndex) const;
|
bool IsCharacterUsed(const CAssetID& rkID, uint32 CharacterIndex) const;
|
||||||
|
@ -47,19 +47,17 @@ class CPackageDependencyListBuilder
|
||||||
std::set<CAssetID> mPackageUsedAssets;
|
std::set<CAssetID> mPackageUsedAssets;
|
||||||
std::set<CAssetID> mAreaUsedAssets;
|
std::set<CAssetID> mAreaUsedAssets;
|
||||||
std::set<CAssetID> mUniversalAreaAssets;
|
std::set<CAssetID> mUniversalAreaAssets;
|
||||||
bool mEnableDuplicates;
|
bool mEnableDuplicates = false;
|
||||||
bool mCurrentAreaHasDuplicates;
|
bool mCurrentAreaHasDuplicates = false;
|
||||||
bool mIsUniversalAreaAsset;
|
bool mIsUniversalAreaAsset = false;
|
||||||
bool mIsPlayerActor;
|
bool mIsPlayerActor = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CPackageDependencyListBuilder(const CPackage *pkPackage)
|
explicit CPackageDependencyListBuilder(const CPackage *pkPackage)
|
||||||
: mpkPackage(pkPackage)
|
: mpkPackage(pkPackage)
|
||||||
, mGame(pkPackage->Project()->Game())
|
|
||||||
, mpStore(pkPackage->Project()->ResourceStore())
|
, mpStore(pkPackage->Project()->ResourceStore())
|
||||||
|
, mGame(pkPackage->Project()->Game())
|
||||||
, mCharacterUsageMap(pkPackage->Project()->ResourceStore())
|
, mCharacterUsageMap(pkPackage->Project()->ResourceStore())
|
||||||
, mCurrentAreaHasDuplicates(false)
|
|
||||||
, mIsPlayerActor(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,10 +77,10 @@ class CAreaDependencyListBuilder
|
||||||
CCharacterUsageMap mCharacterUsageMap;
|
CCharacterUsageMap mCharacterUsageMap;
|
||||||
std::set<CAssetID> mBaseUsedAssets;
|
std::set<CAssetID> mBaseUsedAssets;
|
||||||
std::set<CAssetID> mLayerUsedAssets;
|
std::set<CAssetID> mLayerUsedAssets;
|
||||||
bool mIsPlayerActor;
|
bool mIsPlayerActor = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAreaDependencyListBuilder(CResourceEntry *pAreaEntry)
|
explicit CAreaDependencyListBuilder(CResourceEntry *pAreaEntry)
|
||||||
: mpAreaEntry(pAreaEntry)
|
: mpAreaEntry(pAreaEntry)
|
||||||
, mpStore(pAreaEntry->ResourceStore())
|
, mpStore(pAreaEntry->ResourceStore())
|
||||||
, mGame(pAreaEntry->Game())
|
, mGame(pAreaEntry->Game())
|
||||||
|
@ -106,7 +104,7 @@ class CAssetDependencyListBuilder
|
||||||
CAssetID mCurrentAnimSetID;
|
CAssetID mCurrentAnimSetID;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAssetDependencyListBuilder(CResourceEntry* pEntry)
|
explicit CAssetDependencyListBuilder(CResourceEntry* pEntry)
|
||||||
: mpResourceEntry(pEntry)
|
: mpResourceEntry(pEntry)
|
||||||
, mCharacterUsageMap(pEntry->ResourceStore())
|
, mCharacterUsageMap(pEntry->ResourceStore())
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -7,14 +7,12 @@
|
||||||
class IProgressNotifier
|
class IProgressNotifier
|
||||||
{
|
{
|
||||||
TString mTaskName;
|
TString mTaskName;
|
||||||
int mTaskIndex;
|
int mTaskIndex = 0;
|
||||||
int mTaskCount;
|
int mTaskCount = 1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IProgressNotifier()
|
IProgressNotifier() = default;
|
||||||
: mTaskIndex(0)
|
virtual ~IProgressNotifier() = default;
|
||||||
, mTaskCount(1)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void SetNumTasks(int NumTasks)
|
void SetNumTasks(int NumTasks)
|
||||||
{
|
{
|
||||||
|
@ -67,9 +65,9 @@ protected:
|
||||||
class CNullProgressNotifier : public IProgressNotifier
|
class CNullProgressNotifier : public IProgressNotifier
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool ShouldCancel() const { return false; }
|
bool ShouldCancel() const override{ return false; }
|
||||||
protected:
|
protected:
|
||||||
void UpdateProgress(const TString&, const TString&, float) {}
|
void UpdateProgress(const TString&, const TString&, float) override {}
|
||||||
};
|
};
|
||||||
extern CNullProgressNotifier *gpNullProgress;
|
extern CNullProgressNotifier *gpNullProgress;
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
class IUIRelay
|
class IUIRelay
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual ~IUIRelay() = default;
|
||||||
virtual void ShowMessageBox(const TString& rkInfoBoxTitle, const TString& rkMessage) = 0;
|
virtual void ShowMessageBox(const TString& rkInfoBoxTitle, const TString& rkMessage) = 0;
|
||||||
virtual void ShowMessageBoxAsync(const TString& rkInfoBoxTitle, const TString& rkMessage) = 0;
|
virtual void ShowMessageBoxAsync(const TString& rkInfoBoxTitle, const TString& rkMessage) = 0;
|
||||||
virtual bool AskYesNoQuestion(const TString& rkInfoBoxTitle, const TString& rkQuestion) = 0;
|
virtual bool AskYesNoQuestion(const TString& rkInfoBoxTitle, const TString& rkQuestion) = 0;
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
void SetMultisamplingEnabled(bool Enable);
|
void SetMultisamplingEnabled(bool Enable);
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline CTexture* Texture() const { return mpTexture; }
|
CTexture* Texture() const { return mpTexture; }
|
||||||
|
|
||||||
// Static
|
// Static
|
||||||
static void BindDefaultFramebuffer(GLenum Target = GL_FRAMEBUFFER);
|
static void BindDefaultFramebuffer(GLenum Target = GL_FRAMEBUFFER);
|
||||||
|
|
|
@ -6,25 +6,17 @@
|
||||||
|
|
||||||
class CRenderbuffer
|
class CRenderbuffer
|
||||||
{
|
{
|
||||||
GLuint mRenderbuffer;
|
GLuint mRenderbuffer = 0;
|
||||||
uint mWidth, mHeight;
|
uint mWidth = 0;
|
||||||
bool mEnableMultisampling;
|
uint mHeight = 0;
|
||||||
bool mInitialized;
|
bool mEnableMultisampling = false;
|
||||||
|
bool mInitialized = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CRenderbuffer()
|
CRenderbuffer() = default;
|
||||||
: mWidth(0)
|
|
||||||
, mHeight(0)
|
|
||||||
, mEnableMultisampling(false)
|
|
||||||
, mInitialized(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CRenderbuffer(uint Width, uint Height)
|
CRenderbuffer(uint Width, uint Height)
|
||||||
: mWidth(Width)
|
: mWidth(Width)
|
||||||
, mHeight(Height)
|
, mHeight(Height)
|
||||||
, mEnableMultisampling(false)
|
|
||||||
, mInitialized(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +33,7 @@ public:
|
||||||
InitStorage();
|
InitStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Resize(uint Width, uint Height)
|
void Resize(uint Width, uint Height)
|
||||||
{
|
{
|
||||||
mWidth = Width;
|
mWidth = Width;
|
||||||
mHeight = Height;
|
mHeight = Height;
|
||||||
|
@ -50,23 +42,23 @@ public:
|
||||||
InitStorage();
|
InitStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Bind()
|
void Bind()
|
||||||
{
|
{
|
||||||
if (!mInitialized) Init();
|
if (!mInitialized) Init();
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, mRenderbuffer);
|
glBindRenderbuffer(GL_RENDERBUFFER, mRenderbuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Unbind()
|
void Unbind()
|
||||||
{
|
{
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline GLuint BufferID()
|
GLuint BufferID() const
|
||||||
{
|
{
|
||||||
return mRenderbuffer;
|
return mRenderbuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetMultisamplingEnabled(bool Enable)
|
void SetMultisamplingEnabled(bool Enable)
|
||||||
{
|
{
|
||||||
if (mEnableMultisampling != Enable)
|
if (mEnableMultisampling != Enable)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,7 @@ public:
|
||||||
static CShader* CurrentShader();
|
static CShader* CurrentShader();
|
||||||
static void KillCachedShader();
|
static void KillCachedShader();
|
||||||
|
|
||||||
inline static int NumShaders() { return smNumShaders; }
|
static int NumShaders() { return smNumShaders; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CacheCommonUniforms();
|
void CacheCommonUniforms();
|
||||||
|
|
|
@ -17,7 +17,7 @@ public:
|
||||||
SetBufferSize(0);
|
SetBufferSize(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
CUniformBuffer(uint Size)
|
explicit CUniformBuffer(uint Size)
|
||||||
{
|
{
|
||||||
glGenBuffers(1, &mUniformBuffer);
|
glGenBuffers(1, &mUniformBuffer);
|
||||||
SetBufferSize(Size);
|
SetBufferSize(Size);
|
||||||
|
@ -65,7 +65,7 @@ public:
|
||||||
InitializeBuffer();
|
InitializeBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint GetBufferSize()
|
uint GetBufferSize() const
|
||||||
{
|
{
|
||||||
return mBufferSize;
|
return mBufferSize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ class CVertexArrayManager
|
||||||
{
|
{
|
||||||
std::unordered_map<CVertexBuffer*, GLuint> mVBOMap;
|
std::unordered_map<CVertexBuffer*, GLuint> mVBOMap;
|
||||||
std::unordered_map<CDynamicVertexBuffer*, GLuint> mDynamicVBOMap;
|
std::unordered_map<CDynamicVertexBuffer*, GLuint> mDynamicVBOMap;
|
||||||
uint32 mVectorIndex;
|
uint32 mVectorIndex = 0;
|
||||||
|
|
||||||
static std::vector<CVertexArrayManager*> sVAManagers;
|
static std::vector<CVertexArrayManager*> sVAManagers;
|
||||||
static CVertexArrayManager *spCurrentManager;
|
static CVertexArrayManager *spCurrentManager;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
CVertexBuffer::CVertexBuffer()
|
CVertexBuffer::CVertexBuffer()
|
||||||
{
|
{
|
||||||
mBuffered = false;
|
|
||||||
SetVertexDesc(EVertexAttribute::Position | EVertexAttribute::Normal |
|
SetVertexDesc(EVertexAttribute::Position | EVertexAttribute::Normal |
|
||||||
EVertexAttribute::Tex0 | EVertexAttribute::Tex1 |
|
EVertexAttribute::Tex0 | EVertexAttribute::Tex1 |
|
||||||
EVertexAttribute::Tex2 | EVertexAttribute::Tex3 |
|
EVertexAttribute::Tex2 | EVertexAttribute::Tex3 |
|
||||||
|
@ -216,12 +215,12 @@ void CVertexBuffer::Unbind()
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVertexBuffer::IsBuffered()
|
bool CVertexBuffer::IsBuffered() const
|
||||||
{
|
{
|
||||||
return mBuffered;
|
return mBuffered;
|
||||||
}
|
}
|
||||||
|
|
||||||
FVertexDescription CVertexBuffer::VertexDesc()
|
FVertexDescription CVertexBuffer::VertexDesc() const
|
||||||
{
|
{
|
||||||
return mVtxDesc;
|
return mVtxDesc;
|
||||||
}
|
}
|
||||||
|
@ -238,7 +237,7 @@ void CVertexBuffer::SetSkin(CSkin *pSkin)
|
||||||
mpSkin = pSkin;
|
mpSkin = pSkin;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 CVertexBuffer::Size()
|
uint32 CVertexBuffer::Size() const
|
||||||
{
|
{
|
||||||
return mPositions.size();
|
return mPositions.size();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,11 @@ class CVertexBuffer
|
||||||
std::vector<CVector2f> mTexCoords[8]; // Vectors of texture coordinates
|
std::vector<CVector2f> mTexCoords[8]; // Vectors of texture coordinates
|
||||||
std::vector<TBoneIndices> mBoneIndices; // Vectors of bone indices
|
std::vector<TBoneIndices> mBoneIndices; // Vectors of bone indices
|
||||||
std::vector<TBoneWeights> mBoneWeights; // Vectors of bone weights
|
std::vector<TBoneWeights> mBoneWeights; // Vectors of bone weights
|
||||||
bool mBuffered; // Bool value that indicates whether the attributes have been buffered.
|
bool mBuffered = false; // Bool value that indicates whether the attributes have been buffered.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CVertexBuffer();
|
CVertexBuffer();
|
||||||
CVertexBuffer(FVertexDescription Desc);
|
explicit CVertexBuffer(FVertexDescription Desc);
|
||||||
~CVertexBuffer();
|
~CVertexBuffer();
|
||||||
uint16 AddVertex(const CVertex& rkVtx);
|
uint16 AddVertex(const CVertex& rkVtx);
|
||||||
uint16 AddIfUnique(const CVertex& rkVtx, uint16 Start);
|
uint16 AddIfUnique(const CVertex& rkVtx, uint16 Start);
|
||||||
|
@ -32,11 +32,11 @@ public:
|
||||||
void Buffer();
|
void Buffer();
|
||||||
void Bind();
|
void Bind();
|
||||||
void Unbind();
|
void Unbind();
|
||||||
bool IsBuffered();
|
bool IsBuffered() const;
|
||||||
FVertexDescription VertexDesc();
|
FVertexDescription VertexDesc() const;
|
||||||
void SetVertexDesc(FVertexDescription Desc);
|
void SetVertexDesc(FVertexDescription Desc);
|
||||||
void SetSkin(CSkin *pSkin);
|
void SetSkin(CSkin *pSkin);
|
||||||
uint32 Size();
|
uint32 Size() const;
|
||||||
GLuint CreateVAO();
|
GLuint CreateVAO();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -12,19 +12,16 @@
|
||||||
|
|
||||||
class CRenderBucket
|
class CRenderBucket
|
||||||
{
|
{
|
||||||
bool mEnableDepthSortDebugVisualization;
|
bool mEnableDepthSortDebugVisualization = false;
|
||||||
|
|
||||||
class CSubBucket
|
class CSubBucket
|
||||||
{
|
{
|
||||||
std::vector<SRenderablePtr> mRenderables;
|
std::vector<SRenderablePtr> mRenderables;
|
||||||
uint32 mEstSize;
|
uint32 mEstSize = 0;
|
||||||
uint32 mSize;
|
uint32 mSize = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSubBucket()
|
CSubBucket() = default;
|
||||||
: mEstSize(0)
|
|
||||||
, mSize(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void Add(const SRenderablePtr &rkPtr);
|
void Add(const SRenderablePtr &rkPtr);
|
||||||
void Sort(const CCamera *pkCamera, bool DebugVisualization);
|
void Sort(const CCamera *pkCamera, bool DebugVisualization);
|
||||||
|
@ -36,9 +33,7 @@ class CRenderBucket
|
||||||
CSubBucket mTransparentSubBucket;
|
CSubBucket mTransparentSubBucket;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CRenderBucket()
|
CRenderBucket() = default;
|
||||||
: mEnableDepthSortDebugVisualization(false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void Add(const SRenderablePtr& rkPtr, bool Transparent);
|
void Add(const SRenderablePtr& rkPtr, bool Transparent);
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
|
@ -11,8 +11,8 @@ class CRenderer;
|
||||||
class IRenderable
|
class IRenderable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IRenderable() {}
|
IRenderable() = default;
|
||||||
virtual ~IRenderable() {}
|
virtual ~IRenderable() = default;
|
||||||
virtual void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) = 0;
|
virtual void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) = 0;
|
||||||
virtual void Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ERenderCommand /*Command*/, const SViewInfo& /*rkViewInfo*/) {}
|
virtual void Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ERenderCommand /*Command*/, const SViewInfo& /*rkViewInfo*/) {}
|
||||||
virtual void DrawSelection() {}
|
virtual void DrawSelection() {}
|
||||||
|
|
|
@ -9,28 +9,19 @@
|
||||||
|
|
||||||
struct SCollisionRenderSettings
|
struct SCollisionRenderSettings
|
||||||
{
|
{
|
||||||
uint64 HighlightMask;
|
uint64 HighlightMask = 0;
|
||||||
uint64 HideMask;
|
uint64 HideMask = 0;
|
||||||
int BoundingHierarchyRenderDepth;
|
int BoundingHierarchyRenderDepth = 0;
|
||||||
|
|
||||||
CCollisionMaterial HideMaterial;
|
CCollisionMaterial HideMaterial;
|
||||||
bool DrawWireframe;
|
bool DrawWireframe = true;
|
||||||
bool DrawBackfaces;
|
bool DrawBackfaces = false;
|
||||||
bool DrawAreaCollisionBounds;
|
bool DrawAreaCollisionBounds = true;
|
||||||
bool DrawBoundingHierarchy;
|
bool DrawBoundingHierarchy = false;
|
||||||
bool TintWithSurfaceColor;
|
bool TintWithSurfaceColor = true;
|
||||||
bool TintUnwalkableTris;
|
bool TintUnwalkableTris = true;
|
||||||
|
|
||||||
SCollisionRenderSettings()
|
SCollisionRenderSettings() = default;
|
||||||
: HighlightMask(0)
|
|
||||||
, HideMask(0)
|
|
||||||
, BoundingHierarchyRenderDepth(0)
|
|
||||||
, DrawWireframe(true)
|
|
||||||
, DrawBackfaces(false)
|
|
||||||
, DrawAreaCollisionBounds(true)
|
|
||||||
, DrawBoundingHierarchy(false)
|
|
||||||
, TintWithSurfaceColor(true)
|
|
||||||
, TintUnwalkableTris(true) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SViewInfo
|
struct SViewInfo
|
||||||
|
|
|
@ -14,12 +14,11 @@ class CBone;
|
||||||
|
|
||||||
struct SBoneTransformInfo
|
struct SBoneTransformInfo
|
||||||
{
|
{
|
||||||
CVector3f Position;
|
CVector3f Position{CVector3f::skZero};
|
||||||
CQuaternion Rotation;
|
CQuaternion Rotation{CQuaternion::skIdentity};
|
||||||
CVector3f Scale;
|
CVector3f Scale{CVector3f::skOne};
|
||||||
|
|
||||||
SBoneTransformInfo()
|
SBoneTransformInfo() = default;
|
||||||
: Position(CVector3f::skZero), Rotation(CQuaternion::skIdentity), Scale(CVector3f::skOne) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CSkeleton : public CResource
|
class CSkeleton : public CResource
|
||||||
|
@ -33,8 +32,8 @@ class CSkeleton : public CResource
|
||||||
static const float skSphereRadius;
|
static const float skSphereRadius;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSkeleton(CResourceEntry *pEntry = 0);
|
explicit CSkeleton(CResourceEntry *pEntry = nullptr);
|
||||||
~CSkeleton();
|
~CSkeleton() override;
|
||||||
void UpdateTransform(CBoneTransformData& rData, CAnimation *pAnim, float Time, bool AnchorRoot);
|
void UpdateTransform(CBoneTransformData& rData, CAnimation *pAnim, float Time, bool AnchorRoot);
|
||||||
CBone* BoneByID(uint32 BoneID) const;
|
CBone* BoneByID(uint32 BoneID) const;
|
||||||
CBone* BoneByName(const TString& rkBoneName) const;
|
CBone* BoneByName(const TString& rkBoneName) const;
|
||||||
|
@ -43,8 +42,8 @@ public:
|
||||||
void Draw(FRenderOptions Options, const CBoneTransformData *pkData);
|
void Draw(FRenderOptions Options, const CBoneTransformData *pkData);
|
||||||
std::pair<int32,float> RayIntersect(const CRay& rkRay, const CBoneTransformData& rkData);
|
std::pair<int32,float> RayIntersect(const CRay& rkRay, const CBoneTransformData& rkData);
|
||||||
|
|
||||||
inline uint32 NumBones() const { return mBones.size(); }
|
uint32 NumBones() const { return mBones.size(); }
|
||||||
inline CBone* RootBone() const { return mpRootBone; }
|
CBone* RootBone() const { return mpRootBone; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class CBone
|
class CBone
|
||||||
|
|
|
@ -23,7 +23,7 @@ class CSkin : public CResource
|
||||||
std::vector<SVertGroup> mVertGroups;
|
std::vector<SVertGroup> mVertGroups;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSkin(CResourceEntry *pEntry = 0) : CResource(pEntry) {}
|
explicit CSkin(CResourceEntry *pEntry = nullptr) : CResource(pEntry) {}
|
||||||
|
|
||||||
const SVertexWeights& WeightsForVertex(uint32 VertIdx)
|
const SVertexWeights& WeightsForVertex(uint32 VertIdx)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,7 +27,7 @@ class CSourceAnimData : public CResource
|
||||||
IMetaTransition *mpDefaultTransition;
|
IMetaTransition *mpDefaultTransition;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSourceAnimData(CResourceEntry *pEntry = 0)
|
explicit CSourceAnimData(CResourceEntry *pEntry = nullptr)
|
||||||
: CResource(pEntry)
|
: CResource(pEntry)
|
||||||
, mpDefaultTransition(nullptr)
|
, mpDefaultTransition(nullptr)
|
||||||
{}
|
{}
|
||||||
|
@ -43,7 +43,7 @@ public:
|
||||||
delete mpDefaultTransition;
|
delete mpDefaultTransition;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDependencyTree* BuildDependencyTree() const
|
CDependencyTree* BuildDependencyTree() const override
|
||||||
{
|
{
|
||||||
// SAND normally has dependencies from meta-transitions and events
|
// SAND normally has dependencies from meta-transitions and events
|
||||||
// However, all of these can be character-specific. To simplify things, all SAND
|
// However, all of these can be character-specific. To simplify things, all SAND
|
||||||
|
|
|
@ -26,11 +26,11 @@ extern CMetaAnimFactory gMetaAnimFactory;
|
||||||
class CAnimPrimitive
|
class CAnimPrimitive
|
||||||
{
|
{
|
||||||
TResPtr<CAnimation> mpAnim;
|
TResPtr<CAnimation> mpAnim;
|
||||||
uint32 mID;
|
uint32 mID = 0;
|
||||||
TString mName;
|
TString mName;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAnimPrimitive() : mID(0) {}
|
CAnimPrimitive() = default;
|
||||||
|
|
||||||
CAnimPrimitive(const CAssetID& rkAnimAssetID, uint32 CharAnimID, const TString& rkAnimName)
|
CAnimPrimitive(const CAssetID& rkAnimAssetID, uint32 CharAnimID, const TString& rkAnimName)
|
||||||
: mID(CharAnimID), mName(rkAnimName)
|
: mID(CharAnimID), mName(rkAnimName)
|
||||||
|
@ -45,8 +45,9 @@ public:
|
||||||
mName = rInput.ReadString();
|
mName = rInput.ReadString();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator==(const CAnimPrimitive& rkRight) const { return mID == rkRight.mID; }
|
bool operator==(const CAnimPrimitive& other) const { return mID == other.mID; }
|
||||||
inline bool operator< (const CAnimPrimitive& rkRight) const { return mID < rkRight.mID; }
|
bool operator!=(const CAnimPrimitive& other) const { return !operator==(other); }
|
||||||
|
bool operator< (const CAnimPrimitive& other) const { return mID < other.mID; }
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
CAnimation* Animation() const { return mpAnim; }
|
CAnimation* Animation() const { return mpAnim; }
|
||||||
|
@ -58,8 +59,8 @@ public:
|
||||||
class IMetaAnimation
|
class IMetaAnimation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IMetaAnimation() {}
|
IMetaAnimation() = default;
|
||||||
virtual ~IMetaAnimation() {}
|
virtual ~IMetaAnimation() = default;
|
||||||
virtual EMetaAnimType Type() const = 0;
|
virtual EMetaAnimType Type() const = 0;
|
||||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const = 0;
|
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const = 0;
|
||||||
|
|
||||||
|
@ -78,13 +79,13 @@ protected:
|
||||||
public:
|
public:
|
||||||
CMetaAnimPlay(const CAnimPrimitive& rkPrimitive, float UnkA, uint32 UnkB);
|
CMetaAnimPlay(const CAnimPrimitive& rkPrimitive, float UnkA, uint32 UnkB);
|
||||||
CMetaAnimPlay(IInputStream& rInput, EGame Game);
|
CMetaAnimPlay(IInputStream& rInput, EGame Game);
|
||||||
virtual EMetaAnimType Type() const;
|
EMetaAnimType Type() const override;
|
||||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const override;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline CAnimPrimitive Primitive() const { return mPrimitive; }
|
CAnimPrimitive Primitive() const { return mPrimitive; }
|
||||||
inline float UnknownA() const { return mUnknownA; }
|
float UnknownA() const { return mUnknownA; }
|
||||||
inline uint32 UnknownB() const { return mUnknownB; }
|
uint32 UnknownB() const { return mUnknownB; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// CMetaAnimBlend - blend between two animations
|
// CMetaAnimBlend - blend between two animations
|
||||||
|
@ -100,14 +101,14 @@ protected:
|
||||||
public:
|
public:
|
||||||
CMetaAnimBlend(EMetaAnimType Type, IInputStream& rInput, EGame Game);
|
CMetaAnimBlend(EMetaAnimType Type, IInputStream& rInput, EGame Game);
|
||||||
~CMetaAnimBlend();
|
~CMetaAnimBlend();
|
||||||
virtual EMetaAnimType Type() const;
|
EMetaAnimType Type() const override;
|
||||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const override;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline IMetaAnimation* BlendAnimationA() const { return mpMetaAnimA; }
|
IMetaAnimation* BlendAnimationA() const { return mpMetaAnimA; }
|
||||||
inline IMetaAnimation* BlendAnimationB() const { return mpMetaAnimB; }
|
IMetaAnimation* BlendAnimationB() const { return mpMetaAnimB; }
|
||||||
inline float UnknownA() const { return mUnknownA; }
|
float UnknownA() const { return mUnknownA; }
|
||||||
inline bool UnknownB() const { return mUnknownB; }
|
bool UnknownB() const { return mUnknownB; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// SAnimProbabilityPair - structure used by CMetaAnimationRandom to associate an animation with a probability value
|
// SAnimProbabilityPair - structure used by CMetaAnimationRandom to associate an animation with a probability value
|
||||||
|
@ -126,8 +127,8 @@ protected:
|
||||||
public:
|
public:
|
||||||
CMetaAnimRandom(IInputStream& rInput, EGame Game);
|
CMetaAnimRandom(IInputStream& rInput, EGame Game);
|
||||||
~CMetaAnimRandom();
|
~CMetaAnimRandom();
|
||||||
virtual EMetaAnimType Type() const;
|
EMetaAnimType Type() const override;
|
||||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// CMetaAnim - play a series of animations in sequence
|
// CMetaAnim - play a series of animations in sequence
|
||||||
|
@ -139,8 +140,8 @@ protected:
|
||||||
public:
|
public:
|
||||||
CMetaAnimSequence(IInputStream& rInput, EGame Game);
|
CMetaAnimSequence(IInputStream& rInput, EGame Game);
|
||||||
~CMetaAnimSequence();
|
~CMetaAnimSequence();
|
||||||
virtual EMetaAnimType Type() const;
|
EMetaAnimType Type() const override;
|
||||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // IMETAANIMATION
|
#endif // IMETAANIMATION
|
||||||
|
|
|
@ -27,8 +27,8 @@ extern CMetaTransFactory gMetaTransFactory;
|
||||||
class IMetaTransition
|
class IMetaTransition
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IMetaTransition() {}
|
IMetaTransition() = default;
|
||||||
virtual ~IMetaTransition() {}
|
virtual ~IMetaTransition() = default;
|
||||||
virtual EMetaTransType Type() const = 0;
|
virtual EMetaTransType Type() const = 0;
|
||||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const = 0;
|
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const = 0;
|
||||||
};
|
};
|
||||||
|
@ -41,8 +41,8 @@ class CMetaTransMetaAnim : public IMetaTransition
|
||||||
public:
|
public:
|
||||||
CMetaTransMetaAnim(IInputStream& rInput, EGame Game);
|
CMetaTransMetaAnim(IInputStream& rInput, EGame Game);
|
||||||
~CMetaTransMetaAnim();
|
~CMetaTransMetaAnim();
|
||||||
virtual EMetaTransType Type() const;
|
EMetaTransType Type() const override;
|
||||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// CMetaTransTrans
|
// CMetaTransTrans
|
||||||
|
@ -57,8 +57,8 @@ class CMetaTransTrans : public IMetaTransition
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMetaTransTrans(EMetaTransType Type, IInputStream& rInput, EGame Game);
|
CMetaTransTrans(EMetaTransType Type, IInputStream& rInput, EGame Game);
|
||||||
virtual EMetaTransType Type() const;
|
EMetaTransType Type() const override;
|
||||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// CMetaTransSnap
|
// CMetaTransSnap
|
||||||
|
@ -66,8 +66,8 @@ class CMetaTransSnap : public IMetaTransition
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMetaTransSnap(IInputStream& rInput, EGame Game);
|
CMetaTransSnap(IInputStream& rInput, EGame Game);
|
||||||
virtual EMetaTransType Type() const;
|
EMetaTransType Type() const override;
|
||||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// CMetaTransType4
|
// CMetaTransType4
|
||||||
|
@ -75,8 +75,8 @@ class CMetaTransType4 : public IMetaTransition
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMetaTransType4(IInputStream& rInput, EGame Game);
|
CMetaTransType4(IInputStream& rInput, EGame Game);
|
||||||
virtual EMetaTransType Type() const;
|
EMetaTransType Type() const override;
|
||||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // IMETATRANSITION_H
|
#endif // IMETATRANSITION_H
|
||||||
|
|
|
@ -65,9 +65,9 @@ class CGameArea : public CResource
|
||||||
std::vector< std::vector<CAssetID> > mExtraLayerDeps;
|
std::vector< std::vector<CAssetID> > mExtraLayerDeps;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CGameArea(CResourceEntry *pEntry = 0);
|
CGameArea(CResourceEntry *pEntry = nullptr);
|
||||||
~CGameArea();
|
~CGameArea();
|
||||||
CDependencyTree* BuildDependencyTree() const;
|
CDependencyTree* BuildDependencyTree() const override;
|
||||||
|
|
||||||
void AddWorldModel(CModel *pModel);
|
void AddWorldModel(CModel *pModel);
|
||||||
void MergeTerrain();
|
void MergeTerrain();
|
||||||
|
@ -85,26 +85,26 @@ public:
|
||||||
void DeleteInstance(CScriptObject *pInstance);
|
void DeleteInstance(CScriptObject *pInstance);
|
||||||
void ClearExtraDependencies();
|
void ClearExtraDependencies();
|
||||||
|
|
||||||
// Inline Accessors
|
// Accessors
|
||||||
inline uint32 WorldIndex() const { return mWorldIndex; }
|
uint32 WorldIndex() const { return mWorldIndex; }
|
||||||
inline CTransform4f Transform() const { return mTransform; }
|
CTransform4f Transform() const { return mTransform; }
|
||||||
inline CMaterialSet* Materials() const { return mpMaterialSet; }
|
CMaterialSet* Materials() const { return mpMaterialSet; }
|
||||||
inline uint32 NumWorldModels() const { return mWorldModels.size(); }
|
uint32 NumWorldModels() const { return mWorldModels.size(); }
|
||||||
inline uint32 NumStaticModels() const { return mStaticWorldModels.size(); }
|
uint32 NumStaticModels() const { return mStaticWorldModels.size(); }
|
||||||
inline CModel* TerrainModel(uint32 iMdl) const { return mWorldModels[iMdl]; }
|
CModel* TerrainModel(uint32 iMdl) const { return mWorldModels[iMdl]; }
|
||||||
inline CStaticModel* StaticModel(uint32 iMdl) const { return mStaticWorldModels[iMdl]; }
|
CStaticModel* StaticModel(uint32 iMdl) const { return mStaticWorldModels[iMdl]; }
|
||||||
inline CCollisionMeshGroup* Collision() const { return mpCollision.get(); }
|
CCollisionMeshGroup* Collision() const { return mpCollision.get(); }
|
||||||
inline uint32 NumScriptLayers() const { return mScriptLayers.size(); }
|
uint32 NumScriptLayers() const { return mScriptLayers.size(); }
|
||||||
inline CScriptLayer* ScriptLayer(uint32 Index) const { return mScriptLayers[Index]; }
|
CScriptLayer* ScriptLayer(uint32 Index) const { return mScriptLayers[Index]; }
|
||||||
inline uint32 NumLightLayers() const { return mLightLayers.size(); }
|
uint32 NumLightLayers() const { return mLightLayers.size(); }
|
||||||
inline uint32 NumLights(uint32 LayerIndex) const { return (LayerIndex < mLightLayers.size() ? mLightLayers[LayerIndex].size() : 0); }
|
uint32 NumLights(uint32 LayerIndex) const { return (LayerIndex < mLightLayers.size() ? mLightLayers[LayerIndex].size() : 0); }
|
||||||
inline CLight* Light(uint32 LayerIndex, uint32 LightIndex) { return &mLightLayers[LayerIndex][LightIndex]; }
|
CLight* Light(uint32 LayerIndex, uint32 LightIndex) { return &mLightLayers[LayerIndex][LightIndex]; }
|
||||||
inline CAssetID PathID() const { return mPathID; }
|
CAssetID PathID() const { return mPathID; }
|
||||||
inline CPoiToWorld* PoiToWorldMap() const { return mpPoiToWorldMap; }
|
CPoiToWorld* PoiToWorldMap() const { return mpPoiToWorldMap; }
|
||||||
inline CAssetID PortalAreaID() const { return mPortalAreaID; }
|
CAssetID PortalAreaID() const { return mPortalAreaID; }
|
||||||
inline CAABox AABox() const { return mAABox; }
|
CAABox AABox() const { return mAABox; }
|
||||||
|
|
||||||
inline void SetWorldIndex(uint32 NewWorldIndex) { mWorldIndex = NewWorldIndex; }
|
void SetWorldIndex(uint32 NewWorldIndex) { mWorldIndex = NewWorldIndex; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CGAMEAREA_H
|
#endif // CGAMEAREA_H
|
||||||
|
|
|
@ -59,17 +59,17 @@ class CFont : public CResource
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CFont(CResourceEntry *pEntry = 0);
|
CFont(CResourceEntry *pEntry = nullptr);
|
||||||
~CFont();
|
~CFont();
|
||||||
CDependencyTree* BuildDependencyTree() const;
|
CDependencyTree* BuildDependencyTree() const override;
|
||||||
CVector2f RenderString(const TString& rkString, CRenderer *pRenderer, float AspectRatio,
|
CVector2f RenderString(const TString& rkString, CRenderer *pRenderer, float AspectRatio,
|
||||||
CVector2f Position = CVector2f(0,0),
|
CVector2f Position = CVector2f(0,0),
|
||||||
CColor FillColor = CColor::skWhite, CColor StrokeColor = CColor::skBlack,
|
CColor FillColor = CColor::skWhite, CColor StrokeColor = CColor::skBlack,
|
||||||
uint32 FontSize = CFONT_DEFAULT_SIZE);
|
uint32 FontSize = CFONT_DEFAULT_SIZE);
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline TString FontName() const { return mFontName; }
|
TString FontName() const { return mFontName; }
|
||||||
inline CTexture* Texture() const { return mpFontTexture; }
|
CTexture* Texture() const { return mpFontTexture; }
|
||||||
private:
|
private:
|
||||||
static void InitBuffers();
|
static void InitBuffers();
|
||||||
static void ShutdownBuffers();
|
static void ShutdownBuffers();
|
||||||
|
|
|
@ -43,17 +43,17 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Accessors
|
// Accessors
|
||||||
inline ELightType Type() const { return mType; }
|
ELightType Type() const { return mType; }
|
||||||
inline uint32 LayerIndex() const { return mLayerIndex; }
|
uint32 LayerIndex() const { return mLayerIndex; }
|
||||||
inline CVector3f Position() const { return mPosition; }
|
CVector3f Position() const { return mPosition; }
|
||||||
inline CVector3f Direction() const { return mDirection; }
|
CVector3f Direction() const { return mDirection; }
|
||||||
inline CColor Color() const { return mColor; }
|
CColor Color() const { return mColor; }
|
||||||
inline CVector3f DistAttenuation() const { return mDistAttenCoefficients; }
|
CVector3f DistAttenuation() const { return mDistAttenCoefficients; }
|
||||||
inline CVector3f AngleAttenuation() const { return mAngleAttenCoefficients; }
|
CVector3f AngleAttenuation() const { return mAngleAttenCoefficients; }
|
||||||
|
|
||||||
inline void SetLayer(uint32 Index) { mLayerIndex = Index; }
|
void SetLayer(uint32 Index) { mLayerIndex = Index; }
|
||||||
inline void SetPosition(const CVector3f& rkPosition) { mPosition = rkPosition; }
|
void SetPosition(const CVector3f& rkPosition) { mPosition = rkPosition; }
|
||||||
inline void SetDirection(const CVector3f& rkDirection) { mDirection = rkDirection; }
|
void SetDirection(const CVector3f& rkDirection) { mDirection = rkDirection; }
|
||||||
|
|
||||||
float GetRadius() const;
|
float GetRadius() const;
|
||||||
float GetIntensity() const;
|
float GetIntensity() const;
|
||||||
|
|
|
@ -10,13 +10,13 @@ class CMapArea : public CResource
|
||||||
CAssetID mNameString;
|
CAssetID mNameString;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMapArea(CResourceEntry *pEntry = 0)
|
CMapArea(CResourceEntry *pEntry = nullptr)
|
||||||
: CResource(pEntry)
|
: CResource(pEntry)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
CDependencyTree* BuildDependencyTree() const
|
CDependencyTree* BuildDependencyTree() const override
|
||||||
{
|
{
|
||||||
CDependencyTree *pTree = new CDependencyTree();
|
auto *pTree = new CDependencyTree();
|
||||||
pTree->AddDependency(mNameString);
|
pTree->AddDependency(mNameString);
|
||||||
return pTree;
|
return pTree;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,34 +126,34 @@ public:
|
||||||
void SetNumPasses(uint32 NumPasses);
|
void SetNumPasses(uint32 NumPasses);
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline TString Name() const { return mName; }
|
TString Name() const { return mName; }
|
||||||
inline EGame Version() const { return mVersion; }
|
EGame Version() const { return mVersion; }
|
||||||
inline FMaterialOptions Options() const { return mOptions; }
|
FMaterialOptions Options() const { return mOptions; }
|
||||||
inline FVertexDescription VtxDesc() const { return mVtxDesc; }
|
FVertexDescription VtxDesc() const { return mVtxDesc; }
|
||||||
inline GLenum BlendSrcFac() const { return mBlendSrcFac; }
|
GLenum BlendSrcFac() const { return mBlendSrcFac; }
|
||||||
inline GLenum BlendDstFac() const { return mBlendDstFac; }
|
GLenum BlendDstFac() const { return mBlendDstFac; }
|
||||||
inline CColor Konst(uint32 KIndex) const { return mKonstColors[KIndex]; }
|
CColor Konst(uint32 KIndex) const { return mKonstColors[KIndex]; }
|
||||||
inline CColor TevColor(ETevOutput Out) const { return mTevColors[int(Out)]; }
|
CColor TevColor(ETevOutput Out) const { return mTevColors[int(Out)]; }
|
||||||
inline CTexture* IndTexture() const { return mpIndirectTexture; }
|
CTexture* IndTexture() const { return mpIndirectTexture; }
|
||||||
inline bool IsLightingEnabled() const { return mLightingEnabled; }
|
bool IsLightingEnabled() const { return mLightingEnabled; }
|
||||||
inline uint32 EchoesUnknownA() const { return mEchoesUnknownA; }
|
uint32 EchoesUnknownA() const { return mEchoesUnknownA; }
|
||||||
inline uint32 EchoesUnknownB() const { return mEchoesUnknownB; }
|
uint32 EchoesUnknownB() const { return mEchoesUnknownB; }
|
||||||
inline uint32 PassCount() const { return mPasses.size(); }
|
uint32 PassCount() const { return mPasses.size(); }
|
||||||
inline CMaterialPass* Pass(uint32 PassIndex) const { return mPasses[PassIndex].get(); }
|
CMaterialPass* Pass(uint32 PassIndex) const { return mPasses[PassIndex].get(); }
|
||||||
inline CMaterial* GetNextDrawPass() const { return mpNextDrawPassMaterial.get(); }
|
CMaterial* GetNextDrawPass() const { return mpNextDrawPassMaterial.get(); }
|
||||||
inline CMaterial* GetBloomVersion() const { return mpBloomMaterial.get(); }
|
CMaterial* GetBloomVersion() const { return mpBloomMaterial.get(); }
|
||||||
|
|
||||||
inline void SetName(const TString& rkName) { mName = rkName; }
|
void SetName(const TString& rkName) { mName = rkName; }
|
||||||
inline void SetOptions(FMaterialOptions Options) { mOptions = Options; Update(); }
|
void SetOptions(FMaterialOptions Options) { mOptions = Options; Update(); }
|
||||||
inline void SetVertexDescription(FVertexDescription Desc) { mVtxDesc = Desc; Update(); }
|
void SetVertexDescription(FVertexDescription Desc) { mVtxDesc = Desc; Update(); }
|
||||||
inline void SetBlendMode(GLenum SrcFac, GLenum DstFac) { mBlendSrcFac = SrcFac; mBlendDstFac = DstFac; mRecalcHash = true; }
|
void SetBlendMode(GLenum SrcFac, GLenum DstFac) { mBlendSrcFac = SrcFac; mBlendDstFac = DstFac; mRecalcHash = true; }
|
||||||
inline void SetKonst(const CColor& Konst, uint32 KIndex) { mKonstColors[KIndex] = Konst; Update(); }
|
void SetKonst(const CColor& Konst, uint32 KIndex) { mKonstColors[KIndex] = Konst; Update(); }
|
||||||
inline void SetTevColor(const CColor& Color, ETevOutput Out) { mTevColors[int(Out)] = Color; }
|
void SetTevColor(const CColor& Color, ETevOutput Out) { mTevColors[int(Out)] = Color; }
|
||||||
inline void SetIndTexture(CTexture *pTex) { mpIndirectTexture = pTex; }
|
void SetIndTexture(CTexture *pTex) { mpIndirectTexture = pTex; }
|
||||||
inline void SetLightingEnabled(bool Enabled) { mLightingEnabled = Enabled; Update(); }
|
void SetLightingEnabled(bool Enabled) { mLightingEnabled = Enabled; Update(); }
|
||||||
|
|
||||||
// Static
|
// Static
|
||||||
inline static void KillCachedMaterial() { sCurrentMaterial = 0; }
|
static void KillCachedMaterial() { sCurrentMaterial = 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MATERIAL_H
|
#endif // MATERIAL_H
|
||||||
|
|
|
@ -72,23 +72,23 @@ public:
|
||||||
void SetEnabled(bool Enabled);
|
void SetEnabled(bool Enabled);
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
inline CFourCC Type() const { return mPassType; }
|
CFourCC Type() const { return mPassType; }
|
||||||
inline TString NamedType() const { return PassTypeName(mPassType); }
|
TString NamedType() const { return PassTypeName(mPassType); }
|
||||||
inline ETevColorInput ColorInput(uint32 Input) const { return mColorInputs[Input]; }
|
ETevColorInput ColorInput(uint32 Input) const { return mColorInputs[Input]; }
|
||||||
inline ETevAlphaInput AlphaInput(uint32 Input) const { return mAlphaInputs[Input]; }
|
ETevAlphaInput AlphaInput(uint32 Input) const { return mAlphaInputs[Input]; }
|
||||||
inline ETevOutput ColorOutput() const { return mColorOutput; }
|
ETevOutput ColorOutput() const { return mColorOutput; }
|
||||||
inline ETevOutput AlphaOutput() const { return mAlphaOutput; }
|
ETevOutput AlphaOutput() const { return mAlphaOutput; }
|
||||||
inline ETevKSel KColorSel() const { return mKColorSel; }
|
ETevKSel KColorSel() const { return mKColorSel; }
|
||||||
inline ETevKSel KAlphaSel() const { return mKAlphaSel; }
|
ETevKSel KAlphaSel() const { return mKAlphaSel; }
|
||||||
inline ETevRasSel RasSel() const { return mRasSel; }
|
ETevRasSel RasSel() const { return mRasSel; }
|
||||||
inline float TevColorScale() const { return mTevColorScale; }
|
float TevColorScale() const { return mTevColorScale; }
|
||||||
inline float TevAlphaScale() const { return mTevAlphaScale; }
|
float TevAlphaScale() const { return mTevAlphaScale; }
|
||||||
inline uint32 TexCoordSource() const { return mTexCoordSource; }
|
uint32 TexCoordSource() const { return mTexCoordSource; }
|
||||||
inline CTexture* Texture() const { return mpTexture; }
|
CTexture* Texture() const { return mpTexture; }
|
||||||
inline EUVAnimMode AnimMode() const { return mAnimMode; }
|
EUVAnimMode AnimMode() const { return mAnimMode; }
|
||||||
inline float AnimParam(uint32 ParamIndex) const { return mAnimParams[ParamIndex]; }
|
float AnimParam(uint32 ParamIndex) const { return mAnimParams[ParamIndex]; }
|
||||||
inline char TexSwapComp(uint32 Comp) const { return mTexSwapComps[Comp]; }
|
char TexSwapComp(uint32 Comp) const { return mTexSwapComps[Comp]; }
|
||||||
inline bool IsEnabled() const { return mEnabled; }
|
bool IsEnabled() const { return mEnabled; }
|
||||||
|
|
||||||
// Static
|
// Static
|
||||||
static TString PassTypeName(CFourCC Type);
|
static TString PassTypeName(CFourCC Type);
|
||||||
|
|
|
@ -14,9 +14,8 @@ class CMaterialSet
|
||||||
std::vector<std::unique_ptr<CMaterial>> mMaterials;
|
std::vector<std::unique_ptr<CMaterial>> mMaterials;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMaterialSet() {}
|
CMaterialSet() = default;
|
||||||
|
~CMaterialSet() = default;
|
||||||
~CMaterialSet() {}
|
|
||||||
|
|
||||||
CMaterialSet* Clone()
|
CMaterialSet* Clone()
|
||||||
{
|
{
|
||||||
|
@ -29,7 +28,7 @@ public:
|
||||||
return pOut;
|
return pOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 NumMaterials()
|
uint32 NumMaterials() const
|
||||||
{
|
{
|
||||||
return mMaterials.size();
|
return mMaterials.size();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,25 +22,25 @@ private:
|
||||||
std::map<uint32,SPoiMap*> mPoiLookupMap;
|
std::map<uint32,SPoiMap*> mPoiLookupMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CPoiToWorld(CResourceEntry *pEntry = 0);
|
explicit CPoiToWorld(CResourceEntry *pEntry = nullptr);
|
||||||
~CPoiToWorld();
|
~CPoiToWorld() override;
|
||||||
|
|
||||||
void AddPoi(uint32 PoiID);
|
void AddPoi(uint32 PoiID);
|
||||||
void AddPoiMeshMap(uint32 PoiID, uint32 ModelID);
|
void AddPoiMeshMap(uint32 PoiID, uint32 ModelID);
|
||||||
void RemovePoi(uint32 PoiID);
|
void RemovePoi(uint32 PoiID);
|
||||||
void RemovePoiMeshMap(uint32 PoiID, uint32 ModelID);
|
void RemovePoiMeshMap(uint32 PoiID, uint32 ModelID);
|
||||||
|
|
||||||
inline uint32 NumMappedPOIs() const
|
uint32 NumMappedPOIs() const
|
||||||
{
|
{
|
||||||
return mMaps.size();
|
return mMaps.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const SPoiMap* MapByIndex(uint32 Index) const
|
const SPoiMap* MapByIndex(uint32 Index) const
|
||||||
{
|
{
|
||||||
return mMaps[Index];
|
return mMaps[Index];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const SPoiMap* MapByID(uint32 InstanceID) const
|
const SPoiMap* MapByID(uint32 InstanceID) const
|
||||||
{
|
{
|
||||||
auto it = mPoiLookupMap.find(InstanceID);
|
auto it = mPoiLookupMap.find(InstanceID);
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,11 @@
|
||||||
|
|
||||||
class CResTypeFilter
|
class CResTypeFilter
|
||||||
{
|
{
|
||||||
EGame mGame;
|
EGame mGame = EGame::Invalid;
|
||||||
std::set<EResourceType> mAcceptedTypes;
|
std::set<EResourceType> mAcceptedTypes;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CResTypeFilter() : mGame(EGame::Invalid) { }
|
CResTypeFilter() = default;
|
||||||
CResTypeFilter(EGame Game, const TString& rkTypeList) { FromString(Game, rkTypeList); }
|
CResTypeFilter(EGame Game, const TString& rkTypeList) { FromString(Game, rkTypeList); }
|
||||||
|
|
||||||
void SetAcceptedTypes(EGame Game, const TStringList& rkTypes)
|
void SetAcceptedTypes(EGame Game, const TStringList& rkTypes)
|
||||||
|
@ -53,22 +53,22 @@ public:
|
||||||
rArc << SerialParameter("AcceptedTypes", mAcceptedTypes, SH_Proxy);
|
rArc << SerialParameter("AcceptedTypes", mAcceptedTypes, SH_Proxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool Accepts(EResourceType Type) const
|
bool Accepts(EResourceType Type) const
|
||||||
{
|
{
|
||||||
return mAcceptedTypes.find(Type) != mAcceptedTypes.end();
|
return mAcceptedTypes.find(Type) != mAcceptedTypes.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool Accepts(CResTypeInfo *pType) const
|
bool Accepts(CResTypeInfo *pType) const
|
||||||
{
|
{
|
||||||
return pType && Accepts(pType->Type());
|
return pType && Accepts(pType->Type());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool Accepts(CResourceEntry *pEntry) const
|
bool Accepts(CResourceEntry *pEntry) const
|
||||||
{
|
{
|
||||||
return pEntry && Accepts(pEntry->ResourceType());
|
return pEntry && Accepts(pEntry->ResourceType());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool Accepts(const CResTypeFilter& rkFilter) const
|
bool Accepts(const CResTypeFilter& rkFilter) const
|
||||||
{
|
{
|
||||||
for (auto Iter = mAcceptedTypes.begin(); Iter != mAcceptedTypes.end(); Iter++)
|
for (auto Iter = mAcceptedTypes.begin(); Iter != mAcceptedTypes.end(); Iter++)
|
||||||
{
|
{
|
||||||
|
@ -79,12 +79,12 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator==(const CResTypeFilter& rkOther) const
|
bool operator==(const CResTypeFilter& rkOther) const
|
||||||
{
|
{
|
||||||
return mAcceptedTypes == rkOther.mAcceptedTypes;
|
return mAcceptedTypes == rkOther.mAcceptedTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator!=(const CResTypeFilter& rkOther) const
|
bool operator!=(const CResTypeFilter& rkOther) const
|
||||||
{
|
{
|
||||||
return !(*this == rkOther);
|
return !(*this == rkOther);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,11 +38,11 @@ public:
|
||||||
CFourCC CookedExtension(EGame Game) const;
|
CFourCC CookedExtension(EGame Game) const;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline EResourceType Type() const { return mType; }
|
EResourceType Type() const { return mType; }
|
||||||
inline TString TypeName() const { return mTypeName; }
|
TString TypeName() const { return mTypeName; }
|
||||||
inline bool CanBeSerialized() const { return mCanBeSerialized; }
|
bool CanBeSerialized() const { return mCanBeSerialized; }
|
||||||
inline bool CanHaveDependencies() const { return mCanHaveDependencies; }
|
bool CanHaveDependencies() const { return mCanHaveDependencies; }
|
||||||
inline bool CanBeCreated() const { return mCanBeCreated; }
|
bool CanBeCreated() const { return mCanBeCreated; }
|
||||||
|
|
||||||
// Static
|
// Static
|
||||||
static void GetAllTypesInGame(EGame Game, std::list<CResTypeInfo*>& rOut);
|
static void GetAllTypesInGame(EGame Game, std::list<CResTypeInfo*>& rOut);
|
||||||
|
|
|
@ -32,11 +32,11 @@ class CResource
|
||||||
DECLARE_RESOURCE_TYPE(Resource)
|
DECLARE_RESOURCE_TYPE(Resource)
|
||||||
|
|
||||||
CResourceEntry *mpEntry;
|
CResourceEntry *mpEntry;
|
||||||
int mRefCount;
|
int mRefCount = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CResource(CResourceEntry *pEntry = 0)
|
explicit CResource(CResourceEntry *pEntry = nullptr)
|
||||||
: mpEntry(pEntry), mRefCount(0)
|
: mpEntry(pEntry)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,17 +44,17 @@ public:
|
||||||
virtual CDependencyTree* BuildDependencyTree() const { return new CDependencyTree(); }
|
virtual CDependencyTree* BuildDependencyTree() const { return new CDependencyTree(); }
|
||||||
virtual void Serialize(IArchive& /*rArc*/) {}
|
virtual void Serialize(IArchive& /*rArc*/) {}
|
||||||
virtual void InitializeNewResource() {}
|
virtual void InitializeNewResource() {}
|
||||||
|
|
||||||
inline CResourceEntry* Entry() const { return mpEntry; }
|
CResourceEntry* Entry() const { return mpEntry; }
|
||||||
inline CResTypeInfo* TypeInfo() const { return mpEntry->TypeInfo(); }
|
CResTypeInfo* TypeInfo() const { return mpEntry->TypeInfo(); }
|
||||||
inline EResourceType Type() const { return mpEntry->TypeInfo()->Type(); }
|
EResourceType Type() const { return mpEntry->TypeInfo()->Type(); }
|
||||||
inline TString Source() const { return mpEntry ? mpEntry->CookedAssetPath(true).GetFileName() : ""; }
|
TString Source() const { return mpEntry ? mpEntry->CookedAssetPath(true).GetFileName() : ""; }
|
||||||
inline TString FullSource() const { return mpEntry ? mpEntry->CookedAssetPath(true) : ""; }
|
TString FullSource() const { return mpEntry ? mpEntry->CookedAssetPath(true) : ""; }
|
||||||
inline CAssetID ID() const { return mpEntry ? mpEntry->ID() : CAssetID::skInvalidID64; }
|
CAssetID ID() const { return mpEntry ? mpEntry->ID() : CAssetID::skInvalidID64; }
|
||||||
inline EGame Game() const { return mpEntry ? mpEntry->Game() : EGame::Invalid; }
|
EGame Game() const { return mpEntry ? mpEntry->Game() : EGame::Invalid; }
|
||||||
inline bool IsReferenced() const { return mRefCount > 0; }
|
bool IsReferenced() const { return mRefCount > 0; }
|
||||||
inline void Lock() { mRefCount++; }
|
void Lock() { mRefCount++; }
|
||||||
inline void Release() { mRefCount--; }
|
void Release() { mRefCount--; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CRESOURCE_H
|
#endif // CRESOURCE_H
|
||||||
|
|
|
@ -21,13 +21,13 @@ public:
|
||||||
m[1] = Part2;
|
m[1] = Part2;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSavedStateID(IInputStream& rInput)
|
explicit CSavedStateID(IInputStream& rInput)
|
||||||
{
|
{
|
||||||
m[0] = rInput.ReadLongLong();
|
m[0] = rInput.ReadLongLong();
|
||||||
m[1] = rInput.ReadLongLong();
|
m[1] = rInput.ReadLongLong();
|
||||||
}
|
}
|
||||||
|
|
||||||
TString ToString()
|
TString ToString() const
|
||||||
{
|
{
|
||||||
uint32 Part1 = (m[0] >> 32) & 0xFFFFFFFF;
|
uint32 Part1 = (m[0] >> 32) & 0xFFFFFFFF;
|
||||||
uint32 Part2 = (m[0] >> 16) & 0x0000FFFF;
|
uint32 Part2 = (m[0] >> 16) & 0x0000FFFF;
|
||||||
|
@ -61,17 +61,17 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Operators
|
// Operators
|
||||||
inline bool operator==(const CSavedStateID& rkOther)
|
bool operator==(const CSavedStateID& rkOther) const
|
||||||
{
|
{
|
||||||
return (m[0] == rkOther.m[0] && m[1] == rkOther.m[1]);
|
return (m[0] == rkOther.m[0] && m[1] == rkOther.m[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator!=(const CSavedStateID& rkOther)
|
bool operator!=(const CSavedStateID& rkOther) const
|
||||||
{
|
{
|
||||||
return !(*this == rkOther);
|
return !(*this == rkOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator<(const CSavedStateID& rkOther)
|
bool operator<(const CSavedStateID& rkOther) const
|
||||||
{
|
{
|
||||||
return (m[0] == rkOther.m[0] ? m[1] < rkOther.m[1] : m[0] < rkOther.m[0]);
|
return (m[0] == rkOther.m[0] ? m[1] < rkOther.m[1] : m[0] < rkOther.m[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,16 +10,16 @@ class CStringList : public CResource
|
||||||
std::vector<TString> mStringList;
|
std::vector<TString> mStringList;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CStringList(CResourceEntry *pEntry = 0)
|
explicit CStringList(CResourceEntry *pEntry = nullptr)
|
||||||
: CResource(pEntry)
|
: CResource(pEntry)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
inline uint32 NumStrings() const
|
uint32 NumStrings() const
|
||||||
{
|
{
|
||||||
return mStringList.size();
|
return mStringList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline TString StringByIndex(uint32 Index) const
|
TString StringByIndex(uint32 Index) const
|
||||||
{
|
{
|
||||||
ASSERT(Index >= 0 && Index < mStringList.size());
|
ASSERT(Index >= 0 && Index < mStringList.size());
|
||||||
return mStringList[Index];
|
return mStringList[Index];
|
||||||
|
|
|
@ -1,34 +1,16 @@
|
||||||
#include "CTexture.h"
|
#include "CTexture.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
CTexture::CTexture(CResourceEntry *pEntry /*= 0*/)
|
CTexture::CTexture(CResourceEntry *pEntry)
|
||||||
: CResource(pEntry)
|
: CResource(pEntry)
|
||||||
, mTexelFormat(ETexelFormat::RGBA8)
|
|
||||||
, mSourceTexelFormat(ETexelFormat::RGBA8)
|
|
||||||
, mWidth(0)
|
|
||||||
, mHeight(0)
|
|
||||||
, mNumMipMaps(0)
|
|
||||||
, mLinearSize(0)
|
|
||||||
, mEnableMultisampling(false)
|
|
||||||
, mBufferExists(false)
|
|
||||||
, mpImgDataBuffer(nullptr)
|
|
||||||
, mImgDataSize(0)
|
|
||||||
, mGLBufferExists(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CTexture::CTexture(uint32 Width, uint32 Height)
|
CTexture::CTexture(uint32 Width, uint32 Height)
|
||||||
: mTexelFormat(ETexelFormat::RGBA8)
|
: mWidth(static_cast<uint16>(Width))
|
||||||
, mSourceTexelFormat(ETexelFormat::RGBA8)
|
, mHeight(static_cast<uint16>(Height))
|
||||||
, mWidth((uint16) Width)
|
|
||||||
, mHeight((uint16) Height)
|
|
||||||
, mNumMipMaps(1)
|
, mNumMipMaps(1)
|
||||||
, mLinearSize(Width * Height * 4)
|
, mLinearSize(Width * Height * 4)
|
||||||
, mEnableMultisampling(false)
|
|
||||||
, mBufferExists(false)
|
|
||||||
, mpImgDataBuffer(nullptr)
|
|
||||||
, mImgDataSize(0)
|
|
||||||
, mGLBufferExists(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,22 +15,23 @@ class CTexture : public CResource
|
||||||
friend class CTextureDecoder;
|
friend class CTextureDecoder;
|
||||||
friend class CTextureEncoder;
|
friend class CTextureEncoder;
|
||||||
|
|
||||||
ETexelFormat mTexelFormat; // Format of decoded image data
|
ETexelFormat mTexelFormat{ETexelFormat::RGBA8}; // Format of decoded image data
|
||||||
ETexelFormat mSourceTexelFormat; // Format of input TXTR file
|
ETexelFormat mSourceTexelFormat{ETexelFormat::RGBA8}; // Format of input TXTR file
|
||||||
uint16 mWidth, mHeight; // Image dimensions
|
uint16 mWidth = 0; // Image width
|
||||||
uint32 mNumMipMaps; // The number of mipmaps this texture has
|
uint16 mHeight = 0; // Image height
|
||||||
uint32 mLinearSize; // The size of the top level mipmap, in bytes
|
uint32 mNumMipMaps = 0; // The number of mipmaps this texture has
|
||||||
|
uint32 mLinearSize = 0; // The size of the top level mipmap, in bytes
|
||||||
|
|
||||||
bool mEnableMultisampling; // Whether multisample should be enabled (if this texture is a render target).
|
bool mEnableMultisampling = false; // Whether multisample should be enabled (if this texture is a render target).
|
||||||
bool mBufferExists; // Indicates whether image data buffer has valid data
|
bool mBufferExists = false; // Indicates whether image data buffer has valid data
|
||||||
uint8 *mpImgDataBuffer; // Pointer to image data buffer
|
uint8 *mpImgDataBuffer = nullptr; // Pointer to image data buffer
|
||||||
uint32 mImgDataSize; // Size of image data buffer
|
uint32 mImgDataSize = 0; // Size of image data buffer
|
||||||
|
|
||||||
bool mGLBufferExists; // Indicates whether GL buffer has valid data
|
bool mGLBufferExists = false; // Indicates whether GL buffer has valid data
|
||||||
GLuint mTextureID; // ID for texture GL buffer
|
GLuint mTextureID = 0; // ID for texture GL buffer
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CTexture(CResourceEntry *pEntry = 0);
|
explicit CTexture(CResourceEntry *pEntry = nullptr);
|
||||||
CTexture(uint32 Width, uint32 Height);
|
CTexture(uint32 Width, uint32 Height);
|
||||||
~CTexture();
|
~CTexture();
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@ public:
|
||||||
uint32 NumMipMaps() const { return mNumMipMaps; }
|
uint32 NumMipMaps() const { return mNumMipMaps; }
|
||||||
GLuint TextureID() const { return mTextureID; }
|
GLuint TextureID() const { return mTextureID; }
|
||||||
|
|
||||||
inline void SetMultisamplingEnabled(bool Enable)
|
void SetMultisamplingEnabled(bool Enable)
|
||||||
{
|
{
|
||||||
if (mEnableMultisampling != Enable)
|
if (mEnableMultisampling != Enable)
|
||||||
DeleteBuffers();
|
DeleteBuffers();
|
||||||
|
|
|
@ -87,17 +87,17 @@ class CWorld : public CResource
|
||||||
std::vector<SArea> mAreas;
|
std::vector<SArea> mAreas;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CWorld(CResourceEntry *pEntry = 0);
|
explicit CWorld(CResourceEntry *pEntry = nullptr);
|
||||||
~CWorld();
|
~CWorld();
|
||||||
|
|
||||||
CDependencyTree* BuildDependencyTree() const;
|
CDependencyTree* BuildDependencyTree() const override;
|
||||||
void SetAreaLayerInfo(CGameArea *pArea);
|
void SetAreaLayerInfo(CGameArea *pArea);
|
||||||
TString InGameName() const;
|
TString InGameName() const;
|
||||||
TString AreaInGameName(uint32 AreaIndex) const;
|
TString AreaInGameName(uint32 AreaIndex) const;
|
||||||
uint32 AreaIndex(CAssetID AreaID) const;
|
uint32 AreaIndex(CAssetID AreaID) const;
|
||||||
|
|
||||||
// Serialization
|
// Serialization
|
||||||
virtual void Serialize(IArchive& rArc);
|
void Serialize(IArchive& rArc) override;
|
||||||
friend void Serialize(IArchive& rArc, STimeAttackData& rTimeAttackData);
|
friend void Serialize(IArchive& rArc, STimeAttackData& rTimeAttackData);
|
||||||
friend void Serialize(IArchive& rArc, SMemoryRelay& rMemRelay);
|
friend void Serialize(IArchive& rArc, SMemoryRelay& rMemRelay);
|
||||||
friend void Serialize(IArchive& rArc, SArea& rArea);
|
friend void Serialize(IArchive& rArc, SArea& rArea);
|
||||||
|
@ -107,23 +107,23 @@ public:
|
||||||
friend void Serialize(IArchive& rArc, SAudioGrp& rAudioGrp);
|
friend void Serialize(IArchive& rArc, SAudioGrp& rAudioGrp);
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline TString Name() const { return mName; }
|
TString Name() const { return mName; }
|
||||||
inline CStringTable* NameString() const { return mpWorldName; }
|
CStringTable* NameString() const { return mpWorldName; }
|
||||||
inline CStringTable* DarkNameString() const { return mpDarkWorldName; }
|
CStringTable* DarkNameString() const { return mpDarkWorldName; }
|
||||||
inline CResource* SaveWorld() const { return mpSaveWorld; }
|
CResource* SaveWorld() const { return mpSaveWorld; }
|
||||||
inline CModel* DefaultSkybox() const { return mpDefaultSkybox; }
|
CModel* DefaultSkybox() const { return mpDefaultSkybox; }
|
||||||
inline CResource* MapWorld() const { return mpMapWorld; }
|
CResource* MapWorld() const { return mpMapWorld; }
|
||||||
|
|
||||||
inline uint32 NumAreas() const { return mAreas.size(); }
|
uint32 NumAreas() const { return mAreas.size(); }
|
||||||
inline CAssetID AreaResourceID(uint32 AreaIndex) const { return mAreas[AreaIndex].AreaResID; }
|
CAssetID AreaResourceID(uint32 AreaIndex) const { return mAreas[AreaIndex].AreaResID; }
|
||||||
inline uint32 AreaAttachedCount(uint32 AreaIndex) const { return mAreas[AreaIndex].AttachedAreaIDs.size(); }
|
uint32 AreaAttachedCount(uint32 AreaIndex) const { return mAreas[AreaIndex].AttachedAreaIDs.size(); }
|
||||||
inline uint32 AreaAttachedID(uint32 AreaIndex, uint32 AttachedIndex) const { return mAreas[AreaIndex].AttachedAreaIDs[AttachedIndex]; }
|
uint32 AreaAttachedID(uint32 AreaIndex, uint32 AttachedIndex) const { return mAreas[AreaIndex].AttachedAreaIDs[AttachedIndex]; }
|
||||||
inline TString AreaInternalName(uint32 AreaIndex) const { return mAreas[AreaIndex].InternalName; }
|
TString AreaInternalName(uint32 AreaIndex) const { return mAreas[AreaIndex].InternalName; }
|
||||||
inline CStringTable* AreaName(uint32 AreaIndex) const { return mAreas[AreaIndex].pAreaName; }
|
CStringTable* AreaName(uint32 AreaIndex) const { return mAreas[AreaIndex].pAreaName; }
|
||||||
inline bool DoesAreaAllowPakDuplicates(uint32 AreaIndex) const { return mAreas[AreaIndex].AllowPakDuplicates; }
|
bool DoesAreaAllowPakDuplicates(uint32 AreaIndex) const { return mAreas[AreaIndex].AllowPakDuplicates; }
|
||||||
|
|
||||||
inline void SetName(const TString& rkName) { mName = rkName; }
|
void SetName(const TString& rkName) { mName = rkName; }
|
||||||
inline void SetAreaAllowsPakDuplicates(uint32 AreaIndex, bool Allow) { mAreas[AreaIndex].AllowPakDuplicates = Allow; }
|
void SetAreaAllowsPakDuplicates(uint32 AreaIndex, bool Allow) { mAreas[AreaIndex].AllowPakDuplicates = Allow; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CWORLD_H
|
#endif // CWORLD_H
|
||||||
|
|
|
@ -11,12 +11,12 @@ class CCollidableOBBTree : public CCollisionMesh
|
||||||
std::unique_ptr<SOBBTreeNode> mpOBBTree;
|
std::unique_ptr<SOBBTreeNode> mpOBBTree;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void BuildRenderData() override;
|
void BuildRenderData() override;
|
||||||
|
|
||||||
void BuildOBBTree();
|
void BuildOBBTree();
|
||||||
|
|
||||||
/** Accessors */
|
/** Accessors */
|
||||||
inline SOBBTreeNode* GetOBBTree() const
|
SOBBTreeNode* GetOBBTree() const
|
||||||
{
|
{
|
||||||
return mpOBBTree.get();
|
return mpOBBTree.get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
bool IsFloor() const;
|
bool IsFloor() const;
|
||||||
bool IsUnstandable(EGame Game) const;
|
bool IsUnstandable(EGame Game) const;
|
||||||
|
|
||||||
inline uint64 RawFlags() const { return mRawFlags; }
|
uint64 RawFlags() const { return mRawFlags; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CCOLLISIONMATERIAL
|
#endif // CCOLLISIONMATERIAL
|
||||||
|
|
|
@ -21,22 +21,22 @@ public:
|
||||||
virtual void BuildRenderData();
|
virtual void BuildRenderData();
|
||||||
|
|
||||||
/** Accessors */
|
/** Accessors */
|
||||||
inline CAABox Bounds() const
|
CAABox Bounds() const
|
||||||
{
|
{
|
||||||
return mAABox;
|
return mAABox;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const SCollisionIndexData& GetIndexData() const
|
const SCollisionIndexData& GetIndexData() const
|
||||||
{
|
{
|
||||||
return mIndexData;
|
return mIndexData;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const CCollisionRenderData& GetRenderData() const
|
const CCollisionRenderData& GetRenderData() const
|
||||||
{
|
{
|
||||||
return mRenderData;
|
return mRenderData;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline CCollisionRenderData& GetRenderData()
|
CCollisionRenderData& GetRenderData()
|
||||||
{
|
{
|
||||||
return mRenderData;
|
return mRenderData;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,23 +21,23 @@ public:
|
||||||
delete *it;
|
delete *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint32 NumMeshes() const { return mMeshes.size(); }
|
uint32 NumMeshes() const { return mMeshes.size(); }
|
||||||
inline CCollisionMesh* MeshByIndex(uint32 Index) const { return mMeshes[Index]; }
|
CCollisionMesh* MeshByIndex(uint32 Index) const { return mMeshes[Index]; }
|
||||||
inline void AddMesh(CCollisionMesh *pMesh) { mMeshes.push_back(pMesh); }
|
void AddMesh(CCollisionMesh *pMesh) { mMeshes.push_back(pMesh); }
|
||||||
|
|
||||||
inline void BuildRenderData()
|
void BuildRenderData()
|
||||||
{
|
{
|
||||||
for (auto It = mMeshes.begin(); It != mMeshes.end(); It++)
|
for (auto It = mMeshes.begin(); It != mMeshes.end(); It++)
|
||||||
(*It)->BuildRenderData();
|
(*It)->BuildRenderData();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Draw()
|
void Draw()
|
||||||
{
|
{
|
||||||
for (auto it = mMeshes.begin(); it != mMeshes.end(); it++)
|
for (auto it = mMeshes.begin(); it != mMeshes.end(); it++)
|
||||||
(*it)->GetRenderData().Render(false);
|
(*it)->GetRenderData().Render(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void DrawWireframe()
|
void DrawWireframe()
|
||||||
{
|
{
|
||||||
for (auto it = mMeshes.begin(); it != mMeshes.end(); it++)
|
for (auto it = mMeshes.begin(); it != mMeshes.end(); it++)
|
||||||
(*it)->GetRenderData().Render(true);
|
(*it)->GetRenderData().Render(true);
|
||||||
|
|
|
@ -30,17 +30,13 @@ class CCollisionRenderData
|
||||||
std::vector<uint> mBoundingDepthOffsets;
|
std::vector<uint> mBoundingDepthOffsets;
|
||||||
|
|
||||||
/** Whether render data has been built */
|
/** Whether render data has been built */
|
||||||
bool mBuilt;
|
bool mBuilt = false;
|
||||||
|
|
||||||
/** Whether bounding hierarchy render data has been built */
|
/** Whether bounding hierarchy render data has been built */
|
||||||
bool mBoundingHierarchyBuilt;
|
bool mBoundingHierarchyBuilt = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Default constructor */
|
CCollisionRenderData() = default;
|
||||||
CCollisionRenderData()
|
|
||||||
: mBuilt(false)
|
|
||||||
, mBoundingHierarchyBuilt(false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
/** Build from collision data */
|
/** Build from collision data */
|
||||||
void BuildRenderData(const SCollisionIndexData& kIndexData);
|
void BuildRenderData(const SCollisionIndexData& kIndexData);
|
||||||
|
@ -52,7 +48,7 @@ public:
|
||||||
int MaxBoundingHierarchyDepth() const;
|
int MaxBoundingHierarchyDepth() const;
|
||||||
|
|
||||||
/** Accessors */
|
/** Accessors */
|
||||||
inline bool IsBuilt() const { return mBuilt; }
|
bool IsBuilt() const { return mBuilt; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CCOLLISIONRENDERDATA_H
|
#endif // CCOLLISIONRENDERDATA_H
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
|
|
||||||
class CPoiToWorldCooker
|
class CPoiToWorldCooker
|
||||||
{
|
{
|
||||||
CPoiToWorldCooker() {}
|
CPoiToWorldCooker() = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static bool CookEGMC(CPoiToWorld *pPoiToWorld, IOutputStream& rOut);
|
static bool CookEGMC(CPoiToWorld *pPoiToWorld, IOutputStream& rOut);
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
class CResourceCooker
|
class CResourceCooker
|
||||||
{
|
{
|
||||||
CResourceCooker() {}
|
CResourceCooker() = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static bool CookResource(CResourceEntry *pEntry, IOutputStream& rOutput)
|
static bool CookResource(CResourceEntry *pEntry, IOutputStream& rOutput)
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
/** Cooker class for writing game-compatible SCAN assets */
|
/** Cooker class for writing game-compatible SCAN assets */
|
||||||
class CScanCooker
|
class CScanCooker
|
||||||
{
|
{
|
||||||
CScanCooker() {}
|
CScanCooker() = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static bool CookSCAN(CScan* pScan, IOutputStream& SCAN);
|
static bool CookSCAN(CScan* pScan, IOutputStream& SCAN);
|
||||||
|
|
|
@ -14,7 +14,7 @@ class CScriptCooker
|
||||||
bool mWriteGeneratedSeparately;
|
bool mWriteGeneratedSeparately;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CScriptCooker(EGame Game, bool WriteGeneratedObjectsSeparately = true)
|
explicit CScriptCooker(EGame Game, bool WriteGeneratedObjectsSeparately = true)
|
||||||
: mGame(Game)
|
: mGame(Game)
|
||||||
, mWriteGeneratedSeparately(WriteGeneratedObjectsSeparately && mGame >= EGame::EchoesDemo)
|
, mWriteGeneratedSeparately(WriteGeneratedObjectsSeparately && mGame >= EGame::EchoesDemo)
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -8,17 +8,13 @@
|
||||||
// Small class to manage file sections for CMDL/MREA output
|
// Small class to manage file sections for CMDL/MREA output
|
||||||
class CSectionMgrOut
|
class CSectionMgrOut
|
||||||
{
|
{
|
||||||
uint32 mSectionCount;
|
uint32 mSectionCount = 0;
|
||||||
uint32 mCurSectionStart;
|
uint32 mCurSectionStart = 0;
|
||||||
uint32 mCurSectionIndex;
|
uint32 mCurSectionIndex = 0;
|
||||||
std::vector<uint32> mSectionSizes;
|
std::vector<uint32> mSectionSizes;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSectionMgrOut()
|
CSectionMgrOut() = default;
|
||||||
: mSectionCount(0)
|
|
||||||
, mCurSectionStart(0)
|
|
||||||
, mCurSectionIndex(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void SetSectionCount(uint32 Count)
|
void SetSectionCount(uint32 Count)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,7 @@ class CStringCooker
|
||||||
{
|
{
|
||||||
TResPtr<CStringTable> mpStringTable;
|
TResPtr<CStringTable> mpStringTable;
|
||||||
|
|
||||||
CStringCooker(CStringTable* pStringTable)
|
explicit CStringCooker(CStringTable* pStringTable)
|
||||||
: mpStringTable(pStringTable) {}
|
: mpStringTable(pStringTable) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
#include "CTextureEncoder.h"
|
#include "CTextureEncoder.h"
|
||||||
#include <Common/Log.h>
|
#include <Common/Log.h>
|
||||||
|
|
||||||
CTextureEncoder::CTextureEncoder()
|
CTextureEncoder::CTextureEncoder() = default;
|
||||||
: mpTexture(nullptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CTextureEncoder::WriteTXTR(IOutputStream& rTXTR)
|
void CTextureEncoder::WriteTXTR(IOutputStream& rTXTR)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
// More advanced functions (including actual encoding!) coming later
|
// More advanced functions (including actual encoding!) coming later
|
||||||
class CTextureEncoder
|
class CTextureEncoder
|
||||||
{
|
{
|
||||||
TResPtr<CTexture> mpTexture;
|
TResPtr<CTexture> mpTexture{nullptr};
|
||||||
ETexelFormat mSourceFormat;
|
ETexelFormat mSourceFormat{};
|
||||||
ETexelFormat mOutputFormat;
|
ETexelFormat mOutputFormat{};
|
||||||
|
|
||||||
CTextureEncoder();
|
CTextureEncoder();
|
||||||
void WriteTXTR(IOutputStream& rTXTR);
|
void WriteTXTR(IOutputStream& rTXTR);
|
||||||
|
|
|
@ -8,7 +8,7 @@ class CPoiToWorldLoader
|
||||||
{
|
{
|
||||||
TResPtr<CPoiToWorld> mpPoiToWorld;
|
TResPtr<CPoiToWorld> mpPoiToWorld;
|
||||||
|
|
||||||
CPoiToWorldLoader() {}
|
CPoiToWorldLoader() = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static CPoiToWorld* LoadEGMC(IInputStream& rEGMC, CResourceEntry *pEntry);
|
static CPoiToWorld* LoadEGMC(IInputStream& rEGMC, CResourceEntry *pEntry);
|
||||||
|
|
|
@ -8,7 +8,7 @@ class CScanLoader
|
||||||
{
|
{
|
||||||
TResPtr<CScan> mpScan;
|
TResPtr<CScan> mpScan;
|
||||||
|
|
||||||
CScanLoader() {}
|
CScanLoader() = default;
|
||||||
CScan* LoadScanMP1(IInputStream& SCAN, CResourceEntry* pEntry);
|
CScan* LoadScanMP1(IInputStream& SCAN, CResourceEntry* pEntry);
|
||||||
CScan* LoadScanMP2(IInputStream& SCAN, CResourceEntry* pEntry);
|
CScan* LoadScanMP2(IInputStream& SCAN, CResourceEntry* pEntry);
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,9 @@ class CSectionMgrIn
|
||||||
{
|
{
|
||||||
IInputStream *mpInputStream;
|
IInputStream *mpInputStream;
|
||||||
std::vector<uint32> mSectionSizes;
|
std::vector<uint32> mSectionSizes;
|
||||||
uint32 mCurSec;
|
uint32 mCurSec = 0;
|
||||||
uint32 mCurSecStart;
|
uint32 mCurSecStart = 0;
|
||||||
uint32 mSecsStart;
|
uint32 mSecsStart = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSectionMgrIn(uint32 Count, IInputStream* pSrc)
|
CSectionMgrIn(uint32 Count, IInputStream* pSrc)
|
||||||
|
@ -24,7 +24,7 @@ public:
|
||||||
mSectionSizes[iSec] = pSrc->ReadLong();
|
mSectionSizes[iSec] = pSrc->ReadLong();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
// Initializes the block manager and marks the start of the first block
|
// Initializes the block manager and marks the start of the first block
|
||||||
mCurSec = 0;
|
mCurSec = 0;
|
||||||
|
@ -43,18 +43,18 @@ public:
|
||||||
mCurSecStart = mpInputStream->Tell();
|
mCurSecStart = mpInputStream->Tell();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ToNextSection()
|
void ToNextSection()
|
||||||
{
|
{
|
||||||
mCurSecStart += mSectionSizes[mCurSec];
|
mCurSecStart += mSectionSizes[mCurSec];
|
||||||
mpInputStream->Seek(mCurSecStart, SEEK_SET);
|
mpInputStream->Seek(mCurSecStart, SEEK_SET);
|
||||||
mCurSec++;
|
mCurSec++;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint32 NextOffset() { return mCurSecStart + mSectionSizes[mCurSec]; }
|
uint32 NextOffset() const { return mCurSecStart + mSectionSizes[mCurSec]; }
|
||||||
inline uint32 CurrentSection() { return mCurSec; }
|
uint32 CurrentSection() const { return mCurSec; }
|
||||||
inline uint32 CurrentSectionSize() { return mSectionSizes[mCurSec]; }
|
uint32 CurrentSectionSize() const { return mSectionSizes[mCurSec]; }
|
||||||
inline uint32 NumSections() { return mSectionSizes.size(); }
|
uint32 NumSections() const { return mSectionSizes.size(); }
|
||||||
inline void SetInputStream(IInputStream *pIn) { mpInputStream = pIn; }
|
void SetInputStream(IInputStream *pIn) { mpInputStream = pIn; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CSECTIONMGRIN_H
|
#endif // CSECTIONMGRIN_H
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
class CSkeletonLoader
|
class CSkeletonLoader
|
||||||
{
|
{
|
||||||
TResPtr<CSkeleton> mpSkeleton;
|
TResPtr<CSkeleton> mpSkeleton;
|
||||||
EGame mVersion;
|
EGame mVersion{};
|
||||||
|
|
||||||
CSkeletonLoader() {}
|
CSkeletonLoader() = default;
|
||||||
void SetLocalBoneCoords(CBone *pBone);
|
void SetLocalBoneCoords(CBone *pBone);
|
||||||
void CalculateBoneInverseBindMatrices();
|
void CalculateBoneInverseBindMatrices();
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
|
|
||||||
class CSkinLoader
|
class CSkinLoader
|
||||||
{
|
{
|
||||||
CSkinLoader() {}
|
CSkinLoader() = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static CSkin* LoadCSKR(IInputStream& rCSKR, CResourceEntry *pEntry);
|
static CSkin* LoadCSKR(IInputStream& rCSKR, CResourceEntry *pEntry);
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
|
|
||||||
class CStringLoader
|
class CStringLoader
|
||||||
{
|
{
|
||||||
CStringTable *mpStringTable;
|
CStringTable *mpStringTable = nullptr;
|
||||||
EGame mVersion;
|
EGame mVersion{};
|
||||||
|
|
||||||
CStringLoader() {}
|
CStringLoader() = default;
|
||||||
void LoadPrimeDemoSTRG(IInputStream& STRG);
|
void LoadPrimeDemoSTRG(IInputStream& STRG);
|
||||||
void LoadPrimeSTRG(IInputStream& STRG);
|
void LoadPrimeSTRG(IInputStream& STRG);
|
||||||
void LoadCorruptionSTRG(IInputStream& STRG);
|
void LoadCorruptionSTRG(IInputStream& STRG);
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
// This is needed so we have access to the full dependency list of all resource types.
|
// This is needed so we have access to the full dependency list of all resource types.
|
||||||
class CUnsupportedFormatLoader
|
class CUnsupportedFormatLoader
|
||||||
{
|
{
|
||||||
CDependencyGroup *mpGroup;
|
CDependencyGroup *mpGroup = nullptr;
|
||||||
CUnsupportedFormatLoader() {}
|
CUnsupportedFormatLoader() = default;
|
||||||
|
|
||||||
static void PerformCheating(IInputStream& rFile, EGame Game, std::list<CAssetID>& rAssetList);
|
static void PerformCheating(IInputStream& rFile, EGame Game, std::list<CAssetID>& rAssetList);
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
// Used for finding dependencies. Split from CUnsupportedFormatLoader for being too big.
|
// Used for finding dependencies. Split from CUnsupportedFormatLoader for being too big.
|
||||||
class CUnsupportedParticleLoader
|
class CUnsupportedParticleLoader
|
||||||
{
|
{
|
||||||
CDependencyGroup *mpGroup;
|
CDependencyGroup *mpGroup = nullptr;
|
||||||
CUnsupportedParticleLoader() {}
|
CUnsupportedParticleLoader() = default;
|
||||||
|
|
||||||
// Format-Specific Parameter Loading
|
// Format-Specific Parameter Loading
|
||||||
bool ParseParticleParameter(IInputStream& rPART);
|
bool ParseParticleParameter(IInputStream& rPART);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
class CWorldLoader
|
class CWorldLoader
|
||||||
{
|
{
|
||||||
TResPtr<CWorld> mpWorld;
|
TResPtr<CWorld> mpWorld;
|
||||||
EGame mVersion;
|
EGame mVersion{};
|
||||||
|
|
||||||
CWorldLoader();
|
CWorldLoader();
|
||||||
void LoadPrimeMLVL(IInputStream& rMLVL);
|
void LoadPrimeMLVL(IInputStream& rMLVL);
|
||||||
|
|
|
@ -21,14 +21,14 @@ class CModel : public CBasicModel
|
||||||
bool mHasOwnMaterials;
|
bool mHasOwnMaterials;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CModel(CResourceEntry *pEntry = 0);
|
explicit CModel(CResourceEntry *pEntry = nullptr);
|
||||||
CModel(CMaterialSet *pSet, bool OwnsMatSet);
|
CModel(CMaterialSet *pSet, bool OwnsMatSet);
|
||||||
~CModel();
|
~CModel();
|
||||||
|
|
||||||
CDependencyTree* BuildDependencyTree() const;
|
CDependencyTree* BuildDependencyTree() const override;
|
||||||
void BufferGL();
|
void BufferGL();
|
||||||
void GenerateMaterialShaders();
|
void GenerateMaterialShaders();
|
||||||
void ClearGLBuffer();
|
void ClearGLBuffer() override;
|
||||||
void Draw(FRenderOptions Options, uint32 MatSet);
|
void Draw(FRenderOptions Options, uint32 MatSet);
|
||||||
void DrawSurface(FRenderOptions Options, uint32 Surface, uint32 MatSet);
|
void DrawSurface(FRenderOptions Options, uint32 Surface, uint32 MatSet);
|
||||||
void DrawWireframe(FRenderOptions Options, CColor WireColor = CColor::skWhite);
|
void DrawWireframe(FRenderOptions Options, CColor WireColor = CColor::skWhite);
|
||||||
|
@ -43,7 +43,7 @@ public:
|
||||||
bool IsSurfaceTransparent(uint32 Surface, uint32 MatSet);
|
bool IsSurfaceTransparent(uint32 Surface, uint32 MatSet);
|
||||||
bool IsLightmapped() const;
|
bool IsLightmapped() const;
|
||||||
|
|
||||||
inline bool IsSkinned() const { return (mpSkin != nullptr); }
|
bool IsSkinned() const { return (mpSkin != nullptr); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CIndexBuffer* InternalGetIBO(uint32 Surface, EPrimitiveType Primitive);
|
CIndexBuffer* InternalGetIBO(uint32 Surface, EPrimitiveType Primitive);
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
|
|
||||||
CStaticModel::CStaticModel()
|
CStaticModel::CStaticModel()
|
||||||
: CBasicModel(nullptr)
|
: CBasicModel(nullptr)
|
||||||
, mpMaterial(nullptr)
|
|
||||||
, mTransparent(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,9 +15,7 @@ CStaticModel::CStaticModel(CMaterial *pMat)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CStaticModel::~CStaticModel()
|
CStaticModel::~CStaticModel() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CStaticModel::AddSurface(SSurface *pSurface)
|
void CStaticModel::AddSurface(SSurface *pSurface)
|
||||||
{
|
{
|
||||||
|
@ -213,12 +209,12 @@ void CStaticModel::SetMaterial(CMaterial *pMat)
|
||||||
mTransparent = pMat->Options().HasFlag(EMaterialOption::Transparent);
|
mTransparent = pMat->Options().HasFlag(EMaterialOption::Transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CStaticModel::IsTransparent()
|
bool CStaticModel::IsTransparent() const
|
||||||
{
|
{
|
||||||
return mTransparent;
|
return mTransparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CStaticModel::IsOccluder()
|
bool CStaticModel::IsOccluder() const
|
||||||
{
|
{
|
||||||
return mpMaterial->Options().HasFlag(EMaterialOption::Occluder);
|
return mpMaterial->Options().HasFlag(EMaterialOption::Occluder);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
* IBOs. This allows for a significantly reduced number of draw calls. */
|
* IBOs. This allows for a significantly reduced number of draw calls. */
|
||||||
class CStaticModel : public CBasicModel
|
class CStaticModel : public CBasicModel
|
||||||
{
|
{
|
||||||
CMaterial *mpMaterial;
|
CMaterial *mpMaterial = nullptr;
|
||||||
std::vector<CIndexBuffer> mIBOs;
|
std::vector<CIndexBuffer> mIBOs;
|
||||||
std::vector<std::vector<uint32>> mSurfaceEndOffsets;
|
std::vector<std::vector<uint32>> mSurfaceEndOffsets;
|
||||||
bool mTransparent;
|
bool mTransparent = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CStaticModel();
|
CStaticModel();
|
||||||
CStaticModel(CMaterial *pMat);
|
explicit CStaticModel(CMaterial *pMat);
|
||||||
~CStaticModel();
|
~CStaticModel();
|
||||||
void AddSurface(SSurface *pSurface);
|
void AddSurface(SSurface *pSurface);
|
||||||
|
|
||||||
|
@ -30,8 +30,8 @@ public:
|
||||||
|
|
||||||
CMaterial* GetMaterial();
|
CMaterial* GetMaterial();
|
||||||
void SetMaterial(CMaterial *pMat);
|
void SetMaterial(CMaterial *pMat);
|
||||||
bool IsTransparent();
|
bool IsTransparent() const;
|
||||||
bool IsOccluder();
|
bool IsOccluder() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CIndexBuffer* InternalGetIBO(EPrimitiveType Primitive);
|
CIndexBuffer* InternalGetIBO(EPrimitiveType Primitive);
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
#include <Common/Math/CVector3f.h>
|
#include <Common/Math/CVector3f.h>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
typedef std::array<uint8, 4> TBoneIndices;
|
using TBoneIndices = std::array<uint8, 4>;
|
||||||
typedef std::array<float, 4> TBoneWeights;
|
using TBoneWeights = std::array<float, 4>;
|
||||||
|
|
||||||
class CVertex
|
class CVertex
|
||||||
{
|
{
|
||||||
|
@ -24,12 +24,11 @@ public:
|
||||||
|
|
||||||
CVertex() {}
|
CVertex() {}
|
||||||
|
|
||||||
CVertex(const CVector3f& rPos)
|
CVertex(const CVector3f& rPos) : Position{rPos}
|
||||||
{
|
{
|
||||||
Position = rPos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const CVertex& rkOther) {
|
bool operator==(const CVertex& rkOther) const {
|
||||||
return ((Position == rkOther.Position) &&
|
return ((Position == rkOther.Position) &&
|
||||||
(Normal == rkOther.Normal) &&
|
(Normal == rkOther.Normal) &&
|
||||||
(Color[0] == rkOther.Color[0]) &&
|
(Color[0] == rkOther.Color[0]) &&
|
||||||
|
@ -45,6 +44,11 @@ public:
|
||||||
(BoneIndices == rkOther.BoneIndices) &&
|
(BoneIndices == rkOther.BoneIndices) &&
|
||||||
(BoneWeights == rkOther.BoneWeights));
|
(BoneWeights == rkOther.BoneWeights));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator!=(const CVertex& other) const
|
||||||
|
{
|
||||||
|
return !operator==(other);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CVERTEX_H
|
#endif // CVERTEX_H
|
||||||
|
|
|
@ -15,13 +15,13 @@
|
||||||
// Should prolly be a class
|
// Should prolly be a class
|
||||||
struct SSurface
|
struct SSurface
|
||||||
{
|
{
|
||||||
uint32 VertexCount;
|
uint32 VertexCount = 0;
|
||||||
uint32 TriangleCount;
|
uint32 TriangleCount = 0;
|
||||||
CAABox AABox;
|
CAABox AABox;
|
||||||
CVector3f CenterPoint;
|
CVector3f CenterPoint;
|
||||||
uint32 MaterialID;
|
uint32 MaterialID = 0;
|
||||||
CVector3f ReflectionDirection;
|
CVector3f ReflectionDirection;
|
||||||
uint16 MeshID;
|
uint16 MeshID = 0;
|
||||||
|
|
||||||
struct SPrimitive
|
struct SPrimitive
|
||||||
{
|
{
|
||||||
|
@ -30,11 +30,7 @@ struct SSurface
|
||||||
};
|
};
|
||||||
std::vector<SPrimitive> Primitives;
|
std::vector<SPrimitive> Primitives;
|
||||||
|
|
||||||
SSurface()
|
SSurface() = default;
|
||||||
{
|
|
||||||
VertexCount = 0;
|
|
||||||
TriangleCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::pair<bool,float> IntersectsRay(const CRay& rkRay, bool AllowBackfaces = false, float LineThreshold = 0.02f);
|
std::pair<bool,float> IntersectsRay(const CRay& rkRay, bool AllowBackfaces = false, float LineThreshold = 0.02f);
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,7 +20,7 @@ class CScan : public CResource
|
||||||
std::vector<uint8> mPropertyData;
|
std::vector<uint8> mPropertyData;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CScan(CResourceEntry* pEntry = 0);
|
explicit CScan(CResourceEntry* pEntry = nullptr);
|
||||||
CStructRef ScanData() const;
|
CStructRef ScanData() const;
|
||||||
|
|
||||||
/** Convenience property accessors */
|
/** Convenience property accessors */
|
||||||
|
@ -28,7 +28,7 @@ public:
|
||||||
CBoolRef IsCriticalPropertyRef() const;
|
CBoolRef IsCriticalPropertyRef() const;
|
||||||
|
|
||||||
/** CResource interface */
|
/** CResource interface */
|
||||||
virtual CDependencyTree* BuildDependencyTree() const override;
|
CDependencyTree* BuildDependencyTree() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CSCAN_H
|
#endif // CSCAN_H
|
||||||
|
|
|
@ -19,12 +19,12 @@ struct SObjId
|
||||||
CFourCC ID_4CC;
|
CFourCC ID_4CC;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline SObjId() {}
|
SObjId() {}
|
||||||
inline SObjId(uint32 InID) : ID(InID) {}
|
SObjId(uint32 InID) : ID(InID) {}
|
||||||
inline SObjId(CFourCC InID) : ID_4CC(InID) {}
|
SObjId(CFourCC InID) : ID_4CC(InID) {}
|
||||||
|
|
||||||
inline operator uint32() const { return ID; }
|
operator uint32() const { return ID; }
|
||||||
inline operator CFourCC() const { return ID_4CC; }
|
operator CFourCC() const { return ID_4CC; }
|
||||||
|
|
||||||
void Serialize(IArchive& Arc)
|
void Serialize(IArchive& Arc)
|
||||||
{
|
{
|
||||||
|
@ -61,8 +61,8 @@ struct TTemplatePath
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef TTemplatePath<CScriptTemplate> SScriptTemplatePath;
|
using SScriptTemplatePath = TTemplatePath<CScriptTemplate>;
|
||||||
typedef TTemplatePath<IProperty> SPropertyTemplatePath;
|
using SPropertyTemplatePath = TTemplatePath<IProperty>;
|
||||||
|
|
||||||
/** CGameTemplate - Per-game template data */
|
/** CGameTemplate - Per-game template data */
|
||||||
class CGameTemplate
|
class CGameTemplate
|
||||||
|
@ -106,12 +106,12 @@ public:
|
||||||
CScriptTemplate* FindMiscTemplate(const TString& kTemplateName);
|
CScriptTemplate* FindMiscTemplate(const TString& kTemplateName);
|
||||||
TString GetGameDirectory() const;
|
TString GetGameDirectory() const;
|
||||||
|
|
||||||
// Inline Accessors
|
// Accessors
|
||||||
inline EGame Game() const { return mGame; }
|
EGame Game() const { return mGame; }
|
||||||
inline uint32 NumScriptTemplates() const { return mScriptTemplates.size(); }
|
uint32 NumScriptTemplates() const { return mScriptTemplates.size(); }
|
||||||
inline uint32 NumStates() const { return mStates.size(); }
|
uint32 NumStates() const { return mStates.size(); }
|
||||||
inline uint32 NumMessages() const { return mMessages.size(); }
|
uint32 NumMessages() const { return mMessages.size(); }
|
||||||
inline bool IsLoadedSuccessfully() { return mFullyLoaded; }
|
bool IsLoadedSuccessfully() const { return mFullyLoaded; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CGAMETEMPLATE_H
|
#endif // CGAMETEMPLATE_H
|
||||||
|
|
|
@ -63,18 +63,14 @@ struct SMessage
|
||||||
class CLink
|
class CLink
|
||||||
{
|
{
|
||||||
CGameArea *mpArea;
|
CGameArea *mpArea;
|
||||||
uint32 mStateID;
|
uint32 mStateID = UINT32_MAX;
|
||||||
uint32 mMessageID;
|
uint32 mMessageID = UINT32_MAX;
|
||||||
uint32 mSenderID;
|
uint32 mSenderID = UINT32_MAX;
|
||||||
uint32 mReceiverID;
|
uint32 mReceiverID = UINT32_MAX;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLink(CGameArea *pArea)
|
CLink(CGameArea *pArea)
|
||||||
: mpArea(pArea)
|
: mpArea(pArea)
|
||||||
, mStateID(-1)
|
|
||||||
, mMessageID(-1)
|
|
||||||
, mSenderID(-1)
|
|
||||||
, mReceiverID(-1)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
CLink(CGameArea *pArea, uint32 StateID, uint32 MessageID, uint32 SenderID, uint32 ReceiverID)
|
CLink(CGameArea *pArea, uint32 StateID, uint32 MessageID, uint32 SenderID, uint32 ReceiverID)
|
||||||
|
@ -140,31 +136,31 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Operators
|
// Operators
|
||||||
bool operator==(const CLink& rkOther)
|
bool operator==(const CLink& rkOther) const
|
||||||
{
|
{
|
||||||
return ( (mpArea == rkOther.mpArea) &&
|
return (mpArea == rkOther.mpArea) &&
|
||||||
(mStateID == rkOther.mStateID) &&
|
(mStateID == rkOther.mStateID) &&
|
||||||
(mMessageID == rkOther.mMessageID) &&
|
(mMessageID == rkOther.mMessageID) &&
|
||||||
(mSenderID == rkOther.mSenderID) &&
|
(mSenderID == rkOther.mSenderID) &&
|
||||||
(mReceiverID == rkOther.mReceiverID) );
|
(mReceiverID == rkOther.mReceiverID);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const CLink& rkOther)
|
bool operator!=(const CLink& rkOther) const
|
||||||
{
|
{
|
||||||
return (!(*this == rkOther));
|
return (!(*this == rkOther));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline CGameArea* Area() const { return mpArea; }
|
CGameArea* Area() const { return mpArea; }
|
||||||
inline uint32 State() const { return mStateID; }
|
uint32 State() const { return mStateID; }
|
||||||
inline uint32 Message() const { return mMessageID; }
|
uint32 Message() const { return mMessageID; }
|
||||||
inline uint32 SenderID() const { return mSenderID; }
|
uint32 SenderID() const { return mSenderID; }
|
||||||
inline uint32 ReceiverID() const { return mReceiverID; }
|
uint32 ReceiverID() const { return mReceiverID; }
|
||||||
inline CScriptObject* Sender() const { return mpArea->InstanceByID(mSenderID); }
|
CScriptObject* Sender() const { return mpArea->InstanceByID(mSenderID); }
|
||||||
inline CScriptObject* Receiver() const { return mpArea->InstanceByID(mReceiverID); }
|
CScriptObject* Receiver() const { return mpArea->InstanceByID(mReceiverID); }
|
||||||
|
|
||||||
inline void SetState(uint32 StateID) { mStateID = StateID; }
|
void SetState(uint32 StateID) { mStateID = StateID; }
|
||||||
inline void SetMessage(uint32 MessageID) { mMessageID = MessageID; }
|
void SetMessage(uint32 MessageID) { mMessageID = MessageID; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,15 +11,13 @@ class CScriptLayer
|
||||||
{
|
{
|
||||||
CGameArea *mpArea;
|
CGameArea *mpArea;
|
||||||
TString mLayerName;
|
TString mLayerName;
|
||||||
bool mActive;
|
bool mActive = true;
|
||||||
bool mVisible;
|
bool mVisible = true;
|
||||||
std::vector<CScriptObject*> mInstances;
|
std::vector<CScriptObject*> mInstances;
|
||||||
public:
|
public:
|
||||||
CScriptLayer(CGameArea *pArea)
|
CScriptLayer(CGameArea *pArea)
|
||||||
: mpArea(pArea)
|
: mpArea(pArea)
|
||||||
, mLayerName("New Layer")
|
, mLayerName("New Layer")
|
||||||
, mActive(true)
|
|
||||||
, mVisible(true)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,14 +76,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline CGameArea* Area() const { return mpArea; }
|
CGameArea* Area() const { return mpArea; }
|
||||||
inline TString Name() const { return mLayerName; }
|
TString Name() const { return mLayerName; }
|
||||||
inline bool IsActive() const { return mActive; }
|
bool IsActive() const { return mActive; }
|
||||||
inline bool IsVisible() const { return mVisible; }
|
bool IsVisible() const { return mVisible; }
|
||||||
inline uint32 NumInstances() const { return mInstances.size(); }
|
uint32 NumInstances() const { return mInstances.size(); }
|
||||||
inline CScriptObject* InstanceByIndex(uint32 Index) const { return mInstances[Index]; }
|
CScriptObject* InstanceByIndex(uint32 Index) const { return mInstances[Index]; }
|
||||||
|
|
||||||
inline CScriptObject* InstanceByID(uint32 ID) const
|
CScriptObject* InstanceByID(uint32 ID) const
|
||||||
{
|
{
|
||||||
for (auto it = mInstances.begin(); it != mInstances.end(); it++)
|
for (auto it = mInstances.begin(); it != mInstances.end(); it++)
|
||||||
{
|
{
|
||||||
|
@ -96,11 +94,11 @@ public:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetName(const TString& rkName) { mLayerName = rkName; }
|
void SetName(const TString& rkName) { mLayerName = rkName; }
|
||||||
inline void SetActive(bool Active) { mActive = Active; }
|
void SetActive(bool Active) { mActive = Active; }
|
||||||
inline void SetVisible(bool Visible) { mVisible = Visible; }
|
void SetVisible(bool Visible) { mVisible = Visible; }
|
||||||
|
|
||||||
inline uint32 AreaIndex() const
|
uint32 AreaIndex() const
|
||||||
{
|
{
|
||||||
for (uint32 iLyr = 0; iLyr < mpArea->NumScriptLayers(); iLyr++)
|
for (uint32 iLyr = 0; iLyr < mpArea->NumScriptLayers(); iLyr++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,10 +7,7 @@ CScriptObject::CScriptObject(uint32 InstanceID, CGameArea *pArea, CScriptLayer *
|
||||||
: mpTemplate(pTemplate)
|
: mpTemplate(pTemplate)
|
||||||
, mpArea(pArea)
|
, mpArea(pArea)
|
||||||
, mpLayer(pLayer)
|
, mpLayer(pLayer)
|
||||||
, mVersion(0)
|
|
||||||
, mInstanceID(InstanceID)
|
, mInstanceID(InstanceID)
|
||||||
, mHasInGameModel(false)
|
|
||||||
, mIsCheckingNearVisibleActivation(false)
|
|
||||||
{
|
{
|
||||||
mpTemplate->AddObject(this);
|
mpTemplate->AddObject(this);
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,13 @@ class CInstanceID
|
||||||
{
|
{
|
||||||
uint32 mId = 0;
|
uint32 mId = 0;
|
||||||
public:
|
public:
|
||||||
operator uint32() const { return mId; }
|
constexpr operator uint32() const { return mId; }
|
||||||
CInstanceID() = default;
|
constexpr CInstanceID() = default;
|
||||||
CInstanceID(uint32 id) : mId(id) {}
|
constexpr CInstanceID(uint32 id) : mId(id) {}
|
||||||
CInstanceID& operator=(uint32 id) { mId = id; return *this; }
|
constexpr CInstanceID& operator=(uint32 id) { mId = id; return *this; }
|
||||||
uint8 Layer() const { return uint8((mId >> 26u) & 0x3fu); }
|
[[nodiscard]] constexpr uint8 Layer() const { return uint8((mId >> 26u) & 0x3fu); }
|
||||||
uint16 Area() const { return uint16((mId >> 16u) & 0x3ffu); }
|
[[nodiscard]] constexpr uint16 Area() const { return uint16((mId >> 16u) & 0x3ffu); }
|
||||||
uint16 Id() const { return uint16(mId & 0xffffu); }
|
[[nodiscard]] constexpr uint16 Id() const { return uint16(mId & 0xffffu); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class CScriptObject
|
class CScriptObject
|
||||||
|
@ -37,7 +37,7 @@ class CScriptObject
|
||||||
CScriptTemplate *mpTemplate;
|
CScriptTemplate *mpTemplate;
|
||||||
CGameArea *mpArea;
|
CGameArea *mpArea;
|
||||||
CScriptLayer *mpLayer;
|
CScriptLayer *mpLayer;
|
||||||
uint32 mVersion;
|
uint32 mVersion = 0;
|
||||||
|
|
||||||
CInstanceID mInstanceID;
|
CInstanceID mInstanceID;
|
||||||
std::vector<CLink*> mOutLinks;
|
std::vector<CLink*> mOutLinks;
|
||||||
|
@ -53,15 +53,15 @@ class CScriptObject
|
||||||
|
|
||||||
TResPtr<CResource> mpDisplayAsset;
|
TResPtr<CResource> mpDisplayAsset;
|
||||||
TResPtr<CCollisionMeshGroup> mpCollision;
|
TResPtr<CCollisionMeshGroup> mpCollision;
|
||||||
uint32 mActiveCharIndex;
|
uint32 mActiveCharIndex = 0;
|
||||||
uint32 mActiveAnimIndex;
|
uint32 mActiveAnimIndex = 0;
|
||||||
bool mHasInGameModel;
|
bool mHasInGameModel = false;
|
||||||
|
|
||||||
EVolumeShape mVolumeShape;
|
EVolumeShape mVolumeShape{};
|
||||||
float mVolumeScale;
|
float mVolumeScale = 0.0f;
|
||||||
|
|
||||||
// Recursion guard
|
// Recursion guard
|
||||||
mutable bool mIsCheckingNearVisibleActivation;
|
mutable bool mIsCheckingNearVisibleActivation = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CScriptObject(uint32 InstanceID, CGameArea *pArea, CScriptLayer *pLayer, CScriptTemplate *pTemplate);
|
CScriptObject(uint32 InstanceID, CGameArea *pArea, CScriptLayer *pLayer, CScriptTemplate *pTemplate);
|
||||||
|
|
|
@ -5,45 +5,19 @@
|
||||||
#include "Core/Resource/Animation/CAnimSet.h"
|
#include "Core/Resource/Animation/CAnimSet.h"
|
||||||
#include <Common/Log.h>
|
#include <Common/Log.h>
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
// Old constructor
|
// Old constructor
|
||||||
CScriptTemplate::CScriptTemplate(CGameTemplate *pGame)
|
CScriptTemplate::CScriptTemplate(CGameTemplate *pGame)
|
||||||
: mpGame(pGame)
|
: mpGame(pGame)
|
||||||
, mpProperties(nullptr)
|
|
||||||
, mVisible(true)
|
|
||||||
, mDirty(false)
|
|
||||||
, mpNameProperty(nullptr)
|
|
||||||
, mpPositionProperty(nullptr)
|
|
||||||
, mpRotationProperty(nullptr)
|
|
||||||
, mpScaleProperty(nullptr)
|
|
||||||
, mpActiveProperty(nullptr)
|
|
||||||
, mpLightParametersProperty(nullptr)
|
|
||||||
, mPreviewScale(1.f)
|
|
||||||
, mVolumeShape(EVolumeShape::NoShape)
|
|
||||||
, mVolumeScale(1.f)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// New constructor
|
// New constructor
|
||||||
CScriptTemplate::CScriptTemplate(CGameTemplate* pInGame, uint32 InObjectID, const TString& kInFilePath)
|
CScriptTemplate::CScriptTemplate(CGameTemplate* pInGame, uint32 InObjectID, const TString& kInFilePath)
|
||||||
: mRotationType(ERotationType::RotationEnabled)
|
: mSourceFile(kInFilePath)
|
||||||
, mScaleType(EScaleType::ScaleEnabled)
|
|
||||||
, mPreviewScale(1.f)
|
|
||||||
, mVolumeShape(EVolumeShape::NoShape)
|
|
||||||
, mVolumeScale(1.f)
|
|
||||||
, mSourceFile(kInFilePath)
|
|
||||||
, mObjectID(InObjectID)
|
, mObjectID(InObjectID)
|
||||||
, mpGame(pInGame)
|
, mpGame(pInGame)
|
||||||
, mpNameProperty(nullptr)
|
|
||||||
, mpPositionProperty(nullptr)
|
|
||||||
, mpRotationProperty(nullptr)
|
|
||||||
, mpScaleProperty(nullptr)
|
|
||||||
, mpActiveProperty(nullptr)
|
|
||||||
, mpLightParametersProperty(nullptr)
|
|
||||||
, mVisible(true)
|
|
||||||
, mDirty(false)
|
|
||||||
{
|
{
|
||||||
// Load
|
// Load
|
||||||
CXMLReader Reader(kInFilePath);
|
CXMLReader Reader(kInFilePath);
|
||||||
|
@ -62,9 +36,7 @@ CScriptTemplate::CScriptTemplate(CGameTemplate* pInGame, uint32 InObjectID, cons
|
||||||
if (!mLightParametersIDString.IsEmpty()) mpLightParametersProperty = TPropCast<CStructProperty>( mpProperties->ChildByIDString(mLightParametersIDString) );
|
if (!mLightParametersIDString.IsEmpty()) mpLightParametersProperty = TPropCast<CStructProperty>( mpProperties->ChildByIDString(mLightParametersIDString) );
|
||||||
}
|
}
|
||||||
|
|
||||||
CScriptTemplate::~CScriptTemplate()
|
CScriptTemplate::~CScriptTemplate() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CScriptTemplate::Serialize(IArchive& Arc)
|
void CScriptTemplate::Serialize(IArchive& Arc)
|
||||||
{
|
{
|
||||||
|
|
|
@ -80,17 +80,17 @@ private:
|
||||||
std::vector<SEditorAsset> mAssets;
|
std::vector<SEditorAsset> mAssets;
|
||||||
std::vector<SAttachment> mAttachments;
|
std::vector<SAttachment> mAttachments;
|
||||||
|
|
||||||
ERotationType mRotationType;
|
ERotationType mRotationType{ERotationType::RotationEnabled};
|
||||||
EScaleType mScaleType;
|
EScaleType mScaleType{EScaleType::ScaleEnabled};
|
||||||
float mPreviewScale;
|
float mPreviewScale = 1.0f;
|
||||||
|
|
||||||
// Preview Volume
|
// Preview Volume
|
||||||
EVolumeShape mVolumeShape;
|
EVolumeShape mVolumeShape{EVolumeShape::NoShape};
|
||||||
float mVolumeScale;
|
float mVolumeScale = 1.0f;
|
||||||
TIDString mVolumeConditionIDString;
|
TIDString mVolumeConditionIDString;
|
||||||
|
|
||||||
TString mSourceFile;
|
TString mSourceFile;
|
||||||
uint32 mObjectID;
|
uint32 mObjectID = 0;
|
||||||
|
|
||||||
// Editor Properties
|
// Editor Properties
|
||||||
TIDString mNameIDString;
|
TIDString mNameIDString;
|
||||||
|
@ -103,12 +103,12 @@ private:
|
||||||
CGameTemplate* mpGame;
|
CGameTemplate* mpGame;
|
||||||
std::list<CScriptObject*> mObjectList;
|
std::list<CScriptObject*> mObjectList;
|
||||||
|
|
||||||
CStringProperty* mpNameProperty;
|
CStringProperty* mpNameProperty = nullptr;
|
||||||
CVectorProperty* mpPositionProperty;
|
CVectorProperty* mpPositionProperty = nullptr;
|
||||||
CVectorProperty* mpRotationProperty;
|
CVectorProperty* mpRotationProperty = nullptr;
|
||||||
CVectorProperty* mpScaleProperty;
|
CVectorProperty* mpScaleProperty = nullptr;
|
||||||
CBoolProperty* mpActiveProperty;
|
CBoolProperty* mpActiveProperty = nullptr;
|
||||||
CStructProperty* mpLightParametersProperty;
|
CStructProperty* mpLightParametersProperty = nullptr;
|
||||||
|
|
||||||
struct SVolumeCondition {
|
struct SVolumeCondition {
|
||||||
uint32 Value;
|
uint32 Value;
|
||||||
|
@ -123,14 +123,14 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
std::vector<SVolumeCondition> mVolumeConditions;
|
std::vector<SVolumeCondition> mVolumeConditions;
|
||||||
bool mVisible;
|
bool mVisible = true;
|
||||||
bool mDirty;
|
bool mDirty = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Default constructor. Don't use. This is only here so the serializer doesn't complain
|
// Default constructor. Don't use. This is only here so the serializer doesn't complain
|
||||||
CScriptTemplate() { ASSERT(false); }
|
CScriptTemplate() { ASSERT(false); }
|
||||||
// Old constructor
|
// Old constructor
|
||||||
CScriptTemplate(CGameTemplate *pGame);
|
explicit CScriptTemplate(CGameTemplate *pGame);
|
||||||
// New constructor
|
// New constructor
|
||||||
CScriptTemplate(CGameTemplate* pGame, uint32 ObjectID, const TString& kFilePath);
|
CScriptTemplate(CGameTemplate* pGame, uint32 ObjectID, const TString& kFilePath);
|
||||||
~CScriptTemplate();
|
~CScriptTemplate();
|
||||||
|
@ -145,29 +145,29 @@ public:
|
||||||
CCollisionMeshGroup* FindCollision(void* pPropertyData);
|
CCollisionMeshGroup* FindCollision(void* pPropertyData);
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline CGameTemplate* GameTemplate() const { return mpGame; }
|
CGameTemplate* GameTemplate() const { return mpGame; }
|
||||||
inline TString Name() const { return mpProperties->Name(); }
|
TString Name() const { return mpProperties->Name(); }
|
||||||
inline ERotationType RotationType() const { return mRotationType; }
|
ERotationType RotationType() const { return mRotationType; }
|
||||||
inline EScaleType ScaleType() const { return mScaleType; }
|
EScaleType ScaleType() const { return mScaleType; }
|
||||||
inline float PreviewScale() const { return mPreviewScale; }
|
float PreviewScale() const { return mPreviewScale; }
|
||||||
inline uint32 ObjectID() const { return mObjectID; }
|
uint32 ObjectID() const { return mObjectID; }
|
||||||
inline bool IsVisible() const { return mVisible; }
|
bool IsVisible() const { return mVisible; }
|
||||||
inline TString SourceFile() const { return mSourceFile; }
|
TString SourceFile() const { return mSourceFile; }
|
||||||
inline CStructProperty* Properties() const { return mpProperties.get(); }
|
CStructProperty* Properties() const { return mpProperties.get(); }
|
||||||
inline uint32 NumAttachments() const { return mAttachments.size(); }
|
uint32 NumAttachments() const { return mAttachments.size(); }
|
||||||
const SAttachment& Attachment(uint32 Index) const { return mAttachments[Index]; }
|
const SAttachment& Attachment(uint32 Index) const { return mAttachments[Index]; }
|
||||||
const std::vector<TString>& RequiredModules() const { return mModules; }
|
const std::vector<TString>& RequiredModules() const { return mModules; }
|
||||||
|
|
||||||
inline CStringProperty* NameProperty() const { return mpNameProperty; }
|
CStringProperty* NameProperty() const { return mpNameProperty; }
|
||||||
inline CVectorProperty* PositionProperty() const { return mpPositionProperty; }
|
CVectorProperty* PositionProperty() const { return mpPositionProperty; }
|
||||||
inline CVectorProperty* RotationProperty() const { return mpRotationProperty; }
|
CVectorProperty* RotationProperty() const { return mpRotationProperty; }
|
||||||
inline CVectorProperty* ScaleProperty() const { return mpScaleProperty; }
|
CVectorProperty* ScaleProperty() const { return mpScaleProperty; }
|
||||||
inline CBoolProperty* ActiveProperty() const { return mpActiveProperty; }
|
CBoolProperty* ActiveProperty() const { return mpActiveProperty; }
|
||||||
inline CStructProperty* LightParametersProperty() const { return mpLightParametersProperty; }
|
CStructProperty* LightParametersProperty() const { return mpLightParametersProperty; }
|
||||||
|
|
||||||
inline void SetVisible(bool Visible) { mVisible = Visible; }
|
void SetVisible(bool Visible) { mVisible = Visible; }
|
||||||
inline void MarkDirty() { mDirty = true; }
|
void MarkDirty() { mDirty = true; }
|
||||||
inline bool IsDirty() const { return mDirty || mpProperties->IsDirty(); }
|
bool IsDirty() const { return mDirty || mpProperties->IsDirty(); }
|
||||||
|
|
||||||
// Object Tracking
|
// Object Tracking
|
||||||
uint32 NumObjects() const;
|
uint32 NumObjects() const;
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
const char* Name() const;
|
const char* Name() const;
|
||||||
const char* TypeName() const;
|
const char* TypeName() const;
|
||||||
|
|
||||||
operator bool() const;
|
explicit operator bool() const;
|
||||||
void operator ++();
|
void operator ++();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -14,16 +14,7 @@
|
||||||
|
|
||||||
/** IProperty */
|
/** IProperty */
|
||||||
IProperty::IProperty(EGame Game)
|
IProperty::IProperty(EGame Game)
|
||||||
: mpParent( nullptr )
|
: mGame(Game)
|
||||||
, mpPointerParent( nullptr )
|
|
||||||
, mpArchetype( nullptr )
|
|
||||||
, mGame( Game )
|
|
||||||
, mpScriptTemplate( nullptr )
|
|
||||||
, mOffset( -1 )
|
|
||||||
, mID( -1 )
|
|
||||||
, mCookPreference( ECookPreference::Default )
|
|
||||||
, mMinVersion( 0.0f )
|
|
||||||
, mMaxVersion( FLT_MAX )
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void IProperty::_ClearChildren()
|
void IProperty::_ClearChildren()
|
||||||
|
|
|
@ -13,33 +13,33 @@ class CGameTemplate;
|
||||||
class CScriptTemplate;
|
class CScriptTemplate;
|
||||||
class CStructProperty;
|
class CStructProperty;
|
||||||
|
|
||||||
/** Typedefs */
|
/** Aliases */
|
||||||
typedef TString TIDString;
|
using TIDString = TString;
|
||||||
|
|
||||||
/** Property flags */
|
/** Property flags */
|
||||||
enum class EPropertyFlag : uint32
|
enum class EPropertyFlag : uint32
|
||||||
{
|
{
|
||||||
/** Property has been fully initialized and has had PostLoad called */
|
/** Property has been fully initialized and has had PostLoad called */
|
||||||
IsInitialized = 0x1,
|
IsInitialized = 0x1,
|
||||||
/** Property is an archetype (a template for other properties to copy from) */
|
/** Property is an archetype (a template for other properties to copy from) */
|
||||||
IsArchetype = 0x2,
|
IsArchetype = 0x2,
|
||||||
/** Property is an array archetype (a template for elements of an array property) */
|
/** Property is an array archetype (a template for elements of an array property) */
|
||||||
IsArrayArchetype = 0x4,
|
IsArrayArchetype = 0x4,
|
||||||
/** This property and all its children are a single unit and do not have individual property IDs, sizes, etc. */
|
/** This property and all its children are a single unit and do not have individual property IDs, sizes, etc. */
|
||||||
IsAtomic = 0x8,
|
IsAtomic = 0x8,
|
||||||
/** This is a property of a C++ class, not a script object */
|
/** This is a property of a C++ class, not a script object */
|
||||||
IsIntrinsic = 0x10,
|
IsIntrinsic = 0x10,
|
||||||
/** Property has been modified, and needs to be resaved. Only valid on archetypes */
|
/** Property has been modified, and needs to be resaved. Only valid on archetypes */
|
||||||
IsDirty = 0x20,
|
IsDirty = 0x20,
|
||||||
/** We have cached whether the property name is correct */
|
/** We have cached whether the property name is correct */
|
||||||
HasCachedNameCheck = 0x40000000,
|
HasCachedNameCheck = 0x40000000,
|
||||||
/** The name of the property is a match for the property ID hash */
|
/** The name of the property is a match for the property ID hash */
|
||||||
HasCorrectPropertyName = 0x80000000,
|
HasCorrectPropertyName = 0x80000000,
|
||||||
|
|
||||||
/** Flags that are left intact when copying from an archetype */
|
/** Flags that are left intact when copying from an archetype */
|
||||||
ArchetypeCopyFlags = EPropertyFlag::IsAtomic,
|
ArchetypeCopyFlags = IsAtomic,
|
||||||
/** Flags that are inheritable from parent */
|
/** Flags that are inheritable from parent */
|
||||||
InheritableFlags = EPropertyFlag::IsArchetype | EPropertyFlag::IsArrayArchetype | EPropertyFlag::IsAtomic,
|
InheritableFlags = IsArchetype | IsArrayArchetype | IsAtomic,
|
||||||
};
|
};
|
||||||
DECLARE_FLAGS_ENUMCLASS(EPropertyFlag, FPropertyFlags)
|
DECLARE_FLAGS_ENUMCLASS(EPropertyFlag, FPropertyFlags)
|
||||||
|
|
||||||
|
@ -117,14 +117,14 @@ protected:
|
||||||
FPropertyFlags mFlags;
|
FPropertyFlags mFlags;
|
||||||
|
|
||||||
/** Parent property */
|
/** Parent property */
|
||||||
IProperty* mpParent;
|
IProperty* mpParent = nullptr;
|
||||||
|
|
||||||
/** Pointer parent; if non-null, this parent needs to be dereferenced to access the correct
|
/** Pointer parent; if non-null, this parent needs to be dereferenced to access the correct
|
||||||
* memory region that our property data is stored in */
|
* memory region that our property data is stored in */
|
||||||
IProperty* mpPointerParent;
|
IProperty* mpPointerParent = nullptr;
|
||||||
|
|
||||||
/** Archetype property; source property that we copied metadata from */
|
/** Archetype property; source property that we copied metadata from */
|
||||||
IProperty* mpArchetype;
|
IProperty* mpArchetype = nullptr;
|
||||||
|
|
||||||
/** Sub-instances of archetype properties. For non-archetypes, will be empty.
|
/** Sub-instances of archetype properties. For non-archetypes, will be empty.
|
||||||
* @todo this really oughta be a linked list */
|
* @todo this really oughta be a linked list */
|
||||||
|
@ -137,29 +137,29 @@ protected:
|
||||||
EGame mGame;
|
EGame mGame;
|
||||||
|
|
||||||
/** Script template that this property belongs to. Null for struct/enum/flag archetypes. */
|
/** Script template that this property belongs to. Null for struct/enum/flag archetypes. */
|
||||||
CScriptTemplate* mpScriptTemplate;
|
CScriptTemplate* mpScriptTemplate = nullptr;
|
||||||
|
|
||||||
/** Offset of this property within the property block */
|
/** Offset of this property within the property block */
|
||||||
uint32 mOffset;
|
uint32 mOffset = UINT32_MAX;
|
||||||
|
|
||||||
/** Property ID. This ID is used to uniquely identify this property within this struct. */
|
/** Property ID. This ID is used to uniquely identify this property within this struct. */
|
||||||
uint32 mID;
|
uint32 mID = UINT32_MAX;
|
||||||
|
|
||||||
/** Property metadata */
|
/** Property metadata */
|
||||||
TString mName;
|
TString mName;
|
||||||
TString mDescription;
|
TString mDescription;
|
||||||
TString mSuffix;
|
TString mSuffix;
|
||||||
ECookPreference mCookPreference;
|
ECookPreference mCookPreference{ECookPreference::Default};
|
||||||
|
|
||||||
/** Min/max allowed version number. These numbers correspond to the game's internal build number.
|
/** Min/max allowed version number. These numbers correspond to the game's internal build number.
|
||||||
* This is not used yet but in the future it can be used to configure certain properties to only
|
* This is not used yet but in the future it can be used to configure certain properties to only
|
||||||
* show up when certain versions of the game are being edited. The default values allow the
|
* show up when certain versions of the game are being edited. The default values allow the
|
||||||
* property to show up in all versions. */
|
* property to show up in all versions. */
|
||||||
float mMinVersion;
|
float mMinVersion = 0.0f;
|
||||||
float mMaxVersion;
|
float mMaxVersion = FLT_MAX;
|
||||||
|
|
||||||
/** Private constructor - use static methods to instantiate */
|
/** Private constructor - use static methods to instantiate */
|
||||||
IProperty(EGame Game);
|
explicit IProperty(EGame Game);
|
||||||
void _ClearChildren();
|
void _ClearChildren();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -207,29 +207,69 @@ public:
|
||||||
|
|
||||||
/** Accessors */
|
/** Accessors */
|
||||||
EGame Game() const;
|
EGame Game() const;
|
||||||
inline ECookPreference CookPreference() const;
|
ECookPreference CookPreference() const { return mCookPreference; }
|
||||||
inline uint32 NumChildren() const;
|
uint32 NumChildren() const { return mChildren.size(); }
|
||||||
inline IProperty* ChildByIndex(uint32 ChildIndex) const;
|
|
||||||
inline IProperty* Parent() const;
|
|
||||||
inline IProperty* RootParent();
|
|
||||||
inline IProperty* Archetype() const;
|
|
||||||
inline IProperty* RootArchetype();
|
|
||||||
inline CScriptTemplate* ScriptTemplate() const;
|
|
||||||
inline TString Name() const;
|
|
||||||
inline TString Description() const;
|
|
||||||
inline TString Suffix() const;
|
|
||||||
inline TIDString IDString(bool FullyQualified) const;
|
|
||||||
inline uint32 Offset() const;
|
|
||||||
inline uint32 ID() const;
|
|
||||||
|
|
||||||
inline bool IsInitialized() const { return mFlags.HasFlag(EPropertyFlag::IsInitialized); }
|
IProperty* ChildByIndex(uint32 ChildIndex) const
|
||||||
inline bool IsArchetype() const { return mFlags.HasFlag(EPropertyFlag::IsArchetype); }
|
{
|
||||||
inline bool IsArrayArchetype() const { return mFlags.HasFlag(EPropertyFlag::IsArrayArchetype); }
|
ASSERT(ChildIndex >= 0 && ChildIndex < mChildren.size());
|
||||||
inline bool IsAtomic() const { return mFlags.HasFlag(EPropertyFlag::IsAtomic); }
|
return mChildren[ChildIndex];
|
||||||
inline bool IsIntrinsic() const { return mFlags.HasFlag(EPropertyFlag::IsIntrinsic); }
|
}
|
||||||
inline bool IsDirty() const { return mFlags.HasFlag(EPropertyFlag::IsDirty); }
|
|
||||||
inline bool IsRootParent() const { return mpParent == nullptr; }
|
IProperty* Parent() const { return mpParent; }
|
||||||
inline bool IsRootArchetype() const { return mpArchetype == nullptr; }
|
IProperty* RootParent()
|
||||||
|
{
|
||||||
|
IProperty* pParent = Parent();
|
||||||
|
IProperty* pOut = this;
|
||||||
|
|
||||||
|
while (pParent)
|
||||||
|
{
|
||||||
|
pOut = pParent;
|
||||||
|
pParent = pParent->Parent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return pOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
IProperty* Archetype() const { return mpArchetype; }
|
||||||
|
IProperty* RootArchetype()
|
||||||
|
{
|
||||||
|
IProperty* pArchetype = Archetype();
|
||||||
|
IProperty* pOut = this;
|
||||||
|
|
||||||
|
while (pArchetype)
|
||||||
|
{
|
||||||
|
pOut = pArchetype;
|
||||||
|
pArchetype = pArchetype->Archetype();
|
||||||
|
}
|
||||||
|
|
||||||
|
return pOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
CScriptTemplate* ScriptTemplate() const { return mpScriptTemplate; }
|
||||||
|
TString Name() const { return mName; }
|
||||||
|
TString Description() const { return mDescription; }
|
||||||
|
TString Suffix() const { return mSuffix; }
|
||||||
|
|
||||||
|
TIDString IDString(bool FullyQualified) const
|
||||||
|
{
|
||||||
|
if (FullyQualified && mpParent != nullptr && mpParent->Parent() != nullptr)
|
||||||
|
return mpParent->IDString(FullyQualified) + ":" + TString::HexString(mID);
|
||||||
|
else
|
||||||
|
return TString::HexString(mID);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 Offset() const { return mOffset; }
|
||||||
|
uint32 ID() const { return mID; }
|
||||||
|
|
||||||
|
bool IsInitialized() const { return mFlags.HasFlag(EPropertyFlag::IsInitialized); }
|
||||||
|
bool IsArchetype() const { return mFlags.HasFlag(EPropertyFlag::IsArchetype); }
|
||||||
|
bool IsArrayArchetype() const { return mFlags.HasFlag(EPropertyFlag::IsArrayArchetype); }
|
||||||
|
bool IsAtomic() const { return mFlags.HasFlag(EPropertyFlag::IsAtomic); }
|
||||||
|
bool IsIntrinsic() const { return mFlags.HasFlag(EPropertyFlag::IsIntrinsic); }
|
||||||
|
bool IsDirty() const { return mFlags.HasFlag(EPropertyFlag::IsDirty); }
|
||||||
|
bool IsRootParent() const { return mpParent == nullptr; }
|
||||||
|
bool IsRootArchetype() const { return mpArchetype == nullptr; }
|
||||||
|
|
||||||
/** Create */
|
/** Create */
|
||||||
static IProperty* Create(EPropertyType Type,
|
static IProperty* Create(EPropertyType Type,
|
||||||
|
@ -251,130 +291,42 @@ public:
|
||||||
const IArchive& Arc);
|
const IArchive& Arc);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline ECookPreference IProperty::CookPreference() const
|
|
||||||
{
|
|
||||||
return mCookPreference;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline uint32 IProperty::NumChildren() const
|
|
||||||
{
|
|
||||||
return mChildren.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline IProperty* IProperty::ChildByIndex(uint32 ChildIndex) const
|
|
||||||
{
|
|
||||||
ASSERT(ChildIndex >= 0 && ChildIndex < mChildren.size());
|
|
||||||
return mChildren[ChildIndex];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline IProperty* IProperty::Parent() const
|
|
||||||
{
|
|
||||||
return mpParent;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline IProperty* IProperty::RootParent()
|
|
||||||
{
|
|
||||||
IProperty* pParent = Parent();
|
|
||||||
IProperty* pOut = this;
|
|
||||||
|
|
||||||
while (pParent)
|
|
||||||
{
|
|
||||||
pOut = pParent;
|
|
||||||
pParent = pParent->Parent();
|
|
||||||
}
|
|
||||||
|
|
||||||
return pOut;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline IProperty* IProperty::Archetype() const
|
|
||||||
{
|
|
||||||
return mpArchetype;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline IProperty* IProperty::RootArchetype()
|
|
||||||
{
|
|
||||||
IProperty* pArchetype = Archetype();
|
|
||||||
IProperty* pOut = this;
|
|
||||||
|
|
||||||
while (pArchetype)
|
|
||||||
{
|
|
||||||
pOut = pArchetype;
|
|
||||||
pArchetype = pArchetype->Archetype();
|
|
||||||
}
|
|
||||||
|
|
||||||
return pOut;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline CScriptTemplate* IProperty::ScriptTemplate() const
|
|
||||||
{
|
|
||||||
return mpScriptTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline TString IProperty::Name() const
|
|
||||||
{
|
|
||||||
return mName;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline TString IProperty::Description() const
|
|
||||||
{
|
|
||||||
return mDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline TString IProperty::Suffix() const
|
|
||||||
{
|
|
||||||
return mSuffix;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline TString IProperty::IDString(bool FullyQualified) const
|
|
||||||
{
|
|
||||||
if (FullyQualified && mpParent != nullptr && mpParent->Parent() != nullptr)
|
|
||||||
return mpParent->IDString(FullyQualified) + ":" + TString::HexString(mID);
|
|
||||||
else
|
|
||||||
return TString::HexString(mID);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline uint32 IProperty::Offset() const
|
|
||||||
{
|
|
||||||
return mOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline uint32 IProperty::ID() const
|
|
||||||
{
|
|
||||||
return mID;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename PropType, EPropertyType PropEnum>
|
template<typename PropType, EPropertyType PropEnum>
|
||||||
class TTypedProperty : public IProperty
|
class TTypedProperty : public IProperty
|
||||||
{
|
{
|
||||||
friend class IProperty;
|
friend class IProperty;
|
||||||
friend class CTemplateLoader;
|
friend class CTemplateLoader;
|
||||||
public:
|
public:
|
||||||
typedef PropType ValueType;
|
using ValueType = PropType;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PropType mDefaultValue = {};
|
PropType mDefaultValue = {};
|
||||||
|
|
||||||
TTypedProperty(EGame Game) : IProperty(Game) {}
|
explicit TTypedProperty(EGame Game) : IProperty(Game) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual EPropertyType Type() const { return PropEnum; }
|
EPropertyType Type() const override { return PropEnum; }
|
||||||
virtual uint32 DataSize() const { return sizeof(PropType); }
|
uint32 DataSize() const override { return sizeof(PropType); }
|
||||||
virtual uint32 DataAlignment() const { return alignof(PropType); }
|
uint32 DataAlignment() const override { return alignof(PropType); }
|
||||||
virtual void Construct(void* pData) const { new(ValuePtr(pData)) PropType(mDefaultValue); }
|
void Construct(void* pData) const override { new (ValuePtr(pData)) PropType(mDefaultValue); }
|
||||||
virtual void Destruct(void* pData) const { ValueRef(pData).~PropType(); }
|
void Destruct(void* pData) const override { ValueRef(pData).~PropType(); }
|
||||||
virtual bool MatchesDefault(void* pData) const { return ValueRef(pData) == mDefaultValue; }
|
bool MatchesDefault(void* pData) const override { return ValueRef(pData) == mDefaultValue; }
|
||||||
virtual void RevertToDefault(void* pData) const { ValueRef(pData) = mDefaultValue; }
|
void RevertToDefault(void* pData) const override { ValueRef(pData) = mDefaultValue; }
|
||||||
virtual void SetDefaultFromData(void* pData) { mDefaultValue = ValueRef(pData); MarkDirty(); }
|
void SetDefaultFromData(void* pData) override
|
||||||
|
{
|
||||||
|
mDefaultValue = ValueRef(pData);
|
||||||
|
MarkDirty();
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool CanHaveDefault() const { return true; }
|
virtual bool CanHaveDefault() const { return true; }
|
||||||
|
|
||||||
virtual void InitFromArchetype(IProperty* pOther)
|
void InitFromArchetype(IProperty* pOther) override
|
||||||
{
|
{
|
||||||
IProperty::InitFromArchetype(pOther);
|
IProperty::InitFromArchetype(pOther);
|
||||||
mDefaultValue = static_cast<TTypedProperty*>(pOther)->mDefaultValue;
|
mDefaultValue = static_cast<TTypedProperty*>(pOther)->mDefaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void CopyDefaultValueTo(IProperty* pOtherProperty)
|
void CopyDefaultValueTo(IProperty* pOtherProperty) override
|
||||||
{
|
{
|
||||||
// WARNING: We don't do any type checking here because this function is used for type conversion,
|
// WARNING: We don't do any type checking here because this function is used for type conversion,
|
||||||
// which necessitates that the property class is allowed to be different. The underlying type is
|
// which necessitates that the property class is allowed to be different. The underlying type is
|
||||||
|
@ -384,32 +336,32 @@ public:
|
||||||
pTypedOther->mDefaultValue = mDefaultValue;
|
pTypedOther->mDefaultValue = mDefaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline PropType* ValuePtr(void* pData) const
|
PropType* ValuePtr(void* pData) const
|
||||||
{
|
{
|
||||||
return (PropType*) RawValuePtr(pData);
|
return (PropType*) RawValuePtr(pData);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline PropType& ValueRef(void* pData) const
|
PropType& ValueRef(void* pData) const
|
||||||
{
|
{
|
||||||
return *ValuePtr(pData);
|
return *ValuePtr(pData);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline PropType Value(void* pData) const
|
PropType Value(void* pData) const
|
||||||
{
|
{
|
||||||
return *ValuePtr(pData);
|
return *ValuePtr(pData);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const PropType& DefaultValue() const
|
const PropType& DefaultValue() const
|
||||||
{
|
{
|
||||||
return mDefaultValue;
|
return mDefaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetDefaultValue(const PropType& kInDefaultValue)
|
void SetDefaultValue(const PropType& kInDefaultValue)
|
||||||
{
|
{
|
||||||
mDefaultValue = kInDefaultValue;
|
mDefaultValue = kInDefaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static EPropertyType StaticType() { return PropEnum; }
|
static EPropertyType StaticType() { return PropEnum; }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename PropType, EPropertyType PropEnum>
|
template<typename PropType, EPropertyType PropEnum>
|
||||||
|
@ -417,12 +369,12 @@ class TSerializeableTypedProperty : public TTypedProperty<PropType, PropEnum>
|
||||||
{
|
{
|
||||||
using base = TTypedProperty<PropType, PropEnum>;
|
using base = TTypedProperty<PropType, PropEnum>;
|
||||||
protected:
|
protected:
|
||||||
TSerializeableTypedProperty(EGame Game)
|
explicit TSerializeableTypedProperty(EGame Game)
|
||||||
: base(Game)
|
: base(Game)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void Serialize(IArchive& rArc)
|
void Serialize(IArchive& rArc) override
|
||||||
{
|
{
|
||||||
base::Serialize(rArc);
|
base::Serialize(rArc);
|
||||||
TSerializeableTypedProperty* pArchetype = static_cast<TSerializeableTypedProperty*>(base::mpArchetype);
|
TSerializeableTypedProperty* pArchetype = static_cast<TSerializeableTypedProperty*>(base::mpArchetype);
|
||||||
|
@ -462,7 +414,7 @@ public:
|
||||||
rArc << SerialParameter("DefaultValue", base::mDefaultValue);
|
rArc << SerialParameter("DefaultValue", base::mDefaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool ShouldSerialize() const
|
bool ShouldSerialize() const override
|
||||||
{
|
{
|
||||||
base* pArchetype = static_cast<base*>(base::mpArchetype);
|
base* pArchetype = static_cast<base*>(base::mpArchetype);
|
||||||
|
|
||||||
|
@ -485,17 +437,15 @@ class TNumericalProperty : public TSerializeableTypedProperty<PropType, PropEnum
|
||||||
friend class CTemplateLoader;
|
friend class CTemplateLoader;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PropType mMinValue;
|
PropType mMinValue = -1;
|
||||||
PropType mMaxValue;
|
PropType mMaxValue = -1;
|
||||||
|
|
||||||
TNumericalProperty(EGame Game)
|
explicit TNumericalProperty(EGame Game)
|
||||||
: base(Game)
|
: base(Game)
|
||||||
, mMinValue( -1 )
|
|
||||||
, mMaxValue( -1 )
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void Serialize(IArchive& rArc)
|
void Serialize(IArchive& rArc) override
|
||||||
{
|
{
|
||||||
base::Serialize(rArc);
|
base::Serialize(rArc);
|
||||||
TNumericalProperty* pArchetype = static_cast<TNumericalProperty*>(base::mpArchetype);
|
TNumericalProperty* pArchetype = static_cast<TNumericalProperty*>(base::mpArchetype);
|
||||||
|
@ -504,7 +454,7 @@ public:
|
||||||
<< SerialParameter("Max", mMaxValue, SH_Optional, pArchetype ? pArchetype->mMaxValue : (PropType) -1);
|
<< SerialParameter("Max", mMaxValue, SH_Optional, pArchetype ? pArchetype->mMaxValue : (PropType) -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool ShouldSerialize() const
|
bool ShouldSerialize() const override
|
||||||
{
|
{
|
||||||
TNumericalProperty* pArchetype = static_cast<TNumericalProperty*>(base::mpArchetype);
|
TNumericalProperty* pArchetype = static_cast<TNumericalProperty*>(base::mpArchetype);
|
||||||
return base::ShouldSerialize() ||
|
return base::ShouldSerialize() ||
|
||||||
|
@ -512,7 +462,7 @@ public:
|
||||||
mMaxValue != pArchetype->mMaxValue;
|
mMaxValue != pArchetype->mMaxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void InitFromArchetype(IProperty* pOther)
|
void InitFromArchetype(IProperty* pOther) override
|
||||||
{
|
{
|
||||||
base::InitFromArchetype(pOther);
|
base::InitFromArchetype(pOther);
|
||||||
TNumericalProperty* pCastOther = static_cast<TNumericalProperty*>(pOther);
|
TNumericalProperty* pCastOther = static_cast<TNumericalProperty*>(pOther);
|
||||||
|
@ -520,7 +470,7 @@ public:
|
||||||
mMaxValue = pCastOther->mMaxValue;
|
mMaxValue = pCastOther->mMaxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void PropertyValueChanged(void* pPropertyData)
|
void PropertyValueChanged(void* pPropertyData) override
|
||||||
{
|
{
|
||||||
base::PropertyValueChanged(pPropertyData);
|
base::PropertyValueChanged(pPropertyData);
|
||||||
|
|
||||||
|
@ -534,7 +484,7 @@ public:
|
||||||
|
|
||||||
/** Property casting with dynamic type checking */
|
/** Property casting with dynamic type checking */
|
||||||
template<class PropertyClass>
|
template<class PropertyClass>
|
||||||
inline PropertyClass* TPropCast(IProperty* pProperty)
|
PropertyClass* TPropCast(IProperty* pProperty)
|
||||||
{
|
{
|
||||||
if (pProperty && pProperty->Type() == PropertyClass::StaticType())
|
if (pProperty && pProperty->Type() == PropertyClass::StaticType())
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,15 +27,13 @@ template<class PropertyClass, typename ValueType = typename PropertyClass::Value
|
||||||
class TPropertyRef
|
class TPropertyRef
|
||||||
{
|
{
|
||||||
/** Property data being referenced */
|
/** Property data being referenced */
|
||||||
void* mpPropertyData;
|
void* mpPropertyData = nullptr;
|
||||||
|
|
||||||
/** Property being referenced */
|
/** Property being referenced */
|
||||||
PropertyClass* mpProperty;
|
PropertyClass* mpProperty = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TPropertyRef()
|
TPropertyRef() = default;
|
||||||
: mpPropertyData(nullptr), mpProperty(nullptr)
|
|
||||||
{}
|
|
||||||
|
|
||||||
explicit TPropertyRef(void* pInData, IProperty* pInProperty)
|
explicit TPropertyRef(void* pInData, IProperty* pInProperty)
|
||||||
: mpPropertyData(pInData), mpProperty( TPropCast<PropertyClass>(pInProperty) )
|
: mpPropertyData(pInData), mpProperty( TPropCast<PropertyClass>(pInProperty) )
|
||||||
|
@ -48,19 +46,19 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Accessors */
|
/** Accessors */
|
||||||
inline void* DataPointer() const { return mpPropertyData; }
|
void* DataPointer() const { return mpPropertyData; }
|
||||||
inline PropertyClass* Property() const { return mpProperty; }
|
PropertyClass* Property() const { return mpProperty; }
|
||||||
inline ValueType Get() const { return IsValid() ? *((ValueType*) mpProperty->RawValuePtr( mpPropertyData )) : ValueType(); }
|
ValueType Get() const { return IsValid() ? *((ValueType*) mpProperty->RawValuePtr( mpPropertyData )) : ValueType(); }
|
||||||
inline void Set(const ValueType& kIn) const { if (IsValid()) *((ValueType*) mpProperty->RawValuePtr( mpPropertyData )) = kIn; }
|
void Set(const ValueType& kIn) const { if (IsValid()) *((ValueType*) mpProperty->RawValuePtr( mpPropertyData )) = kIn; }
|
||||||
inline bool IsValid() const { return mpPropertyData != nullptr && mpProperty != nullptr; }
|
bool IsValid() const { return mpPropertyData != nullptr && mpProperty != nullptr; }
|
||||||
|
|
||||||
/** Inline operators */
|
/** Inline operators */
|
||||||
inline operator ValueType() const
|
operator ValueType() const
|
||||||
{
|
{
|
||||||
return Get();
|
return Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator==(IProperty* pProperty) const
|
bool operator==(IProperty* pProperty) const
|
||||||
{
|
{
|
||||||
return mpProperty == pProperty;
|
return mpProperty == pProperty;
|
||||||
}
|
}
|
||||||
|
@ -72,25 +70,25 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Convenience typedefs */
|
/** Convenience typedefs */
|
||||||
typedef TPropertyRef<CBoolProperty> CBoolRef;
|
using CAnimationRef = TPropertyRef<CAnimationProperty>;
|
||||||
typedef TPropertyRef<CByteProperty> CByteRef;
|
using CAnimationSetRef = TPropertyRef<CAnimationSetProperty>;
|
||||||
typedef TPropertyRef<CShortProperty> CShortRef;
|
using CArrayRef = TPropertyRef<CArrayProperty>;
|
||||||
typedef TPropertyRef<CIntProperty> CIntRef;
|
using CAssetRef = TPropertyRef<CAssetProperty>;
|
||||||
typedef TPropertyRef<CFloatProperty> CFloatRef;
|
using CBoolRef = TPropertyRef<CBoolProperty>;
|
||||||
typedef TPropertyRef<CFlagsProperty> CFlagsRef;
|
using CByteRef = TPropertyRef<CByteProperty>;
|
||||||
typedef TPropertyRef<CStringProperty> CStringRef;
|
using CColorRef = TPropertyRef<CColorProperty>;
|
||||||
typedef TPropertyRef<CVectorProperty> CVectorRef;
|
using CFlagsRef = TPropertyRef<CFlagsProperty>;
|
||||||
typedef TPropertyRef<CColorProperty> CColorRef;
|
using CFloatRef = TPropertyRef<CFloatProperty>;
|
||||||
typedef TPropertyRef<CAssetProperty> CAssetRef;
|
using CGuidRef = TPropertyRef<CGuidProperty>;
|
||||||
typedef TPropertyRef<CSoundProperty> CSoundRef;
|
using CIntRef = TPropertyRef<CIntProperty>;
|
||||||
typedef TPropertyRef<CAnimationProperty> CAnimationRef;
|
using CPointerRef = TPropertyRef<CPointerProperty>;
|
||||||
typedef TPropertyRef<CAnimationSetProperty> CAnimationSetRef;
|
using CSequenceRef = TPropertyRef<CSequenceProperty>;
|
||||||
typedef TPropertyRef<CSequenceProperty> CSequenceRef;
|
using CShortRef = TPropertyRef<CShortProperty>;
|
||||||
typedef TPropertyRef<CSplineProperty> CSplineRef;
|
using CSoundRef = TPropertyRef<CSoundProperty>;
|
||||||
typedef TPropertyRef<CGuidProperty> CGuidRef;
|
using CSplineRef = TPropertyRef<CSplineProperty>;
|
||||||
typedef TPropertyRef<CPointerProperty> CPointerRef;
|
using CStringRef = TPropertyRef<CStringProperty>;
|
||||||
typedef TPropertyRef<CStructProperty> CStructRef;
|
using CStructRef = TPropertyRef<CStructProperty>;
|
||||||
typedef TPropertyRef<CArrayProperty> CArrayRef;
|
using CVectorRef = TPropertyRef<CVectorProperty>;
|
||||||
|
|
||||||
/** Special version for enums */
|
/** Special version for enums */
|
||||||
template<typename ValueType>
|
template<typename ValueType>
|
||||||
|
|
|
@ -24,11 +24,9 @@ class CStringTable : public CResource
|
||||||
struct SStringData
|
struct SStringData
|
||||||
{
|
{
|
||||||
TString String;
|
TString String;
|
||||||
bool IsLocalized;
|
bool IsLocalized = false;
|
||||||
|
|
||||||
SStringData()
|
SStringData() = default;
|
||||||
: IsLocalized(false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void Serialize(IArchive& Arc)
|
void Serialize(IArchive& Arc)
|
||||||
{
|
{
|
||||||
|
@ -52,19 +50,19 @@ class CStringTable : public CResource
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
CStringTable(CResourceEntry *pEntry = 0) : CResource(pEntry) {}
|
explicit CStringTable(CResourceEntry *pEntry = nullptr) : CResource(pEntry) {}
|
||||||
|
|
||||||
/** Returns the number of languages in the table */
|
/** Returns the number of languages in the table */
|
||||||
inline uint NumLanguages() const { return mLanguages.size(); }
|
uint NumLanguages() const { return mLanguages.size(); }
|
||||||
|
|
||||||
/** Returns the number of strings in the table */
|
/** Returns the number of strings in the table */
|
||||||
inline uint NumStrings() const { return mLanguages.empty() ? 0 : mLanguages[0].Strings.size(); }
|
uint NumStrings() const { return mLanguages.empty() ? 0 : mLanguages[0].Strings.size(); }
|
||||||
|
|
||||||
/** Returns languages used by index */
|
/** Returns languages used by index */
|
||||||
inline ELanguage LanguageByIndex(uint Index) const { return mLanguages.size() > Index ? mLanguages[Index].Language : ELanguage::Invalid; }
|
ELanguage LanguageByIndex(uint Index) const { return mLanguages.size() > Index ? mLanguages[Index].Language : ELanguage::Invalid; }
|
||||||
|
|
||||||
/** Returns the string name by string index. May be blank if the string at the requested index is unnamed */
|
/** Returns the string name by string index. May be blank if the string at the requested index is unnamed */
|
||||||
inline TString StringNameByIndex(uint Index) const { return mStringNames.size() > Index ? mStringNames[Index] : ""; }
|
TString StringNameByIndex(uint Index) const { return mStringNames.size() > Index ? mStringNames[Index] : ""; }
|
||||||
|
|
||||||
/** Returns a string given a language/index pair */
|
/** Returns a string given a language/index pair */
|
||||||
TString GetString(ELanguage Language, uint StringIndex) const;
|
TString GetString(ELanguage Language, uint StringIndex) const;
|
||||||
|
@ -85,13 +83,13 @@ public:
|
||||||
void RemoveString(uint StringIndex);
|
void RemoveString(uint StringIndex);
|
||||||
|
|
||||||
/** Initialize new resource data */
|
/** Initialize new resource data */
|
||||||
virtual void InitializeNewResource() override;
|
void InitializeNewResource() override;
|
||||||
|
|
||||||
/** Serialize resource data */
|
/** Serialize resource data */
|
||||||
virtual void Serialize(IArchive& Arc) override;
|
void Serialize(IArchive& Arc) override;
|
||||||
|
|
||||||
/** Build the dependency tree for this resource */
|
/** Build the dependency tree for this resource */
|
||||||
virtual CDependencyTree* BuildDependencyTree() const override;
|
CDependencyTree* BuildDependencyTree() const override;
|
||||||
|
|
||||||
/** Static - Strip all formatting tags for a given string */
|
/** Static - Strip all formatting tags for a given string */
|
||||||
static TString StripFormatting(const TString& kInString);
|
static TString StripFormatting(const TString& kInString);
|
||||||
|
|
|
@ -8,15 +8,13 @@ class CSceneNode;
|
||||||
|
|
||||||
struct SRayIntersection
|
struct SRayIntersection
|
||||||
{
|
{
|
||||||
bool Hit;
|
bool Hit = false;
|
||||||
float Distance;
|
float Distance = 0.0f;
|
||||||
CVector3f HitPoint;
|
CVector3f HitPoint{CVector3f::skZero};
|
||||||
CSceneNode *pNode;
|
CSceneNode *pNode = nullptr;
|
||||||
uint ComponentIndex;
|
uint ComponentIndex = UINT32_MAX;
|
||||||
|
|
||||||
SRayIntersection()
|
|
||||||
: Hit(false), Distance(0.f), HitPoint(CVector3f::skZero), pNode(nullptr), ComponentIndex(-1) {}
|
|
||||||
|
|
||||||
|
SRayIntersection() = default;
|
||||||
SRayIntersection(bool _Hit, float _Distance, CVector3f _HitPoint, CSceneNode *_pNode, uint _ComponentIndex)
|
SRayIntersection(bool _Hit, float _Distance, CVector3f _HitPoint, CSceneNode *_pNode, uint _ComponentIndex)
|
||||||
: Hit(_Hit), Distance(_Distance), HitPoint(_HitPoint), pNode(_pNode), ComponentIndex(_ComponentIndex) {}
|
: Hit(_Hit), Distance(_Distance), HitPoint(_HitPoint), pNode(_pNode), ComponentIndex(_ComponentIndex) {}
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,12 +9,12 @@ class CCollisionNode : public CSceneNode
|
||||||
TResPtr<CCollisionMeshGroup> mpCollision;
|
TResPtr<CCollisionMeshGroup> mpCollision;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CCollisionNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0, CCollisionMeshGroup *pCollision = 0);
|
CCollisionNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = nullptr, CCollisionMeshGroup *pCollision = nullptr);
|
||||||
ENodeType NodeType();
|
ENodeType NodeType() override;
|
||||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo) override;
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override;
|
||||||
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override;
|
||||||
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo);
|
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo) override;
|
||||||
void SetCollision(CCollisionMeshGroup *pCollision);
|
void SetCollision(CCollisionMeshGroup *pCollision);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,21 +8,21 @@ class CLightNode : public CSceneNode
|
||||||
{
|
{
|
||||||
CLight *mpLight;
|
CLight *mpLight;
|
||||||
public:
|
public:
|
||||||
CLightNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0, CLight *Light = 0);
|
CLightNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = nullptr, CLight *Light = nullptr);
|
||||||
ENodeType NodeType();
|
ENodeType NodeType() override;
|
||||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo);
|
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& ViewInfo) override;
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& ViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& ViewInfo) override;
|
||||||
void DrawSelection();
|
void DrawSelection() override;
|
||||||
void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& ViewInfo);
|
void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& ViewInfo) override;
|
||||||
SRayIntersection RayNodeIntersectTest(const CRay &Ray, uint32 AssetID, const SViewInfo& ViewInfo);
|
SRayIntersection RayNodeIntersectTest(const CRay& Ray, uint32 AssetID, const SViewInfo& ViewInfo) override;
|
||||||
CStructRef GetProperties() const;
|
CStructRef GetProperties() const override;
|
||||||
void PropertyModified(IProperty* pProperty);
|
void PropertyModified(IProperty* pProperty) override;
|
||||||
bool AllowsRotate() const { return false; }
|
bool AllowsRotate() const override { return false; }
|
||||||
CLight* Light();
|
CLight* Light();
|
||||||
CVector2f BillboardScale();
|
CVector2f BillboardScale();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void CalculateTransform(CTransform4f& rOut) const;
|
void CalculateTransform(CTransform4f& rOut) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLIGHTNODE_H
|
#endif // CLIGHTNODE_H
|
||||||
|
|
|
@ -17,29 +17,29 @@ class CModelNode : public CSceneNode
|
||||||
public:
|
public:
|
||||||
explicit CModelNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0, CModel *pModel = 0);
|
explicit CModelNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0, CModel *pModel = 0);
|
||||||
|
|
||||||
virtual ENodeType NodeType();
|
ENodeType NodeType() override;
|
||||||
virtual void PostLoad();
|
void PostLoad() override;
|
||||||
virtual void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override;
|
||||||
virtual void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override;
|
||||||
virtual void DrawSelection();
|
void DrawSelection() override;
|
||||||
virtual void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& rkViewInfo);
|
void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& rkViewInfo) override;
|
||||||
virtual SRayIntersection RayNodeIntersectTest(const CRay &Ray, uint32 AssetID, const SViewInfo& rkViewInfo);
|
SRayIntersection RayNodeIntersectTest(const CRay& Ray, uint32 AssetID, const SViewInfo& rkViewInfo) override;
|
||||||
virtual CColor TintColor(const SViewInfo& rkViewInfo) const;
|
CColor TintColor(const SViewInfo& rkViewInfo) const override;
|
||||||
|
|
||||||
// Setters
|
// Setters
|
||||||
void SetModel(CModel *pModel);
|
void SetModel(CModel *pModel);
|
||||||
|
|
||||||
inline void SetMatSet(uint32 MatSet) { mActiveMatSet = MatSet; }
|
void SetMatSet(uint32 MatSet) { mActiveMatSet = MatSet; }
|
||||||
inline void SetWorldModel(bool World) { mWorldModel = World; }
|
void SetWorldModel(bool World) { mWorldModel = World; }
|
||||||
inline void ForceAlphaEnabled(bool Enable) { mForceAlphaOn = Enable; }
|
void ForceAlphaEnabled(bool Enable) { mForceAlphaOn = Enable; }
|
||||||
inline void SetTintColor(const CColor& rkTintColor) { mTintColor = rkTintColor; }
|
void SetTintColor(const CColor& rkTintColor) { mTintColor = rkTintColor; }
|
||||||
inline void ClearTintColor() { mTintColor = CColor::skWhite; }
|
void ClearTintColor() { mTintColor = CColor::skWhite; }
|
||||||
inline void SetScanOverlayEnabled(bool Enable) { mEnableScanOverlay = Enable; }
|
void SetScanOverlayEnabled(bool Enable) { mEnableScanOverlay = Enable; }
|
||||||
inline void SetScanOverlayColor(const CColor& rkColor) { mScanOverlayColor = rkColor; }
|
void SetScanOverlayColor(const CColor& rkColor) { mScanOverlayColor = rkColor; }
|
||||||
inline CModel* Model() const { return mpModel; }
|
CModel* Model() const { return mpModel; }
|
||||||
inline uint32 MatSet() const { return mActiveMatSet; }
|
uint32 MatSet() const { return mActiveMatSet; }
|
||||||
inline bool IsWorldModel() const { return mWorldModel; }
|
bool IsWorldModel() const { return mWorldModel; }
|
||||||
inline uint32 FindMeshID() const { return mpModel->GetSurface(0)->MeshID; }
|
uint32 FindMeshID() const { return mpModel->GetSurface(0)->MeshID; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CMODELNODE_H
|
#endif // CMODELNODE_H
|
||||||
|
|
|
@ -2,29 +2,28 @@
|
||||||
#define CROOTNODE_H
|
#define CROOTNODE_H
|
||||||
|
|
||||||
#include "CSceneNode.h"
|
#include "CSceneNode.h"
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
// CRootNode's main purpose is to manage groups of other nodes as its children.
|
// CRootNode's main purpose is to manage groups of other nodes as its children.
|
||||||
class CRootNode : public CSceneNode
|
class CRootNode : public CSceneNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CRootNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0)
|
explicit CRootNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = nullptr)
|
||||||
: CSceneNode(pScene, NodeID, pParent) {}
|
: CSceneNode(pScene, NodeID, pParent) {}
|
||||||
~CRootNode() {}
|
~CRootNode() = default;
|
||||||
|
|
||||||
ENodeType NodeType()
|
ENodeType NodeType() override
|
||||||
{
|
{
|
||||||
return ENodeType::Root;
|
return ENodeType::Root;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void RayAABoxIntersectTest(CRayCollisionTester&, const SViewInfo&) {}
|
void RayAABoxIntersectTest(CRayCollisionTester&, const SViewInfo&) override {}
|
||||||
|
|
||||||
inline SRayIntersection RayNodeIntersectTest(const CRay &, uint32, const SViewInfo&)
|
SRayIntersection RayNodeIntersectTest(const CRay &, uint32, const SViewInfo&) override
|
||||||
{
|
{
|
||||||
return SRayIntersection();
|
return SRayIntersection();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void DrawSelection() {}
|
void DrawSelection() override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CROOTNODE_H
|
#endif // CROOTNODE_H
|
||||||
|
|
|
@ -20,44 +20,44 @@ class CSceneIterator
|
||||||
public:
|
public:
|
||||||
CSceneIterator(CScene *pScene, FNodeFlags AllowedNodeTypes = ENodeType::All, bool AllowHiddenNodes = false);
|
CSceneIterator(CScene *pScene, FNodeFlags AllowedNodeTypes = ENodeType::All, bool AllowHiddenNodes = false);
|
||||||
|
|
||||||
inline CSceneNode* Next()
|
CSceneNode* Next()
|
||||||
{
|
{
|
||||||
InternalFindNext();
|
InternalFindNext();
|
||||||
return mpCurNode;
|
return mpCurNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool DoneIterating() const
|
bool DoneIterating() const
|
||||||
{
|
{
|
||||||
return (mpCurNode == nullptr);
|
return (mpCurNode == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline CSceneNode* GetNode() const
|
CSceneNode* GetNode() const
|
||||||
{
|
{
|
||||||
return mpCurNode;
|
return mpCurNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline operator bool() const
|
explicit operator bool() const
|
||||||
{
|
{
|
||||||
return !DoneIterating();
|
return !DoneIterating();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline CSceneNode* operator*() const
|
CSceneNode* operator*() const
|
||||||
{
|
{
|
||||||
return mpCurNode;
|
return mpCurNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline CSceneNode* operator->() const
|
CSceneNode* operator->() const
|
||||||
{
|
{
|
||||||
return mpCurNode;
|
return mpCurNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline CSceneIterator& operator++()
|
CSceneIterator& operator++()
|
||||||
{
|
{
|
||||||
Next();
|
Next();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline CSceneIterator operator++(int)
|
CSceneIterator operator++(int)
|
||||||
{
|
{
|
||||||
CSceneIterator Copy = *this;
|
CSceneIterator Copy = *this;
|
||||||
Next();
|
Next();
|
||||||
|
|
|
@ -26,15 +26,15 @@ public:
|
||||||
void ParentDisplayAssetChanged(CResource *pNewDisplayAsset);
|
void ParentDisplayAssetChanged(CResource *pNewDisplayAsset);
|
||||||
CModel* Model() const;
|
CModel* Model() const;
|
||||||
|
|
||||||
ENodeType NodeType() { return ENodeType::ScriptAttach; }
|
ENodeType NodeType() override { return ENodeType::ScriptAttach; }
|
||||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override;
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override;
|
||||||
void DrawSelection();
|
void DrawSelection() override;
|
||||||
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override;
|
||||||
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo);
|
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo) override;
|
||||||
|
|
||||||
inline IProperty* AttachProperty() const { return mpAttachAssetProp; }
|
IProperty* AttachProperty() const { return mpAttachAssetProp; }
|
||||||
inline TString LocatorName() const { return mLocatorName; }
|
TString LocatorName() const { return mLocatorName; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void CalculateTransform(CTransform4f& rOut) const;
|
void CalculateTransform(CTransform4f& rOut) const;
|
||||||
|
|
|
@ -13,11 +13,7 @@
|
||||||
|
|
||||||
CScriptNode::CScriptNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent, CScriptObject *pInstance)
|
CScriptNode::CScriptNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent, CScriptObject *pInstance)
|
||||||
: CSceneNode(pScene, NodeID, pParent)
|
: CSceneNode(pScene, NodeID, pParent)
|
||||||
, mGameModeVisibility(EGameModeVisibility::Untested)
|
|
||||||
, mpVolumePreviewNode(nullptr)
|
|
||||||
, mHasVolumePreview(false)
|
|
||||||
, mpInstance(pInstance)
|
, mpInstance(pInstance)
|
||||||
, mpExtra(nullptr)
|
|
||||||
{
|
{
|
||||||
ASSERT(pInstance);
|
ASSERT(pInstance);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class CScriptExtra;
|
||||||
class CScriptNode : public CSceneNode
|
class CScriptNode : public CSceneNode
|
||||||
{
|
{
|
||||||
CScriptObject *mpInstance;
|
CScriptObject *mpInstance;
|
||||||
CScriptExtra *mpExtra;
|
CScriptExtra *mpExtra = nullptr;
|
||||||
|
|
||||||
TResPtr<CResource> mpDisplayAsset;
|
TResPtr<CResource> mpDisplayAsset;
|
||||||
uint32 mCharIndex;
|
uint32 mCharIndex;
|
||||||
|
@ -21,34 +21,37 @@ class CScriptNode : public CSceneNode
|
||||||
CCollisionNode *mpCollisionNode;
|
CCollisionNode *mpCollisionNode;
|
||||||
std::vector<CScriptAttachNode*> mAttachments;
|
std::vector<CScriptAttachNode*> mAttachments;
|
||||||
|
|
||||||
bool mHasValidPosition;
|
bool mHasValidPosition = false;
|
||||||
bool mHasVolumePreview;
|
bool mHasVolumePreview = false;
|
||||||
CModelNode *mpVolumePreviewNode;
|
CModelNode *mpVolumePreviewNode = nullptr;
|
||||||
|
|
||||||
std::unique_ptr<CLightParameters> mpLightParameters;
|
std::unique_ptr<CLightParameters> mpLightParameters;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class EGameModeVisibility
|
enum class EGameModeVisibility
|
||||||
{
|
{
|
||||||
Visible, NotVisible, Untested
|
Visible,
|
||||||
} mGameModeVisibility;
|
NotVisible,
|
||||||
|
Untested,
|
||||||
|
};
|
||||||
|
EGameModeVisibility mGameModeVisibility{EGameModeVisibility::Untested};
|
||||||
|
|
||||||
CScriptNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0, CScriptObject *pObject = 0);
|
CScriptNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = nullptr, CScriptObject *pObject = nullptr);
|
||||||
ENodeType NodeType();
|
ENodeType NodeType() override;
|
||||||
void PostLoad();
|
void PostLoad() override;
|
||||||
void OnTransformed();
|
void OnTransformed() override;
|
||||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override;
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override;
|
||||||
void DrawSelection();
|
void DrawSelection() override;
|
||||||
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override;
|
||||||
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo);
|
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo) override;
|
||||||
bool AllowsRotate() const;
|
bool AllowsRotate() const override;
|
||||||
bool AllowsScale() const;
|
bool AllowsScale() const override;
|
||||||
bool IsVisible() const;
|
bool IsVisible() const override;
|
||||||
CColor TintColor(const SViewInfo& rkViewInfo) const;
|
CColor TintColor(const SViewInfo& rkViewInfo) const override;
|
||||||
CColor WireframeColor() const;
|
CColor WireframeColor() const override;
|
||||||
CStructRef GetProperties() const;
|
CStructRef GetProperties() const override;
|
||||||
void PropertyModified(IProperty* pProp);
|
void PropertyModified(IProperty* pProp) override;
|
||||||
|
|
||||||
void LinksModified();
|
void LinksModified();
|
||||||
void UpdatePreviewVolume();
|
void UpdatePreviewVolume();
|
||||||
|
@ -69,9 +72,9 @@ public:
|
||||||
CTexture* ActiveBillboard() const;
|
CTexture* ActiveBillboard() const;
|
||||||
bool UsesModel() const;
|
bool UsesModel() const;
|
||||||
|
|
||||||
inline uint32 NumAttachments() const { return mAttachments.size(); }
|
uint32 NumAttachments() const { return mAttachments.size(); }
|
||||||
inline CScriptAttachNode* Attachment(uint32 Index) const { return mAttachments[Index]; }
|
CScriptAttachNode* Attachment(uint32 Index) const { return mAttachments[Index]; }
|
||||||
inline CResource* DisplayAsset() const { return mpDisplayAsset; }
|
CResource* DisplayAsset() const { return mpDisplayAsset; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetDisplayAsset(CResource *pRes);
|
void SetDisplayAsset(CResource *pRes);
|
||||||
|
|
|
@ -9,14 +9,14 @@ class CStaticNode : public CSceneNode
|
||||||
CStaticModel *mpModel;
|
CStaticModel *mpModel;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CStaticNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0, CStaticModel *pModel = 0);
|
CStaticNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = nullptr, CStaticModel *pModel = nullptr);
|
||||||
ENodeType NodeType();
|
ENodeType NodeType() override;
|
||||||
void PostLoad();
|
void PostLoad() override;
|
||||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override;
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override;
|
||||||
void DrawSelection();
|
void DrawSelection() override;
|
||||||
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override;
|
||||||
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo);
|
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CSTATICNODE_H
|
#endif // CSTATICNODE_H
|
||||||
|
|
|
@ -30,20 +30,20 @@ private:
|
||||||
float mCachedRayDistance;
|
float mCachedRayDistance;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CDamageableTriggerExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0);
|
explicit CDamageableTriggerExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = nullptr);
|
||||||
~CDamageableTriggerExtra();
|
~CDamageableTriggerExtra();
|
||||||
void CreateMaterial();
|
void CreateMaterial();
|
||||||
void UpdatePlaneTransform();
|
void UpdatePlaneTransform();
|
||||||
ERenderSide RenderSideForDirection(const CVector3f& rkDir);
|
ERenderSide RenderSideForDirection(const CVector3f& rkDir);
|
||||||
ERenderSide TransformRenderSide(ERenderSide Side);
|
ERenderSide TransformRenderSide(ERenderSide Side);
|
||||||
void OnTransformed();
|
void OnTransformed() override;
|
||||||
void PropertyModified(IProperty* pProperty);
|
void PropertyModified(IProperty* pProperty) override;
|
||||||
bool ShouldDrawNormalAssets();
|
bool ShouldDrawNormalAssets() override;
|
||||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override;
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override;
|
||||||
void DrawSelection();
|
void DrawSelection() override;
|
||||||
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override;
|
||||||
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 ComponentIndex, const SViewInfo& rkViewInfo);
|
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 ComponentIndex, const SViewInfo& rkViewInfo) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CDAMAGEABLETRIGGEREXTRA_H
|
#endif // CDAMAGEABLETRIGGEREXTRA_H
|
||||||
|
|
|
@ -14,13 +14,13 @@ class CDoorExtra : public CScriptExtra
|
||||||
CColor mShieldColor;
|
CColor mShieldColor;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CDoorExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = 0);
|
explicit CDoorExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = nullptr);
|
||||||
void PropertyModified(IProperty* pProperty);
|
void PropertyModified(IProperty* pProperty) override;
|
||||||
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo);
|
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override;
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override;
|
||||||
void DrawSelection();
|
void DrawSelection() override;
|
||||||
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override;
|
||||||
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo);
|
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CDOOREXTRA_H
|
#endif // CDOOREXTRA_H
|
||||||
|
|
|
@ -14,8 +14,8 @@ class CPointOfInterestExtra : public CScriptExtra
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CPointOfInterestExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0);
|
explicit CPointOfInterestExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0);
|
||||||
void PropertyModified(IProperty* pProperty);
|
void PropertyModified(IProperty* pProperty) override;
|
||||||
void ModifyTintColor(CColor& Color);
|
void ModifyTintColor(CColor& Color) override;
|
||||||
CScan* GetScan() const { return mpScanData; }
|
CScan* GetScan() const { return mpScanData; }
|
||||||
|
|
||||||
static const CColor skRegularColor;
|
static const CColor skRegularColor;
|
||||||
|
|
|
@ -10,9 +10,9 @@ class CRadiusSphereExtra : public CScriptExtra
|
||||||
CFloatRef mRadius;
|
CFloatRef mRadius;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CRadiusSphereExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = 0);
|
explicit CRadiusSphereExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = nullptr);
|
||||||
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo);
|
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override;
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override;
|
||||||
CColor Color() const;
|
CColor Color() const;
|
||||||
CAABox Bounds() const;
|
CAABox Bounds() const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,7 +26,7 @@ protected:
|
||||||
EGame mGame;
|
EGame mGame;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CScriptExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0)
|
explicit CScriptExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = nullptr)
|
||||||
: CSceneNode(pScene, -1, pParent)
|
: CSceneNode(pScene, -1, pParent)
|
||||||
, mpScriptNode(pParent)
|
, mpScriptNode(pParent)
|
||||||
, mpInstance(pInstance)
|
, mpInstance(pInstance)
|
||||||
|
@ -34,20 +34,20 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~CScriptExtra() {}
|
virtual ~CScriptExtra() = default;
|
||||||
inline CScriptObject* Instance() const { return mpInstance; }
|
CScriptObject* Instance() const { return mpInstance; }
|
||||||
inline EGame Game() const { return mGame; }
|
EGame Game() const { return mGame; }
|
||||||
|
|
||||||
// Default implementations for CSceneNode
|
// Default implementations for CSceneNode
|
||||||
virtual ENodeType NodeType() { return ENodeType::ScriptExtra; }
|
ENodeType NodeType() override { return ENodeType::ScriptExtra; }
|
||||||
virtual void RayAABoxIntersectTest(CRayCollisionTester& /*rTester*/, const SViewInfo& /*rkViewInfo*/) {}
|
void RayAABoxIntersectTest(CRayCollisionTester& /*rTester*/, const SViewInfo& /*rkViewInfo*/) override {}
|
||||||
virtual SRayIntersection RayNodeIntersectTest(const CRay& /*rkRay*/, uint32 /*AssetID*/, const SViewInfo& /*rkViewInfo*/)
|
SRayIntersection RayNodeIntersectTest(const CRay& /*rkRay*/, uint32 /*AssetID*/, const SViewInfo& /*rkViewInfo*/) override
|
||||||
{
|
{
|
||||||
SRayIntersection out;
|
SRayIntersection out;
|
||||||
out.Hit = false;
|
out.Hit = false;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
virtual CColor WireframeColor() const { return mpParent->WireframeColor(); }
|
CColor WireframeColor() const override { return mpParent->WireframeColor(); }
|
||||||
|
|
||||||
// Virtual CScriptExtra functions
|
// Virtual CScriptExtra functions
|
||||||
virtual void InstanceTransformed() {}
|
virtual void InstanceTransformed() {}
|
||||||
|
|
|
@ -25,8 +25,8 @@ class CSpacePirateExtra : public CScriptExtra
|
||||||
TEnumRef<EVulnerabilityTypeMP1> mPlasmaVulnerability;
|
TEnumRef<EVulnerabilityTypeMP1> mPlasmaVulnerability;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CSpacePirateExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0);
|
explicit CSpacePirateExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = nullptr);
|
||||||
CColor TevColor();
|
CColor TevColor() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CSPACEPIRATEEXTRA_H
|
#endif // CSPACEPIRATEEXTRA_H
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue