123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- //
- // UVModule.h
- // cocos2d_libs
- //
- // Created by 徐俊杰 on 2020/4/24.
- //
- #ifndef UVModule_h
- #define UVModule_h
- //#include "cocos2d.h"
- #include "rparticle/Macros/RParticleMacros.h"
- #include "rparticle/Modules/ParticleSystemModule.h"
- #include "rparticle/PolynomialCurve.h"
- NS_RRP_BEGIN
- struct ParticleSystemParticles;
- class UVModule : public ParticleSystemModule
- {
- public:
- DECLARE_MODULE (UVModule)
- UVModule ();
-
- void RefreshFrames (std::vector<RRP_PARTICLEQUAD_VERTEX_INFO>& vertextInfos);
- void Update (const ParticleSystemParticles& ps, float* tempSheetIndex, size_t fromIndex, size_t toIndex);
- void CheckConsistency ();
-
- inline MinMaxCurve& GetCurve() { return m_Curve; }
- inline const MinMaxCurve& GetCurve() const { return m_Curve; }
-
- void GetNumTiles(int& uvTilesX, int& uvTilesY) const;
-
- template<class TransferFunction>
- void Transfer (TransferFunction& transfer);
-
- void SetTilesX(int value) { m_TilesX = value; }
- int GetTilesX() const { return m_TilesX; }
- void SetTilesY(int value) { m_TilesY = value; }
- int GetTilesY() const { return m_TilesY; }
- void SetAnimationType(int value) { m_AnimationType = value; }
- int GetAnimationType() const { return m_AnimationType; }
- void SetRowIndex(int value) { m_RowIndex = value; }
- int GetRowIndex() const { return m_RowIndex; }
- void SetCycles(float value) { m_Cycles = value; }
- float GetCycles() const { return m_Cycles; }
- void SetRandomRow(bool value) { m_RandomRow = value; }
- bool GetRandomRow() const { return m_RandomRow; }
- void SetMode(int value) { m_Mode = value; }
- int GetMode() const { return m_Mode; }
- void SetFrameNamePrefix(const std::string& value) {
- if (_frameNamePrefix != value) {
- _frameNamePrefix = value;
- _isFramesDirty = true;
- }
- }
- const std::string& GetFrameNamePrefix() const { return _frameNamePrefix; }
- void SetFrameStartIndex(int value) {
- if (_frameStartIndex != value) {
- _frameStartIndex = value;
- _isFramesDirty = true;
- }
- }
- int GetFrameStartIndex() const { return _frameStartIndex; }
- void SetFrameEndIndex(int value) {
- if (_frameEndIndex != value) {
- _frameEndIndex = value;
- _isFramesDirty = true;
- }
- }
- int GetFrameEndIndex() const { return _frameEndIndex; }
- void SetFrameCount(int value) {
- #if REDREAM_EDITOR
- _frameCount = value;
- #endif
- }
- int GetFrameCount() const {
- #if REDREAM_EDITOR
- return _frameCount;
- #else
- return 0;
- #endif
- }
- void SetFrameDirty() { _isFramesDirty = true; }
- void ClearFrameDirty() { _isFramesDirty = false; }
- private:
- enum Mode { kModeGrid, kModeSprites, kNumModes };
- enum { kWholeSheet, kSingleRow, kNumAnimationTypes };
-
- int m_Mode;
- MinMaxCurve m_Curve;
- int m_TilesX;
- int m_TilesY;
- int m_AnimationType;
- int m_RowIndex;
- float m_Cycles;
- bool m_RandomRow;
- std::string _frameNamePrefix;
- int _frameStartIndex;
- int _frameEndIndex;
- #if REDREAM_EDITOR
- int _frameCount;
- #endif
-
- bool _isFramesDirty;
- };
- NS_RRP_END
- #endif /* UVModule_h */
|