Преглед на файлове

Merge pull request #257 from jvasti/master

Cocos2d-iphone v.3.1 support
Nathan Sweet преди 11 години
родител
ревизия
50da55bcde

+ 4 - 6
spine-cocos2d-iphone/3.0/spine-cocos2d-iphone-ios.xcodeproj/project.pbxproj

@@ -51,12 +51,12 @@
 		43F7FF661927F91900CA4038 /* SkinnedMeshAttachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 43F7FF4E1927F91900CA4038 /* SkinnedMeshAttachment.c */; };
 		43F7FF671927F91900CA4038 /* Slot.c in Sources */ = {isa = PBXBuildFile; fileRef = 43F7FF4F1927F91900CA4038 /* Slot.c */; };
 		43F7FF681927F91900CA4038 /* SlotData.c in Sources */ = {isa = PBXBuildFile; fileRef = 43F7FF501927F91900CA4038 /* SlotData.c */; };
-		43F7FF871927F94800CA4038 /* PolygonBatch.m in Sources */ = {isa = PBXBuildFile; fileRef = 43F7FF821927F94800CA4038 /* PolygonBatch.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
 		43F7FF881927F94800CA4038 /* SkeletonAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 43F7FF841927F94800CA4038 /* SkeletonAnimation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
 		43F7FF891927F94800CA4038 /* SkeletonRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 43F7FF861927F94800CA4038 /* SkeletonRenderer.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
 		43F7FF8E1927F96700CA4038 /* GoblinsExample.m in Sources */ = {isa = PBXBuildFile; fileRef = 43F7FF8B1927F96700CA4038 /* GoblinsExample.m */; };
 		43F7FF8F1927F96700CA4038 /* SpineboyExample.m in Sources */ = {isa = PBXBuildFile; fileRef = 43F7FF8D1927F96700CA4038 /* SpineboyExample.m */; };
 		652107961895250000B1FF07 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 652107951895250000B1FF07 /* CoreText.framework */; };
+		83F1A0EF1986955A001F6B44 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83F1A0EE1986955A001F6B44 /* GLKit.framework */; };
 		9A5D2499170A94DA0030D4DD /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A5D2498170A94DA0030D4DD /* QuartzCore.framework */; };
 		9A5D249B170A94DA0030D4DD /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A5D249A170A94DA0030D4DD /* OpenGLES.framework */; };
 		9A5D249D170A94DA0030D4DD /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A5D249C170A94DA0030D4DD /* OpenAL.framework */; };
@@ -153,8 +153,6 @@
 		43F7FF7E1927F92500CA4038 /* Slot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Slot.h; path = "../../spine-c/include/spine/Slot.h"; sourceTree = "<group>"; };
 		43F7FF7F1927F92500CA4038 /* SlotData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SlotData.h; path = "../../spine-c/include/spine/SlotData.h"; sourceTree = "<group>"; };
 		43F7FF801927F92500CA4038 /* spine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = spine.h; path = "../../spine-c/include/spine/spine.h"; sourceTree = "<group>"; };
-		43F7FF811927F94800CA4038 /* PolygonBatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolygonBatch.h; path = src/spine/PolygonBatch.h; sourceTree = "<group>"; };
-		43F7FF821927F94800CA4038 /* PolygonBatch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PolygonBatch.m; path = src/spine/PolygonBatch.m; sourceTree = "<group>"; };
 		43F7FF831927F94800CA4038 /* SkeletonAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonAnimation.h; path = src/spine/SkeletonAnimation.h; sourceTree = "<group>"; };
 		43F7FF841927F94800CA4038 /* SkeletonAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SkeletonAnimation.m; path = src/spine/SkeletonAnimation.m; sourceTree = "<group>"; };
 		43F7FF851927F94800CA4038 /* SkeletonRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonRenderer.h; path = src/spine/SkeletonRenderer.h; sourceTree = "<group>"; };
@@ -164,6 +162,7 @@
 		43F7FF8C1927F96700CA4038 /* SpineboyExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpineboyExample.h; path = example/SpineboyExample.h; sourceTree = "<group>"; };
 		43F7FF8D1927F96700CA4038 /* SpineboyExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SpineboyExample.m; path = example/SpineboyExample.m; sourceTree = "<group>"; };
 		652107951895250000B1FF07 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; };
+		83F1A0EE1986955A001F6B44 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; };
 		9A5D2495170A94DA0030D4DD /* SpineExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SpineExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		9A5D2498170A94DA0030D4DD /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
 		9A5D249A170A94DA0030D4DD /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
@@ -182,6 +181,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				83F1A0EF1986955A001F6B44 /* GLKit.framework in Frameworks */,
 				A28E1F0C192926C500D16B23 /* libcocos2d.a in Frameworks */,
 				652107961895250000B1FF07 /* CoreText.framework in Frameworks */,
 				9A5D2499170A94DA0030D4DD /* QuartzCore.framework in Frameworks */,
