2012-04-19 14:35:52 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2009 On-Core
|
2014-01-07 11:25:07 +08:00
|
|
|
Copyright (c) 2010-2012 cocos2d-x.org
|
2018-01-29 16:25:32 +08:00
|
|
|
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
|
|
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
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__
|
|
|
|
|
2014-04-27 01:11:22 +08:00
|
|
|
#include "2d/CCActionGrid.h"
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
NS_CC_BEGIN
|
2012-06-20 18:09:11 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup actions
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
/**
|
2015-03-18 18:15:34 +08:00
|
|
|
@brief Waves3D action.
|
2015-03-19 15:59:58 +08:00
|
|
|
@details This action is used for take effect on the target node as 3D waves.
|
2015-03-18 18:15:34 +08:00
|
|
|
You can control the effect by these parameters:
|
|
|
|
duration, grid size, waves count, amplitude.
|
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:
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Create an action with duration, grid size, waves and amplitude.
|
|
|
|
@param duration Specify the duration of the Waves3D action. It's a value in seconds.
|
|
|
|
@param gridSize Specify the size of the grid.
|
|
|
|
@param waves Specify the waves count of the Waves3D action.
|
|
|
|
@param amplitude Specify the amplitude of the Waves3D action.
|
2015-09-22 16:08:23 +08:00
|
|
|
@return If the creation success, return a pointer of Waves3D action; otherwise, return nil.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2021-10-23 23:27:14 +08:00
|
|
|
static Waves3D* create(float duration, const Vec2& gridSize, unsigned int waves, float amplitude);
|
2013-07-18 07:56:19 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Get the amplitude of the effect.
|
|
|
|
@return Return the amplitude of the effect.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
float getAmplitude() const { return _amplitude; }
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Set the amplitude to the effect.
|
|
|
|
@param amplitude The value of amplitude will be set.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setAmplitude(float amplitude) { _amplitude = amplitude; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Get the amplitude rate of the effect.
|
|
|
|
@return Return the amplitude rate of the effect.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
float getAmplitudeRate() const { return _amplitudeRate; }
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
2015-09-22 16:08:23 +08:00
|
|
|
@brief Set the amplitude rate of the effect.
|
2015-03-18 18:15:34 +08:00
|
|
|
@param amplitudeRate The value of amplitude rate will be set.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2016-04-08 13:40:36 +08:00
|
|
|
// Overrides
|
|
|
|
virtual Waves3D* clone() const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void update(float time) override;
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS : Waves3D() {}
|
2013-11-23 07:07:58 +08:00
|
|
|
virtual ~Waves3D() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
/**
|
2015-03-18 18:15:34 +08:00
|
|
|
@brief Initializes an action with duration, grid size, waves and amplitude.
|
|
|
|
@param duration Specify the duration of the Waves3D action. It's a value in seconds.
|
|
|
|
@param gridSize Specify the size of the grid.
|
|
|
|
@param waves Specify the waves count of the Waves3D action.
|
|
|
|
@param amplitude Specify the amplitude of the Waves3D action.
|
|
|
|
@return If the initialization success, return true; otherwise, return false.
|
|
|
|
*/
|
2021-10-23 23:27:14 +08:00
|
|
|
bool initWithDuration(float duration, const Vec2& gridSize, unsigned int waves, float amplitude);
|
2013-11-23 07:07:58 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
unsigned int _waves;
|
|
|
|
float _amplitude;
|
|
|
|
float _amplitudeRate;
|
2013-11-23 07:07:58 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(Waves3D);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief FlipX3D action.
|
2015-03-19 15:59:58 +08:00
|
|
|
@details This action is used for flipping the target node on the x axis.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL FlipX3D : public Grid3DAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Create the action with duration.
|
|
|
|
@param duration Specify the duration of the FilpX3D action. It's a value in seconds.
|
2015-09-22 16:08:23 +08:00
|
|
|
@return If the creation success, return a pointer of FilpX3D action; otherwise, return nil.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2013-07-18 07:56:19 +08:00
|
|
|
static FlipX3D* create(float duration);
|
|
|
|
|
2013-11-23 07:07:58 +08:00
|
|
|
// Override
|
2016-04-08 13:40:36 +08:00
|
|
|
virtual FlipX3D* clone() const override;
|
2013-11-23 07:07:58 +08:00
|
|
|
virtual void update(float time) override;
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS : FlipX3D() {}
|
2013-11-23 07:07:58 +08:00
|
|
|
virtual ~FlipX3D() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
/**
|
2015-03-18 18:15:34 +08:00
|
|
|
@brief Initializes an action with duration.
|
|
|
|
@param duration Specify the duration of the FlipX3D action. It's a value in seconds.
|
|
|
|
@return If the initialization success, return true; otherwise, return false.
|
|
|
|
*/
|
2013-07-17 16:25:13 +08:00
|
|
|
bool initWithDuration(float duration);
|
2015-03-18 18:15:34 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
/**
|
2015-03-18 18:15:34 +08:00
|
|
|
@brief Initializes an action with duration and grid size.
|
|
|
|
@param gridSize Specify the grid size of the FlipX3D action.
|
|
|
|
@param duration Specify the duration of the FlipX3D action. It's a value in seconds.
|
|
|
|
@return If the initialization success, return true; otherwise, return false.
|
|
|
|
*/
|
2021-10-23 23:27:14 +08:00
|
|
|
virtual bool initWithSize(const Vec2& gridSize, float duration);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
2013-11-23 07:07:58 +08:00
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(FlipX3D);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief FlipY3D action.
|
2015-03-19 15:59:58 +08:00
|
|
|
@details This action is used for flipping the target node on the y axis.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL FlipY3D : public FlipX3D
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Create the action with duration.
|
|
|
|
@param duration Specify the duration of the FlipY3D action. It's a value in seconds.
|
2015-09-22 16:08:23 +08:00
|
|
|
@return If the creation success, return a pointer of FlipY3D action; otherwise, return nil.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
static FlipY3D* create(float duration);
|
2013-07-18 07:56:19 +08:00
|
|
|
|
|
|
|
// Overrides
|
|
|
|
virtual void update(float time) override;
|
2016-04-08 13:40:36 +08:00
|
|
|
virtual FlipY3D* clone() const override;
|
2013-11-23 07:07:58 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
CC_CONSTRUCTOR_ACCESS : FlipY3D() {}
|
2014-02-20 10:53:49 +08:00
|
|
|
virtual ~FlipY3D() {}
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2013-11-23 07:07:58 +08:00
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(FlipY3D);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Lens3D action.
|
2015-03-19 15:59:58 +08:00
|
|
|
@details This action is used for take effect on the target node as lens.
|
2015-03-18 18:15:34 +08:00
|
|
|
You can create the action by these parameters:
|
|
|
|
duration, grid size, center position of lens, radius of lens.
|
|
|
|
Also you can change the lens effect value & whether effect is concave by the setter methods.
|
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL Lens3D : public Grid3DAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Create the action with center position, radius, a grid size and duration.
|
|
|
|
@param duration Specify the duration of the Lens3D action. It's a value in seconds.
|
|
|
|
@param gridSize Specify the size of the grid.
|
|
|
|
@param position Specify the center position of the lens.
|
|
|
|
@param radius Specify the radius of the lens.
|
2015-09-22 16:08:23 +08:00
|
|
|
@return If the creation success, return a pointer of Lens3D action; otherwise, return nil.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2021-10-23 23:27:14 +08:00
|
|
|
static Lens3D* create(float duration, const Vec2& gridSize, const Vec2& position, float radius);
|
2013-07-18 07:56:19 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Get the value of lens effect. Default value is 0.7.
|
|
|
|
@return The value of lens effect.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
float getLensEffect() const { return _lensEffect; }
|
2015-03-18 18:15:34 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
@brief Set the value of lens effect.
|
|
|
|
@param lensEffect The value of lens effect will be set.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setLensEffect(float lensEffect) { _lensEffect = lensEffect; }
|
2015-03-18 18:15:34 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
@brief Set whether lens is concave.
|
|
|
|
@param concave Whether lens is concave.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setConcave(bool concave) { _concave = concave; }
|
2015-03-18 18:15:34 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
@brief Get the center position of lens effect.
|
|
|
|
@return The center position of lens effect.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
const Vec2& getPosition() const { return _position; }
|
2015-03-18 18:15:34 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
@brief Set the center position of lens effect.
|
2015-03-27 10:17:33 +08:00
|
|
|
@param position The center position will be set.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
void setPosition(const Vec2& position);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-18 07:56:19 +08:00
|
|
|
// Overrides
|
2016-04-08 13:40:36 +08:00
|
|
|
virtual Lens3D* clone() const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void update(float time) override;
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS : Lens3D() {}
|
2013-11-23 07:07:58 +08:00
|
|
|
virtual ~Lens3D() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Initializes the action with center position, radius, grid size and duration.
|
|
|
|
@param duration Specify the duration of the Lens3D action. It's a value in seconds.
|
|
|
|
@param gridSize Specify the size of the grid.
|
|
|
|
@param position Specify the center position of the lens effect.
|
|
|
|
@param radius Specify the radius of the lens effect.
|
|
|
|
@return If the initialization success, return true; otherwise, return false.
|
|
|
|
*/
|
2021-10-23 23:27:14 +08:00
|
|
|
bool initWithDuration(float duration, const Vec2& gridSize, const Vec2& position, float radius);
|
2013-11-23 07:07:58 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2012-04-19 14:35:52 +08:00
|
|
|
/* lens center position */
|
2014-05-15 01:07:09 +08:00
|
|
|
Vec2 _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
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
bool _dirty;
|
2013-11-23 07:07:58 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(Lens3D);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Ripple3D action.
|
2015-03-19 15:59:58 +08:00
|
|
|
@details This action is used for take effect on the target node as ripple.
|
2015-03-18 18:15:34 +08:00
|
|
|
You can create the action by these parameters:
|
|
|
|
duration, grid size, center position of ripple,
|
|
|
|
radius of ripple, waves count, amplitude.
|
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL Ripple3D : public Grid3DAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Create the action with center position, radius, number of waves, amplitude, a grid size and duration.
|
|
|
|
@param duration Specify the duration of the Ripple3D action. It's a value in seconds.
|
|
|
|
@param gridSize Specify the size of the grid.
|
|
|
|
@param position Specify the center position of the ripple effect.
|
|
|
|
@param radius Specify the radius of the ripple effect.
|
|
|
|
@param waves Specify the waves count of the ripple effect.
|
|
|
|
@param amplitude Specify the amplitude of the ripple effect.
|
2015-09-22 16:08:23 +08:00
|
|
|
@return If the creation success, return a pointer of Ripple3D action; otherwise, return nil.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2021-12-25 10:04:45 +08:00
|
|
|
static Ripple3D* create(float duration,
|
|
|
|
const Vec2& gridSize,
|
|
|
|
const Vec2& position,
|
|
|
|
float radius,
|
|
|
|
unsigned int waves,
|
|
|
|
float amplitude);
|
2013-07-18 07:56:19 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Get the center position of ripple effect.
|
|
|
|
@return The center position of ripple effect.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
const Vec2& getPosition() const { return _position; }
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Set the center position of ripple effect.
|
|
|
|
@param position The center position of ripple effect will be set.
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
void setPosition(const Vec2& position);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Get the amplitude of ripple effect.
|
|
|
|
@return The amplitude of ripple effect.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
float getAmplitude() const { return _amplitude; }
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Set the amplitude of ripple effect.
|
|
|
|
@param fAmplitude The amplitude of ripple effect.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Get the amplitude rate of ripple effect.
|
|
|
|
@return The amplitude rate of ripple effect.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
float getAmplitudeRate() const { return _amplitudeRate; }
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Set the amplitude rate of ripple effect.
|
|
|
|
@param fAmplitudeRate The amplitude rate of ripple effect.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-18 07:56:19 +08:00
|
|
|
// Override
|
2016-04-08 13:40:36 +08:00
|
|
|
virtual Ripple3D* clone() const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void update(float time) override;
|
2013-06-16 03:38:32 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
CC_CONSTRUCTOR_ACCESS : Ripple3D() {}
|
2013-11-23 07:07:58 +08:00
|
|
|
virtual ~Ripple3D() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Initializes the action with center position, radius, number of waves, amplitude, a grid size and duration.
|
|
|
|
@param duration Specify the duration of the Ripple3D action. It's a value in seconds.
|
|
|
|
@param gridSize Specify the size of the grid.
|
|
|
|
@param position Specify the center position of the ripple effect.
|
|
|
|
@param radius Specify the radius of the ripple effect.
|
|
|
|
@param waves Specify the waves count of the ripple effect.
|
|
|
|
@param amplitude Specify the amplitude of the ripple effect.
|
|
|
|
@return If the initialization success, return true; otherwise, return false.
|
|
|
|
*/
|
2021-12-25 10:04:45 +08:00
|
|
|
bool initWithDuration(float duration,
|
|
|
|
const Vec2& gridSize,
|
|
|
|
const Vec2& position,
|
|
|
|
float radius,
|
|
|
|
unsigned int waves,
|
|
|
|
float amplitude);
|
2013-11-23 07:07:58 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2012-04-19 14:35:52 +08:00
|
|
|
/* center position */
|
2014-05-15 01:07:09 +08:00
|
|
|
Vec2 _position;
|
2013-06-15 14:03:30 +08:00
|
|
|
float _radius;
|
|
|
|
unsigned int _waves;
|
|
|
|
float _amplitude;
|
|
|
|
float _amplitudeRate;
|
2013-11-23 07:07:58 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(Ripple3D);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Shaky3D action.
|
2015-03-19 15:59:58 +08:00
|
|
|
@details This action is used for take effect on the target node as shaky.
|
2015-03-18 18:15:34 +08:00
|
|
|
You can create the action by these parameters:
|
|
|
|
duration, grid size, range, whether shake on the z axis.
|
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL Shaky3D : public Grid3DAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2021-12-25 10:04:45 +08:00
|
|
|
/**
|
2015-03-18 18:15:34 +08:00
|
|
|
@brief Create the action with a range, shake Z vertices, a grid and duration.
|
2015-03-27 10:17:33 +08:00
|
|
|
@param initWithDuration Specify the duration of the Shaky3D action. It's a value in seconds.
|
2015-03-18 18:15:34 +08:00
|
|
|
@param gridSize Specify the size of the grid.
|
|
|
|
@param range Specify the range of the shaky effect.
|
|
|
|
@param shakeZ Specify whether shake on the z axis.
|
2015-09-22 16:08:23 +08:00
|
|
|
@return If the creation success, return a pointer of Shaky3D action; otherwise, return nil.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2021-10-23 23:27:14 +08:00
|
|
|
static Shaky3D* create(float initWithDuration, const Vec2& gridSize, int range, bool shakeZ);
|
2013-07-18 07:56:19 +08:00
|
|
|
|
|
|
|
// Overrides
|
2016-04-08 13:40:36 +08:00
|
|
|
virtual Shaky3D* clone() const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void update(float time) override;
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS : Shaky3D() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
virtual ~Shaky3D() {}
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
/**
|
2015-03-18 18:15:34 +08:00
|
|
|
@brief Initializes the action with a range, shake Z vertices, grid size and duration.
|
|
|
|
@param duration Specify the duration of the Shaky3D action. It's a value in seconds.
|
|
|
|
@param gridSize Specify the size of the grid.
|
|
|
|
@param range Specify the range of the shaky effect.
|
|
|
|
@param shakeZ Specify whether shake on the z axis.
|
2015-09-22 16:08:23 +08:00
|
|
|
@return If the Initialization success, return true; otherwise, return false.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2021-10-23 23:27:14 +08:00
|
|
|
bool initWithDuration(float duration, const Vec2& gridSize, int range, bool shakeZ);
|
2013-11-23 07:07:58 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
int _randrange;
|
|
|
|
bool _shakeZ;
|
2013-11-23 07:07:58 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(Shaky3D);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Liquid action.
|
2015-03-19 15:59:58 +08:00
|
|
|
@details This action is used for take effect on the target node as liquid.
|
2015-03-18 18:15:34 +08:00
|
|
|
You can create the action by these parameters:
|
|
|
|
duration, grid size, waves count, amplitude of the liquid effect.
|
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL Liquid : public Grid3DAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Create the action with amplitude, grid size, waves count and duration.
|
|
|
|
@param duration Specify the duration of the Liquid action. It's a value in seconds.
|
|
|
|
@param gridSize Specify the size of the grid.
|
|
|
|
@param waves Specify the waves count of the Liquid action.
|
|
|
|
@param amplitude Specify the amplitude of the Liquid action.
|
2015-09-22 16:08:23 +08:00
|
|
|
@return If the creation success, return a pointer of Liquid action; otherwise, return nil.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2021-10-23 23:27:14 +08:00
|
|
|
static Liquid* create(float duration, const Vec2& gridSize, unsigned int waves, float amplitude);
|
2013-07-18 07:56:19 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Get the amplitude of the effect.
|
|
|
|
@return Return the amplitude of the effect.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
float getAmplitude() const { return _amplitude; }
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Set the amplitude to the effect.
|
|
|
|
@param amplitude The value of amplitude will be set.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setAmplitude(float amplitude) { _amplitude = amplitude; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Get the amplitude rate of the effect.
|
|
|
|
@return Return the amplitude rate of the effect.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
float getAmplitudeRate() const { return _amplitudeRate; }
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
2015-09-22 16:08:23 +08:00
|
|
|
@brief Set the amplitude rate of the effect.
|
2015-03-18 18:15:34 +08:00
|
|
|
@param amplitudeRate The value of amplitude rate will be set.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-18 07:56:19 +08:00
|
|
|
// Overrides
|
2016-04-08 13:40:36 +08:00
|
|
|
virtual Liquid* clone() const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void update(float time) override;
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS : Liquid() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
virtual ~Liquid() {}
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Initializes the action with amplitude, grid size, waves count and duration.
|
|
|
|
@param duration Specify the duration of the Liquid action. It's a value in seconds.
|
|
|
|
@param gridSize Specify the size of the grid.
|
|
|
|
@param waves Specify the waves count of the Liquid action.
|
|
|
|
@param amplitude Specify the amplitude of the Liquid action.
|
2015-09-22 16:08:23 +08:00
|
|
|
@return If the initialization success, return true; otherwise, return false.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2021-10-23 23:27:14 +08:00
|
|
|
bool initWithDuration(float duration, const Vec2& gridSize, unsigned int waves, float amplitude);
|
2013-11-23 07:07:58 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
unsigned int _waves;
|
|
|
|
float _amplitude;
|
|
|
|
float _amplitudeRate;
|
2013-11-23 07:07:58 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(Liquid);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Waves action.
|
2015-03-19 15:59:58 +08:00
|
|
|
@details This action is used for take effect on the target node as waves.
|
2015-03-18 18:15:34 +08:00
|
|
|
You can control the effect by these parameters:
|
|
|
|
duration, grid size, waves count, amplitude,
|
|
|
|
whether waves on horizontal and whether waves on vertical.
|
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL Waves : public Grid3DAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Create the action with amplitude, horizontal sin, vertical sin, grid size, waves count and duration.
|
|
|
|
@param duration Specify the duration of the Waves action. It's a value in seconds.
|
|
|
|
@param gridSize Specify the size of the grid.
|
|
|
|
@param waves Specify the waves count of the Waves action.
|
|
|
|
@param amplitude Specify the amplitude of the Waves action.
|
|
|
|
@param horizontal Specify whether waves on horizontal.
|
|
|
|
@param vertical Specify whether waves on vertical.
|
2015-09-22 16:08:23 +08:00
|
|
|
@return If the creation success, return a pointer of Waves action; otherwise, return nil.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2021-12-25 10:04:45 +08:00
|
|
|
static Waves* create(float duration,
|
|
|
|
const Vec2& gridSize,
|
|
|
|
unsigned int waves,
|
|
|
|
float amplitude,
|
|
|
|
bool horizontal,
|
|
|
|
bool vertical);
|
2013-07-18 07:56:19 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Get the amplitude of the effect.
|
|
|
|
@return Return the amplitude of the effect.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
float getAmplitude() const { return _amplitude; }
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Set the amplitude to the effect.
|
|
|
|
@param amplitude The value of amplitude will be set.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setAmplitude(float amplitude) { _amplitude = amplitude; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Get the amplitude rate of the effect.
|
|
|
|
@return Return the amplitude rate of the effect.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
float getAmplitudeRate() const { return _amplitudeRate; }
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
2015-09-22 16:08:23 +08:00
|
|
|
@brief Set the amplitude rate of the effect.
|
2015-03-18 18:15:34 +08:00
|
|
|
@param amplitudeRate The value of amplitude rate will be set.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-18 07:56:19 +08:00
|
|
|
// Overrides
|
2016-04-08 13:40:36 +08:00
|
|
|
virtual Waves* clone() const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void update(float time) override;
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS : Waves() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
virtual ~Waves() {}
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Initializes the action with amplitude, horizontal sin, vertical sin, grid size, waves count and duration.
|
|
|
|
@param duration Specify the duration of the Waves action. It's a value in seconds.
|
|
|
|
@param gridSize Specify the size of the grid.
|
|
|
|
@param waves Specify the waves count of the Waves action.
|
|
|
|
@param amplitude Specify the amplitude of the Waves action.
|
|
|
|
@param horizontal Specify whether waves on horizontal.
|
|
|
|
@param vertical Specify whether waves on vertical.
|
2015-09-22 16:08:23 +08:00
|
|
|
@return If the initialization success, return true; otherwise, return false.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2021-12-25 10:04:45 +08:00
|
|
|
bool initWithDuration(float duration,
|
|
|
|
const Vec2& gridSize,
|
|
|
|
unsigned int waves,
|
|
|
|
float amplitude,
|
|
|
|
bool horizontal,
|
|
|
|
bool vertical);
|
2013-11-23 07:07:58 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
unsigned int _waves;
|
|
|
|
float _amplitude;
|
|
|
|
float _amplitudeRate;
|
|
|
|
bool _vertical;
|
|
|
|
bool _horizontal;
|
2013-11-23 07:07:58 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(Waves);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Twirl action.
|
2015-03-19 15:59:58 +08:00
|
|
|
@details This action is used for take effect on the target node as twirl.
|
2015-03-18 18:15:34 +08:00
|
|
|
You can control the effect by these parameters:
|
|
|
|
duration, grid size, center position, twirls count, amplitude.
|
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL Twirl : public Grid3DAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Create the action with center position, number of twirls, amplitude, a grid size and duration.
|
|
|
|
@param duration Specify the duration of the Twirl action. It's a value in seconds.
|
|
|
|
@param gridSize Specify the size of the grid.
|
|
|
|
@param position Specify the center position of the twirl action.
|
|
|
|
@param twirls Specify the twirls count of the Twirl action.
|
|
|
|
@param amplitude Specify the amplitude of the Twirl action.
|
2015-09-22 16:08:23 +08:00
|
|
|
@return If the creation success, return a pointer of Twirl action; otherwise, return nil.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2021-12-25 10:04:45 +08:00
|
|
|
static Twirl* create(float duration,
|
|
|
|
const Vec2& gridSize,
|
|
|
|
const Vec2& position,
|
|
|
|
unsigned int twirls,
|
|
|
|
float amplitude);
|
2013-07-18 07:56:19 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Get the center position of twirl action.
|
|
|
|
@return The center position of twirl action.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
const Vec2& getPosition() const { return _position; }
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Set the center position of twirl action.
|
|
|
|
@param position The center position of twirl action will be set.
|
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
void setPosition(const Vec2& position);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Get the amplitude of the effect.
|
|
|
|
@return Return the amplitude of the effect.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
float getAmplitude() const { return _amplitude; }
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Set the amplitude to the effect.
|
|
|
|
@param amplitude The value of amplitude will be set.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setAmplitude(float amplitude) { _amplitude = amplitude; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
|
|
|
@brief Get the amplitude rate of the effect.
|
|
|
|
@return Return the amplitude rate of the effect.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
float getAmplitudeRate() const { return _amplitudeRate; }
|
2015-03-18 18:15:34 +08:00
|
|
|
/**
|
2015-09-22 16:08:23 +08:00
|
|
|
@brief Set the amplitude rate of the effect.
|
2015-03-18 18:15:34 +08:00
|
|
|
@param amplitudeRate The value of amplitude rate will be set.
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-18 07:56:19 +08:00
|
|
|
// Overrides
|
2016-04-08 13:40:36 +08:00
|
|
|
virtual Twirl* clone() const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void update(float time) override;
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS : Twirl() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
virtual ~Twirl() {}
|
2015-03-18 18:15:34 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
@brief Initializes the action with center position, number of twirls, amplitude, a grid size and duration.
|
|
|
|
@param duration Specify the duration of the Twirl action. It's a value in seconds.
|
|
|
|
@param gridSize Specify the size of the grid.
|
|
|
|
@param position Specify the center position of the twirl action.
|
|
|
|
@param twirls Specify the twirls count of the Twirl action.
|
|
|
|
@param amplitude Specify the amplitude of the Twirl action.
|
2015-09-22 16:08:23 +08:00
|
|
|
@return If the initialization success, return true; otherwise, return false.
|
2015-03-18 18:15:34 +08:00
|
|
|
*/
|
2021-12-25 10:04:45 +08:00
|
|
|
bool initWithDuration(float duration,
|
|
|
|
const Vec2& gridSize,
|
|
|
|
const Vec2& position,
|
|
|
|
unsigned int twirls,
|
|
|
|
float amplitude);
|
2013-11-23 07:07:58 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2012-04-19 14:35:52 +08:00
|
|
|
/* twirl center */
|
2014-05-15 01:07:09 +08:00
|
|
|
Vec2 _position;
|
2013-06-15 14:03:30 +08:00
|
|
|
unsigned int _twirls;
|
|
|
|
float _amplitude;
|
|
|
|
float _amplitudeRate;
|
2013-11-23 07:07:58 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(Twirl);
|
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
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
#endif // __ACTION_CCGRID3D_ACTION_H__
|