mirror of
https://github.com/isledecomp/isle-portable.git
synced 2024-11-26 01:17:55 -05:00
Implement/match LegoCharacterManager::FUN_10085870 (#764)
This commit is contained in:
parent
60388c8c5d
commit
8225a38a01
4 changed files with 43 additions and 6 deletions
|
@ -11,6 +11,8 @@
|
|||
#include "roi/legolod.h"
|
||||
#include "roi/legoroi.h"
|
||||
|
||||
#include <vec.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoCharacter, 0x08)
|
||||
DECOMP_SIZE_ASSERT(LegoCharacterManager, 0x08)
|
||||
|
||||
|
@ -554,11 +556,46 @@ LegoROI* LegoCharacterManager::FUN_10085210(const char* p_name, const char* p_lo
|
|||
return roi;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10085870
|
||||
// FUNCTION: LEGO1 0x10085870
|
||||
MxResult LegoCharacterManager::FUN_10085870(LegoROI* p_roi)
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
MxResult result = FAILURE;
|
||||
|
||||
BoundingSphere boundingSphere;
|
||||
BoundingBox boundingBox;
|
||||
|
||||
const Tgl::MeshBuilder* meshBuilder = ((ViewLOD*) p_roi->GetLOD(0))->GetMeshBuilder();
|
||||
|
||||
if (meshBuilder != NULL) {
|
||||
float min[3], max[3];
|
||||
|
||||
FILLVEC3(min, 88888.0);
|
||||
FILLVEC3(max, -88888.0);
|
||||
meshBuilder->GetBoundingBox(min, max);
|
||||
|
||||
float center[3];
|
||||
center[0] = (min[0] + max[0]) / 2.0f;
|
||||
center[1] = (min[1] + max[1]) / 2.0f;
|
||||
center[2] = (min[2] + max[2]) / 2.0f;
|
||||
SET3(boundingSphere.Center(), center);
|
||||
|
||||
float radius[3];
|
||||
VMV3(radius, max, min);
|
||||
boundingSphere.Radius() = sqrt(NORMSQRD3(radius)) / 2.0;
|
||||
|
||||
p_roi->SetBoundingSphere(boundingSphere);
|
||||
|
||||
SET3(boundingBox.Min(), min);
|
||||
SET3(boundingBox.Max(), max);
|
||||
|
||||
p_roi->SetUnknown0x80(boundingBox);
|
||||
|
||||
p_roi->VTable0x14();
|
||||
|
||||
result = SUCCESS;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10085a80
|
||||
|
|
|
@ -362,7 +362,7 @@ class MeshBuilderImpl : public MeshBuilder {
|
|||
unsigned long (*pTextureIndices)[3],
|
||||
ShadingModel shadingModel
|
||||
) override;
|
||||
Result GetBoundingBox(float min[3], float max[3]) override;
|
||||
Result GetBoundingBox(float min[3], float max[3]) const override;
|
||||
|
||||
// vtable+0x10
|
||||
MeshBuilder* Clone() override;
|
||||
|
|
|
@ -159,7 +159,7 @@ inline Result MeshBuilderImpl::CreateMeshImpl(
|
|||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100a3ae0
|
||||
Result MeshBuilderImpl::GetBoundingBox(float min[3], float max[3])
|
||||
Result MeshBuilderImpl::GetBoundingBox(float min[3], float max[3]) const
|
||||
{
|
||||
D3DRMBOX box;
|
||||
Result result = ResultVal(m_data->GetBox(&box));
|
||||
|
|
|
@ -330,7 +330,7 @@ class MeshBuilder : public Object {
|
|||
unsigned long (*pTextureIndices)[3],
|
||||
ShadingModel shadingModel
|
||||
) = 0;
|
||||
virtual Result GetBoundingBox(float min[3], float max[3]) = 0;
|
||||
virtual Result GetBoundingBox(float min[3], float max[3]) const = 0;
|
||||
virtual MeshBuilder* Clone() = 0;
|
||||
|
||||
// SYNTHETIC: LEGO1 0x100a27b0
|
||||
|
|
Loading…
Reference in a new issue