@@ -275,8 +275,6 @@
 		43C32823170B0BC7004A9460 /* spine-cocos2d-iphone */ = {
 			isa = PBXGroup;
 			children = (
-				43F7FF811927F94800CA4038 /* PolygonBatch.h */,
-				43F7FF821927F94800CA4038 /* PolygonBatch.m */,
 				43F7FF831927F94800CA4038 /* SkeletonAnimation.h */,
 				43F7FF841927F94800CA4038 /* SkeletonAnimation.m */,
 				43F7FF851927F94800CA4038 /* SkeletonRenderer.h */,
@@ -342,6 +340,7 @@
 		9A5D2497170A94DA0030D4DD /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				83F1A0EE1986955A001F6B44 /* GLKit.framework */,
 				652107951895250000B1FF07 /* CoreText.framework */,
 				9A5D2498170A94DA0030D4DD /* QuartzCore.framework */,
 				9A5D249A170A94DA0030D4DD /* OpenGLES.framework */,
@@ -494,7 +493,6 @@
 				43F7FF661927F91900CA4038 /* SkinnedMeshAttachment.c in Sources */,
 				43F7FF671927F91900CA4038 /* Slot.c in Sources */,
 				43F7FF681927F91900CA4038 /* SlotData.c in Sources */,
-				43F7FF871927F94800CA4038 /* PolygonBatch.m in Sources */,
 				43F7FF881927F94800CA4038 /* SkeletonAnimation.m in Sources */,
 				43F7FF891927F94800CA4038 /* SkeletonRenderer.m in Sources */,
 				43F7FF8E1927F96700CA4038 /* GoblinsExample.m in Sources */,

+ 4 - 21
spine-cocos2d-iphone/3.0/spine-cocos2d-iphone-osx.xcodeproj/project.pbxproj

@@ -40,7 +40,6 @@
 		43F7FD861927C31700CA4038 /* SkinnedMeshAttachment.c in Sources */ = {isa = PBXBuildFile; fileRef = 43F7FD6E1927C31700CA4038 /* SkinnedMeshAttachment.c */; };
 		43F7FD871927C31700CA4038 /* Slot.c in Sources */ = {isa = PBXBuildFile; fileRef = 43F7FD6F1927C31700CA4038 /* Slot.c */; };
 		43F7FD881927C31700CA4038 /* SlotData.c in Sources */ = {isa = PBXBuildFile; fileRef = 43F7FD701927C31700CA4038 /* SlotData.c */; };
-		43F7FDA71927C33C00CA4038 /* PolygonBatch.m in Sources */ = {isa = PBXBuildFile; fileRef = 43F7FDA21927C33C00CA4038 /* PolygonBatch.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
 		43F7FDA81927C33C00CA4038 /* SkeletonAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 43F7FDA41927C33C00CA4038 /* SkeletonAnimation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
 		43F7FDA91927C33C00CA4038 /* SkeletonRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 43F7FDA61927C33C00CA4038 /* SkeletonRenderer.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
 		43F7FDAC1927C34600CA4038 /* SpineboyExample.m in Sources */ = {isa = PBXBuildFile; fileRef = 43F7FDAB1927C34600CA4038 /* SpineboyExample.m */; };
@@ -48,6 +47,7 @@
 		43F7FDB11927C35600CA4038 /* goblins-ffd.json in Resources */ = {isa = PBXBuildFile; fileRef = 43F7FDAE1927C35600CA4038 /* goblins-ffd.json */; };
 		43F7FDB21927C35600CA4038 /* goblins-ffd.png in Resources */ = {isa = PBXBuildFile; fileRef = 43F7FDAF1927C35600CA4038 /* goblins-ffd.png */; };
 		43F7FDB51927D04200CA4038 /* GoblinsExample.m in Sources */ = {isa = PBXBuildFile; fileRef = 43F7FDB41927D04200CA4038 /* GoblinsExample.m */; };
+		83F1A0E319868B46001F6B44 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83F1A0E219868B46001F6B44 /* GLKit.framework */; };
 		A2BD1E68192A41C100405470 /* libcocos2d.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A2BD1E63192A417300405470 /* libcocos2d.a */; };
 		A2BD1E73192A47A000405470 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2BD1E6C192A47A000405470 /* AVFoundation.framework */; };
 		A2BD1E74192A47A000405470 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2BD1E6D192A47A000405470 /* QuartzCore.framework */; };
