isle/LEGO1/realtime/roi.h

125 lines
3 KiB
C
Raw Normal View History

#ifndef ROI_H
#define ROI_H
2023-11-19 09:49:36 -05:00
// ROI stands for Real-time Object Instance.
2023-12-11 16:33:46 -05:00
#include "compat.h"
#include "lodlist.h"
2024-01-12 19:34:38 -05:00
#include "mxgeometry/mxgeometry3d.h"
#include "mxstl/stlcompat.h"
#include "realtime/realtime.h"
/*
* A simple bounding box object with Min and Max accessor methods.
*/
2024-01-12 19:34:38 -05:00
// SIZE 0x28
class BoundingBox {
public:
2024-01-12 19:34:38 -05:00
const Mx3DPointFloat& Min() const { return min; }
Mx3DPointFloat& Min() { return min; }
const Mx3DPointFloat& Max() const { return max; }
Mx3DPointFloat& Max() { return max; }
private:
Mx3DPointFloat min; // 0x00
Mx3DPointFloat max; // 0x14
};
/*
* A simple bounding sphere object with center and radius accessor methods.
*/
2024-01-12 19:34:38 -05:00
// SIZE 0x18
class BoundingSphere {
public:
2024-01-12 19:34:38 -05:00
const Mx3DPointFloat& Center() const { return center; }
Mx3DPointFloat& Center() { return center; }
const float& Radius() const { return radius; }
float& Radius() { return radius; }
private:
Mx3DPointFloat center; // 0x00
float radius; // 0x14
};
/*
* Abstract base class representing a single LOD version of
* a geometric object.
*/
class LODObject {
public:
// LODObject();
virtual ~LODObject() {}
virtual float Cost(float pixels_covered) const = 0; // vtable+0x04
virtual float AveragePolyArea() const = 0; // vtable+0x08
virtual int NVerts() const = 0; // vtable+0x0c
};
/*
* A CompoundObject is simply a set of ROI objects which
* all together represent a single object with sub-parts.
*/
class ROI;
// typedef std::set<ROI*, std::less<const ROI*> > CompoundObject;
typedef list<ROI*> CompoundObject;
/*
* A ROIList is a list of ROI objects.
*/
typedef vector<const ROI*> ROIList;
/*
* A simple list of integers.
* Returned by RealtimeView::SelectLODs as indices into an ROIList.
*/
typedef vector<int> IntList;
// VTABLE: LEGO1 0x100dbc38
2024-01-12 19:34:38 -05:00
// SIZE 0x10
class ROI {
public:
ROI()
{
comp = 0;
lods = 0;
m_unk0x0c = 1;
}
virtual ~ROI()
{
// if derived class set the comp and lods, it should delete them
assert(!comp);
assert(!lods);
}
virtual float IntrinsicImportance() const = 0; // vtable+0x04
virtual const float* GetWorldVelocity() const = 0; // vtable+0x08
virtual const BoundingBox& GetWorldBoundingBox() const = 0; // vtable+0x0c
virtual const BoundingSphere& GetWorldBoundingSphere() const = 0; // vtable+0x10
const LODListBase* GetLODs() const { return lods; }
const LODObject* GetLOD(int i) const
{
assert(lods);
return (*lods)[i];
}
int GetLODCount() const { return lods ? lods->Size() : 0; }
const CompoundObject* GetComp() const { return comp; }
inline undefined GetUnknown0x0c() { return m_unk0x0c; }
inline void SetUnknown0x0c(undefined p_unk0x0c) { m_unk0x0c = p_unk0x0c; }
// SYNTHETIC: LEGO1 0x100a5d60
// ROI::`scalar deleting destructor'
protected:
CompoundObject* comp; // 0x04
LODListBase* lods; // 0x08
undefined m_unk0x0c; // 0x0c
};
// TEMPLATE: LEGO1 0x10084930
// list<ROI *,allocator<ROI *> >::~list<ROI *,allocator<ROI *> >
// SYNTHETIC: LEGO1 0x100a5d50
// ROI::~ROI
#endif // ROI_H