Radium Engine
1.5.20
|
#include <Engine/Rendering/RenderObject.hpp>
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::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 | |
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 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.
|
override |
Definition at line 38 of file RenderObject.cpp.
Core::Aabb Ra::Engine::Rendering::RenderObject::computeAabb | ( | ) |
Definition at line 210 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.
Scene::Component * Ra::Engine::Rendering::RenderObject::getComponent | ( | ) |
Definition at line 151 of file RenderObject.cpp.
const Scene::Component * Ra::Engine::Rendering::RenderObject::getComponent | ( | ) | const |
Definition at line 147 of file RenderObject.cpp.
const Core::Transform & Ra::Engine::Rendering::RenderObject::getLocalTransform | ( | ) | const |
Definition at line 242 of file RenderObject.cpp.
const Core::Matrix4 & Ra::Engine::Rendering::RenderObject::getLocalTransformAsMatrix | ( | ) | const |
Definition at line 246 of file RenderObject.cpp.
std::shared_ptr< Data::Material > Ra::Engine::Rendering::RenderObject::getMaterial | ( | ) |
Definition at line 176 of file RenderObject.cpp.
std::shared_ptr< const Data::Material > Ra::Engine::Rendering::RenderObject::getMaterial | ( | ) | const |
Definition at line 172 of file RenderObject.cpp.
const std::shared_ptr< Data::Displayable > & Ra::Engine::Rendering::RenderObject::getMesh | ( | ) |
Definition at line 198 of file RenderObject.cpp.
std::shared_ptr< const Data::Displayable > Ra::Engine::Rendering::RenderObject::getMesh | ( | ) | const |
Definition at line 194 of file RenderObject.cpp.
const std::string & Ra::Engine::Rendering::RenderObject::getName | ( | ) | const |
Getters and setters.
Definition at line 76 of file RenderObject.cpp.
std::shared_ptr< RenderTechnique > Ra::Engine::Rendering::RenderObject::getRenderTechnique | ( | ) |
Definition at line 164 of file RenderObject.cpp.
std::shared_ptr< const RenderTechnique > Ra::Engine::Rendering::RenderObject::getRenderTechnique | ( | ) | const |
Definition at line 160 of file RenderObject.cpp.
Core::Transform Ra::Engine::Rendering::RenderObject::getTransform | ( | ) | const |
Definition at line 202 of file RenderObject.cpp.
Core::Matrix4 Ra::Engine::Rendering::RenderObject::getTransformAsMatrix | ( | ) | const |
Definition at line 206 of file RenderObject.cpp.
const RenderObjectType & Ra::Engine::Rendering::RenderObject::getType | ( | ) | const |
Definition at line 68 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.
void Ra::Engine::Rendering::RenderObject::hasExpired | ( | ) |
Notify component that the render object has expired.
Definition at line 258 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::invalidateAabb | ( | ) |
Definition at line 307 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.
bool Ra::Engine::Rendering::RenderObject::isDirty | ( | ) | const |
Definition at line 143 of file RenderObject.cpp.
bool Ra::Engine::Rendering::RenderObject::isPickable | ( | ) | const |
Definition at line 100 of file RenderObject.cpp.
bool Ra::Engine::Rendering::RenderObject::isTransparent | ( | ) | const |
Definition at line 124 of file RenderObject.cpp.
bool Ra::Engine::Rendering::RenderObject::isVisible | ( | ) | const |
Definition at line 88 of file RenderObject.cpp.
bool Ra::Engine::Rendering::RenderObject::isXRay | ( | ) | const |
Definition at line 112 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::setColoredByVertexAttrib | ( | bool | state | ) |
manage usage of VERTEX_COLOR attribute by the material
Definition at line 128 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::setLifetime | ( | int | t | ) |
Set a lifetime to an existing RenderObject.
Definition at line 262 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::setLocalTransform | ( | const Core::Matrix4 & | transform | ) |
Definition at line 237 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::setLocalTransform | ( | const Core::Transform & | transform | ) |
Definition at line 232 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::setMaterial | ( | std::shared_ptr< Data::Material > | material | ) |
Definition at line 168 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::setMesh | ( | std::shared_ptr< Data::Displayable > | mesh | ) |
Definition at line 180 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::setPickable | ( | bool | pickable | ) |
Definition at line 92 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::setRenderTechnique | ( | std::shared_ptr< RenderTechnique > | technique | ) |
Definition at line 155 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::setTransparent | ( | bool | transparent | ) |
Definition at line 116 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::setType | ( | const RenderObjectType & | t | ) |
Definition at line 72 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::setVisible | ( | bool | visible | ) |
Definition at line 80 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::setXRay | ( | bool | xray | ) |
Definition at line 104 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::togglePickable | ( | ) |
Definition at line 96 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::toggleTransparent | ( | ) |
Definition at line 120 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::toggleVisible | ( | ) |
Definition at line 84 of file RenderObject.cpp.
void Ra::Engine::Rendering::RenderObject::toggleXRay | ( | ) |
Definition at line 108 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.