@@ -66,13 +66,6 @@
 			remoteGlobalIDString = E01E663D121CA00A001A484F;
 			remoteInfo = cocos2d;
 		};
-		A2BD1E64192A417300405470 /* PBXContainerItemProxy */ = {
-			isa = PBXContainerItemProxy;
-			containerPortal = A2BD1E5C192A417300405470 /* cocos2d-osx.xcodeproj */;
-			proxyType = 2;
-			remoteGlobalIDString = A06430E713C1414300CC5554;
-			remoteInfo = kazmath;
-		};
 		A2BD1E66192A417300405470 /* PBXContainerItemProxy */ = {
 			isa = PBXContainerItemProxy;
 			containerPortal = A2BD1E5C192A417300405470 /* cocos2d-osx.xcodeproj */;
@@ -146,8 +139,6 @@
 		43F7FD9E1927C32800CA4038 /* Slot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Slot.h; path = "../../spine-c/include/spine/Slot.h"; sourceTree = "<group>"; };
 		43F7FD9F1927C32800CA4038 /* SlotData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SlotData.h; path = "../../spine-c/include/spine/SlotData.h"; sourceTree = "<group>"; };
 		43F7FDA01927C32800CA4038 /* spine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = spine.h; path = "../../spine-c/include/spine/spine.h"; sourceTree = "<group>"; };
-		43F7FDA11927C33C00CA4038 /* PolygonBatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PolygonBatch.h; path = src/spine/PolygonBatch.h; sourceTree = "<group>"; };
-		43F7FDA21927C33C00CA4038 /* PolygonBatch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PolygonBatch.m; path = src/spine/PolygonBatch.m; sourceTree = "<group>"; };
 		43F7FDA31927C33C00CA4038 /* SkeletonAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonAnimation.h; path = src/spine/SkeletonAnimation.h; sourceTree = "<group>"; };
 		43F7FDA41927C33C00CA4038 /* SkeletonAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SkeletonAnimation.m; path = src/spine/SkeletonAnimation.m; sourceTree = "<group>"; };
 		43F7FDA51927C33C00CA4038 /* SkeletonRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonRenderer.h; path = src/spine/SkeletonRenderer.h; sourceTree = "<group>"; };
@@ -159,6 +150,7 @@
 		43F7FDAF1927C35600CA4038 /* goblins-ffd.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "goblins-ffd.png"; sourceTree = "<group>"; };
 		43F7FDB31927D04200CA4038 /* GoblinsExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GoblinsExample.h; sourceTree = "<group>"; };
 		43F7FDB41927D04200CA4038 /* GoblinsExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GoblinsExample.m; sourceTree = "<group>"; };
+		83F1A0E219868B46001F6B44 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; };
 		A2BD1E5C192A417300405470 /* cocos2d-osx.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "cocos2d-osx.xcodeproj"; path = "cocos2d/cocos2d-osx.xcodeproj"; sourceTree = SOURCE_ROOT; };
 		A2BD1E6C192A47A000405470 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
 		A2BD1E6D192A47A000405470 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
@@ -174,6 +166,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				83F1A0E319868B46001F6B44 /* GLKit.framework in Frameworks */,
 				A2BD1E78192A47A000405470 /* AppKit.framework in Frameworks */,
 				A2BD1E73192A47A000405470 /* AVFoundation.framework in Frameworks */,
 				A2BD1E75192A47A000405470 /* OpenGL.framework in Frameworks */,
@@ -211,6 +204,7 @@
 		4319B51616FF9B2600C1D7A9 /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				83F1A0E219868B46001F6B44 /* GLKit.framework */,
 				A2BD1E6C192A47A000405470 /* AVFoundation.framework */,
 				A2BD1E6D192A47A000405470 /* QuartzCore.framework */,
 				A2BD1E6E192A47A000405470 /* OpenGL.framework */,
@@ -322,8 +316,6 @@
 		4319B8931701168F00C1D7A9 /* spine-cocos2d-iphone */ = {
 			isa = PBXGroup;
 			children = (
-				43F7FDA11927C33C00CA4038 /* PolygonBatch.h */,
-				43F7FDA21927C33C00CA4038 /* PolygonBatch.m */,
 				43F7FDA31927C33C00CA4038 /* SkeletonAnimation.h */,
 				43F7FDA41927C33C00CA4038 /* SkeletonAnimation.m */,
 				43F7FDA51927C33C00CA4038 /* SkeletonRenderer.h */,
@@ -359,7 +351,6 @@
 			isa = PBXGroup;
 			children = (
 				A2BD1E63192A417300405470 /* libcocos2d.a */,
-				A2BD1E65192A417300405470 /* libkazmath.a */,
 				A2BD1E67192A417300405470 /* libObjectiveChipmunk.a */,
 			);
 			name = Products;
@@ -426,13 +417,6 @@
 			remoteRef = A2BD1E62192A417300405470 /* PBXContainerItemProxy */;
 			sourceTree = BUILT_PRODUCTS_DIR;
 		};
-		A2BD1E65192A417300405470 /* libkazmath.a */ = {
-			isa = PBXReferenceProxy;
-			fileType = archive.ar;
-			path = libkazmath.a;
-			remoteRef = A2BD1E64192A417300405470 /* PBXContainerItemProxy */;
-			sourceTree = BUILT_PRODUCTS_DIR;
-		};
 		A2BD1E67192A417300405470 /* libObjectiveChipmunk.a */ = {
 			isa = PBXReferenceProxy;
 			fileType = archive.ar;
@@ -493,7 +477,6 @@
 				43F7FD861927C31700CA4038 /* SkinnedMeshAttachment.c in Sources */,
 				43F7FD871927C31700CA4038 /* Slot.c in Sources */,
 				43F7FD881927C31700CA4038 /* SlotData.c in Sources */,
-				43F7FDA71927C33C00CA4038 /* PolygonBatch.m in Sources */,
 				43F7FDA81927C33C00CA4038 /* SkeletonAnimation.m in Sources */,
 				43F7FDA91927C33C00CA4038 /* SkeletonRenderer.m in Sources */,
 				43F7FDAC1927C34600CA4038 /* SpineboyExample.m in Sources */,

+ 0 - 51
spine-cocos2d-iphone/3.0/src/spine/PolygonBatch.h

@@ -1,51 +0,0 @@
-/******************************************************************************
- * Spine Runtimes Software License
- * Version 2.1
- * 
- * Copyright (c) 2013, Esoteric Software
- * All rights reserved.
- * 
- * You are granted a perpetual, non-exclusive, non-sublicensable and
- * non-transferable license to install, execute and perform the Spine Runtimes
- * Software (the "Software") solely for internal use. Without the written
- * permission of Esoteric Software (typically granted by licensing Spine), you
- * may not (a) modify, translate, adapt or otherwise create derivative works,
- * improvements of the Software or develop new applications using the Software
- * or (b) remove, delete, alter or obscure any trademarks or any copyright,
- * trademark, patent or other intellectual property or proprietary rights
- * notices on or in the Software, including any copy thereof. Redistributions
- * in binary or source form must include this license and terms.
- * 
- * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "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 SOFTARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) 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.
- *****************************************************************************/
-
-#import <spine/spine-cocos2d-iphone.h>
-
-@interface spPolygonBatch : NSObject {
-	int _capacity;
-	ccV2F_C4B_T2F* _vertices;
-	int _verticesCount;
-	GLushort* _triangles;
-	int _trianglesCount;
-	CCTexture* _texture;
-}
-
-+ (id) createWithCapacity:(int)capacity;
-
-- (id) initWithCapacity:(int)capacity;
-
-- (void) add:(CCTexture*)texture vertices:(const float*)vertices uvs:(const float*)uvs
-	verticesCount:(int)verticesCount triangles:(const int*)triangles trianglesCount:(int)trianglesCount
-	color:(ccColor4B*)color;
-- (void) flush;
-
-@end

+ 0 - 106
spine-cocos2d-iphone/3.0/src/spine/PolygonBatch.m

@@ -1,106 +0,0 @@
-/******************************************************************************
- * Spine Runtimes Software License
- * Version 2.1
- * 
- * Copyright (c) 2013, Esoteric Software
- * All rights reserved.
- * 
- * You are granted a perpetual, non-exclusive, non-sublicensable and
- * non-transferable license to install, execute and perform the Spine Runtimes
- * Software (the "Software") solely for internal use. Without the written
- * permission of Esoteric Software (typically granted by licensing Spine), you
- * may not (a) modify, translate, adapt or otherwise create derivative works,
- * improvements of the Software or develop new applications using the Software
- * or (b) remove, delete, alter or obscure any trademarks or any copyright,
- * trademark, patent or other intellectual property or proprietary rights
- * notices on or in the Software, including any copy thereof. Redistributions
- * in binary or source form must include this license and terms.
- * 
- * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "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 SOFTARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) 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.
- *****************************************************************************/
-
-#import <spine/PolygonBatch.h>
-#import <spine/spine-cocos2d-iphone.h>
-#import <spine/extension.h>
-#import "CCTexture_Private.h"
-
-@implementation spPolygonBatch
-
-+ (id) createWithCapacity:(int)capacity {
-	return [[(spPolygonBatch*)[self alloc] initWithCapacity:capacity] autorelease];
-}
-
-- (id) initWithCapacity:(int)capacity {
-	// 32767 is max index, so 32767 / 3 - (32767 / 3 % 3) = 10920.
-	NSAssert(capacity <= 10920, @"capacity cannot be > 10920");
-	NSAssert(capacity >= 0, @"capacity cannot be < 0");
-
-	self = [super init];
-	if (!self) return nil;
-
-	_capacity = capacity;
-	_vertices = MALLOC(ccV2F_C4B_T2F, capacity);
-	_triangles = MALLOC(GLushort, capacity * 3);
-
-	return self;
-}
-
-- (void) dealloc {
-	FREE(_vertices);
-	FREE(_triangles);
-	[super dealloc];
-}
-
-- (void) add:(CCTexture*)addTexture vertices:(const float*)addVertices uvs:(const float*)uvs
-	verticesCount:(int)addVerticesCount triangles:(const int*)addTriangles trianglesCount:(int)addTrianglesCount
-	color:(ccColor4B*)color {
-
-	if (
-		addTexture != _texture
-		|| _verticesCount + (addVerticesCount >> 1) > _capacity
-		|| _trianglesCount + addTrianglesCount > _capacity * 3) {
-		[self flush];
-		_texture = addTexture;
-	}
-
-	for (int i = 0; i < addTrianglesCount; ++i, ++_trianglesCount)
-		_triangles[_trianglesCount] = addTriangles[i] + _verticesCount;
-
-	for (int i = 0; i < addVerticesCount; i += 2, ++_verticesCount) {
-		ccV2F_C4B_T2F* vertex = _vertices + _verticesCount;
-		vertex->vertices.x = addVertices[i];
-		vertex->vertices.y = addVertices[i + 1];
-		vertex->colors = *color;
-		vertex->texCoords.u = uvs[i];
-		vertex->texCoords.v = uvs[i + 1];
-	}
-}
-
-- (void) flush {
-	if (!_verticesCount) return;
-
-	ccGLBindTexture2D(_texture.name);
-	glEnableVertexAttribArray(kCCVertexAttrib_Position);
-	glEnableVertexAttribArray(kCCVertexAttrib_Color);
-	glEnableVertexAttribArray(kCCVertexAttrib_TexCoords);
-	glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, sizeof(ccV2F_C4B_T2F), &_vertices[0].vertices);
-	glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ccV2F_C4B_T2F), &_vertices[0].colors);
-	glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, sizeof(ccV2F_C4B_T2F), &_vertices[0].texCoords);
-	glDrawElements(GL_TRIANGLES, _trianglesCount, GL_UNSIGNED_SHORT, _triangles);
-
-	_verticesCount = 0;
-	_trianglesCount = 0;
-
-	CHECK_GL_ERROR_DEBUG();
-}
-
-@end

