The SceneBounds class is a special kind of gem describing the bounds of scene. The shape of the bounds is a cube, with a given extent in each direction. The main reason that the bounds are also a gem is easier collision detection. If there are bounds around our scene every ray emitted into scene will hit something. Furthermore the collision with scene bounds can be processed in a way, that the player will lose if the player hits the bounds. More...
#include <scenebounds.h>
Public Member Functions | |
SceneBounds (QObject *parent=0) | |
Creates new SceneBounds. The extent of bounds is taken from config file. More... | |
virtual | ~SceneBounds () |
void | setPosition (const QVector3D &position) override |
Override AbstractGem::setPosition() in order to forbid moving the bounds around. More... | |
void | setRotation (const QQuaternion &rotation) override |
setRotation Override AbstractGem::setRotation() in order to forbid rotating the bounds. More... | |
QList< LightRay * > | processRayIntersection (const LightRay &ray, Scene *scene) override |
Override AbstractGem::processRayIntersection() in order to ensure the player loses hitting the bounds. More... | |
![]() | |
AbstractGem (QObject *parent=0) | |
virtual | ~AbstractGem () |
const QVector3D & | color () const |
void | setColor (const QVector3D &color) |
const GemData & | data () const |
Returns the GemData object describing the gem. This method was not intended to be public, but public access is needed it for rendering. More... | |
const QMatrix4x4 & | model () const |
Constructs normal matrix for gem in order to transform it from objectspace into worldsapce. More... | |
const QVector3D & | position () const |
qreal | radius () const |
Radius of boundingsphere. This value is influenced by scale and the geometry of gem. More... | |
const QQuaternion & | rotation () const |
Rotation around own center. More... | |
void | rotate (const QQuaternion &quaternion) |
Rotates the gem around the center of the gem. More... | |
qreal | scale () const |
void | setScale (qreal scaleFactor) |
GemType | type () const |
Returns the type of gem, in order to differentiate between types even if you have only AbstractGems. More... | |
float | boundingSphereIntersectedBy (const LightRay &ray, QVector3D *collisionPoint=nullptr) |
Calculates distance to collision with gem's boundingsphere. The boundingsphere is specified by gems themself and cannot be influenced from outside. Because the collision point is only calculated with the bondingsphere computation is pretty fast. More... | |
virtual float | intersectedBy (const LightRay &ray, QVector3D *collisionPoint=nullptr) |
Calcualtes the distance to collision of ray with gem. This method calculates the real collision point. Therefore, many computations are done especially for complex gems. More... | |
Additional Inherited Members | |
![]() | |
void | setRotationFromEuler (const QVector3D &eulerRotation) |
Sets rotation of gem using euler angles. This method is mainly used to set initial rotation. More... | |
![]() | |
void | positionChanged () |
void | rotationChanged () |
void | scaleChanged () |
void | colorChanged () |
![]() | |
int | solveQuadricFormula (float a, float b, float c, float &x1, float &x2) |
float | faceIntersectedBy (const LightRay &ray, Triangle *&intersectedFace, QVector3D *collisionPoint=nullptr) |
Finds face of gem intersected by given ray. Ownership of returned face is transferred to caller. More... | |
Triangle | inWorldCoordinates (const Triangle &triangle) |
Calculates triangle in world coordinates for given triangle. Therefore, position, rotatition and scale of gem are used. More... | |
![]() | |
GemData * | m_data |
qreal | m_radius |
The SceneBounds class is a special kind of gem describing the bounds of scene. The shape of the bounds is a cube, with a given extent in each direction. The main reason that the bounds are also a gem is easier collision detection. If there are bounds around our scene every ray emitted into scene will hit something. Furthermore the collision with scene bounds can be processed in a way, that the player will lose if the player hits the bounds.
|
explicit |
Creates new SceneBounds. The extent of bounds is taken from config file.
parent |
|
virtual |
|
overridevirtual |
Override AbstractGem::processRayIntersection() in order to ensure the player loses hitting the bounds.
ray | The ray hitting the bounds. |
scene | The scene containing all lightrays. |
Reimplemented from AbstractGem.
|
overridevirtual |
Override AbstractGem::setPosition() in order to forbid moving the bounds around.
position | This parameter will be ignored. |
Reimplemented from AbstractGem.
|
overridevirtual |
setRotation Override AbstractGem::setRotation() in order to forbid rotating the bounds.
rotation | This parameter will be ignored. |
Reimplemented from AbstractGem.