Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
Object Class Reference

Represent a 3D textured object. More...

#include <Object.hpp>

Public Member Functions

 Object ()=default
 
 Object (const Mesh *mesh, bool castShadows)
 
void addAnimation (const std::shared_ptr< Animation > &anim)
 
void set (const glm::mat4 &model)
 
virtual void update (double fullTime, double frameTime)
 
const BoundingBoxboundingBox () const
 
const Meshmesh () const
 
const glm::mat4 & model () const
 
bool castsShadow () const
 
bool useTexCoords () const
 
bool animated () const
 
void setMaterial (const Material *material)
 
const Materialmaterial () const
 
const std::string & materialName () const
 
virtual bool decode (const KeyValues &params, Storage options)
 
virtual KeyValues encode () const
 
virtual ~Object ()=default
 
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=default
 
Objectoperator= (Object &&)=default
 

Protected Attributes

const Mesh_mesh = nullptr
 Geometry of the object.
 
std::string _materialName
 Material name.
 
const Material_material = nullptr
 Material.
 
std::vector< std::shared_ptr< Animation > > _animations
 Animations list (applied in order).
 
Animated< glm::mat4 > _model { glm::mat4(1.0f) }
 The transformation matrix of the 3D model, updated by the animations.
 
BoundingBox _bbox
 The world space object bounding box.
 
bool _castShadow = true
 Can the object casts shadows.
 
bool _skipUVs = false
 The object doesn't use UV coordinates.
 
bool _dirtyBbox = true
 Has the bounding box been updated following an animation update.
 

Detailed Description

Represent a 3D textured object.

Inherited by Sky.

Constructor & Destructor Documentation

◆ Object() [1/4]

Object::Object ( )
default

Constructor

◆ Object() [2/4]

Object::Object ( const Mesh mesh,
bool  castShadows 
)

Construct a new object.

Parameters
meshthe geometric mesh infos
castShadowsdenote if the object should cast shadows

◆ ~Object()

virtual Object::~Object ( )
virtualdefault

Destructor.

◆ Object() [3/4]

Object::Object ( const Object )
delete

Copy constructor.

◆ Object() [4/4]

Object::Object ( Object &&  )
default

Move constructor.

Member Function Documentation

◆ addAnimation()

void Object::addAnimation ( const std::shared_ptr< Animation > &  anim)

Add an animation to apply at each frame.

Parameters
animthe animation to add

◆ animated()

bool Object::animated ( ) const
inline

Check if the object is moving over time.

Returns
a boolean denoting if animations are applied to the object

◆ boundingBox()

const BoundingBox & Object::boundingBox ( ) const

Query the bounding box of the object in world space.

Returns
the bounding box
Note
For mesh space bounding box, call boundingBox on mesh().

◆ castsShadow()

bool Object::castsShadow ( ) const
inline

Is the object casting a shadow.

Returns
a boolean denoting if the object is a caster

◆ decode()

bool Object::decode ( const KeyValues params,
Storage  options 
)
virtual

Setup an object parameters from a list of key-value tuples. The following keywords will be searched for:

material: material_name
mesh: meshname
translation: X,Y,Z
scaling: scale
orientation: axisX,axisY,axisZ angle
shadows: bool
skipuvs: bool
animations:
    - animationtype: ...
    - ...
Parameters
paramsthe parameters tuple
optionsdata loading and storage options
Returns
decoding status

Reimplemented in Sky.

◆ encode()

KeyValues Object::encode ( ) const
virtual

Generate a key-values representation of the object. See decode for the keywords and layout.

Returns
a tuple representing the object.

Reimplemented in Sky.

◆ material()

const Material & Object::material ( ) const
inline
Returns
the material associated to this object

◆ materialName()

const std::string & Object::materialName ( ) const
inline
Returns
the name of the material associated to this object

◆ mesh()

const Mesh * Object::mesh ( ) const
inline

Mesh getter.

Returns
the mesh infos

◆ model()

const glm::mat4 & Object::model ( ) const
inline

Object pose getter.

Returns
the model matrix

◆ operator=() [1/2]

Object & Object::operator= ( const Object )
delete

Copy assignment.

Returns
a reference to the object assigned to

◆ operator=() [2/2]

Object & Object::operator= ( Object &&  )
default

Move assignment.

Returns
a reference to the object assigned to

◆ set()

void Object::set ( const glm::mat4 &  model)

Update the object transformation matrix.

Parameters
modelthe new model matrix

◆ setMaterial()

void Object::setMaterial ( const Material material)

Set the material to use for this object

Parameters
materialthe new material to use

◆ update()

void Object::update ( double  fullTime,
double  frameTime 
)
virtual

Apply the animations for a frame duration.

Parameters
fullTimethe time since the launch of the application
frameTimethe time elapsed since the last frame

Reimplemented in Sky.

◆ useTexCoords()

bool Object::useTexCoords ( ) const
inline

Should the object use its texture coordinates (if they exist)

Returns
a boolean denoting if the UV should be used

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