mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-31 12:11:15 +00:00
Fix function
This commit is contained in:
parent
7d6316609b
commit
aca7f635fe
@ -193,7 +193,7 @@ inline void ViewManager::FUN_100a66f0(ViewROI* p_roi, int p_und)
|
|||||||
|
|
||||||
if (p_und == -1) {
|
if (p_und == -1) {
|
||||||
if (p_roi->GetWorldBoundingSphere().Radius() > 0.001F) {
|
if (p_roi->GetWorldBoundingSphere().Radius() > 0.001F) {
|
||||||
float und = FUN_100a6dc0(p_roi->GetWorldBoundingSphere());
|
float und = ProjectedSize(p_roi->GetWorldBoundingSphere());
|
||||||
|
|
||||||
if (und < seconds_allowed * g_unk0x1010105c) {
|
if (und < seconds_allowed * g_unk0x1010105c) {
|
||||||
if (p_roi->GetUnknown0xe0() == -2) {
|
if (p_roi->GetUnknown0xe0() == -2) {
|
||||||
@ -269,7 +269,7 @@ inline int ViewManager::Unknown()
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float fVar7 = tan(view_angle / 2.0F);
|
float fVar7 = tan(view_angle / 2.0F);
|
||||||
unk0x2c = view_angle * view_angle * 4.0F;
|
view_area_at_one = view_angle * view_angle * 4.0F;
|
||||||
|
|
||||||
float fVar1 = front * fVar7;
|
float fVar1 = front * fVar7;
|
||||||
float fVar2 = (width / height) * fVar1;
|
float fVar2 = (width / height) * fVar1;
|
||||||
@ -435,16 +435,17 @@ void ViewManager::SetPOVSource(const OrientableROI* point_of_view)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a6dc0
|
// FUNCTION: LEGO1 0x100a6dc0
|
||||||
float ViewManager::FUN_100a6dc0(const BoundingSphere& p_bounding_sphere)
|
float ViewManager::ProjectedSize(const BoundingSphere& p_bounding_sphere)
|
||||||
{
|
{
|
||||||
const float* data = p_bounding_sphere.Center().GetData();
|
// The algorithm projects the radius of bounding sphere onto the perpendicular
|
||||||
float(*matrixData)[4] = pov.GetData();
|
// plane one unit in front of the camera. That value is simply the ratio of the
|
||||||
|
// radius to the distance from the camera to the sphere center. The projected size
|
||||||
double points[3];
|
// is then the ratio of the area of that projected circle to the view surface area
|
||||||
|
// at Z == 1.0.
|
||||||
VMV3(points, data, matrixData[3]);
|
//
|
||||||
|
float sphere_projected_area = 3.14159265359 * (p_bounding_sphere.Radius() * p_bounding_sphere.Radius());
|
||||||
return (p_bounding_sphere.Radius() * p_bounding_sphere.Radius() * 3.14159265359) / DOT3(data, points) * unk0x2c;
|
float square_dist_to_sphere = DISTSQRD3(p_bounding_sphere.Center(), pov[3]);
|
||||||
|
return sphere_projected_area / view_area_at_one / square_dist_to_sphere;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x100a6e00
|
// STUB: LEGO1 0x100a6e00
|
||||||
|
|||||||
@ -26,7 +26,7 @@ class ViewManager {
|
|||||||
void FUN_100a65b0(ViewROI* p_roi, int p_und);
|
void FUN_100a65b0(ViewROI* p_roi, int p_und);
|
||||||
void FUN_100a66a0(ViewROI* p_roi);
|
void FUN_100a66a0(ViewROI* p_roi);
|
||||||
void SetPOVSource(const OrientableROI* point_of_view);
|
void SetPOVSource(const OrientableROI* point_of_view);
|
||||||
float FUN_100a6dc0(const BoundingSphere& p_bounding_sphere);
|
float ProjectedSize(const BoundingSphere& p_bounding_sphere);
|
||||||
ViewROI* Pick(Tgl::View* p_view, unsigned long x, unsigned long y);
|
ViewROI* Pick(Tgl::View* p_view, unsigned long x, unsigned long y);
|
||||||
void SetResolution(int width, int height);
|
void SetResolution(int width, int height);
|
||||||
void SetFrustrum(float fov, float front, float back);
|
void SetFrustrum(float fov, float front, float back);
|
||||||
@ -50,7 +50,7 @@ class ViewManager {
|
|||||||
RealtimeView rt_view; // 0x14
|
RealtimeView rt_view; // 0x14
|
||||||
ROIList visible_rois; // 0x18
|
ROIList visible_rois; // 0x18
|
||||||
float unk0x28; // 0x28
|
float unk0x28; // 0x28
|
||||||
float unk0x2c; // 0x2c
|
float view_area_at_one; // 0x2c
|
||||||
unsigned int flags; // 0x30
|
unsigned int flags; // 0x30
|
||||||
float width; // 0x34
|
float width; // 0x34
|
||||||
float height; // 0x38
|
float height; // 0x38
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user