GroundPlane

Engine/source/T3D/groundPlane.h

A virtually infinite XY ground plane primitive.

More...

Public Types

Parent 

Protected Types

GFXVertexPNTBT
VertexType 

Private Types

Private Attributes

List of collision convexes we have created; for cleanup.

Instantiated material based on given material name.

Scale factor for U texture coordinates.

Scale factor for V texture coordinates.

World units per grid cell edge.

Public Functions

buildConvex(const Box3F & box, Convex * convex)

Builds a convex hull for this object.

bool
buildPolyList(PolyListContext context, AbstractPolyList * polyList, const Box3F & box, const SphereF & sphere)

Builds a list of polygons which intersect a bounding volume.

bool
castRay(const Point3F & start, const Point3F & end, RayInfo * info)

Casts a ray and obtain collision information, returns true if RayInfo is modified.

Called after any property of the object is changed in the world editor.

bool

Called when the object is added to the sim.

Called when the object is removed from the sim.

packUpdate(NetConnection * conn, U32 mask, BitStream * stream)

Instructs this object to pack its state for transfer over the network.

Called when the SceneManager is ready for the registration of render instances.

Sets the scale for the object.

Sets the Object -> World transform.

Instructs this object to read state data previously packed with packUpdate.

Public Static Functions

Protected Functions

Generate a subset of the ground plane matching the given frustum.

generateGrid(U32 width, U32 height, F32 squareSize, const Point2F & min, const Point2F & max, GFXVertexBufferHandle< VertexType > & outVertices, GFXPrimitiveBufferHandle & outPrimitives)

Generate a triangulated grid spanning the given bounds into the given buffers.

projectFrustum(const Frustum & frustum, F32 squareSize, Point2F & outMin, Point2F & outMax)

Project the given frustum onto the ground plane and return the XY bounds in world space.

Detailed Description

A virtually infinite XY ground plane primitive.

For rendering, a subset of the plane spanning the view frustum is generated and rendered. Tesselation is determined by the given squareSize property.

For collision detection, a finite bounding box is used to deal with finite precision of floating-point operations (we can't use floating-point infinity as infinity*0 is undefined.)

The ground plane can be textured like regular geometry by assigning a material name to its 'material' property. UVs mirror grid coordinates so that when using UV wrapping, textures will tile nicely.

Rendering State

Point2F mMin 
Point2F mMax 
VertexBuffer mVertexBuffer 
PrimitiveBuffer mPrimitiveBuffer 
GFXPrimitive mPrimitive 

Public Types

typedef SceneObject Parent 

Protected Types

typedef GFXVertexPNTBT VertexType 

Private Types

typedef GFXPrimitiveBufferHandle PrimitiveBuffer 
typedef GFXVertexBufferHandle< VertexType > VertexBuffer 

Private Attributes

Convex * mConvexList 

List of collision convexes we have created; for cleanup.

BaseMatInstance * mMaterial 

Instantiated material based on given material name.

PhysicsBody * mPhysicsRep 
F32 mScaleU 

Scale factor for U texture coordinates.

F32 mScaleV 

Scale factor for V texture coordinates.

F32 mSquareSize 

World units per grid cell edge.

Public Functions

GroundPlane()

~GroundPlane()

buildConvex(const Box3F & box, Convex * convex)

Reimplemented from: SceneObject

buildPolyList(PolyListContext context, AbstractPolyList * polyList, const Box3F & box, const SphereF & sphere)

Reimplemented from: SceneObject

castRay(const Point3F & start, const Point3F & end, RayInfo * info)

Reimplemented from: SceneObject

DECLARE_CONOBJECT(GroundPlane )

getUtilizedAssets(Vector< StringTableEntry > * usedAssetsList)

Reimplemented from: SceneObject

inspectPostApply()

Reimplemented from: SceneObject

onAdd()

Reimplemented from: SceneObject

onRemove()

Reimplemented from: SceneObject

packUpdate(NetConnection * conn, U32 mask, BitStream * stream)

Reimplemented from: SceneObject

prepRenderImage(SceneRenderState * state)

Reimplemented from: SceneObject

setScale(const Point3F & scale)

Reimplemented from: SceneObject

setTransform(const MatrixF & mat)

Reimplemented from: SceneObject

unpackUpdate(NetConnection * conn, BitStream * stream)

Reimplemented from: SceneObject

Public Static Functions

initPersistFields()

Protected Functions

_updateMaterial()

createGeometry(const Frustum & frustum)

Generate a subset of the ground plane matching the given frustum.

generateGrid(U32 width, U32 height, F32 squareSize, const Point2F & min, const Point2F & max, GFXVertexBufferHandle< VertexType > & outVertices, GFXPrimitiveBufferHandle & outPrimitives)

Generate a triangulated grid spanning the given bounds into the given buffers.

getPlaneBox()

projectFrustum(const Frustum & frustum, F32 squareSize, Point2F & outMin, Point2F & outMax)

Project the given frustum onto the ground plane and return the XY bounds in world space.