Wraith
0.1.5
Basic 3D game engine in C++
|
An OBB Collision volume More...
#include <CollisionVolumeOBB.h>
Public Member Functions | |
CollisionVolumeOBB (const CollisionVolumeOBB &)=default | |
CollisionVolumeOBB & | operator= (const CollisionVolumeOBB &)=default |
CollisionVolumeOBB (CollisionVolumeOBB &&)=default | |
CollisionVolumeOBB & | operator= (CollisionVolumeOBB &&)=default |
virtual void | computeData (Model *pModel, const Matrix &worldMatrix) override |
Calculates the data for OBB. In this case the center. More... | |
void | computeData (const Vect &minWorldVertex, const Vect &maxWorldVertex, const Matrix &worldMatrix) |
Calculates the data for OBB. In this case the center. More... | |
virtual bool | intersectAccept (const CollisionVolume &collisionVolume) const override |
Accepts a collision volume to perform intersect test. More... | |
virtual bool | intersectVisitor (const CollisionVolumeBSphere &collisionBSphere) const override |
Visits a collision volume BSphere to perform intersect test. More... | |
virtual bool | intersectVisitor (const CollisionVolumeAABB &AABB) const override |
Visits a collision volume AABB to perform intersect test. More... | |
virtual bool | intersectVisitor (const CollisionVolumeOBB &OBB) const override |
Visits a collision volume OBB to perform intersect test. More... | |
virtual bool | intersectVisitor (const CollisionVolumeOctree &Octree) const override |
Visits a collision volume Octree to perform intersect test. More... | |
void | setMinMaxLocalVertex (const Vect &minlocalVertex, const Vect &maxlocalVertex) |
Sets the minimum and maximum vertex in local space. More... | |
void | setWorldMatrix (const Matrix &worldMatrix) |
Sets the world matrix. More... | |
const Matrix & | getWorldMatrix () const |
Gets the world matrix of OBB. More... | |
const Matrix & | getInverseWorldMatrix () const |
Gets the inverse world matrix of OBB. More... | |
const Vect & | getMinLocalVertex () const |
Gets the minimum vertex in local space. More... | |
const Vect & | getMaxLocalVertex () const |
Gets the maximum vertex in local space. More... | |
const Vect & | getLocalHalfDiagonal () const |
Gets the half diagonal of OBB in local space. More... | |
const Vect & | getWorldCenter () const |
Gets the center position of OBB in world space. More... | |
float | getScalingFactorSquared () const |
Gets scaling factor sqaured of OBB. More... | |
virtual int | getMaxDepth () const override |
![]() | |
CollisionVolume (const CollisionVolume &)=default | |
CollisionVolume & | operator= (const CollisionVolume &)=default |
CollisionVolume (CollisionVolume &&)=default | |
CollisionVolume & | operator= (CollisionVolume &&)=default |
Private Member Functions | |
virtual void | debugDraw (const Vect &color, int depth) const override |
Draws it collision volume. More... | |
Private Attributes | |
Matrix | _worldMatrix |
Matrix | _inverseWorldMatrix |
Vect | _minLocalVertex |
Vect | _maxLocalVertex |
Vect | _localHalfDiagonal |
Vect | _worldCenter |
float | _scalingFactorSqaured |
An OBB Collision volume
void CollisionVolumeOBB::computeData | ( | const Vect & | minWorldVertex, |
const Vect & | maxWorldVertex, | ||
const Matrix & | worldMatrix | ||
) |
Calculates the data for OBB. In this case the center.
minWorldVertex | The min local vertex. |
maxWorldVertex | The max local vertex. |
worldMatrix | The world matrix. |
|
overridevirtual |
Calculates the data for OBB. In this case the center.
pModel | the pointer to a model. |
worldMatrix | The world matrix. |
Implements CollisionVolume.
|
overrideprivatevirtual |
Draws it collision volume.
Used for debuggin purposes. Depth value is used only for Octree collision value. All other collision volumes ignore it.
color | the color to render the collision volume. |
depth | the depth to render collision volume. |
Implements CollisionVolume.
const Matrix & CollisionVolumeOBB::getInverseWorldMatrix | ( | ) | const |
Gets the inverse world matrix of OBB.
const Vect & CollisionVolumeOBB::getLocalHalfDiagonal | ( | ) | const |
Gets the half diagonal of OBB in local space.
const Vect & CollisionVolumeOBB::getMaxLocalVertex | ( | ) | const |
Gets the maximum vertex in local space.
const Vect & CollisionVolumeOBB::getMinLocalVertex | ( | ) | const |
Gets the minimum vertex in local space.
float CollisionVolumeOBB::getScalingFactorSquared | ( | ) | const |
Gets scaling factor sqaured of OBB.
const Vect & CollisionVolumeOBB::getWorldCenter | ( | ) | const |
Gets the center position of OBB in world space.
const Matrix & CollisionVolumeOBB::getWorldMatrix | ( | ) | const |
Gets the world matrix of OBB.
|
overridevirtual |
Accepts a collision volume to perform intersect test.
Uses Visitor Pattern. This is the first step of the process. Then calls on intersectVisitor().
collisionVolume | a collision volume. |
Implements CollisionVolume.
|
overridevirtual |
Visits a collision volume AABB to perform intersect test.
Uses Visitor Pattern. This is the second step of the process.
AABB | a collision volume AABB. |
Implements CollisionVolume.
|
overridevirtual |
Visits a collision volume BSphere to perform intersect test.
Uses Visitor Pattern. This is the second step of the process.
collisionBSphere | a collision volume BSphere. |
Implements CollisionVolume.
|
overridevirtual |
Visits a collision volume OBB to perform intersect test.
Uses Visitor Pattern. This is the second step of the process.
OBB | a collision volume OBB. |
Implements CollisionVolume.
|
overridevirtual |
Visits a collision volume Octree to perform intersect test.
Uses Visitor Pattern. This is the second step of the process.
Octree | a collision volume Octree. |
Implements CollisionVolume.
void CollisionVolumeOBB::setMinMaxLocalVertex | ( | const Vect & | minlocalVertex, |
const Vect & | maxlocalVertex | ||
) |
Sets the minimum and maximum vertex in local space.
minWorldVertex | The min local vertex. |
maxWorldVertex | The max local vertex. |
void CollisionVolumeOBB::setWorldMatrix | ( | const Matrix & | worldMatrix | ) |
Sets the world matrix.
worldMatrix | The world matrix. |