Bubba-3D
0.9.0
Awesome game engine!
|
A class for containing all information about a object in the game world. More...
#include <GameObject.h>
Public Member Functions | |
GameObject (GameObject *parent) | |
GameObject (Mesh *mesh) | |
GameObject (Mesh *mesh, Mesh *colliderMesh) | |
GameObject (Mesh *mesh, GameObject *parent) | |
GameObject (Mesh *mesh, Mesh *colliderMesh, GameObject *parent) | |
virtual void | render () |
virtual void | renderShadow (ShaderProgram *shaderProgram) |
void | addRenderComponent (IRenderComponent *renderer) |
void | addComponent (IComponent *newComponent) |
void | update (float dt) |
void | callEvent (EventType type, GameObject *data) |
chag::float4x4 | getModelMatrix () |
void | move (chag::float4x4 model_matrix) |
void | update (chag::float4x4 update_matrix) |
chag::float3 | getRelativeScale () |
chag::float3 | getAbsoluteScale () |
void | setScale (chag::float3 s) |
chag::Quaternion | getRelativeRotation () |
chag::Quaternion | getAbsoluteRotation () |
void | setRotation (chag::Quaternion r) |
void | updateRotation (chag::Quaternion r) |
chag::float3 | getRelativeLocation () |
chag::float3 | getAbsoluteLocation () |
void | setLocation (chag::float3 l) |
void | addChild (GameObject *child) |
TypeIdentifier | getIdentifier () |
void | setIdentifier (TypeIdentifier identifier) |
void | addCollidesWith (TypeIdentifier colliderID) |
void | addCollidesWith (std::initializer_list< TypeIdentifier > colliderIDs) |
void | clearCollidesWithList () |
bool | collidesWith (TypeIdentifier id) |
Octree * | getOctree () |
std::vector< Triangle * > | getTriangles () |
AABB | getTransformedAABB () |
Sphere | getTransformedSphere () |
bool | isDynamicObject () |
void | setDynamic (bool isDynamic) |
int | getId () |
void | makeDirty () |
bool | isDirty () |
Additional Inherited Members | |
![]() | |
float | shininess |
A class for containing all information about a object in the game world.
Contains information about the mesh; how to render it, how to manipulate it and how to collide it.
Standard usage:
If the object can move, call setDynamic(true) to indicate this. The objects dynamicity can be used by collision handlers to determine if two objects can possibly collide (eg, two static objects can never collide).
The dirty flag can be used to indicate that an objects should be removed when possible. This can be useful if calculations involving the object needs to be performed after it has been marked as dirty. Then you can at a later point, when calculations arent being done, safely remove the object.
Definition at line 67 of file GameObject.h.
|
explicit |
Initiates the GameObject with the same mesh for rendering and collision
mesh | The mesh to render and perform collisions with |
Definition at line 61 of file GameObject.cpp.
Initiates the GameObject with different meshes for rendering and collisions
mesh | The mesh to use for rendering |
colliderMesh | The mesh to use for collision |
Definition at line 66 of file GameObject.cpp.
void GameObject::callEvent | ( | EventType | type, |
GameObject * | data | ||
) |
Calls a specific component event on all components in the GameObject
type | The event to call on the components |
data | // TODO(Bubbad) Do all events need to involve another gameobject? |
Definition at line 207 of file GameObject.cpp.
Octree * GameObject::getOctree | ( | ) |
NOTE: The octree has not been transformed.
Definition at line 274 of file GameObject.cpp.
std::vector< Triangle * > GameObject::getTriangles | ( | ) |
NOTE: The triangles have not been transformed.
Definition at line 148 of file GameObject.cpp.
void GameObject::makeDirty | ( | ) |
Marks the GameObject as dirty, indicating that it should be removed at some point.
Definition at line 118 of file GameObject.cpp.
void GameObject::move | ( | chag::float4x4 | model_matrix | ) |
Replaces the old model matrix completely
modelMatrix | The new model matrix |
Definition at line 129 of file GameObject.cpp.
|
virtual |
Renders the GameObject using the GameObjects RenderComponent, if any.
Implements IDrawable.
Definition at line 137 of file GameObject.cpp.
|
virtual |
Renders the GameObject shadows using the GameObjects RenderComponent, if any.
Implements IDrawable.
Definition at line 157 of file GameObject.cpp.
void GameObject::update | ( | float | dt | ) |
Calls update for all components in the GameObject
dt | The time since last called |
Definition at line 192 of file GameObject.cpp.
void GameObject::update | ( | chag::float4x4 | update_matrix | ) |
Multiplies the old model matrix with the specified
updateMatrix | The matrix to multiply with |
Definition at line 133 of file GameObject.cpp.