Packagesandy.view
Classpublic class Frustum

Used to create the frustum of the camera.

The frustum is volume used to control a geometrical object, such as a box, a sphere, or a point can be seen by the camera, and thus should be rendered.

Clipping of objects and polygons is performed against the frustum surfaces, as well as the near and far planes.



Public Properties
 PropertyDefined by
  aConstants : Array
Frustum
  aNormals : Array
Frustum
  aPlanes : Array
An array of planes representing the frustum.
Frustum
  aPoints : Array
An array of points representing the frustum.
Frustum
Public Methods
 MethodDefined by
  
Creates a frustum for the camera.
Frustum
  
Returns the culling state for the passed bounding box.
Frustum
  
clipFrontPlane(p_aCvert:Array, p_aUVCoords:Array):void
Clips a polygon against the front frustum plane.
Frustum
  
clipFrustum(p_aCvert:Array, p_aUVCoords:Array):void
Clips a polygon against the frustum planes.
Frustum
  
clipLineFrontPlane(p_aCvert:Array):void
Clip the given vertex and UVCoords arrays against the frustum front plane.
Frustum
  
clipPolygon(p_oPlane:Plane, p_aCvert:Array, p_aUVCoords:Array):void
Clips a polygon against one the frustum planes.
Frustum
  
computePlanes(p_nAspect:Number, p_nNear:Number, p_nFar:Number, p_nFov:Number):void
Computes the frustum planes.
Frustum
  
extractPlanes(comboMatrix:Matrix4, normalize:Boolean):void
Extracts the clipping planes.
Frustum
  
Returns the culling state for the passed point.
Frustum
  
Returns the culling state for the passed bounding sphere.
Frustum
Public Constants
 ConstantDefined by
  BOTTOM : uint = 5
[static] Specifies the index of the bottom plane of the frustum in the aPlanes array.
Frustum
  EPSILON : Number = 0.005
[static]
Frustum
  FAR : uint = 0
[static] Specifies the index of the far plane of the frustum in the aPlanes array.
Frustum
  INSIDE : CullingState
[static] Alias of CullingState.INSIDE.
Frustum
  INTERSECT : CullingState
[static] Alias of CullingState.INTERSECT.
Frustum
  LEFT : uint = 3
[static] Specifies the index of the left plane of the frustum in the aPlanes array.
Frustum
  NEAR : uint = 1
[static] Specifies the index of the near plane of the frustum in the aPlanes array.
Frustum
  OUTSIDE : CullingState
[static] Alias of CullingState.OUTSIDE.
Frustum
  RIGHT : uint = 2
[static] Specifies the index of the right plane of the frustum in the aPlanes array.
Frustum
  TOP : uint = 4
[static] Specifies the index of the top plane of the frustum in the aPlanes array.
Frustum
Property detail
aConstantsproperty
public var aConstants:Array
aNormalsproperty 
public var aNormals:Array
aPlanesproperty 
public var aPlanes:Array

An array of planes representing the frustum.

aPointsproperty 
public var aPoints:Array

An array of points representing the frustum.

Constructor detail
Frustum()constructor
public function Frustum()

Creates a frustum for the camera.

This constructor only creates the necessay data structures

Method detail
boxInFrustum()method
public function boxInFrustum(box:BBox):CullingState

Returns the culling state for the passed bounding box.

The method tests if the bounding box is within the frustum volume or not. The returned culling state is either Frustum.INSIDE, Frustum.OUTSIDE or Frustum.INTERSECT

Parameters
box:BBox — The box to test.

Returns
CullingState — The culling state of the box.
clipFrontPlane()method 
public function clipFrontPlane(p_aCvert:Array, p_aUVCoords:Array):void

Clips a polygon against the front frustum plane.

Parameters
p_aCvert:Array — Vertices of the polygon.
 
p_aUVCoords:Array — UV coordiantes of the polygon.
clipFrustum()method 
public function clipFrustum(p_aCvert:Array, p_aUVCoords:Array):void

Clips a polygon against the frustum planes.

Parameters
p_aCvert:Array — Vertices of the polygon.
 
p_aUVCoords:Array — UV coordiantes of the polygon.
clipLineFrontPlane()method 
public function clipLineFrontPlane(p_aCvert:Array):void

Clip the given vertex and UVCoords arrays against the frustum front plane.

Parameters
p_aCvert:Array — Vertices of the line.
clipPolygon()method 
public function clipPolygon(p_oPlane:Plane, p_aCvert:Array, p_aUVCoords:Array):void

Clips a polygon against one the frustum planes.

Parameters
p_oPlane:Plane — The plane to clip against.
 
p_aCvert:Array — Vertices of the polygon.
 
p_aUVCoords:Array — UV coordiantes of the polygon.
computePlanes()method 
public function computePlanes(p_nAspect:Number, p_nNear:Number, p_nFar:Number, p_nFov:Number):void

Computes the frustum planes.

Parameters
p_nAspect:Number — Aspect ration of the camera.
 
p_nNear:Number — The distance from the camera to the near clipping plane.
 
p_nFar:Number — The distance from the camera to the far clipping plane.
 
p_nFov:Number — Vertical field of view of the camera.
extractPlanes()method 
public function extractPlanes(comboMatrix:Matrix4, normalize:Boolean):void

Extracts the clipping planes.

[ToDo: Expalain this ]

Parameters
comboMatrix:Matrix4
 
normalize:Boolean
pointInFrustum()method 
public function pointInFrustum(p_oPoint:Vector):CullingState

Returns the culling state for the passed point.

The method tests if the passed point is within the frustum volume or not. The returned culling state is either Frustum.INSIDE or Frustum.OUTSIDE.

Parameters
p_oPoint:Vector — The point to test.

Returns
CullingState — The culling state of the point.
sphereInFrustum()method 
public function sphereInFrustum(p_oS:BSphere):CullingState

Returns the culling state for the passed bounding sphere.

The method tests if the bounding sphere is within the frustum volume or not. The returned culling state is either Frustum.INSIDE, Frustum.OUTSIDE or Frustum.INTERSECT

Parameters
p_oS:BSphere — The sphere to test.

Returns
CullingState — The culling state of the sphere.
Constant detail
BOTTOMconstant
public static const BOTTOM:uint = 5

Specifies the index of the bottom plane of the frustum in the aPlanes array.

EPSILONconstant 
public static const EPSILON:Number = 0.005
FARconstant 
public static const FAR:uint = 0

Specifies the index of the far plane of the frustum in the aPlanes array.

INSIDEconstant 
public static const INSIDE:CullingState

Alias of CullingState.INSIDE.

INTERSECTconstant 
public static const INTERSECT:CullingState

Alias of CullingState.INTERSECT.

LEFTconstant 
public static const LEFT:uint = 3

Specifies the index of the left plane of the frustum in the aPlanes array.

NEARconstant 
public static const NEAR:uint = 1

Specifies the index of the near plane of the frustum in the aPlanes array.

OUTSIDEconstant 
public static const OUTSIDE:CullingState

Alias of CullingState.OUTSIDE.

RIGHTconstant 
public static const RIGHT:uint = 2

Specifies the index of the right plane of the frustum in the aPlanes array.

TOPconstant 
public static const TOP:uint = 4

Specifies the index of the top plane of the frustum in the aPlanes array.