Package eu.svjatoslav.sixth.e3d.gui
Class ViewSpaceTracker
java.lang.Object
eu.svjatoslav.sixth.e3d.gui.ViewSpaceTracker
Tracks an object's position in view/camera space for distance and angle calculations.
Used primarily for level-of-detail (LOD) decisions based on how far and at what angle the viewer is from an object. The tracker maintains the object's center point transformed into view space, and optionally orientation axes for angle calculations.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidanalyze(TransformStack transformPipe, RenderingContext renderingContext) Transforms the tracked points from object space to view space.voidEnables tracking of orientation axes for angle calculations.doubleReturns the angle between the viewer and object in the XY plane.doubleReturns the angle between the viewer and object in the XZ plane.doubleReturns the angle between the viewer and object in the YZ plane.doubleReturns the distance from the camera to the object's center.doubleProposes a slice factor for texture LOD based on distance to camera.
-
Field Details
-
center
The object's center point (0,0,0 in object space) transformed to view space. -
right
Point at (10,0,0) in object space, used for XZ angle calculation. Only initialized if orientation tracking is enabled. -
down
Point at (0,10,0) in object space, used for YZ angle calculation. Only initialized if orientation tracking is enabled.
-
-
Constructor Details
-
ViewSpaceTracker
public ViewSpaceTracker()
-
-
Method Details
-
analyze
Transforms the tracked points from object space to view space.- Parameters:
transformPipe- the current transform stackrenderingContext- the rendering context for frame info
-
enableOrientationTracking
public void enableOrientationTracking()Enables tracking of orientation axes for angle calculations. Disabled by default to save computation when angles are not needed. -
getAngleXY
public double getAngleXY()Returns the angle between the viewer and object in the XY plane.- Returns:
- the XY angle in radians
-
getAngleXZ
public double getAngleXZ()Returns the angle between the viewer and object in the XZ plane.- Returns:
- the XZ angle in radians
-
getAngleYZ
public double getAngleYZ()Returns the angle between the viewer and object in the YZ plane.- Returns:
- the YZ angle in radians
-
getDistanceToCamera
public double getDistanceToCamera()Returns the distance from the camera to the object's center. Used for level-of-detail calculations.- Returns:
- the distance in world units
-
proposeSliceFactor
public double proposeSliceFactor()Proposes a slice factor for texture LOD based on distance to camera.- Returns:
- the proposed slice factor
-