Nymph Game Engine
Chaiscript based Game Engine
|
Class for renderable. More...
#include <renderable.h>
Public Member Functions | |
Renderable (const unsigned int vertex_array_object, const VertexData &vertex_data) | |
Renderable constructor. More... | |
Renderable (const Renderable &)=delete | |
Renderable | operator= (Renderable &)=delete |
Renderable (Renderable &&renderable) | |
Renderable & | operator= (Renderable &&renderable) |
virtual | ~Renderable () |
void | setShader (std::shared_ptr< Shader > shader_object) noexcept |
Sets the shader. More... | |
std::shared_ptr< Shader > | getShader () const noexcept |
Gets the shader. More... | |
void | addTexture (const unsigned int unit, const std::string uniform_name, std::shared_ptr< BaseTexture > texture_object) noexcept |
Adds a texture. More... | |
void | removeTexture (const unsigned int unit) |
Removes a texture. More... | |
std::map< unsigned int, std::shared_ptr< BaseTexture > > | getTextures () const noexcept |
Gets the textures. More... | |
void | setLightReactive (const bool reactive) noexcept |
Sets if the renderable should be light reactive. More... | |
bool | isLightReactive () const noexcept |
Determines if light reactive. More... | |
void | setAmbientLight (const glm::vec3 color) noexcept |
Sets the ambient light. More... | |
glm::vec3 | getAmbientLight () const noexcept |
Gets the ambient light. More... | |
void | setAmbientIntensity (const float intensity) noexcept |
Sets the ambient intensity. More... | |
float | getAmbientIntensity () const noexcept |
Gets the ambient intensity. More... | |
void | addInfluencingLight (std::shared_ptr< Light > light) noexcept |
Adds an influencing light. More... | |
void | clearInfluencingLights () |
Clears all influencing lights. More... | |
virtual std::string | to_string () const noexceptoverride |
Returns a string representation of the object. More... | |
virtual std::string | className () const noexceptoverride |
Returns a string representing the class name. More... | |
float | highestZ () const noexcept |
The highest possible z value in the renderable. More... | |
unsigned int | getVertexArrayBinding () const noexcept |
Gets the vertex array binding. More... | |
VertexData | getVertexData () const noexcept |
Gets the vertex data. More... | |
virtual void | onDestroy () override |
Called when the engine is shutting down. More... | |
virtual void | onStart () override |
Called when the engine starts and when a new scene is loaded. More... | |
virtual bool | onUpdate (const double delta) override |
Called every engine loop. More... | |
void | handleQueuedEvent (std::shared_ptr< Events::Event > event) override |
HandleQueuedEvent allows derived classes to define behaviour for when queuedEvents are received. More... | |
void | onNotifyNow (std::shared_ptr< Events::Event > event) override |
When receiving an event that is immediate, onNotifyNow is used. It acts as an interrupt to make sure the object is notified before another engine loop. This is pure virtual and is implemented on a case by case basis in derived classes. More... | |
virtual unsigned long long | getValueForSorting () const noexceptoverride |
Gets the value for sorting. More... | |
virtual void | log (el::base::type::ostream_t &os) const override |
Public Member Functions inherited from Component | |
Component () | |
Component constructor. More... | |
void | setTransform (std::shared_ptr< Transform > transform) |
Sets the transform. More... | |
std::shared_ptr< Transform > | getTransform () const noexcept |
Gets the transform. More... | |
void | setActive (const bool active) noexcept |
Sets the component active or inactive. More... | |
bool | isActive () const noexcept |
Determines if active. More... | |
unsigned int | getId () const noexcept |
Gets the identifier. More... | |
bool | operator< (Component &other) noexcept |
Operator < using getValueForSorting. More... | |
virtual | ~Component () |
Destroys the object. More... | |
Public Member Functions inherited from Events::Subject | |
virtual | ~Subject ()=default |
virtual void | notify (std::shared_ptr< Event > event) |
notify is used to tell observers of an event. More... | |
virtual void | notifyNow (std::shared_ptr< Event > event) |
notifyNow is used to tell observers of an event as an interrupt. More... | |
virtual void | addObserver (std::shared_ptr< Observer > observer) |
Adds an observer. More... | |
virtual void | removeObserver (std::shared_ptr< Observer > observer) |
Removes an observer. More... | |
Public Member Functions inherited from Events::Observer | |
virtual | ~Observer () |
void | onNotify (std::shared_ptr< Event > event) |
When receiving an event that is non-immediate, onNotify is used. The event is added to the event queue that is processed when processEventQueue is called. More... | |
void | processEventQueue () |
This should be called once ever loop for every Observer to properly use queued events. More... | |
Static Public Member Functions | |
static std::shared_ptr < Renderable > | create (const VertexData &vertex_data) |
Renderable factory function. More... | |
Protected Member Functions | |
void | setUniform (const Uniform &uniform) noexcept |
Renderable () | |
Protected Member Functions inherited from Events::Observer | |
std::shared_ptr< Event > | getEvent () |
bool | eventsWaiting () const noexcept |
Protected Attributes | |
std::set< Uniform > | uniforms |
Protected Attributes inherited from Component | |
std::weak_ptr< Entity > | entity |
std::shared_ptr< Transform > | transform |
bool | active |
unsigned int | id |
Additional Inherited Members | |
Static Protected Attributes inherited from Component | |
static unsigned int | next_id = 0 |
Class for renderable.
|
inlineprotected |
Graphics::Renderable::Renderable | ( | const unsigned int | vertex_array_object, |
const VertexData & | vertex_data | ||
) |
Renderable constructor.
[in] | vertex_array_object | The vertex array object |
[in] | vertex_data | The vertex data |
|
delete |
Graphics::Renderable::Renderable | ( | Renderable && | renderable | ) |
|
virtual |
References onDestroy().
|
noexcept |
Adds an influencing light.
[in] | light | The light |
Referenced by generated::getRenderableModule().
|
noexcept |
Adds a texture.
[in] | unit | The unit |
[in] | uniform_name | The uniform name |
[in] | texture_object | The texture object |
References Graphics::Uniform::setData().
Referenced by Graphics::UI::Element::Element(), and generated::getRenderableModule().
|
overridevirtualnoexcept |
Returns a string representing the class name.
Reimplemented from Component.
Reimplemented in Graphics::UI::Element, Graphics::UI::TextArea, Graphics::UI::TextField, Graphics::UI::Button, Graphics::UI::Area, and Graphics::UI::QuitButton.
Referenced by generated::getRenderableModule().
void Graphics::Renderable::clearInfluencingLights | ( | ) |
Clears all influencing lights.
Referenced by generated::getRenderableModule().
|
static |
Renderable factory function.
[in] | vertex_data | The vertex data |
References Graphics::VertexData::generateVertexArrayObject().
|
noexcept |
Gets the ambient intensity.
Referenced by generated::getRenderableModule().
|
noexcept |
|
noexcept |
|
noexcept |
Gets the textures.
Referenced by generated::getRenderableModule().
|
overridevirtualnoexcept |
Gets the value for sorting.
Implements Component.
Reimplemented in Graphics::UI::Element.
References Component::getTransform().
|
noexcept |
Gets the vertex array binding.
|
noexcept |
Gets the vertex data.
|
overridevirtual |
HandleQueuedEvent allows derived classes to define behaviour for when queuedEvents are received.
[in] | event | The event |
Reimplemented from Component.
Reimplemented in Graphics::UI::Element, Graphics::UI::TextArea, Graphics::UI::TextField, Graphics::UI::Area, and Graphics::UI::Button.
References Events::ADD_TEXTURE, Component::handleQueuedEvent(), Events::REMOVE_TEXTURE, Events::SET_SHADER, Events::SET_UNIFORM, and setUniform().
Referenced by Graphics::UI::Element::handleQueuedEvent(), and onNotifyNow().
|
noexcept |
The highest possible z value in the renderable.
References Graphics::VertexData::highestZ().
Referenced by to_string().
|
noexcept |
Determines if light reactive.
Referenced by generated::getRenderableModule().
|
overridevirtual |
Reimplemented from Component.
Reimplemented in Graphics::UI::Element, Graphics::UI::TextArea, Graphics::UI::TextField, Graphics::UI::Area, and Graphics::UI::Button.
References to_string().
|
overridevirtual |
Called when the engine is shutting down.
Implements Component.
Reimplemented in Graphics::UI::Element, Graphics::UI::TextField, Graphics::UI::TextArea, and Graphics::UI::Area.
Referenced by ~Renderable().
|
overridevirtual |
When receiving an event that is immediate, onNotifyNow is used. It acts as an interrupt to make sure the object is notified before another engine loop. This is pure virtual and is implemented on a case by case basis in derived classes.
[in] | event | The event |
Reimplemented from Component.
Reimplemented in Graphics::UI::Element, Graphics::UI::TextArea, Graphics::UI::TextField, Graphics::UI::Area, and Graphics::UI::Button.
References handleQueuedEvent().
|
overridevirtual |
Called when the engine starts and when a new scene is loaded.
Implements Component.
Reimplemented in Graphics::UI::Element, Graphics::UI::TextField, Graphics::UI::TextArea, and Graphics::UI::Area.
References Graphics::Uniform::setData(), and setUniform().
|
overridevirtual |
Called every engine loop.
[in] | delta | The delta |
Implements Component.
Reimplemented in Graphics::UI::Element, Graphics::UI::TextField, Graphics::UI::TextArea, and Graphics::UI::Area.
References Graphics::VertexData::getIndexCount(), Component::getTransform(), Graphics::VertexData::getVertexCount(), Component::isActive(), Graphics::Uniform::setData(), and setUniform().
Referenced by Graphics::UI::Element::onUpdate().
|
delete |
Renderable & Graphics::Renderable::operator= | ( | Renderable && | renderable | ) |
void Graphics::Renderable::removeTexture | ( | const unsigned int | unit | ) |
|
noexcept |
Sets the ambient intensity.
[in] | intensity | The intensity |
Referenced by generated::getRenderableModule().
|
noexcept |
Sets the ambient light.
[in] | color | The color |
Referenced by generated::getRenderableModule().
|
noexcept |
Sets if the renderable should be light reactive.
[in] | reactive | True if reactive |
Referenced by generated::getRenderableModule().
|
noexcept |
Sets the shader.
[in] | shader_object | The shader object |
Referenced by Graphics::UI::Element::Element(), and generated::getRenderableModule().
|
protectednoexcept |
Referenced by handleQueuedEvent(), onStart(), onUpdate(), and Graphics::UI::Element::setAnchorPoint().
|
overridevirtualnoexcept |
Returns a string representation of the object.
Reimplemented from Component.
Reimplemented in Graphics::UI::Element, Graphics::UI::TextArea, Graphics::UI::TextField, and Graphics::UI::Area.
References highestZ(), and Component::to_string().
Referenced by generated::getRenderableModule(), log(), and Graphics::UI::Element::to_string().
|
protected |