mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-11-06 06:25:54 +00:00
CClumpModelInfo
This commit is contained in:
parent
9361aeb8eb
commit
1bee2caf5c
|
@ -57,15 +57,15 @@ public:
|
||||||
virtual void ConvertAnimFileIndex(void) {}
|
virtual void ConvertAnimFileIndex(void) {}
|
||||||
virtual int GetAnimFileIndex(void) { return -1; }
|
virtual int GetAnimFileIndex(void) { return -1; }
|
||||||
|
|
||||||
virtual void LoadModel(void *model, const void *chunk) {}; // = 0;
|
virtual void LoadModel(void *model, const void *chunk) = 0;
|
||||||
virtual void DeleteChunk(void);
|
virtual void DeleteChunk(void);
|
||||||
// this writes the modelinfo struct, possibly including actual RW models
|
// this writes the modelinfo struct, possibly including actual RW models
|
||||||
virtual void Write(base::cRelocatableChunkWriter &writer);
|
virtual void Write(base::cRelocatableChunkWriter &writer);
|
||||||
// this writes the RW models
|
// this writes the RW models
|
||||||
virtual void *WriteModel(base::cRelocatableChunkWriter &writer) { return nil; } // = 0; // this is not in the vtable for some reason???
|
virtual void *WriteModel(base::cRelocatableChunkWriter &writer) { return nil; } // = 0; // this is not in the vtable for some reason???
|
||||||
// these allocate the space for a modelinfo struct and patch the vtable pointer
|
// these allocate the space for a modelinfo struct and patch the vtable pointer
|
||||||
virtual void RcWriteThis(base::cRelocatableChunkWriter &writer) {} // = 0;
|
virtual void RcWriteThis(base::cRelocatableChunkWriter &writer) = 0;
|
||||||
virtual void RcWriteEmpty(base::cRelocatableChunkWriter &writer) {} // = 0;
|
virtual void RcWriteEmpty(base::cRelocatableChunkWriter &writer) = 0;
|
||||||
|
|
||||||
// one day it becomes virtual
|
// one day it becomes virtual
|
||||||
uint8 GetModelType() const { return m_type; }
|
uint8 GetModelType() const { return m_type; }
|
||||||
|
|
|
@ -1,17 +1,30 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
#include "RwHelper.h"
|
#include "RwHelper.h"
|
||||||
#include "General.h"
|
#include "General.h"
|
||||||
#include "NodeName.h"
|
#include "NodeName.h"
|
||||||
#include "VisibilityPlugins.h"
|
#include "VisibilityPlugins.h"
|
||||||
#include "ModelInfo.h"
|
#include "ModelInfo.h"
|
||||||
#include "AnimManager.h"
|
#include "AnimManager.h"
|
||||||
|
#include "Streaming.h"
|
||||||
|
#include "Leeds.h"
|
||||||
|
|
||||||
|
base::cRelocatableChunkClassInfo CClumpModelInfo::msClassInfo("CElementGroupModelInfo", VTABLE_ADDR(&msClassInstance), sizeof(msClassInstance)); // the real name
|
||||||
|
CClumpModelInfo CClumpModelInfo::msClassInstance;
|
||||||
|
|
||||||
void
|
void
|
||||||
CClumpModelInfo::DeleteRwObject(void)
|
CClumpModelInfo::DeleteRwObject(void)
|
||||||
{
|
{
|
||||||
if(m_clump){
|
if(m_clump){
|
||||||
|
if(!gUseChunkFiles)
|
||||||
RpClumpDestroy(m_clump);
|
RpClumpDestroy(m_clump);
|
||||||
|
else{
|
||||||
|
CStreaming::UnregisterClump(m_clump);
|
||||||
|
CStreaming::UnregisterPointer(&m_clump, 2);
|
||||||
|
DeleteChunk();
|
||||||
|
}
|
||||||
|
|
||||||
m_clump = nil;
|
m_clump = nil;
|
||||||
RemoveTexDictionaryRef();
|
RemoveTexDictionaryRef();
|
||||||
if(GetAnimFileIndex() != -1)
|
if(GetAnimFileIndex() != -1)
|
||||||
|
@ -52,6 +65,7 @@ CClumpModelInfo::CreateInstance(RwMatrix *m)
|
||||||
if(m_clump){
|
if(m_clump){
|
||||||
RpClump *clump = (RpClump*)CreateInstance();
|
RpClump *clump = (RpClump*)CreateInstance();
|
||||||
*RwFrameGetMatrix(RpClumpGetFrame(clump)) = *m;
|
*RwFrameGetMatrix(RpClumpGetFrame(clump)) = *m;
|
||||||
|
CStreaming::RegisterInstance(clump);
|
||||||
return (RwObject*)clump;
|
return (RwObject*)clump;
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -73,14 +87,15 @@ CClumpModelInfo::SetClump(RpClump *clump)
|
||||||
if(GetAnimFileIndex() != -1)
|
if(GetAnimFileIndex() != -1)
|
||||||
CAnimManager::AddAnimBlockRef(GetAnimFileIndex());
|
CAnimManager::AddAnimBlockRef(GetAnimFileIndex());
|
||||||
if(IsClumpSkinned(clump)){
|
if(IsClumpSkinned(clump)){
|
||||||
int i;
|
//int i;
|
||||||
RpHAnimHierarchy *hier;
|
RpHAnimHierarchy *hier;
|
||||||
RpAtomic *skinAtomic;
|
//RpAtomic *skinAtomic;
|
||||||
RpSkin *skin;
|
//RpSkin *skin;
|
||||||
|
|
||||||
hier = GetAnimHierarchyFromClump(clump);
|
hier = GetAnimHierarchyFromClump(clump);
|
||||||
assert(hier);
|
assert(hier);
|
||||||
RpClumpForAllAtomics(clump, SetHierarchyForSkinAtomic, hier);
|
RpClumpForAllAtomics(clump, SetHierarchyForSkinAtomic, hier);
|
||||||
|
/*
|
||||||
skinAtomic = GetFirstAtomic(clump);
|
skinAtomic = GetFirstAtomic(clump);
|
||||||
|
|
||||||
assert(skinAtomic);
|
assert(skinAtomic);
|
||||||
|
@ -94,6 +109,7 @@ CClumpModelInfo::SetClump(RpClump *clump)
|
||||||
weights->w2 /= sum;
|
weights->w2 /= sum;
|
||||||
weights->w3 /= sum;
|
weights->w3 /= sum;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS));
|
RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,3 +219,47 @@ CClumpModelInfo::GetFrameFromId(RpClump *clump, int32 id)
|
||||||
RwFrameForAllChildren(RpClumpGetFrame(clump), FindFrameFromIdCB, &assoc);
|
RwFrameForAllChildren(RpClumpGetFrame(clump), FindFrameFromIdCB, &assoc);
|
||||||
return assoc.frame;
|
return assoc.frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
CClumpModelInfo::LoadModel(void *clump, const void *chunk)
|
||||||
|
{
|
||||||
|
m_chunk = (void*)chunk;
|
||||||
|
m_clump = (RpClump*)clump;
|
||||||
|
LoadResource(m_clump);
|
||||||
|
CStreaming::RegisterPointer(&m_chunk, 2, true);
|
||||||
|
CStreaming::RegisterClump(m_clump);
|
||||||
|
CStreaming::RegisterPointer(&m_clump, 2, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CClumpModelInfo::Write(base::cRelocatableChunkWriter &writer)
|
||||||
|
{
|
||||||
|
CBaseModelInfo::Write(writer);
|
||||||
|
if(m_clump){
|
||||||
|
writer.AddPatch(&m_clump);
|
||||||
|
SaveResource(m_clump, writer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void*
|
||||||
|
CClumpModelInfo::WriteModel(base::cRelocatableChunkWriter &writer)
|
||||||
|
{
|
||||||
|
if(m_clump)
|
||||||
|
SaveResource(m_clump, writer);
|
||||||
|
return m_clump;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CClumpModelInfo::RcWriteThis(base::cRelocatableChunkWriter &writer)
|
||||||
|
{
|
||||||
|
writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
|
||||||
|
writer.Class(VTABLE_ADDR(this), msClassInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CClumpModelInfo::RcWriteEmpty(base::cRelocatableChunkWriter &writer)
|
||||||
|
{
|
||||||
|
writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
|
||||||
|
writer.Class(VTABLE_ADDR(this), msClassInfo);
|
||||||
|
}
|
||||||
|
|
|
@ -35,6 +35,9 @@ public:
|
||||||
char *m_animFileName;
|
char *m_animFileName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static base::cRelocatableChunkClassInfo msClassInfo;
|
||||||
|
static CClumpModelInfo msClassInstance;
|
||||||
|
|
||||||
CClumpModelInfo(void) : CBaseModelInfo(MITYPE_CLUMP) { m_animFileIndex = -1; }
|
CClumpModelInfo(void) : CBaseModelInfo(MITYPE_CLUMP) { m_animFileIndex = -1; }
|
||||||
CClumpModelInfo(ModelInfoType id) : CBaseModelInfo(id) { m_animFileIndex = -1; }
|
CClumpModelInfo(ModelInfoType id) : CBaseModelInfo(id) { m_animFileIndex = -1; }
|
||||||
~CClumpModelInfo() {}
|
~CClumpModelInfo() {}
|
||||||
|
@ -48,6 +51,12 @@ public:
|
||||||
virtual void ConvertAnimFileIndex(void);
|
virtual void ConvertAnimFileIndex(void);
|
||||||
virtual int GetAnimFileIndex(void) { return m_animFileIndex; }
|
virtual int GetAnimFileIndex(void) { return m_animFileIndex; }
|
||||||
|
|
||||||
|
virtual void LoadModel(void *model, const void *chunk);
|
||||||
|
virtual void Write(base::cRelocatableChunkWriter &writer);
|
||||||
|
virtual void *WriteModel(base::cRelocatableChunkWriter &writer);
|
||||||
|
virtual void RcWriteThis(base::cRelocatableChunkWriter &writer);
|
||||||
|
virtual void RcWriteEmpty(base::cRelocatableChunkWriter &writer);
|
||||||
|
|
||||||
static RpAtomic *SetAtomicRendererCB(RpAtomic *atomic, void *data);
|
static RpAtomic *SetAtomicRendererCB(RpAtomic *atomic, void *data);
|
||||||
void SetFrameIds(RwObjectNameIdAssocation *assocs);
|
void SetFrameIds(RwObjectNameIdAssocation *assocs);
|
||||||
static RwFrame *FindFrameFromNameCB(RwFrame *frame, void *data);
|
static RwFrame *FindFrameFromNameCB(RwFrame *frame, void *data);
|
||||||
|
|
Loading…
Reference in a new issue