An object that appears on the 3D scene. It is made up of a Model, together with information for positioning, rotation and collision detection. Skeletal animation is supported if contained in the Model. Otherwise, frame based animation can be used if the SceneObject is constructed with a vector of Models, each of which will be used as an animation frame.
More...
#include <SceneObject.hpp>
An object that appears on the 3D scene. It is made up of a Model, together with information for positioning, rotation and collision detection. Skeletal animation is supported if contained in the Model. Otherwise, frame based animation can be used if the SceneObject is constructed with a vector of Models, each of which will be used as an animation frame.
◆ SceneObject() [1/3]
small3d::SceneObject::SceneObject |
( |
const std::string & |
name, |
|
|
const Model & |
model, |
|
|
const uint32_t |
boundingBoxSubdivisions = 0 |
|
) |
| |
Model based constructor (skeletal animation)
- Parameters
-
name | The name of the object |
model | The Model for which to create the object (lvalue) |
boundingBoxSubdivisions | How many times to subdivide the initially created bounding box, getting more accurate collision detection at the expense of performance. |
◆ SceneObject() [2/3]
small3d::SceneObject::SceneObject |
( |
const std::string & |
name, |
|
|
const Model && |
model, |
|
|
const uint32_t |
boundingBoxSubdivisions = 0 |
|
) |
| |
Model based constructor (skeletal animation)
- Parameters
-
name | The name of the object |
model | The Model for which to create the object (rvalue) |
boundingBoxSubdivisions | How many times to subdivide the initially created bounding box, getting more accurate collision detection at the expense of performance. |
◆ SceneObject() [3/3]
small3d::SceneObject::SceneObject |
( |
const std::string & |
name, |
|
|
const std::vector< std::shared_ptr< Model >> & |
models, |
|
|
const uint32_t |
boundingBoxSubdivisions = 0 |
|
) |
| |
Model vector based constructor (animation using frames)
- Parameters
-
name | The name of the object |
models | The Model for which to create the object (rvalue) |
boundingBoxSubdivisions | How many times to subdivide the initially created bounding box, getting more accurate collision detection at the expense of performance. |
◆ contains()
bool small3d::SceneObject::contains |
( |
const Vec3 & |
point | ) |
const |
Check if the bounding boxes of this object contain a given point.
- Parameters
-
- Returns
- True if the point is contained in the bounding boxes of the object, False otherwise.
◆ containsCorners()
bool small3d::SceneObject::containsCorners |
( |
const SceneObject & |
otherObject | ) |
const |
Check if the bounding boxes of this object contain a corner of the bounding boxes of another object.
- Parameters
-
otherObject | The other object. |
- Returns
- True if the bounding boxes of this object contain a corner of the bounding boxes of another object, False otherwise.
◆ getBoundingBoxSetExtremes()
std::vector< BoundingBoxSet::extremes > & small3d::SceneObject::getBoundingBoxSetExtremes |
( |
| ) |
|
Get the bounding box set extremes (min and max coords)
- Returns
- The bounding box set extremes
◆ getBoundingBoxSetModels()
std::vector< Model > small3d::SceneObject::getBoundingBoxSetModels |
( |
| ) |
|
Get the bounding box set as models (for debug-rendering)
- Returns
- The bounding box set models
◆ getCurrentPose()
uint64_t small3d::SceneObject::getCurrentPose |
( |
| ) |
|
Get the current animation pose.
- Returns
- The current animation pose
◆ getModel()
Model & small3d::SceneObject::getModel |
( |
| ) |
|
Get the object's model.
- Returns
- The object's model
◆ getName()
const std::string small3d::SceneObject::getName |
( |
| ) |
const |
Get the name of the object.
- Returns
- The name of the object
◆ getOrientation()
const Vec3 small3d::SceneObject::getOrientation |
( |
| ) |
const |
: Get the orientation of the object
- Returns
- The orientation of the object
◆ getRotationXYZ()
const Vec3 & small3d::SceneObject::getRotationXYZ |
( |
| ) |
const |
: Get the rotation of the object in x, y, z representation. This will NOT work if the rotation was set via the setTransformation function.
- Returns
- The rotation in x, y, z representation
◆ getTransformation()
const Mat4 & small3d::SceneObject::getTransformation |
( |
| ) |
const |
: Get the tranformation matrix of the object
- Returns
- The tranformation matrix
◆ rotate()
void small3d::SceneObject::rotate |
( |
const Vec3 & |
rotation | ) |
|
: Modify the rotation of the object
- Parameters
-
rotation | The rotation to modify by (x, y, z) |
◆ setAnimation()
void small3d::SceneObject::setAnimation |
( |
uint32_t |
animationIdx | ) |
|
Set the current animation.
- Parameters
-
animationIdx | The index of the current animation |
◆ setFrameDelay()
void small3d::SceneObject::setFrameDelay |
( |
const int |
delay | ) |
|
Set the animation speed.
- Parameters
-
delay | The delay between each animation frame, expressed in number of game frames |
◆ setRotation()
void small3d::SceneObject::setRotation |
( |
const Vec3 & |
rotation | ) |
|
: Set the rotation of the object. (Overwrites transformation entered via setTransformation)
- Parameters
-
rotation | The rotation (x, y, z) |
◆ setTransformation()
void small3d::SceneObject::setTransformation |
( |
const Mat4 & |
rotation | ) |
|
: Set the transformation matrix of the object. (Overwrites rotation entered via setRotation)
- Parameters
-
rotation | The tranformation matrix |
◆ startAnimating()
void small3d::SceneObject::startAnimating |
( |
bool |
repeat = true | ) |
|
Start animating the object.
- Parameters
-
repeat | Repeat the animation after it has finished? |
◆ position
Vec3 small3d::SceneObject::position = Vec3(0.0f, 0.0f, 0.0f) |
The documentation for this class was generated from the following files: