SFMLRenderer Class Reference

An abstract Renderer for the SFML renderers. More...

Inheritance diagram for SFMLRenderer:
Renderer Registerable BufferHandler SFMLDrawableRenderer SFMLLineRenderer SFMLPointRenderer SFMLQuadRenderer

List of all members.

Public Member Functions

 SFMLRenderer ()
 Default constructor of SFMLRenderer.
virtual ~SFMLRenderer ()
 Destructor of SFMLRenderer.
void setBlendMode (sf::Blend::Mode mode)
 Sets the blend mode of this SFMLRenderer.
virtual void setBlending (BlendingMode blendMode)
 Sets the blending mode of this renderer.
void setGroundCulling (bool cull)
 Sets whether the ground culling is enabled or not.
sf::Blend::Mode getBlendMode () const
 Gets the blend mode of this SFMLRenderer.
bool hasGroundCulling () const
 Tells whether the ground culling is enabled or not.
void render (const Group &group)
 Renders a Group of particles.

Static Public Member Functions

static void setZFactor (float zFactor)
 Sets the Z factor.
static float getZFactor ()
 Gets the Z factor.
static void bindCurrentTarget (sf::RenderTarget &target)
 Binds a RenderTarget for rendering.
static void releaseCurrentTarget ()
 Releases the current RenderTarget.
static void bindCurrentSystem (const SFMLSystem &system)
 Binds an SFMLSystem for rendering.
static void releaseCurrentSystem ()
 Releases the current SFMLSystem.

Static Protected Member Functions

static sf::RenderTarget * getCurrentTarget ()
 Gets the current RenderTarget.
static float getViewZoom (ResizeMode mode)
 Gets the scale factor function of the current zoom and resize mode.

Detailed Description

An abstract Renderer for the SFML renderers.

All children of this renderer are meant to be used with the 2D engine of the SFML library.

As the rendering occurs in 2D the X and Y axis are the screen axis and the Z coordinate is subtracted to the Y coordinate to have classical 2D height effect.
The factor of Z to subtract to the Y can be adjusted with a call to the static method setZFactor(float). If the factor is 0, the Z coordinate is ignored.
Moreover, particles with a negative Z are not rendered as they are considered to be under the other 2D elements.
In the SFML library, a RenderTarget must be used for rendering. This RenderTarget can be set with a call to bindRenderTarget(const sf::RenderTarget&) and released with a call to releaseRenderTarget().
A call to render(const Group&) of a SFMLRenderer will not render anything if a RenderTarget is not set.
However using SFMLSystem to render particles with SFML will bind the target internally, freeing the user from setting it manually.

Since:
1.01.00

Definition at line 67 of file SPK_SFMLRenderer.h.


Constructor & Destructor Documentation

SFMLRenderer (  ) 

Default constructor of SFMLRenderer.

virtual ~SFMLRenderer (  )  [virtual]

Destructor of SFMLRenderer.


Member Function Documentation

static void bindCurrentSystem ( const SFMLSystem system  )  [static]

Binds an SFMLSystem for rendering.

This method is used internally to tell the engine which SFMLSystem is currently being rendered.

Parameters:
system : The SFMLSystem that is currently being rendered
Since:
1.03.01
Deprecated:
1.05.05 Does nothing

Definition at line 184 of file SPK_SFMLRenderer.h.

static void bindCurrentTarget ( sf::RenderTarget &  target  )  [static]

Binds a RenderTarget for rendering.

A RenderTarget is compulsory to render with SFML.
Rendering with SFMLSystem calls this method internally.

Parameters:
target : the SFML RenderTarget to bind
sf::Blend::Mode getBlendMode (  )  const

Gets the blend mode of this SFMLRenderer.

Returns:
the blend mode of this SFMLRenderer in SFML style

Definition at line 245 of file SPK_SFMLRenderer.h.

static sf::RenderTarget* getCurrentTarget (  )  [static, protected]

Gets the current RenderTarget.

Returns:
the current RenderTarget or NULL if no RenderTarget is attached.
static float getViewZoom ( ResizeMode  mode  )  [static, protected]

Gets the scale factor function of the current zoom and resize mode.

Parameters:
mode : the resize mode used to compute the factor
static float getZFactor (  )  [static]

Gets the Z factor.

see setZFactor(float) for more details about Z factor

Returns:
the Z factor
bool hasGroundCulling (  )  const

Tells whether the ground culling is enabled or not.

For more information about ground culling see setGroundCulling(bool).

Returns:
true if the ground culling is enabled, false if it is disabled
Since:
1.03.00

Definition at line 250 of file SPK_SFMLRenderer.h.

static void releaseCurrentSystem (  )  [static]

Releases the current SFMLSystem.

This method sets internally the SFMLSystem being rendered to NULL

Since:
1.03.01
Deprecated:
1.05.05 Does nothing

Definition at line 194 of file SPK_SFMLRenderer.h.

static void releaseCurrentTarget (  )  [static]

Releases the current RenderTarget.

This method only sets the inner pointer to NULL.

void render ( const Group group  )  [virtual]

Renders a Group of particles.

Parameters:
group : the Group to render

Implements Renderer.

virtual void setBlending ( BlendingMode  blendMode  )  [virtual]

Sets the blending mode of this renderer.

This is a generic method that allows to set most common blending modes in a generic way. However renderers can implement method to give more control over the blending mode used.

Parameters:
blendMode : the blending mode to use
Since:
1.04.00

Implements Renderer.

void setBlendMode ( sf::Blend::Mode  mode  ) 

Sets the blend mode of this SFMLRenderer.

Parameters:
mode : the blend mode of this SFMLRenderer in SFML style

Definition at line 235 of file SPK_SFMLRenderer.h.

void setGroundCulling ( bool  cull  ) 

Sets whether the ground culling is enabled or not.

If it is enabled, all particles with and altitude (z coordinate) lower than zero will not be rendered.
This allows to simulate the activation of the zbuffer with the ground.

Parameters:
cull : true to enable the ground culling, false to disable it
Since:
1.03.00

Definition at line 240 of file SPK_SFMLRenderer.h.

static void setZFactor ( float  zFactor  )  [static]

Sets the Z factor.

The Z factor is the constant that will multiply the Z coordinate of a Particle position before being subtracted to the Y coordinate.
Note that the Z factor is static and in that way identical for all SFMLRenderers.

Parameters:
zFactor : the Z factor

Generated on Wed Apr 27 21:09:27 2011 for SPARK Particle Engine by  doxygen 1.6.1