mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Add CalcWorldBoundingVolumes (#651)
This commit is contained in:

committed by
GitHub

parent
660c1e1170
commit
d090b449d1
@@ -131,6 +131,32 @@ void OrientableROI::UpdateWorldVelocity()
|
||||
{
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100a5a60
|
||||
void CalcWorldBoundingVolumes(
|
||||
const BoundingSphere& modelling_sphere,
|
||||
const Matrix4& local2world,
|
||||
BoundingBox& world_bounding_box,
|
||||
BoundingSphere& world_bounding_sphere
|
||||
)
|
||||
{
|
||||
// calculate world bounding volumes given a bounding sphere in modelling
|
||||
// space and local2world transform
|
||||
|
||||
// ??? we need to transform the radius too... if scaling...
|
||||
|
||||
V3XM4(world_bounding_sphere.Center(), modelling_sphere.Center(), local2world);
|
||||
|
||||
world_bounding_sphere.Radius() = modelling_sphere.Radius();
|
||||
|
||||
// update world_bounding_box
|
||||
world_bounding_box.Min()[0] = world_bounding_sphere.Center()[0] - world_bounding_sphere.Radius();
|
||||
world_bounding_box.Min()[1] = world_bounding_sphere.Center()[1] - world_bounding_sphere.Radius();
|
||||
world_bounding_box.Min()[2] = world_bounding_sphere.Center()[2] - world_bounding_sphere.Radius();
|
||||
world_bounding_box.Max()[0] = world_bounding_sphere.Center()[0] + world_bounding_sphere.Radius();
|
||||
world_bounding_box.Max()[1] = world_bounding_sphere.Center()[1] + world_bounding_sphere.Radius();
|
||||
world_bounding_box.Max()[2] = world_bounding_sphere.Center()[2] + world_bounding_sphere.Radius();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100a5d80
|
||||
const float* OrientableROI::GetWorldVelocity() const
|
||||
{
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#define REALTIME_H
|
||||
|
||||
#include "matrix.h"
|
||||
#include "roi.h"
|
||||
|
||||
#define NORMVEC3(dst, src) \
|
||||
{ \
|
||||
@@ -11,4 +12,8 @@
|
||||
|
||||
void CalcLocalTransform(const Vector3& p_posVec, const Vector3& p_dirVec, const Vector3& p_upVec, Matrix4& p_outMatrix);
|
||||
|
||||
// utility to help derived ROI classes implement
|
||||
// update_world_bounding_volumes() using a modelling sphere
|
||||
void CalcWorldBoundingVolumes(const BoundingSphere& modelling_sphere, const Matrix4& local2world, BoundingBox&, BoundingSphere&);
|
||||
|
||||
#endif // REALTIME_H
|
||||
|
@@ -4,10 +4,10 @@
|
||||
// ROI stands for Real-time Object Instance.
|
||||
|
||||
#include "compat.h"
|
||||
#include "decomp.h"
|
||||
#include "lodlist.h"
|
||||
#include "mxgeometry/mxgeometry3d.h"
|
||||
#include "mxstl/stlcompat.h"
|
||||
#include "realtime/realtime.h"
|
||||
|
||||
/*
|
||||
* A simple bounding box object with Min and Max accessor methods.
|
||||
|
Reference in New Issue
Block a user