Radium Engine  1.5.20
Loading...
Searching...
No Matches
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

 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::stringgetName () const
 
const Scene::ComponentgetComponent () const
 
Scene::ComponentgetComponent ()
 
const RenderObjectTypegetType () 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
 
bool isColoredByVertexAttrib () const
 manage usage of VERTEX_COLOR attribute by the material
 
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.

◆ ~RenderObject()

Ra::Engine::Rendering::RenderObject::~RenderObject ( )
override

Definition at line 38 of file RenderObject.cpp.

Member Function Documentation

◆ computeAabb()

Core::Aabb Ra::Engine::Rendering::RenderObject::computeAabb ( )

Definition at line 210 of file RenderObject.cpp.

◆ 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:

◆ getComponent() [1/2]

Scene::Component * Ra::Engine::Rendering::RenderObject::getComponent ( )

Definition at line 151 of file RenderObject.cpp.

◆ getComponent() [2/2]

const Scene::Component * Ra::Engine::Rendering::RenderObject::getComponent ( ) const

Definition at line 147 of file RenderObject.cpp.

◆ getLocalTransform()

const Core::Transform & Ra::Engine::Rendering::RenderObject::getLocalTransform ( ) const

Definition at line 242 of file RenderObject.cpp.

◆ getLocalTransformAsMatrix()

const Core::Matrix4 & Ra::Engine::Rendering::RenderObject::getLocalTransformAsMatrix ( ) const

Definition at line 246 of file RenderObject.cpp.

◆ getMaterial() [1/2]

std::shared_ptr< Data::Material > Ra::Engine::Rendering::RenderObject::getMaterial ( )

Definition at line 176 of file RenderObject.cpp.

◆ getMaterial() [2/2]

std::shared_ptr< const Data::Material > Ra::Engine::Rendering::RenderObject::getMaterial ( ) const

Definition at line 172 of file RenderObject.cpp.

◆ getMesh() [1/2]

const std::shared_ptr< Data::Displayable > & Ra::Engine::Rendering::RenderObject::getMesh ( )

Definition at line 198 of file RenderObject.cpp.

◆ getMesh() [2/2]

std::shared_ptr< const Data::Displayable > Ra::Engine::Rendering::RenderObject::getMesh ( ) const

Definition at line 194 of file RenderObject.cpp.

◆ getName()

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

Getters and setters.

Definition at line 76 of file RenderObject.cpp.

◆ getRenderTechnique() [1/2]

std::shared_ptr< RenderTechnique > Ra::Engine::Rendering::RenderObject::getRenderTechnique ( )

Definition at line 164 of file RenderObject.cpp.

◆ getRenderTechnique() [2/2]

std::shared_ptr< const RenderTechnique > Ra::Engine::Rendering::RenderObject::getRenderTechnique ( ) const

Definition at line 160 of file RenderObject.cpp.

◆ getTransform()

Core::Transform Ra::Engine::Rendering::RenderObject::getTransform ( ) const

Definition at line 202 of file RenderObject.cpp.

◆ getTransformAsMatrix()

Core::Matrix4 Ra::Engine::Rendering::RenderObject::getTransformAsMatrix ( ) const

Definition at line 206 of file RenderObject.cpp.

◆ getType()

const RenderObjectType & Ra::Engine::Rendering::RenderObject::getType ( ) const

Definition at line 68 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.

◆ hasExpired()

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

Notify component that the render object has expired.

Definition at line 258 of file RenderObject.cpp.

◆ invalidateAabb()

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

Definition at line 307 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.

◆ isDirty()

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

Definition at line 143 of file RenderObject.cpp.

◆ isPickable()

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

Definition at line 100 of file RenderObject.cpp.

◆ isTransparent()

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

Definition at line 124 of file RenderObject.cpp.

◆ isVisible()

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

Definition at line 88 of file RenderObject.cpp.

◆ isXRay()

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

Definition at line 112 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:

◆ setColoredByVertexAttrib()

void Ra::Engine::Rendering::RenderObject::setColoredByVertexAttrib ( bool state)

manage usage of VERTEX_COLOR attribute by the material

Definition at line 128 of file RenderObject.cpp.

◆ setLifetime()

void Ra::Engine::Rendering::RenderObject::setLifetime ( int t)

Set a lifetime to an existing RenderObject.

Definition at line 262 of file RenderObject.cpp.

◆ setLocalTransform() [1/2]

void Ra::Engine::Rendering::RenderObject::setLocalTransform ( const Core::Matrix4 & transform)

Definition at line 237 of file RenderObject.cpp.

◆ setLocalTransform() [2/2]

void Ra::Engine::Rendering::RenderObject::setLocalTransform ( const Core::Transform & transform)

Definition at line 232 of file RenderObject.cpp.

◆ setMaterial()

void Ra::Engine::Rendering::RenderObject::setMaterial ( std::shared_ptr< Data::Material > material)

Definition at line 168 of file RenderObject.cpp.

◆ setMesh()

void Ra::Engine::Rendering::RenderObject::setMesh ( std::shared_ptr< Data::Displayable > mesh)

Definition at line 180 of file RenderObject.cpp.

◆ setPickable()

void Ra::Engine::Rendering::RenderObject::setPickable ( bool pickable)

Definition at line 92 of file RenderObject.cpp.

◆ setRenderTechnique()

void Ra::Engine::Rendering::RenderObject::setRenderTechnique ( std::shared_ptr< RenderTechnique > technique)

Definition at line 155 of file RenderObject.cpp.

◆ setTransparent()

void Ra::Engine::Rendering::RenderObject::setTransparent ( bool transparent)

Definition at line 116 of file RenderObject.cpp.

◆ setType()

void Ra::Engine::Rendering::RenderObject::setType ( const RenderObjectType & t)

Definition at line 72 of file RenderObject.cpp.

◆ setVisible()

void Ra::Engine::Rendering::RenderObject::setVisible ( bool visible)

Definition at line 80 of file RenderObject.cpp.

◆ setXRay()

void Ra::Engine::Rendering::RenderObject::setXRay ( bool xray)

Definition at line 104 of file RenderObject.cpp.

◆ toggleColoredByVertexAttrib()

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

manage usage of VERTEX_COLOR attribute by the material

Definition at line 132 of file RenderObject.cpp.

◆ togglePickable()

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

Definition at line 96 of file RenderObject.cpp.

◆ toggleTransparent()

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

Definition at line 120 of file RenderObject.cpp.

◆ toggleVisible()

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

Definition at line 84 of file RenderObject.cpp.

◆ toggleXRay()

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

Definition at line 108 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: