mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-20 10:25:40 +00:00
Cleanup & refactoring
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
class CAnimEventData : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eAnimEventData)
|
||||
DECLARE_RESOURCE_TYPE(AnimEventData)
|
||||
|
||||
struct SEvent
|
||||
{
|
||||
|
||||
@@ -45,12 +45,12 @@ struct SHalfTransition
|
||||
};
|
||||
|
||||
// Character structures
|
||||
enum EOverlayType
|
||||
enum class EOverlayType
|
||||
{
|
||||
eOT_Frozen = FOURCC('FRZN'),
|
||||
eOT_Hypermode = FOURCC('HYPR'),
|
||||
eOT_Acid = FOURCC('ACID'),
|
||||
eOT_XRay = FOURCC('XRAY')
|
||||
Frozen = FOURCC('FRZN'),
|
||||
Hypermode = FOURCC('HYPR'),
|
||||
Acid = FOURCC('ACID'),
|
||||
XRay = FOURCC('XRAY')
|
||||
};
|
||||
|
||||
struct SOverlayModel
|
||||
@@ -84,7 +84,7 @@ struct SSetCharacter
|
||||
|
||||
class CAnimSet : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eAnimSet)
|
||||
DECLARE_RESOURCE_TYPE(AnimSet)
|
||||
friend class CAnimSetLoader;
|
||||
|
||||
// Character Set
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
class CAnimation : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eAnimation)
|
||||
DECLARE_RESOURCE_TYPE(Animation)
|
||||
friend class CAnimationLoader;
|
||||
|
||||
typedef std::vector<CVector3f> TScaleChannel;
|
||||
|
||||
@@ -160,7 +160,7 @@ const SSetCharacter* CAnimationParameters::GetCurrentSetCharacter(int32 NodeInde
|
||||
{
|
||||
CAnimSet *pSet = AnimSet();
|
||||
|
||||
if (pSet && (pSet->Type() == eAnimSet || pSet->Type() == eCharacter))
|
||||
if (pSet && (pSet->Type() == EResourceType::AnimSet || pSet->Type() == EResourceType::Character))
|
||||
{
|
||||
if (NodeIndex == -1)
|
||||
NodeIndex = mCharIndex;
|
||||
@@ -215,7 +215,7 @@ void CAnimationParameters::SetResource(const CAssetID& rkID)
|
||||
|
||||
if (!pEntry)
|
||||
errorf("Invalid resource ID passed to CAnimationParameters: %s", *rkID.ToString());
|
||||
else if (pEntry->ResourceType() != eAnimSet && pEntry->ResourceType() != eCharacter)
|
||||
else if (pEntry->ResourceType() != EResourceType::AnimSet && pEntry->ResourceType() != EResourceType::Character)
|
||||
errorf("Resource with invalid type passed to CAnimationParameters: %s", *pEntry->CookedAssetPath().GetFileName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ struct SBoneTransformInfo
|
||||
|
||||
class CSkeleton : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eSkeleton)
|
||||
DECLARE_RESOURCE_TYPE(Skeleton)
|
||||
friend class CSkeletonLoader;
|
||||
|
||||
CBone *mpRootBone;
|
||||
|
||||
@@ -12,7 +12,7 @@ struct SVertexWeights
|
||||
|
||||
class CSkin : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eSkin)
|
||||
DECLARE_RESOURCE_TYPE(Skin)
|
||||
friend class CSkinLoader;
|
||||
|
||||
struct SVertGroup
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
class CSourceAnimData : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eSourceAnimData)
|
||||
DECLARE_RESOURCE_TYPE(SourceAnimData)
|
||||
friend class CAnimSetLoader;
|
||||
|
||||
struct STransition
|
||||
|
||||
@@ -5,21 +5,21 @@ CMetaAnimFactory gMetaAnimFactory;
|
||||
|
||||
IMetaAnimation* CMetaAnimFactory::LoadFromStream(IInputStream& rInput, EGame Game)
|
||||
{
|
||||
EMetaAnimationType Type = (EMetaAnimationType) rInput.ReadLong();
|
||||
EMetaAnimType Type = (EMetaAnimType) rInput.ReadLong();
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
case eMAT_Play:
|
||||
case EMetaAnimType::Play:
|
||||
return new CMetaAnimPlay(rInput, Game);
|
||||
|
||||
case eMAT_Blend:
|
||||
case eMAT_PhaseBlend:
|
||||
case EMetaAnimType::Blend:
|
||||
case EMetaAnimType::PhaseBlend:
|
||||
return new CMetaAnimBlend(Type, rInput, Game);
|
||||
|
||||
case eMAT_Random:
|
||||
case EMetaAnimType::Random:
|
||||
return new CMetaAnimRandom(rInput, Game);
|
||||
|
||||
case eMAT_Sequence:
|
||||
case EMetaAnimType::Sequence:
|
||||
return new CMetaAnimSequence(rInput, Game);
|
||||
|
||||
default:
|
||||
@@ -43,9 +43,9 @@ CMetaAnimPlay::CMetaAnimPlay(IInputStream& rInput, EGame Game)
|
||||
mUnknownB = rInput.ReadLong();
|
||||
}
|
||||
|
||||
EMetaAnimationType CMetaAnimPlay::Type() const
|
||||
EMetaAnimType CMetaAnimPlay::Type() const
|
||||
{
|
||||
return eMAT_Play;
|
||||
return EMetaAnimType::Play;
|
||||
}
|
||||
|
||||
void CMetaAnimPlay::GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const
|
||||
@@ -54,9 +54,9 @@ void CMetaAnimPlay::GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) cons
|
||||
}
|
||||
|
||||
// ************ CMetaAnimBlend ************
|
||||
CMetaAnimBlend::CMetaAnimBlend(EMetaAnimationType Type, IInputStream& rInput, EGame Game)
|
||||
CMetaAnimBlend::CMetaAnimBlend(EMetaAnimType Type, IInputStream& rInput, EGame Game)
|
||||
{
|
||||
ASSERT(Type == eMAT_Blend || Type == eMAT_PhaseBlend);
|
||||
ASSERT(Type == EMetaAnimType::Blend || Type == EMetaAnimType::PhaseBlend);
|
||||
mType = Type;
|
||||
mpMetaAnimA = gMetaAnimFactory.LoadFromStream(rInput, Game);
|
||||
mpMetaAnimB = gMetaAnimFactory.LoadFromStream(rInput, Game);
|
||||
@@ -70,7 +70,7 @@ CMetaAnimBlend::~CMetaAnimBlend()
|
||||
delete mpMetaAnimB;
|
||||
}
|
||||
|
||||
EMetaAnimationType CMetaAnimBlend::Type() const
|
||||
EMetaAnimType CMetaAnimBlend::Type() const
|
||||
{
|
||||
return mType;
|
||||
}
|
||||
@@ -102,9 +102,9 @@ CMetaAnimRandom::~CMetaAnimRandom()
|
||||
delete mProbabilityPairs[iPair].pAnim;
|
||||
}
|
||||
|
||||
EMetaAnimationType CMetaAnimRandom::Type() const
|
||||
EMetaAnimType CMetaAnimRandom::Type() const
|
||||
{
|
||||
return eMAT_Random;
|
||||
return EMetaAnimType::Random;
|
||||
}
|
||||
|
||||
void CMetaAnimRandom::GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const
|
||||
@@ -132,9 +132,9 @@ CMetaAnimSequence::~CMetaAnimSequence()
|
||||
delete mAnimations[iAnim];
|
||||
}
|
||||
|
||||
EMetaAnimationType CMetaAnimSequence::Type() const
|
||||
EMetaAnimType CMetaAnimSequence::Type() const
|
||||
{
|
||||
return eMAT_Sequence;
|
||||
return EMetaAnimType::Sequence;
|
||||
}
|
||||
|
||||
void CMetaAnimSequence::GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
#include "Core/Resource/TResPtr.h"
|
||||
#include <Common/TString.h>
|
||||
|
||||
enum EMetaAnimationType
|
||||
enum class EMetaAnimType
|
||||
{
|
||||
eMAT_Play = 0,
|
||||
eMAT_Blend = 1,
|
||||
eMAT_PhaseBlend = 2, // note: structure shared with eMAT_Blend
|
||||
eMAT_Random = 3,
|
||||
eMAT_Sequence = 4
|
||||
Play = 0,
|
||||
Blend = 1,
|
||||
PhaseBlend = 2, // note: structure shared with eMAT_Blend
|
||||
Random = 3,
|
||||
Sequence = 4
|
||||
};
|
||||
|
||||
// Factory class
|
||||
@@ -60,7 +60,7 @@ class IMetaAnimation
|
||||
public:
|
||||
IMetaAnimation() {}
|
||||
virtual ~IMetaAnimation() {}
|
||||
virtual EMetaAnimationType Type() const = 0;
|
||||
virtual EMetaAnimType Type() const = 0;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const = 0;
|
||||
|
||||
// Static
|
||||
@@ -78,7 +78,7 @@ protected:
|
||||
public:
|
||||
CMetaAnimPlay(const CAnimPrimitive& rkPrimitive, float UnkA, uint32 UnkB);
|
||||
CMetaAnimPlay(IInputStream& rInput, EGame Game);
|
||||
virtual EMetaAnimationType Type() const;
|
||||
virtual EMetaAnimType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
|
||||
// Accessors
|
||||
@@ -91,16 +91,16 @@ public:
|
||||
class CMetaAnimBlend : public IMetaAnimation
|
||||
{
|
||||
protected:
|
||||
EMetaAnimationType mType;
|
||||
EMetaAnimType mType;
|
||||
IMetaAnimation *mpMetaAnimA;
|
||||
IMetaAnimation *mpMetaAnimB;
|
||||
float mUnknownA;
|
||||
bool mUnknownB;
|
||||
|
||||
public:
|
||||
CMetaAnimBlend(EMetaAnimationType Type, IInputStream& rInput, EGame Game);
|
||||
CMetaAnimBlend(EMetaAnimType Type, IInputStream& rInput, EGame Game);
|
||||
~CMetaAnimBlend();
|
||||
virtual EMetaAnimationType Type() const;
|
||||
virtual EMetaAnimType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
|
||||
// Accessors
|
||||
@@ -126,7 +126,7 @@ protected:
|
||||
public:
|
||||
CMetaAnimRandom(IInputStream& rInput, EGame Game);
|
||||
~CMetaAnimRandom();
|
||||
virtual EMetaAnimationType Type() const;
|
||||
virtual EMetaAnimType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
};
|
||||
|
||||
@@ -139,7 +139,7 @@ protected:
|
||||
public:
|
||||
CMetaAnimSequence(IInputStream& rInput, EGame Game);
|
||||
~CMetaAnimSequence();
|
||||
virtual EMetaAnimationType Type() const;
|
||||
virtual EMetaAnimType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -6,21 +6,21 @@ CMetaTransFactory gMetaTransFactory;
|
||||
|
||||
IMetaTransition* CMetaTransFactory::LoadFromStream(IInputStream& rInput, EGame Game)
|
||||
{
|
||||
EMetaTransitionType Type = (EMetaTransitionType) rInput.ReadLong();
|
||||
EMetaTransType Type = (EMetaTransType) rInput.ReadLong();
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
case eMTT_MetaAnim:
|
||||
case EMetaTransType::MetaAnim:
|
||||
return new CMetaTransMetaAnim(rInput, Game);
|
||||
|
||||
case eMTT_Trans:
|
||||
case eMTT_PhaseTrans:
|
||||
case EMetaTransType::Trans:
|
||||
case EMetaTransType::PhaseTrans:
|
||||
return new CMetaTransTrans(Type, rInput, Game);
|
||||
|
||||
case eMTT_Snap:
|
||||
case EMetaTransType::Snap:
|
||||
return new CMetaTransSnap(rInput, Game);
|
||||
|
||||
case eMTT_Type4:
|
||||
case EMetaTransType::Type4:
|
||||
return new CMetaTransType4(rInput, Game);
|
||||
|
||||
default:
|
||||
@@ -40,9 +40,9 @@ CMetaTransMetaAnim::~CMetaTransMetaAnim()
|
||||
delete mpAnim;
|
||||
}
|
||||
|
||||
EMetaTransitionType CMetaTransMetaAnim::Type() const
|
||||
EMetaTransType CMetaTransMetaAnim::Type() const
|
||||
{
|
||||
return eMTT_MetaAnim;
|
||||
return EMetaTransType::MetaAnim;
|
||||
}
|
||||
|
||||
void CMetaTransMetaAnim::GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const
|
||||
@@ -51,9 +51,9 @@ void CMetaTransMetaAnim::GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet)
|
||||
}
|
||||
|
||||
// ************ CMetaTransTrans ************
|
||||
CMetaTransTrans::CMetaTransTrans(EMetaTransitionType Type, IInputStream& rInput, EGame Game)
|
||||
CMetaTransTrans::CMetaTransTrans(EMetaTransType Type, IInputStream& rInput, EGame Game)
|
||||
{
|
||||
ASSERT(Type == eMTT_Trans || Type == eMTT_PhaseTrans);
|
||||
ASSERT(Type == EMetaTransType::Trans || Type == EMetaTransType::PhaseTrans);
|
||||
mType = Type;
|
||||
|
||||
if (Game <= EGame::Echoes)
|
||||
@@ -70,7 +70,7 @@ CMetaTransTrans::CMetaTransTrans(EMetaTransitionType Type, IInputStream& rInput,
|
||||
}
|
||||
}
|
||||
|
||||
EMetaTransitionType CMetaTransTrans::Type() const
|
||||
EMetaTransType CMetaTransTrans::Type() const
|
||||
{
|
||||
return mType;
|
||||
}
|
||||
@@ -84,9 +84,9 @@ CMetaTransSnap::CMetaTransSnap(IInputStream&, EGame)
|
||||
{
|
||||
}
|
||||
|
||||
EMetaTransitionType CMetaTransSnap::Type() const
|
||||
EMetaTransType CMetaTransSnap::Type() const
|
||||
{
|
||||
return eMTT_Snap;
|
||||
return EMetaTransType::Snap;
|
||||
}
|
||||
|
||||
void CMetaTransSnap::GetUniquePrimitives(std::set<CAnimPrimitive>&) const
|
||||
@@ -99,9 +99,9 @@ CMetaTransType4::CMetaTransType4(IInputStream& rInput, EGame)
|
||||
rInput.Skip(0x14);
|
||||
}
|
||||
|
||||
EMetaTransitionType CMetaTransType4::Type() const
|
||||
EMetaTransType CMetaTransType4::Type() const
|
||||
{
|
||||
return eMTT_Type4;
|
||||
return EMetaTransType::Type4;
|
||||
}
|
||||
|
||||
void CMetaTransType4::GetUniquePrimitives(std::set<CAnimPrimitive>&) const
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
class IMetaAnimation;
|
||||
class IMetaTransition;
|
||||
|
||||
enum EMetaTransitionType
|
||||
enum class EMetaTransType
|
||||
{
|
||||
eMTT_MetaAnim = 0,
|
||||
eMTT_Trans = 1,
|
||||
eMTT_PhaseTrans = 2, // note: structure shared with eMTT_Trans
|
||||
eMTT_Snap = 3,
|
||||
eMTT_Type4 = 4 // MP3 only
|
||||
MetaAnim = 0,
|
||||
Trans = 1,
|
||||
PhaseTrans = 2, // note: structure shared with eMTT_Trans
|
||||
Snap = 3,
|
||||
Type4 = 4 // MP3 only
|
||||
};
|
||||
|
||||
// Factory class
|
||||
@@ -29,7 +29,7 @@ class IMetaTransition
|
||||
public:
|
||||
IMetaTransition() {}
|
||||
virtual ~IMetaTransition() {}
|
||||
virtual EMetaTransitionType Type() const = 0;
|
||||
virtual EMetaTransType Type() const = 0;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const = 0;
|
||||
};
|
||||
|
||||
@@ -41,14 +41,14 @@ class CMetaTransMetaAnim : public IMetaTransition
|
||||
public:
|
||||
CMetaTransMetaAnim(IInputStream& rInput, EGame Game);
|
||||
~CMetaTransMetaAnim();
|
||||
virtual EMetaTransitionType Type() const;
|
||||
virtual EMetaTransType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
};
|
||||
|
||||
// CMetaTransTrans
|
||||
class CMetaTransTrans : public IMetaTransition
|
||||
{
|
||||
EMetaTransitionType mType;
|
||||
EMetaTransType mType;
|
||||
float mUnknownA;
|
||||
uint32 mUnknownB;
|
||||
bool mUnknownC;
|
||||
@@ -56,8 +56,8 @@ class CMetaTransTrans : public IMetaTransition
|
||||
uint32 mUnknownE;
|
||||
|
||||
public:
|
||||
CMetaTransTrans(EMetaTransitionType Type, IInputStream& rInput, EGame Game);
|
||||
virtual EMetaTransitionType Type() const;
|
||||
CMetaTransTrans(EMetaTransType Type, IInputStream& rInput, EGame Game);
|
||||
virtual EMetaTransType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
};
|
||||
|
||||
@@ -66,7 +66,7 @@ class CMetaTransSnap : public IMetaTransition
|
||||
{
|
||||
public:
|
||||
CMetaTransSnap(IInputStream& rInput, EGame Game);
|
||||
virtual EMetaTransitionType Type() const;
|
||||
virtual EMetaTransType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
};
|
||||
|
||||
@@ -75,7 +75,7 @@ class CMetaTransType4 : public IMetaTransition
|
||||
{
|
||||
public:
|
||||
CMetaTransType4(IInputStream& rInput, EGame Game);
|
||||
virtual EMetaTransitionType Type() const;
|
||||
virtual EMetaTransType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class CScriptTemplate;
|
||||
|
||||
class CGameArea : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eArea)
|
||||
DECLARE_RESOURCE_TYPE(Area)
|
||||
friend class CAreaLoader;
|
||||
friend class CAreaCooker;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Very limited functionality - mostly just intended to find the AGSC that a sound ID belongs to
|
||||
class CAudioGroup : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eAudioGroup)
|
||||
DECLARE_RESOURCE_TYPE(AudioGroup)
|
||||
friend class CAudioGroupLoader;
|
||||
|
||||
TString mGroupName;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
class CAudioLookupTable : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eAudioLookupTable)
|
||||
DECLARE_RESOURCE_TYPE(AudioLookupTable)
|
||||
friend class CAudioGroupLoader;
|
||||
std::vector<uint16> mDefineIDs;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
class CAudioMacro : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eAudioMacro)
|
||||
DECLARE_RESOURCE_TYPE(AudioMacro)
|
||||
friend class CUnsupportedFormatLoader;
|
||||
|
||||
TString mMacroName;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
CCollisionMesh::CCollisionMesh()
|
||||
{
|
||||
mVBO.SetVertexDesc(ePosition | eNormal);
|
||||
mVBO.SetVertexDesc(EVertexAttribute::Position | EVertexAttribute::Normal);
|
||||
mVertexCount = 0;
|
||||
mLineCount = 0;
|
||||
mFaceCount = 0;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
class CCollisionMeshGroup : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eDynamicCollision)
|
||||
DECLARE_RESOURCE_TYPE(DynamicCollision)
|
||||
std::vector<CCollisionMesh*> mMeshes;
|
||||
|
||||
public:
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
class CDependencyGroup : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eDependencyGroup)
|
||||
DECLARE_RESOURCE_TYPE(DependencyGroup)
|
||||
std::vector<CAssetID> mDependencies;
|
||||
|
||||
public:
|
||||
|
||||
@@ -116,7 +116,7 @@ CVector2f CFont::RenderString(const TString& rkString, CRenderer* /*pRenderer*/,
|
||||
|
||||
// Load shader uniforms, buffer texture
|
||||
glUniformMatrix4fv(ModelMtxLoc, 1, GL_FALSE, (GLfloat*) &GlyphTransform);
|
||||
smGlyphVertices.BufferAttrib(eTex0, &pGlyph->TexCoords);
|
||||
smGlyphVertices.BufferAttrib(EVertexAttribute::Tex0, &pGlyph->TexCoords);
|
||||
|
||||
// Draw fill
|
||||
glUniform1i(LayerLoc, GlyphLayer);
|
||||
@@ -148,7 +148,7 @@ CVector2f CFont::RenderString(const TString& rkString, CRenderer* /*pRenderer*/,
|
||||
|
||||
void CFont::InitBuffers()
|
||||
{
|
||||
smGlyphVertices.SetActiveAttribs(ePosition | eTex0);
|
||||
smGlyphVertices.SetActiveAttribs(EVertexAttribute::Position | EVertexAttribute::Tex0);
|
||||
smGlyphVertices.SetVertexCount(4);
|
||||
|
||||
CVector3f Vertices[4] = {
|
||||
@@ -157,7 +157,7 @@ void CFont::InitBuffers()
|
||||
CVector3f( 0.f, -2.f, 0.f),
|
||||
CVector3f( 2.f, -2.f, 0.f)
|
||||
};
|
||||
smGlyphVertices.BufferAttrib(ePosition, Vertices);
|
||||
smGlyphVertices.BufferAttrib(EVertexAttribute::Position, Vertices);
|
||||
|
||||
CVector2f TexCoords[4] = {
|
||||
CVector2f(0.f, 0.f),
|
||||
@@ -165,7 +165,7 @@ void CFont::InitBuffers()
|
||||
CVector2f(0.f, 1.f),
|
||||
CVector2f(1.f, 1.f)
|
||||
};
|
||||
smGlyphVertices.BufferAttrib(eTex0, TexCoords);
|
||||
smGlyphVertices.BufferAttrib(EVertexAttribute::Tex0, TexCoords);
|
||||
|
||||
smGlyphIndices.Reserve(4);
|
||||
smGlyphIndices.AddIndex(0);
|
||||
|
||||
@@ -18,7 +18,7 @@ class CRenderer;
|
||||
|
||||
class CFont : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eFont)
|
||||
DECLARE_RESOURCE_TYPE(Font)
|
||||
friend class CFontLoader;
|
||||
static CDynamicVertexBuffer smGlyphVertices; // This is the vertex buffer used to draw glyphs. It has two attributes - Pos and Tex0. Tex0 should be updated for each glyph.
|
||||
static CIndexBuffer smGlyphIndices; // This is the index buffer used to draw glyphs. It uses a triangle strip.
|
||||
|
||||
@@ -60,14 +60,14 @@ float CLight::CalculateIntensity() const
|
||||
float Greatest = (mColor.G >= mColor.B) ? mColor.G : mColor.B;
|
||||
Greatest = (mColor.R >= Greatest) ? mColor.R : Greatest;
|
||||
|
||||
float Multiplier = (mType == eCustom) ? mAngleAttenCoefficients.X : 1.0f;
|
||||
float Multiplier = (mType == ELightType::Custom) ? mAngleAttenCoefficients.X : 1.0f;
|
||||
return Greatest * Multiplier;
|
||||
}
|
||||
|
||||
// As is this one... partly
|
||||
CVector3f CLight::CalculateSpotAngleAtten()
|
||||
{
|
||||
if (mType != eSpot) return CVector3f(1.f, 0.f, 0.f);
|
||||
if (mType != ELightType::Spot) return CVector3f(1.f, 0.f, 0.f);
|
||||
|
||||
if ((mSpotCutoff < 0.f) || (mSpotCutoff > 90.f))
|
||||
return CVector3f(1.f, 0.f, 0.f);
|
||||
@@ -141,14 +141,15 @@ CStructProperty* CLight::GetProperties() const
|
||||
0,
|
||||
"Light");
|
||||
|
||||
//@todo it would be really cool if the property could detect all possible values automatically from TEnumReflection
|
||||
CChoiceProperty* pLightType = (CChoiceProperty*) IProperty::CreateIntrinsic(EPropertyType::Choice,
|
||||
pProperties,
|
||||
MEMBER_OFFSET(CLight, mType),
|
||||
"LightType");
|
||||
pLightType->AddValue("LocalAmbient", eLocalAmbient);
|
||||
pLightType->AddValue("Directional", eDirectional);
|
||||
pLightType->AddValue("Spot", eSpot);
|
||||
pLightType->AddValue("Custom", eCustom);
|
||||
pLightType->AddValue("LocalAmbient", (uint32) ELightType::LocalAmbient);
|
||||
pLightType->AddValue("Directional", (uint32) ELightType::Directional);
|
||||
pLightType->AddValue("Spot", (uint32) ELightType::Spot);
|
||||
pLightType->AddValue("Custom", (uint32) ELightType::Custom);
|
||||
|
||||
IProperty::CreateIntrinsic(EPropertyType::Color,
|
||||
pProperties,
|
||||
@@ -184,24 +185,24 @@ void CLight::Load() const
|
||||
|
||||
switch (mType)
|
||||
{
|
||||
case eLocalAmbient:
|
||||
case ELightType::LocalAmbient:
|
||||
// LocalAmbient is already accounted for in CGraphics::sAreaAmbientColor
|
||||
return;
|
||||
case eDirectional:
|
||||
case ELightType::Directional:
|
||||
pLight->Position = CVector4f(-mDirection * 1048576.f, 1.f);
|
||||
pLight->Direction = CVector4f(mDirection, 0.f);
|
||||
pLight->Color = mColor * CGraphics::sWorldLightMultiplier;
|
||||
pLight->DistAtten = CVector4f(1.f, 0.f, 0.f, 0.f);
|
||||
pLight->AngleAtten = CVector4f(1.f, 0.f, 0.f, 0.f);
|
||||
break;
|
||||
case eSpot:
|
||||
case ELightType::Spot:
|
||||
pLight->Position = CVector4f(mPosition, 1.f);
|
||||
pLight->Direction = CVector4f(mDirection, 0.f);
|
||||
pLight->Color = mColor * CGraphics::sWorldLightMultiplier;
|
||||
pLight->DistAtten = mDistAttenCoefficients;
|
||||
pLight->AngleAtten = mAngleAttenCoefficients;
|
||||
break;
|
||||
case eCustom:
|
||||
case ELightType::Custom:
|
||||
pLight->Position = CVector4f(mPosition, 1.f);
|
||||
pLight->Direction = CVector4f(mDirection, 0.f);
|
||||
pLight->Color = mColor * CGraphics::sWorldLightMultiplier;
|
||||
@@ -218,7 +219,7 @@ void CLight::Load() const
|
||||
CLight* CLight::BuildLocalAmbient(const CVector3f& rkPosition, const CColor& rkColor)
|
||||
{
|
||||
CLight *pLight = new CLight;
|
||||
pLight->mType = eLocalAmbient;
|
||||
pLight->mType = ELightType::LocalAmbient;
|
||||
pLight->mPosition = rkPosition;
|
||||
pLight->mDirection = skDefaultLightDir;
|
||||
pLight->mColor = rkColor;
|
||||
@@ -229,7 +230,7 @@ CLight* CLight::BuildLocalAmbient(const CVector3f& rkPosition, const CColor& rkC
|
||||
CLight* CLight::BuildDirectional(const CVector3f& rkPosition, const CVector3f& rkDirection, const CColor& rkColor)
|
||||
{
|
||||
CLight *pLight = new CLight;
|
||||
pLight->mType = eDirectional;
|
||||
pLight->mType = ELightType::Directional;
|
||||
pLight->mPosition = rkPosition;
|
||||
pLight->mDirection = rkDirection;
|
||||
pLight->mColor = rkColor;
|
||||
@@ -240,7 +241,7 @@ CLight* CLight::BuildDirectional(const CVector3f& rkPosition, const CVector3f& r
|
||||
CLight* CLight::BuildSpot(const CVector3f& rkPosition, const CVector3f& rkDirection, const CColor& rkColor, float Cutoff)
|
||||
{
|
||||
CLight *pLight = new CLight;
|
||||
pLight->mType = eSpot;
|
||||
pLight->mType = ELightType::Spot;
|
||||
pLight->mPosition = rkPosition;
|
||||
pLight->mDirection = -rkDirection.Normalized();
|
||||
pLight->mColor = rkColor;
|
||||
@@ -254,7 +255,7 @@ CLight* CLight::BuildCustom(const CVector3f& rkPosition, const CVector3f& rkDire
|
||||
float AngleAttenA, float AngleAttenB, float AngleAttenC)
|
||||
{
|
||||
CLight *pLight = new CLight;
|
||||
pLight->mType = eCustom;
|
||||
pLight->mType = ELightType::Custom;
|
||||
pLight->mPosition = rkPosition;
|
||||
pLight->mDirection = rkDirection;
|
||||
pLight->mColor = rkColor;
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
/* CLight is currently heavily based on the lights system from Metroid Prime,
|
||||
* including code reverse engineered from the game's executable. Not yet sure
|
||||
* how much needs to be modified to properly support DKCR. */
|
||||
enum ELightType
|
||||
enum class ELightType
|
||||
{
|
||||
eLocalAmbient = 0,
|
||||
eDirectional = 1,
|
||||
eSpot = 3,
|
||||
eCustom = 2
|
||||
LocalAmbient = 0,
|
||||
Directional = 1,
|
||||
Spot = 3,
|
||||
Custom = 2
|
||||
};
|
||||
|
||||
class CLight
|
||||
|
||||
@@ -15,12 +15,12 @@ std::map<uint64, CMaterial::SMaterialShader> CMaterial::smShaderMap;
|
||||
|
||||
CMaterial::CMaterial()
|
||||
: mpShader(nullptr)
|
||||
, mShaderStatus(eNoShader)
|
||||
, mShaderStatus(EShaderStatus::NoShader)
|
||||
, mRecalcHash(true)
|
||||
, mEnableBloom(false)
|
||||
, mVersion(EGame::Invalid)
|
||||
, mOptions(eNoSettings)
|
||||
, mVtxDesc(eNoAttributes)
|
||||
, mOptions(EMaterialOption::None)
|
||||
, mVtxDesc(EVertexAttribute::None)
|
||||
, mBlendSrcFac(GL_ONE)
|
||||
, mBlendDstFac(GL_ZERO)
|
||||
, mLightingEnabled(true)
|
||||
@@ -32,11 +32,11 @@ CMaterial::CMaterial()
|
||||
|
||||
CMaterial::CMaterial(EGame Version, FVertexDescription VtxDesc)
|
||||
: mpShader(nullptr)
|
||||
, mShaderStatus(eNoShader)
|
||||
, mShaderStatus(EShaderStatus::NoShader)
|
||||
, mRecalcHash(true)
|
||||
, mEnableBloom(Version == EGame::Corruption)
|
||||
, mVersion(Version)
|
||||
, mOptions(eDepthWrite)
|
||||
, mOptions(EMaterialOption::DepthWrite)
|
||||
, mVtxDesc(VtxDesc)
|
||||
, mBlendSrcFac(GL_ONE)
|
||||
, mBlendDstFac(GL_ZERO)
|
||||
@@ -46,11 +46,11 @@ CMaterial::CMaterial(EGame Version, FVertexDescription VtxDesc)
|
||||
, mpIndirectTexture(nullptr)
|
||||
{
|
||||
mpShader = nullptr;
|
||||
mShaderStatus = eNoShader;
|
||||
mShaderStatus = EShaderStatus::NoShader;
|
||||
mRecalcHash = true;
|
||||
mEnableBloom = (Version == EGame::Corruption);
|
||||
mVersion = Version;
|
||||
mOptions = eDepthWrite;
|
||||
mOptions = EMaterialOption::DepthWrite;
|
||||
mVtxDesc = VtxDesc;
|
||||
mBlendSrcFac = GL_ONE;
|
||||
mBlendDstFac = GL_ZERO;
|
||||
@@ -96,7 +96,7 @@ void CMaterial::GenerateShader(bool AllowRegen /*= true*/)
|
||||
{
|
||||
HashParameters(); // Calling HashParameters() may change mShaderStatus so call it before checking
|
||||
|
||||
if (mShaderStatus != eShaderExists || AllowRegen)
|
||||
if (mShaderStatus != EShaderStatus::ShaderExists || AllowRegen)
|
||||
{
|
||||
auto Find = smShaderMap.find(mParametersHash);
|
||||
|
||||
@@ -119,14 +119,14 @@ void CMaterial::GenerateShader(bool AllowRegen /*= true*/)
|
||||
|
||||
if (!mpShader->IsValidProgram())
|
||||
{
|
||||
mShaderStatus = eShaderFailed;
|
||||
mShaderStatus = EShaderStatus::ShaderFailed;
|
||||
delete mpShader;
|
||||
mpShader = nullptr;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
mShaderStatus = eShaderExists;
|
||||
mShaderStatus = EShaderStatus::ShaderExists;
|
||||
smShaderMap[mParametersHash] = SMaterialShader { 1, mpShader };
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@ void CMaterial::ClearShader()
|
||||
}
|
||||
|
||||
mpShader = nullptr;
|
||||
mShaderStatus = eNoShader;
|
||||
mShaderStatus = EShaderStatus::NoShader;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,16 +162,16 @@ bool CMaterial::SetCurrent(FRenderOptions Options)
|
||||
if (sCurrentMaterial != HashParameters())
|
||||
{
|
||||
// Shader setup
|
||||
if (mShaderStatus == eNoShader) GenerateShader();
|
||||
if (mShaderStatus == EShaderStatus::NoShader) GenerateShader();
|
||||
mpShader->SetCurrent();
|
||||
|
||||
if (mShaderStatus == eShaderFailed)
|
||||
if (mShaderStatus == EShaderStatus::ShaderFailed)
|
||||
return false;
|
||||
|
||||
// Set RGB blend equation - force to ZERO/ONE if alpha is disabled
|
||||
GLenum srcRGB, dstRGB, srcAlpha, dstAlpha;
|
||||
|
||||
if (Options & eNoAlpha) {
|
||||
if (Options & ERenderOption::NoAlpha) {
|
||||
srcRGB = GL_ONE;
|
||||
dstRGB = GL_ZERO;
|
||||
} else {
|
||||
@@ -182,7 +182,7 @@ bool CMaterial::SetCurrent(FRenderOptions Options)
|
||||
// Set alpha blend equation
|
||||
bool AlphaBlended = ((mBlendSrcFac == GL_SRC_ALPHA) && (mBlendDstFac == GL_ONE_MINUS_SRC_ALPHA));
|
||||
|
||||
if ((mEnableBloom) && (Options & eEnableBloom) && (!AlphaBlended)) {
|
||||
if ((mEnableBloom) && (Options & ERenderOption::EnableBloom) && (!AlphaBlended)) {
|
||||
srcAlpha = mBlendSrcFac;
|
||||
dstAlpha = mBlendDstFac;
|
||||
} else {
|
||||
@@ -201,7 +201,7 @@ bool CMaterial::SetCurrent(FRenderOptions Options)
|
||||
CGraphics::sVertexBlock.COLOR0_Mat = CColor::skWhite;
|
||||
|
||||
// Set depth write - force on if alpha is disabled (lots of weird depth issues otherwise)
|
||||
if ((mOptions & eDepthWrite) || (Options & eNoAlpha)) glDepthMask(GL_TRUE);
|
||||
if ((mOptions & EMaterialOption::DepthWrite) || (Options & ERenderOption::NoAlpha)) glDepthMask(GL_TRUE);
|
||||
else glDepthMask(GL_FALSE);
|
||||
|
||||
// Load uniforms
|
||||
@@ -218,8 +218,8 @@ bool CMaterial::SetCurrent(FRenderOptions Options)
|
||||
{
|
||||
EUVAnimMode mode = mPasses[iPass]->AnimMode();
|
||||
|
||||
if ((mode == eInverseMV) || (mode == eInverseMVTranslated) ||
|
||||
(mode == eModelMatrix) || (mode == eSimpleMode))
|
||||
if ((mode == EUVAnimMode::InverseMV) || (mode == EUVAnimMode::InverseMVTranslated) ||
|
||||
(mode == EUVAnimMode::ModelMatrix) || (mode == EUVAnimMode::SimpleMode))
|
||||
mPasses[iPass]->SetAnimCurrent(Options, iPass);
|
||||
}
|
||||
}
|
||||
@@ -243,7 +243,7 @@ uint64 CMaterial::HashParameters()
|
||||
{
|
||||
if (mRecalcHash)
|
||||
{
|
||||
CFNV1A Hash(CFNV1A::e64Bit);
|
||||
CFNV1A Hash(CFNV1A::k64Bit);
|
||||
|
||||
Hash.HashLong((int) mVersion);
|
||||
Hash.HashLong(mOptions);
|
||||
@@ -273,7 +273,7 @@ uint64 CMaterial::HashParameters()
|
||||
void CMaterial::Update()
|
||||
{
|
||||
mRecalcHash = true;
|
||||
mShaderStatus = eNoShader;
|
||||
mShaderStatus = EShaderStatus::NoShader;
|
||||
}
|
||||
|
||||
void CMaterial::SetNumPasses(uint32 NumPasses)
|
||||
|
||||
@@ -16,35 +16,33 @@
|
||||
|
||||
class CMaterialSet;
|
||||
|
||||
// Enums
|
||||
enum class EMaterialOption
|
||||
{
|
||||
None = 0,
|
||||
Konst = 0x8,
|
||||
Transparent = 0x10,
|
||||
Masked = 0x20,
|
||||
Reflection = 0x40,
|
||||
DepthWrite = 0x80,
|
||||
SurfaceReflection = 0x100,
|
||||
Occluder = 0x200,
|
||||
IndStage = 0x400,
|
||||
Lightmap = 0x800,
|
||||
ShortTexCoord = 0x2000,
|
||||
AllMP1Settings = 0x2FF8,
|
||||
DrawWhiteAmbientDKCR = 0x80000
|
||||
};
|
||||
DECLARE_FLAGS_ENUMCLASS(EMaterialOption, FMaterialOptions)
|
||||
|
||||
class CMaterial
|
||||
{
|
||||
public:
|
||||
friend class CMaterialLoader;
|
||||
friend class CMaterialCooker;
|
||||
|
||||
// Enums
|
||||
enum EMaterialOption
|
||||
enum class EShaderStatus
|
||||
{
|
||||
eNoSettings = 0,
|
||||
eKonst = 0x8,
|
||||
eTransparent = 0x10,
|
||||
ePunchthrough = 0x20,
|
||||
eReflection = 0x40,
|
||||
eDepthWrite = 0x80,
|
||||
eSurfaceReflection = 0x100,
|
||||
eOccluder = 0x200,
|
||||
eIndStage = 0x400,
|
||||
eLightmap = 0x800,
|
||||
eShortTexCoord = 0x2000,
|
||||
eAllMP1Settings = 0x2FF8,
|
||||
eDrawWhiteAmbientDKCR = 0x80000
|
||||
};
|
||||
DECLARE_FLAGS(EMaterialOption, FMaterialOptions)
|
||||
|
||||
private:
|
||||
enum EShaderStatus
|
||||
{
|
||||
eNoShader, eShaderExists, eShaderFailed
|
||||
NoShader, ShaderExists, ShaderFailed
|
||||
};
|
||||
|
||||
// Statics
|
||||
|
||||
@@ -5,22 +5,22 @@
|
||||
|
||||
CMaterialPass::CMaterialPass(CMaterial *pParent)
|
||||
: mPassType("CUST")
|
||||
, mSettings(eNoPassSettings)
|
||||
, mSettings(EPassSettings::None)
|
||||
, mpTexture(nullptr)
|
||||
, mEnabled(true)
|
||||
, mpParentMat(pParent)
|
||||
, mColorOutput(ePrevReg)
|
||||
, mAlphaOutput(ePrevReg)
|
||||
, mKColorSel(eKonstOne)
|
||||
, mKAlphaSel(eKonstOne)
|
||||
, mRasSel(eRasColorNull)
|
||||
, mColorOutput(kPrevReg)
|
||||
, mAlphaOutput(kPrevReg)
|
||||
, mKColorSel(kKonstOne)
|
||||
, mKAlphaSel(kKonstOne)
|
||||
, mRasSel(kRasColorNull)
|
||||
, mTexCoordSource(0xFF)
|
||||
, mAnimMode(eNoUVAnim)
|
||||
, mAnimMode(EUVAnimMode::NoUVAnim)
|
||||
{
|
||||
for (uint32 iParam = 0; iParam < 4; iParam++)
|
||||
{
|
||||
mColorInputs[iParam] = eZeroRGB;
|
||||
mAlphaInputs[iParam] = eZeroAlpha;
|
||||
mColorInputs[iParam] = kZeroRGB;
|
||||
mAlphaInputs[iParam] = kZeroAlpha;
|
||||
mAnimParams[iParam] = 0.f;
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,7 @@ void CMaterialPass::HashParameters(CFNV1A& rHash)
|
||||
rHash.HashLong(mKAlphaSel);
|
||||
rHash.HashLong(mRasSel);
|
||||
rHash.HashLong(mTexCoordSource);
|
||||
rHash.HashLong(mAnimMode);
|
||||
rHash.HashLong((uint) mAnimMode);
|
||||
rHash.HashData(mAnimParams, sizeof(float) * 4);
|
||||
rHash.HashByte(mEnabled);
|
||||
}
|
||||
@@ -86,7 +86,7 @@ void CMaterialPass::LoadTexture(uint32 PassIndex)
|
||||
|
||||
void CMaterialPass::SetAnimCurrent(FRenderOptions Options, uint32 PassIndex)
|
||||
{
|
||||
if (mAnimMode == eNoUVAnim) return;
|
||||
if (mAnimMode == EUVAnimMode::NoUVAnim) return;
|
||||
|
||||
float Seconds = CTimer::SecondsMod900();
|
||||
const CMatrix4f& ModelMtx = CGraphics::sMVPBlock.ModelMatrix;
|
||||
@@ -98,8 +98,8 @@ void CMaterialPass::SetAnimCurrent(FRenderOptions Options, uint32 PassIndex)
|
||||
switch (mAnimMode)
|
||||
{
|
||||
|
||||
case eInverseMV: // Mode 0
|
||||
case eSimpleMode: // Mode 10 - maybe not correct?
|
||||
case EUVAnimMode::InverseMV: // Mode 0
|
||||
case EUVAnimMode::SimpleMode: // Mode 10 - maybe not correct?
|
||||
{
|
||||
TexMtx = (ViewMtx.Inverse().Transpose() * ModelMtx);
|
||||
TexMtx[0][3] = TexMtx[1][3] = TexMtx[2][3] = 0.f;
|
||||
@@ -110,7 +110,7 @@ void CMaterialPass::SetAnimCurrent(FRenderOptions Options, uint32 PassIndex)
|
||||
break;
|
||||
}
|
||||
|
||||
case eInverseMVTranslated: // Mode 1
|
||||
case EUVAnimMode::InverseMVTranslated: // Mode 1
|
||||
{
|
||||
TexMtx = (ViewMtx.Inverse().Transpose() * ModelMtx);
|
||||
PostMtx = CMatrix4f(0.5f, 0.0f, 0.0f, 0.5f,
|
||||
@@ -119,9 +119,9 @@ void CMaterialPass::SetAnimCurrent(FRenderOptions Options, uint32 PassIndex)
|
||||
0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
case eUVScroll: // Mode 2
|
||||
case EUVAnimMode::UVScroll: // Mode 2
|
||||
{
|
||||
if (Options & eEnableUVScroll)
|
||||
if (Options & ERenderOption::EnableUVScroll)
|
||||
{
|
||||
TexMtx[0][3] = (Seconds * mAnimParams[2]) + mAnimParams[0];
|
||||
TexMtx[1][3] = (Seconds * mAnimParams[3]) + mAnimParams[1];
|
||||
@@ -129,9 +129,9 @@ void CMaterialPass::SetAnimCurrent(FRenderOptions Options, uint32 PassIndex)
|
||||
break;
|
||||
}
|
||||
|
||||
case eUVRotation: // Mode 3
|
||||
case EUVAnimMode::UVRotation: // Mode 3
|
||||
{
|
||||
if (Options & eEnableUVScroll)
|
||||
if (Options & ERenderOption::EnableUVScroll)
|
||||
{
|
||||
float Angle = (Seconds * mAnimParams[1]) + mAnimParams[0];
|
||||
|
||||
@@ -148,20 +148,20 @@ void CMaterialPass::SetAnimCurrent(FRenderOptions Options, uint32 PassIndex)
|
||||
break;
|
||||
}
|
||||
|
||||
case eHFilmstrip: // Mode 4
|
||||
case eVFilmstrip: // Mode 5
|
||||
case EUVAnimMode::HFilmstrip: // Mode 4
|
||||
case EUVAnimMode::VFilmstrip: // Mode 5
|
||||
{
|
||||
if (Options & eEnableUVScroll)
|
||||
if (Options & ERenderOption::EnableUVScroll)
|
||||
{
|
||||
float Offset = mAnimParams[2] * mAnimParams[0] * (mAnimParams[3] + Seconds);
|
||||
Offset = (float)(short)(float)(mAnimParams[1] * fmod(Offset, 1.0f)) * mAnimParams[2];
|
||||
if (mAnimMode == eHFilmstrip) TexMtx[0][3] = Offset;
|
||||
if (mAnimMode == eVFilmstrip) TexMtx[1][3] = Offset;
|
||||
if (mAnimMode == EUVAnimMode::HFilmstrip) TexMtx[0][3] = Offset;
|
||||
if (mAnimMode == EUVAnimMode::VFilmstrip) TexMtx[1][3] = Offset;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case eModelMatrix: // Mode 6
|
||||
case EUVAnimMode::ModelMatrix: // Mode 6
|
||||
{
|
||||
// It looks ok, but I can't tell whether it's correct...
|
||||
TexMtx = ModelMtx;
|
||||
@@ -174,7 +174,7 @@ void CMaterialPass::SetAnimCurrent(FRenderOptions Options, uint32 PassIndex)
|
||||
TexMtx[2][3] = 0.f;
|
||||
}
|
||||
|
||||
case eConvolutedModeA: // Mode 7
|
||||
case EUVAnimMode::ConvolutedModeA: // Mode 7
|
||||
{
|
||||
CMatrix4f View = CGraphics::sMVPBlock.ViewMatrix;
|
||||
|
||||
@@ -196,7 +196,7 @@ void CMaterialPass::SetAnimCurrent(FRenderOptions Options, uint32 PassIndex)
|
||||
break;
|
||||
}
|
||||
|
||||
case eConvolutedModeB: // Mode 8 (MP3/DKCR only)
|
||||
case EUVAnimMode::ConvolutedModeB: // Mode 8 (MP3/DKCR only)
|
||||
{
|
||||
// todo
|
||||
break;
|
||||
@@ -256,8 +256,8 @@ void CMaterialPass::SetKColorSel(ETevKSel Sel)
|
||||
void CMaterialPass::SetKAlphaSel(ETevKSel Sel)
|
||||
{
|
||||
// Konst RGB is invalid for alpha, so reset to One if that's the selection
|
||||
if ((Sel >= eKonst0_RGB) && (Sel <= eKonst3_RGB))
|
||||
Sel = eKonstOne;
|
||||
if ((Sel >= kKonst0_RGB) && (Sel <= kKonst3_RGB))
|
||||
Sel = kKonstOne;
|
||||
|
||||
mKAlphaSel = Sel;
|
||||
mpParentMat->Update();
|
||||
|
||||
@@ -10,23 +10,22 @@
|
||||
|
||||
class CMaterial;
|
||||
|
||||
enum class EPassSettings
|
||||
{
|
||||
None = 0x0,
|
||||
EmissiveBloom = 0x4,
|
||||
InvertOpacityMap = 0x10
|
||||
};
|
||||
DECLARE_FLAGS_ENUMCLASS(EPassSettings, FPassSettings)
|
||||
|
||||
class CMaterialPass
|
||||
{
|
||||
friend class CMaterialLoader;
|
||||
friend class CMaterialCooker;
|
||||
|
||||
public:
|
||||
enum EPassSettings
|
||||
{
|
||||
eNoPassSettings = 0x0,
|
||||
eEmissiveBloom = 0x4,
|
||||
eInvertOpacityMap = 0x10
|
||||
};
|
||||
|
||||
private:
|
||||
CMaterial *mpParentMat;
|
||||
CFourCC mPassType;
|
||||
EPassSettings mSettings;
|
||||
FPassSettings mSettings;
|
||||
|
||||
ETevColorInput mColorInputs[4];
|
||||
ETevAlphaInput mAlphaInputs[4];
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
class CPoiToWorld : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eStaticGeometryMap)
|
||||
DECLARE_RESOURCE_TYPE(StaticGeometryMap)
|
||||
|
||||
public:
|
||||
struct SPoiMap
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
class CResTypeFilter
|
||||
{
|
||||
EGame mGame;
|
||||
std::set<EResType> mAcceptedTypes;
|
||||
std::set<EResourceType> mAcceptedTypes;
|
||||
|
||||
public:
|
||||
CResTypeFilter() : mGame(EGame::Invalid) { }
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
rArc << SerialParameter("AcceptedTypes", mAcceptedTypes, SH_Proxy);
|
||||
}
|
||||
|
||||
inline bool Accepts(EResType Type) const
|
||||
inline bool Accepts(EResourceType Type) const
|
||||
{
|
||||
return mAcceptedTypes.find(Type) != mAcceptedTypes.end();
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
#include <Common/Macros.h>
|
||||
#include <algorithm>
|
||||
|
||||
std::unordered_map<EResType, CResTypeInfo*> CResTypeInfo::smTypeMap;
|
||||
std::unordered_map<EResourceType, CResTypeInfo*> CResTypeInfo::smTypeMap;
|
||||
|
||||
CResTypeInfo::CResTypeInfo(EResType Type, const TString& rkTypeName, const TString& rkRetroExtension)
|
||||
CResTypeInfo::CResTypeInfo(EResourceType Type, const TString& rkTypeName, const TString& rkRetroExtension)
|
||||
: mType(Type)
|
||||
, mTypeName(rkTypeName)
|
||||
, mRetroExtension(rkRetroExtension)
|
||||
@@ -117,7 +117,7 @@ void Serialize(IArchive& rArc, CResTypeInfo*& rpType)
|
||||
}
|
||||
}
|
||||
|
||||
void Serialize(IArchive& rArc, EResType& rType)
|
||||
void Serialize(IArchive& rArc, EResourceType& rType)
|
||||
{
|
||||
CFourCC Extension;
|
||||
|
||||
@@ -169,235 +169,235 @@ void CResTypeInfo::CResTypeInfoFactory::AddExtension(CResTypeInfo *pType, CFourC
|
||||
void CResTypeInfo::CResTypeInfoFactory::InitTypes()
|
||||
{
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eAnimation, "Animation", "ani");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::Animation, "Animation", "ani");
|
||||
AddExtension(pType, "ANIM", EGame::PrimeDemo, EGame::DKCReturns);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eAnimCollisionPrimData, "Animation Collision Primitive Data", "?");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::AnimCollisionPrimData, "Animation Collision Primitive Data", "?");
|
||||
AddExtension(pType, "CPRM", EGame::DKCReturns, EGame::DKCReturns);
|
||||
pType->mCanHaveDependencies = false;
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eAnimEventData, "Animation Event Data", "evnt");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::AnimEventData, "Animation Event Data", "evnt");
|
||||
AddExtension(pType, "EVNT", EGame::PrimeDemo, EGame::Prime);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eAnimSet, "Animation Character Set", "acs");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::AnimSet, "Animation Character Set", "acs");
|
||||
AddExtension(pType, "ANCS", EGame::PrimeDemo, EGame::Echoes);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eArea, "Area", "mrea");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::Area, "Area", "mrea");
|
||||
AddExtension(pType, "MREA", EGame::PrimeDemo, EGame::DKCReturns);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eAudioAmplitudeData, "Audio Amplitude Data", "?");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::AudioAmplitudeData, "Audio Amplitude Data", "?");
|
||||
AddExtension(pType, "CAAD", EGame::Corruption, EGame::Corruption);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eAudioGroup, "Audio Group", "agsc");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::AudioGroup, "Audio Group", "agsc");
|
||||
AddExtension(pType, "AGSC", EGame::PrimeDemo, EGame::Echoes);
|
||||
pType->mCanHaveDependencies = false;
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eAudioMacro, "Audio Macro", "caud");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::AudioMacro, "Audio Macro", "caud");
|
||||
AddExtension(pType, "CAUD", EGame::CorruptionProto, EGame::DKCReturns);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eAudioSample, "Audio Sample", "csmp");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::AudioSample, "Audio Sample", "csmp");
|
||||
AddExtension(pType, "CSMP", EGame::CorruptionProto, EGame::DKCReturns);
|
||||
pType->mCanHaveDependencies = false;
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eAudioLookupTable, "Audio Lookup Table", "atbl");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::AudioLookupTable, "Audio Lookup Table", "atbl");
|
||||
AddExtension(pType, "ATBL", EGame::PrimeDemo, EGame::Corruption);
|
||||
pType->mCanHaveDependencies = false;
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eBinaryData, "Generic Data", "dat");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::BinaryData, "Generic Data", "dat");
|
||||
AddExtension(pType, "DUMB", EGame::PrimeDemo, EGame::Corruption);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eBurstFireData, "Burst Fire Data", "bfre.bfrc");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::BurstFireData, "Burst Fire Data", "bfre.bfrc");
|
||||
AddExtension(pType, "BFRC", EGame::CorruptionProto, EGame::Corruption);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eCharacter, "Character", "char");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::Character, "Character", "char");
|
||||
AddExtension(pType, "CHAR", EGame::CorruptionProto, EGame::DKCReturns);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eDependencyGroup, "Dependency Group", "?");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::DependencyGroup, "Dependency Group", "?");
|
||||
AddExtension(pType, "DGRP", EGame::PrimeDemo, EGame::DKCReturns);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eDynamicCollision, "Dynamic Collision", "dcln");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::DynamicCollision, "Dynamic Collision", "dcln");
|
||||
AddExtension(pType, "DCLN", EGame::PrimeDemo, EGame::DKCReturns);
|
||||
pType->mCanHaveDependencies = false;
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eFont, "Font", "rpff");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::Font, "Font", "rpff");
|
||||
AddExtension(pType, "FONT", EGame::PrimeDemo, EGame::DKCReturns);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eGuiFrame, "Gui Frame", "frme");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::GuiFrame, "Gui Frame", "frme");
|
||||
AddExtension(pType, "FRME", EGame::PrimeDemo, EGame::DKCReturns);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eGuiKeyFrame, "Gui Keyframe", "?");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::GuiKeyFrame, "Gui Keyframe", "?");
|
||||
AddExtension(pType, "KFAM", EGame::PrimeDemo, EGame::PrimeDemo);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eHintSystem, "Hint System Data", "hint");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::HintSystem, "Hint System Data", "hint");
|
||||
AddExtension(pType, "HINT", EGame::Prime, EGame::Corruption);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eMapArea, "Area Map", "mapa");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::MapArea, "Area Map", "mapa");
|
||||
AddExtension(pType, "MAPA", EGame::PrimeDemo, EGame::Corruption);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eMapWorld, "World Map", "mapw");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::MapWorld, "World Map", "mapw");
|
||||
AddExtension(pType, "MAPW", EGame::PrimeDemo, EGame::Corruption);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eMapUniverse, "Universe Map", "mapu");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::MapUniverse, "Universe Map", "mapu");
|
||||
AddExtension(pType, "MAPU", EGame::PrimeDemo, EGame::Echoes);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eMidi, "MIDI", "?");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::Midi, "MIDI", "?");
|
||||
AddExtension(pType, "CSNG", EGame::PrimeDemo, EGame::Echoes);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eModel, "Model", "cmdl");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::Model, "Model", "cmdl");
|
||||
AddExtension(pType, "CMDL", EGame::PrimeDemo, EGame::DKCReturns);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eParticle, "Particle System", "gpsm.part");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::Particle, "Particle System", "gpsm.part");
|
||||
AddExtension(pType, "PART", EGame::PrimeDemo, EGame::DKCReturns);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eParticleCollisionResponse, "Collision Response Particle System", "crsm.crsc");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::ParticleCollisionResponse, "Collision Response Particle System", "crsm.crsc");
|
||||
AddExtension(pType, "CRSC", EGame::PrimeDemo, EGame::Corruption);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eParticleDecal, "Decal Particle System", "dpsm.dpsc");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::ParticleDecal, "Decal Particle System", "dpsm.dpsc");
|
||||
AddExtension(pType, "DPSC", EGame::PrimeDemo, EGame::Corruption);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eParticleElectric, "Electric Particle System", "elsm.elsc");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::ParticleElectric, "Electric Particle System", "elsm.elsc");
|
||||
AddExtension(pType, "ELSC", EGame::PrimeDemo, EGame::Corruption);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eParticleSorted, "Sorted Particle System", "srsm.srsc");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::ParticleSorted, "Sorted Particle System", "srsm.srsc");
|
||||
AddExtension(pType, "SRSC", EGame::EchoesDemo, EGame::Echoes);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eParticleSpawn, "Spawn Particle System", "spsm.spsc");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::ParticleSpawn, "Spawn Particle System", "spsm.spsc");
|
||||
AddExtension(pType, "SPSC", EGame::EchoesDemo, EGame::DKCReturns);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eParticleSwoosh, "Swoosh Particle System", "swsh.swhc");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::ParticleSwoosh, "Swoosh Particle System", "swsh.swhc");
|
||||
AddExtension(pType, "SWHC", EGame::PrimeDemo, EGame::DKCReturns);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eParticleTransform, "Transform Particle System", "xfsm.xfsc");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::ParticleTransform, "Transform Particle System", "xfsm.xfsc");
|
||||
AddExtension(pType, "XFSC", EGame::DKCReturns, EGame::DKCReturns);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eParticleWeapon, "Weapon Particle System", "wpsm.wpsc");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::ParticleWeapon, "Weapon Particle System", "wpsm.wpsc");
|
||||
AddExtension(pType, "WPSC", EGame::PrimeDemo, EGame::Corruption);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(ePathfinding, "Pathfinding Mesh", "path");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::Pathfinding, "Pathfinding Mesh", "path");
|
||||
AddExtension(pType, "PATH", EGame::PrimeDemo, EGame::Corruption);
|
||||
pType->mCanHaveDependencies = false;
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(ePortalArea, "Portal Area", "?");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::PortalArea, "Portal Area", "?");
|
||||
AddExtension(pType, "PTLA", EGame::EchoesDemo, EGame::Corruption);
|
||||
pType->mCanHaveDependencies = false;
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eRuleSet, "Rule Set", "rule");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::RuleSet, "Rule Set", "rule");
|
||||
AddExtension(pType, "RULE", EGame::EchoesDemo, EGame::DKCReturns);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eSaveArea, "Area Save Info", "sava");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::SaveArea, "Area Save Info", "sava");
|
||||
AddExtension(pType, "SAVA", EGame::CorruptionProto, EGame::Corruption);
|
||||
pType->mCanHaveDependencies = false;
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eSaveWorld, "World Save Info", "savw");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::SaveWorld, "World Save Info", "savw");
|
||||
AddExtension(pType, "SAVW", EGame::Prime, EGame::DKCReturns);
|
||||
pType->mCanHaveDependencies = false;
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eScan, "Scan", "scan");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::Scan, "Scan", "scan");
|
||||
AddExtension(pType, "SCAN", EGame::PrimeDemo, EGame::Corruption);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eSkeleton, "Skeleton", "cin");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::Skeleton, "Skeleton", "cin");
|
||||
AddExtension(pType, "CINF", EGame::PrimeDemo, EGame::DKCReturns);
|
||||
pType->mCanHaveDependencies = false;
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eSkin, "Skin", "cskr");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::Skin, "Skin", "cskr");
|
||||
AddExtension(pType, "CSKR", EGame::PrimeDemo, EGame::DKCReturns);
|
||||
pType->mCanHaveDependencies = false;
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eSourceAnimData, "Source Animation Data", "sand");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::SourceAnimData, "Source Animation Data", "sand");
|
||||
AddExtension(pType, "SAND", EGame::CorruptionProto, EGame::Corruption);
|
||||
pType->mCanHaveDependencies = false; // all dependencies are added to the CHAR dependency tree
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eSpatialPrimitive, "Spatial Primitive", "?");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::SpatialPrimitive, "Spatial Primitive", "?");
|
||||
AddExtension(pType, "CSPP", EGame::EchoesDemo, EGame::Echoes);
|
||||
pType->mCanHaveDependencies = false;
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eStateMachine, "State Machine", "afsm");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::StateMachine, "State Machine", "afsm");
|
||||
AddExtension(pType, "AFSM", EGame::PrimeDemo, EGame::Echoes);
|
||||
AddExtension(pType, "FSM2", EGame::CorruptionProto, EGame::Corruption);
|
||||
AddExtension(pType, "FSMC", EGame::DKCReturns, EGame::DKCReturns);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eStateMachine2, "State Machine 2", "fsm2");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::StateMachine2, "State Machine 2", "fsm2");
|
||||
AddExtension(pType, "FSM2", EGame::EchoesDemo, EGame::Corruption);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eStaticGeometryMap, "Static Scan Map", "egmc");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::StaticGeometryMap, "Static Scan Map", "egmc");
|
||||
AddExtension(pType, "EGMC", EGame::EchoesDemo, EGame::Corruption);
|
||||
pType->mCanHaveDependencies = false;
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eStreamedAudio, "Streamed Audio", "?");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::StreamedAudio, "Streamed Audio", "?");
|
||||
AddExtension(pType, "STRM", EGame::CorruptionProto, EGame::DKCReturns);
|
||||
pType->mCanHaveDependencies = false;
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eStringList, "String List", "stlc");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::StringList, "String List", "stlc");
|
||||
AddExtension(pType, "STLC", EGame::EchoesDemo, EGame::CorruptionProto);
|
||||
pType->mCanHaveDependencies = false;
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eStringTable, "String Table", "strg");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::StringTable, "String Table", "strg");
|
||||
AddExtension(pType, "STRG", EGame::PrimeDemo, EGame::DKCReturns);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eTexture, "Texture", "txtr");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::Texture, "Texture", "txtr");
|
||||
AddExtension(pType, "TXTR", EGame::PrimeDemo, EGame::DKCReturns);
|
||||
pType->mCanHaveDependencies = false;
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eTweak, "Tweak Data", "ctwk");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::Tweak, "Tweak Data", "ctwk");
|
||||
AddExtension(pType, "CTWK", EGame::PrimeDemo, EGame::Prime);
|
||||
pType->mCanHaveDependencies = false;
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eUserEvaluatorData, "User Evaluator Data", "user.usrc");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::UserEvaluatorData, "User Evaluator Data", "user.usrc");
|
||||
AddExtension(pType, "USRC", EGame::CorruptionProto, EGame::Corruption);
|
||||
}
|
||||
{
|
||||
CResTypeInfo *pType = new CResTypeInfo(eWorld, "World", "mwld");
|
||||
CResTypeInfo *pType = new CResTypeInfo(EResourceType::World, "World", "mwld");
|
||||
AddExtension(pType, "MLVL", EGame::PrimeDemo, EGame::DKCReturns);
|
||||
pType->mCanBeSerialized = true;
|
||||
}
|
||||
|
||||
@@ -17,17 +17,17 @@ class CResTypeInfo
|
||||
CFourCC CookedExt;
|
||||
};
|
||||
|
||||
EResType mType;
|
||||
EResourceType mType;
|
||||
TString mTypeName;
|
||||
std::vector<SGameExtension> mCookedExtensions;
|
||||
TString mRetroExtension; // File extension in Retro's directory tree. We don't use it directly but it is needed for generating asset ID hashes
|
||||
bool mCanBeSerialized;
|
||||
bool mCanHaveDependencies;
|
||||
|
||||
static std::unordered_map<EResType, CResTypeInfo*> smTypeMap;
|
||||
static std::unordered_map<EResourceType, CResTypeInfo*> smTypeMap;
|
||||
|
||||
// Private Methods
|
||||
CResTypeInfo(EResType Type, const TString& rkTypeName, const TString& rkRetroExtension);
|
||||
CResTypeInfo(EResourceType Type, const TString& rkTypeName, const TString& rkRetroExtension);
|
||||
~CResTypeInfo() {}
|
||||
|
||||
// Public Methods
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
CFourCC CookedExtension(EGame Game) const;
|
||||
|
||||
// Accessors
|
||||
inline EResType Type() const { return mType; }
|
||||
inline EResourceType Type() const { return mType; }
|
||||
inline TString TypeName() const { return mTypeName; }
|
||||
inline bool CanBeSerialized() const { return mCanBeSerialized; }
|
||||
inline bool CanHaveDependencies() const { return mCanHaveDependencies; }
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
static void GetAllTypesInGame(EGame Game, std::list<CResTypeInfo*>& rOut);
|
||||
static CResTypeInfo* TypeForCookedExtension(EGame, CFourCC Ext);
|
||||
|
||||
inline static CResTypeInfo* FindTypeInfo(EResType Type)
|
||||
inline static CResTypeInfo* FindTypeInfo(EResourceType Type)
|
||||
{
|
||||
auto Iter = smTypeMap.find(Type);
|
||||
return (Iter == smTypeMap.end() ? nullptr : Iter->second);
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
|
||||
// This macro creates functions that allow us to easily identify this resource type.
|
||||
// Must be included on every CResource subclass.
|
||||
#define DECLARE_RESOURCE_TYPE(ResTypeEnum) \
|
||||
#define DECLARE_RESOURCE_TYPE(ResourceTypeEnum) \
|
||||
public: \
|
||||
static EResType StaticType() \
|
||||
static EResourceType StaticType() \
|
||||
{ \
|
||||
return ResTypeEnum; \
|
||||
return EResourceType::ResourceTypeEnum; \
|
||||
} \
|
||||
\
|
||||
static CResTypeInfo* StaticTypeInfo() \
|
||||
@@ -29,7 +29,7 @@ private: \
|
||||
|
||||
class CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eResource)
|
||||
DECLARE_RESOURCE_TYPE(Resource)
|
||||
|
||||
CResourceEntry *mpEntry;
|
||||
int mRefCount;
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
|
||||
inline CResourceEntry* Entry() const { return mpEntry; }
|
||||
inline CResTypeInfo* TypeInfo() const { return mpEntry->TypeInfo(); }
|
||||
inline EResType Type() const { return mpEntry->TypeInfo()->Type(); }
|
||||
inline EResourceType Type() const { return mpEntry->TypeInfo()->Type(); }
|
||||
inline TString Source() const { return mpEntry ? mpEntry->CookedAssetPath(true).GetFileName() : ""; }
|
||||
inline TString FullSource() const { return mpEntry ? mpEntry->CookedAssetPath(true) : ""; }
|
||||
inline CAssetID ID() const { return mpEntry ? mpEntry->ID() : CAssetID::skInvalidID64; }
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
|
||||
class CScan : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eScan)
|
||||
DECLARE_RESOURCE_TYPE(Scan)
|
||||
friend class CScanLoader;
|
||||
|
||||
public:
|
||||
// This likely needs revising when MP2/MP3 support is added
|
||||
enum ELogbookCategory
|
||||
enum class ELogbookCategory
|
||||
{
|
||||
eNone,
|
||||
ePirateData,
|
||||
eChozoLore,
|
||||
eCreatures,
|
||||
eResearch
|
||||
None,
|
||||
PirateData,
|
||||
ChozoLore,
|
||||
Creatures,
|
||||
Research
|
||||
};
|
||||
|
||||
struct SScanInfoSecondaryModel
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
, mpStringTable(nullptr)
|
||||
, mIsSlow(false)
|
||||
, mIsImportant(false)
|
||||
, mCategory(eNone)
|
||||
, mCategory(ELogbookCategory::None)
|
||||
{}
|
||||
|
||||
CDependencyTree* BuildDependencyTree() const
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
class CStringList : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eStringList)
|
||||
DECLARE_RESOURCE_TYPE(StringList)
|
||||
friend class CAudioGroupLoader;
|
||||
std::vector<TString> mStringList;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
class CStringTable : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eStringTable)
|
||||
DECLARE_RESOURCE_TYPE(StringTable)
|
||||
friend class CStringLoader;
|
||||
|
||||
std::vector<TString> mStringNames;
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
{
|
||||
// STRGs can reference FONTs with the &font=; formatting tag and TXTRs with the &image=; tag
|
||||
CDependencyTree *pTree = new CDependencyTree();
|
||||
EIDLength IDLength = (Game() <= EGame::Echoes ? e32Bit : e64Bit);
|
||||
EIDLength IDLength = (Game() <= EGame::Echoes ? k32Bit : k64Bit);
|
||||
|
||||
for (uint32 iLang = 0; iLang < mLangTables.size(); iLang++)
|
||||
{
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
CTexture::CTexture(CResourceEntry *pEntry /*= 0*/)
|
||||
: CResource(pEntry)
|
||||
, mTexelFormat(eRGBA8)
|
||||
, mSourceTexelFormat(eRGBA8)
|
||||
, mTexelFormat(ETexelFormat::RGBA8)
|
||||
, mSourceTexelFormat(ETexelFormat::RGBA8)
|
||||
, mWidth(0)
|
||||
, mHeight(0)
|
||||
, mNumMipMaps(0)
|
||||
@@ -17,8 +17,8 @@ CTexture::CTexture(CResourceEntry *pEntry /*= 0*/)
|
||||
}
|
||||
|
||||
CTexture::CTexture(uint32 Width, uint32 Height)
|
||||
: mTexelFormat(eRGBA8)
|
||||
, mSourceTexelFormat(eRGBA8)
|
||||
: mTexelFormat(ETexelFormat::RGBA8)
|
||||
, mSourceTexelFormat(ETexelFormat::RGBA8)
|
||||
, mWidth((uint16) Width)
|
||||
, mHeight((uint16) Height)
|
||||
, mNumMipMaps(1)
|
||||
@@ -47,27 +47,27 @@ bool CTexture::BufferGL()
|
||||
|
||||
switch (mTexelFormat)
|
||||
{
|
||||
case eLuminance:
|
||||
case ETexelFormat::Luminance:
|
||||
GLFormat = GL_LUMINANCE;
|
||||
GLType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case eLuminanceAlpha:
|
||||
case ETexelFormat::LuminanceAlpha:
|
||||
GLFormat = GL_LUMINANCE_ALPHA;
|
||||
GLType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case eRGB565:
|
||||
case ETexelFormat::RGB565:
|
||||
GLFormat = GL_RGB;
|
||||
GLType = GL_UNSIGNED_SHORT_5_6_5;
|
||||
break;
|
||||
case eRGBA4:
|
||||
case ETexelFormat::RGBA4:
|
||||
GLFormat = GL_RGBA;
|
||||
GLType = GL_UNSIGNED_SHORT_4_4_4_4;
|
||||
break;
|
||||
case eRGBA8:
|
||||
case ETexelFormat::RGBA8:
|
||||
GLFormat = GL_RGBA;
|
||||
GLType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case eDXT1:
|
||||
case ETexelFormat::DXT1:
|
||||
GLFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
||||
IsCompressed = true;
|
||||
break;
|
||||
@@ -145,9 +145,9 @@ float CTexture::ReadTexelAlpha(const CVector2f& rkTexCoord)
|
||||
uint32 TexelX = (uint32) ((mWidth - 1) * rkTexCoord.X);
|
||||
uint32 TexelY = (uint32) ((mHeight - 1) * (1.f - fmodf(rkTexCoord.Y, 1.f)));
|
||||
|
||||
if (mTexelFormat == eDXT1 && mBufferExists)
|
||||
if (mTexelFormat == ETexelFormat::DXT1 && mBufferExists)
|
||||
{
|
||||
CMemoryInStream Buffer(mpImgDataBuffer, mImgDataSize, IOUtil::kSystemEndianness);
|
||||
CMemoryInStream Buffer(mpImgDataBuffer, mImgDataSize, EEndian::SystemEndian);
|
||||
|
||||
// 8 bytes per 4x4 16-pixel block, left-to-right top-to-bottom
|
||||
uint32 BlockIdxX = TexelX / 4;
|
||||
@@ -205,18 +205,18 @@ bool CTexture::WriteDDS(IOutputStream& rOut)
|
||||
|
||||
switch (mTexelFormat)
|
||||
{
|
||||
case eLuminance:
|
||||
case ETexelFormat::Luminance:
|
||||
PFFlags = 0x20000;
|
||||
PFBpp = 0x8;
|
||||
PFRBitMask = 0xFF;
|
||||
break;
|
||||
case eLuminanceAlpha:
|
||||
case ETexelFormat::LuminanceAlpha:
|
||||
PFFlags = 0x20001;
|
||||
PFBpp = 0x10;
|
||||
PFRBitMask = 0x00FF;
|
||||
PFABitMask = 0xFF00;
|
||||
break;
|
||||
case eRGBA4:
|
||||
case ETexelFormat::RGBA4:
|
||||
PFFlags = 0x41;
|
||||
PFBpp = 0x10;
|
||||
PFRBitMask = 0x0F00;
|
||||
@@ -224,14 +224,14 @@ bool CTexture::WriteDDS(IOutputStream& rOut)
|
||||
PFBBitMask = 0x000F;
|
||||
PFABitMask = 0xF000;
|
||||
break;
|
||||
case eRGB565:
|
||||
case ETexelFormat::RGB565:
|
||||
PFFlags = 0x40;
|
||||
PFBpp = 0x10;
|
||||
PFRBitMask = 0xF800;
|
||||
PFGBitMask = 0x7E0;
|
||||
PFBBitMask = 0x1F;
|
||||
break;
|
||||
case eRGBA8:
|
||||
case ETexelFormat::RGBA8:
|
||||
PFFlags = 0x41;
|
||||
PFBpp = 0x20;
|
||||
PFRBitMask = 0x00FF0000;
|
||||
@@ -239,13 +239,13 @@ bool CTexture::WriteDDS(IOutputStream& rOut)
|
||||
PFBBitMask = 0x000000FF;
|
||||
PFABitMask = 0xFF000000;
|
||||
break;
|
||||
case eDXT1:
|
||||
case ETexelFormat::DXT1:
|
||||
PFFlags = 0x4;
|
||||
break;
|
||||
}
|
||||
|
||||
rOut.WriteLong(PFFlags); // DDS_PIXELFORMAT.dwFlags
|
||||
(mTexelFormat == eDXT1) ? rOut.WriteFourCC(FOURCC('DXT1')) : rOut.WriteLong(0); // DDS_PIXELFORMAT.dwFourCC
|
||||
(mTexelFormat == ETexelFormat::DXT1) ? rOut.WriteFourCC(FOURCC('DXT1')) : rOut.WriteLong(0); // DDS_PIXELFORMAT.dwFourCC
|
||||
rOut.WriteLong(PFBpp); // DDS_PIXELFORMAT.dwRGBBitCount
|
||||
rOut.WriteLong(PFRBitMask); // DDS_PIXELFORMAT.dwRBitMask
|
||||
rOut.WriteLong(PFGBitMask); // DDS_PIXELFORMAT.dwGBitMask
|
||||
@@ -267,23 +267,23 @@ uint32 CTexture::FormatBPP(ETexelFormat Format)
|
||||
{
|
||||
switch (Format)
|
||||
{
|
||||
case eGX_I4: return 4;
|
||||
case eGX_I8: return 8;
|
||||
case eGX_IA4: return 8;
|
||||
case eGX_IA8: return 16;
|
||||
case eGX_C4: return 4;
|
||||
case eGX_C8: return 8;
|
||||
case eGX_RGB565: return 16;
|
||||
case eGX_RGB5A3: return 16;
|
||||
case eGX_RGBA8: return 32;
|
||||
case eGX_CMPR: return 4;
|
||||
case eLuminance: return 8;
|
||||
case eLuminanceAlpha: return 16;
|
||||
case eRGBA4: return 16;
|
||||
case eRGB565: return 16;
|
||||
case eRGBA8: return 32;
|
||||
case eDXT1: return 4;
|
||||
default: return 0;
|
||||
case ETexelFormat::GX_I4: return 4;
|
||||
case ETexelFormat::GX_I8: return 8;
|
||||
case ETexelFormat::GX_IA4: return 8;
|
||||
case ETexelFormat::GX_IA8: return 16;
|
||||
case ETexelFormat::GX_C4: return 4;
|
||||
case ETexelFormat::GX_C8: return 8;
|
||||
case ETexelFormat::GX_RGB565: return 16;
|
||||
case ETexelFormat::GX_RGB5A3: return 16;
|
||||
case ETexelFormat::GX_RGBA8: return 32;
|
||||
case ETexelFormat::GX_CMPR: return 4;
|
||||
case ETexelFormat::Luminance: return 8;
|
||||
case ETexelFormat::LuminanceAlpha: return 16;
|
||||
case ETexelFormat::RGBA4: return 16;
|
||||
case ETexelFormat::RGB565: return 16;
|
||||
case ETexelFormat::RGBA8: return 32;
|
||||
case ETexelFormat::DXT1: return 4;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ void CTexture::CopyGLBuffer()
|
||||
MipH /= 2;
|
||||
}
|
||||
|
||||
mTexelFormat = eRGBA8;
|
||||
mTexelFormat = ETexelFormat::RGBA8;
|
||||
mLinearSize = mWidth * mHeight * 4;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
class CTexture : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eTexture)
|
||||
DECLARE_RESOURCE_TYPE(Texture)
|
||||
friend class CTextureDecoder;
|
||||
friend class CTextureEncoder;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
class CWorld : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eWorld)
|
||||
DECLARE_RESOURCE_TYPE(World)
|
||||
friend class CWorldLoader;
|
||||
friend class CWorldCooker;
|
||||
|
||||
|
||||
@@ -9,26 +9,26 @@ CMaterialCooker::CMaterialCooker()
|
||||
uint32 CMaterialCooker::ConvertFromVertexDescription(FVertexDescription VtxDesc)
|
||||
{
|
||||
uint32 Flags = 0;
|
||||
if (VtxDesc & ePosition) Flags |= 0x00000003;
|
||||
if (VtxDesc & eNormal) Flags |= 0x0000000C;
|
||||
if (VtxDesc & eColor0) Flags |= 0x00000030;
|
||||
if (VtxDesc & eColor1) Flags |= 0x000000C0;
|
||||
if (VtxDesc & eTex0) Flags |= 0x00000300;
|
||||
if (VtxDesc & eTex1) Flags |= 0x00000C00;
|
||||
if (VtxDesc & eTex2) Flags |= 0x00003000;
|
||||
if (VtxDesc & eTex3) Flags |= 0x0000C000;
|
||||
if (VtxDesc & eTex4) Flags |= 0x00030000;
|
||||
if (VtxDesc & eTex5) Flags |= 0x000C0000;
|
||||
if (VtxDesc & eTex6) Flags |= 0x00300000;
|
||||
if (VtxDesc & eTex7) Flags |= 0x00C00000;
|
||||
if (VtxDesc & ePosMtx) Flags |= 0x01000000;
|
||||
if (VtxDesc & eTex0Mtx) Flags |= 0x02000000;
|
||||
if (VtxDesc & eTex1Mtx) Flags |= 0x04000000;
|
||||
if (VtxDesc & eTex2Mtx) Flags |= 0x08000000;
|
||||
if (VtxDesc & eTex3Mtx) Flags |= 0x10000000;
|
||||
if (VtxDesc & eTex4Mtx) Flags |= 0x20000000;
|
||||
if (VtxDesc & eTex5Mtx) Flags |= 0x40000000;
|
||||
if (VtxDesc & eTex6Mtx) Flags |= 0x80000000;
|
||||
if (VtxDesc & EVertexAttribute::Position) Flags |= 0x00000003;
|
||||
if (VtxDesc & EVertexAttribute::Normal) Flags |= 0x0000000C;
|
||||
if (VtxDesc & EVertexAttribute::Color0) Flags |= 0x00000030;
|
||||
if (VtxDesc & EVertexAttribute::Color1) Flags |= 0x000000C0;
|
||||
if (VtxDesc & EVertexAttribute::Tex0) Flags |= 0x00000300;
|
||||
if (VtxDesc & EVertexAttribute::Tex1) Flags |= 0x00000C00;
|
||||
if (VtxDesc & EVertexAttribute::Tex2) Flags |= 0x00003000;
|
||||
if (VtxDesc & EVertexAttribute::Tex3) Flags |= 0x0000C000;
|
||||
if (VtxDesc & EVertexAttribute::Tex4) Flags |= 0x00030000;
|
||||
if (VtxDesc & EVertexAttribute::Tex5) Flags |= 0x000C0000;
|
||||
if (VtxDesc & EVertexAttribute::Tex6) Flags |= 0x00300000;
|
||||
if (VtxDesc & EVertexAttribute::Tex7) Flags |= 0x00C00000;
|
||||
if (VtxDesc & EVertexAttribute::PosMtx) Flags |= 0x01000000;
|
||||
if (VtxDesc & EVertexAttribute::Tex0Mtx) Flags |= 0x02000000;
|
||||
if (VtxDesc & EVertexAttribute::Tex1Mtx) Flags |= 0x04000000;
|
||||
if (VtxDesc & EVertexAttribute::Tex2Mtx) Flags |= 0x08000000;
|
||||
if (VtxDesc & EVertexAttribute::Tex3Mtx) Flags |= 0x10000000;
|
||||
if (VtxDesc & EVertexAttribute::Tex4Mtx) Flags |= 0x20000000;
|
||||
if (VtxDesc & EVertexAttribute::Tex5Mtx) Flags |= 0x40000000;
|
||||
if (VtxDesc & EVertexAttribute::Tex6Mtx) Flags |= 0x80000000;
|
||||
return Flags;
|
||||
}
|
||||
|
||||
@@ -98,19 +98,20 @@ void CMaterialCooker::WriteMatSetCorruption(IOutputStream& /*rOut*/)
|
||||
void CMaterialCooker::WriteMaterialPrime(IOutputStream& rOut)
|
||||
{
|
||||
// Gather data from the passes before we start writing
|
||||
uint32 TexFlags = 0;
|
||||
uint32 NumKonst = 0;
|
||||
std::vector<uint32> TexIndices;
|
||||
uint TexFlags = 0;
|
||||
uint NumKonst = 0;
|
||||
std::vector<uint> TexIndices;
|
||||
|
||||
for (uint32 iPass = 0; iPass < mpMat->mPasses.size(); iPass++)
|
||||
for (uint iPass = 0; iPass < mpMat->mPasses.size(); iPass++)
|
||||
{
|
||||
CMaterialPass *pPass = mpMat->Pass(iPass);
|
||||
|
||||
if ((pPass->KColorSel() >= 0xC) || (pPass->KAlphaSel() >= 0x10))
|
||||
if ((pPass->KColorSel() >= kKonst0_RGB) ||
|
||||
(pPass->KAlphaSel() >= kKonst0_R))
|
||||
{
|
||||
// Determine the highest Konst index being used
|
||||
uint32 KColorIndex = pPass->KColorSel() % 4;
|
||||
uint32 KAlphaIndex = pPass->KAlphaSel() % 4;
|
||||
uint KColorIndex = ((uint) pPass->KColorSel()) % 4;
|
||||
uint KAlphaIndex = ((uint) pPass->KAlphaSel()) % 4;
|
||||
|
||||
if (KColorIndex >= NumKonst)
|
||||
NumKonst = KColorIndex + 1;
|
||||
@@ -272,14 +273,14 @@ void CMaterialCooker::WriteMaterialPrime(IOutputStream& rOut)
|
||||
CMaterialPass *pPass = mpMat->Pass(iPass);
|
||||
if (pPass->Texture() == nullptr) continue;
|
||||
|
||||
uint32 AnimType = pPass->AnimMode();
|
||||
EUVAnimMode AnimType = pPass->AnimMode();
|
||||
uint32 CoordSource = pPass->TexCoordSource();
|
||||
|
||||
uint32 TexMtxIdx, PostMtxIdx;
|
||||
bool Normalize;
|
||||
|
||||
// No animation - set TexMtx and PostMtx to identity, disable normalization
|
||||
if (AnimType == eNoUVAnim)
|
||||
if (AnimType == EUVAnimMode::NoUVAnim)
|
||||
{
|
||||
TexMtxIdx = 30;
|
||||
PostMtxIdx = 61;
|
||||
@@ -291,7 +292,7 @@ void CMaterialCooker::WriteMaterialPrime(IOutputStream& rOut)
|
||||
{
|
||||
TexMtxIdx = CurTexMtx;
|
||||
|
||||
if ((AnimType < 2) || (AnimType > 5))
|
||||
if ((AnimType <= EUVAnimMode::InverseMVTranslated) || (AnimType >= EUVAnimMode::ModelMatrix))
|
||||
{
|
||||
PostMtxIdx = CurTexMtx;
|
||||
Normalize = true;
|
||||
@@ -318,17 +319,17 @@ void CMaterialCooker::WriteMaterialPrime(IOutputStream& rOut)
|
||||
for (uint32 iPass = 0; iPass < NumPasses; iPass++)
|
||||
{
|
||||
CMaterialPass *pPass = mpMat->Pass(iPass);
|
||||
uint32 AnimMode = pPass->AnimMode();
|
||||
if (AnimMode == eNoUVAnim) continue;
|
||||
EUVAnimMode AnimMode = pPass->AnimMode();
|
||||
if (AnimMode == EUVAnimMode::NoUVAnim) continue;
|
||||
|
||||
rOut.WriteLong(AnimMode);
|
||||
rOut.WriteLong((int) AnimMode);
|
||||
|
||||
if ((AnimMode > 1) && (AnimMode != 6))
|
||||
if ((AnimMode >= EUVAnimMode::UVScroll) && (AnimMode != EUVAnimMode::ModelMatrix))
|
||||
{
|
||||
rOut.WriteFloat(pPass->AnimParam(0));
|
||||
rOut.WriteFloat(pPass->AnimParam(1));
|
||||
|
||||
if ((AnimMode == 2) || (AnimMode == 4) || (AnimMode == 5))
|
||||
if ((AnimMode == EUVAnimMode::UVScroll) || (AnimMode == EUVAnimMode::HFilmstrip) || (AnimMode == EUVAnimMode::VFilmstrip))
|
||||
{
|
||||
rOut.WriteFloat(pPass->AnimParam(2));
|
||||
rOut.WriteFloat(pPass->AnimParam(3));
|
||||
|
||||
@@ -18,7 +18,7 @@ void CModelCooker::GenerateSurfaceData()
|
||||
mVertices.resize(mNumVertices);
|
||||
|
||||
// Get vertex attributes
|
||||
mVtxAttribs = eNoAttributes;
|
||||
mVtxAttribs = EVertexAttribute::None;
|
||||
|
||||
for (uint32 iMat = 0; iMat < mpModel->GetMatCount(); iMat++)
|
||||
{
|
||||
@@ -115,7 +115,8 @@ void CModelCooker::WriteModelPrime(IOutputStream& rOut)
|
||||
// Float UV coordinates
|
||||
for (uint32 iTexSlot = 0; iTexSlot < 8; iTexSlot++)
|
||||
{
|
||||
bool HasTexSlot = (mVtxAttribs & (eTex0 << iTexSlot)) != 0;
|
||||
uint TexSlotBit = ((uint) (EVertexAttribute::Tex0)) << iTexSlot;
|
||||
bool HasTexSlot = (mVtxAttribs & TexSlotBit) != 0;
|
||||
if (HasTexSlot)
|
||||
{
|
||||
for (uint32 iTex = 0; iTex < mNumVertices; iTex++)
|
||||
@@ -171,28 +172,35 @@ void CModelCooker::WriteModelPrime(IOutputStream& rOut)
|
||||
if (mVersion == EGame::Echoes)
|
||||
{
|
||||
for (uint32 iMtxAttribs = 0; iMtxAttribs < 8; iMtxAttribs++)
|
||||
if (VtxAttribs & (ePosMtx << iMtxAttribs))
|
||||
{
|
||||
uint MatrixBit = ((uint) (EVertexAttribute::PosMtx) << iMtxAttribs);
|
||||
if (VtxAttribs & MatrixBit)
|
||||
{
|
||||
rOut.WriteByte(pVert->MatrixIndices[iMtxAttribs]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint16 VertexIndex = (uint16) pVert->ArrayPosition;
|
||||
|
||||
if (VtxAttribs & ePosition)
|
||||
if (VtxAttribs & EVertexAttribute::Position)
|
||||
rOut.WriteShort(VertexIndex);
|
||||
|
||||
if (VtxAttribs & eNormal)
|
||||
if (VtxAttribs & EVertexAttribute::Normal)
|
||||
rOut.WriteShort(VertexIndex);
|
||||
|
||||
if (VtxAttribs & eColor0)
|
||||
if (VtxAttribs & EVertexAttribute::Color0)
|
||||
rOut.WriteShort(VertexIndex);
|
||||
|
||||
if (VtxAttribs & eColor1)
|
||||
if (VtxAttribs & EVertexAttribute::Color1)
|
||||
rOut.WriteShort(VertexIndex);
|
||||
|
||||
uint16 TexOffset = 0;
|
||||
for (uint32 iTex = 0; iTex < 8; iTex++)
|
||||
{
|
||||
if (VtxAttribs & (eTex0 << iTex))
|
||||
uint TexBit = ((uint) EVertexAttribute::Tex0) << iTex;
|
||||
|
||||
if (VtxAttribs & TexBit)
|
||||
{
|
||||
rOut.WriteShort(VertexIndex + TexOffset);
|
||||
TexOffset += (uint16) mNumVertices;
|
||||
|
||||
@@ -20,10 +20,10 @@ public:
|
||||
|
||||
switch (pEntry->ResourceType())
|
||||
{
|
||||
case eArea: return CAreaCooker::CookMREA((CGameArea*) pRes, rOutput);
|
||||
case eModel: return CModelCooker::CookCMDL((CModel*) pRes, rOutput);
|
||||
case eStaticGeometryMap: return CPoiToWorldCooker::CookEGMC((CPoiToWorld*) pRes, rOutput);
|
||||
case eWorld: return CWorldCooker::CookMLVL((CWorld*) pRes, rOutput);
|
||||
case EResourceType::Area: return CAreaCooker::CookMREA((CGameArea*) pRes, rOutput);
|
||||
case EResourceType::Model: return CModelCooker::CookCMDL((CModel*) pRes, rOutput);
|
||||
case EResourceType::StaticGeometryMap: return CPoiToWorldCooker::CookEGMC((CPoiToWorld*) pRes, rOutput);
|
||||
case EResourceType::World: return CWorldCooker::CookMLVL((CWorld*) pRes, rOutput);
|
||||
|
||||
default:
|
||||
warnf("Failed to cook %s asset; this resource type is not supported for cooking", *pEntry->CookedExtension().ToString());
|
||||
|
||||
@@ -250,12 +250,12 @@ void CScriptCooker::WriteInstance(IOutputStream& rOut, CScriptObject *pInstance)
|
||||
uint32 InstanceID = (pInstance->Layer()->AreaIndex() << 26) | pInstance->InstanceID();
|
||||
rOut.WriteLong(InstanceID);
|
||||
|
||||
uint32 NumLinks = pInstance->NumLinks(eOutgoing);
|
||||
uint32 NumLinks = pInstance->NumLinks(ELinkType::Outgoing);
|
||||
IsPrime1 ? rOut.WriteLong(NumLinks) : rOut.WriteShort((uint16) NumLinks);
|
||||
|
||||
for (uint32 LinkIdx = 0; LinkIdx < NumLinks; LinkIdx++)
|
||||
{
|
||||
CLink *pLink = pInstance->Link(eOutgoing, LinkIdx);
|
||||
CLink *pLink = pInstance->Link(ELinkType::Outgoing, LinkIdx);
|
||||
rOut.WriteLong(pLink->State());
|
||||
rOut.WriteLong(pLink->Message());
|
||||
rOut.WriteLong(pLink->ReceiverID());
|
||||
@@ -298,9 +298,9 @@ void CScriptCooker::WriteLayer(IOutputStream& rOut, CScriptLayer *pLayer)
|
||||
// Generate/Attach message (MP3+) should be written to SCGN, not SCLY
|
||||
else
|
||||
{
|
||||
for (uint32 LinkIdx = 0; LinkIdx < pInstance->NumLinks(eIncoming); LinkIdx++)
|
||||
for (uint32 LinkIdx = 0; LinkIdx < pInstance->NumLinks(ELinkType::Incoming); LinkIdx++)
|
||||
{
|
||||
CLink *pLink = pInstance->Link(eIncoming, LinkIdx);
|
||||
CLink *pLink = pInstance->Link(ELinkType::Incoming, LinkIdx);
|
||||
|
||||
if (mGame <= EGame::Echoes)
|
||||
{
|
||||
|
||||
@@ -9,14 +9,14 @@ CTextureEncoder::CTextureEncoder()
|
||||
void CTextureEncoder::WriteTXTR(IOutputStream& rTXTR)
|
||||
{
|
||||
// Only DXT1->CMPR supported at the moment
|
||||
rTXTR.WriteLong(mOutputFormat);
|
||||
rTXTR.WriteLong((uint) mOutputFormat);
|
||||
rTXTR.WriteShort(mpTexture->mWidth);
|
||||
rTXTR.WriteShort(mpTexture->mHeight);
|
||||
rTXTR.WriteLong(mpTexture->mNumMipMaps);
|
||||
|
||||
uint32 MipW = mpTexture->Width() / 4;
|
||||
uint32 MipH = mpTexture->Height() / 4;
|
||||
CMemoryInStream Image(mpTexture->mpImgDataBuffer, mpTexture->mImgDataSize, IOUtil::eLittleEndian);
|
||||
CMemoryInStream Image(mpTexture->mpImgDataBuffer, mpTexture->mImgDataSize, EEndian::LittleEndian);
|
||||
uint32 MipOffset = Image.Tell();
|
||||
|
||||
for (uint32 iMip = 0; iMip < mpTexture->mNumMipMaps; iMip++)
|
||||
@@ -61,7 +61,7 @@ void CTextureEncoder::ReadSubBlockCMPR(IInputStream& rSource, IOutputStream& rDe
|
||||
// ************ STATIC ************
|
||||
void CTextureEncoder::EncodeTXTR(IOutputStream& rTXTR, CTexture *pTex)
|
||||
{
|
||||
if (pTex->mTexelFormat != eDXT1)
|
||||
if (pTex->mTexelFormat != ETexelFormat::DXT1)
|
||||
{
|
||||
errorf("Unsupported texel format for decoding");
|
||||
return;
|
||||
@@ -69,8 +69,8 @@ void CTextureEncoder::EncodeTXTR(IOutputStream& rTXTR, CTexture *pTex)
|
||||
|
||||
CTextureEncoder Encoder;
|
||||
Encoder.mpTexture = pTex;
|
||||
Encoder.mSourceFormat = eDXT1;
|
||||
Encoder.mOutputFormat = eGX_CMPR;
|
||||
Encoder.mSourceFormat = ETexelFormat::DXT1;
|
||||
Encoder.mOutputFormat = ETexelFormat::GX_CMPR;
|
||||
Encoder.WriteTXTR(rTXTR);
|
||||
}
|
||||
|
||||
@@ -84,13 +84,13 @@ ETexelFormat CTextureEncoder::GetGXFormat(ETexelFormat Format)
|
||||
{
|
||||
switch (Format)
|
||||
{
|
||||
case eLuminance: return eGX_I8;
|
||||
case eLuminanceAlpha: return eGX_IA8;
|
||||
case eRGBA4: return eGX_RGB5A3;
|
||||
case eRGB565: return eGX_RGB565;
|
||||
case eRGBA8: return eGX_RGBA8;
|
||||
case eDXT1: return eGX_CMPR;
|
||||
default: return eInvalidTexelFormat;
|
||||
case ETexelFormat::Luminance: return ETexelFormat::GX_I8;
|
||||
case ETexelFormat::LuminanceAlpha: return ETexelFormat::GX_IA8;
|
||||
case ETexelFormat::RGBA4: return ETexelFormat::GX_RGB5A3;
|
||||
case ETexelFormat::RGB565: return ETexelFormat::GX_RGB565;
|
||||
case ETexelFormat::RGBA8: return ETexelFormat::GX_RGBA8;
|
||||
case ETexelFormat::DXT1: return ETexelFormat::GX_CMPR;
|
||||
default: return ETexelFormat::Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,12 +98,12 @@ ETexelFormat CTextureEncoder::GetFormat(ETexelFormat Format)
|
||||
{
|
||||
switch (Format)
|
||||
{
|
||||
case eGX_I4: return eLuminance;
|
||||
case eGX_I8: return eLuminance;
|
||||
case eGX_IA4: return eLuminanceAlpha;
|
||||
case eGX_IA8: return eLuminanceAlpha;
|
||||
case ETexelFormat::GX_I4: return ETexelFormat::Luminance;
|
||||
case ETexelFormat::GX_I8: return ETexelFormat::Luminance;
|
||||
case ETexelFormat::GX_IA4: return ETexelFormat::LuminanceAlpha;
|
||||
case ETexelFormat::GX_IA8: return ETexelFormat::LuminanceAlpha;
|
||||
// todo rest of these
|
||||
case eGX_CMPR: return eDXT1;
|
||||
default: return eInvalidTexelFormat;
|
||||
case ETexelFormat::GX_CMPR: return ETexelFormat::DXT1;
|
||||
default: return ETexelFormat::Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ bool CWorldCooker::CookMLVL(CWorld *pWorld, IOutputStream& rMLVL)
|
||||
// Area Header
|
||||
CWorld::SArea& rArea = pWorld->mAreas[iArea];
|
||||
CResourceEntry *pAreaEntry = gpResourceStore->FindEntry(rArea.AreaResID);
|
||||
ASSERT(pAreaEntry && pAreaEntry->ResourceType() == eArea);
|
||||
ASSERT(pAreaEntry && pAreaEntry->ResourceType() == EResourceType::Area);
|
||||
|
||||
CAssetID AreaNameID = rArea.pAreaName ? rArea.pAreaName->ID() : CAssetID::InvalidID(Game);
|
||||
AreaNameID.Write(rMLVL);
|
||||
|
||||
@@ -1,81 +1,81 @@
|
||||
#ifndef ERESTYPE
|
||||
#define ERESTYPE
|
||||
#ifndef ERESOURCETYPE
|
||||
#define ERESOURCETYPE
|
||||
|
||||
#include <Common/EGame.h>
|
||||
#include <Common/TString.h>
|
||||
|
||||
enum EResType
|
||||
enum class EResourceType
|
||||
{
|
||||
eAnimation,
|
||||
eAnimCollisionPrimData,
|
||||
eAnimEventData,
|
||||
eAnimSet,
|
||||
eArea,
|
||||
eAreaCollision,
|
||||
eAreaGeometry,
|
||||
eAreaLights,
|
||||
eAreaMaterials,
|
||||
eAreaSurfaceBounds,
|
||||
eAreaOctree,
|
||||
eAreaVisibilityTree,
|
||||
eAudioAmplitudeData,
|
||||
eAudioGroup,
|
||||
eAudioMacro,
|
||||
eAudioSample,
|
||||
eAudioLookupTable,
|
||||
eBinaryData,
|
||||
eBurstFireData,
|
||||
eCharacter,
|
||||
eDependencyGroup,
|
||||
eDynamicCollision,
|
||||
eFont,
|
||||
eGuiFrame,
|
||||
eGuiKeyFrame,
|
||||
eHintSystem,
|
||||
eMapArea,
|
||||
eMapWorld,
|
||||
eMapUniverse,
|
||||
eMidi,
|
||||
eModel,
|
||||
eMusicTrack,
|
||||
ePackage,
|
||||
eParticle,
|
||||
eParticleCollisionResponse,
|
||||
eParticleDecal,
|
||||
eParticleElectric,
|
||||
eParticleSorted,
|
||||
eParticleSpawn,
|
||||
eParticleSwoosh,
|
||||
eParticleTransform,
|
||||
eParticleWeapon,
|
||||
ePathfinding,
|
||||
ePortalArea,
|
||||
eResource,
|
||||
eRuleSet,
|
||||
eSaveArea,
|
||||
eSaveWorld,
|
||||
eScan,
|
||||
eSkeleton,
|
||||
eSkin,
|
||||
eSourceAnimData,
|
||||
eSpatialPrimitive,
|
||||
eStateMachine,
|
||||
eStateMachine2, // For distinguishing AFSM/FSM2
|
||||
eStaticGeometryMap,
|
||||
eStreamedAudio,
|
||||
eStringList,
|
||||
eStringTable,
|
||||
eTexture,
|
||||
eTweak,
|
||||
eUserEvaluatorData,
|
||||
eVideo,
|
||||
eWorld,
|
||||
Animation,
|
||||
AnimCollisionPrimData,
|
||||
AnimEventData,
|
||||
AnimSet,
|
||||
Area,
|
||||
AreaCollision,
|
||||
AreaGeometry,
|
||||
AreaLights,
|
||||
AreaMaterials,
|
||||
AreaSurfaceBounds,
|
||||
AreaOctree,
|
||||
AreaVisibilityTree,
|
||||
AudioAmplitudeData,
|
||||
AudioGroup,
|
||||
AudioMacro,
|
||||
AudioSample,
|
||||
AudioLookupTable,
|
||||
BinaryData,
|
||||
BurstFireData,
|
||||
Character,
|
||||
DependencyGroup,
|
||||
DynamicCollision,
|
||||
Font,
|
||||
GuiFrame,
|
||||
GuiKeyFrame,
|
||||
HintSystem,
|
||||
MapArea,
|
||||
MapWorld,
|
||||
MapUniverse,
|
||||
Midi,
|
||||
Model,
|
||||
MusicTrack,
|
||||
Package,
|
||||
Particle,
|
||||
ParticleCollisionResponse,
|
||||
ParticleDecal,
|
||||
ParticleElectric,
|
||||
ParticleSorted,
|
||||
ParticleSpawn,
|
||||
ParticleSwoosh,
|
||||
ParticleTransform,
|
||||
ParticleWeapon,
|
||||
Pathfinding,
|
||||
PortalArea,
|
||||
Resource,
|
||||
RuleSet,
|
||||
SaveArea,
|
||||
SaveWorld,
|
||||
Scan,
|
||||
Skeleton,
|
||||
Skin,
|
||||
SourceAnimData,
|
||||
SpatialPrimitive,
|
||||
StateMachine,
|
||||
StateMachine2, // For distinguishing AFSM/FSM2
|
||||
StaticGeometryMap,
|
||||
StreamedAudio,
|
||||
StringList,
|
||||
StringTable,
|
||||
Texture,
|
||||
Tweak,
|
||||
UserEvaluatorData,
|
||||
Video,
|
||||
World,
|
||||
|
||||
eInvalidResType = -1
|
||||
Invalid = -1
|
||||
};
|
||||
|
||||
// Defined in CResTypeInfo.cpp
|
||||
void Serialize(IArchive& rArc, EResType& rType);
|
||||
void Serialize(IArchive& rArc, EResourceType& rType);
|
||||
|
||||
#endif // ERESTYPE
|
||||
#endif // ERESOURCETYPE
|
||||
|
||||
|
||||
@@ -3,103 +3,103 @@
|
||||
|
||||
enum ETevColorInput
|
||||
{
|
||||
ePrevRGB = 0x0,
|
||||
ePrevAAA = 0x1,
|
||||
eColor0RGB = 0x2,
|
||||
eColor0AAA = 0x3,
|
||||
eColor1RGB = 0x4,
|
||||
eColor1AAA = 0x5,
|
||||
eColor2RGB = 0x6,
|
||||
eColor2AAA = 0x7,
|
||||
eTextureRGB = 0x8,
|
||||
eTextureAAA = 0x9,
|
||||
eRasRGB = 0xA,
|
||||
eRasAAA = 0xB,
|
||||
eOneRGB = 0xC,
|
||||
eHalfRGB = 0xD,
|
||||
eKonstRGB = 0xE,
|
||||
eZeroRGB = 0xF
|
||||
kPrevRGB = 0x0,
|
||||
kPrevAAA = 0x1,
|
||||
kColor0RGB = 0x2,
|
||||
kColor0AAA = 0x3,
|
||||
kColor1RGB = 0x4,
|
||||
kColor1AAA = 0x5,
|
||||
kColor2RGB = 0x6,
|
||||
kColor2AAA = 0x7,
|
||||
kTextureRGB = 0x8,
|
||||
kTextureAAA = 0x9,
|
||||
kRasRGB = 0xA,
|
||||
kRasAAA = 0xB,
|
||||
kOneRGB = 0xC,
|
||||
kHalfRGB = 0xD,
|
||||
kKonstRGB = 0xE,
|
||||
kZeroRGB = 0xF
|
||||
};
|
||||
|
||||
enum ETevAlphaInput
|
||||
{
|
||||
ePrevAlpha = 0x0,
|
||||
eColor0Alpha = 0x1,
|
||||
eColor1Alpha = 0x2,
|
||||
eColor2Alpha = 0x3,
|
||||
eTextureAlpha = 0x4,
|
||||
eRasAlpha = 0x5,
|
||||
eKonstAlpha = 0x6,
|
||||
eZeroAlpha = 0x7
|
||||
kPrevAlpha = 0x0,
|
||||
kColor0Alpha = 0x1,
|
||||
kColor1Alpha = 0x2,
|
||||
kColor2Alpha = 0x3,
|
||||
kTextureAlpha = 0x4,
|
||||
kRasAlpha = 0x5,
|
||||
kKonstAlpha = 0x6,
|
||||
kZeroAlpha = 0x7
|
||||
};
|
||||
|
||||
enum ETevOutput
|
||||
{
|
||||
ePrevReg = 0x0,
|
||||
eColor0Reg = 0x1,
|
||||
eColor1Reg = 0x2,
|
||||
eColor2Reg = 0x3
|
||||
kPrevReg = 0x0,
|
||||
kColor0Reg = 0x1,
|
||||
kColor1Reg = 0x2,
|
||||
kColor2Reg = 0x3
|
||||
};
|
||||
|
||||
enum ETevKSel
|
||||
{
|
||||
eKonstOne = 0x0,
|
||||
eKonstSevenEighths = 0x1,
|
||||
eKonstThreeFourths = 0x2,
|
||||
eKonstFiveEighths = 0x3,
|
||||
eKonstOneHalf = 0x4,
|
||||
eKonstThreeEighths = 0x5,
|
||||
eKonstOneFourth = 0x6,
|
||||
eKonstOneEighth = 0x7,
|
||||
eKonst0_RGB = 0xC,
|
||||
eKonst1_RGB = 0xD,
|
||||
eKonst2_RGB = 0xE,
|
||||
eKonst3_RGB = 0xF,
|
||||
eKonst0_R = 0x10,
|
||||
eKonst1_R = 0x11,
|
||||
eKonst2_R = 0x12,
|
||||
eKonst3_R = 0x13,
|
||||
eKonst0_G = 0x14,
|
||||
eKonst1_G = 0x15,
|
||||
eKonst2_G = 0x16,
|
||||
eKonst3_G = 0x17,
|
||||
eKonst0_B = 0x18,
|
||||
eKonst1_B = 0x19,
|
||||
eKonst2_B = 0x1A,
|
||||
eKonst3_B = 0x1B,
|
||||
eKonst0_A = 0x1C,
|
||||
eKonst1_A = 0x1D,
|
||||
eKonst2_A = 0x1E,
|
||||
eKonst3_A = 0x1F
|
||||
kKonstOne = 0x0,
|
||||
kKonstSevenEighths = 0x1,
|
||||
kKonstThreeFourths = 0x2,
|
||||
kKonstFiveEighths = 0x3,
|
||||
kKonstOneHalf = 0x4,
|
||||
kKonstThreeEighths = 0x5,
|
||||
kKonstOneFourth = 0x6,
|
||||
kKonstOneEighth = 0x7,
|
||||
kKonst0_RGB = 0xC,
|
||||
kKonst1_RGB = 0xD,
|
||||
kKonst2_RGB = 0xE,
|
||||
kKonst3_RGB = 0xF,
|
||||
kKonst0_R = 0x10,
|
||||
kKonst1_R = 0x11,
|
||||
kKonst2_R = 0x12,
|
||||
kKonst3_R = 0x13,
|
||||
kKonst0_G = 0x14,
|
||||
kKonst1_G = 0x15,
|
||||
kKonst2_G = 0x16,
|
||||
kKonst3_G = 0x17,
|
||||
kKonst0_B = 0x18,
|
||||
kKonst1_B = 0x19,
|
||||
kKonst2_B = 0x1A,
|
||||
kKonst3_B = 0x1B,
|
||||
kKonst0_A = 0x1C,
|
||||
kKonst1_A = 0x1D,
|
||||
kKonst2_A = 0x1E,
|
||||
kKonst3_A = 0x1F
|
||||
};
|
||||
|
||||
enum ETevRasSel
|
||||
{
|
||||
eRasColor0 = 0x0,
|
||||
eRasColor1 = 0x1,
|
||||
eRasAlpha0 = 0x2,
|
||||
eRasAlpha1 = 0x3,
|
||||
eRasColor0A0 = 0x4,
|
||||
eRasColor1A1 = 0x5,
|
||||
eRasColorZero = 0x6,
|
||||
eRasAlphaBump = 0x7,
|
||||
eRasAlphaBumpN = 0x8,
|
||||
eRasColorNull = 0xFF
|
||||
kRasColor0 = 0x0,
|
||||
kRasColor1 = 0x1,
|
||||
kRasAlpha0 = 0x2,
|
||||
kRasAlpha1 = 0x3,
|
||||
kRasColor0A0 = 0x4,
|
||||
kRasColor1A1 = 0x5,
|
||||
kRasColorZero = 0x6,
|
||||
kRasAlphaBump = 0x7,
|
||||
kRasAlphaBumpN = 0x8,
|
||||
kRasColorNull = 0xFF
|
||||
};
|
||||
|
||||
enum EUVAnimMode
|
||||
enum class EUVAnimMode
|
||||
{
|
||||
eInverseMV = 0x0,
|
||||
eInverseMVTranslated = 0x1,
|
||||
eUVScroll = 0x2,
|
||||
eUVRotation = 0x3,
|
||||
eHFilmstrip = 0x4,
|
||||
eVFilmstrip = 0x5,
|
||||
eModelMatrix = 0x6,
|
||||
eConvolutedModeA = 0x7,
|
||||
eConvolutedModeB = 0x8,
|
||||
eSimpleMode = 0xA,
|
||||
eNoUVAnim = 0xFFFFFFFF
|
||||
InverseMV = 0x0,
|
||||
InverseMVTranslated = 0x1,
|
||||
UVScroll = 0x2,
|
||||
UVRotation = 0x3,
|
||||
HFilmstrip = 0x4,
|
||||
VFilmstrip = 0x5,
|
||||
ModelMatrix = 0x6,
|
||||
ConvolutedModeA = 0x7,
|
||||
ConvolutedModeB = 0x8,
|
||||
SimpleMode = 0xA,
|
||||
NoUVAnim = -1
|
||||
};
|
||||
|
||||
#endif // ETEVENUMS
|
||||
|
||||
@@ -2,36 +2,36 @@
|
||||
#define ETEXELFORMAT
|
||||
|
||||
// ETexelFormat - supported internal formats for decoded textures
|
||||
enum ETexelFormat
|
||||
enum class ETexelFormat
|
||||
{
|
||||
// Supported texel formats in GX using Retro's numbering
|
||||
eGX_I4 = 0x0,
|
||||
eGX_I8 = 0x1,
|
||||
eGX_IA4 = 0x2,
|
||||
eGX_IA8 = 0x3,
|
||||
eGX_C4 = 0x4,
|
||||
eGX_C8 = 0x5,
|
||||
eGX_C14x2 = 0x6,
|
||||
eGX_RGB565 = 0x7,
|
||||
eGX_RGB5A3 = 0x8,
|
||||
eGX_RGBA8 = 0x9,
|
||||
eGX_CMPR = 0xA,
|
||||
GX_I4 = 0x0,
|
||||
GX_I8 = 0x1,
|
||||
GX_IA4 = 0x2,
|
||||
GX_IA8 = 0x3,
|
||||
GX_C4 = 0x4,
|
||||
GX_C8 = 0x5,
|
||||
GX_C14x2 = 0x6,
|
||||
GX_RGB565 = 0x7,
|
||||
GX_RGB5A3 = 0x8,
|
||||
GX_RGBA8 = 0x9,
|
||||
GX_CMPR = 0xA,
|
||||
// Supported internal texel formats for decoded textures
|
||||
eLuminance,
|
||||
eLuminanceAlpha,
|
||||
eRGBA4,
|
||||
eRGB565,
|
||||
eRGBA8,
|
||||
eDXT1,
|
||||
eInvalidTexelFormat
|
||||
Luminance,
|
||||
LuminanceAlpha,
|
||||
RGBA4,
|
||||
RGB565,
|
||||
RGBA8,
|
||||
DXT1,
|
||||
Invalid = -1
|
||||
};
|
||||
|
||||
// EGXPaletteFormat - GX's supported palette texel formats for C4/C8
|
||||
enum EGXPaletteFormat
|
||||
enum class EGXPaletteFormat
|
||||
{
|
||||
ePalette_IA8 = 0,
|
||||
ePalette_RGB565 = 1,
|
||||
ePalette_RGB5A3 = 2
|
||||
IA8 = 0,
|
||||
RGB565 = 1,
|
||||
RGB5A3 = 2
|
||||
};
|
||||
|
||||
#endif // ETEXELFORMAT
|
||||
|
||||
@@ -24,13 +24,13 @@ CAnimSet* CAnimSetLoader::LoadCorruptionCHAR(IInputStream& rCHAR)
|
||||
{
|
||||
SOverlayModel Overlay;
|
||||
Overlay.Type = (EOverlayType) rCHAR.ReadLong();
|
||||
Overlay.ModelID = CAssetID(rCHAR, e64Bit);
|
||||
Overlay.SkinID = CAssetID(rCHAR, e64Bit);
|
||||
Overlay.ModelID = CAssetID(rCHAR, k64Bit);
|
||||
Overlay.SkinID = CAssetID(rCHAR, k64Bit);
|
||||
rChar.OverlayModels.push_back(Overlay);
|
||||
}
|
||||
|
||||
rChar.pSkeleton = gpResourceStore->LoadResource<CSkeleton>(rCHAR.ReadLongLong());
|
||||
rChar.AnimDataID = CAssetID(rCHAR, e64Bit);
|
||||
rChar.AnimDataID = CAssetID(rCHAR, k64Bit);
|
||||
|
||||
// PAS Database
|
||||
LoadPASDatabase(rCHAR);
|
||||
@@ -88,7 +88,7 @@ CAnimSet* CAnimSetLoader::LoadCorruptionCHAR(IInputStream& rCHAR)
|
||||
|
||||
for (uint32 SoundIdx = 0; SoundIdx < NumSounds; SoundIdx++)
|
||||
{
|
||||
CAssetID SoundID(rCHAR, e64Bit);
|
||||
CAssetID SoundID(rCHAR, k64Bit);
|
||||
rChar.SoundEffects.push_back(SoundID);
|
||||
}
|
||||
|
||||
@@ -581,7 +581,7 @@ CAnimSet* CAnimSetLoader::LoadANCS(IInputStream& rANCS, CResourceEntry *pEntry)
|
||||
{
|
||||
rANCS.ReadString();
|
||||
rANCS.Seek(0x4, SEEK_CUR);
|
||||
CAssetID ParticleID(rANCS, e32Bit);
|
||||
CAssetID ParticleID(rANCS, k32Bit);
|
||||
if (ParticleID.IsValid()) pChar->EffectParticles.push_back(ParticleID);
|
||||
|
||||
if (Loader.mGame == EGame::Prime) rANCS.ReadString();
|
||||
@@ -591,9 +591,9 @@ CAnimSet* CAnimSetLoader::LoadANCS(IInputStream& rANCS, CResourceEntry *pEntry)
|
||||
}
|
||||
|
||||
SOverlayModel Overlay;
|
||||
Overlay.Type = eOT_Frozen;
|
||||
Overlay.ModelID = CAssetID(rANCS, e32Bit);
|
||||
Overlay.SkinID = CAssetID(rANCS, e32Bit);
|
||||
Overlay.Type = EOverlayType::Frozen;
|
||||
Overlay.ModelID = CAssetID(rANCS, k32Bit);
|
||||
Overlay.SkinID = CAssetID(rANCS, k32Bit);
|
||||
pChar->OverlayModels.push_back(Overlay);
|
||||
|
||||
uint32 AnimIndexCount = rANCS.ReadLong();
|
||||
@@ -664,8 +664,8 @@ CSourceAnimData* CAnimSetLoader::LoadSAND(IInputStream& rSAND, CResourceEntry *p
|
||||
ASSERT(UnkByte == 0);
|
||||
|
||||
CSourceAnimData::STransition Transition;
|
||||
Transition.AnimA = CAssetID(rSAND, e64Bit);
|
||||
Transition.AnimB = CAssetID(rSAND, e64Bit);
|
||||
Transition.AnimA = CAssetID(rSAND, k64Bit);
|
||||
Transition.AnimB = CAssetID(rSAND, k64Bit);
|
||||
Transition.pTransition = gMetaTransFactory.LoadFromStream(rSAND, pEntry->Game());
|
||||
pData->mTransitions.push_back(Transition);
|
||||
}
|
||||
@@ -679,7 +679,7 @@ CSourceAnimData* CAnimSetLoader::LoadSAND(IInputStream& rSAND, CResourceEntry *p
|
||||
ASSERT(UnkByte == 0);
|
||||
|
||||
CSourceAnimData::SHalfTransition HalfTrans;
|
||||
HalfTrans.Anim = CAssetID(rSAND, e64Bit);
|
||||
HalfTrans.Anim = CAssetID(rSAND, k64Bit);
|
||||
HalfTrans.pTransition = gMetaTransFactory.LoadFromStream(rSAND, pEntry->Game());
|
||||
pData->mHalfTransitions.push_back(HalfTrans);
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ void CAreaLoader::ReadLightsPrime()
|
||||
Multiplier = FLT_EPSILON;
|
||||
|
||||
// Local Ambient
|
||||
if (Type == eLocalAmbient)
|
||||
if (Type == ELightType::LocalAmbient)
|
||||
{
|
||||
Color *= Multiplier;
|
||||
|
||||
@@ -212,13 +212,13 @@ void CAreaLoader::ReadLightsPrime()
|
||||
}
|
||||
|
||||
// Directional
|
||||
else if (Type == eDirectional)
|
||||
else if (Type == ELightType::Directional)
|
||||
{
|
||||
pLight = CLight::BuildDirectional(Position, Direction, LightColor);
|
||||
}
|
||||
|
||||
// Spot
|
||||
else if (Type == eSpot)
|
||||
else if (Type == ELightType::Spot)
|
||||
{
|
||||
pLight = CLight::BuildSpot(Position, Direction.Normalized(), LightColor, SpotCutoff);
|
||||
|
||||
@@ -499,19 +499,19 @@ void CAreaLoader::ReadLightsCorruption()
|
||||
Multiplier = FLT_EPSILON;
|
||||
|
||||
// Local Ambient
|
||||
if (Type == eLocalAmbient)
|
||||
if (Type == ELightType::LocalAmbient)
|
||||
{
|
||||
pLight = CLight::BuildLocalAmbient(Position, LightColor * Multiplier);
|
||||
}
|
||||
|
||||
// Directional
|
||||
else if (Type == eDirectional)
|
||||
else if (Type == ELightType::Directional)
|
||||
{
|
||||
pLight = CLight::BuildDirectional(Position, Direction, LightColor);
|
||||
}
|
||||
|
||||
// Spot
|
||||
else if (Type == eSpot)
|
||||
else if (Type == ELightType::Spot)
|
||||
{
|
||||
pLight = CLight::BuildSpot(Position, Direction.Normalized(), LightColor, SpotCutoff);
|
||||
|
||||
@@ -597,7 +597,7 @@ void CAreaLoader::Decompress()
|
||||
}
|
||||
|
||||
TString Source = mpMREA->GetSourceString();
|
||||
mpMREA = new CMemoryInStream(mpDecmpBuffer, mTotalDecmpSize, IOUtil::eBigEndian);
|
||||
mpMREA = new CMemoryInStream(mpDecmpBuffer, mTotalDecmpSize, EEndian::BigEndian);
|
||||
mpMREA->SetSourceString(Source);
|
||||
mpSectionMgr->SetInputStream(mpMREA);
|
||||
mHasDecompressedBuffer = true;
|
||||
@@ -639,7 +639,7 @@ void CAreaLoader::ReadEGMC()
|
||||
{
|
||||
mpSectionMgr->ToSection(mEGMCBlockNum);
|
||||
CAssetID EGMC(*mpMREA, mVersion);
|
||||
mpArea->mpPoiToWorldMap = gpResourceStore->LoadResource(EGMC, eStaticGeometryMap);
|
||||
mpArea->mpPoiToWorldMap = gpResourceStore->LoadResource(EGMC, EResourceType::StaticGeometryMap);
|
||||
}
|
||||
|
||||
void CAreaLoader::SetUpObjects(CScriptLayer *pGenLayer)
|
||||
@@ -692,9 +692,9 @@ void CAreaLoader::SetUpObjects(CScriptLayer *pGenLayer)
|
||||
CScriptObject *pInst = Iter->second;
|
||||
|
||||
// Store outgoing connections
|
||||
for (uint32 iCon = 0; iCon < pInst->NumLinks(eOutgoing); iCon++)
|
||||
for (uint32 iCon = 0; iCon < pInst->NumLinks(ELinkType::Outgoing); iCon++)
|
||||
{
|
||||
CLink *pLink = pInst->Link(eOutgoing, iCon);
|
||||
CLink *pLink = pInst->Link(ELinkType::Outgoing, iCon);
|
||||
mConnectionMap[pLink->ReceiverID()].push_back(pLink);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,10 +17,7 @@ CFont* CFontLoader::LoadFont(IInputStream& rFONT)
|
||||
rFONT.Seek(0x2, SEEK_CUR);
|
||||
mpFont->mDefaultSize = rFONT.ReadLong();
|
||||
mpFont->mFontName = rFONT.ReadString();
|
||||
|
||||
if (mVersion <= EGame::Echoes) mpFont->mpFontTexture = gpResourceStore->LoadResource(rFONT.ReadLong(), eTexture);
|
||||
else mpFont->mpFontTexture = gpResourceStore->LoadResource(rFONT.ReadLongLong(), eTexture);
|
||||
|
||||
mpFont->mpFontTexture = gpResourceStore->LoadResource(CAssetID(rFONT, mVersion), EResourceType::Texture);
|
||||
mpFont->mTextureFormat = rFONT.ReadLong();
|
||||
uint32 NumGlyphs = rFONT.ReadLong();
|
||||
mpFont->mGlyphs.reserve(NumGlyphs);
|
||||
|
||||
@@ -18,26 +18,26 @@ CMaterialLoader::~CMaterialLoader()
|
||||
FVertexDescription CMaterialLoader::ConvertToVertexDescription(uint32 VertexFlags)
|
||||
{
|
||||
FVertexDescription Desc;
|
||||
if (VertexFlags & 0x00000003) Desc |= ePosition;
|
||||
if (VertexFlags & 0x0000000C) Desc |= eNormal;
|
||||
if (VertexFlags & 0x00000030) Desc |= eColor0;
|
||||
if (VertexFlags & 0x000000C0) Desc |= eColor1;
|
||||
if (VertexFlags & 0x00000300) Desc |= eTex0;
|
||||
if (VertexFlags & 0x00000C00) Desc |= eTex1;
|
||||
if (VertexFlags & 0x00003000) Desc |= eTex2;
|
||||
if (VertexFlags & 0x0000C000) Desc |= eTex3;
|
||||
if (VertexFlags & 0x00030000) Desc |= eTex4;
|
||||
if (VertexFlags & 0x000C0000) Desc |= eTex5;
|
||||
if (VertexFlags & 0x00300000) Desc |= eTex6;
|
||||
if (VertexFlags & 0x00C00000) Desc |= eTex7;
|
||||
if (VertexFlags & 0x01000000) Desc |= ePosMtx;
|
||||
if (VertexFlags & 0x02000000) Desc |= eTex0Mtx;
|
||||
if (VertexFlags & 0x04000000) Desc |= eTex1Mtx;
|
||||
if (VertexFlags & 0x08000000) Desc |= eTex2Mtx;
|
||||
if (VertexFlags & 0x10000000) Desc |= eTex3Mtx;
|
||||
if (VertexFlags & 0x20000000) Desc |= eTex4Mtx;
|
||||
if (VertexFlags & 0x40000000) Desc |= eTex5Mtx;
|
||||
if (VertexFlags & 0x80000000) Desc |= eTex6Mtx;
|
||||
if (VertexFlags & 0x00000003) Desc |= EVertexAttribute::Position;
|
||||
if (VertexFlags & 0x0000000C) Desc |= EVertexAttribute::Normal;
|
||||
if (VertexFlags & 0x00000030) Desc |= EVertexAttribute::Color0;
|
||||
if (VertexFlags & 0x000000C0) Desc |= EVertexAttribute::Color1;
|
||||
if (VertexFlags & 0x00000300) Desc |= EVertexAttribute::Tex0;
|
||||
if (VertexFlags & 0x00000C00) Desc |= EVertexAttribute::Tex1;
|
||||
if (VertexFlags & 0x00003000) Desc |= EVertexAttribute::Tex2;
|
||||
if (VertexFlags & 0x0000C000) Desc |= EVertexAttribute::Tex3;
|
||||
if (VertexFlags & 0x00030000) Desc |= EVertexAttribute::Tex4;
|
||||
if (VertexFlags & 0x000C0000) Desc |= EVertexAttribute::Tex5;
|
||||
if (VertexFlags & 0x00300000) Desc |= EVertexAttribute::Tex6;
|
||||
if (VertexFlags & 0x00C00000) Desc |= EVertexAttribute::Tex7;
|
||||
if (VertexFlags & 0x01000000) Desc |= EVertexAttribute::PosMtx;
|
||||
if (VertexFlags & 0x02000000) Desc |= EVertexAttribute::Tex0Mtx;
|
||||
if (VertexFlags & 0x04000000) Desc |= EVertexAttribute::Tex1Mtx;
|
||||
if (VertexFlags & 0x08000000) Desc |= EVertexAttribute::Tex2Mtx;
|
||||
if (VertexFlags & 0x10000000) Desc |= EVertexAttribute::Tex3Mtx;
|
||||
if (VertexFlags & 0x20000000) Desc |= EVertexAttribute::Tex4Mtx;
|
||||
if (VertexFlags & 0x40000000) Desc |= EVertexAttribute::Tex5Mtx;
|
||||
if (VertexFlags & 0x80000000) Desc |= EVertexAttribute::Tex6Mtx;
|
||||
return Desc;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ CMaterial* CMaterialLoader::ReadPrimeMaterial()
|
||||
pMat->mEnableBloom = false;
|
||||
|
||||
// Flags
|
||||
pMat->mOptions = (mpFile->ReadLong() & CMaterial::eAllMP1Settings);
|
||||
pMat->mOptions = (mpFile->ReadLong() & (uint) EMaterialOption::AllMP1Settings);
|
||||
|
||||
// Textures
|
||||
uint32 NumTextures = mpFile->ReadLong();
|
||||
@@ -100,7 +100,7 @@ CMaterial* CMaterialLoader::ReadPrimeMaterial()
|
||||
mpFile->Seek(0x4, SEEK_CUR); // Skipping group index
|
||||
|
||||
// Konst
|
||||
if (pMat->mOptions & CMaterial::eKonst)
|
||||
if (pMat->mOptions & EMaterialOption::Konst)
|
||||
{
|
||||
uint32 KonstCount = mpFile->ReadLong();
|
||||
|
||||
@@ -117,7 +117,7 @@ CMaterial* CMaterialLoader::ReadPrimeMaterial()
|
||||
pMat->mBlendSrcFac = gBlendFactor[mpFile->ReadShort()];
|
||||
|
||||
// Indirect texture
|
||||
if (pMat->mOptions & CMaterial::eIndStage)
|
||||
if (pMat->mOptions & EMaterialOption::IndStage)
|
||||
{
|
||||
uint32 IndTexIndex = mpFile->ReadLong();
|
||||
pMat->mpIndirectTexture = mTextures[TextureIndices[IndTexIndex]];
|
||||
@@ -224,7 +224,7 @@ CMaterial* CMaterialLoader::ReadPrimeMaterial()
|
||||
if ((TexGens.size() == 0) || (TexCoordIdx == 0xFF))
|
||||
{
|
||||
pPass->mTexCoordSource = 0xFF;
|
||||
pPass->mAnimMode = eNoUVAnim;
|
||||
pPass->mAnimMode = EUVAnimMode::NoUVAnim;
|
||||
}
|
||||
|
||||
else
|
||||
@@ -235,7 +235,7 @@ CMaterial* CMaterialLoader::ReadPrimeMaterial()
|
||||
// Texture matrix is a reliable way to tell, because every UV anim mode generates a texture matrix
|
||||
uint32 TexMtxIdx = ((TexGens[TexCoordIdx] & 0x3E00) >> 9) / 3;
|
||||
|
||||
if (TexMtxIdx == 10) pPass->mAnimMode = eNoUVAnim; // 10 is identity matrix; indicates no UV anim for this pass
|
||||
if (TexMtxIdx == 10) pPass->mAnimMode = EUVAnimMode::NoUVAnim; // 10 is identity matrix; indicates no UV anim for this pass
|
||||
|
||||
else
|
||||
{
|
||||
@@ -269,7 +269,7 @@ void CMaterialLoader::ReadCorruptionMatSet()
|
||||
CMaterial* CMaterialLoader::ReadCorruptionMaterial()
|
||||
{
|
||||
CMaterial *pMat = new CMaterial();
|
||||
pMat->mOptions = CMaterial::eDepthWrite;
|
||||
pMat->mOptions = EMaterialOption::DepthWrite;
|
||||
pMat->mEnableBloom = true;
|
||||
|
||||
// Flags
|
||||
@@ -278,18 +278,18 @@ CMaterial* CMaterialLoader::ReadCorruptionMaterial()
|
||||
{
|
||||
pMat->mBlendSrcFac = GL_SRC_ALPHA;
|
||||
pMat->mBlendDstFac = GL_ONE_MINUS_SRC_ALPHA;
|
||||
pMat->mOptions |= CMaterial::eTransparent;
|
||||
pMat->mOptions |= EMaterialOption::Transparent;
|
||||
}
|
||||
else if (Flags & 0x20)
|
||||
{
|
||||
pMat->mBlendSrcFac = GL_ONE;
|
||||
pMat->mBlendDstFac = GL_ONE;
|
||||
pMat->mOptions |= CMaterial::eTransparent;
|
||||
pMat->mOptions |= EMaterialOption::Transparent;
|
||||
}
|
||||
|
||||
if (Flags & 0x10) pMat->mOptions |= CMaterial::ePunchthrough;
|
||||
if (Flags & 0x100) pMat->mOptions |= CMaterial::eOccluder;
|
||||
if (Flags & 0x80000) pMat->mOptions |= CMaterial::eDrawWhiteAmbientDKCR;
|
||||
if (Flags & 0x10) pMat->mOptions |= EMaterialOption::Masked;
|
||||
if (Flags & 0x100) pMat->mOptions |= EMaterialOption::Occluder;
|
||||
if (Flags & 0x80000) pMat->mOptions |= EMaterialOption::DrawWhiteAmbientDKCR;
|
||||
mHas0x400 = ((Flags & 0x400) != 0);
|
||||
|
||||
mpFile->Seek(0x8, SEEK_CUR); // Don't know what any of this is
|
||||
@@ -356,7 +356,7 @@ CMaterial* CMaterialLoader::ReadCorruptionMaterial()
|
||||
uint32 Next = Size + mpFile->Tell();
|
||||
|
||||
pPass->mPassType = mpFile->ReadLong();
|
||||
pPass->mSettings = (CMaterialPass::EPassSettings) mpFile->ReadLong();
|
||||
pPass->mSettings = (EPassSettings) mpFile->ReadLong();
|
||||
|
||||
// Skip passes that don't have a texture. Honestly don't really know what to do with these right now
|
||||
uint64 TextureID = mpFile->ReadLongLong();
|
||||
@@ -408,11 +408,16 @@ CMaterial* CMaterialLoader::ReadCorruptionMaterial()
|
||||
}
|
||||
|
||||
// Hack until the correct way to determine tex coord source is figured out
|
||||
if ((pPass->mAnimMode < 2) || (pPass->mAnimMode == 6) || (pPass->mAnimMode == 7) || (pPass->mAnimMode == 10))
|
||||
if ((pPass->mAnimMode < EUVAnimMode::UVScroll) ||
|
||||
(pPass->mAnimMode == EUVAnimMode::ModelMatrix) ||
|
||||
(pPass->mAnimMode == EUVAnimMode::ConvolutedModeA) ||
|
||||
(pPass->mAnimMode == EUVAnimMode::SimpleMode))
|
||||
{
|
||||
pPass->mTexCoordSource = 1;
|
||||
}
|
||||
}
|
||||
|
||||
else pPass->mAnimMode = eNoUVAnim;
|
||||
else pPass->mAnimMode = EUVAnimMode::NoUVAnim;
|
||||
|
||||
pMat->mPasses.push_back(pPass);
|
||||
mpFile->Seek(Next, SEEK_SET);
|
||||
@@ -438,48 +443,48 @@ void CMaterialLoader::CreateCorruptionPasses(CMaterial *pMat)
|
||||
// Color Map (Diffuse)
|
||||
if (Type == "CLR ")
|
||||
{
|
||||
pPass->SetRasSel(eRasColor0A0);
|
||||
pPass->SetRasSel(kRasColor0A0);
|
||||
|
||||
if (Lightmap)
|
||||
{
|
||||
pPass->SetColorInputs(eZeroRGB, eColor0RGB, eTextureRGB, eZeroRGB);
|
||||
pPass->SetColorInputs(kZeroRGB, kColor0RGB, kTextureRGB, kZeroRGB);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
pPass->SetColorInputs(eZeroRGB, eRasRGB, eTextureRGB, eZeroRGB);
|
||||
pPass->SetColorInputs(kZeroRGB, kRasRGB, kTextureRGB, kZeroRGB);
|
||||
}
|
||||
|
||||
|
||||
if (pMat->mOptions & CMaterial::ePunchthrough)
|
||||
if (pMat->mOptions & EMaterialOption::Masked)
|
||||
{
|
||||
pPass->SetAlphaInputs(eZeroAlpha, eZeroAlpha, eZeroAlpha, eTextureAlpha);
|
||||
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kTextureAlpha);
|
||||
}
|
||||
else if (mHasOPAC)
|
||||
{
|
||||
pPass->SetAlphaInputs(eZeroAlpha, eZeroAlpha, eZeroAlpha, eKonstAlpha);
|
||||
pPass->SetKColorSel(eKonst0_RGB);
|
||||
pPass->SetKAlphaSel(eKonst0_A);
|
||||
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kKonstAlpha);
|
||||
pPass->SetKColorSel(kKonst0_RGB);
|
||||
pPass->SetKAlphaSel(kKonst0_A);
|
||||
}
|
||||
else
|
||||
{
|
||||
pPass->SetAlphaInputs(eZeroAlpha, eZeroAlpha, eZeroAlpha, ePrevAlpha);
|
||||
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
||||
}
|
||||
|
||||
pPass->SetColorOutput(ePrevReg);
|
||||
pPass->SetAlphaOutput(ePrevReg);
|
||||
pPass->SetColorOutput(kPrevReg);
|
||||
pPass->SetAlphaOutput(kPrevReg);
|
||||
}
|
||||
|
||||
// Lightmap
|
||||
else if (Type == "DIFF")
|
||||
{
|
||||
pPass->SetColorInputs(eZeroRGB, eKonstRGB, eTextureRGB, eRasRGB);
|
||||
pPass->SetAlphaInputs(eZeroAlpha, eZeroAlpha, eZeroAlpha, eKonstAlpha);
|
||||
pPass->SetColorOutput(eColor0Reg);
|
||||
pPass->SetAlphaOutput(eColor0Reg);
|
||||
pPass->SetKColorSel(eKonst1_RGB);
|
||||
pPass->SetKAlphaSel(eKonst1_A);
|
||||
pPass->SetRasSel(eRasColor0A0);
|
||||
pPass->SetColorInputs(kZeroRGB, kKonstRGB, kTextureRGB, kRasRGB);
|
||||
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kKonstAlpha);
|
||||
pPass->SetColorOutput(kColor0Reg);
|
||||
pPass->SetAlphaOutput(kColor0Reg);
|
||||
pPass->SetKColorSel(kKonst1_RGB);
|
||||
pPass->SetKAlphaSel(kKonst1_A);
|
||||
pPass->SetRasSel(kRasColor0A0);
|
||||
Lightmap = true;
|
||||
}
|
||||
|
||||
@@ -487,91 +492,91 @@ void CMaterialLoader::CreateCorruptionPasses(CMaterial *pMat)
|
||||
else if (Type == "BLOL")
|
||||
{
|
||||
// Bloom maps work by writing to framebuffer alpha. Can't do this on alpha-blended mats.
|
||||
pPass->SetColorInputs(eZeroRGB, eZeroRGB, eZeroRGB, ePrevRGB);
|
||||
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kPrevRGB);
|
||||
|
||||
if ((AlphaBlended) || (pMat->mOptions & CMaterial::ePunchthrough))
|
||||
pPass->SetAlphaInputs(eZeroAlpha, eZeroAlpha, eZeroAlpha, ePrevAlpha);
|
||||
if ((AlphaBlended) || (pMat->mOptions & EMaterialOption::Masked))
|
||||
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
||||
else
|
||||
pPass->SetAlphaInputs(eZeroAlpha, eZeroAlpha, eZeroAlpha, eTextureAlpha);
|
||||
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kTextureAlpha);
|
||||
|
||||
pPass->SetColorOutput(ePrevReg);
|
||||
pPass->SetAlphaOutput(ePrevReg);
|
||||
pPass->SetColorOutput(kPrevReg);
|
||||
pPass->SetAlphaOutput(kPrevReg);
|
||||
}
|
||||
|
||||
// Rim Light Map
|
||||
else if (Type == "RIML")
|
||||
{
|
||||
pPass->SetColorInputs(eZeroRGB, eOneRGB, ePrevRGB, eTextureRGB);
|
||||
pPass->SetAlphaInputs(eZeroAlpha, eZeroAlpha, eZeroAlpha, ePrevAlpha);
|
||||
pPass->SetColorOutput(ePrevReg);
|
||||
pPass->SetAlphaOutput(ePrevReg);
|
||||
pPass->SetColorInputs(kZeroRGB, kOneRGB, kPrevRGB, kTextureRGB);
|
||||
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
||||
pPass->SetColorOutput(kPrevReg);
|
||||
pPass->SetAlphaOutput(kPrevReg);
|
||||
}
|
||||
|
||||
// Emissive Map
|
||||
else if (Type == "INCA")
|
||||
{
|
||||
pPass->SetColorInputs(eZeroRGB, eTextureRGB, eOneRGB, ePrevRGB);
|
||||
pPass->SetColorInputs(kZeroRGB, kTextureRGB, kOneRGB, kPrevRGB);
|
||||
|
||||
if ((pPass->mSettings & CMaterialPass::eEmissiveBloom) && (!AlphaBlended))
|
||||
if ((pPass->mSettings & EPassSettings::EmissiveBloom) && (!AlphaBlended))
|
||||
{
|
||||
pPass->SetAlphaInputs(eZeroAlpha, eTextureAlpha, eKonstAlpha, ePrevAlpha);
|
||||
pPass->SetKAlphaSel(eKonstOneFourth);
|
||||
pPass->SetAlphaInputs(kZeroAlpha, kTextureAlpha, kKonstAlpha, kPrevAlpha);
|
||||
pPass->SetKAlphaSel(kKonstOneFourth);
|
||||
}
|
||||
else
|
||||
{
|
||||
pPass->SetAlphaInputs(eZeroAlpha, eZeroAlpha, eZeroAlpha, ePrevAlpha);
|
||||
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
||||
}
|
||||
|
||||
pPass->SetColorOutput(ePrevReg);
|
||||
pPass->SetAlphaOutput(ePrevReg);
|
||||
pPass->SetColorOutput(kPrevReg);
|
||||
pPass->SetAlphaOutput(kPrevReg);
|
||||
}
|
||||
|
||||
// Opacity Map
|
||||
else if (Type == "TRAN")
|
||||
{
|
||||
pPass->SetColorInputs(eZeroRGB, eZeroRGB, eZeroRGB, ePrevRGB);
|
||||
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kPrevRGB);
|
||||
|
||||
if (pPass->mSettings & CMaterialPass::eInvertOpacityMap)
|
||||
pPass->SetAlphaInputs(eKonstAlpha, eZeroAlpha, eTextureAlpha, eZeroAlpha);
|
||||
if (pPass->mSettings & EPassSettings::InvertOpacityMap)
|
||||
pPass->SetAlphaInputs(kKonstAlpha, kZeroAlpha, kTextureAlpha, kZeroAlpha);
|
||||
else
|
||||
pPass->SetAlphaInputs(eZeroAlpha, eKonstAlpha, eTextureAlpha, eZeroAlpha);
|
||||
pPass->SetAlphaInputs(kZeroAlpha, kKonstAlpha, kTextureAlpha, kZeroAlpha);
|
||||
|
||||
pPass->SetColorOutput(ePrevReg);
|
||||
pPass->SetAlphaOutput(ePrevReg);
|
||||
pPass->SetColorOutput(kPrevReg);
|
||||
pPass->SetAlphaOutput(kPrevReg);
|
||||
}
|
||||
|
||||
// Specular Map
|
||||
else if (Type == "RFLV")
|
||||
{
|
||||
pPass->SetColorInputs(eZeroRGB, eZeroRGB, eZeroRGB, eTextureRGB);
|
||||
pPass->SetAlphaInputs(eZeroAlpha, eZeroAlpha, eZeroAlpha, ePrevAlpha);
|
||||
pPass->SetColorOutput(eColor2Reg);
|
||||
pPass->SetAlphaOutput(eColor2Reg);
|
||||
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kTextureRGB);
|
||||
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
||||
pPass->SetColorOutput(kColor2Reg);
|
||||
pPass->SetAlphaOutput(kColor2Reg);
|
||||
}
|
||||
|
||||
// Reflection Map
|
||||
else if (Type == "RFLD")
|
||||
{
|
||||
pPass->SetColorInputs(eZeroRGB, eColor2RGB, eTextureRGB, ePrevRGB);
|
||||
pPass->SetAlphaInputs(eZeroAlpha, eZeroAlpha, eZeroAlpha, ePrevAlpha);
|
||||
pPass->SetColorOutput(ePrevReg);
|
||||
pPass->SetAlphaOutput(ePrevReg);
|
||||
pPass->SetColorInputs(kZeroRGB, kColor2RGB, kTextureRGB, kPrevRGB);
|
||||
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
||||
pPass->SetColorOutput(kPrevReg);
|
||||
pPass->SetAlphaOutput(kPrevReg);
|
||||
if (mHas0x400) pPass->SetEnabled(false);
|
||||
}
|
||||
|
||||
// Bloom Incandescence
|
||||
else if (Type == "BLOI")
|
||||
{
|
||||
pPass->SetColorInputs(eZeroRGB, eZeroRGB, eZeroRGB, ePrevRGB);
|
||||
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kPrevRGB);
|
||||
|
||||
// Comes out wrong every time even though this is exactly how the Dolphin shaders say this is done.
|
||||
if (AlphaBlended)
|
||||
pPass->SetAlphaInputs(eZeroAlpha, eZeroAlpha, eZeroAlpha, ePrevAlpha);
|
||||
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
||||
else
|
||||
pPass->SetAlphaInputs(eTextureAlpha, eZeroAlpha, eZeroAlpha, ePrevAlpha);
|
||||
pPass->SetAlphaInputs(kTextureAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
||||
|
||||
pPass->SetColorOutput(ePrevReg);
|
||||
pPass->SetAlphaOutput(ePrevReg);
|
||||
pPass->SetColorOutput(kPrevReg);
|
||||
pPass->SetAlphaOutput(kPrevReg);
|
||||
}
|
||||
|
||||
// Bloom Diffuse
|
||||
@@ -583,28 +588,28 @@ void CMaterialLoader::CreateCorruptionPasses(CMaterial *pMat)
|
||||
// X-Ray - since we don't support X-Ray previews, no effect
|
||||
else if (Type == "XRAY")
|
||||
{
|
||||
pPass->SetColorInputs(eZeroRGB, eZeroRGB, eZeroRGB, ePrevRGB);
|
||||
pPass->SetAlphaInputs(eZeroAlpha, eZeroAlpha, eZeroAlpha, ePrevAlpha);
|
||||
pPass->SetColorOutput(ePrevReg);
|
||||
pPass->SetAlphaOutput(ePrevReg);
|
||||
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kPrevRGB);
|
||||
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
||||
pPass->SetColorOutput(kPrevReg);
|
||||
pPass->SetAlphaOutput(kPrevReg);
|
||||
}
|
||||
|
||||
// Toon? Don't know what it's for but got TEV setup from shader dumps
|
||||
else if (Type == "TOON")
|
||||
{
|
||||
pPass->SetColorInputs(eZeroRGB, ePrevRGB, eTextureRGB, eZeroRGB);
|
||||
pPass->SetAlphaInputs(eZeroAlpha, eZeroAlpha, eZeroAlpha, eTextureAlpha);
|
||||
pPass->SetColorOutput(ePrevReg);
|
||||
pPass->SetAlphaOutput(ePrevReg);
|
||||
pPass->SetColorInputs(kZeroRGB, kPrevRGB, kTextureRGB, kZeroRGB);
|
||||
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kTextureAlpha);
|
||||
pPass->SetColorOutput(kPrevReg);
|
||||
pPass->SetAlphaOutput(kPrevReg);
|
||||
}
|
||||
|
||||
// LURD and LRLD are unknown and don't seem to do anything
|
||||
else if ((Type == "LURD") || (Type == "LRLD"))
|
||||
{
|
||||
pPass->SetColorInputs(eZeroRGB, eZeroRGB, eZeroRGB, ePrevRGB);
|
||||
pPass->SetAlphaInputs(eZeroAlpha, eZeroAlpha, eZeroAlpha, ePrevAlpha);
|
||||
pPass->SetColorOutput(ePrevReg);
|
||||
pPass->SetAlphaOutput(ePrevReg);
|
||||
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kPrevRGB);
|
||||
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
||||
pPass->SetColorOutput(kPrevReg);
|
||||
pPass->SetAlphaOutput(kPrevReg);
|
||||
}
|
||||
|
||||
else if (Type == "CUST") {}
|
||||
@@ -620,7 +625,7 @@ void CMaterialLoader::CreateCorruptionPasses(CMaterial *pMat)
|
||||
CMaterial* CMaterialLoader::LoadAssimpMaterial(const aiMaterial *pAiMat)
|
||||
{
|
||||
// todo: generate new material using import values.
|
||||
CMaterial *pMat = new CMaterial(mVersion, eNoAttributes);
|
||||
CMaterial *pMat = new CMaterial(mVersion, EVertexAttribute::None);
|
||||
|
||||
aiString Name;
|
||||
pAiMat->Get(AI_MATKEY_NAME, Name);
|
||||
@@ -628,11 +633,11 @@ CMaterial* CMaterialLoader::LoadAssimpMaterial(const aiMaterial *pAiMat)
|
||||
|
||||
// Create generic custom pass that uses Konst color
|
||||
CMaterialPass *pPass = new CMaterialPass(pMat);
|
||||
pPass->SetColorInputs(eZeroRGB, eRasRGB, eKonstRGB, eZeroRGB);
|
||||
pPass->SetAlphaInputs(eZeroAlpha, eZeroAlpha, eZeroAlpha, eKonstAlpha);
|
||||
pPass->SetKColorSel(eKonst0_RGB);
|
||||
pPass->SetKAlphaSel(eKonstOne);
|
||||
pPass->SetRasSel(eRasColor0A0);
|
||||
pPass->SetColorInputs(kZeroRGB, kRasRGB, kKonstRGB, kZeroRGB);
|
||||
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kKonstAlpha);
|
||||
pPass->SetKColorSel(kKonst0_RGB);
|
||||
pPass->SetKAlphaSel(kKonstOne);
|
||||
pPass->SetRasSel(kRasColor0A0);
|
||||
pMat->mKonstColors[0] = CColor::RandomLightColor(false);
|
||||
pMat->mPasses.push_back(pPass);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <map>
|
||||
|
||||
CModelLoader::CModelLoader()
|
||||
: mFlags(eNoFlags)
|
||||
: mFlags(EModelLoaderFlag::None)
|
||||
, mNumVertices(0)
|
||||
{
|
||||
}
|
||||
@@ -24,7 +24,7 @@ void CModelLoader::LoadWorldMeshHeader(IInputStream& rModel)
|
||||
void CModelLoader::LoadAttribArrays(IInputStream& rModel)
|
||||
{
|
||||
// Positions
|
||||
if (mFlags & eShortPositions) // Shorts (DKCR only)
|
||||
if (mFlags & EModelLoaderFlag::HalfPrecisionPositions) // 16-bit (DKCR only)
|
||||
{
|
||||
mPositions.resize(mpSectionMgr->CurrentSectionSize() / 0x6);
|
||||
float Divisor = 8192.f; // Might be incorrect! Needs verification via size comparison.
|
||||
@@ -38,7 +38,7 @@ void CModelLoader::LoadAttribArrays(IInputStream& rModel)
|
||||
}
|
||||
}
|
||||
|
||||
else // Floats
|
||||
else // 32-bit
|
||||
{
|
||||
mPositions.resize(mpSectionMgr->CurrentSectionSize() / 0xC);
|
||||
|
||||
@@ -49,7 +49,7 @@ void CModelLoader::LoadAttribArrays(IInputStream& rModel)
|
||||
mpSectionMgr->ToNextSection();
|
||||
|
||||
// Normals
|
||||
if (mFlags & eShortNormals) // Shorts
|
||||
if (mFlags & EModelLoaderFlag::HalfPrecisionNormals) // 16-bit
|
||||
{
|
||||
mNormals.resize(mpSectionMgr->CurrentSectionSize() / 0x6);
|
||||
float Divisor = (mVersion < EGame::DKCReturns) ? 32768.f : 16384.f;
|
||||
@@ -62,7 +62,7 @@ void CModelLoader::LoadAttribArrays(IInputStream& rModel)
|
||||
mNormals[iVtx] = CVector3f(X, Y, Z);
|
||||
}
|
||||
}
|
||||
else // Floats
|
||||
else // 32-bit
|
||||
{
|
||||
mNormals.resize(mpSectionMgr->CurrentSectionSize() / 0xC);
|
||||
|
||||
@@ -81,7 +81,7 @@ void CModelLoader::LoadAttribArrays(IInputStream& rModel)
|
||||
mpSectionMgr->ToNextSection();
|
||||
|
||||
|
||||
// Float UVs
|
||||
// UVs
|
||||
mTex0.resize(mpSectionMgr->CurrentSectionSize() / 0x8);
|
||||
|
||||
for (uint32 iVtx = 0; iVtx < mTex0.size(); iVtx++)
|
||||
@@ -89,8 +89,8 @@ void CModelLoader::LoadAttribArrays(IInputStream& rModel)
|
||||
|
||||
mpSectionMgr->ToNextSection();
|
||||
|
||||
// Short UVs
|
||||
if (mFlags & eHasTex1)
|
||||
// Lightmap UVs
|
||||
if (mFlags & EModelLoaderFlag::LightmapUVs)
|
||||
{
|
||||
mTex1.resize(mpSectionMgr->CurrentSectionSize() / 0x4);
|
||||
float Divisor = (mVersion < EGame::DKCReturns) ? 32768.f : 8192.f;
|
||||
@@ -137,7 +137,7 @@ SSurface* CModelLoader::LoadSurface(IInputStream& rModel)
|
||||
while ((Flag != 0) && ((uint32) rModel.Tell() < NextSurface))
|
||||
{
|
||||
SSurface::SPrimitive Prim;
|
||||
Prim.Type = EGXPrimitiveType(Flag & 0xF8);
|
||||
Prim.Type = EPrimitiveType(Flag & 0xF8);
|
||||
uint16 VertexCount = rModel.ReadShort();
|
||||
|
||||
for (uint16 iVtx = 0; iVtx < VertexCount; iVtx++)
|
||||
@@ -146,14 +146,14 @@ SSurface* CModelLoader::LoadSurface(IInputStream& rModel)
|
||||
FVertexDescription VtxDesc = pMat->VtxDesc();
|
||||
|
||||
for (uint32 iMtxAttr = 0; iMtxAttr < 8; iMtxAttr++)
|
||||
if (VtxDesc & (ePosMtx << iMtxAttr)) rModel.Seek(0x1, SEEK_CUR);
|
||||
if (VtxDesc & ((uint) EVertexAttribute::PosMtx << iMtxAttr)) rModel.Seek(0x1, SEEK_CUR);
|
||||
|
||||
// Only thing to do here is check whether each attribute is present, and if so, read it.
|
||||
// A couple attributes have special considerations; normals can be floats or shorts, as can tex0, depending on vtxfmt.
|
||||
// tex0 can also be read from either UV buffer; depends what the material says.
|
||||
|
||||
// Position
|
||||
if (VtxDesc & ePosition)
|
||||
if (VtxDesc & EVertexAttribute::Position)
|
||||
{
|
||||
uint16 PosIndex = rModel.ReadShort() & 0xFFFF;
|
||||
Vtx.Position = mPositions[PosIndex];
|
||||
@@ -163,21 +163,21 @@ SSurface* CModelLoader::LoadSurface(IInputStream& rModel)
|
||||
}
|
||||
|
||||
// Normal
|
||||
if (VtxDesc & eNormal)
|
||||
if (VtxDesc & EVertexAttribute::Normal)
|
||||
Vtx.Normal = mNormals[rModel.ReadShort() & 0xFFFF];
|
||||
|
||||
// Color
|
||||
for (uint32 iClr = 0; iClr < 2; iClr++)
|
||||
if (VtxDesc & (eColor0 << iClr))
|
||||
if (VtxDesc & ((uint) EVertexAttribute::Color0 << iClr))
|
||||
Vtx.Color[iClr] = mColors[rModel.ReadShort() & 0xFFFF];
|
||||
|
||||
// Tex Coords - these are done a bit differently in DKCR than in the Prime series
|
||||
if (mVersion < EGame::DKCReturns)
|
||||
{
|
||||
// Tex0
|
||||
if (VtxDesc & eTex0)
|
||||
if (VtxDesc & EVertexAttribute::Tex0)
|
||||
{
|
||||
if ((mFlags & eHasTex1) && (pMat->Options() & CMaterial::eShortTexCoord))
|
||||
if ((mFlags & EModelLoaderFlag::LightmapUVs) && (pMat->Options() & EMaterialOption::ShortTexCoord))
|
||||
Vtx.Tex[0] = mTex1[rModel.ReadShort() & 0xFFFF];
|
||||
else
|
||||
Vtx.Tex[0] = mTex0[rModel.ReadShort() & 0xFFFF];
|
||||
@@ -185,7 +185,7 @@ SSurface* CModelLoader::LoadSurface(IInputStream& rModel)
|
||||
|
||||
// Tex1-7
|
||||
for (uint32 iTex = 1; iTex < 7; iTex++)
|
||||
if (VtxDesc & (eTex0 << iTex))
|
||||
if (VtxDesc & ((uint) EVertexAttribute::Tex0 << iTex))
|
||||
Vtx.Tex[iTex] = mTex0[rModel.ReadShort() & 0xFFFF];
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ SSurface* CModelLoader::LoadSurface(IInputStream& rModel)
|
||||
// Tex0-7
|
||||
for (uint32 iTex = 0; iTex < 7; iTex++)
|
||||
{
|
||||
if (VtxDesc & (eTex0 << iTex))
|
||||
if (VtxDesc & ((uint) EVertexAttribute::Tex0 << iTex))
|
||||
{
|
||||
if (!mSurfaceUsingTex1)
|
||||
Vtx.Tex[iTex] = mTex0[rModel.ReadShort() & 0xFFFF];
|
||||
@@ -212,11 +212,11 @@ SSurface* CModelLoader::LoadSurface(IInputStream& rModel)
|
||||
|
||||
switch (Prim.Type)
|
||||
{
|
||||
case eGX_Triangles:
|
||||
case EPrimitiveType::Triangles:
|
||||
pSurf->TriangleCount += VertexCount / 3;
|
||||
break;
|
||||
case eGX_TriangleFan:
|
||||
case eGX_TriangleStrip:
|
||||
case EPrimitiveType::TriangleFan:
|
||||
case EPrimitiveType::TriangleStrip:
|
||||
pSurf->TriangleCount += VertexCount - 2;
|
||||
break;
|
||||
}
|
||||
@@ -283,13 +283,13 @@ SSurface* CModelLoader::LoadAssimpMesh(const aiMesh *pkMesh, CMaterialSet *pSet)
|
||||
CMaterial *pMat = pSet->MaterialByIndex(pkMesh->mMaterialIndex);
|
||||
FVertexDescription Desc = pMat->VtxDesc();
|
||||
|
||||
if (Desc == eNoAttributes)
|
||||
if (Desc == (FVertexDescription) EVertexAttribute::None)
|
||||
{
|
||||
if (pkMesh->HasPositions()) Desc |= ePosition;
|
||||
if (pkMesh->HasNormals()) Desc |= eNormal;
|
||||
if (pkMesh->HasPositions()) Desc |= EVertexAttribute::Position;
|
||||
if (pkMesh->HasNormals()) Desc |= EVertexAttribute::Normal;
|
||||
|
||||
for (uint32 iUV = 0; iUV < pkMesh->GetNumUVChannels(); iUV++)
|
||||
Desc |= (eTex0 << iUV);
|
||||
Desc |= ((uint) EVertexAttribute::Tex0 << iUV);
|
||||
|
||||
pMat->SetVertexDescription(Desc);
|
||||
|
||||
@@ -297,8 +297,8 @@ SSurface* CModelLoader::LoadAssimpMesh(const aiMesh *pkMesh, CMaterialSet *pSet)
|
||||
if (!pkMesh->HasNormals())
|
||||
{
|
||||
pMat->SetLightingEnabled(false);
|
||||
pMat->Pass(0)->SetColorInputs(eZeroRGB, eOneRGB, eKonstRGB, eZeroRGB);
|
||||
pMat->Pass(0)->SetRasSel(eRasColorNull);
|
||||
pMat->Pass(0)->SetColorInputs(kZeroRGB, kOneRGB, kKonstRGB, kZeroRGB);
|
||||
pMat->Pass(0)->SetRasSel(kRasColorNull);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,9 +313,9 @@ SSurface* CModelLoader::LoadAssimpMesh(const aiMesh *pkMesh, CMaterialSet *pSet)
|
||||
|
||||
// Check primitive type on first face
|
||||
uint32 NumIndices = pkMesh->mFaces[0].mNumIndices;
|
||||
if (NumIndices == 1) rPrim.Type = eGX_Points;
|
||||
else if (NumIndices == 2) rPrim.Type = eGX_Lines;
|
||||
else if (NumIndices == 3) rPrim.Type = eGX_Triangles;
|
||||
if (NumIndices == 1) rPrim.Type = EPrimitiveType::Points;
|
||||
else if (NumIndices == 2) rPrim.Type = EPrimitiveType::Lines;
|
||||
else if (NumIndices == 3) rPrim.Type = EPrimitiveType::Triangles;
|
||||
|
||||
// Generate bounding box, center point, and reflection projection
|
||||
pSurf->CenterPoint = CVector3f::skZero;
|
||||
@@ -340,7 +340,7 @@ SSurface* CModelLoader::LoadAssimpMesh(const aiMesh *pkMesh, CMaterialSet *pSet)
|
||||
|
||||
// Set vertex/triangle count
|
||||
pSurf->VertexCount = pkMesh->mNumVertices;
|
||||
pSurf->TriangleCount = (rPrim.Type == eGX_Triangles ? pkMesh->mNumFaces : 0);
|
||||
pSurf->TriangleCount = (rPrim.Type == EPrimitiveType::Triangles ? pkMesh->mNumFaces : 0);
|
||||
|
||||
// Create primitive
|
||||
for (uint32 iFace = 0; iFace < pkMesh->mNumFaces; iFace++)
|
||||
@@ -401,9 +401,9 @@ CModel* CModelLoader::LoadCMDL(IInputStream& rCMDL, CResourceEntry *pEntry)
|
||||
BlockCount = rCMDL.ReadLong();
|
||||
MatSetCount = rCMDL.ReadLong();
|
||||
|
||||
if (Flags & 0x1) Loader.mFlags |= eSkinnedModel;
|
||||
if (Flags & 0x2) Loader.mFlags |= eShortNormals;
|
||||
if (Flags & 0x4) Loader.mFlags |= eHasTex1;
|
||||
if (Flags & 0x1) Loader.mFlags |= EModelLoaderFlag::Skinned;
|
||||
if (Flags & 0x2) Loader.mFlags |= EModelLoaderFlag::HalfPrecisionNormals;
|
||||
if (Flags & 0x4) Loader.mFlags |= EModelLoaderFlag::LightmapUVs;
|
||||
}
|
||||
|
||||
// 0x9381000A - Donkey Kong Country Returns
|
||||
@@ -416,9 +416,9 @@ CModel* CModelLoader::LoadCMDL(IInputStream& rCMDL, CResourceEntry *pEntry)
|
||||
MatSetCount = rCMDL.ReadLong();
|
||||
|
||||
// todo: unknown flags
|
||||
Loader.mFlags = eShortNormals | eHasTex1;
|
||||
if (Flags & 0x10) Loader.mFlags |= eHasVisGroups;
|
||||
if (Flags & 0x20) Loader.mFlags |= eShortPositions;
|
||||
Loader.mFlags = EModelLoaderFlag::HalfPrecisionNormals | EModelLoaderFlag::LightmapUVs;
|
||||
if (Flags & 0x10) Loader.mFlags |= EModelLoaderFlag::VisibilityGroups;
|
||||
if (Flags & 0x20) Loader.mFlags |= EModelLoaderFlag::HalfPrecisionPositions;
|
||||
|
||||
// Visibility group data
|
||||
// Skipping for now - should read in eventually
|
||||
@@ -498,8 +498,8 @@ CModel* CModelLoader::LoadWorldModel(IInputStream& rMREA, CSectionMgrIn& rBlockM
|
||||
CModelLoader Loader;
|
||||
Loader.mpSectionMgr = &rBlockMgr;
|
||||
Loader.mVersion = Version;
|
||||
Loader.mFlags = eShortNormals;
|
||||
if (Version != EGame::CorruptionProto) Loader.mFlags |= eHasTex1;
|
||||
Loader.mFlags = EModelLoaderFlag::HalfPrecisionNormals;
|
||||
if (Version != EGame::CorruptionProto) Loader.mFlags |= EModelLoaderFlag::LightmapUVs;
|
||||
Loader.mMaterials.resize(1);
|
||||
Loader.mMaterials[0] = &rMatSet;
|
||||
|
||||
@@ -531,10 +531,10 @@ CModel* CModelLoader::LoadCorruptionWorldModel(IInputStream& rMREA, CSectionMgrI
|
||||
CModelLoader Loader;
|
||||
Loader.mpSectionMgr = &rBlockMgr;
|
||||
Loader.mVersion = Version;
|
||||
Loader.mFlags = eShortNormals;
|
||||
Loader.mFlags = EModelLoaderFlag::HalfPrecisionNormals;
|
||||
Loader.mMaterials.resize(1);
|
||||
Loader.mMaterials[0] = &rMatSet;
|
||||
if (Version == EGame::DKCReturns) Loader.mFlags |= eHasTex1;
|
||||
if (Version == EGame::DKCReturns) Loader.mFlags |= EModelLoaderFlag::LightmapUVs;
|
||||
|
||||
// Corruption/DKCR MREAs split the mesh header and surface offsets away from the actual geometry data so I need two section numbers to read it
|
||||
rBlockMgr.ToSection(HeaderSecNum);
|
||||
|
||||
@@ -11,19 +11,20 @@
|
||||
|
||||
#include <assimp/scene.h>
|
||||
|
||||
enum class EModelLoaderFlag
|
||||
{
|
||||
None = 0x0,
|
||||
HalfPrecisionPositions = 0x1,
|
||||
HalfPrecisionNormals = 0x2,
|
||||
LightmapUVs = 0x4,
|
||||
VisibilityGroups = 0x8,
|
||||
Skinned = 0x10
|
||||
};
|
||||
DECLARE_FLAGS_ENUMCLASS(EModelLoaderFlag, FModelLoaderFlags)
|
||||
|
||||
class CModelLoader
|
||||
{
|
||||
public:
|
||||
enum EModelFlag
|
||||
{
|
||||
eNoFlags = 0x0,
|
||||
eShortPositions = 0x1,
|
||||
eShortNormals = 0x2,
|
||||
eHasTex1 = 0x4,
|
||||
eHasVisGroups = 0x8,
|
||||
eSkinnedModel = 0x10
|
||||
};
|
||||
DECLARE_FLAGS(EModelFlag, FModelFlags)
|
||||
|
||||
private:
|
||||
TResPtr<CModel> mpModel;
|
||||
@@ -43,7 +44,7 @@ private:
|
||||
uint32 mSurfaceCount;
|
||||
std::vector<uint32> mSurfaceOffsets;
|
||||
|
||||
FModelFlags mFlags;
|
||||
FModelLoaderFlags mFlags;
|
||||
|
||||
CModelLoader();
|
||||
~CModelLoader();
|
||||
|
||||
@@ -34,28 +34,28 @@ public:
|
||||
{
|
||||
switch (pEntry->ResourceType())
|
||||
{
|
||||
case eAnimation: return new CAnimation(pEntry);
|
||||
case eAnimEventData: return new CAnimEventData(pEntry);
|
||||
case eAnimSet: return new CAnimSet(pEntry);
|
||||
case eArea: return new CGameArea(pEntry);
|
||||
case eAudioMacro: return new CAudioMacro(pEntry);
|
||||
case eAudioGroup: return new CAudioGroup(pEntry);
|
||||
case eAudioLookupTable: return new CAudioLookupTable(pEntry);
|
||||
case eCharacter: return new CAnimSet(pEntry);
|
||||
case eDynamicCollision: return new CCollisionMeshGroup(pEntry);
|
||||
case eDependencyGroup: return new CDependencyGroup(pEntry);
|
||||
case eFont: return new CFont(pEntry);
|
||||
case eMapArea: return new CMapArea(pEntry);
|
||||
case eModel: return new CModel(pEntry);
|
||||
case eScan: return new CScan(pEntry);
|
||||
case eSkeleton: return new CSkeleton(pEntry);
|
||||
case eSkin: return new CSkin(pEntry);
|
||||
case eSourceAnimData: return new CSourceAnimData(pEntry);
|
||||
case eStaticGeometryMap: return new CPoiToWorld(pEntry);
|
||||
case eStringList: return new CStringList(pEntry);
|
||||
case eStringTable: return new CStringTable(pEntry);
|
||||
case eTexture: return new CTexture(pEntry);
|
||||
case eWorld: return new CWorld(pEntry);
|
||||
case EResourceType::Animation: return new CAnimation(pEntry);
|
||||
case EResourceType::AnimEventData: return new CAnimEventData(pEntry);
|
||||
case EResourceType::AnimSet: return new CAnimSet(pEntry);
|
||||
case EResourceType::Area: return new CGameArea(pEntry);
|
||||
case EResourceType::AudioMacro: return new CAudioMacro(pEntry);
|
||||
case EResourceType::AudioGroup: return new CAudioGroup(pEntry);
|
||||
case EResourceType::AudioLookupTable: return new CAudioLookupTable(pEntry);
|
||||
case EResourceType::Character: return new CAnimSet(pEntry);
|
||||
case EResourceType::DynamicCollision: return new CCollisionMeshGroup(pEntry);
|
||||
case EResourceType::DependencyGroup: return new CDependencyGroup(pEntry);
|
||||
case EResourceType::Font: return new CFont(pEntry);
|
||||
case EResourceType::MapArea: return new CMapArea(pEntry);
|
||||
case EResourceType::Model: return new CModel(pEntry);
|
||||
case EResourceType::Scan: return new CScan(pEntry);
|
||||
case EResourceType::Skeleton: return new CSkeleton(pEntry);
|
||||
case EResourceType::Skin: return new CSkin(pEntry);
|
||||
case EResourceType::SourceAnimData: return new CSourceAnimData(pEntry);
|
||||
case EResourceType::StaticGeometryMap: return new CPoiToWorld(pEntry);
|
||||
case EResourceType::StringList: return new CStringList(pEntry);
|
||||
case EResourceType::StringTable: return new CStringTable(pEntry);
|
||||
case EResourceType::Texture: return new CTexture(pEntry);
|
||||
case EResourceType::World: return new CWorld(pEntry);
|
||||
default: return nullptr; // should it return a CResource instead?
|
||||
}
|
||||
}
|
||||
@@ -68,38 +68,38 @@ public:
|
||||
|
||||
switch (pEntry->ResourceType())
|
||||
{
|
||||
case eAnimation: pRes = CAnimationLoader::LoadANIM(rInput, pEntry); break;
|
||||
case eAnimEventData: pRes = CAnimEventLoader::LoadEVNT(rInput, pEntry); break;
|
||||
case eAnimSet: pRes = CAnimSetLoader::LoadANCS(rInput, pEntry); break;
|
||||
case eArea: pRes = CAreaLoader::LoadMREA(rInput, pEntry); break;
|
||||
case eAudioMacro: pRes = CUnsupportedFormatLoader::LoadCAUD(rInput, pEntry); break;
|
||||
case eAudioGroup: pRes = CAudioGroupLoader::LoadAGSC(rInput, pEntry); break;
|
||||
case eAudioLookupTable: pRes = CAudioGroupLoader::LoadATBL(rInput, pEntry); break;
|
||||
case eBinaryData: pRes = CUnsupportedFormatLoader::LoadDUMB(rInput, pEntry); break;
|
||||
case eCharacter: pRes = CAnimSetLoader::LoadCHAR(rInput, pEntry); break;
|
||||
case eDependencyGroup: pRes = CDependencyGroupLoader::LoadDGRP(rInput, pEntry); break;
|
||||
case eDynamicCollision: pRes = CCollisionLoader::LoadDCLN(rInput, pEntry); break;
|
||||
case eFont: pRes = CFontLoader::LoadFONT(rInput, pEntry); break;
|
||||
case eGuiFrame: pRes = CUnsupportedFormatLoader::LoadFRME(rInput, pEntry); break;
|
||||
case eHintSystem: pRes = CUnsupportedFormatLoader::LoadHINT(rInput, pEntry); break;
|
||||
case eMapArea: pRes = CUnsupportedFormatLoader::LoadMAPA(rInput, pEntry); break;
|
||||
case eMapWorld: pRes = CUnsupportedFormatLoader::LoadMAPW(rInput, pEntry); break;
|
||||
case eMapUniverse: pRes = CUnsupportedFormatLoader::LoadMAPU(rInput, pEntry); break;
|
||||
case eMidi: pRes = CUnsupportedFormatLoader::LoadCSNG(rInput, pEntry); break;
|
||||
case eModel: pRes = CModelLoader::LoadCMDL(rInput, pEntry); break;
|
||||
case eRuleSet: pRes = CUnsupportedFormatLoader::LoadRULE(rInput, pEntry); break;
|
||||
case eScan: pRes = CScanLoader::LoadSCAN(rInput, pEntry); break;
|
||||
case eSkeleton: pRes = CSkeletonLoader::LoadCINF(rInput, pEntry); break;
|
||||
case eSkin: pRes = CSkinLoader::LoadCSKR(rInput, pEntry); break;
|
||||
case eSourceAnimData: pRes = CAnimSetLoader::LoadSAND(rInput, pEntry); break;
|
||||
case eStateMachine2: pRes = CUnsupportedFormatLoader::LoadFSM2(rInput, pEntry); break;
|
||||
case eStaticGeometryMap: pRes = CPoiToWorldLoader::LoadEGMC(rInput, pEntry); break;
|
||||
case eStringList: pRes = CAudioGroupLoader::LoadSTLC(rInput, pEntry); break;
|
||||
case eStringTable: pRes = CStringLoader::LoadSTRG(rInput, pEntry); break;
|
||||
case eTexture: pRes = CTextureDecoder::LoadTXTR(rInput, pEntry); break;
|
||||
case eWorld: pRes = CWorldLoader::LoadMLVL(rInput, pEntry); break;
|
||||
case EResourceType::Animation: pRes = CAnimationLoader::LoadANIM(rInput, pEntry); break;
|
||||
case EResourceType::AnimEventData: pRes = CAnimEventLoader::LoadEVNT(rInput, pEntry); break;
|
||||
case EResourceType::AnimSet: pRes = CAnimSetLoader::LoadANCS(rInput, pEntry); break;
|
||||
case EResourceType::Area: pRes = CAreaLoader::LoadMREA(rInput, pEntry); break;
|
||||
case EResourceType::AudioMacro: pRes = CUnsupportedFormatLoader::LoadCAUD(rInput, pEntry); break;
|
||||
case EResourceType::AudioGroup: pRes = CAudioGroupLoader::LoadAGSC(rInput, pEntry); break;
|
||||
case EResourceType::AudioLookupTable: pRes = CAudioGroupLoader::LoadATBL(rInput, pEntry); break;
|
||||
case EResourceType::BinaryData: pRes = CUnsupportedFormatLoader::LoadDUMB(rInput, pEntry); break;
|
||||
case EResourceType::Character: pRes = CAnimSetLoader::LoadCHAR(rInput, pEntry); break;
|
||||
case EResourceType::DependencyGroup: pRes = CDependencyGroupLoader::LoadDGRP(rInput, pEntry); break;
|
||||
case EResourceType::DynamicCollision: pRes = CCollisionLoader::LoadDCLN(rInput, pEntry); break;
|
||||
case EResourceType::Font: pRes = CFontLoader::LoadFONT(rInput, pEntry); break;
|
||||
case EResourceType::GuiFrame: pRes = CUnsupportedFormatLoader::LoadFRME(rInput, pEntry); break;
|
||||
case EResourceType::HintSystem: pRes = CUnsupportedFormatLoader::LoadHINT(rInput, pEntry); break;
|
||||
case EResourceType::MapArea: pRes = CUnsupportedFormatLoader::LoadMAPA(rInput, pEntry); break;
|
||||
case EResourceType::MapWorld: pRes = CUnsupportedFormatLoader::LoadMAPW(rInput, pEntry); break;
|
||||
case EResourceType::MapUniverse: pRes = CUnsupportedFormatLoader::LoadMAPU(rInput, pEntry); break;
|
||||
case EResourceType::Midi: pRes = CUnsupportedFormatLoader::LoadCSNG(rInput, pEntry); break;
|
||||
case EResourceType::Model: pRes = CModelLoader::LoadCMDL(rInput, pEntry); break;
|
||||
case EResourceType::RuleSet: pRes = CUnsupportedFormatLoader::LoadRULE(rInput, pEntry); break;
|
||||
case EResourceType::Scan: pRes = CScanLoader::LoadSCAN(rInput, pEntry); break;
|
||||
case EResourceType::Skeleton: pRes = CSkeletonLoader::LoadCINF(rInput, pEntry); break;
|
||||
case EResourceType::Skin: pRes = CSkinLoader::LoadCSKR(rInput, pEntry); break;
|
||||
case EResourceType::SourceAnimData: pRes = CAnimSetLoader::LoadSAND(rInput, pEntry); break;
|
||||
case EResourceType::StateMachine2: pRes = CUnsupportedFormatLoader::LoadFSM2(rInput, pEntry); break;
|
||||
case EResourceType::StaticGeometryMap: pRes = CPoiToWorldLoader::LoadEGMC(rInput, pEntry); break;
|
||||
case EResourceType::StringList: pRes = CAudioGroupLoader::LoadSTLC(rInput, pEntry); break;
|
||||
case EResourceType::StringTable: pRes = CStringLoader::LoadSTRG(rInput, pEntry); break;
|
||||
case EResourceType::Texture: pRes = CTextureDecoder::LoadTXTR(rInput, pEntry); break;
|
||||
case EResourceType::World: pRes = CWorldLoader::LoadMLVL(rInput, pEntry); break;
|
||||
|
||||
case eStateMachine:
|
||||
case EResourceType::StateMachine:
|
||||
// AFSM currently unsupported
|
||||
if (pEntry->Game() <= EGame::Echoes)
|
||||
pRes = new CDependencyGroup(pEntry);
|
||||
@@ -109,17 +109,17 @@ public:
|
||||
pRes = CUnsupportedFormatLoader::LoadFSMC(rInput, pEntry);
|
||||
break;
|
||||
|
||||
case eBurstFireData:
|
||||
case eParticle:
|
||||
case eParticleElectric:
|
||||
case eParticleSorted:
|
||||
case eParticleSpawn:
|
||||
case eParticleSwoosh:
|
||||
case eParticleDecal:
|
||||
case eParticleWeapon:
|
||||
case eParticleCollisionResponse:
|
||||
case eParticleTransform:
|
||||
case eUserEvaluatorData:
|
||||
case EResourceType::BurstFireData:
|
||||
case EResourceType::Particle:
|
||||
case EResourceType::ParticleElectric:
|
||||
case EResourceType::ParticleSorted:
|
||||
case EResourceType::ParticleSpawn:
|
||||
case EResourceType::ParticleSwoosh:
|
||||
case EResourceType::ParticleDecal:
|
||||
case EResourceType::ParticleWeapon:
|
||||
case EResourceType::ParticleCollisionResponse:
|
||||
case EResourceType::ParticleTransform:
|
||||
case EResourceType::UserEvaluatorData:
|
||||
pRes = CUnsupportedParticleLoader::LoadParticle(rInput, pEntry);
|
||||
break;
|
||||
|
||||
|
||||
@@ -9,15 +9,15 @@ CScanLoader::CScanLoader()
|
||||
CScan* CScanLoader::LoadScanMP1(IInputStream& rSCAN)
|
||||
{
|
||||
// Basic support at the moment - don't read animation/scan image data
|
||||
mpScan->mFrameID = CAssetID(rSCAN, e32Bit);
|
||||
mpScan->mpStringTable = gpResourceStore->LoadResource(rSCAN.ReadLong(), eStringTable);
|
||||
mpScan->mFrameID = CAssetID(rSCAN, k32Bit);
|
||||
mpScan->mpStringTable = gpResourceStore->LoadResource(rSCAN.ReadLong(), EResourceType::StringTable);
|
||||
mpScan->mIsSlow = (rSCAN.ReadLong() != 0);
|
||||
mpScan->mCategory = (CScan::ELogbookCategory) rSCAN.ReadLong();
|
||||
mpScan->mIsImportant = (rSCAN.ReadByte() == 1);
|
||||
|
||||
for (uint32 iImg = 0; iImg < 4; iImg++)
|
||||
{
|
||||
mpScan->mScanImageTextures[iImg] = CAssetID(rSCAN, e32Bit);
|
||||
mpScan->mScanImageTextures[iImg] = CAssetID(rSCAN, k32Bit);
|
||||
rSCAN.Seek(0x18, SEEK_CUR);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ void CScanLoader::LoadParamsMP2(IInputStream& rSCAN, uint16 NumProperties)
|
||||
switch (PropertyID)
|
||||
{
|
||||
case 0x2F5B6423:
|
||||
mpScan->mpStringTable = gpResourceStore->LoadResource(rSCAN.ReadLong(), eStringTable);
|
||||
mpScan->mpStringTable = gpResourceStore->LoadResource(rSCAN.ReadLong(), EResourceType::StringTable);
|
||||
break;
|
||||
|
||||
case 0xC308A322:
|
||||
@@ -199,7 +199,7 @@ void CScanLoader::LoadParamsMP2(IInputStream& rSCAN, uint16 NumProperties)
|
||||
rSCAN.GoTo(Next);
|
||||
}
|
||||
|
||||
mpScan->mCategory = CScan::eNone;
|
||||
mpScan->mCategory = CScan::ELogbookCategory::None;
|
||||
}
|
||||
|
||||
void CScanLoader::LoadParamsMP3(IInputStream& rSCAN, uint16 NumProperties)
|
||||
@@ -214,7 +214,7 @@ void CScanLoader::LoadParamsMP3(IInputStream& rSCAN, uint16 NumProperties)
|
||||
switch (PropertyID)
|
||||
{
|
||||
case 0x2F5B6423:
|
||||
mpScan->mpStringTable = gpResourceStore->LoadResource(rSCAN.ReadLongLong(), eStringTable);
|
||||
mpScan->mpStringTable = gpResourceStore->LoadResource(rSCAN.ReadLongLong(), EResourceType::Scan);
|
||||
break;
|
||||
|
||||
case 0xC308A322:
|
||||
@@ -229,7 +229,7 @@ void CScanLoader::LoadParamsMP3(IInputStream& rSCAN, uint16 NumProperties)
|
||||
rSCAN.GoTo(Next);
|
||||
}
|
||||
|
||||
mpScan->mCategory = CScan::eNone;
|
||||
mpScan->mCategory = CScan::ELogbookCategory::None;
|
||||
}
|
||||
|
||||
void CScanLoader::LoadScanInfoSecondaryModel(IInputStream& rSCAN, CScan::SScanInfoSecondaryModel& rSecondaryModel)
|
||||
|
||||
@@ -49,37 +49,37 @@ CTexture* CTextureDecoder::CreateTexture()
|
||||
pTex->mWidth = mWidth;
|
||||
pTex->mHeight = mHeight;
|
||||
pTex->mNumMipMaps = mNumMipMaps;
|
||||
pTex->mLinearSize = (uint32) (mWidth * mHeight * gskPixelsToBytes[mTexelFormat]);
|
||||
pTex->mLinearSize = (uint32) (mWidth * mHeight * gskPixelsToBytes[(int) mTexelFormat]);
|
||||
pTex->mpImgDataBuffer = mpDataBuffer;
|
||||
pTex->mImgDataSize = mDataBufferSize;
|
||||
pTex->mBufferExists = true;
|
||||
|
||||
switch (mTexelFormat)
|
||||
{
|
||||
case eGX_I4:
|
||||
case eGX_I8:
|
||||
case eGX_IA4:
|
||||
case eGX_IA8:
|
||||
pTex->mTexelFormat = eLuminanceAlpha;
|
||||
case ETexelFormat::GX_I4:
|
||||
case ETexelFormat::GX_I8:
|
||||
case ETexelFormat::GX_IA4:
|
||||
case ETexelFormat::GX_IA8:
|
||||
pTex->mTexelFormat = ETexelFormat::LuminanceAlpha;
|
||||
break;
|
||||
case eGX_RGB565:
|
||||
pTex->mTexelFormat = eRGB565;
|
||||
case ETexelFormat::GX_RGB565:
|
||||
pTex->mTexelFormat = ETexelFormat::RGB565;
|
||||
break;
|
||||
case eGX_C4:
|
||||
case eGX_C8:
|
||||
if (mPaletteFormat == ePalette_IA8) pTex->mTexelFormat = eLuminanceAlpha;
|
||||
if (mPaletteFormat == ePalette_RGB565) pTex->mTexelFormat = eRGB565;
|
||||
if (mPaletteFormat == ePalette_RGB5A3) pTex->mTexelFormat = eRGBA8;
|
||||
case ETexelFormat::GX_C4:
|
||||
case ETexelFormat::GX_C8:
|
||||
if (mPaletteFormat == EGXPaletteFormat::IA8) pTex->mTexelFormat = ETexelFormat::LuminanceAlpha;
|
||||
if (mPaletteFormat == EGXPaletteFormat::RGB565) pTex->mTexelFormat = ETexelFormat::RGB565;
|
||||
if (mPaletteFormat == EGXPaletteFormat::RGB5A3) pTex->mTexelFormat = ETexelFormat::RGBA8;
|
||||
break;
|
||||
case eGX_RGB5A3:
|
||||
case eGX_RGBA8:
|
||||
pTex->mTexelFormat = eRGBA8;
|
||||
case ETexelFormat::GX_RGB5A3:
|
||||
case ETexelFormat::GX_RGBA8:
|
||||
pTex->mTexelFormat = ETexelFormat::RGBA8;
|
||||
break;
|
||||
case eGX_CMPR:
|
||||
pTex->mTexelFormat = eDXT1;
|
||||
case ETexelFormat::GX_CMPR:
|
||||
pTex->mTexelFormat = ETexelFormat::DXT1;
|
||||
break;
|
||||
case eDXT1:
|
||||
pTex->mTexelFormat = eDXT1;
|
||||
case ETexelFormat::DXT1:
|
||||
pTex->mTexelFormat = ETexelFormat::DXT1;
|
||||
pTex->mLinearSize = mWidth * mHeight / 2;
|
||||
break;
|
||||
default:
|
||||
@@ -108,7 +108,7 @@ CTexture* CTextureDecoder::DoFullDecode(IInputStream& rTXTR, CResourceEntry *pEn
|
||||
Decoder.FullDecodeGXTexture(rTXTR);
|
||||
|
||||
CTexture *pTexture = Decoder.CreateTexture();
|
||||
pTexture->mTexelFormat = eRGBA8;
|
||||
pTexture->mTexelFormat = ETexelFormat::RGBA8;
|
||||
return pTexture;
|
||||
}
|
||||
|
||||
@@ -136,17 +136,17 @@ void CTextureDecoder::ReadTXTR(IInputStream& rTXTR)
|
||||
mNumMipMaps = rTXTR.ReadLong();
|
||||
|
||||
// For C4 and C8 images, read palette
|
||||
if ((mTexelFormat == eGX_C4) || (mTexelFormat == eGX_C8))
|
||||
if ((mTexelFormat == ETexelFormat::GX_C4) || (mTexelFormat == ETexelFormat::GX_C8))
|
||||
{
|
||||
mHasPalettes = true;
|
||||
mPaletteFormat = EGXPaletteFormat(rTXTR.ReadLong());
|
||||
rTXTR.Seek(0x4, SEEK_CUR);
|
||||
|
||||
uint32 PaletteEntryCount = (mTexelFormat == eGX_C4) ? 16 : 256;
|
||||
uint32 PaletteEntryCount = (mTexelFormat == ETexelFormat::GX_C4) ? 16 : 256;
|
||||
mPalettes.resize(PaletteEntryCount * 2);
|
||||
rTXTR.ReadBytes(mPalettes.data(), mPalettes.size());
|
||||
|
||||
mPaletteInput.SetData(mPalettes.data(), mPalettes.size(), IOUtil::eBigEndian);
|
||||
mPaletteInput.SetData(mPalettes.data(), mPalettes.size(), EEndian::BigEndian);
|
||||
}
|
||||
else mHasPalettes = false;
|
||||
}
|
||||
@@ -214,28 +214,28 @@ void CTextureDecoder::PartialDecodeGXTexture(IInputStream& TXTR)
|
||||
uint32 ImageSize = TXTR.Tell() - ImageStart;
|
||||
TXTR.Seek(ImageStart, SEEK_SET);
|
||||
|
||||
mDataBufferSize = ImageSize * (gskOutputBpp[mTexelFormat] / gskSourceBpp[mTexelFormat]);
|
||||
if ((mHasPalettes) && (mPaletteFormat == ePalette_RGB5A3)) mDataBufferSize *= 2;
|
||||
mDataBufferSize = ImageSize * (gskOutputBpp[(int) mTexelFormat] / gskSourceBpp[(int) mTexelFormat]);
|
||||
if ((mHasPalettes) && (mPaletteFormat == EGXPaletteFormat::RGB5A3)) mDataBufferSize *= 2;
|
||||
mpDataBuffer = new uint8[mDataBufferSize];
|
||||
|
||||
CMemoryOutStream Out(mpDataBuffer, mDataBufferSize, IOUtil::kSystemEndianness);
|
||||
CMemoryOutStream Out(mpDataBuffer, mDataBufferSize, EEndian::SystemEndian);
|
||||
|
||||
// Initializing more stuff before we start the mipmap loop
|
||||
uint32 MipW = mWidth, MipH = mHeight;
|
||||
uint32 MipOffset = 0;
|
||||
|
||||
uint32 BWidth = gskBlockWidth[mTexelFormat];
|
||||
uint32 BHeight = gskBlockHeight[mTexelFormat];
|
||||
uint32 BWidth = gskBlockWidth[(int) mTexelFormat];
|
||||
uint32 BHeight = gskBlockHeight[(int) mTexelFormat];
|
||||
|
||||
uint32 PixelStride = gskOutputPixelStride[mTexelFormat];
|
||||
if (mHasPalettes && (mPaletteFormat == ePalette_RGB5A3))
|
||||
uint32 PixelStride = gskOutputPixelStride[(int) mTexelFormat];
|
||||
if (mHasPalettes && (mPaletteFormat == EGXPaletteFormat::RGB5A3))
|
||||
PixelStride = 4;
|
||||
|
||||
// With CMPR, we're using a little trick.
|
||||
// CMPR stores pixels in 8x8 blocks, with four 4x4 subblocks.
|
||||
// An easy way to convert it is to pretend each block is 2x2 and each subblock is one pixel.
|
||||
// So to do that we need to calculate the "new" dimensions of the image, 1/4 the size of the original.
|
||||
if (mTexelFormat == eGX_CMPR) {
|
||||
if (mTexelFormat == ETexelFormat::GX_CMPR) {
|
||||
MipW /= 4;
|
||||
MipH /= 4;
|
||||
}
|
||||
@@ -261,33 +261,33 @@ void CTextureDecoder::PartialDecodeGXTexture(IInputStream& TXTR)
|
||||
uint32 DstPos = ((iImgY * MipW) + iImgX) * PixelStride;
|
||||
Out.Seek(MipOffset + DstPos, SEEK_SET);
|
||||
|
||||
if (mTexelFormat == eGX_I4) ReadPixelsI4(TXTR, Out);
|
||||
else if (mTexelFormat == eGX_I8) ReadPixelI8(TXTR, Out);
|
||||
else if (mTexelFormat == eGX_IA4) ReadPixelIA4(TXTR, Out);
|
||||
else if (mTexelFormat == eGX_IA8) ReadPixelIA8(TXTR, Out);
|
||||
else if (mTexelFormat == eGX_C4) ReadPixelsC4(TXTR, Out);
|
||||
else if (mTexelFormat == eGX_C8) ReadPixelC8(TXTR, Out);
|
||||
else if (mTexelFormat == eGX_RGB565) ReadPixelRGB565(TXTR, Out);
|
||||
else if (mTexelFormat == eGX_RGB5A3) ReadPixelRGB5A3(TXTR, Out);
|
||||
else if (mTexelFormat == eGX_RGBA8) ReadPixelRGBA8(TXTR, Out);
|
||||
else if (mTexelFormat == eGX_CMPR) ReadSubBlockCMPR(TXTR, Out);
|
||||
if (mTexelFormat == ETexelFormat::GX_I4) ReadPixelsI4(TXTR, Out);
|
||||
else if (mTexelFormat == ETexelFormat::GX_I8) ReadPixelI8(TXTR, Out);
|
||||
else if (mTexelFormat == ETexelFormat::GX_IA4) ReadPixelIA4(TXTR, Out);
|
||||
else if (mTexelFormat == ETexelFormat::GX_IA8) ReadPixelIA8(TXTR, Out);
|
||||
else if (mTexelFormat == ETexelFormat::GX_C4) ReadPixelsC4(TXTR, Out);
|
||||
else if (mTexelFormat == ETexelFormat::GX_C8) ReadPixelC8(TXTR, Out);
|
||||
else if (mTexelFormat == ETexelFormat::GX_RGB565) ReadPixelRGB565(TXTR, Out);
|
||||
else if (mTexelFormat == ETexelFormat::GX_RGB5A3) ReadPixelRGB5A3(TXTR, Out);
|
||||
else if (mTexelFormat == ETexelFormat::GX_RGBA8) ReadPixelRGBA8(TXTR, Out);
|
||||
else if (mTexelFormat == ETexelFormat::GX_CMPR) ReadSubBlockCMPR(TXTR, Out);
|
||||
|
||||
// I4 and C4 have 4bpp images, so I'm forced to read two pixels at a time.
|
||||
if ((mTexelFormat == eGX_I4) || (mTexelFormat == eGX_C4)) iImgX++;
|
||||
if ((mTexelFormat == ETexelFormat::GX_I4) || (mTexelFormat == ETexelFormat::GX_C4)) iImgX++;
|
||||
|
||||
// Check if we're at the end of the file.
|
||||
if (TXTR.EoF()) BreakEarly = true;
|
||||
}
|
||||
if (BreakEarly) break;
|
||||
}
|
||||
if (mTexelFormat == eGX_RGBA8) TXTR.Seek(0x20, SEEK_CUR);
|
||||
if (mTexelFormat == ETexelFormat::GX_RGBA8) TXTR.Seek(0x20, SEEK_CUR);
|
||||
if (BreakEarly) break;
|
||||
}
|
||||
if (BreakEarly) break;
|
||||
}
|
||||
|
||||
uint32 MipSize = (uint32) (MipW * MipH * gskPixelsToBytes[mTexelFormat]);
|
||||
if (mTexelFormat == eGX_CMPR) MipSize *= 16; // Since we're pretending the image is 1/4 its actual size, we have to multiply the size by 16 to get the correct offset
|
||||
uint32 MipSize = (uint32) (MipW * MipH * gskPixelsToBytes[(int) mTexelFormat]);
|
||||
if (mTexelFormat == ETexelFormat::GX_CMPR) MipSize *= 16; // Since we're pretending the image is 1/4 its actual size, we have to multiply the size by 16 to get the correct offset
|
||||
|
||||
MipOffset += MipSize;
|
||||
MipW /= 2;
|
||||
@@ -305,23 +305,23 @@ void CTextureDecoder::FullDecodeGXTexture(IInputStream& rTXTR)
|
||||
uint32 ImageSize = rTXTR.Tell() - ImageStart;
|
||||
rTXTR.Seek(ImageStart, SEEK_SET);
|
||||
|
||||
mDataBufferSize = ImageSize * (32 / gskSourceBpp[mTexelFormat]);
|
||||
mDataBufferSize = ImageSize * (32 / gskSourceBpp[(int) mTexelFormat]);
|
||||
mpDataBuffer = new uint8[mDataBufferSize];
|
||||
|
||||
CMemoryOutStream Out(mpDataBuffer, mDataBufferSize, IOUtil::kSystemEndianness);
|
||||
CMemoryOutStream Out(mpDataBuffer, mDataBufferSize, EEndian::SystemEndian);
|
||||
|
||||
// Initializing more stuff before we start the mipmap loop
|
||||
uint32 MipW = mWidth, MipH = mHeight;
|
||||
uint32 MipOffset = 0;
|
||||
|
||||
uint32 BWidth = gskBlockWidth[mTexelFormat];
|
||||
uint32 BHeight = gskBlockHeight[mTexelFormat];
|
||||
uint32 BWidth = gskBlockWidth[(int) mTexelFormat];
|
||||
uint32 BHeight = gskBlockHeight[(int) mTexelFormat];
|
||||
|
||||
// With CMPR, we're using a little trick.
|
||||
// CMPR stores pixels in 8x8 blocks, with four 4x4 subblocks.
|
||||
// An easy way to convert it is to pretend each block is 2x2 and each subblock is one pixel.
|
||||
// So to do that we need to calculate the "new" dimensions of the image, 1/4 the size of the original.
|
||||
if (mTexelFormat == eGX_CMPR)
|
||||
if (mTexelFormat == ETexelFormat::GX_CMPR)
|
||||
{
|
||||
MipW /= 4;
|
||||
MipH /= 4;
|
||||
@@ -334,45 +334,45 @@ void CTextureDecoder::FullDecodeGXTexture(IInputStream& rTXTR)
|
||||
for (uint32 iImgY = iBlockY; iImgY < iBlockY + BHeight; iImgY++) {
|
||||
for (uint32 iImgX = iBlockX; iImgX < iBlockX + BWidth; iImgX++)
|
||||
{
|
||||
uint32 DstPos = (mTexelFormat == eGX_CMPR) ? ((iImgY * (MipW * 4)) + iImgX) * 16 : ((iImgY * MipW) + iImgX) * 4;
|
||||
uint32 DstPos = (mTexelFormat == ETexelFormat::GX_CMPR) ? ((iImgY * (MipW * 4)) + iImgX) * 16 : ((iImgY * MipW) + iImgX) * 4;
|
||||
Out.Seek(MipOffset + DstPos, SEEK_SET);
|
||||
|
||||
// I4/C4/CMPR require reading more than one pixel at a time
|
||||
if (mTexelFormat == eGX_I4)
|
||||
if (mTexelFormat == ETexelFormat::GX_I4)
|
||||
{
|
||||
uint8 Byte = rTXTR.ReadByte();
|
||||
Out.WriteLong( DecodePixelI4(Byte, 0).ToLongARGB() );
|
||||
Out.WriteLong( DecodePixelI4(Byte, 1).ToLongARGB() );
|
||||
}
|
||||
else if (mTexelFormat == eGX_C4)
|
||||
else if (mTexelFormat == ETexelFormat::GX_C4)
|
||||
{
|
||||
uint8 Byte = rTXTR.ReadByte();
|
||||
Out.WriteLong( DecodePixelC4(Byte, 0, mPaletteInput).ToLongARGB() );
|
||||
Out.WriteLong( DecodePixelC4(Byte, 1, mPaletteInput).ToLongARGB() );
|
||||
}
|
||||
else if (mTexelFormat == eGX_CMPR) DecodeSubBlockCMPR(rTXTR, Out, (uint16) (MipW * 4));
|
||||
else if (mTexelFormat == ETexelFormat::GX_CMPR) DecodeSubBlockCMPR(rTXTR, Out, (uint16) (MipW * 4));
|
||||
|
||||
else
|
||||
{
|
||||
CColor Pixel;
|
||||
|
||||
if (mTexelFormat == eGX_I8) Pixel = DecodePixelI8(rTXTR.ReadByte());
|
||||
else if (mTexelFormat == eGX_IA4) Pixel = DecodePixelIA4(rTXTR.ReadByte());
|
||||
else if (mTexelFormat == eGX_IA8) Pixel = DecodePixelIA8(rTXTR.ReadShort());
|
||||
else if (mTexelFormat == eGX_C8) Pixel = DecodePixelC8(rTXTR.ReadByte(), mPaletteInput);
|
||||
else if (mTexelFormat == eGX_RGB565) Pixel = DecodePixelRGB565(rTXTR.ReadShort());
|
||||
else if (mTexelFormat == eGX_RGB5A3) Pixel = DecodePixelRGB5A3(rTXTR.ReadShort());
|
||||
else if (mTexelFormat == eGX_RGBA8) Pixel = CColor(rTXTR, true);
|
||||
if (mTexelFormat == ETexelFormat::GX_I8) Pixel = DecodePixelI8(rTXTR.ReadByte());
|
||||
else if (mTexelFormat == ETexelFormat::GX_IA4) Pixel = DecodePixelIA4(rTXTR.ReadByte());
|
||||
else if (mTexelFormat == ETexelFormat::GX_IA8) Pixel = DecodePixelIA8(rTXTR.ReadShort());
|
||||
else if (mTexelFormat == ETexelFormat::GX_C8) Pixel = DecodePixelC8(rTXTR.ReadByte(), mPaletteInput);
|
||||
else if (mTexelFormat == ETexelFormat::GX_RGB565) Pixel = DecodePixelRGB565(rTXTR.ReadShort());
|
||||
else if (mTexelFormat == ETexelFormat::GX_RGB5A3) Pixel = DecodePixelRGB5A3(rTXTR.ReadShort());
|
||||
else if (mTexelFormat == ETexelFormat::GX_RGBA8) Pixel = CColor(rTXTR, true);
|
||||
|
||||
Out.WriteLong(Pixel.ToLongARGB());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mTexelFormat == eGX_RGBA8) rTXTR.Seek(0x20, SEEK_CUR);
|
||||
if (mTexelFormat == ETexelFormat::GX_RGBA8) rTXTR.Seek(0x20, SEEK_CUR);
|
||||
}
|
||||
|
||||
uint32 MipSize = MipW * MipH * 4;
|
||||
if (mTexelFormat == eGX_CMPR) MipSize *= 16;
|
||||
if (mTexelFormat == ETexelFormat::GX_CMPR) MipSize *= 16;
|
||||
|
||||
MipOffset += MipSize;
|
||||
MipW /= 2;
|
||||
@@ -396,7 +396,7 @@ void CTextureDecoder::DecodeDDS(IInputStream& rDDS)
|
||||
else mDataBufferSize *= 4;
|
||||
mpDataBuffer = new uint8[mDataBufferSize];
|
||||
|
||||
CMemoryOutStream Out(mpDataBuffer, mDataBufferSize, IOUtil::kSystemEndianness);
|
||||
CMemoryOutStream Out(mpDataBuffer, mDataBufferSize, EEndian::SystemEndian);
|
||||
|
||||
// Initializing more stuff before we start the mipmap loop
|
||||
uint32 MipW = mWidth, MipH = mHeight;
|
||||
@@ -487,9 +487,9 @@ void CTextureDecoder::DecodeDDS(IInputStream& rDDS)
|
||||
}
|
||||
|
||||
if (mDDSInfo.Format == SDDSInfo::DXT1)
|
||||
mTexelFormat = eDXT1;
|
||||
mTexelFormat = ETexelFormat::DXT1;
|
||||
else
|
||||
mTexelFormat = eGX_RGBA8;
|
||||
mTexelFormat = ETexelFormat::GX_RGBA8;
|
||||
}
|
||||
|
||||
// ************ READ PIXELS (PARTIAL DECODE) ************
|
||||
@@ -567,9 +567,9 @@ void CTextureDecoder::ReadPixelC8(IInputStream& rSrc, IOutputStream& rDst)
|
||||
|
||||
mPaletteInput.Seek(Index * 2, SEEK_SET);
|
||||
|
||||
if (mPaletteFormat == ePalette_IA8) ReadPixelIA8(mPaletteInput, rDst);
|
||||
else if (mPaletteFormat == ePalette_RGB565) ReadPixelRGB565(mPaletteInput, rDst);
|
||||
else if (mPaletteFormat == ePalette_RGB5A3) ReadPixelRGB5A3(mPaletteInput, rDst);
|
||||
if (mPaletteFormat == EGXPaletteFormat::IA8) ReadPixelIA8(mPaletteInput, rDst);
|
||||
else if (mPaletteFormat == EGXPaletteFormat::RGB565) ReadPixelRGB565(mPaletteInput, rDst);
|
||||
else if (mPaletteFormat == EGXPaletteFormat::RGB5A3) ReadPixelRGB5A3(mPaletteInput, rDst);
|
||||
}
|
||||
|
||||
void CTextureDecoder::ReadPixelRGB565(IInputStream& rSrc, IOutputStream& rDst)
|
||||
@@ -659,18 +659,18 @@ CColor CTextureDecoder::DecodePixelC4(uint8 Byte, uint8 WhichPixel, IInputStream
|
||||
Byte &= 0xF;
|
||||
|
||||
rPaletteStream.Seek(Byte * 2, SEEK_SET);
|
||||
if (mPaletteFormat == ePalette_IA8) return DecodePixelIA8(rPaletteStream.ReadShort());
|
||||
else if (mPaletteFormat == ePalette_RGB565) return DecodePixelIA8(rPaletteStream.ReadShort());
|
||||
else if (mPaletteFormat == ePalette_RGB5A3) return DecodePixelIA8(rPaletteStream.ReadShort());
|
||||
if (mPaletteFormat == EGXPaletteFormat::IA8) return DecodePixelIA8(rPaletteStream.ReadShort());
|
||||
else if (mPaletteFormat == EGXPaletteFormat::RGB565) return DecodePixelIA8(rPaletteStream.ReadShort());
|
||||
else if (mPaletteFormat == EGXPaletteFormat::RGB5A3) return DecodePixelIA8(rPaletteStream.ReadShort());
|
||||
else return CColor::skTransparentBlack;
|
||||
}
|
||||
|
||||
CColor CTextureDecoder::DecodePixelC8(uint8 Byte, IInputStream& rPaletteStream)
|
||||
{
|
||||
rPaletteStream.Seek(Byte * 2, SEEK_SET);
|
||||
if (mPaletteFormat == ePalette_IA8) return DecodePixelIA8(rPaletteStream.ReadShort());
|
||||
else if (mPaletteFormat == ePalette_RGB565) return DecodePixelIA8(rPaletteStream.ReadShort());
|
||||
else if (mPaletteFormat == ePalette_RGB5A3) return DecodePixelIA8(rPaletteStream.ReadShort());
|
||||
if (mPaletteFormat == EGXPaletteFormat::IA8) return DecodePixelIA8(rPaletteStream.ReadShort());
|
||||
else if (mPaletteFormat == EGXPaletteFormat::RGB565) return DecodePixelIA8(rPaletteStream.ReadShort());
|
||||
else if (mPaletteFormat == EGXPaletteFormat::RGB5A3) return DecodePixelIA8(rPaletteStream.ReadShort());
|
||||
else return CColor::skTransparentBlack;
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ CDependencyGroup* CUnsupportedFormatLoader::LoadFRME(IInputStream& rFRME, CResou
|
||||
// Model
|
||||
else if (WidgetType == FOURCC('MODL'))
|
||||
{
|
||||
pGroup->AddDependency( CAssetID(rFRME, e32Bit) ); // CMDL
|
||||
pGroup->AddDependency( CAssetID(rFRME, k32Bit) ); // CMDL
|
||||
rFRME.Seek(0x8, SEEK_CUR);
|
||||
}
|
||||
|
||||
@@ -184,12 +184,12 @@ CDependencyGroup* CUnsupportedFormatLoader::LoadFRME(IInputStream& rFRME, CResou
|
||||
else if (WidgetType == FOURCC('TXPN'))
|
||||
{
|
||||
rFRME.Seek(0x14, SEEK_CUR);
|
||||
pGroup->AddDependency( CAssetID(rFRME, e32Bit) ); // FONT
|
||||
pGroup->AddDependency( CAssetID(rFRME, k32Bit) ); // FONT
|
||||
rFRME.Seek(0x32, SEEK_CUR);
|
||||
|
||||
if (Version == 1)
|
||||
{
|
||||
pGroup->AddDependency( CAssetID(rFRME, e32Bit) ); // FONT
|
||||
pGroup->AddDependency( CAssetID(rFRME, k32Bit) ); // FONT
|
||||
rFRME.Seek(0x8, SEEK_CUR);
|
||||
}
|
||||
}
|
||||
@@ -197,7 +197,7 @@ CDependencyGroup* CUnsupportedFormatLoader::LoadFRME(IInputStream& rFRME, CResou
|
||||
// Image Pane
|
||||
else if (WidgetType == FOURCC('IMGP'))
|
||||
{
|
||||
pGroup->AddDependency( CAssetID(rFRME, e32Bit) ); // TXTR
|
||||
pGroup->AddDependency( CAssetID(rFRME, k32Bit) ); // TXTR
|
||||
if (rFRME.ReadLong() != 0xFFFFFFFF) DEBUG_BREAK;
|
||||
rFRME.Seek(0x4, SEEK_CUR);
|
||||
|
||||
@@ -210,7 +210,7 @@ CDependencyGroup* CUnsupportedFormatLoader::LoadFRME(IInputStream& rFRME, CResou
|
||||
// Energy Bar
|
||||
else if (WidgetType == FOURCC('ENRG'))
|
||||
{
|
||||
pGroup->AddDependency( CAssetID(rFRME, e32Bit) ); // TXTR
|
||||
pGroup->AddDependency( CAssetID(rFRME, k32Bit) ); // TXTR
|
||||
}
|
||||
|
||||
// Slider Group
|
||||
@@ -438,7 +438,7 @@ CMapArea* CUnsupportedFormatLoader::LoadMAPA(IInputStream& /*rMAPA*/, CResourceE
|
||||
CAssetID MapWorldID;
|
||||
uint32 WorldIndex = -1;
|
||||
|
||||
for (TResourceIterator<eMapWorld> It; It; ++It)
|
||||
for (TResourceIterator<EResourceType::MapWorld> It; It; ++It)
|
||||
{
|
||||
CDependencyGroup *pGroup = (CDependencyGroup*) It->Load();
|
||||
|
||||
@@ -459,7 +459,7 @@ CMapArea* CUnsupportedFormatLoader::LoadMAPA(IInputStream& /*rMAPA*/, CResourceE
|
||||
// Find a world that contains this MapWorld
|
||||
if (WorldIndex != -1)
|
||||
{
|
||||
for (TResourceIterator<eWorld> It; It; ++It)
|
||||
for (TResourceIterator<EResourceType::World> It; It; ++It)
|
||||
{
|
||||
CWorld *pWorld = (CWorld*) It->Load();
|
||||
CDependencyGroup *pMapWorld = (CDependencyGroup*) pWorld->MapWorld();
|
||||
@@ -490,7 +490,7 @@ CDependencyGroup* CUnsupportedFormatLoader::LoadMAPW(IInputStream& rMAPW, CResou
|
||||
// Version check
|
||||
uint32 AreasStart = rMAPW.Tell();
|
||||
rMAPW.Seek(NumAreas * 4, SEEK_CUR);
|
||||
EIDLength IDLength = (rMAPW.EoF() || rMAPW.ReadLong() == 0xFFFFFFFF ? e32Bit : e64Bit);
|
||||
EIDLength IDLength = (rMAPW.EoF() || rMAPW.ReadLong() == 0xFFFFFFFF ? k32Bit : k64Bit);
|
||||
rMAPW.Seek(AreasStart, SEEK_SET);
|
||||
|
||||
// Read MAPA IDs
|
||||
@@ -542,7 +542,7 @@ CDependencyGroup* CUnsupportedFormatLoader::LoadRULE(IInputStream& rRULE, CResou
|
||||
uint32 IDOffset = rRULE.Tell();
|
||||
rRULE.Seek(0x4, SEEK_CUR);
|
||||
uint32 RuleSetCount = rRULE.ReadShort();
|
||||
EIDLength IDLength = (RuleSetCount > 0xFF ? e64Bit : e32Bit);
|
||||
EIDLength IDLength = (RuleSetCount > 0xFF ? k64Bit : k32Bit);
|
||||
rRULE.Seek(IDOffset, SEEK_SET);
|
||||
|
||||
// Read rule ID
|
||||
|
||||
@@ -16,19 +16,19 @@ void CWorldLoader::LoadPrimeMLVL(IInputStream& rMLVL)
|
||||
// Header
|
||||
if (mVersion < EGame::CorruptionProto)
|
||||
{
|
||||
mpWorld->mpWorldName = gpResourceStore->LoadResource(rMLVL.ReadLong(), eStringTable);
|
||||
if (mVersion == EGame::Echoes) mpWorld->mpDarkWorldName = gpResourceStore->LoadResource(rMLVL.ReadLong(), eStringTable);
|
||||
mpWorld->mpWorldName = gpResourceStore->LoadResource(rMLVL.ReadLong(), EResourceType::StringTable);
|
||||
if (mVersion == EGame::Echoes) mpWorld->mpDarkWorldName = gpResourceStore->LoadResource(rMLVL.ReadLong(), EResourceType::StringTable);
|
||||
if (mVersion >= EGame::Echoes) mpWorld->mTempleKeyWorldIndex = rMLVL.ReadLong();
|
||||
if (mVersion >= EGame::Prime) mpWorld->mpSaveWorld = gpResourceStore->LoadResource(rMLVL.ReadLong(), eSaveWorld);
|
||||
mpWorld->mpDefaultSkybox = gpResourceStore->LoadResource(rMLVL.ReadLong(), eModel);
|
||||
if (mVersion >= EGame::Prime) mpWorld->mpSaveWorld = gpResourceStore->LoadResource(rMLVL.ReadLong(), EResourceType::SaveWorld);
|
||||
mpWorld->mpDefaultSkybox = gpResourceStore->LoadResource(rMLVL.ReadLong(), EResourceType::Model);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
mpWorld->mpWorldName = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), eStringTable);
|
||||
mpWorld->mpWorldName = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), EResourceType::StringTable);
|
||||
rMLVL.Seek(0x4, SEEK_CUR); // Skipping unknown value
|
||||
mpWorld->mpSaveWorld = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), eSaveWorld);
|
||||
mpWorld->mpDefaultSkybox = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), eModel);
|
||||
mpWorld->mpSaveWorld = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), EResourceType::SaveWorld);
|
||||
mpWorld->mpDefaultSkybox = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), EResourceType::Model);
|
||||
}
|
||||
|
||||
// Memory relays - only in MP1
|
||||
@@ -132,7 +132,7 @@ void CWorldLoader::LoadPrimeMLVL(IInputStream& rMLVL)
|
||||
}
|
||||
|
||||
// MapWorld
|
||||
mpWorld->mpMapWorld = gpResourceStore->LoadResource( CAssetID(rMLVL, mVersion), eMapWorld );
|
||||
mpWorld->mpMapWorld = gpResourceStore->LoadResource( CAssetID(rMLVL, mVersion), EResourceType::MapWorld );
|
||||
rMLVL.Seek(0x5, SEEK_CUR); // Unknown values which are always 0
|
||||
|
||||
// Audio Groups - we don't need this info as we regenerate it on cook
|
||||
@@ -200,7 +200,7 @@ void CWorldLoader::LoadReturnsMLVL(IInputStream& rMLVL)
|
||||
rData.ShinyGoldTime = rMLVL.ReadFloat();
|
||||
}
|
||||
|
||||
mpWorld->mpSaveWorld = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), eSaveWorld);
|
||||
mpWorld->mpSaveWorld = gpResourceStore->LoadResource(rMLVL.ReadLongLong(), EResourceType::SaveWorld);
|
||||
mpWorld->mpDefaultSkybox = gpResourceStore->LoadResource<CModel>(rMLVL.ReadLongLong());
|
||||
|
||||
// Areas
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
class CBasicModel : public CResource
|
||||
{
|
||||
DECLARE_RESOURCE_TYPE(eModel)
|
||||
DECLARE_RESOURCE_TYPE(Model)
|
||||
protected:
|
||||
CAABox mAABox;
|
||||
uint32 mVertexCount;
|
||||
|
||||
@@ -76,13 +76,13 @@ void CModel::BufferGL()
|
||||
// then add the indices to the IBO. We convert some primitives to strips to minimize draw calls.
|
||||
switch (pPrim->Type)
|
||||
{
|
||||
case eGX_Triangles:
|
||||
case EPrimitiveType::Triangles:
|
||||
pIBO->TrianglesToStrips(Indices.data(), Indices.size());
|
||||
break;
|
||||
case eGX_TriangleFan:
|
||||
case EPrimitiveType::TriangleFan:
|
||||
pIBO->FansToStrips(Indices.data(), Indices.size());
|
||||
break;
|
||||
case eGX_Quads:
|
||||
case EPrimitiveType::Quads:
|
||||
pIBO->QuadsToStrips(Indices.data(), Indices.size());
|
||||
break;
|
||||
default:
|
||||
@@ -137,12 +137,12 @@ void CModel::DrawSurface(FRenderOptions Options, uint32 Surface, uint32 MatSet)
|
||||
MatSet = mMaterialSets.size() - 1;
|
||||
|
||||
// Bind material
|
||||
if ((Options & eNoMaterialSetup) == 0)
|
||||
if ((Options & ERenderOption::NoMaterialSetup) == 0)
|
||||
{
|
||||
SSurface *pSurf = mSurfaces[Surface];
|
||||
CMaterial *pMat = mMaterialSets[MatSet]->MaterialByIndex(pSurf->MaterialID);
|
||||
|
||||
if (!Options.HasFlag(eEnableOccluders) && pMat->Options().HasFlag(CMaterial::eOccluder))
|
||||
if (!Options.HasFlag(ERenderOption::EnableOccluders) && pMat->Options().HasFlag(EMaterialOption::Occluder))
|
||||
return;
|
||||
|
||||
pMat->SetCurrent(Options);
|
||||
@@ -168,7 +168,7 @@ void CModel::DrawWireframe(FRenderOptions Options, CColor WireColor /*= CColor::
|
||||
// Set up wireframe
|
||||
WireColor.A = 0;
|
||||
CDrawUtil::UseColorShader(WireColor);
|
||||
Options |= eNoMaterialSetup;
|
||||
Options |= ERenderOption::NoMaterialSetup;
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
glBlendFunc(GL_ONE, GL_ZERO);
|
||||
|
||||
@@ -185,9 +185,11 @@ void CModel::SetSkin(CSkin *pSkin)
|
||||
// Assert commented out because it actually failed somewhere! Needs to be addressed.
|
||||
//ASSERT(!mpSkin || !pSkin || mpSkin == pSkin); // This is to verify no model has more than one unique skin applied
|
||||
|
||||
//@todo this is actually really dumb and could be handled much better (and much more inline with how the game does it)
|
||||
// by simply storing skinning data in a different vertex buffer that isn't tied to the model's vertex buffer
|
||||
if (mpSkin != pSkin)
|
||||
{
|
||||
const FVertexDescription kBoneFlags = (eBoneIndices | eBoneWeights);
|
||||
const FVertexDescription kBoneFlags = (EVertexAttribute::BoneIndices | EVertexAttribute::BoneWeights);
|
||||
|
||||
mpSkin = pSkin;
|
||||
mVBO.SetSkin(pSkin);
|
||||
@@ -261,7 +263,7 @@ bool CModel::HasTransparency(uint32 MatSet)
|
||||
MatSet = mMaterialSets.size() - 1;
|
||||
|
||||
for (uint32 iMat = 0; iMat < mMaterialSets[MatSet]->NumMaterials(); iMat++)
|
||||
if (mMaterialSets[MatSet]->MaterialByIndex(iMat)->Options() & CMaterial::eTransparent ) return true;
|
||||
if (mMaterialSets[MatSet]->MaterialByIndex(iMat)->Options() & EMaterialOption::Transparent ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -272,7 +274,7 @@ bool CModel::IsSurfaceTransparent(uint32 Surface, uint32 MatSet)
|
||||
MatSet = mMaterialSets.size() - 1;
|
||||
|
||||
uint32 matID = mSurfaces[Surface]->MaterialID;
|
||||
return (mMaterialSets[MatSet]->MaterialByIndex(matID)->Options() & CMaterial::eTransparent) != 0;
|
||||
return (mMaterialSets[MatSet]->MaterialByIndex(matID)->Options() & EMaterialOption::Transparent) != 0;
|
||||
}
|
||||
|
||||
bool CModel::IsLightmapped() const
|
||||
@@ -284,14 +286,14 @@ bool CModel::IsLightmapped() const
|
||||
for (uint32 iMat = 0; iMat < pSet->NumMaterials(); iMat++)
|
||||
{
|
||||
CMaterial *pMat = pSet->MaterialByIndex(iMat);
|
||||
if (pMat->Options().HasFlag(CMaterial::eLightmap))
|
||||
if (pMat->Options().HasFlag(EMaterialOption::Lightmap))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CIndexBuffer* CModel::InternalGetIBO(uint32 Surface, EGXPrimitiveType Primitive)
|
||||
CIndexBuffer* CModel::InternalGetIBO(uint32 Surface, EPrimitiveType Primitive)
|
||||
{
|
||||
std::vector<CIndexBuffer> *pIBOs = &mSurfaceIndexBuffers[Surface];
|
||||
GLenum Type = GXPrimToGLPrim(Primitive);
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
inline bool IsSkinned() const { return (mpSkin != nullptr); }
|
||||
|
||||
private:
|
||||
CIndexBuffer* InternalGetIBO(uint32 Surface, EGXPrimitiveType Primitive);
|
||||
CIndexBuffer* InternalGetIBO(uint32 Surface, EPrimitiveType Primitive);
|
||||
};
|
||||
|
||||
#endif // MODEL_H
|
||||
|
||||
@@ -13,7 +13,7 @@ CStaticModel::CStaticModel()
|
||||
CStaticModel::CStaticModel(CMaterial *pMat)
|
||||
: CBasicModel()
|
||||
, mpMaterial(pMat)
|
||||
, mTransparent((pMat->Options() & CMaterial::eTransparent) != 0)
|
||||
, mTransparent((pMat->Options() & EMaterialOption::Transparent) != 0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -58,13 +58,13 @@ void CStaticModel::BufferGL()
|
||||
// then add the indices to the IBO. We convert some primitives to strips to minimize draw calls.
|
||||
switch (pPrim->Type)
|
||||
{
|
||||
case eGX_Triangles:
|
||||
case EPrimitiveType::Triangles:
|
||||
pIBO->TrianglesToStrips(Indices.data(), Indices.size());
|
||||
break;
|
||||
case eGX_TriangleFan:
|
||||
case EPrimitiveType::TriangleFan:
|
||||
pIBO->FansToStrips(Indices.data(), Indices.size());
|
||||
break;
|
||||
case eGX_Quads:
|
||||
case EPrimitiveType::Quads:
|
||||
pIBO->QuadsToStrips(Indices.data(), Indices.size());
|
||||
break;
|
||||
default:
|
||||
@@ -109,7 +109,7 @@ void CStaticModel::Draw(FRenderOptions Options)
|
||||
{
|
||||
if (!mBuffered) BufferGL();
|
||||
|
||||
if ((Options & eNoMaterialSetup) == 0) mpMaterial->SetCurrent(Options);
|
||||
if ((Options & ERenderOption::NoMaterialSetup) == 0) mpMaterial->SetCurrent(Options);
|
||||
|
||||
// Draw IBOs
|
||||
mVBO.Bind();
|
||||
@@ -133,7 +133,7 @@ void CStaticModel::DrawSurface(FRenderOptions Options, uint32 Surface)
|
||||
|
||||
mVBO.Bind();
|
||||
glLineWidth(1.f);
|
||||
if ((Options & eNoMaterialSetup) == 0) mpMaterial->SetCurrent(Options);
|
||||
if ((Options & ERenderOption::NoMaterialSetup) == 0) mpMaterial->SetCurrent(Options);
|
||||
|
||||
for (uint32 iIBO = 0; iIBO < mIBOs.size(); iIBO++)
|
||||
{
|
||||
@@ -159,7 +159,7 @@ void CStaticModel::DrawWireframe(FRenderOptions Options, CColor WireColor /*= CC
|
||||
// Set up wireframe
|
||||
WireColor.A = 0;
|
||||
CDrawUtil::UseColorShader(WireColor);
|
||||
Options |= eNoMaterialSetup;
|
||||
Options |= ERenderOption::NoMaterialSetup;
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
glBlendFunc(GL_ONE, GL_ZERO);
|
||||
|
||||
@@ -179,7 +179,7 @@ CMaterial* CStaticModel::GetMaterial()
|
||||
void CStaticModel::SetMaterial(CMaterial *pMat)
|
||||
{
|
||||
mpMaterial = pMat;
|
||||
mTransparent = pMat->Options().HasFlag(CMaterial::eTransparent);
|
||||
mTransparent = pMat->Options().HasFlag(EMaterialOption::Transparent);
|
||||
}
|
||||
|
||||
bool CStaticModel::IsTransparent()
|
||||
@@ -189,10 +189,10 @@ bool CStaticModel::IsTransparent()
|
||||
|
||||
bool CStaticModel::IsOccluder()
|
||||
{
|
||||
return mpMaterial->Options().HasFlag(CMaterial::eOccluder);
|
||||
return mpMaterial->Options().HasFlag(EMaterialOption::Occluder);
|
||||
}
|
||||
|
||||
CIndexBuffer* CStaticModel::InternalGetIBO(EGXPrimitiveType Primitive)
|
||||
CIndexBuffer* CStaticModel::InternalGetIBO(EPrimitiveType Primitive)
|
||||
{
|
||||
GLenum type = GXPrimToGLPrim(Primitive);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
bool IsOccluder();
|
||||
|
||||
private:
|
||||
CIndexBuffer* InternalGetIBO(EGXPrimitiveType Primitive);
|
||||
CIndexBuffer* InternalGetIBO(EPrimitiveType Primitive);
|
||||
};
|
||||
|
||||
#endif // CSTATICMODEL_H
|
||||
|
||||
@@ -7,23 +7,23 @@ uint32 VertexAttributeSize(EVertexAttribute Attrib)
|
||||
{
|
||||
switch (Attrib)
|
||||
{
|
||||
case ePosition:
|
||||
case eNormal:
|
||||
case EVertexAttribute::Position:
|
||||
case EVertexAttribute::Normal:
|
||||
return 0x0C;
|
||||
case eColor0:
|
||||
case eColor1:
|
||||
case eBoneWeights:
|
||||
case EVertexAttribute::Color0:
|
||||
case EVertexAttribute::Color1:
|
||||
case EVertexAttribute::BoneWeights:
|
||||
return 0x10;
|
||||
case eTex0:
|
||||
case eTex1:
|
||||
case eTex2:
|
||||
case eTex3:
|
||||
case eTex4:
|
||||
case eTex5:
|
||||
case eTex6:
|
||||
case eTex7:
|
||||
case EVertexAttribute::Tex0:
|
||||
case EVertexAttribute::Tex1:
|
||||
case EVertexAttribute::Tex2:
|
||||
case EVertexAttribute::Tex3:
|
||||
case EVertexAttribute::Tex4:
|
||||
case EVertexAttribute::Tex5:
|
||||
case EVertexAttribute::Tex6:
|
||||
case EVertexAttribute::Tex7:
|
||||
return 0x08;
|
||||
case eBoneIndices:
|
||||
case EVertexAttribute::BoneIndices:
|
||||
return 0x04;
|
||||
default:
|
||||
errorf("AttributeSize(): Unknown vertex attribute: %d", Attrib);
|
||||
|
||||
@@ -3,33 +3,33 @@
|
||||
|
||||
#include <Common/Flags.h>
|
||||
|
||||
enum EVertexAttribute
|
||||
enum class EVertexAttribute
|
||||
{
|
||||
eNoAttributes = 0x0,
|
||||
ePosition = 0x1,
|
||||
eNormal = 0x2,
|
||||
eColor0 = 0x4,
|
||||
eColor1 = 0x8,
|
||||
eTex0 = 0x10,
|
||||
eTex1 = 0x20,
|
||||
eTex2 = 0x40,
|
||||
eTex3 = 0x80,
|
||||
eTex4 = 0x100,
|
||||
eTex5 = 0x200,
|
||||
eTex6 = 0x400,
|
||||
eTex7 = 0x800,
|
||||
eBoneIndices = 0x1000,
|
||||
eBoneWeights = 0x2000,
|
||||
ePosMtx = 0x4000,
|
||||
eTex0Mtx = 0x8000,
|
||||
eTex1Mtx = 0x10000,
|
||||
eTex2Mtx = 0x20000,
|
||||
eTex3Mtx = 0x40000,
|
||||
eTex4Mtx = 0x80000,
|
||||
eTex5Mtx = 0x100000,
|
||||
eTex6Mtx = 0x200000
|
||||
None = 0x0,
|
||||
Position = 0x1,
|
||||
Normal = 0x2,
|
||||
Color0 = 0x4,
|
||||
Color1 = 0x8,
|
||||
Tex0 = 0x10,
|
||||
Tex1 = 0x20,
|
||||
Tex2 = 0x40,
|
||||
Tex3 = 0x80,
|
||||
Tex4 = 0x100,
|
||||
Tex5 = 0x200,
|
||||
Tex6 = 0x400,
|
||||
Tex7 = 0x800,
|
||||
BoneIndices = 0x1000,
|
||||
BoneWeights = 0x2000,
|
||||
PosMtx = 0x4000,
|
||||
Tex0Mtx = 0x8000,
|
||||
Tex1Mtx = 0x10000,
|
||||
Tex2Mtx = 0x20000,
|
||||
Tex3Mtx = 0x40000,
|
||||
Tex4Mtx = 0x80000,
|
||||
Tex5Mtx = 0x100000,
|
||||
Tex6Mtx = 0x200000
|
||||
};
|
||||
DECLARE_FLAGS(EVertexAttribute, FVertexDescription)
|
||||
DECLARE_FLAGS_ENUMCLASS(EVertexAttribute, FVertexDescription)
|
||||
|
||||
extern const uint32 gkNumVertexAttribs;
|
||||
uint32 VertexAttributeSize(EVertexAttribute Attrib);
|
||||
|
||||
@@ -14,11 +14,11 @@ std::pair<bool,float> SSurface::IntersectsRay(const CRay& rkRay, bool AllowBackf
|
||||
uint32 NumVerts = pPrim->Vertices.size();
|
||||
|
||||
// Triangles
|
||||
if ((pPrim->Type == eGX_Triangles) || (pPrim->Type == eGX_TriangleFan) || (pPrim->Type == eGX_TriangleStrip))
|
||||
if ((pPrim->Type == EPrimitiveType::Triangles) || (pPrim->Type == EPrimitiveType::TriangleFan) || (pPrim->Type == EPrimitiveType::TriangleStrip))
|
||||
{
|
||||
uint32 NumTris;
|
||||
|
||||
if (pPrim->Type == eGX_Triangles)
|
||||
if (pPrim->Type == EPrimitiveType::Triangles)
|
||||
NumTris = NumVerts / 3;
|
||||
else
|
||||
NumTris = NumVerts - 2;
|
||||
@@ -28,7 +28,7 @@ std::pair<bool,float> SSurface::IntersectsRay(const CRay& rkRay, bool AllowBackf
|
||||
CVector3f VtxA, VtxB, VtxC;
|
||||
|
||||
// Get the three vertices that make up the current tri
|
||||
if (pPrim->Type == eGX_Triangles)
|
||||
if (pPrim->Type == EPrimitiveType::Triangles)
|
||||
{
|
||||
uint32 VertIndex = iTri * 3;
|
||||
VtxA = pPrim->Vertices[VertIndex].Position;
|
||||
@@ -36,14 +36,14 @@ std::pair<bool,float> SSurface::IntersectsRay(const CRay& rkRay, bool AllowBackf
|
||||
VtxC = pPrim->Vertices[VertIndex+2].Position;
|
||||
}
|
||||
|
||||
else if (pPrim->Type == eGX_TriangleFan)
|
||||
else if (pPrim->Type == EPrimitiveType::TriangleFan)
|
||||
{
|
||||
VtxA = pPrim->Vertices[0].Position;
|
||||
VtxB = pPrim->Vertices[iTri+1].Position;
|
||||
VtxC = pPrim->Vertices[iTri+2].Position;
|
||||
}
|
||||
|
||||
else if (pPrim->Type = eGX_TriangleStrip)
|
||||
else if (pPrim->Type == EPrimitiveType::TriangleStrip)
|
||||
{
|
||||
if (iTri & 0x1)
|
||||
{
|
||||
@@ -75,11 +75,11 @@ std::pair<bool,float> SSurface::IntersectsRay(const CRay& rkRay, bool AllowBackf
|
||||
}
|
||||
|
||||
// Lines
|
||||
if ((pPrim->Type == eGX_Lines) || (pPrim->Type == eGX_LineStrip))
|
||||
if ((pPrim->Type == EPrimitiveType::Lines) || (pPrim->Type == EPrimitiveType::LineStrip))
|
||||
{
|
||||
uint32 NumLines;
|
||||
|
||||
if (pPrim->Type == eGX_Lines)
|
||||
if (pPrim->Type == EPrimitiveType::Lines)
|
||||
NumLines = NumVerts / 2;
|
||||
else
|
||||
NumLines = NumVerts - 1;
|
||||
@@ -89,7 +89,7 @@ std::pair<bool,float> SSurface::IntersectsRay(const CRay& rkRay, bool AllowBackf
|
||||
CVector3f VtxA, VtxB;
|
||||
|
||||
// Get the two vertices that make up the current line
|
||||
uint32 Index = (pPrim->Type == eGX_Lines ? iLine * 2 : iLine);
|
||||
uint32 Index = (pPrim->Type == EPrimitiveType::Lines ? iLine * 2 : iLine);
|
||||
VtxA = pPrim->Vertices[Index].Position;
|
||||
VtxB = pPrim->Vertices[Index+1].Position;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ struct SSurface
|
||||
|
||||
struct SPrimitive
|
||||
{
|
||||
EGXPrimitiveType Type;
|
||||
EPrimitiveType Type;
|
||||
std::vector<CVertex> Vertices;
|
||||
};
|
||||
std::vector<SPrimitive> Primitives;
|
||||
|
||||
@@ -92,8 +92,8 @@ public:
|
||||
CScriptObject *pNewSender = mpArea->InstanceByID(NewSenderID);
|
||||
|
||||
mSenderID = NewSenderID;
|
||||
if (pOldSender) pOldSender->RemoveLink(eOutgoing, this);
|
||||
pNewSender->AddLink(eOutgoing, this, Index);
|
||||
if (pOldSender) pOldSender->RemoveLink(ELinkType::Outgoing, this);
|
||||
pNewSender->AddLink(ELinkType::Outgoing, this, Index);
|
||||
}
|
||||
|
||||
void SetReceiver(uint32 NewReceiverID, uint32 Index = -1)
|
||||
@@ -103,8 +103,8 @@ public:
|
||||
CScriptObject *pNewReceiver = mpArea->InstanceByID(NewReceiverID);
|
||||
|
||||
mReceiverID = NewReceiverID;
|
||||
if (pOldReceiver) pOldReceiver->RemoveLink(eIncoming, this);
|
||||
pNewReceiver->AddLink(eIncoming, this, Index);
|
||||
if (pOldReceiver) pOldReceiver->RemoveLink(ELinkType::Incoming, this);
|
||||
pNewReceiver->AddLink(ELinkType::Incoming, this, Index);
|
||||
}
|
||||
|
||||
uint32 SenderIndex() const
|
||||
@@ -113,9 +113,9 @@ public:
|
||||
|
||||
if (pSender)
|
||||
{
|
||||
for (uint32 iLink = 0; iLink < pSender->NumLinks(eOutgoing); iLink++)
|
||||
for (uint32 iLink = 0; iLink < pSender->NumLinks(ELinkType::Outgoing); iLink++)
|
||||
{
|
||||
if (pSender->Link(eOutgoing, iLink) == this)
|
||||
if (pSender->Link(ELinkType::Outgoing, iLink) == this)
|
||||
return iLink;
|
||||
}
|
||||
}
|
||||
@@ -129,9 +129,9 @@ public:
|
||||
|
||||
if (pReceiver)
|
||||
{
|
||||
for (uint32 iLink = 0; iLink < pReceiver->NumLinks(eIncoming); iLink++)
|
||||
for (uint32 iLink = 0; iLink < pReceiver->NumLinks(ELinkType::Incoming); iLink++)
|
||||
{
|
||||
if (pReceiver->Link(eIncoming, iLink) == this)
|
||||
if (pReceiver->Link(ELinkType::Incoming, iLink) == this)
|
||||
return iLink;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,14 +140,14 @@ bool CScriptObject::HasNearVisibleActivation() const
|
||||
CLink *pLink = mInLinks[iLink];
|
||||
|
||||
// Check for trigger activation
|
||||
if (pLink->State() == 0x49533034 || pLink->State() == 0x49533035 || pLink->State() == 0x49533036) // "IS04", "IS05", or "IS06"
|
||||
if (pLink->State() == FOURCC('IS04') || pLink->State() == FOURCC('IS05') || pLink->State() == FOURCC('IS06'))
|
||||
{
|
||||
if ( (!IsRelay && pLink->Message() == 0x41435456) || // "ACTV"
|
||||
(IsRelay && pLink->Message() == 0x4143544E) ) // "ACTN"
|
||||
if ( (!IsRelay && pLink->Message() == FOURCC('ACTV')) ||
|
||||
(IsRelay && pLink->Message() == FOURCC('ACTN')) )
|
||||
{
|
||||
CScriptObject *pObj = pLink->Sender();
|
||||
|
||||
if (pObj->ObjectTypeID() == 0x54524752) // "TRGR"
|
||||
if (pObj->ObjectTypeID() == FOURCC('TRGR'))
|
||||
{
|
||||
mIsCheckingNearVisibleActivation = false;
|
||||
return true;
|
||||
@@ -156,14 +156,14 @@ bool CScriptObject::HasNearVisibleActivation() const
|
||||
}
|
||||
|
||||
// Check for relay activation
|
||||
else if (pLink->State() == 0x524C4159) // "RLAY"
|
||||
else if (pLink->State() == FOURCC('RLAY'))
|
||||
{
|
||||
if ( (!IsRelay && pLink->Message() == 0x41435456) || // "ACTV"
|
||||
(IsRelay && pLink->Message() == 0x4143544E) ) // "ACTN"
|
||||
if ( (!IsRelay && pLink->Message() == FOURCC('ACTV')) ||
|
||||
(IsRelay && pLink->Message() == FOURCC('ACTN')) )
|
||||
{
|
||||
CScriptObject *pObj = pLink->Sender();
|
||||
|
||||
if (pObj->ObjectTypeID() == 0x53524C59) // "SRLY"
|
||||
if (pObj->ObjectTypeID() == FOURCC('SRLY'))
|
||||
Relays.push_back(pObj);
|
||||
}
|
||||
}
|
||||
@@ -185,7 +185,7 @@ bool CScriptObject::HasNearVisibleActivation() const
|
||||
|
||||
void CScriptObject::AddLink(ELinkType Type, CLink *pLink, uint32 Index /*= -1*/)
|
||||
{
|
||||
std::vector<CLink*> *pLinkVec = (Type == eIncoming ? &mInLinks : &mOutLinks);
|
||||
std::vector<CLink*> *pLinkVec = (Type == ELinkType::Incoming ? &mInLinks : &mOutLinks);
|
||||
|
||||
if (Index == -1 || Index == pLinkVec->size())
|
||||
pLinkVec->push_back(pLink);
|
||||
@@ -199,7 +199,7 @@ void CScriptObject::AddLink(ELinkType Type, CLink *pLink, uint32 Index /*= -1*/)
|
||||
|
||||
void CScriptObject::RemoveLink(ELinkType Type, CLink *pLink)
|
||||
{
|
||||
std::vector<CLink*> *pLinkVec = (Type == eIncoming ? &mInLinks : &mOutLinks);
|
||||
std::vector<CLink*> *pLinkVec = (Type == ELinkType::Incoming ? &mInLinks : &mOutLinks);
|
||||
|
||||
for (auto it = pLinkVec->begin(); it != pLinkVec->end(); it++)
|
||||
{
|
||||
@@ -217,7 +217,7 @@ void CScriptObject::BreakAllLinks()
|
||||
{
|
||||
CLink *pLink = *it;
|
||||
CScriptObject *pSender = pLink->Sender();
|
||||
if (pSender) pSender->RemoveLink(eOutgoing, pLink);
|
||||
if (pSender) pSender->RemoveLink(ELinkType::Outgoing, pLink);
|
||||
delete pLink;
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ void CScriptObject::BreakAllLinks()
|
||||
{
|
||||
CLink *pLink = *it;
|
||||
CScriptObject *pReceiver = pLink->Receiver();
|
||||
if (pReceiver) pReceiver->RemoveLink(eIncoming, pLink);
|
||||
if (pReceiver) pReceiver->RemoveLink(ELinkType::Incoming, pLink);
|
||||
delete pLink;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
class CScriptLayer;
|
||||
class CLink;
|
||||
|
||||
enum ELinkType
|
||||
enum class ELinkType
|
||||
{
|
||||
eIncoming,
|
||||
eOutgoing
|
||||
Incoming,
|
||||
Outgoing
|
||||
};
|
||||
|
||||
class CScriptObject
|
||||
@@ -76,8 +76,8 @@ public:
|
||||
uint32 Version() const { return mVersion; }
|
||||
uint32 ObjectTypeID() const { return mpTemplate->ObjectID(); }
|
||||
uint32 InstanceID() const { return mInstanceID; }
|
||||
uint32 NumLinks(ELinkType Type) const { return (Type == eIncoming ? mInLinks.size() : mOutLinks.size()); }
|
||||
CLink* Link(ELinkType Type, uint32 Index) const { return (Type == eIncoming ? mInLinks[Index] : mOutLinks[Index]); }
|
||||
uint32 NumLinks(ELinkType Type) const { return (Type == ELinkType::Incoming ? mInLinks.size() : mOutLinks.size()); }
|
||||
CLink* Link(ELinkType Type, uint32 Index) const { return (Type == ELinkType::Incoming ? mInLinks[Index] : mOutLinks[Index]); }
|
||||
void* PropertyData() const { return (void*) mPropertyData.data(); }
|
||||
|
||||
CVector3f Position() const { return mPosition.IsValid() ? mPosition.Get() : CVector3f::skZero; }
|
||||
|
||||
@@ -21,17 +21,17 @@ CScriptTemplate::CScriptTemplate(CGameTemplate *pGame)
|
||||
, mpActiveProperty(nullptr)
|
||||
, mpLightParametersProperty(nullptr)
|
||||
, mPreviewScale(1.f)
|
||||
, mVolumeShape(eNoShape)
|
||||
, mVolumeShape(EVolumeShape::NoShape)
|
||||
, mVolumeScale(1.f)
|
||||
{
|
||||
}
|
||||
|
||||
// New constructor
|
||||
CScriptTemplate::CScriptTemplate(CGameTemplate* pInGame, uint32 InObjectID, const TString& kInFilePath)
|
||||
: mRotationType(eRotationEnabled)
|
||||
, mScaleType(eScaleEnabled)
|
||||
: mRotationType(ERotationType::RotationEnabled)
|
||||
, mScaleType(EScaleType::ScaleEnabled)
|
||||
, mPreviewScale(1.f)
|
||||
, mVolumeShape(eNoShape)
|
||||
, mVolumeShape(EVolumeShape::NoShape)
|
||||
, mVolumeScale(1.f)
|
||||
, mSourceFile(kInFilePath)
|
||||
, mObjectID(InObjectID)
|
||||
@@ -85,10 +85,10 @@ void CScriptTemplate::Serialize(IArchive& Arc)
|
||||
|
||||
Arc << SerialParameter("Assets", mAssets, SH_Optional)
|
||||
<< SerialParameter("Attachments", mAttachments, SH_Optional)
|
||||
<< SerialParameter("RotationType", mRotationType, SH_Optional, eRotationEnabled)
|
||||
<< SerialParameter("ScaleType", mScaleType, SH_Optional, eScaleEnabled)
|
||||
<< SerialParameter("RotationType", mRotationType, SH_Optional, ERotationType::RotationEnabled)
|
||||
<< SerialParameter("ScaleType", mScaleType, SH_Optional, EScaleType::ScaleEnabled)
|
||||
<< SerialParameter("PreviewScale", mPreviewScale, SH_Optional, 1.0f)
|
||||
<< SerialParameter("VolumeShape", mVolumeShape, SH_Optional, eNoShape)
|
||||
<< SerialParameter("VolumeShape", mVolumeShape, SH_Optional, EVolumeShape::NoShape)
|
||||
<< SerialParameter("VolumeScale", mVolumeScale, SH_Optional, 1.0f)
|
||||
<< SerialParameter("VolumeConditionProperty", mVolumeConditionIDString, SH_Optional)
|
||||
<< SerialParameter("VolumeConditions", mVolumeConditions, SH_Optional);
|
||||
@@ -129,13 +129,13 @@ EVolumeShape CScriptTemplate::VolumeShape(CScriptObject *pObj)
|
||||
if (pObj->Template() != this)
|
||||
{
|
||||
errorf("%s instance somehow called VolumeShape() on %s template", *pObj->Template()->Name(), *Name());
|
||||
return eInvalidShape;
|
||||
return EVolumeShape::InvalidShape;
|
||||
}
|
||||
|
||||
if (mVolumeShape == eConditionalShape)
|
||||
if (mVolumeShape == EVolumeShape::ConditionalShape)
|
||||
{
|
||||
int32 Index = CheckVolumeConditions(pObj, true);
|
||||
if (Index == -1) return eInvalidShape;
|
||||
if (Index == -1) return EVolumeShape::InvalidShape;
|
||||
else return mVolumeConditions[Index].Shape;
|
||||
}
|
||||
else return mVolumeShape;
|
||||
@@ -149,7 +149,7 @@ float CScriptTemplate::VolumeScale(CScriptObject *pObj)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mVolumeShape == eConditionalShape)
|
||||
if (mVolumeShape == EVolumeShape::ConditionalShape)
|
||||
{
|
||||
int32 Index = CheckVolumeConditions(pObj, false);
|
||||
if (Index == -1) return mVolumeScale;
|
||||
@@ -161,7 +161,7 @@ float CScriptTemplate::VolumeScale(CScriptObject *pObj)
|
||||
int32 CScriptTemplate::CheckVolumeConditions(CScriptObject *pObj, bool LogErrors)
|
||||
{
|
||||
// Private function
|
||||
if (mVolumeShape == eConditionalShape)
|
||||
if (mVolumeShape == EVolumeShape::ConditionalShape)
|
||||
{
|
||||
TIDString PropID = mVolumeConditionIDString;
|
||||
IProperty* pProp = pObj->Template()->Properties()->ChildByIDString( PropID );
|
||||
@@ -216,11 +216,11 @@ CResource* CScriptTemplate::FindDisplayAsset(void* pPropertyData, uint32& rOutCh
|
||||
|
||||
for (auto it = mAssets.begin(); it != mAssets.end(); it++)
|
||||
{
|
||||
if (it->AssetType == SEditorAsset::eCollision) continue;
|
||||
if (it->AssetType == SEditorAsset::EAssetType::Collision) continue;
|
||||
CResource *pRes = nullptr;
|
||||
|
||||
// File
|
||||
if (it->AssetSource == SEditorAsset::eFile)
|
||||
if (it->AssetSource == SEditorAsset::EAssetSource::File)
|
||||
pRes = gpEditorStore->LoadResource(it->AssetLocation);
|
||||
|
||||
// Property
|
||||
@@ -228,7 +228,7 @@ CResource* CScriptTemplate::FindDisplayAsset(void* pPropertyData, uint32& rOutCh
|
||||
{
|
||||
IProperty* pProp = mpProperties->ChildByIDString(it->AssetLocation);
|
||||
|
||||
if (it->AssetType == SEditorAsset::eAnimParams && pProp->Type() == EPropertyType::AnimationSet)
|
||||
if (it->AssetType == SEditorAsset::EAssetType::AnimParams && pProp->Type() == EPropertyType::AnimationSet)
|
||||
{
|
||||
CAnimationSetProperty* pAnimSet = TPropCast<CAnimationSetProperty>(pProp);
|
||||
CAnimationParameters Params = pAnimSet->Value(pPropertyData);
|
||||
@@ -255,7 +255,7 @@ CResource* CScriptTemplate::FindDisplayAsset(void* pPropertyData, uint32& rOutCh
|
||||
// If we have a valid resource, return
|
||||
if (pRes)
|
||||
{
|
||||
rOutIsInGame = (pRes->Type() != eTexture && it->AssetSource == SEditorAsset::eProperty);
|
||||
rOutIsInGame = (pRes->Type() != EResourceType::Texture && it->AssetSource == SEditorAsset::EAssetSource::Property);
|
||||
return pRes;
|
||||
}
|
||||
}
|
||||
@@ -268,11 +268,11 @@ CCollisionMeshGroup* CScriptTemplate::FindCollision(void* pPropertyData)
|
||||
{
|
||||
for (auto it = mAssets.begin(); it != mAssets.end(); it++)
|
||||
{
|
||||
if (it->AssetType != SEditorAsset::eCollision) continue;
|
||||
if (it->AssetType != SEditorAsset::EAssetType::Collision) continue;
|
||||
CResource *pRes = nullptr;
|
||||
|
||||
// File
|
||||
if (it->AssetSource == SEditorAsset::eFile)
|
||||
if (it->AssetSource == SEditorAsset::EAssetSource::File)
|
||||
pRes = gpResourceStore->LoadResource(it->AssetLocation);
|
||||
|
||||
// Property
|
||||
@@ -283,12 +283,12 @@ CCollisionMeshGroup* CScriptTemplate::FindCollision(void* pPropertyData)
|
||||
if (pProp->Type() == EPropertyType::Asset)
|
||||
{
|
||||
CAssetProperty* pAsset = TPropCast<CAssetProperty>(pProp);
|
||||
pRes = gpResourceStore->LoadResource( pAsset->Value(pPropertyData), eDynamicCollision );
|
||||
pRes = gpResourceStore->LoadResource( pAsset->Value(pPropertyData), EResourceType::DynamicCollision );
|
||||
}
|
||||
}
|
||||
|
||||
// Verify resource exists + is correct type
|
||||
if (pRes && (pRes->Type() == eDynamicCollision))
|
||||
if (pRes && (pRes->Type() == EResourceType::DynamicCollision))
|
||||
return static_cast<CCollisionMeshGroup*>(pRes);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,23 +44,23 @@ struct SAttachment
|
||||
class CScriptTemplate
|
||||
{
|
||||
public:
|
||||
enum ERotationType {
|
||||
eRotationEnabled, eRotationDisabled
|
||||
enum class ERotationType {
|
||||
RotationEnabled, RotationDisabled,
|
||||
};
|
||||
|
||||
enum EScaleType {
|
||||
eScaleEnabled, eScaleDisabled, eScaleVolume
|
||||
enum class EScaleType {
|
||||
ScaleEnabled, ScaleDisabled, ScaleVolume
|
||||
};
|
||||
|
||||
private:
|
||||
struct SEditorAsset
|
||||
{
|
||||
enum EAssetType {
|
||||
eModel, eAnimParams, eBillboard, eCollision
|
||||
enum class EAssetType {
|
||||
Model, AnimParams, Billboard, Collision
|
||||
} AssetType;
|
||||
|
||||
enum EAssetSource {
|
||||
eProperty, eFile
|
||||
enum class EAssetSource {
|
||||
Property, File
|
||||
} AssetSource;
|
||||
|
||||
TIDString AssetLocation;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#ifndef EVOLUMESHAPE
|
||||
#define EVOLUMESHAPE
|
||||
|
||||
enum EVolumeShape
|
||||
enum class EVolumeShape
|
||||
{
|
||||
eNoShape,
|
||||
eAxisAlignedBoxShape,
|
||||
eBoxShape,
|
||||
eEllipsoidShape,
|
||||
eCylinderShape,
|
||||
eConditionalShape,
|
||||
eInvalidShape
|
||||
NoShape,
|
||||
AxisAlignedBoxShape,
|
||||
BoxShape,
|
||||
EllipsoidShape,
|
||||
CylinderShape,
|
||||
ConditionalShape,
|
||||
InvalidShape
|
||||
};
|
||||
|
||||
#endif // EVOLUMESHAPE
|
||||
|
||||
Reference in New Issue
Block a user