Fixed grid drawing at incorrect depth, fixed MP2 areas not loading correctly with the AnimSet loader changes
This commit is contained in:
parent
c4268746f2
commit
7f3929d4ca
|
@ -298,47 +298,50 @@ CAnimSet* CAnimSetLoader::LoadANCS(IInputStream& rANCS)
|
|||
}
|
||||
}
|
||||
|
||||
// Load Animation Set
|
||||
u32 SetStart = rANCS.Tell();
|
||||
SetStart = SetStart;
|
||||
u16 InfoCount = rANCS.ReadShort();
|
||||
u32 NumAnims = rANCS.ReadLong();
|
||||
|
||||
for (u32 iAnim = 0; iAnim < NumAnims; iAnim++)
|
||||
Loader.LoadAnimation(rANCS);
|
||||
|
||||
u32 NumTransitions = rANCS.ReadLong();
|
||||
|
||||
for (u32 iTrans = 0; iTrans < NumTransitions; iTrans++)
|
||||
Loader.LoadTransition(rANCS);
|
||||
Loader.LoadMetaTransition(rANCS);
|
||||
|
||||
u32 NumAdditiveAnims = rANCS.ReadLong();
|
||||
|
||||
for (u32 iAnim = 0; iAnim < NumAdditiveAnims; iAnim++)
|
||||
Loader.LoadAdditiveAnimation(rANCS);
|
||||
|
||||
rANCS.Seek(0x8, SEEK_CUR);
|
||||
|
||||
if (InfoCount > 2)
|
||||
if (Loader.mVersion <= ePrime)
|
||||
{
|
||||
u32 NumHalfTransitions = rANCS.ReadLong();
|
||||
// Load Animation Set
|
||||
u32 SetStart = rANCS.Tell();
|
||||
SetStart = SetStart;
|
||||
u16 InfoCount = rANCS.ReadShort();
|
||||
u32 NumAnims = rANCS.ReadLong();
|
||||
|
||||
for (u32 iHalf = 0; iHalf < NumHalfTransitions; iHalf++)
|
||||
Loader.LoadHalfTransition(rANCS);
|
||||
}
|
||||
for (u32 iAnim = 0; iAnim < NumAnims; iAnim++)
|
||||
Loader.LoadAnimation(rANCS);
|
||||
|
||||
// Add anims to set
|
||||
for (u32 iPrim = 0; iPrim < Loader.mAnimPrimitives.size(); iPrim++)
|
||||
{
|
||||
SPrimitive& rPrim = Loader.mAnimPrimitives[iPrim];
|
||||
u32 NumTransitions = rANCS.ReadLong();
|
||||
|
||||
if (rPrim.Loaded)
|
||||
for (u32 iTrans = 0; iTrans < NumTransitions; iTrans++)
|
||||
Loader.LoadTransition(rANCS);
|
||||
Loader.LoadMetaTransition(rANCS);
|
||||
|
||||
u32 NumAdditiveAnims = rANCS.ReadLong();
|
||||
|
||||
for (u32 iAnim = 0; iAnim < NumAdditiveAnims; iAnim++)
|
||||
Loader.LoadAdditiveAnimation(rANCS);
|
||||
|
||||
rANCS.Seek(0x8, SEEK_CUR);
|
||||
|
||||
if (InfoCount > 2)
|
||||
{
|
||||
CAnimSet::SAnimation Anim;
|
||||
Anim.Name = rPrim.Name;
|
||||
Anim.pAnim = gResCache.GetResource(rPrim.AnimID, "ANIM");
|
||||
Loader.pSet->mAnims.push_back(Anim);
|
||||
u32 NumHalfTransitions = rANCS.ReadLong();
|
||||
|
||||
for (u32 iHalf = 0; iHalf < NumHalfTransitions; iHalf++)
|
||||
Loader.LoadHalfTransition(rANCS);
|
||||
}
|
||||
|
||||
// Add anims to set
|
||||
for (u32 iPrim = 0; iPrim < Loader.mAnimPrimitives.size(); iPrim++)
|
||||
{
|
||||
SPrimitive& rPrim = Loader.mAnimPrimitives[iPrim];
|
||||
|
||||
if (rPrim.Loaded)
|
||||
{
|
||||
CAnimSet::SAnimation Anim;
|
||||
Anim.Name = rPrim.Name;
|
||||
Anim.pAnim = gResCache.GetResource(rPrim.AnimID, "ANIM");
|
||||
Loader.pSet->mAnims.push_back(Anim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -464,16 +464,6 @@ CModel* CModelLoader::LoadCMDL(IInputStream& rCMDL)
|
|||
{
|
||||
Loader.mMaterials[iSet] = CMaterialLoader::LoadMaterialSet(rCMDL, Loader.mVersion);
|
||||
|
||||
// Toggle skinning on materials
|
||||
if (Loader.mFlags.HasAnyFlags(eSkinnedModel))
|
||||
{
|
||||
for (u32 iMat = 0; iMat < Loader.mMaterials[iSet]->NumMaterials(); iMat++)
|
||||
{
|
||||
CMaterial *pMat = Loader.mMaterials[iSet]->MaterialByIndex(iMat);
|
||||
pMat->SetVertexDescription(pMat->VtxDesc() | FVertexDescription(eBoneIndices | eBoneWeights));
|
||||
}
|
||||
}
|
||||
|
||||
if (Loader.mVersion < eCorruptionProto)
|
||||
Loader.mpSectionMgr->ToNextSection();
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ void CModel::DrawSurface(FRenderOptions Options, u32 Surface, u32 MatSet)
|
|||
SSurface *pSurf = mSurfaces[Surface];
|
||||
CMaterial *pMat = mMaterialSets[MatSet]->MaterialByIndex(pSurf->MaterialID);
|
||||
|
||||
if ((!(Options & eEnableOccluders)) && (pMat->Options() & CMaterial::eOccluder))
|
||||
if (!Options.HasFlag(eEnableOccluders) && pMat->Options().HasFlag(CMaterial::eOccluder))
|
||||
return;
|
||||
|
||||
pMat->SetCurrent(Options);
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef CGRIDRENDERABLE
|
||||
#define CGRIDRENDERABLE
|
||||
|
||||
#include <Core/Render/CRenderer.h>
|
||||
#include <Core/Render/IRenderable.h>
|
||||
|
||||
// Tiny helper to make sure the grid draws at the correct depth.
|
||||
class CGridRenderable : public IRenderable
|
||||
{
|
||||
public:
|
||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo&)
|
||||
{
|
||||
pRenderer->AddMesh(this, 0, CAABox::skOne, false, eDrawMesh);
|
||||
}
|
||||
|
||||
void Draw(FRenderOptions, int, const SViewInfo&)
|
||||
{
|
||||
CDrawUtil::DrawGrid();
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CGRIDRENDERABLE
|
||||
|
|
@ -49,14 +49,14 @@ void CCharacterEditorViewport::Paint()
|
|||
{
|
||||
mpRenderer->BeginFrame();
|
||||
mCamera.LoadMatrices();
|
||||
CDrawUtil::DrawGrid();
|
||||
mGrid.AddToRenderer(mpRenderer, mViewInfo);
|
||||
|
||||
if (mpCharNode)
|
||||
{
|
||||
mpCharNode->AddToRenderer(mpRenderer, mViewInfo);
|
||||
mpRenderer->RenderBuckets(mViewInfo);
|
||||
}
|
||||
|
||||
mpRenderer->RenderBuckets(mViewInfo);
|
||||
mpRenderer->EndFrame();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define CCHARACTEREDITORVIEWPORT_H
|
||||
|
||||
#include "Editor/CBasicViewport.h"
|
||||
#include "Editor/CGridRenderable.h"
|
||||
#include <Core/Scene/CCharacterNode.h>
|
||||
|
||||
class CCharacterEditorViewport : public CBasicViewport
|
||||
|
@ -9,6 +10,7 @@ class CCharacterEditorViewport : public CBasicViewport
|
|||
Q_OBJECT
|
||||
|
||||
CCharacterNode *mpCharNode;
|
||||
CGridRenderable mGrid;
|
||||
CRenderer *mpRenderer;
|
||||
u32 mHoverBone;
|
||||
|
||||
|
|
|
@ -158,7 +158,8 @@ HEADERS += \
|
|||
WorldEditor/CRepackInfoDialog.h \
|
||||
CAboutDialog.h \
|
||||
CharacterEditor/CCharacterEditor.h \
|
||||
CharacterEditor/CCharacterEditorViewport.h
|
||||
CharacterEditor/CCharacterEditorViewport.h \
|
||||
CGridRenderable.h
|
||||
|
||||
# Source Files
|
||||
SOURCES += \
|
||||
|
|
|
@ -56,13 +56,15 @@ void CModelEditorViewport::Paint()
|
|||
if (!mpModelNode->Model())
|
||||
{
|
||||
if (mGridEnabled)
|
||||
CDrawUtil::DrawGrid();
|
||||
mGrid.AddToRenderer(mpRenderer, mViewInfo);
|
||||
|
||||
mpRenderer->RenderBuckets(mViewInfo);
|
||||
}
|
||||
|
||||
else if (mMode == eDrawMesh)
|
||||
{
|
||||
if (mGridEnabled)
|
||||
CDrawUtil::DrawGrid();
|
||||
mGrid.AddToRenderer(mpRenderer, mViewInfo);
|
||||
|
||||
mpModelNode->AddToRenderer(mpRenderer, mViewInfo);
|
||||
mpRenderer->RenderBuckets(mViewInfo);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define CMODELEDITORVIEWPORT_H
|
||||
|
||||
#include "Editor/CBasicViewport.h"
|
||||
#include "Editor/CGridRenderable.h"
|
||||
#include <Core/Scene/CModelNode.h>
|
||||
|
||||
class CModelEditorViewport : public CBasicViewport
|
||||
|
@ -13,6 +14,7 @@ public:
|
|||
|
||||
private:
|
||||
EDrawMode mMode;
|
||||
CGridRenderable mGrid;
|
||||
CModelNode *mpModelNode;
|
||||
CMaterial *mpActiveMaterial;
|
||||
CRenderer *mpRenderer;
|
||||
|
|
Loading…
Reference in New Issue