xyginext  0.2.0
Second generation of xygine game creation framework
Public Member Functions | List of all members
xy::RenderSystem Class Referencefinal

Used to draw all entities which have a Drawable and Transform component. The RenderSystem is used to depth sort and draw all entities which have a Drawable and Transform component attached, and optionally a Sprite component. NOTE multiple components which rely on a Drawable component cannot exist on the same entity, as only one set of vertices will be available. More...

#include <RenderSystem.hpp>

Inheritance diagram for xy::RenderSystem:
xy::System

Public Member Functions

 RenderSystem (xy::MessageBus &)
 
void process (float) override
 Implement this for system specific processing to entities.
 
void setCullingBorder (float size)
 Adds a border around the current view when culling. This is used to increase the effectively culled area when the system is drawn. By default drawables outside the view of the currently active camera are culled from rendering, this value adds a border around the viewble area, increasing or decreasing the size of the area from which drawables are culled. More...
 
void setFilterFlags (std::uint64_t flags)
 Sets the filter flags which decide which drawables are rendered. Setting this value to anything other than 0 will render all drawables which have their matching flag set. As drawables by default are set to uint64::max they will ALWAYS be drawn when this is non-zero value. Flags must be set on both drawable components and the RenderSystem for the filter to work. For example light emitting enitities can be rendered to a separate buffer by setting the component flag to 0x1 (first bit) then setting this filter to the same value. Returning it to uint64::max (all flags set) will once again render all drawable with a non-zero bitmask. Generally this is not used unless you have a specific multipass effect in mind.
 
std::uint64_t getFilterFlags () const
 
- Public Member Functions inherited from xy::System
 System (MessageBus &mb, UniqueType t)
 Constructor. Pass in a reference to the concrete implementation to generate a unique type ID for this system.
 
UniqueType getType () const
 Returns the unique type ID of the system.
 
const std::vector< Entity > & getEntities () const
 Returns a list of entities that this system is currently interested in.
 
void addEntity (Entity)
 Adds an entity to the list to process.
 
void removeEntity (Entity)
 Removes an entity from the list to process.
 
const ComponentMask & getComponentMask () const
 Returns the component mask used to mask entities with corresponding components for this system to process.
 
virtual void handleMessage (const Message &)
 Used to process any incoming system messages.
 
bool isActive () const
 Returns true if the system is currently active. Systems can be activeated and deactivated with Scene::setSystemActive()
 
template<typename T >
void requireComponent ()
 
template<typename T >
T * postMessage (Message::ID id)
 

Additional Inherited Members

- Public Types inherited from xy::System
using Ptr = std::unique_ptr< System >
 
- Protected Member Functions inherited from xy::System
template<typename T >
void requireComponent ()
 Adds a component type to the list of components required by the system for it to be interested in a particular entity. This should only be used in the constructor of the System else types will not be registered.
 
std::vector< Entity > & getEntities ()
 
virtual void onEntityRemoved (Entity)
 Optional callback performed when an entity is removed.
 
template<typename T >
T * postMessage (Message::ID id)
 Posts a message on the system wide message bus.
 
MessageBusgetMessageBus ()
 Returns a reference to the MessageBus.
 
void setScene (Scene &)
 
ScenegetScene ()
 Returns a pointer to the scene to which this system belongs.
 

Detailed Description

Used to draw all entities which have a Drawable and Transform component. The RenderSystem is used to depth sort and draw all entities which have a Drawable and Transform component attached, and optionally a Sprite component. NOTE multiple components which rely on a Drawable component cannot exist on the same entity, as only one set of vertices will be available.

Member Function Documentation

◆ getFilterFlags()

std::uint64_t xy::RenderSystem::getFilterFlags ( ) const
inline

\breif Returns the current filter flags.

See also
setFilterFlags

◆ setCullingBorder()

void xy::RenderSystem::setCullingBorder ( float  size)

Adds a border around the current view when culling. This is used to increase the effectively culled area when the system is drawn. By default drawables outside the view of the currently active camera are culled from rendering, this value adds a border around the viewble area, increasing or decreasing the size of the area from which drawables are culled.

Parameters
sizeThe size of the border. This is a positive or negative value added to every side of the active view. Negative values will decrease the size of the culling area making drawables visibly culled from the output.