mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Implement ViewManager::FUN_100a6dc0 (#697)
* Update viewmanager.cpp * Fix function --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "mxdirectx/mxstopwatch.h"
|
#include "mxdirectx/mxstopwatch.h"
|
||||||
#include "tgl/d3drm/impl.h"
|
#include "tgl/d3drm/impl.h"
|
||||||
|
#include "vec.h"
|
||||||
#include "viewlod.h"
|
#include "viewlod.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(ViewManager, 0x1bc)
|
DECOMP_SIZE_ASSERT(ViewManager, 0x1bc)
|
||||||
@@ -192,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) {
|
||||||
@@ -268,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;
|
||||||
@@ -433,11 +434,18 @@ void ViewManager::SetPOVSource(const OrientableROI* point_of_view)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x100a6dc0
|
// FUNCTION: LEGO1 0x100a6dc0
|
||||||
float ViewManager::FUN_100a6dc0(const BoundingSphere& p_bounding_sphere)
|
float ViewManager::ProjectedSize(const BoundingSphere& p_bounding_sphere)
|
||||||
{
|
{
|
||||||
// TODO
|
// The algorithm projects the radius of bounding sphere onto the perpendicular
|
||||||
return 0.0F;
|
// 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
|
||||||
|
// is then the ratio of the area of that projected circle to the view surface area
|
||||||
|
// at Z == 1.0.
|
||||||
|
//
|
||||||
|
float sphere_projected_area = 3.14159265359 * (p_bounding_sphere.Radius() * p_bounding_sphere.Radius());
|
||||||
|
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 @@ public:
|
|||||||
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 @@ private:
|
|||||||
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
|
||||||
|
Reference in New Issue
Block a user