+ 1 - 4
spine-cocos2d-iphone/3.0/src/spine/SkeletonRenderer.h

@@ -31,8 +31,6 @@
 #import <spine/spine.h>
 #import "cocos2d.h"
 
-@class spPolygonBatch;
-
 /** Draws a skeleton. */
 @interface SkeletonRenderer : CCNode<CCBlendProtocol> {
 	spSkeleton* _skeleton;
@@ -41,10 +39,9 @@
 	bool _debugBones;
 	bool _premultipliedAlpha;
 	ccBlendFunc _blendFunc;
-
+    CCDrawNode *_drawNode;
 	bool _ownsSkeletonData;
 	spAtlas* _atlas;
-	spPolygonBatch* batch;
 	float* worldVertices;
 }
 

+ 45 - 35
spine-cocos2d-iphone/3.0/src/spine/SkeletonRenderer.m

@@ -31,9 +31,8 @@
 #import <spine/SkeletonRenderer.h>
 #import <spine/spine-cocos2d-iphone.h>
 #import <spine/extension.h>
-#import <spine/PolygonBatch.h>
 #import "CCNode_Private.h"
-#import "CCDrawingPrimitives.h"
+#import "CCDrawNode.h"
 
 static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
 
@@ -65,16 +64,16 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
 
 	worldVertices = MALLOC(float, 1000); // Max number of vertices per mesh.
 
