

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object org.jrabbit.standard.game.world.camera.components.CameraViewChecker
public class CameraViewChecker
A CameraViewCheck handles checking to see if objects in the game world are being viewed by the camera. This allows the game to stop offscreen objects from being rendered, speeding up render time. This onscreenchecking is fairly optimized, but it is a bit complex. Basically, the CameraViewChecker caches all variables used in calculations that can be cached, and uses a "lossy" equation to determine onscreenness that is much faster than calculating trig variables for each check.
Field Summary  

(package private) boolean 
needsRecalc
Whether or not the CameraViewChecker should recalculate the variables it uses to determine culling. 
protected float 
radiusScale
The amount to scale the indicated 
protected Rotation 
rotation
The rotation that determines the angle of the viewed scene. 
protected Scalar 
scalar
The Scalar that determines the scale of the viewed scene. 
protected float 
viewHeightVal
Half the height of the viewed scene; used in culling. 
protected float 
viewWidthVal
Half the width of the viewed scene; used in culling. 
protected float 
xToX
A variable used to transform the unrotated coordinates into sensible values. 
protected float 
xToY
A variable used to transform the unrotated coordinates into sensible values. 
protected float 
yToX
A variable used to transform the unrotated coordinates into sensible values. 
protected float 
yToY
A variable used to transform the unrotated coordinates into sensible values. 
Constructor Summary  

CameraViewChecker(Rotation rotation,
Scalar scalar)
Creates a CameraViewChecker that uses the indicated rotation and scaling objects to calculate culling. 
Method Summary  

void 
flipped(Scalar scalar)
Flipping does not actually affect the results of culling, so this is safely ignored. 
void 
recalculate()
Recalculates all values used to optimize viewing checking. 
void 
rotated(Rotation rotation)
Flags that recalculation needs to occur, since the rotation of the view has been changed. 
void 
scaled(Scalar scalar)
Flags that recalculation needs to occur, since the scaling of the view has been changed. 
void 
update(int delta)
Resets the viewing dimensions, and checks to see if culling variables need to be recalculated. 
boolean 
views(float x,
float y,
float radius)
Determines if the object described is onscreen. 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Field Detail 

protected Rotation rotation
protected Scalar scalar
boolean needsRecalc
protected float viewWidthVal
protected float viewHeightVal
protected float xToX
protected float xToY
protected float yToX
protected float yToY
protected float radiusScale
Constructor Detail 

public CameraViewChecker(Rotation rotation, Scalar scalar)
rotation
 The Rotation to use for culling.scalar
 The Scalar to use for culling.Method Detail 

public boolean views(float x, float y, float radius)
views
in interface Viewer
x
 The relative x coordinate to the center of the view.y
 The relative y coordinate to the center of the view.radius
 The radius that the object fits within.
public void rotated(Rotation rotation)
rotated
in interface RotationListener
rotation
 The Rotation that was rotated.public void flipped(Scalar scalar)
flipped
in interface ScalarListener
scalar
 The Scalar that was flipped.public void scaled(Scalar scalar)
scaled
in interface ScalarListener
scalar
 The Scalar that was scaled.public void recalculate()
public void update(int delta)
update
in interface Updateable
delta
 The number of microseconds that have passed.


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 