torque Torque Game Engine Documentation
TGE Version 1.5.2

VectorField Class Reference

#include <gVectorField.h>


Public Types

enum  TextureCoordFlip {
  Flip_None = 0,
  Flip_X = BIT(0),
  Flip_Y = BIT(1),
  Flip_XY = Flip_X | Flip_Y
}
 This is used to specify flip options for creating the texture coord array. More...

Public Member Functions

 VectorField ()
 Default Constructor.
 VectorField (const Point2I &resolution, const F32 maxX=1.f, const F32 maxY=1.f, TextureCoordFlip flip=Flip_None, VectorFieldInitFn initFn=NULL)
 Constructor.
 VectorField (const char *fileName)
 Constructor with file name.
 ~VectorField ()
 Destructor.
void initVectorField (F32 maxX=1.f, F32 maxY=1.f, TextureCoordFlip flip=Flip_None, VectorFieldInitFn initFn=NULL)
 Init the vector field.
bool loadField (const char *fileName)
 Load the vector field from a file.
bool saveField (const char *fileName) const
 Save the vector field to a file.
void renderField (bool texture=false) const
 Render out the vector field.
void visualizeField (F32 alpha=1.f) const
 Render the field to let someone visualize what it is doing.

Private Member Functions

void allocVectorField (const Point2I &resolution)
 Helper function to create the vector field.
void destroyVectorField ()
 Helper function to destroy the vector field.
void nullField ()
 Helper function to null the pointers.
Point2FgetVector (const U32 x, const U32 y)
 Helper inline just so I can store the vector field as a 1d array but access it as a 2d array.
const Point2FgetVector (const U32 x, const U32 y) const
void serialize (Stream *stream) const
 Put this field out to a stream.
void unserialize (Stream *stream)
 Read a stream and set up this field.

Private Attributes

Point2I mFieldResolution
 Resolution of the vector field, x * y = number of quads.
Point2FmVectorField
 Vector Field.
Point2FmFieldVerts
 Vertices for rendering the field.
U16mFieldIndices
 Indices for rendering the field.
Point2F mMax
 Maximum texture coordinate values.
Point2FmUnflippedVecField
 If the coords get flipped, then this will be unflipped.


Member Enumeration Documentation

This is used to specify flip options for creating the texture coord array.

Enumerator:
Flip_None 
Flip_X 
Flip_Y 
Flip_XY 


Constructor & Destructor Documentation

VectorField::VectorField (  ) 

Default Constructor.

VectorField::VectorField ( const Point2I resolution,
const F32  maxX = 1.f,
const F32  maxY = 1.f,
TextureCoordFlip  flip = Flip_None,
VectorFieldInitFn  initFn = NULL 
)

Constructor.

Parameters:
resolution Vector Field resolution
maxX Maximum value that can be assigned to an x-coord
maxY Maximum value that can be assigned to a y-coord
flip Flipping options for the texture coordinates
initFn Function pointer to init the vector field values with

VectorField::VectorField ( const char *  fileName  ) 

Constructor with file name.

Parameters:
fileName File name to load from

VectorField::~VectorField (  ) 

Destructor.


Member Function Documentation

void VectorField::allocVectorField ( const Point2I resolution  )  [private]

Helper function to create the vector field.

Parameters:
resolution Vector Field resolution

void VectorField::destroyVectorField (  )  [private]

Helper function to destroy the vector field.

void VectorField::nullField (  )  [inline, private]

Helper function to null the pointers.

Point2F & VectorField::getVector ( const U32  x,
const U32  y 
) [inline, private]

Helper inline just so I can store the vector field as a 1d array but access it as a 2d array.

const Point2F & VectorField::getVector ( const U32  x,
const U32  y 
) const [inline, private]

void VectorField::serialize ( Stream stream  )  const [private]

Put this field out to a stream.

void VectorField::unserialize ( Stream stream  )  [private]

Read a stream and set up this field.

void VectorField::initVectorField ( F32  maxX = 1.f,
F32  maxY = 1.f,
TextureCoordFlip  flip = Flip_None,
VectorFieldInitFn  initFn = NULL 
)

Init the vector field.

Parameters:
maxX Maximum value that can be assigned to an x-coord
maxY Maximum value that can be assigned to a y-coord
flip Flipping options for the texture coordinates
initFn Function pointer to init the vector field values with

bool VectorField::loadField ( const char *  fileName  ) 

Load the vector field from a file.

See also:
saveField
Parameters:
fileName File name to load from

bool VectorField::saveField ( const char *  fileName  )  const

Save the vector field to a file.

Parameters:
fileName File name to save to

void VectorField::renderField ( bool  texture = false  )  const

Render out the vector field.

Parameters:
texture True if this should enable texturing

void VectorField::visualizeField ( F32  alpha = 1.f  )  const

Render the field to let someone visualize what it is doing.


Field Documentation

Resolution of the vector field, x * y = number of quads.

Vertices for rendering the field.

Indices for rendering the field.

Maximum texture coordinate values.

If the coords get flipped, then this will be unflipped.




All Rights Reserved GarageGames.com, Inc. 1999-2005
Auto-magically Generated with Doxygen