Rename class

This commit is contained in:
Christian Semmler 2024-03-08 11:24:45 -05:00
parent 0e67d9d9b6
commit e2863a4c07
11 changed files with 50 additions and 56 deletions

View File

@ -94,9 +94,9 @@ add_library(tglrl STATIC
LEGO1/tgl/d3drm/group.cpp
LEGO1/tgl/d3drm/light.cpp
LEGO1/tgl/d3drm/mesh.cpp
LEGO1/tgl/d3drm/meshbuilder.cpp
LEGO1/tgl/d3drm/renderer.cpp
LEGO1/tgl/d3drm/texture.cpp
LEGO1/tgl/d3drm/unk.cpp
LEGO1/tgl/d3drm/view.cpp
)
register_lego1_target(tglrl)

View File

@ -72,7 +72,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
return SUCCESS;
}
m_unk0x04 = p_renderer->CreateUnk();
m_meshBuilder = p_renderer->CreateMeshBuilder();
if (p_storage->Read(&m_numMeshes, sizeof(m_numMeshes)) != SUCCESS) {
goto done;
@ -188,7 +188,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
meshUnd2++;
}
m_meshes[meshIndex].m_tglMesh = m_unk0x04->CreateMesh(
m_meshes[meshIndex].m_tglMesh = m_meshBuilder->CreateMesh(
numPolys & MAXWORD,
numVertices & MAXWORD,
vertices,

View File

@ -94,10 +94,10 @@ Result GroupImpl::Add(const Mesh* pMesh)
}
// FUNCTION: LEGO1 0x100a3450
Result GroupImpl::Remove(const Unk* pUnk)
Result GroupImpl::Remove(const MeshBuilder* pMeshBuilder)
{
const UnkImpl* pUnkImpl = static_cast<const UnkImpl*>(pUnk);
return ResultVal(m_data->DeleteVisual(pUnkImpl->ImplementationData()));
const MeshBuilderImpl* pMeshBuilderImpl = static_cast<const MeshBuilderImpl*>(pMeshBuilder);
return ResultVal(m_data->DeleteVisual(pMeshBuilderImpl->ImplementationData()));
}
// FUNCTION: LEGO1 0x100a3480

View File

@ -34,7 +34,7 @@ class CameraImpl;
class GroupImpl;
class MeshImpl;
class TextureImpl;
class UnkImpl;
class MeshBuilderImpl;
// VTABLE: LEGO1 0x100db910
class RendererImpl : public Renderer {
@ -62,7 +62,7 @@ class RendererImpl : public Renderer {
Group* CreateGroup(const Group* pParent) override;
// vtable+0x20
Unk* CreateUnk() override;
MeshBuilder* CreateMeshBuilder() override;
Texture* CreateTexture(
int width,
int height,
@ -275,10 +275,10 @@ class MeshImpl : public Mesh {
Result GetTexture(Texture*&) override;
Result SetTextureMappingMode(ProjectionType) override;
Result SetShadingModel(ShadingModel) override;
Mesh* DeepClone(Unk*) override;
Mesh* DeepClone(MeshBuilder*) override;
// vtable+0x20
Mesh* ShallowClone(Unk*) override;
Mesh* ShallowClone(MeshBuilder*) override;
struct MeshData {
IDirect3DRMMesh* groupMesh;
@ -323,7 +323,7 @@ class GroupImpl : public Group {
// vtable+0x20
Result Add(const Mesh*) override;
Result Remove(const Group*) override;
Result Remove(const Unk*) override;
Result Remove(const MeshBuilder*) override;
Result RemoveAll() override;
// vtable+0x30
@ -338,10 +338,10 @@ class GroupImpl : public Group {
};
// VTABLE: LEGO1 0x100dbb18
class UnkImpl : public Unk {
class MeshBuilderImpl : public MeshBuilder {
public:
UnkImpl() : m_data(0) {}
~UnkImpl() override
MeshBuilderImpl() : m_data(0) {}
~MeshBuilderImpl() override
{
if (m_data) {
m_data->Release();
@ -365,7 +365,7 @@ class UnkImpl : public Unk {
Result GetBoundingBox(float min[3], float max[3]) override;
// vtable+0x10
Unk* Clone() override;
MeshBuilder* Clone() override;
inline IDirect3DRMMesh* ImplementationData() const { return m_data; }

View File

@ -73,7 +73,7 @@ Result MeshImpl::SetShadingModel(ShadingModel model)
}
// FUNCTION: LEGO1 0x100a4030
Mesh* MeshImpl::DeepClone(Unk* pUnk)
Mesh* MeshImpl::DeepClone(MeshBuilder* pMeshBuilder)
{
// Create group
MeshImpl* newMesh = new MeshImpl();
@ -96,7 +96,7 @@ Mesh* MeshImpl::DeepClone(Unk* pUnk)
D3DCOLOR color = m_data->groupMesh->GetGroupColor(m_data->groupIndex);
// Push information to new group
UnkImpl* target = static_cast<UnkImpl*>(pUnk);
MeshBuilderImpl* target = static_cast<MeshBuilderImpl*>(pMeshBuilder);
D3DRMGROUPINDEX index;
target->ImplementationData()->AddGroup(vcount, fcount, vperface, faceBuffer, &index);
newMesh->m_data->groupIndex = index;
@ -118,14 +118,14 @@ Mesh* MeshImpl::DeepClone(Unk* pUnk)
}
// FUNCTION: LEGO1 0x100a4240
Mesh* MeshImpl::ShallowClone(Unk* pUnk)
Mesh* MeshImpl::ShallowClone(MeshBuilder* pMeshBuilder)
{
MeshImpl* newGroup = new MeshImpl();
MeshData* newData = new MeshData();
newGroup->m_data = newData;
if (newData) {
newData->groupIndex = m_data->groupIndex;
newData->groupMesh = static_cast<UnkImpl*>(pUnk)->ImplementationData();
newData->groupMesh = static_cast<MeshBuilderImpl*>(pMeshBuilder)->ImplementationData();
}
else {
delete newGroup;

View File

@ -2,17 +2,17 @@
using namespace TglImpl;
DECOMP_SIZE_ASSERT(Unk, 0x04);
DECOMP_SIZE_ASSERT(UnkImpl, 0x08);
DECOMP_SIZE_ASSERT(MeshBuilder, 0x04);
DECOMP_SIZE_ASSERT(MeshBuilderImpl, 0x08);
// FUNCTION: LEGO1 0x100a3830
void* UnkImpl::ImplementationDataPtr()
void* MeshBuilderImpl::ImplementationDataPtr()
{
return reinterpret_cast<void*>(&m_data);
}
// FUNCTION: LEGO1 0x100a3840
Mesh* UnkImpl::CreateMesh(
Mesh* MeshBuilderImpl::CreateMesh(
unsigned long faceCount,
unsigned long vertexCount,
float (*pPositions)[3],
@ -132,7 +132,7 @@ inline Result CreateMesh(
return result;
}
inline Result UnkImpl::CreateMeshImpl(
inline Result MeshBuilderImpl::CreateMeshImpl(
MeshImpl* pMeshImpl,
unsigned long faceCount,
unsigned long vertexCount,
@ -159,7 +159,7 @@ inline Result UnkImpl::CreateMeshImpl(
}
// FUNCTION: LEGO1 0x100a3ae0
Result UnkImpl::GetBoundingBox(float min[3], float max[3])
Result MeshBuilderImpl::GetBoundingBox(float min[3], float max[3])
{
D3DRMBOX box;
Result result = ResultVal(m_data->GetBox(&box));
@ -175,9 +175,9 @@ Result UnkImpl::GetBoundingBox(float min[3], float max[3])
}
// FUNCTION: LEGO1 0x100a3b40
Unk* UnkImpl::Clone()
MeshBuilder* MeshBuilderImpl::Clone()
{
UnkImpl* mesh = new UnkImpl();
MeshBuilderImpl* mesh = new MeshBuilderImpl();
int ret = m_data->Clone(0, IID_IDirect3DRMMeshBuilder, (void**) &mesh->m_data);
if (ret < 0) {
delete mesh;

View File

@ -209,20 +209,14 @@ Light* RendererImpl::CreateLight(LightType type, float r, float g, float b)
}
// FUNCTION: LEGO1 0x100a1e90
Unk* RendererImpl::CreateUnk()
MeshBuilder* RendererImpl::CreateMeshBuilder()
{
// Note: I'm fairly certain that Unknown is not what Tgl calls a
// "Mesh", because the methods on Mesh in the Tgl leak line up much
// more closely with a different vtable than the one assigned in
// this method (meaning this method is not creating a Mesh).
// Maybe this method is something like CreateMeshBuilder where the
// Mesh data type in the Tgl leak was split into builder/result?
UnkImpl* unknown = new UnkImpl();
if (FAILED(m_data->CreateMesh(&unknown->m_data))) {
delete unknown;
unknown = NULL;
MeshBuilderImpl* meshBuilder = new MeshBuilderImpl();
if (FAILED(m_data->CreateMesh(&meshBuilder->m_data))) {
delete meshBuilder;
meshBuilder = NULL;
}
return unknown;
return meshBuilder;
}
inline Result RendererCreateTexture(

View File

@ -96,7 +96,7 @@ class Camera;
class Group;
class Mesh;
class Texture;
class Unk;
class MeshBuilder;
// VTABLE: LEGO1 0x100db980
class Object {
@ -131,7 +131,7 @@ class Renderer : public Object {
virtual Group* CreateGroup(const Group* pParent = 0) = 0;
// vtable+0x20
virtual Unk* CreateUnk() = 0;
virtual MeshBuilder* CreateMeshBuilder() = 0;
virtual Texture* CreateTexture(
int width,
int height,
@ -280,10 +280,10 @@ class Mesh : public Object {
virtual Result SetShadingModel(ShadingModel) = 0;
// Clone data in underlying group
virtual Mesh* DeepClone(Unk*) = 0;
virtual Mesh* DeepClone(MeshBuilder*) = 0;
// Just get another Group pointing to the same underlying data
virtual Mesh* ShallowClone(Unk*) = 0;
virtual Mesh* ShallowClone(MeshBuilder*) = 0;
// SYNTHETIC: LEGO1 0x100a3e60
// Tgl::Mesh::`scalar deleting destructor'
@ -300,7 +300,7 @@ class Group : public Object {
virtual Result Add(const Group*) = 0;
virtual Result Add(const Mesh*) = 0;
virtual Result Remove(const Group*) = 0;
virtual Result Remove(const Unk*) = 0;
virtual Result Remove(const MeshBuilder*) = 0;
virtual Result RemoveAll() = 0;
// This is TransformLocalToWorld in the leak, however it seems
@ -318,7 +318,7 @@ class Group : public Object {
// was not in the leaked Tgl code. My suspicion is that it's
// some kind of builder class for creating meshes.
// VTABLE: LEGO1 0x100dbb30
class Unk : public Object {
class MeshBuilder : public Object {
public:
virtual Mesh* CreateMesh(
unsigned long faceCount,
@ -331,7 +331,7 @@ class Unk : public Object {
ShadingModel shadingModel
) = 0;
virtual Result GetBoundingBox(float min[3], float max[3]) = 0;
virtual Unk* Clone() = 0;
virtual MeshBuilder* Clone() = 0;
// SYNTHETIC: LEGO1 0x100a27b0
// Tgl::Unk::~Unk

View File

@ -3,5 +3,5 @@
// FUNCTION: LEGO1 0x100a5e40
ViewLOD::~ViewLOD()
{
delete m_unk0x04;
delete m_meshBuilder;
}

View File

@ -17,7 +17,7 @@ class ViewLOD : public LODObject {
c_bit4 = 0x10
};
ViewLOD(Tgl::Renderer* pRenderer) : m_unk0x04(NULL), m_unk0x08(3) {}
ViewLOD(Tgl::Renderer* pRenderer) : m_meshBuilder(NULL), m_unk0x08(3) {}
~ViewLOD() override;
// FUNCTION: LEGO1 0x100a6f30
@ -26,8 +26,8 @@ class ViewLOD : public LODObject {
// FUNCTION: LEGO1 0x100a6f50
int NVerts() const override { return NumPolys() * 2; } // vtable+0x08
Tgl::Unk* GetUnknown0x04() { return m_unk0x04; }
const Tgl::Unk* GetUnknown0x04() const { return m_unk0x04; }
Tgl::MeshBuilder* GetMeshBuilder() { return m_meshBuilder; }
const Tgl::MeshBuilder* GetMeshBuilder() const { return m_meshBuilder; }
unsigned char GetUnknown0x08Test4() { return m_unk0x08 & 0xffffff04; }
unsigned char GetUnknown0x08Test8() { return m_unk0x08 & 0xffffff08; }
@ -38,8 +38,8 @@ class ViewLOD : public LODObject {
// ViewLOD::`scalar deleting destructor'
protected:
Tgl::Unk* m_unk0x04; // 0x04
undefined4 m_unk0x08; // 0x08
Tgl::MeshBuilder* m_meshBuilder; // 0x04
undefined4 m_unk0x08; // 0x08
};
#endif // VIEWLOD_H

View File

@ -93,13 +93,13 @@ void ViewManager::FUN_100a66a0(ViewROI* p_roi)
const ViewLOD* lod = (const ViewLOD*) p_roi->GetLOD(p_roi->GetUnknown0xe0());
if (lod != NULL) {
const Tgl::Unk* unk = NULL;
const Tgl::MeshBuilder* meshBuilder = NULL;
Tgl::Group* roiGeometry = p_roi->GetGeometry();
unk = lod->GetUnknown0x04();
meshBuilder = lod->GetMeshBuilder();
if (unk != NULL) {
roiGeometry->Remove(unk);
if (meshBuilder != NULL) {
roiGeometry->Remove(meshBuilder);
}
scene->Remove(roiGeometry);