-	batch = [[spPolygonBatch createWithCapacity:2000] retain]; // Max number of vertices and triangles per batch.
-
 	_skeleton = spSkeleton_create(skeletonData);
 	_rootBone = _skeleton->bones[0];
-
-	_blendFunc.src = GL_ONE;
-	_blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
-	[self setOpacityModifyRGB:YES];
-
-	[self setShaderProgram:[[CCShaderCache sharedShaderCache] programForKey:kCCShader_PositionTextureColor]];
+    
+    _blendFunc.src = GL_ONE;
+    _blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
+    _drawNode = [[CCDrawNode alloc] init];
+    [_drawNode setBlendMode: [CCBlendMode premultipliedAlphaMode]];
+    [self addChild:_drawNode];
+    
+    [self setShader:[CCShader positionTextureColorShader]];
 }
 
 - (id) initWithData:(spSkeletonData*)skeletonData ownsSkeletonData:(bool)ownsSkeletonData {
@@ -125,18 +124,16 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
 }
 
 - (void) dealloc {
+    
 	if (_ownsSkeletonData) spSkeletonData_dispose(_skeleton->data);
 	if (_atlas) spAtlas_dispose(_atlas);
 	spSkeleton_dispose(_skeleton);
-	[batch release];
 	FREE(worldVertices);
 	[super dealloc];
 }
 
