Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

AbsObj Class Reference

#include <absobj.h>

Inheritance diagram for AbsObj:

Inheritance graph
[legend]
Collaboration diagram for AbsObj:

Collaboration graph
[legend]
List of all members.

Detailed Description

What will be hopefully the building block of the game.

Author:
Stephen Bridges
Todo:
Privatise some of the member vars?


Public Types

enum  objtype {
  UnSet = 0, Static, MainObj, Debris,
  NonContact, Projectile
}
 Making some object types allows different collision handling etc based on this.

Public Member Functions

 AbsObj ()
 Initialisation of object to sensible values.
void genericupdate (float time)
 Integrate time and set velocities.
void pos (float px, float py, float pz)
 Overloaded pos to set affine transform as well.
void setTransp (float t)
 Set transparency (alpha) of the object.
void setColour (float rin, float gin, float bin)
 Set the colour of the object.
void setRotation (float xin, float yin, float zin)
 Set the rotation of the object directly.
void setVel (float xin, float yin, float zin)
 Set velocity directly.
void setRotVel (float xin, float yin, float zin)
 Set rotational velocity directly.
void addRotVel (float xin, float yin, float zin)
 Increase velocity directly.
void calcTorque (Vec4 pos, Vec4 force)
 Given a point, and force vector, find the torque exerted on the object.
void getAffine (void)
 Calculate the affine transform.
void genericrender (void)
 This used to be virtual, but now we have generic models.
bool collide (const AbsObj &incoming, Vec4 *collpt=NULL, Vec4 *colln=NULL, Vec4 *collintr=NULL)
 Finds if an incoming object collides with this one.
bool collidept (const AbsObj &incoming, Vec4 *colln=NULL)
 Finds whether the incoming object (that is a point) is colliding with our object.
virtual void update (float time)=0
 The physics update function.
virtual void render (void)=0
 The rendering function.

Public Attributes

Vec4 col
Vec4 vrot
 Rotation vector.
Vec4 l
 Scaling from unit size.
Vec4 vl
 Linear velocity.
Vec4 vr
 Rotation velocity (tumbling).
bool gotGrav
 Does this object fall under gravity?
bool gotMove
 Can this object move?
float LastColl
 Time since last collision.
Matrix4x4 affine
 The affine transformation between object space and world space.
Matrix4x4 invaff
 And the inverse.
float life
 Life in seconds.
float mass
 Mass of the object - for collisions etc.
Matrix4x4 invtensor
 The inverse of the tensor, so we don't have to divide.
Vec4 forces
 The forces summing on the object every iteration.
Vec4 torques
 The torque summing about the object on every iteration.
vector< Vec4vertlist
 List of vertices (dynamically created).
vector< tritypetrilist
 List of the triangles.
vector< Vec4normlist
 List of the normal of each triangle.


Constructor & Destructor Documentation

AbsObj::AbsObj  ) 
 

Initialisation of object to sensible values.

Most of this is due to no previous constructors.


Member Function Documentation

void AbsObj::addRotVel float  xin,
float  yin,
float  zin
[inline]
 

Increase velocity directly.

Do not use.

void AbsObj::calcTorque Vec4  pos,
Vec4  force
 

Given a point, and force vector, find the torque exerted on the object.

The force vector is assumed to be in world space and in need of affine transformation.

Here is the call graph for this function:

bool AbsObj::collide const AbsObj incoming,
Vec4 collpt = NULL,
Vec4 colln = NULL,
Vec4 collintr = NULL
 

Finds if an incoming object collides with this one.

Specifically, do any of the triangles in the new object intersect any of the triangles in our object? This is unfortunately not the same, so this must be called from the PoV of both objects. Oh well.

Todo:
Fix intersection code, and check the averaging stuff.
Parameters:
incoming The object assumed to be "incoming", as it were.
collpt If not NULL, this is set to be the point of collision.
colln If not NULL, this is set to be the normal of the collision.
collintr The distance of intersection.
Returns:
True on collision.

Here is the call graph for this function:

bool AbsObj::collidept const AbsObj incoming,
Vec4 colln = NULL
 

Finds whether the incoming object (that is a point) is colliding with our object.

This is done by modelling the point as a ray, with a start point and direction. Then we find the triangles that intersect with the ray, and check if we are between these triangles or on the outside of them. Presumably this works for concave objects also.

Parameters:
incoming An AbsObj that is assumed to be a point.
colln If not NULL, set as the normal of the collision.
Todo:
Fold into the other collision code, as it wouldn't be difficult.

Here is the call graph for this function:

void AbsObj::genericrender void   ) 
 

This used to be virtual, but now we have generic models.

As collide will be virtual (unless it converges itself) absobj will still be uninstantiateable.

void AbsObj::genericupdate float  time  ) 
 

Integrate time and set velocities.

Currently the only thing that happens to velocities over time is gravity and friction. TBH I don't think anything else will be needed as collision impulses etc will be taken care of elsewhere.

Parameters:
time Time in seconds.

Todo:
Use Midpoint or RK4. I can't work out how to do this atm as forces would need to be recalculated.

Todo:
Take out gotGrav reference - used for debug only atm so we can collide with things.

Here is the call graph for this function:

virtual void AbsObj::render void   )  [pure virtual]
 

The rendering function.

You are unlikely to need to set this to anything other than genericrender() as it is pretty bloody generic.

Implemented in Grid, Particle, Bullet, Light, Ship, and Wall.

void AbsObj::setRotation float  xin,
float  yin,
float  zin
 

Set the rotation of the object directly.

Only use for statics.

Here is the call graph for this function:

void AbsObj::setRotVel float  xin,
float  yin,
float  zin
[inline]
 

Set rotational velocity directly.

Do not use.

void AbsObj::setTransp float  t  )  [inline]
 

Set transparency (alpha) of the object.

Parameters:
t 0 - 1.

void AbsObj::setVel float  xin,
float  yin,
float  zin
[inline]
 

Set velocity directly.

Do not use.

Here is the call graph for this function:

virtual void AbsObj::update float  time  )  [pure virtual]
 

The physics update function.

Set to genericupdate unless special stuff is required. In which case, call it from your new function.

Implemented in Grid, Particle, Bullet, Light, Ship, and Wall.


Member Data Documentation

Vec4 AbsObj::col
 

Todo:
Add alpha blending.

bool AbsObj::gotGrav
 

Does this object fall under gravity?

Todo:
Remove this and use objtpye instead.


The documentation for this class was generated from the following files:
Generated on Mon Jan 3 15:14:19 2005 for Graviton by  doxygen 1.3.9.1