A Renderer drawing particles as points for the SFML 2D rendering engine. More...
Public Member Functions | |
SFMLPointRenderer (float size=1.0f, ResizeMode mode=RESIZE_NONE) | |
Constructor of SFMLPointRenderer. | |
bool | setType (PointType type) |
Sets the type of points to use in this PointRendererInterface. | |
void | setImage (sf::Image *image) |
Sets the image of this SFMLPointRenderer. | |
void | setResizeMode (ResizeMode mode) |
Sets the resize mode of this SFMLPointRenderer. | |
sf::Image * | getImage () const |
Gets the texture of this SFMLPointRenderer. | |
ResizeMode | getResizeMode () const |
Gets the resize mode of this SFMLPointRenderer. | |
virtual void | createBuffers (const Group &group) |
Creates the buffers for this buffer handler in the given group. | |
virtual void | destroyBuffers (const Group &group) |
Destroys the buffers for this buffer handler in the given group. | |
Static Public Member Functions | |
static SFMLPointRenderer * | create (float size=1.0f, ResizeMode mode=RESIZE_NONE) |
Creates and registers a new SFMLPointRenderer. | |
Protected Member Functions | |
virtual bool | checkBuffers (const Group &group) |
checks the buffers and prepare them |
A Renderer drawing particles as points for the SFML 2D rendering engine.
points can be configured to render them in 3 different ways :
Points size can be updated in function of the zoom of the SFML view using ResizeMode (either SPK_SFML::RESIZE_ZOOM_X or SPK_SFML::RESIZE_ZOOM_Y)
The zoom is constraints by the minimum and maximum dimensions of the point size (being generally 1.0f and 64.0f).
However on hardware that supports the openGL extension point parameter counteracts these limitations. The extension is automatically loaded if possible.
User can check whether the extension is available by calling SPK::GL::GLExtHandler::loadGLExtPointParameter()
Below are the parameters of Particle that are used in this Renderer (others have no effects) :
Definition at line 62 of file SPK_SFMLPointRenderer.h.
SFMLPointRenderer | ( | float | size = 1.0f , |
|
ResizeMode | mode = RESIZE_NONE | |||
) |
Constructor of SFMLPointRenderer.
size | : the size of this SFMLPointRenderer | |
mode | : the resize mode of this SFMLPointRenderer |
virtual bool checkBuffers | ( | const Group & | group | ) | [protected, virtual] |
checks the buffers and prepare them
This method has to be implemented in derived class that uses buffers.
true must be returned if the buffers are found and initialized, false otherwise.
group | : the group in which to check the buffers |
Reimplemented from BufferHandler.
SFMLPointRenderer * create | ( | float | size = 1.0f , |
|
ResizeMode | mode = RESIZE_NONE | |||
) | [static] |
Creates and registers a new SFMLPointRenderer.
size | : the size of this SFMLPointRenderer | |
mode | : the resize mode of this SFMLPointRenderer |
Definition at line 154 of file SPK_SFMLPointRenderer.h.
virtual void createBuffers | ( | const Group & | group | ) | [virtual] |
Creates the buffers for this buffer handler in the given group.
If the buffers for this type of buffer handler already exists within the Group, they are priorly destroyed.
The type of buffers created depends on the state of the buffer handler at the time this method is called.
This method has to be overridden in derived classes that use buffers
group | : the Group in which to create the buffers for this buffer handler |
Reimplemented from BufferHandler.
virtual void destroyBuffers | ( | const Group & | group | ) | [virtual] |
Destroys the buffers for this buffer handler in the given group.
if the buffers dont exist, nothing happens.
This method has to be overridden in derived classes that use buffers
group | : the Group in which to destroy the buffers for this buffer handler |
Reimplemented from BufferHandler.
sf::Image * getImage | ( | ) | const |
Gets the texture of this SFMLPointRenderer.
Definition at line 171 of file SPK_SFMLPointRenderer.h.
ResizeMode getResizeMode | ( | ) | const |
Gets the resize mode of this SFMLPointRenderer.
Definition at line 176 of file SPK_SFMLPointRenderer.h.
void setImage | ( | sf::Image * | image | ) |
Sets the image of this SFMLPointRenderer.
Note that the image is only used if point sprites are used (type is set to SPK::POINT_SPRITE)
image | : the index of the SFML Image of this SFMLPointRenderer |
Definition at line 161 of file SPK_SFMLPointRenderer.h.
void setResizeMode | ( | ResizeMode | mode | ) |
Sets the resize mode of this SFMLPointRenderer.
mode | : the resize mode of this SFMLPointRenderer |
Definition at line 166 of file SPK_SFMLPointRenderer.h.
bool setType | ( | PointType | type | ) | [virtual] |
Sets the type of points to use in this PointRendererInterface.
If the type is not supported by the platform, false is returned and the type per default is set.
type | : the type of points to use in this PointRendererInterface |
Reimplemented from PointRendererInterface.