[cocos2dx] Unify SkeletonRenderer interface.

This commit is contained in:
badlogic 2019-12-10 13:38:01 +01:00
parent bf14723dcc
commit d950c32ba2
4 changed files with 22 additions and 340 deletions

View File

@ -209,6 +209,9 @@
76D28AD0239FAF2C00FB142D /* SkeletonTwoColorBatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76D28AC5239FAF0A00FB142D /* SkeletonTwoColorBatch.cpp */; };
76D520E61EB362DD00572471 /* CoinExample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76D520E41EB362DD00572471 /* CoinExample.cpp */; };
76D520E71EB3634600572471 /* CoinExample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76D520E41EB362DD00572471 /* CoinExample.cpp */; };
76F10839239FC8DA005B0CE9 /* SkeletonRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76F10836239FC8DA005B0CE9 /* SkeletonRenderer.cpp */; };
76F1083A239FC8DA005B0CE9 /* SkeletonTwoColorBatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76F10837239FC8DA005B0CE9 /* SkeletonTwoColorBatch.cpp */; };
76F1083B239FC8DA005B0CE9 /* SkeletonBatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76F10838239FC8DA005B0CE9 /* SkeletonBatch.cpp */; };
76F5BD551D2BD7D3005917E5 /* TankExample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76F5BD531D2BD7D3005917E5 /* TankExample.cpp */; };
76F5BD561D2BD7EF005917E5 /* TankExample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76F5BD531D2BD7D3005917E5 /* TankExample.cpp */; };
76F5BD571D2BD7EF005917E5 /* TankExample.h in Sources */ = {isa = PBXBuildFile; fileRef = 76F5BD541D2BD7D3005917E5 /* TankExample.h */; };
@ -392,12 +395,17 @@
76D1BFDF2029E35200A0272D /* SkeletonRendererSeparatorExample.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkeletonRendererSeparatorExample.cpp; sourceTree = "<group>"; };
76D28AC5239FAF0A00FB142D /* SkeletonTwoColorBatch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonTwoColorBatch.cpp; path = ../../src/spine/v3/SkeletonTwoColorBatch.cpp; sourceTree = "<group>"; };
76D28AC6239FAF0B00FB142D /* SkeletonTwoColorBatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonTwoColorBatch.h; path = ../../src/spine/v3/SkeletonTwoColorBatch.h; sourceTree = "<group>"; };
76D28AC7239FAF0B00FB142D /* SkeletonRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonRenderer.h; path = ../../src/spine/v3/SkeletonRenderer.h; sourceTree = "<group>"; };
76D28AC8239FAF0B00FB142D /* SkeletonBatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonBatch.h; path = ../../src/spine/v3/SkeletonBatch.h; sourceTree = "<group>"; };
76D28AC9239FAF0B00FB142D /* SkeletonRenderer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonRenderer.cpp; path = ../../src/spine/v3/SkeletonRenderer.cpp; sourceTree = "<group>"; };
76D28ACA239FAF0B00FB142D /* SkeletonBatch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonBatch.cpp; path = ../../src/spine/v3/SkeletonBatch.cpp; sourceTree = "<group>"; };
76D520E41EB362DD00572471 /* CoinExample.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CoinExample.cpp; sourceTree = "<group>"; };
76D520E51EB362DD00572471 /* CoinExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoinExample.h; sourceTree = "<group>"; };
76F10834239FC8D9005B0CE9 /* SkeletonBatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonBatch.h; path = ../../src/spine/v4/SkeletonBatch.h; sourceTree = "<group>"; };
76F10835239FC8DA005B0CE9 /* SkeletonTwoColorBatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonTwoColorBatch.h; path = ../../src/spine/v4/SkeletonTwoColorBatch.h; sourceTree = "<group>"; };
76F10836239FC8DA005B0CE9 /* SkeletonRenderer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonRenderer.cpp; path = ../../src/spine/v4/SkeletonRenderer.cpp; sourceTree = "<group>"; };
76F10837239FC8DA005B0CE9 /* SkeletonTwoColorBatch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonTwoColorBatch.cpp; path = ../../src/spine/v4/SkeletonTwoColorBatch.cpp; sourceTree = "<group>"; };
76F10838239FC8DA005B0CE9 /* SkeletonBatch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonBatch.cpp; path = ../../src/spine/v4/SkeletonBatch.cpp; sourceTree = "<group>"; };
76F1083C239FC8E5005B0CE9 /* SkeletonRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonRenderer.h; path = ../../src/spine/SkeletonRenderer.h; sourceTree = "<group>"; };
76F5BD531D2BD7D3005917E5 /* TankExample.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TankExample.cpp; sourceTree = "<group>"; };
76F5BD541D2BD7D3005917E5 /* TankExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TankExample.h; sourceTree = "<group>"; };
8262943D1AAF051F00CB7CF7 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
@ -689,7 +697,8 @@
76AAA3FF1D18102C00C54FCB /* spine-cocos2dx */ = {
isa = PBXGroup;
children = (
76D28AC4239FAEEA00FB142D /* v4 */,
76F1083C239FC8E5005B0CE9 /* SkeletonRenderer.h */,
76F10833239FC8CB005B0CE9 /* v4 */,
76D28AC2239FAED800FB142D /* v3 */,
76AAA4001D18106000C54FCB /* AttachmentVertices.cpp */,
76AAA4011D18106000C54FCB /* AttachmentVertices.h */,
@ -707,16 +716,20 @@
76D28ACA239FAF0B00FB142D /* SkeletonBatch.cpp */,
76D28AC8239FAF0B00FB142D /* SkeletonBatch.h */,
76D28AC9239FAF0B00FB142D /* SkeletonRenderer.cpp */,
76D28AC7239FAF0B00FB142D /* SkeletonRenderer.h */,
76D28AC5239FAF0A00FB142D /* SkeletonTwoColorBatch.cpp */,
76D28AC6239FAF0B00FB142D /* SkeletonTwoColorBatch.h */,
);
name = v3;
sourceTree = "<group>";
};
76D28AC4239FAEEA00FB142D /* v4 */ = {
76F10833239FC8CB005B0CE9 /* v4 */ = {
isa = PBXGroup;
children = (
76F10838239FC8DA005B0CE9 /* SkeletonBatch.cpp */,
76F10834239FC8D9005B0CE9 /* SkeletonBatch.h */,
76F10836239FC8DA005B0CE9 /* SkeletonRenderer.cpp */,
76F10837239FC8DA005B0CE9 /* SkeletonTwoColorBatch.cpp */,
76F10835239FC8DA005B0CE9 /* SkeletonTwoColorBatch.h */,
);
name = v4;
sourceTree = "<group>";
@ -869,6 +882,7 @@
763104EF20BC1B5E00927A1E /* IkConstraintTimeline.cpp in Sources */,
763104D820BC1B5E00927A1E /* AnimationState.cpp in Sources */,
763104EE20BC1B5E00927A1E /* SkeletonClipping.cpp in Sources */,
76F1083A239FC8DA005B0CE9 /* SkeletonTwoColorBatch.cpp in Sources */,
763104E420BC1B5E00927A1E /* ClippingAttachment.cpp in Sources */,
76D28ACD239FAF0B00FB142D /* SkeletonBatch.cpp in Sources */,
763104C620BC1B5E00927A1E /* CurveTimeline.cpp in Sources */,
@ -925,6 +939,7 @@
763104FB20BC1B5E00927A1E /* DeformTimeline.cpp in Sources */,
503AE10217EB989F00D1A890 /* RootViewController.mm in Sources */,
503AE10117EB989F00D1A890 /* main.m in Sources */,
76F1083B239FC8DA005B0CE9 /* SkeletonBatch.cpp in Sources */,
763104CC20BC1B5E00927A1E /* RTTI.cpp in Sources */,
763104F020BC1B5E00927A1E /* Timeline.cpp in Sources */,
763104FE20BC1B5E00927A1E /* ShearTimeline.cpp in Sources */,
@ -941,6 +956,7 @@
763104E220BC1B5E00927A1E /* Updatable.cpp in Sources */,
763104D220BC1B5E00927A1E /* RotateTimeline.cpp in Sources */,
763104E320BC1B5E00927A1E /* RegionAttachment.cpp in Sources */,
76F10839239FC8DA005B0CE9 /* SkeletonRenderer.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -33,12 +33,12 @@
#include <spine/spine.h>
#include "cocos2d.h"
#include <spine/SkeletonRenderer.h>
#if COCOS2D_VERSION < 0x00040000
#include <spine/v3/SkeletonRenderer.h>
#include <spine/v3/SkeletonBatch.h>
#include <spine/v3/SkeletonTwoColorBatch.h>
#else
#include <spine/v4/SkeletonRenderer.h>
#include <spine/v4/SkeletonBatch.h>
#include <spine/v4/SkeletonTwoColorBatch.h>
#endif

View File

@ -1,168 +0,0 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated May 1, 2019. Replaces all prior versions.
*
* Copyright (c) 2013-2019, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#ifndef SPINE_SKELETONRENDERER_H_
#define SPINE_SKELETONRENDERER_H_
#include "cocos2d.h"
#if COCOS2D_VERSION < 0x00040000
#include <spine/spine.h>
namespace spine {
class AttachmentVertices;
/* Draws a skeleton. */
class SkeletonRenderer: public cocos2d::Node, public cocos2d::BlendProtocol {
public:
CREATE_FUNC(SkeletonRenderer);
static SkeletonRenderer* createWithSkeleton(Skeleton* skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false);
static SkeletonRenderer* createWithData (SkeletonData* skeletonData, bool ownsSkeletonData = false);
static SkeletonRenderer* createWithFile (const std::string& skeletonDataFile, Atlas* atlas, float scale = 1);
static SkeletonRenderer* createWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
void update (float deltaTime) override;
void draw (cocos2d::Renderer* renderer, const cocos2d::Mat4& transform, uint32_t transformFlags) override;
cocos2d::Rect getBoundingBox () const override;
void onEnter () override;
void onExit () override;
Skeleton* getSkeleton() const;
void setTimeScale(float scale);
float getTimeScale() const;
/* */
void setDebugSlotsEnabled(bool enabled);
bool getDebugSlotsEnabled() const;
void setDebugBonesEnabled(bool enabled);
bool getDebugBonesEnabled() const;
void setDebugMeshesEnabled(bool enabled);
bool getDebugMeshesEnabled() const;
void setDebugBoundingRectEnabled(bool enabled);
bool getDebugBoundingRectEnabled() const;
// --- Convenience methods for common Skeleton_* functions.
void updateWorldTransform ();
void setToSetupPose ();
void setBonesToSetupPose ();
void setSlotsToSetupPose ();
/* Returns 0 if the bone was not found. */
Bone* findBone (const std::string& boneName) const;
/* Returns 0 if the slot was not found. */
Slot* findSlot (const std::string& slotName) const;
/* Sets the skin used to look up attachments not found in the SkeletonData defaultSkin. Attachments from the new skin are
* attached if the corresponding attachment from the old skin was attached.
* @param skin May be empty string ("") for no skin.*/
void setSkin (const std::string& skinName);
/** @param skin May be 0 for no skin.*/
void setSkin (const char* skinName);
/* Returns 0 if the slot or attachment was not found. */
Attachment* getAttachment (const std::string& slotName, const std::string& attachmentName) const;
/* Returns false if the slot or attachment was not found.
* @param attachmentName May be empty string ("") for no attachment. */
bool setAttachment (const std::string& slotName, const std::string& attachmentName);
/* @param attachmentName May be 0 for no attachment. */
bool setAttachment (const std::string& slotName, const char* attachmentName);
/* Enables/disables two color tinting for this instance. May break batching */
void setTwoColorTint(bool enabled);
/* Whether two color tinting is enabled */
bool isTwoColorTint();
/* Sets the vertex effect to be used, set to 0 to disable vertex effects */
void setVertexEffect(VertexEffect* effect);
/* Sets the range of slots that should be rendered. Use -1, -1 to clear the range */
void setSlotsRange(int startSlotIndex, int endSlotIndex);
// --- BlendProtocol
void setBlendFunc (const cocos2d::BlendFunc& blendFunc)override;
const cocos2d::BlendFunc& getBlendFunc () const override;
void setOpacityModifyRGB (bool value) override;
bool isOpacityModifyRGB () const override;
CC_CONSTRUCTOR_ACCESS:
SkeletonRenderer ();
SkeletonRenderer(Skeleton* skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false, bool ownsAtlas = false);
SkeletonRenderer (SkeletonData* skeletonData, bool ownsSkeletonData = false);
SkeletonRenderer (const std::string& skeletonDataFile, Atlas* atlas, float scale = 1);
SkeletonRenderer (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
virtual ~SkeletonRenderer ();
void initWithSkeleton(Skeleton* skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false, bool ownsAtlas = false);
void initWithData (SkeletonData* skeletonData, bool ownsSkeletonData = false);
void initWithJsonFile (const std::string& skeletonDataFile, Atlas* atlas, float scale = 1);
void initWithJsonFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
void initWithBinaryFile (const std::string& skeletonDataFile, Atlas* atlas, float scale = 1);
void initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
virtual void initialize ();
protected:
void setSkeletonData (SkeletonData* skeletonData, bool ownsSkeletonData);
void setupGLProgramState(bool twoColorTintEnabled);
virtual void drawDebug (cocos2d::Renderer* renderer, const cocos2d::Mat4& transform, uint32_t transformFlags);
bool _ownsSkeletonData;
bool _ownsSkeleton;
bool _ownsAtlas = false;
Atlas* _atlas;
AttachmentLoader* _attachmentLoader;
cocos2d::CustomCommand _debugCommand;
cocos2d::BlendFunc _blendFunc;
bool _premultipliedAlpha;
Skeleton* _skeleton;
float _timeScale;
bool _debugSlots;
bool _debugBones;
bool _debugMeshes;
bool _debugBoundingRect;
SkeletonClipping* _clipper;
VertexEffect* _effect;
cocos2d::Rect _boundingRect;
int _startSlotIndex;
int _endSlotIndex;
};
}
#endif
#endif /* SPINE_SKELETONRENDERER_H_ */

View File

@ -1,166 +0,0 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated May 1, 2019. Replaces all prior versions.
*
* Copyright (c) 2013-2019, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#ifndef SPINE_SKELETONRENDERER_H_
#define SPINE_SKELETONRENDERER_H_
#include "cocos2d.h"
#if COCOS2D_VERSION >= 0x00040000
#include <spine/spine.h>
namespace spine {
class AttachmentVertices;
/* Draws a skeleton. */
class SkeletonRenderer: public cocos2d::Node, public cocos2d::BlendProtocol {
public:
CREATE_FUNC(SkeletonRenderer);
static SkeletonRenderer* createWithSkeleton(Skeleton* skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false);
static SkeletonRenderer* createWithData (SkeletonData* skeletonData, bool ownsSkeletonData = false);
static SkeletonRenderer* createWithFile (const std::string& skeletonDataFile, Atlas* atlas, float scale = 1);
static SkeletonRenderer* createWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
virtual void update (float deltaTime) override;
virtual void draw (cocos2d::Renderer* renderer, const cocos2d::Mat4& transform, uint32_t transformFlags) override;
virtual void drawDebug (cocos2d::Renderer* renderer, const cocos2d::Mat4& transform, uint32_t transformFlags);
virtual cocos2d::Rect getBoundingBox () const override;
virtual void onEnter () override;
virtual void onExit () override;
Skeleton* getSkeleton();
void setTimeScale(float scale);
float getTimeScale() const;
/* */
void setDebugSlotsEnabled(bool enabled);
bool getDebugSlotsEnabled() const;
void setDebugBonesEnabled(bool enabled);
bool getDebugBonesEnabled() const;
void setDebugMeshesEnabled(bool enabled);
bool getDebugMeshesEnabled() const;
// --- Convenience methods for common Skeleton_* functions.
void updateWorldTransform ();
void setToSetupPose ();
void setBonesToSetupPose ();
void setSlotsToSetupPose ();
/* Returns 0 if the bone was not found. */
Bone* findBone (const std::string& boneName) const;
/* Returns 0 if the slot was not found. */
Slot* findSlot (const std::string& slotName) const;
/* Sets the skin used to look up attachments not found in the SkeletonData defaultSkin. Attachments from the new skin are
* attached if the corresponding attachment from the old skin was attached.
* @param skin May be empty string ("") for no skin.*/
void setSkin (const std::string& skinName);
/** @param skin May be 0 for no skin.*/
void setSkin (const char* skinName);
/* Returns 0 if the slot or attachment was not found. */
Attachment* getAttachment (const std::string& slotName, const std::string& attachmentName) const;
/* Returns false if the slot or attachment was not found.
* @param attachmentName May be empty string ("") for no attachment. */
bool setAttachment (const std::string& slotName, const std::string& attachmentName);
/* @param attachmentName May be 0 for no attachment. */
bool setAttachment (const std::string& slotName, const char* attachmentName);
/* Enables/disables two color tinting for this instance. May break batching */
void setTwoColorTint(bool enabled);
/* Whether two color tinting is enabled */
bool isTwoColorTint();
/* Sets the vertex effect to be used, set to 0 to disable vertex effects */
void setVertexEffect(VertexEffect* effect);
/* Sets the range of slots that should be rendered. Use -1, -1 to clear the range */
void setSlotsRange(int startSlotIndex, int endSlotIndex);
// --- BlendProtocol
virtual void setBlendFunc (const cocos2d::BlendFunc& blendFunc)override;
virtual const cocos2d::BlendFunc& getBlendFunc () const override;
virtual void setOpacityModifyRGB (bool value) override;
virtual bool isOpacityModifyRGB () const override;
// Frees global memory used for temporay vertex transformations.
static void destroyScratchBuffers();
CC_CONSTRUCTOR_ACCESS:
SkeletonRenderer ();
SkeletonRenderer(Skeleton* skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false, bool ownsAtlas = false);
SkeletonRenderer (SkeletonData* skeletonData, bool ownsSkeletonData = false);
SkeletonRenderer (const std::string& skeletonDataFile, Atlas* atlas, float scale = 1);
SkeletonRenderer (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
virtual ~SkeletonRenderer ();
void initWithSkeleton(Skeleton* skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false, bool ownsAtlas = false);
void initWithData (SkeletonData* skeletonData, bool ownsSkeletonData = false);
void initWithJsonFile (const std::string& skeletonDataFile, Atlas* atlas, float scale = 1);
void initWithJsonFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
void initWithBinaryFile (const std::string& skeletonDataFile, Atlas* atlas, float scale = 1);
void initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
virtual void initialize ();
protected:
void setSkeletonData (SkeletonData* skeletonData, bool ownsSkeletonData);
void setupGLProgramState(bool twoColorTintEnabled);
bool _ownsSkeletonData;
bool _ownsSkeleton;
bool _ownsAtlas;
Atlas* _atlas;
AttachmentLoader* _attachmentLoader;
cocos2d::BlendFunc _blendFunc;
bool _premultipliedAlpha;
Skeleton* _skeleton;
float _timeScale;
bool _debugSlots;
bool _debugBones;
bool _debugMeshes;
SkeletonClipping* _clipper;
VertexEffect* _effect;
bool _twoColorTintEnabled = false;
int _startSlotIndex;
int _endSlotIndex;
};
}
#endif
#endif /* SPINE_SKELETONRENDERER_H_ */