#include <absobj.h>
Inheritance diagram for AbsObj:
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< Vec4 > | vertlist |
List of vertices (dynamically created). | |
vector< tritype > | trilist |
List of the triangles. | |
vector< Vec4 > | normlist |
List of the normal of each triangle. |
|
Initialisation of object to sensible values. Most of this is due to no previous constructors. |
|
Increase velocity directly. Do not use. |
|
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:
|
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.
|
Here is the call graph for this function:
|
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.
|
Here is the call graph for this function:
|
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. |
|
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.
|
Here is the call graph for this function:
|
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. |
|
Set the rotation of the object directly. Only use for statics. |
Here is the call graph for this function:
|
Set rotational velocity directly. Do not use. |
|
Set transparency (alpha) of the object.
|
|
Set velocity directly. Do not use. |
Here is the call graph for this function:
|
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. |
|
|
|
Does this object fall under gravity?
|