-- (void) draw {
-	CC_NODE_DRAW_SETUP();
-	ccGLBindVAO(0);
-
+-(void)draw:(CCRenderer *)renderer transform:(const GLKMatrix4 *)transform {
+    
 	CCColor* nodeColor = self.color;
 	_skeleton->r = nodeColor.red;
 	_skeleton->g = nodeColor.green;
@@ -151,6 +148,7 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
 	int trianglesCount = 0;
 	float r = 0, g = 0, b = 0, a = 0;
 	for (int i = 0, n = _skeleton->slotCount; i < n; i++) {
+        
 		spSlot* slot = _skeleton->drawOrder[i];
 		if (!slot->attachment) continue;
 		CCTexture *texture = 0;
@@ -170,6 +168,7 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
 			break;
 		}
 		case SP_ATTACHMENT_MESH: {
+            
 			spMeshAttachment* attachment = (spMeshAttachment*)slot->attachment;
 			spMeshAttachment_computeWorldVertices(attachment, slot->skeleton->x, slot->skeleton->y, slot, worldVertices);
 			texture = [self getTextureForMesh:attachment];
@@ -184,6 +183,7 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
 			break;
 		}
 		case SP_ATTACHMENT_SKINNED_MESH: {
+            
 			spSkinnedMeshAttachment* attachment = (spSkinnedMeshAttachment*)slot->attachment;
 			spSkinnedMeshAttachment_computeWorldVertices(attachment, slot->skeleton->x, slot->skeleton->y, slot, worldVertices);
 			texture = [self getTextureForSkinnedMesh:attachment];
@@ -201,8 +201,7 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
 		}
 		if (texture) {
 			if (slot->data->additiveBlending != additive) {
-				[batch flush];
-				ccGLBlendFunc(_blendFunc.src, slot->data->additiveBlending ? GL_ONE : _blendFunc.dst);
+                    [self setBlendMode:[CCBlendMode blendModeWithOptions:@{CCBlendFuncSrcColor: @(_blendFunc.src),CCBlendFuncDstColor: @(slot->data->additiveBlending ? GL_ONE : _blendFunc.dst)}]];
 				additive = slot->data->additiveBlending;
 			}
 			color.a = _skeleton->a * slot->a * a * 255;
@@ -210,16 +209,29 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
 			color.r = _skeleton->r * slot->r * r * multiplier;
 			color.g = _skeleton->g * slot->g * g * multiplier;
 			color.b = _skeleton->b * slot->b * b * multiplier;
-			[batch add:texture vertices:worldVertices uvs:uvs verticesCount:verticesCount
-				triangles:triangles trianglesCount:trianglesCount color:&color];
+            self.texture = texture;
+            CGSize size = texture.contentSize;
+            GLKVector2 center = GLKVector2Make(size.width/2.0, size.height/2.0);
+            GLKVector2 extents = GLKVector2Make(size.width/2.0, size.height/2.0);
+            if(CCRenderCheckVisbility(transform, center, extents)){
+                CCRenderBuffer buffer = [renderer enqueueTriangles:trianglesCount/3 andVertexes:verticesCount withState:self.renderState globalSortOrder:0];
+                for(int i = 0; (i*2)  < verticesCount; ++i) {
+                    CCVertex vertex;
+                    vertex.position = GLKVector4Make(worldVertices[i*2], worldVertices[i*2 + 1], 0.0, 1.0);
+                    vertex.color = GLKVector4Make(color.r, color.g, color.b, color.a);
+                    vertex.texCoord1 = GLKVector2Make(uvs[i*2], 1 - uvs[(i*2) +1]);
+                    CCRenderBufferSetVertex(buffer, i, CCVertexApplyTransform(vertex, transform));
+                }
+                for(int j = 0; j*3 < trianglesCount; ++j) {
+                    CCRenderBufferSetTriangle(buffer, j, triangles[j*3], triangles[(j*3) + 1], triangles[(j*3) + 2]);
+                }
+            }
 		}
+        
 	}
-	[batch flush];
-
+    [_drawNode clear];
 	if (_debugSlots) {
 		// Slots.
-		ccDrawColor4B(0, 0, 255, 255);
-		glLineWidth(1);
 		CGPoint points[4];
 		for (int i = 0, n = _skeleton->slotCount; i < n; i++) {
 			spSlot* slot = _skeleton->drawOrder[i];
@@ -230,26 +242,24 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
 			points[1] = ccp(worldVertices[2], worldVertices[3]);
 			points[2] = ccp(worldVertices[4], worldVertices[5]);
 			points[3] = ccp(worldVertices[6], worldVertices[7]);
-			ccDrawPoly(points, 4, true);
+            [_drawNode drawPolyWithVerts:points count:4 fillColor:[CCColor clearColor] borderWidth:1 borderColor:[CCColor blueColor]];
+            
 		}
 	}
 	if (_debugBones) {
 		// Bone lengths.
-		glLineWidth(2);
-		ccDrawColor4B(255, 0, 0, 255);
 		for (int i = 0, n = _skeleton->boneCount; i < n; i++) {
 			spBone *bone = _skeleton->bones[i];
 			float x = bone->data->length * bone->m00 + bone->worldX;
 			float y = bone->data->length * bone->m10 + bone->worldY;
-			ccDrawLine(ccp(bone->worldX, bone->worldY), ccp(x, y));
+            [_drawNode drawSegmentFrom:ccp(bone->worldX, bone->worldY) to: ccp(x, y)radius:2 color:[CCColor redColor]];
 		}
+        
 		// Bone origins.
-		ccPointSize(4);
-		ccDrawColor4B(0, 0, 255, 255); // Root bone is blue.
 		for (int i = 0, n = _skeleton->boneCount; i < n; i++) {
 			spBone *bone = _skeleton->bones[i];
-			ccDrawPoint(ccp(bone->worldX, bone->worldY));
-			if (i == 0) ccDrawColor4B(0, 255, 0, 255);
+            [_drawNode drawDot:ccp(bone->worldX, bone->worldY) radius:4 color:[CCColor greenColor]];
+            if (i == 0) [_drawNode drawDot:ccp(bone->worldX, bone->worldY) radius:4 color:[CCColor blueColor]];
 		}
 	}
 }
@@ -289,10 +299,10 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
 			continue;
 		for (int ii = 0; ii < verticesCount; ii += 2) {
 			float x = worldVertices[ii] * scaleX, y = worldVertices[ii + 1] * scaleY;
-			minX = min(minX, x);
-			minY = min(minY, y);
-			maxX = max(maxX, x);
-			maxY = max(maxY, y);
+			minX = fmin(minX, x);
+			minY = fmin(minY, y);
+			maxX = fmax(maxX, x);
+			maxY = fmax(maxY, y);
 		}
 	}
 	minX = self.position.x + minX;