mirror of
https://github.com/isledecomp/isle-portable.git
synced 2024-11-22 15:37:55 -05:00
Implement ViewManager::FUN_100a6dc0 (#697)
* Update viewmanager.cpp * Fix function --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
parent
0994d6dbfb
commit
d92963982a
2 changed files with 16 additions and 8 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "mxdirectx/mxstopwatch.h"
|
||||
#include "tgl/d3drm/impl.h"
|
||||
#include "vec.h"
|
||||
#include "viewlod.h"
|
||||
|
||||
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_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 (p_roi->GetUnknown0xe0() == -2) {
|
||||
|
@ -268,7 +269,7 @@ inline int ViewManager::Unknown()
|
|||
}
|
||||
else {
|
||||
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 fVar2 = (width / height) * fVar1;
|
||||
|
@ -433,11 +434,18 @@ void ViewManager::SetPOVSource(const OrientableROI* point_of_view)
|
|||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100a6dc0
|
||||
float ViewManager::FUN_100a6dc0(const BoundingSphere& p_bounding_sphere)
|
||||
// FUNCTION: LEGO1 0x100a6dc0
|
||||
float ViewManager::ProjectedSize(const BoundingSphere& p_bounding_sphere)
|
||||
{
|
||||
// TODO
|
||||
return 0.0F;
|
||||
// The algorithm projects the radius of bounding sphere onto the perpendicular
|
||||
// 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
|
||||
|
|
|
@ -26,7 +26,7 @@ class ViewManager {
|
|||
void FUN_100a65b0(ViewROI* p_roi, int p_und);
|
||||
void FUN_100a66a0(ViewROI* p_roi);
|
||||
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);
|
||||
void SetResolution(int width, int height);
|
||||
void SetFrustrum(float fov, float front, float back);
|
||||
|
@ -50,7 +50,7 @@ class ViewManager {
|
|||
RealtimeView rt_view; // 0x14
|
||||
ROIList visible_rois; // 0x18
|
||||
float unk0x28; // 0x28
|
||||
float unk0x2c; // 0x2c
|
||||
float view_area_at_one; // 0x2c
|
||||
unsigned int flags; // 0x30
|
||||
float width; // 0x34
|
||||
float height; // 0x38
|
||||
|
|
Loading…
Reference in a new issue