Radium Engine
1.5.0
|
#include <Engine/Rendering/RenderObject.hpp>
Public Member Functions | |
EIGEN_MAKE_ALIGNED_OPERATOR_NEW | RenderObject (const std::string &name, Scene::Component *comp, const RenderObjectType &type, int lifetime=-1) |
void | updateGL () |
void | hasBeenRenderedOnce () |
void | hasExpired () |
Notify component that the render object has expired. | |
void | setLifetime (int t) |
Set a lifetime to an existing RenderObject. | |
void | render (const Data::RenderParameters &lightParams, const Data::ViewingParameters &viewParams, const Data::ShaderProgram *shader, const Data::RenderParameters &shaderParams) |
void | render (const Data::RenderParameters &lightParams, const Data::ViewingParameters &viewParams, Core::Utils::Index passId=DefaultRenderingPasses::LIGHTING_OPAQUE) |
void | invalidateAabb () |
const std::string & | getName () const |
const Scene::Component * | getComponent () const |
Scene::Component * | getComponent () |
const RenderObjectType & | getType () const |
void | setType (const RenderObjectType &t) |
void | setVisible (bool visible) |
void | toggleVisible () |
bool | isVisible () const |
void | setPickable (bool pickable) |
void | togglePickable () |
bool | isPickable () const |
void | setXRay (bool xray) |
void | toggleXRay () |
bool | isXRay () const |
void | setTransparent (bool transparent) |
void | toggleTransparent () |
bool | isTransparent () const |
void | setColoredByVertexAttrib (bool state) |
manage usage of VERTEX_COLOR attribute by the material | |
void | toggleColoredByVertexAttrib () |
manage usage of VERTEX_COLOR attribute by the material More... | |
bool | isColoredByVertexAttrib () const |
manage usage of VERTEX_COLOR attribute by the material More... | |
bool | isDirty () const |
void | setRenderTechnique (std::shared_ptr< RenderTechnique > technique) |
std::shared_ptr< const RenderTechnique > | getRenderTechnique () const |
std::shared_ptr< RenderTechnique > | getRenderTechnique () |
void | setMaterial (std::shared_ptr< Data::Material > material) |
std::shared_ptr< const Data::Material > | getMaterial () const |
std::shared_ptr< Data::Material > | getMaterial () |
void | setMesh (std::shared_ptr< Data::Displayable > mesh) |
std::shared_ptr< const Data::Displayable > | getMesh () const |
const std::shared_ptr< Data::Displayable > & | getMesh () |
Core::Transform | getTransform () const |
Core::Matrix4 | getTransformAsMatrix () const |
Core::Aabb | computeAabb () |
void | setLocalTransform (const Core::Transform &transform) |
void | setLocalTransform (const Core::Matrix4 &transform) |
const Core::Transform & | getLocalTransform () const |
const Core::Matrix4 & | getLocalTransformAsMatrix () const |
Public Member Functions inherited from Ra::Core::Utils::IndexedObject | |
IndexedObject (Index idx=Index::Invalid()) | |
CONSTRUCTOR. | |
IndexedObject (const IndexedObject &id_obj)=default | |
void | setIndex (const Index &idx) |
const Index & | getIndex () const |
Static Public Member Functions | |
static RenderObject * | createRenderObject (const std::string &name, Scene::Component *comp, const RenderObjectType &type, std::shared_ptr< Data::Displayable > mesh, const RenderTechnique &techniqueConfig=RenderTechnique::createDefaultRenderTechnique()) |
Additional Inherited Members | |
Protected Attributes inherited from Ra::Core::Utils::IndexedObject | |
Index | m_idx |
VARIABLE. | |
Class to manage renderable objects. This class associate all the informations needed to draw an object in OpenGL.
Definition at line 36 of file RenderObject.hpp.
Ra::Engine::Rendering::RenderObject::RenderObject | ( | const std::string & | name, |
Scene::Component * | comp, | ||
const RenderObjectType & | type, | ||
int | lifetime = -1 |
||
) |
Construct a renderObject
name | the name of the renderObject |
comp | The component that holds the RenderObject |
type | The type (ui, debug, geometry) of the render object |
lifetime | A -1 (or any other negative value) lifetime is considered infinite, 0 is an "invalid value" (would mean the render object has to die immediatly), hence it's considered as infinite, any other positive value will be taken into account. |
Definition at line 26 of file RenderObject.cpp.
|
static |
Sort of factory method to easily create a render object. Use case example : std::string name = "MyRO"; Component* comp; // Retrieve the component the way you want. // Since this method will often be used in a component, // just use this pointer. RenderObjectType type = RenderObjectType::Geometry; // For example // Retrieve an already created configuration, or create one (see ShaderConfiguration docs). ShaderConfiguration config = ShaderConfigurationFactory::getConfiguration("MyConfig"); Material* mat = new Material; // Then configure your material... // Configure your render technique RenderTechnique rt;
// createRenderObject can finally be called. RenderObject* ro = createRenderObject(name, component, type, config, material);
name | |
comp | |
type | |
mesh | |
techniqueConfig | |
material |
Definition at line 44 of file RenderObject.cpp.
const std::string & Ra::Engine::Rendering::RenderObject::getName | ( | ) | const |
Getters and setters.
Definition at line 76 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::hasBeenRenderedOnce | ( | ) |
Basically just decreases lifetime counter. If it goes to zero, then render object notifies the manager that it needs to be deleted. Does nothing if lifetime is set to -1
Definition at line 250 of file RenderObject.cpp.
bool Ra::Engine::Rendering::RenderObject::isColoredByVertexAttrib | ( | ) | const |
manage usage of VERTEX_COLOR attribute by the material
Definition at line 138 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::render | ( | const Data::RenderParameters & | lightParams, |
const Data::ViewingParameters & | viewParams, | ||
const Data::ShaderProgram * | shader, | ||
const Data::RenderParameters & | shaderParams | ||
) |
Render the object with the given rendering environment defined by the lighting parameters, the viewing parameters and the shader
lightParams | lighting parameters for this rendering |
viewParams | viewing parameters for this rendering |
shader | shader to use for this rendering |
Definition at line 267 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::render | ( | const Data::RenderParameters & | lightParams, |
const Data::ViewingParameters & | viewParams, | ||
Core::Utils::Index | passId = DefaultRenderingPasses::LIGHTING_OPAQUE |
||
) |
Render the object for the given rendering environment defined by the lighting parameters, the viewing parameters and the RenderTechnique pass name
lightParams | lighting parameters for this rendering |
viewParams | viewing parameters for this rendering |
passname | RenderTechnique pass name |
Definition at line 291 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::toggleColoredByVertexAttrib | ( | ) |
manage usage of VERTEX_COLOR attribute by the material
Definition at line 132 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::updateGL | ( | ) |
Updates all the openGL state of the object. Called at the beginning of each frame
Definition at line 57 of file RenderObject.cpp.