//////////////////////////////////////////////////////////////////////////////////
// SPARK particle engine //
// Copyright (C) 2008-2009 - Julien Fryer - julienfryer@gmail.com //
// //
// This software is provided 'as-is', without any express or implied //
// warranty. In no event will the authors be held liable for any damages //
// arising from the use of this software. //
// //
// Permission is granted to anyone to use this software for any purpose, //
// including commercial applications, and to alter it and redistribute it //
// freely, subject to the following restrictions: //
// //
// 1. The origin of this software must not be misrepresented; you must not //
// claim that you wrote the original software. If you use this software //
// in a product, an acknowledgment in the product documentation would be //
// appreciated but is not required. //
// 2. Altered source versions must be plainly marked as such, and must not be //
// misrepresented as being the original software. //
// 3. This notice may not be removed or altered from any source distribution. //
//////////////////////////////////////////////////////////////////////////////////
#ifndef H_SPK_QUADRENDERERINTERFACE
#define H_SPK_QUADRENDERERINTERFACE
#include "Core/SPK_DEF.h"
#include "Core/SPK_Particle.h"
namespace SPK
{
/**
* @enum TexturingMode
* @brief Constants defining the way to apply texture over the particles
* @since 1.02.00
*/
enum TexturingMode
{
TEXTURE_NONE, /**< Constant telling no texturing is used */
TEXTURE_2D, /**< Constant telling a 2D texture is used */
TEXTURE_3D, /**< Constant telling a 3D texture is used */
};
/**
* @brief Base Interface for rendering particles with quads
* @since 1.04.00
*/
class SPK_PREFIX QuadRendererInterface
{
public :
//////////////////
// Constructors //
//////////////////
/**
* @brief Constructor of QuadRendererInterface
* @param scaleX the scale of the width of the quad
* @param scaleY the scale of the height of the quad
*/
QuadRendererInterface(float scaleX = 1.0f,float scaleY = 1.0f);
////////////////
// Destructor //
////////////////
/** @brief Destructor of QuadRendererInterface */
virtual inline ~QuadRendererInterface() {}
/////////////
// Setters //
/////////////
/**
* @brief Sets the texturing mode for this GLQuadRenderer
*
* The texturing mode defines whether or not to apply a texture
* and if so which type of texture to apply (2D,3D or atlas).
*
* Note that the validity of the texturing mode depends on the rendering API below.
* The method returns true if the rendering mode can be set, false if it cannot
*
* @param mode : the texturing mode of this GLQuadRenderer
* @return true if the rendering mode can be set, false if it cannot
*/
virtual inline bool setTexturingMode(TexturingMode mode);
/**
* @brief Sets the cut of the texture
*
* This is available only if SPK::PARAM_TEXTURE_INDEX is enabled and texturing mode is TEXTURE_2D.
*
* Particles can be rendered only with a part of the texture depending on their texture index value.
* The cut can only be constant.
* The user defines in how many parts the texture must be divided in X and Y.
* The first index is located at the top left cut, the it goes from left to right and from top to bottom.
*
* For instance a cut with nbX = 3 and nbY = 2 will be as followed :
*
* -------------
* | 0 | 1 | 2 |
* -------------
* | 3 | 4 | 5 |
* -------------
*
* By default nbX and nbY are equal to 1.
*
* @param nbX : the number of cuts in the X axis
* @param nbY : the number of cuts in the Y axis
*/
void setAtlasDimensions(size_t nbX,size_t nbY);
/**
* @brief Sets the size ratio of this GLQuadRenderer
*
* These values defines how quads are scaled.
* The height and width of a quad in the universe is defined as followed :
*