Radium Engine  1.5.0
Ra::Engine::Rendering::RenderObject Class Referencefinal

#include <Engine/Rendering/RenderObject.hpp>

+ Inheritance diagram for Ra::Engine::Rendering::RenderObject:
+ Collaboration diagram for Ra::Engine::Rendering::RenderObject:

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::ComponentgetComponent () const
 
Scene::ComponentgetComponent ()
 
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 RenderTechniquegetRenderTechnique () const
 
std::shared_ptr< RenderTechniquegetRenderTechnique ()
 
void setMaterial (std::shared_ptr< Data::Material > material)
 
std::shared_ptr< const Data::MaterialgetMaterial () const
 
std::shared_ptr< Data::MaterialgetMaterial ()
 
void setMesh (std::shared_ptr< Data::Displayable > mesh)
 
std::shared_ptr< const Data::DisplayablegetMesh () 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 RenderObjectcreateRenderObject (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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ RenderObject()

Ra::Engine::Rendering::RenderObject::RenderObject ( const std::string &  name,
Scene::Component comp,
const RenderObjectType &  type,
int  lifetime = -1 
)

Construct a renderObject

Parameters
namethe name of the renderObject
compThe component that holds the RenderObject
typeThe type (ui, debug, geometry) of the render object
lifetimeA -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.

Member Function Documentation

◆ createRenderObject()

RenderObject * Ra::Engine::Rendering::RenderObject::createRenderObject ( const std::string &  name,
Scene::Component comp,
const RenderObjectType &  type,
std::shared_ptr< Data::Displayable mesh,
const RenderTechnique techniqueConfig = RenderTechnique::createDefaultRenderTechnique() 
)
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);

Parameters
name
comp
type
mesh
techniqueConfig
material
Returns

Definition at line 44 of file RenderObject.cpp.

+ Here is the call graph for this function:

◆ getName()

const std::string & Ra::Engine::Rendering::RenderObject::getName ( ) const

Getters and setters.

Definition at line 76 of file RenderObject.cpp.

◆ hasBeenRenderedOnce()

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.

◆ isColoredByVertexAttrib()

bool Ra::Engine::Rendering::RenderObject::isColoredByVertexAttrib ( ) const

manage usage of VERTEX_COLOR attribute by the material

Definition at line 138 of file RenderObject.cpp.

◆ render() [1/2]

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

Parameters
lightParamslighting parameters for this rendering
viewParamsviewing parameters for this rendering
shadershader to use for this rendering

Definition at line 267 of file RenderObject.cpp.

+ Here is the call graph for this function:

◆ render() [2/2]

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

Parameters
lightParamslighting parameters for this rendering
viewParamsviewing parameters for this rendering
passnameRenderTechnique pass name

Definition at line 291 of file RenderObject.cpp.

+ Here is the call graph for this function:

◆ toggleColoredByVertexAttrib()

void Ra::Engine::Rendering::RenderObject::toggleColoredByVertexAttrib ( )

manage usage of VERTEX_COLOR attribute by the material

Definition at line 132 of file RenderObject.cpp.

◆ updateGL()

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.


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