Gem Illuminator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
Public Member Functions | List of all members
SceneBounds Class Reference

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>

Inheritance diagram for SceneBounds:
AbstractGem

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...
 
- Public Member Functions inherited from AbstractGem
 AbstractGem (QObject *parent=0)
 
virtual ~AbstractGem ()
 
const QVector3D & color () const
 
void setColor (const QVector3D &color)
 
const GemDatadata () 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

- Public Slots inherited from AbstractGem
void setRotationFromEuler (const QVector3D &eulerRotation)
 Sets rotation of gem using euler angles. This method is mainly used to set initial rotation. More...
 
- Signals inherited from AbstractGem
void positionChanged ()
 
void rotationChanged ()
 
void scaleChanged ()
 
void colorChanged ()
 
- Protected Member Functions inherited from AbstractGem
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...
 
- Protected Attributes inherited from AbstractGem
GemDatam_data
 
qreal m_radius
 

Detailed Description

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.

Constructor & Destructor Documentation

SceneBounds::SceneBounds ( QObject *  parent = 0)
explicit

Creates new SceneBounds. The extent of bounds is taken from config file.

Parameters
parent
SceneBounds::~SceneBounds ( )
virtual

Member Function Documentation

QList< LightRay * > SceneBounds::processRayIntersection ( const LightRay ray,
Scene scene 
)
overridevirtual

Override AbstractGem::processRayIntersection() in order to ensure the player loses hitting the bounds.

Parameters
rayThe ray hitting the bounds.
sceneThe scene containing all lightrays.
Returns
Returns a QList containing only a GameLostRay, so the player will loose as soon as the player tries to move on returned ray.

Reimplemented from AbstractGem.

void SceneBounds::setPosition ( const QVector3D &  position)
overridevirtual

Override AbstractGem::setPosition() in order to forbid moving the bounds around.

Parameters
positionThis parameter will be ignored.

Reimplemented from AbstractGem.

void SceneBounds::setRotation ( const QQuaternion &  rotation)
overridevirtual

setRotation Override AbstractGem::setRotation() in order to forbid rotating the bounds.

Parameters
rotationThis parameter will be ignored.

Reimplemented from AbstractGem.


The documentation for this class was generated from the following files: