2012-04-19 14:35:52 +08:00
|
|
|
/****************************************************************************
|
2012-06-14 15:13:16 +08:00
|
|
|
Copyright (c) 2010-2012 cocos2d-x.org
|
2012-04-19 14:35:52 +08:00
|
|
|
Copyright (c) 2009 On-Core
|
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef __ACTION_CCGRID3D_ACTION_H__
|
|
|
|
#define __ACTION_CCGRID3D_ACTION_H__
|
|
|
|
|
|
|
|
#include "CCActionGrid.h"
|
|
|
|
|
|
|
|
NS_CC_BEGIN
|
2012-06-20 18:09:11 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup actions
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/**
|
2013-06-20 14:13:12 +08:00
|
|
|
@brief Waves3D action
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL Waves3D : public Grid3DAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-07-07 13:01:21 +08:00
|
|
|
inline float getAmplitude(void) const { return _amplitude; }
|
2013-06-15 14:03:30 +08:00
|
|
|
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-07 13:01:21 +08:00
|
|
|
inline float getAmplitudeRate(void) const { return _amplitudeRate; }
|
2013-06-15 14:03:30 +08:00
|
|
|
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-12-26 18:59:31 +08:00
|
|
|
/** initializes an action with duration, grid size, waves and amplitude */
|
2013-06-20 14:13:12 +08:00
|
|
|
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-16 03:38:32 +08:00
|
|
|
/** returns a new clone of the action */
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual Waves3D* clone() const;
|
2013-06-16 03:38:32 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual Object* copyWithZone(Zone* pZone);
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
2012-12-26 18:59:31 +08:00
|
|
|
/** creates an action with duration, grid size, waves and amplitude */
|
2013-06-20 14:13:12 +08:00
|
|
|
static Waves3D* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
unsigned int _waves;
|
|
|
|
float _amplitude;
|
|
|
|
float _amplitudeRate;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief FlipX3D action */
|
|
|
|
class CC_DLL FlipX3D : public Grid3DAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** initializes the action with duration */
|
2012-12-26 18:59:31 +08:00
|
|
|
virtual bool initWithDuration(float duration);
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual bool initWithSize(const Size& gridSize, float duration);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
|
|
|
/** returns a new clone of the action */
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual FlipX3D* clone() const;
|
2013-06-16 03:38:32 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual Object* copyWithZone(Zone* pZone);
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
/** creates the action with duration */
|
2013-06-20 14:13:12 +08:00
|
|
|
static FlipX3D* create(float duration);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief FlipY3D action */
|
|
|
|
class CC_DLL FlipY3D : public FlipX3D
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual Object* copyWithZone(Zone* pZone);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
/** creates the action with duration */
|
2013-06-20 14:13:12 +08:00
|
|
|
static FlipY3D* create(float duration);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief Lens3D action */
|
|
|
|
class CC_DLL Lens3D : public Grid3DAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** Get lens center position */
|
2013-07-07 13:01:21 +08:00
|
|
|
inline float getLensEffect(void) const { return _lensEffect; }
|
2012-04-19 14:35:52 +08:00
|
|
|
/** Set lens center position */
|
2013-06-15 14:03:30 +08:00
|
|
|
inline void setLensEffect(float fLensEffect) { _lensEffect = fLensEffect; }
|
2013-02-16 11:12:12 +08:00
|
|
|
/** Set whether lens is concave */
|
2013-06-15 14:03:30 +08:00
|
|
|
inline void setConcave(bool bConcave) { _concave = bConcave; }
|
2013-02-16 11:12:12 +08:00
|
|
|
|
2013-07-07 13:01:21 +08:00
|
|
|
inline const Point& getPosition(void) const { return _position; }
|
2013-06-20 14:13:12 +08:00
|
|
|
void setPosition(const Point& position);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** initializes the action with center position, radius, a grid size and duration */
|
2013-06-20 14:13:12 +08:00
|
|
|
bool initWithDuration(float duration, const Size& gridSize, const Point& position, float radius);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
|
|
|
/** returns a new clone of the action */
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual Lens3D* clone() const;
|
2013-06-16 03:38:32 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual Object* copyWithZone(Zone* pZone);
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
/** creates the action with center position, radius, a grid size and duration */
|
2013-06-20 14:13:12 +08:00
|
|
|
static Lens3D* create(float duration, const Size& gridSize, const Point& position, float radius);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
|
|
|
/* lens center position */
|
2013-06-20 14:13:12 +08:00
|
|
|
Point _position;
|
2013-06-15 14:03:30 +08:00
|
|
|
float _radius;
|
2012-04-19 14:35:52 +08:00
|
|
|
/** lens effect. Defaults to 0.7 - 0 means no effect, 1 is very strong effect */
|
2013-06-15 14:03:30 +08:00
|
|
|
float _lensEffect;
|
2013-02-16 11:12:12 +08:00
|
|
|
/** lens is concave. (true = concave, false = convex) default is convex i.e. false */
|
2013-06-15 14:03:30 +08:00
|
|
|
bool _concave;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
bool _dirty;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief Ripple3D action */
|
|
|
|
class CC_DLL Ripple3D : public Grid3DAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** get center position */
|
2013-07-07 13:01:21 +08:00
|
|
|
inline const Point& getPosition(void) const { return _position; }
|
2012-04-19 14:35:52 +08:00
|
|
|
/** set center position */
|
2013-06-20 14:13:12 +08:00
|
|
|
void setPosition(const Point& position);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-07 13:01:21 +08:00
|
|
|
inline float getAmplitude(void) const { return _amplitude; }
|
2013-06-15 14:03:30 +08:00
|
|
|
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-07 13:01:21 +08:00
|
|
|
inline float getAmplitudeRate(void) const { return _amplitudeRate; }
|
2013-06-15 14:03:30 +08:00
|
|
|
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** initializes the action with radius, number of waves, amplitude, a grid size and duration */
|
2013-06-20 14:13:12 +08:00
|
|
|
bool initWithDuration(float duration, const Size& gridSize, const Point& position, float radius, unsigned int waves, float amplitude);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
|
|
|
/** returns a new clone of the action */
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual Ripple3D* clone() const;
|
2013-06-16 03:38:32 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual Object* copyWithZone(Zone* pZone);
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
/** creates the action with radius, number of waves, amplitude, a grid size and duration */
|
2013-06-20 14:13:12 +08:00
|
|
|
static Ripple3D* create(float duration, const Size& gridSize, const Point& position, float radius, unsigned int waves, float amplitude);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
|
|
|
/* center position */
|
2013-06-20 14:13:12 +08:00
|
|
|
Point _position;
|
2013-06-15 14:03:30 +08:00
|
|
|
float _radius;
|
|
|
|
unsigned int _waves;
|
|
|
|
float _amplitude;
|
|
|
|
float _amplitudeRate;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief Shaky3D action */
|
|
|
|
class CC_DLL Shaky3D : public Grid3DAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** initializes the action with a range, shake Z vertices, a grid and duration */
|
2013-06-20 14:13:12 +08:00
|
|
|
bool initWithDuration(float duration, const Size& gridSize, int range, bool shakeZ);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
|
|
|
/** returns a new clone of the action */
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual Shaky3D* clone() const;
|
2013-06-16 03:38:32 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual Object* copyWithZone(Zone* pZone);
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
/** creates the action with a range, shake Z vertices, a grid and duration */
|
2013-06-20 14:13:12 +08:00
|
|
|
static Shaky3D* create(float duration, const Size& gridSize, int range, bool shakeZ);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
int _randrange;
|
|
|
|
bool _shakeZ;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief Liquid action */
|
|
|
|
class CC_DLL Liquid : public Grid3DAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-07-07 13:01:21 +08:00
|
|
|
inline float getAmplitude(void) const { return _amplitude; }
|
2013-06-15 14:03:30 +08:00
|
|
|
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-07 13:01:21 +08:00
|
|
|
inline float getAmplitudeRate(void) const { return _amplitudeRate; }
|
2013-06-15 14:03:30 +08:00
|
|
|
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** initializes the action with amplitude, a grid and duration */
|
2013-06-20 14:13:12 +08:00
|
|
|
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
|
|
|
/** returns a new clone of the action */
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual Liquid* clone() const;
|
2013-06-16 03:38:32 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual Object* copyWithZone(Zone* pZone);
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
/** creates the action with amplitude, a grid and duration */
|
2013-06-20 14:13:12 +08:00
|
|
|
static Liquid* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
unsigned int _waves;
|
|
|
|
float _amplitude;
|
|
|
|
float _amplitudeRate;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief Waves action */
|
|
|
|
class CC_DLL Waves : public Grid3DAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-07-07 13:01:21 +08:00
|
|
|
inline float getAmplitude(void) const { return _amplitude; }
|
2013-06-15 14:03:30 +08:00
|
|
|
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-07 13:01:21 +08:00
|
|
|
inline float getAmplitudeRate(void) const { return _amplitudeRate; }
|
2013-06-15 14:03:30 +08:00
|
|
|
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
|
2013-06-20 14:13:12 +08:00
|
|
|
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
|
|
|
/** returns a new clone of the action */
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual Waves* clone() const;
|
2013-06-16 03:38:32 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual Object* copyWithZone(Zone* pZone);
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
|
2013-06-20 14:13:12 +08:00
|
|
|
static Waves* create(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
unsigned int _waves;
|
|
|
|
float _amplitude;
|
|
|
|
float _amplitudeRate;
|
|
|
|
bool _vertical;
|
|
|
|
bool _horizontal;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief Twirl action */
|
|
|
|
class CC_DLL Twirl : public Grid3DAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** get twirl center */
|
2013-07-07 13:01:21 +08:00
|
|
|
inline const Point& getPosition(void) const { return _position; }
|
2012-04-19 14:35:52 +08:00
|
|
|
/** set twirl center */
|
2013-06-20 14:13:12 +08:00
|
|
|
void setPosition(const Point& position);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-07 13:01:21 +08:00
|
|
|
inline float getAmplitude(void) const { return _amplitude; }
|
2013-06-15 14:03:30 +08:00
|
|
|
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-07 13:01:21 +08:00
|
|
|
inline float getAmplitudeRate(void) const { return _amplitudeRate; }
|
2013-06-15 14:03:30 +08:00
|
|
|
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** initializes the action with center position, number of twirls, amplitude, a grid size and duration */
|
2013-06-20 14:13:12 +08:00
|
|
|
bool initWithDuration(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
|
|
|
/** returns a new clone of the action */
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual Twirl* clone() const;
|
2013-06-16 03:38:32 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual Object* copyWithZone(Zone* pZone);
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
/** creates the action with center position, number of twirls, amplitude, a grid size and duration */
|
2013-06-20 14:13:12 +08:00
|
|
|
static Twirl* create(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
|
|
|
/* twirl center */
|
2013-06-20 14:13:12 +08:00
|
|
|
Point _position;
|
2013-06-15 14:03:30 +08:00
|
|
|
unsigned int _twirls;
|
|
|
|
float _amplitude;
|
|
|
|
float _amplitudeRate;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
// end of actions group
|
|
|
|
/// @}
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
NS_CC_END
|
|
|
|
|
|
|
|
#endif // __ACTION_CCGRID3D_ACTION_H__
|