Add the PolySprite support and adjust the project setting on the different platform

This commit is contained in:
samuele3hu 2015-04-23 00:51:47 +08:00
parent ca1a95f2bb
commit 7c77bc9587
17 changed files with 1577 additions and 12 deletions

View File

@ -818,6 +818,42 @@
15EFA212198A2BB5000C57D3 /* CCProtectedNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15EFA20F198A2BB5000C57D3 /* CCProtectedNode.cpp */; };
15EFA213198A2BB5000C57D3 /* CCProtectedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 15EFA210198A2BB5000C57D3 /* CCProtectedNode.h */; };
15EFA214198A2BB5000C57D3 /* CCProtectedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 15EFA210198A2BB5000C57D3 /* CCProtectedNode.h */; };
15FB206A1AE7BE7400C31518 /* PolySprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15FB20661AE7BE7400C31518 /* PolySprite.cpp */; };
15FB206B1AE7BE7400C31518 /* PolySprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15FB20661AE7BE7400C31518 /* PolySprite.cpp */; };
15FB206C1AE7BE7400C31518 /* PolySprite.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20671AE7BE7400C31518 /* PolySprite.h */; };
15FB206D1AE7BE7400C31518 /* PolySprite.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20671AE7BE7400C31518 /* PolySprite.h */; };
15FB206E1AE7BE7400C31518 /* PolySpriteCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15FB20681AE7BE7400C31518 /* PolySpriteCache.cpp */; };
15FB206F1AE7BE7400C31518 /* PolySpriteCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15FB20681AE7BE7400C31518 /* PolySpriteCache.cpp */; };
15FB20701AE7BE7400C31518 /* PolySpriteCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20691AE7BE7400C31518 /* PolySpriteCache.h */; };
15FB20711AE7BE7400C31518 /* PolySpriteCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20691AE7BE7400C31518 /* PolySpriteCache.h */; };
15FB20741AE7BF8600C31518 /* MarchingSquare.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15FB20721AE7BF8600C31518 /* MarchingSquare.cpp */; };
15FB20751AE7BF8600C31518 /* MarchingSquare.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15FB20721AE7BF8600C31518 /* MarchingSquare.cpp */; };
15FB20761AE7BF8600C31518 /* MarchingSquare.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20731AE7BF8600C31518 /* MarchingSquare.h */; };
15FB20771AE7BF8600C31518 /* MarchingSquare.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20731AE7BF8600C31518 /* MarchingSquare.h */; };
15FB20871AE7C57D00C31518 /* shapes.cc in Sources */ = {isa = PBXBuildFile; fileRef = 15FB207A1AE7C57D00C31518 /* shapes.cc */; };
15FB20881AE7C57D00C31518 /* shapes.cc in Sources */ = {isa = PBXBuildFile; fileRef = 15FB207A1AE7C57D00C31518 /* shapes.cc */; };
15FB20891AE7C57D00C31518 /* shapes.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB207B1AE7C57D00C31518 /* shapes.h */; };
15FB208A1AE7C57D00C31518 /* shapes.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB207B1AE7C57D00C31518 /* shapes.h */; };
15FB208B1AE7C57D00C31518 /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB207C1AE7C57D00C31518 /* utils.h */; };
15FB208C1AE7C57D00C31518 /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB207C1AE7C57D00C31518 /* utils.h */; };
15FB208D1AE7C57D00C31518 /* poly2tri.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB207D1AE7C57D00C31518 /* poly2tri.h */; };
15FB208E1AE7C57D00C31518 /* poly2tri.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB207D1AE7C57D00C31518 /* poly2tri.h */; };
15FB208F1AE7C57D00C31518 /* advancing_front.cc in Sources */ = {isa = PBXBuildFile; fileRef = 15FB207F1AE7C57D00C31518 /* advancing_front.cc */; };
15FB20901AE7C57D00C31518 /* advancing_front.cc in Sources */ = {isa = PBXBuildFile; fileRef = 15FB207F1AE7C57D00C31518 /* advancing_front.cc */; };
15FB20911AE7C57D00C31518 /* advancing_front.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20801AE7C57D00C31518 /* advancing_front.h */; };
15FB20921AE7C57D00C31518 /* advancing_front.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20801AE7C57D00C31518 /* advancing_front.h */; };
15FB20931AE7C57D00C31518 /* cdt.cc in Sources */ = {isa = PBXBuildFile; fileRef = 15FB20811AE7C57D00C31518 /* cdt.cc */; };
15FB20941AE7C57D00C31518 /* cdt.cc in Sources */ = {isa = PBXBuildFile; fileRef = 15FB20811AE7C57D00C31518 /* cdt.cc */; };
15FB20951AE7C57D00C31518 /* cdt.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20821AE7C57D00C31518 /* cdt.h */; };
15FB20961AE7C57D00C31518 /* cdt.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20821AE7C57D00C31518 /* cdt.h */; };
15FB20971AE7C57D00C31518 /* sweep.cc in Sources */ = {isa = PBXBuildFile; fileRef = 15FB20831AE7C57D00C31518 /* sweep.cc */; };
15FB20981AE7C57D00C31518 /* sweep.cc in Sources */ = {isa = PBXBuildFile; fileRef = 15FB20831AE7C57D00C31518 /* sweep.cc */; };
15FB20991AE7C57D00C31518 /* sweep.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20841AE7C57D00C31518 /* sweep.h */; };
15FB209A1AE7C57D00C31518 /* sweep.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20841AE7C57D00C31518 /* sweep.h */; };
15FB209B1AE7C57D00C31518 /* sweep_context.cc in Sources */ = {isa = PBXBuildFile; fileRef = 15FB20851AE7C57D00C31518 /* sweep_context.cc */; };
15FB209C1AE7C57D00C31518 /* sweep_context.cc in Sources */ = {isa = PBXBuildFile; fileRef = 15FB20851AE7C57D00C31518 /* sweep_context.cc */; };
15FB209D1AE7C57D00C31518 /* sweep_context.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20861AE7C57D00C31518 /* sweep_context.h */; };
15FB209E1AE7C57D00C31518 /* sweep_context.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20861AE7C57D00C31518 /* sweep_context.h */; };
182C5CAE1A95961600C30D34 /* CSParse3DBinary_generated.h in Headers */ = {isa = PBXBuildFile; fileRef = 182C5CAD1A95961600C30D34 /* CSParse3DBinary_generated.h */; };
182C5CB21A95964700C30D34 /* Node3DReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 182C5CB01A95964700C30D34 /* Node3DReader.cpp */; };
182C5CB31A95964700C30D34 /* Node3DReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 182C5CB11A95964700C30D34 /* Node3DReader.h */; };
@ -2673,6 +2709,24 @@
15B3707719EE414C00ABE682 /* Manifest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Manifest.h; sourceTree = "<group>"; };
15EFA20F198A2BB5000C57D3 /* CCProtectedNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCProtectedNode.cpp; sourceTree = "<group>"; };
15EFA210198A2BB5000C57D3 /* CCProtectedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCProtectedNode.h; sourceTree = "<group>"; };
15FB20661AE7BE7400C31518 /* PolySprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PolySprite.cpp; sourceTree = "<group>"; };
15FB20671AE7BE7400C31518 /* PolySprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolySprite.h; sourceTree = "<group>"; };
15FB20681AE7BE7400C31518 /* PolySpriteCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PolySpriteCache.cpp; sourceTree = "<group>"; };
15FB20691AE7BE7400C31518 /* PolySpriteCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolySpriteCache.h; sourceTree = "<group>"; };
15FB20721AE7BF8600C31518 /* MarchingSquare.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarchingSquare.cpp; sourceTree = "<group>"; };
15FB20731AE7BF8600C31518 /* MarchingSquare.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarchingSquare.h; sourceTree = "<group>"; };
15FB207A1AE7C57D00C31518 /* shapes.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = shapes.cc; sourceTree = "<group>"; };
15FB207B1AE7C57D00C31518 /* shapes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = shapes.h; sourceTree = "<group>"; };
15FB207C1AE7C57D00C31518 /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = "<group>"; };
15FB207D1AE7C57D00C31518 /* poly2tri.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = poly2tri.h; sourceTree = "<group>"; };
15FB207F1AE7C57D00C31518 /* advancing_front.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = advancing_front.cc; sourceTree = "<group>"; };
15FB20801AE7C57D00C31518 /* advancing_front.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = advancing_front.h; sourceTree = "<group>"; };
15FB20811AE7C57D00C31518 /* cdt.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cdt.cc; sourceTree = "<group>"; };
15FB20821AE7C57D00C31518 /* cdt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cdt.h; sourceTree = "<group>"; };
15FB20831AE7C57D00C31518 /* sweep.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sweep.cc; sourceTree = "<group>"; };
15FB20841AE7C57D00C31518 /* sweep.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sweep.h; sourceTree = "<group>"; };
15FB20851AE7C57D00C31518 /* sweep_context.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sweep_context.cc; sourceTree = "<group>"; };
15FB20861AE7C57D00C31518 /* sweep_context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sweep_context.h; sourceTree = "<group>"; };
182C5CAD1A95961600C30D34 /* CSParse3DBinary_generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSParse3DBinary_generated.h; sourceTree = "<group>"; };
182C5CB01A95964700C30D34 /* Node3DReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Node3DReader.cpp; path = Node3DReader/Node3DReader.cpp; sourceTree = "<group>"; };
182C5CB11A95964700C30D34 /* Node3DReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Node3DReader.h; path = Node3DReader/Node3DReader.h; sourceTree = "<group>"; };
@ -4131,6 +4185,42 @@
name = Frameworks;
sourceTree = "<group>";
};
15FB20781AE7C57D00C31518 /* poly2tri */ = {
isa = PBXGroup;
children = (
15FB20791AE7C57D00C31518 /* common */,
15FB207D1AE7C57D00C31518 /* poly2tri.h */,
15FB207E1AE7C57D00C31518 /* sweep */,
);
name = poly2tri;
path = ../external/poly2tri;
sourceTree = "<group>";
};
15FB20791AE7C57D00C31518 /* common */ = {
isa = PBXGroup;
children = (
15FB207A1AE7C57D00C31518 /* shapes.cc */,
15FB207B1AE7C57D00C31518 /* shapes.h */,
15FB207C1AE7C57D00C31518 /* utils.h */,
);
path = common;
sourceTree = "<group>";
};
15FB207E1AE7C57D00C31518 /* sweep */ = {
isa = PBXGroup;
children = (
15FB207F1AE7C57D00C31518 /* advancing_front.cc */,
15FB20801AE7C57D00C31518 /* advancing_front.h */,
15FB20811AE7C57D00C31518 /* cdt.cc */,
15FB20821AE7C57D00C31518 /* cdt.h */,
15FB20831AE7C57D00C31518 /* sweep.cc */,
15FB20841AE7C57D00C31518 /* sweep.h */,
15FB20851AE7C57D00C31518 /* sweep_context.cc */,
15FB20861AE7C57D00C31518 /* sweep_context.h */,
);
path = sweep;
sourceTree = "<group>";
};
182C5CAF1A95961E00C30D34 /* Node3DReader */ = {
isa = PBXGroup;
children = (
@ -4485,6 +4575,12 @@
1A570275180BCC840088DEC7 /* sprite-nodes */ = {
isa = PBXGroup;
children = (
15FB20721AE7BF8600C31518 /* MarchingSquare.cpp */,
15FB20731AE7BF8600C31518 /* MarchingSquare.h */,
15FB20661AE7BE7400C31518 /* PolySprite.cpp */,
15FB20671AE7BE7400C31518 /* PolySprite.h */,
15FB20681AE7BE7400C31518 /* PolySpriteCache.cpp */,
15FB20691AE7BE7400C31518 /* PolySpriteCache.h */,
1A57028E180BCCAB0088DEC7 /* CCAnimation.cpp */,
1A57028F180BCCAB0088DEC7 /* CCAnimation.h */,
1A570290180BCCAB0088DEC7 /* CCAnimationCache.cpp */,
@ -4547,6 +4643,7 @@
1A57033E180BD0490088DEC7 /* external */ = {
isa = PBXGroup;
children = (
15FB20781AE7C57D00C31518 /* poly2tri */,
382383E11A258FA7002C4610 /* flatbuffers */,
1AC026971914068200FA920D /* ConvertUTF */,
46C02E0418E91123004B7456 /* xxhash */,
@ -6629,6 +6726,7 @@
3E2F27A719CFBFE400E7C490 /* AudioEngine.h in Headers */,
15AE183A19AAD2F700C27E9E /* CCRay.h in Headers */,
15AE18A319AAD33D00C27E9E /* CCParticleSystemQuadLoader.h in Headers */,
15FB20761AE7BF8600C31518 /* MarchingSquare.h in Headers */,
B665E2C41AA80A6500DDB1C5 /* CCPUGeometryRotatorTranslator.h in Headers */,
46A170F01807CECA005B8026 /* CCPhysicsWorld.h in Headers */,
15AE199D19AAD39600C27E9E /* ScrollViewReader.h in Headers */,
@ -6689,6 +6787,7 @@
15AE18ED19AAD35000C27E9E /* CCActionObject.h in Headers */,
ED9C6A9618599AD8000A5232 /* CCNodeGrid.h in Headers */,
15AE18A719AAD33D00C27E9E /* CCScrollViewLoader.h in Headers */,
15FB20891AE7C57D00C31518 /* shapes.h in Headers */,
15AE184819AAD2F700C27E9E /* cocos3d.h in Headers */,
50ABBEC31925AB6F00A911A9 /* CCVector.h in Headers */,
1A57008B180BC5A10088DEC7 /* CCActionProgressTimer.h in Headers */,
@ -6762,6 +6861,7 @@
B68779021A8CA82E00643ABF /* CCParticle3DRender.h in Headers */,
15AE1B6C19AADA9900C27E9E /* UIWidget.h in Headers */,
B665E2681AA80A6500DDB1C5 /* CCPUDoExpireEventHandlerTranslator.h in Headers */,
15FB208B1AE7C57D00C31518 /* utils.h in Headers */,
15AE180E19AAD2F700C27E9E /* CCAnimate3D.h in Headers */,
1A5701B3180BCB590088DEC7 /* CCFontFNT.h in Headers */,
38F526421A48363B000DB7F7 /* CSArmatureNode_generated.h in Headers */,
@ -6802,6 +6902,7 @@
15AE1A3319AAD3D500C27E9E /* b2CircleShape.h in Headers */,
1A5701E0180BCB8C0088DEC7 /* CCLayer.h in Headers */,
1A5701E4180BCB8C0088DEC7 /* CCScene.h in Headers */,
15FB20701AE7BE7400C31518 /* PolySpriteCache.h in Headers */,
B665E3D81AA80A6600DDB1C5 /* CCPUScriptParser.h in Headers */,
382384091A25900F002C4610 /* FlatBuffersSerialize.h in Headers */,
15AE1BDD19AAE01E00C27E9E /* CCControlUtils.h in Headers */,
@ -6894,6 +6995,7 @@
1A57022F180BCC1A0088DEC7 /* CCParticleSystemQuad.h in Headers */,
B665E37C1AA80A6500DDB1C5 /* CCPUParticleSystem3D.h in Headers */,
15AE188519AAD33D00C27E9E /* CCBSequence.h in Headers */,
15FB20951AE7C57D00C31518 /* cdt.h in Headers */,
B665E3541AA80A6500DDB1C5 /* CCPUOnQuotaObserver.h in Headers */,
50643BE219BFCF1800EF68ED /* CCPlatformConfig.h in Headers */,
B29A7DF519EE1B7700872B35 /* Skeleton.h in Headers */,
@ -6986,6 +7088,7 @@
B29A7E3919EE1B7700872B35 /* Animation.h in Headers */,
B665E2B01AA80A6500DDB1C5 /* CCPUFlockCenteringAffectorTranslator.h in Headers */,
382384381A259126002C4610 /* ProjectNodeReader.h in Headers */,
15FB20991AE7C57D00C31518 /* sweep.h in Headers */,
B665E3C41AA80A6600DDB1C5 /* CCPUScaleAffectorTranslator.h in Headers */,
15AE191019AAD35000C27E9E /* CCInputDelegate.h in Headers */,
B665E4301AA80A6600DDB1C5 /* CCPUVelocityMatchingAffectorTranslator.h in Headers */,
@ -7002,6 +7105,7 @@
382383EE1A258FA7002C4610 /* flatbuffers.h in Headers */,
15AE1B5619AADA9900C27E9E /* UIScrollView.h in Headers */,
50ABBDBB1925AB4100A911A9 /* CCTextureAtlas.h in Headers */,
15FB20911AE7C57D00C31518 /* advancing_front.h in Headers */,
1A570302180BCE890088DEC7 /* CCParallaxNode.h in Headers */,
50ABBE4B1925AB6F00A911A9 /* CCEventAcceleration.h in Headers */,
1A57030E180BCF190088DEC7 /* CCComponent.h in Headers */,
@ -7042,6 +7146,7 @@
15AE183219AAD2F700C27E9E /* CCOBB.h in Headers */,
15AE1BE319AAE01E00C27E9E /* CCScrollView.h in Headers */,
B665E2941AA80A6500DDB1C5 /* CCPUEmitter.h in Headers */,
15FB209D1AE7C57D00C31518 /* sweep_context.h in Headers */,
50CB247519D9C5A100687767 /* AudioCache.h in Headers */,
3823841C1A2590D2002C4610 /* ComAudioReader.h in Headers */,
50ABC01F1926664800A911A9 /* CCThread.h in Headers */,
@ -7049,6 +7154,7 @@
1A57035A180BD0B00088DEC7 /* unzip.h in Headers */,
15AE188B19AAD33D00C27E9E /* CCControlLoader.h in Headers */,
B29A7DF719EE1B7700872B35 /* Attachment.h in Headers */,
15FB208D1AE7C57D00C31518 /* poly2tri.h in Headers */,
15AE1BCA19AAE01E00C27E9E /* CCControl.h in Headers */,
50ABBDBF1925AB4100A911A9 /* CCTextureCache.h in Headers */,
B29A7E0D19EE1B7700872B35 /* Bone.h in Headers */,
@ -7147,6 +7253,7 @@
50ABBE5B1925AB6F00A911A9 /* CCEventKeyboard.h in Headers */,
B665E1F41AA80A6500DDB1C5 /* CCPUAffector.h in Headers */,
1A01C69E18F57BE800EFE3A6 /* CCString.h in Headers */,
15FB206C1AE7BE7400C31518 /* PolySprite.h in Headers */,
50ABC00F1926664800A911A9 /* CCFileUtils.h in Headers */,
B665E2981AA80A6500DDB1C5 /* CCPUEmitterManager.h in Headers */,
15AE1A3719AAD3D500C27E9E /* b2PolygonShape.h in Headers */,
@ -7260,6 +7367,7 @@
5034CA38191D591100CE6051 /* ccShader_PositionColorLengthTexture.vert in Headers */,
15AE1B8119AADA9A00C27E9E /* UITextAtlas.h in Headers */,
B29A7E3A19EE1B7700872B35 /* Animation.h in Headers */,
15FB208C1AE7C57D00C31518 /* utils.h in Headers */,
B665E2B51AA80A6500DDB1C5 /* CCPUForceField.h in Headers */,
B665E2D91AA80A6500DDB1C5 /* CCPUJetAffector.h in Headers */,
15B3708319EE414C00ABE682 /* CCEventListenerAssetsManagerEx.h in Headers */,
@ -7271,6 +7379,7 @@
46A171011807CECB005B8026 /* CCPhysicsJoint.h in Headers */,
B665E3D91AA80A6600DDB1C5 /* CCPUScriptParser.h in Headers */,
B665E43D1AA80A6600DDB1C5 /* CCPUVortexAffectorTranslator.h in Headers */,
15FB208E1AE7C57D00C31518 /* poly2tri.h in Headers */,
B29A7E3219EE1B7700872B35 /* SkinnedMeshAttachment.h in Headers */,
46A170FD1807CECB005B8026 /* CCPhysicsBody.h in Headers */,
50ABBE9C1925AB6F00A911A9 /* CCRef.h in Headers */,
@ -7343,6 +7452,7 @@
B665E4351AA80A6600DDB1C5 /* CCPUVertexEmitter.h in Headers */,
B665E2451AA80A6500DDB1C5 /* CCPUCollisionAvoidanceAffector.h in Headers */,
50ABBEC41925AB6F00A911A9 /* CCVector.h in Headers */,
15FB20711AE7BE7400C31518 /* PolySpriteCache.h in Headers */,
50ABBE501925AB6F00A911A9 /* CCEventCustom.h in Headers */,
15AE1AD719AAD40300C27E9E /* b2WheelJoint.h in Headers */,
B665E3311AA80A6500DDB1C5 /* CCPUOnCountObserverTranslator.h in Headers */,
@ -7409,6 +7519,7 @@
15AE1B7719AADA9A00C27E9E /* UIPageView.h in Headers */,
50ABBD8A1925AB4100A911A9 /* CCCustomCommand.h in Headers */,
299754F7193EC95400A54AC3 /* ObjectFactory.h in Headers */,
15FB20921AE7C57D00C31518 /* advancing_front.h in Headers */,
50ABBE881925AB6F00A911A9 /* ccMacros.h in Headers */,
B665E3991AA80A6500DDB1C5 /* CCPUPointEmitter.h in Headers */,
B29A7E4019EE1B7700872B35 /* AnimationState.h in Headers */,
@ -7568,6 +7679,7 @@
B665E3A51AA80A6500DDB1C5 /* CCPUPositionEmitterTranslator.h in Headers */,
B68779071A8CA82E00643ABF /* CCParticleSystem3D.h in Headers */,
B665E2651AA80A6500DDB1C5 /* CCPUDoExpireEventHandler.h in Headers */,
15FB208A1AE7C57D00C31518 /* shapes.h in Headers */,
50ABBEA21925AB6F00A911A9 /* CCScheduler.h in Headers */,
1A57020B180BCBDF0088DEC7 /* CCMotionStreak.h in Headers */,
B665E2211AA80A6500DDB1C5 /* CCPUBehaviourManager.h in Headers */,
@ -7579,6 +7691,7 @@
15AE1AA819AAD40300C27E9E /* b2Island.h in Headers */,
B665E2391AA80A6500DDB1C5 /* CCPUBoxEmitterTranslator.h in Headers */,
15B3708B19EE414C00ABE682 /* Manifest.h in Headers */,
15FB209A1AE7C57D00C31518 /* sweep.h in Headers */,
1A570213180BCBF40088DEC7 /* CCProgressTimer.h in Headers */,
38F526431A48363B000DB7F7 /* CSArmatureNode_generated.h in Headers */,
1A570217180BCBF40088DEC7 /* CCRenderTexture.h in Headers */,
@ -7588,6 +7701,7 @@
B665E3ED1AA80A6600DDB1C5 /* CCPUSlaveBehaviour.h in Headers */,
15AE198619AAD36400C27E9E /* WidgetReader.h in Headers */,
1A570224180BCC1A0088DEC7 /* CCParticleBatchNode.h in Headers */,
15FB20961AE7C57D00C31518 /* cdt.h in Headers */,
15AE1AC919AAD40300C27E9E /* b2Joint.h in Headers */,
382383EF1A258FA7002C4610 /* flatbuffers.h in Headers */,
B6D38B911AC3AFAC00043997 /* CCTextureCube.h in Headers */,
@ -7662,8 +7776,10 @@
1A5702ED180BCE750088DEC7 /* CCTileMapAtlas.h in Headers */,
15AE195E19AAD35100C27E9E /* CCSkin.h in Headers */,
1A5702F1180BCE750088DEC7 /* CCTMXLayer.h in Headers */,
15FB20771AE7BF8600C31518 /* MarchingSquare.h in Headers */,
15AE18AE19AAD33D00C27E9E /* CCBFileLoader.h in Headers */,
15AE197819AAD35700C27E9E /* CCActionTimeline.h in Headers */,
15FB206D1AE7BE7400C31518 /* PolySprite.h in Headers */,
15AE1AA019AAD40300C27E9E /* b2Timer.h in Headers */,
5034CA44191D591100CE6051 /* ccShader_Label.vert in Headers */,
1A5702F5180BCE750088DEC7 /* CCTMXObjectGroup.h in Headers */,
@ -7893,6 +8009,7 @@
15AE18BE19AAD33D00C27E9E /* CCLabelBMFontLoader.h in Headers */,
50ABC00A1926664800A911A9 /* CCCommon.h in Headers */,
15AE19AD19AAD39700C27E9E /* LoadingBarReader.h in Headers */,
15FB209E1AE7C57D00C31518 /* sweep_context.h in Headers */,
50ABBE5C1925AB6F00A911A9 /* CCEventKeyboard.h in Headers */,
B665E2191AA80A6500DDB1C5 /* CCPUBeamRender.h in Headers */,
5E9F612D1A3FFE3D0038DE01 /* CCPlane.h in Headers */,
@ -8052,6 +8169,7 @@
B665E4261AA80A6600DDB1C5 /* CCPUUtil.cpp in Sources */,
15AE1B6319AADA9900C27E9E /* UICheckBox.cpp in Sources */,
15EFA211198A2BB5000C57D3 /* CCProtectedNode.cpp in Sources */,
15FB208F1AE7C57D00C31518 /* advancing_front.cc in Sources */,
50ABBEB71925AB6F00A911A9 /* ccUTF8.cpp in Sources */,
B665E2621AA80A6500DDB1C5 /* CCPUDoExpireEventHandler.cpp in Sources */,
B665E4161AA80A6600DDB1C5 /* CCPUTextureAnimatorTranslator.cpp in Sources */,
@ -8254,6 +8372,7 @@
B665E2A21AA80A6500DDB1C5 /* CCPUEventHandlerManager.cpp in Sources */,
B665E3EE1AA80A6600DDB1C5 /* CCPUSlaveBehaviourTranslator.cpp in Sources */,
1A5701EE180BCB8C0088DEC7 /* CCTransitionProgress.cpp in Sources */,
15FB20931AE7C57D00C31518 /* cdt.cc in Sources */,
B29A7DE119EE1B7700872B35 /* MeshAttachment.c in Sources */,
15AE18F419AAD35000C27E9E /* CCArmatureDefine.cpp in Sources */,
15AE186619AAD31D00C27E9E /* CDOpenALSupport.m in Sources */,
@ -8267,6 +8386,7 @@
1A5701FB180BCBAD0088DEC7 /* CCMenuItem.cpp in Sources */,
1A570202180BCBD40088DEC7 /* CCClippingNode.cpp in Sources */,
1A570208180BCBDF0088DEC7 /* CCMotionStreak.cpp in Sources */,
15FB20971AE7C57D00C31518 /* sweep.cc in Sources */,
1A570210180BCBF40088DEC7 /* CCProgressTimer.cpp in Sources */,
292DB15F19B461CA00A80320 /* ExtensionDeprecated.cpp in Sources */,
292DB14D19B4574100A80320 /* UIEditBoxImpl-mac.mm in Sources */,
@ -8301,6 +8421,7 @@
15AE199619AAD39600C27E9E /* ListViewReader.cpp in Sources */,
50ABC0191926664800A911A9 /* CCSAXParser.cpp in Sources */,
15AE189219AAD33D00C27E9E /* CCLayerGradientLoader.cpp in Sources */,
15FB206E1AE7BE7400C31518 /* PolySpriteCache.cpp in Sources */,
15AE1B6A19AADA9900C27E9E /* UIDeprecated.cpp in Sources */,
15AE183C19AAD2F700C27E9E /* CCSkeleton3D.cpp in Sources */,
15AE1A2319AAD3D500C27E9E /* b2BroadPhase.cpp in Sources */,
@ -8385,6 +8506,7 @@
15AE199A19AAD39600C27E9E /* PageViewReader.cpp in Sources */,
1A57030C180BCF190088DEC7 /* CCComponent.cpp in Sources */,
382383F61A258FA7002C4610 /* idl_gen_fbs.cpp in Sources */,
15FB20741AE7BF8600C31518 /* MarchingSquare.cpp in Sources */,
B665E2A61AA80A6500DDB1C5 /* CCPUEventHandlerTranslator.cpp in Sources */,
15AE1A5919AAD40300C27E9E /* b2StackAllocator.cpp in Sources */,
B29A7E3D19EE1B7700872B35 /* AnimationState.c in Sources */,
@ -8397,6 +8519,7 @@
1A01C69C18F57BE800EFE3A6 /* CCString.cpp in Sources */,
B665E2721AA80A6500DDB1C5 /* CCPUDoPlacementParticleEventHandler.cpp in Sources */,
50ABBD3C1925AB0000A911A9 /* CCGeometry.cpp in Sources */,
15FB206A1AE7BE7400C31518 /* PolySprite.cpp in Sources */,
B29A7DDD19EE1B7700872B35 /* BoneData.c in Sources */,
15AE188A19AAD33D00C27E9E /* CCControlLoader.cpp in Sources */,
B665E35A1AA80A6500DDB1C5 /* CCPUOnRandomObserver.cpp in Sources */,
@ -8440,6 +8563,7 @@
15AE18F819AAD35000C27E9E /* CCBone.cpp in Sources */,
B665E2121AA80A6500DDB1C5 /* CCPUBaseForceAffectorTranslator.cpp in Sources */,
38ACD1FC1A27111900C3093D /* WidgetCallBackHandlerProtocol.cpp in Sources */,
15FB209B1AE7C57D00C31518 /* sweep_context.cc in Sources */,
15AE1A7619AAD40300C27E9E /* b2EdgeAndPolygonContact.cpp in Sources */,
50ABBD8B1925AB4100A911A9 /* CCGLProgram.cpp in Sources */,
464AD6E5197EBB1400E502D8 /* pvr.cpp in Sources */,
@ -8487,6 +8611,7 @@
15AE19A019AAD39600C27E9E /* TextAtlasReader.cpp in Sources */,
15AE1A2A19AAD3D500C27E9E /* b2Distance.cpp in Sources */,
50ABBE6D1925AB6F00A911A9 /* CCEventListenerKeyboard.cpp in Sources */,
15FB20871AE7C57D00C31518 /* shapes.cc in Sources */,
B665E27A1AA80A6500DDB1C5 /* CCPUDoScaleEventHandler.cpp in Sources */,
15AE190B19AAD35000C27E9E /* CCDisplayFactory.cpp in Sources */,
B29A7DE319EE1B7700872B35 /* SkeletonBounds.c in Sources */,
@ -8613,6 +8738,7 @@
15AE192C19AAD35100C27E9E /* CCActionFrame.cpp in Sources */,
1A01C69918F57BE800EFE3A6 /* CCSet.cpp in Sources */,
1A01C69D18F57BE800EFE3A6 /* CCString.cpp in Sources */,
15FB20981AE7C57D00C31518 /* sweep.cc in Sources */,
15AE199219AAD37300C27E9E /* ImageViewReader.cpp in Sources */,
B665E1F71AA80A6500DDB1C5 /* CCPUAffectorManager.cpp in Sources */,
2986667F18B1B246000E39CA /* CCTweenFunction.cpp in Sources */,
@ -8727,6 +8853,7 @@
50CB247C19D9C5A100687767 /* AudioEngine-inl.mm in Sources */,
15AE1AC819AAD40300C27E9E /* b2Joint.cpp in Sources */,
50ABBE461925AB6F00A911A9 /* CCEvent.cpp in Sources */,
15FB20881AE7C57D00C31518 /* shapes.cc in Sources */,
50ABBEA01925AB6F00A911A9 /* CCScheduler.cpp in Sources */,
15AE1A4119AAD3D500C27E9E /* b2Distance.cpp in Sources */,
50ABBE4E1925AB6F00A911A9 /* CCEventCustom.cpp in Sources */,
@ -8854,6 +8981,7 @@
15AE18AB19AAD33D00C27E9E /* CCBAnimationManager.cpp in Sources */,
15AE1B7219AADA9A00C27E9E /* UIListView.cpp in Sources */,
1A5701BE180BCB5A0088DEC7 /* CCLabelAtlas.cpp in Sources */,
15FB20751AE7BF8600C31518 /* MarchingSquare.cpp in Sources */,
15AE1A3D19AAD3D500C27E9E /* b2CollideEdge.cpp in Sources */,
1A5701C2180BCB5A0088DEC7 /* CCLabelBMFont.cpp in Sources */,
1A087AE91860400400196EF5 /* edtaa3func.cpp in Sources */,
@ -8877,6 +9005,7 @@
382384291A2590F9002C4610 /* NodeReader.cpp in Sources */,
15AE193419AAD35100C27E9E /* CCActionObject.cpp in Sources */,
B665E4171AA80A6600DDB1C5 /* CCPUTextureAnimatorTranslator.cpp in Sources */,
15FB20941AE7C57D00C31518 /* cdt.cc in Sources */,
B665E34B1AA80A6500DDB1C5 /* CCPUOnPositionObserver.cpp in Sources */,
15AE1AD619AAD40300C27E9E /* b2WheelJoint.cpp in Sources */,
299754F5193EC95400A54AC3 /* ObjectFactory.cpp in Sources */,
@ -8984,10 +9113,12 @@
15AE193E19AAD35100C27E9E /* CCBatchNode.cpp in Sources */,
15AE185919AAD31200C27E9E /* CDAudioManager.m in Sources */,
1A57028B180BCC900088DEC7 /* CCSpriteFrameCache.cpp in Sources */,
15FB209C1AE7C57D00C31518 /* sweep_context.cc in Sources */,
B665E3E31AA80A6600DDB1C5 /* CCPUSineForceAffector.cpp in Sources */,
1A570293180BCCAB0088DEC7 /* CCAnimation.cpp in Sources */,
15AE1AAE19AAD40300C27E9E /* b2ChainAndCircleContact.cpp in Sources */,
15AE194D19AAD35100C27E9E /* CCDataReaderHelper.cpp in Sources */,
15FB20901AE7C57D00C31518 /* advancing_front.cc in Sources */,
15AE1B8C19AADA9A00C27E9E /* UIScale9Sprite.cpp in Sources */,
15AE19AE19AAD39700C27E9E /* PageViewReader.cpp in Sources */,
B68778FD1A8CA82E00643ABF /* CCParticle3DEmitter.cpp in Sources */,
@ -9081,6 +9212,7 @@
5027253D190BF1B900AAF4ED /* cocos2d.cpp in Sources */,
B29A7E0819EE1B7700872B35 /* SkinnedMeshAttachment.c in Sources */,
15AE183919AAD2F700C27E9E /* CCRay.cpp in Sources */,
15FB206B1AE7BE7400C31518 /* PolySprite.cpp in Sources */,
15AE1B8219AADA9A00C27E9E /* UITextBMFont.cpp in Sources */,
50ABBE6A1925AB6F00A911A9 /* CCEventListenerFocus.cpp in Sources */,
50ABBE661925AB6F00A911A9 /* CCEventListenerCustom.cpp in Sources */,
@ -9133,6 +9265,7 @@
B665E29F1AA80A6500DDB1C5 /* CCPUEventHandler.cpp in Sources */,
15AE195519AAD35100C27E9E /* CCDisplayManager.cpp in Sources */,
B665E43B1AA80A6600DDB1C5 /* CCPUVortexAffectorTranslator.cpp in Sources */,
15FB206F1AE7BE7400C31518 /* PolySpriteCache.cpp in Sources */,
15AE1BA719AADFDF00C27E9E /* UIRelativeBox.cpp in Sources */,
15AE1ACE19AAD40300C27E9E /* b2PulleyJoint.cpp in Sources */,
B665E2DF1AA80A6500DDB1C5 /* CCPULineAffector.cpp in Sources */,
@ -9253,7 +9386,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../cocos/editor-support $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../external $(SRCROOT)/../extensions";
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../cocos/editor-support $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../external $(SRCROOT)/../extensions $(SRCROOT)/../external/poly2tri $(SRCROOT)/../external/poly2tri/common $(SRCROOT)/../external/poly2tri/sweep";
};
name = Debug;
};
@ -9286,7 +9419,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../cocos/editor-support $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../external $(SRCROOT)/../extensions";
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../cocos/editor-support $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../external $(SRCROOT)/../extensions $(SRCROOT)/../external/poly2tri $(SRCROOT)/../external/poly2tri/common $(SRCROOT)/../external/poly2tri/sweep";
VALIDATE_PRODUCT = YES;
};
name = Release;

View File

@ -1,5 +1,8 @@
include_directories(
../external/ConvertUTF, .
../external/ConvertUTF
../external/poly2tri
../external/poly2tri/common
../external/poly2tri/sweep
)
set(COCOS_2D_SRC
@ -63,6 +66,9 @@ set(COCOS_2D_SRC
2d/CCSprite.cpp
2d/CCSpriteFrameCache.cpp
2d/CCSpriteFrame.cpp
2d/MarchingSquare.cpp
2d/PolySprite.cpp
2d/PolySpriteCache.cpp
2d/CCTextFieldTTF.cpp
2d/CCTileMapAtlas.cpp
2d/CCTMXLayer.cpp

347
cocos/2d/MarchingSquare.cpp Normal file
View File

@ -0,0 +1,347 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc.
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.
****************************************************************************/
#include "MarchingSquare.h"
#include "cocos2d.h"
#include <algorithm>
USING_NS_CC;
MarchingSquare::MarchingSquare(const std::string &filename, const unsigned int threshold)
{
_filename = filename;
_threshold = threshold;
Image *image = new Image();
image->initWithImageFile(filename);
CCASSERT(image->getRenderFormat()==Texture2D::PixelFormat::RGBA8888, "unsupported format, currently only supports rgba8888");
data = image->getData();
width = image->getWidth();
height = image->getHeight();
}
void MarchingSquare::trace()
{
unsigned int first = findFirstNoneTransparentPixel();
start = Vec2(first%width, first/width);
marchSquare(start.x, start.y);
}
unsigned int MarchingSquare::findFirstNoneTransparentPixel()
{
for(unsigned int i = 0; i < width*height; i++)
{
if(getAlphaAt(i) > _threshold)
{
// CCLOG("first non transparent is at x:%d, y%d", i%width, i/width);
return i;
}
}
throw "image is all transparent!";
}
unsigned char MarchingSquare::getAlphaAt(const unsigned int i)
{
return *(data+i*4+3);
}
unsigned char MarchingSquare::getAlphaAt(const int x, const int y)
{
if(x < 0 || y < 0 || x > width-1 || y > height-1)
return 0;
return *(data+(y*width+x)*4+3);
}
unsigned int MarchingSquare::getSquareValue(int x, int y)
{
/*
checking the 2x2 pixel grid, assigning these values to each pixel, if not transparent
+---+---+
| 1 | 2 |
+---+---+
| 4 | 8 | <- current pixel (curx,cury)
+---+---+
*/
unsigned int sv = 0;
if(getAlphaAt(x-1, y-1) > _threshold)
sv += 1;
if(getAlphaAt(x,y-1) > _threshold)
sv += 2;
if(getAlphaAt(x-1, y) > _threshold)
sv += 4;
if(getAlphaAt(x, y) > _threshold)
sv += 8;
return sv;
}
void MarchingSquare::marchSquare(int startx, int starty)
{
int stepx = 0;
int stepy = 0;
int prevx = 0;
int prevy = 0;
int curx = startx;
int cury = starty;
float halfWidth = width/2.0;
float halfHeight = height/2.0;
unsigned int count = 0;
unsigned int totalPixel = width*height;
bool problem = false;
std::vector<int> case9s;
std::vector<int> case6s;
int i;
std::vector<int>::iterator it;
do{
int sv = getSquareValue(curx, cury);
switch(sv){
case 1:
case 5:
case 13:
/* going UP with these cases:
1 5 13
+---+---+ +---+---+ +---+---+
| 1 | | | 1 | | | 1 | |
+---+---+ +---+---+ +---+---+
| | | | 4 | | | 4 | 8 |
+---+---+ +---+---+ +---+---+
*/
stepx = 0;
stepy = -1;
break;
case 8:
case 10:
case 11:
/* going DOWN with these cases:
8 10 11
+---+---+ +---+---+ +---+---+
| | | | | 2 | | 1 | 2 |
+---+---+ +---+---+ +---+---+
| | 8 | | | 8 | | | 8 |
+---+---+ +---+---+ +---+---+
*/
stepx = 0;
stepy = 1;
break;
case 4:
case 12:
case 14:
/* going LEFT with these cases:
4 12 14
+---+---+ +---+---+ +---+---+
| | | | | | | | 2 |
+---+---+ +---+---+ +---+---+
| 4 | | | 4 | 8 | | 4 | 8 |
+---+---+ +---+---+ +---+---+
*/
stepx = -1;
stepy = 0;
break;
case 2 :
case 3 :
case 7 :
/* going RIGHT with these cases:
2 3 7
+---+---+ +---+---+ +---+---+
| | 2 | | 1 | 2 | | 1 | 2 |
+---+---+ +---+---+ +---+---+
| | | | | | | 4 | |
+---+---+ +---+---+ +---+---+
*/
stepx=1;
stepy=0;
break;
case 9 :
/*
+---+---+
| 1 | |
+---+---+
| | 8 |
+---+---+
this should normaly go UP, but if we already been here, we go down
*/
//find index from xy;
i = getIndexFromPos(curx, cury);
it = find (case9s.begin(), case9s.end(), i);
if (it != case9s.end())
{
//found, so we go down, and delete from case9s;
stepx = 0;
stepy = 1;
case9s.erase(it);
problem = true;
}
else
{
//not found, we go up, and add to case9s;
stepx = 0;
stepy = -1;
case9s.push_back(i);
}
break;
case 6 :
/*
6
+---+---+
| | 2 |
+---+---+
| 4 | |
+---+---+
this normally go RIGHT, but if its coming from UP, it should go LEFT
*/
i = getIndexFromPos(curx, cury);
it = find (case6s.begin(), case6s.end(), i);
if (it != case6s.end())
{
//found, so we go down, and delete from case9s;
stepx = -1;
stepy = 0;
case6s.erase(it);
problem = true;
}
else{
//not found, we go up, and add to case9s;
stepx = 1;
stepy = 0;
case6s.push_back(i);
}
break;
case 0:
CCLOG("case 0 at x:%d, y:%d, coming from %d, %d", curx, cury, prevx, prevy);
throw "this shoudln't happen";
case 15:
CCLOG("case 15 at x:%d, y:%d, coming from %d, %d", curx, cury, prevx, prevy);
throw "this shoudln't happen";
}
//little optimization
// if previous direction is same as current direction,
// then we should modify the last vec to current
curx += stepx;
cury += stepy;
if(stepx == prevx && stepy == prevy)
{
points.back().x = (float)curx-halfWidth;
points.back().y =(float)height-cury-halfHeight;
}
else if(problem)
{
//TODO: we triangulation cannot work collineer points, so we need to modify same point a little
//TODO: maybe we can detect if we go into a hole and coming back the hole, we should extract those points and remove them
points.back().x -= 0.00001;
points.back().y -= 0.00001;
points.push_back(Vec2((float)curx-halfWidth, (float)height-cury-halfHeight));
}
else{
points.push_back(Vec2((float)curx-halfWidth, (float)height-cury-halfHeight));
}
count++;
prevx = stepx;
prevy = stepy;
problem = false;
if(count > totalPixel)
throw "oh no, marching square cannot find starting position";
} while(curx != startx || cury != starty);
}
void MarchingSquare::printPoints()
{
for(auto p : points)
{
CCLOG("%.1f %.1f", p.x, height-p.y);
}
}
float MarchingSquare::perpendicularDistance(cocos2d::Vec2 ii, cocos2d::Vec2 ss, cocos2d::Vec2 ee)
{
float res;
float slope;
float intercept;
if(ss.x == ee.x)
{
res = fabsf(ii.x- ee.x);
}
else if (ss.y == ee.y)
{
res = fabsf(ii.y - ee.y);
}
else{
slope = (ee.y - ss.y) / (ee.x - ss.x);
intercept = ss.y - (slope*ss.x);
res = fabsf(slope * ii.x - ii.y + intercept) / sqrtf(powf(slope, 2)+1);
}
return res;
}
std::vector<cocos2d::Vec2> MarchingSquare::rdp(std::vector<cocos2d::Vec2> v)
{
if(v.size() < 3)
return v;
int index = -1;
float dist = 0;
//not looping first and last point
for(int i = 1; i < v.size()-1; i++)
{
float cdist = perpendicularDistance(v[i], v.front(), v.back());
if(cdist > dist)
{
dist = cdist;
index = i;
}
}
if (dist>epsilon)
{
std::vector<Vec2>::const_iterator begin = v.begin();
std::vector<Vec2>::const_iterator end = v.end();
std::vector<Vec2> l1(begin, begin+index+1);
std::vector<Vec2> l2(begin+index, end);
std::vector<Vec2> r1 = rdp(l1);
std::vector<Vec2> r2 = rdp(l2);
r1.insert(r1.end(), r2.begin()+1, r2.end());
return r1;
}
else {
std::vector<Vec2> ret;
ret.push_back(v.front());
ret.push_back(v.back());
return ret;
}
}
void MarchingSquare::optimize(float level)
{
if(level <= 0 || points.size()<4)
return;
epsilon = level;
points = rdp(points);
}

77
cocos/2d/MarchingSquare.h Normal file
View File

@ -0,0 +1,77 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc.
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 COCOS_2D_MARCHINGSQUARE_H__
#define COCOS_2D_MARCHINGSQUARE_H__
#include <string>
#include <vector>
#include "platform/CCPlatformMacros.h"
#include "math/Vec2.h"
NS_CC_BEGIN
class CC_DLL MarchingSquare
{
public:
MarchingSquare(const std::string &filename, const unsigned int threshold = 0);
//TODO: should return list of vec2s
void trace();
// unsigned int getAlphaAt(const unsigned int i);
// unsigned int getAlphaAt(int x, int y);
void setThreshold(unsigned int threshold){_threshold = threshold;};
unsigned int getThreshold(){return _threshold;};
unsigned int getVecCount(){return points.size();};
std::vector<cocos2d::Vec2> getPoints(){return points;};
void printPoints();
//using RamerDouglasPeucker algorithm
void optimize(float level = 0);
protected:
unsigned int findFirstNoneTransparentPixel();
void marchSquare(int startx, int starty);
unsigned int getSquareValue(int x, int y);
unsigned char * data;
std::string _filename;
unsigned int width;
unsigned int height;
unsigned int _threshold;
unsigned char getAlphaAt(const unsigned int i);
unsigned char getAlphaAt(const int x, const int y);
cocos2d::Vec2 start;
std::vector<cocos2d::Vec2> points;
int getIndexFromPos(int x, int y){return y*width+x;};
cocos2d::Vec2 getPosFromIndex(int i){return cocos2d::Vec2(i%width, i/width);};
float epsilon;
std::vector<cocos2d::Vec2> rdp(std::vector<cocos2d::Vec2> v);
float perpendicularDistance(cocos2d::Vec2 i, cocos2d::Vec2 start, cocos2d::Vec2 end);
};
NS_CC_END
#endif // #ifndef COCOS_2D_MARCHINGSQUARE_H__

435
cocos/2d/PolySprite.cpp Normal file
View File

@ -0,0 +1,435 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc.
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.
****************************************************************************/
#include "PolySprite.h"
#include "3d/CCMesh.h"
#include "3d/CCMeshVertexIndexData.h"
#include "MarchingSquare.h"
#include "base/CCDirector.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCTextureCache.h"
#include "renderer/CCGLProgramState.h"
#include "renderer/CCGLProgramCache.h"
#include <vector>
#include "poly2tri/poly2tri.h"
#include "PolySpriteCache.h"
#include "platform/CCFileUtils.h"
using namespace std;
USING_NS_CC;
using namespace cocos2d::experimental;
PolySprite *PolySprite::create(const std::string& file, std::vector<cocos2d::V3F_C4B_T2F>& verts, std::vector<unsigned short>& indices)
{
PolySprite *ret = new (std::nothrow) PolySprite();
if (ret && ret->initWithVerts(file, verts, indices))
{
ret->autorelease();
return ret;
}
else
{
CC_SAFE_DELETE(ret);
return nullptr;
}
}
PolySprite *PolySprite::create(const std::string& file, std::vector<cocos2d::Vec2>& verts,std::vector<unsigned short>& indices, const cocos2d::Rect& rect, bool rotated)
{
PolySprite *ret = new (std::nothrow) PolySprite();
if (ret && ret->initWithRect(file, verts, indices, rect, rotated))
{
ret->autorelease();
return ret;
}
else
{
CC_SAFE_DELETE(ret);
return nullptr;
}
}
PolySprite *PolySprite::create(const std::string& file, std::vector<cocos2d::Vec2>& verts, const cocos2d::Rect& rect, bool rotated)
{
PolySprite *ret = new (std::nothrow) PolySprite();
if (ret && ret->initWithPoly2tri(file, verts, rect, rotated))
{
ret->autorelease();
return ret;
}
else
{
CC_SAFE_DELETE(ret);
return nullptr;
}
}
PolySprite *PolySprite::create(const std::string &file, const cocos2d::Rect &rect, unsigned short optimization)
{
PolySprite *ret = new (std::nothrow) PolySprite();
if (ret && ret->initWithMarching(file, rect, optimization))
{
ret->autorelease();
return ret;
}
else
{
CC_SAFE_DELETE(ret);
return nullptr;
}
}
static Texture2D * getDummyTexture()
{
auto texture = Director::getInstance()->getTextureCache()->getTextureForKey("/dummyTexture");
if(!texture)
{
unsigned char data[] ={255,0,0,255};//1*1 pure red picture
Image * image =new (std::nothrow) Image();
image->initWithRawData(data,sizeof(data),1,1,sizeof(unsigned char));
texture=Director::getInstance()->getTextureCache()->addImage(image,"/dummyTexture");
image->release();
}
return texture;
}
void PolySprite::triangulate(std::vector<cocos2d::Vec2> & verts)
{
std::vector<p2t::Point*> points;
for(std::vector<Vec2>::const_iterator it = verts.begin(); it<verts.end(); it++)
{
p2t::Point * p = new p2t::Point(it->x, it->y);
points.push_back(p);
}
auto cdt = new p2t::CDT(points);
cdt->Triangulate();
std::vector<p2t::Triangle*> tris = cdt->GetTriangles();
_verts.clear();
_indices.clear();
auto bb = setContentSizeFromVecs(verts);
// auto bb = Rect(_textureRect);
// bb.origin.x = -bb.size.width/2;
// bb.origin.y = -bb.size.height/2;
unsigned short idx = 0;
auto texture = _texture;
auto textureWidth = (float)texture->getPixelsWide();
auto textureHeight = (float)texture->getPixelsHigh();
auto scaledRect = CC_RECT_POINTS_TO_PIXELS(_textureRect);
for(std::vector<p2t::Triangle*>::const_iterator ite = tris.begin(); ite < tris.end(); ite++)
{
for(int i = 0; i < 3; i++)
{
auto p = (*ite)->GetPoint(i);
auto v3 = Vec3(p->x, p->y, 0);
auto c4b = Color4B::WHITE;
auto u = (scaledRect.origin.x + scaledRect.size.width* (p->x - bb.origin.x)/_contentSize.width)/textureWidth;
auto v = (scaledRect.origin.y + scaledRect.size.height* (p->y - bb.origin.y)/_contentSize.height)/textureHeight;
auto t2f = Tex2F(u,1-v);
_verts.push_back(V3F_C4B_T2F{v3,c4b,t2f});
_indices.push_back(idx);
idx++;
}
}
for(auto j : points)
{
delete j;
}
delete cdt;
_triangles = TrianglesCommand::Triangles{&_verts[0], &_indices[0], (ssize_t)_verts.size(), (ssize_t)_indices.size()};
}
bool PolySprite::initWithMarching(const std::string &file, const cocos2d::Rect &rect, unsigned short optimization)
{
CCASSERT(file.size()>0, "Invalid filename for sprite");
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(file);
if (texture)
{
init(texture, rect);
}
else{
throw "some error";
}
std::string fullpath = FileUtils::getInstance()->fullPathForFilename(file);
PolySpriteInfo* info = PolySpriteCache::getInstance()->getPolySpriteCache(fullpath, rect);
if (nullptr != info)
{
_textureRect = info->_textureRect;
_triangles = TrianglesCommand::Triangles{info->_triangles.verts, info->_triangles.indices, info->_triangles.vertCount, info->_triangles.indexCount};
#if CC_SPRITE_DEBUG_DRAW
debugDraw();
#endif
}
//Marching Square
auto marcher = new MarchingSquare(file);
marcher->trace();
// marcher->printPoints();
marcher->optimize(3);
auto p = marcher->getPoints();
auto calculatedRect = setContentSizeFromVecs(p);
_textureRect = Rect(rect.origin.x,rect.origin.y,calculatedRect.size.width, calculatedRect.size.height);
triangulate(p);
delete marcher;
#if CC_SPRITE_DEBUG_DRAW
debugDraw();
#endif
PolySpriteInfo storeInfo = {rect, _triangles, _textureRect };
PolySpriteCache::getInstance()->addPolySpriteCache(fullpath, storeInfo);
return true;
}
bool PolySprite::initWithPoly2tri(const std::string &filename, std::vector<cocos2d::Vec2> & verts, const cocos2d::Rect &Rect, bool rotated)
{
CCASSERT(filename.size()>0, "Invalid filename for sprite");
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
if (texture)
{
init(texture, Rect);
}
else{
throw "some error";
}
triangulate(verts);
#if CC_SPRITE_DEBUG_DRAW
debugDraw();
#endif
return true;
}
bool PolySprite::initWithVerts(const std::string& filename,std::vector<cocos2d::V3F_C4B_T2F>& verts, std::vector<unsigned short>& indices)
{
CCASSERT(filename.size()>0, "Invalid filename for sprite");
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
if (texture)
{
// rect.size = texture->getContentSize();
init(texture);
// return initWithTexture(texture, rect);
}
else{
throw "some error";
}
_verts = verts;
_indices = indices;
_triangles = TrianglesCommand::Triangles{&_verts[0], &_indices[0], (ssize_t)_verts.size(), (ssize_t)_indices.size()};
#if CC_SPRITE_DEBUG_DRAW
debugDraw();
#endif
return true;
}
Rect PolySprite::setContentSizeFromVecs(std::vector<cocos2d::Vec2>& verts)
{
//find min max x,y coords
auto firstV = &verts.front();
auto left = firstV->x;
auto right = firstV->x;
auto top = firstV->y;
auto bot = firstV->y;
for(std::vector<Vec2>::const_iterator i = verts.begin()+1; i<verts.end(); i++)
{
if(i->x < left)
{
left = i->x;
}
else if (i->x > right)
{
right = i->x;
}
if(i->y < bot)
{
bot = i->y;
}
else if (i->y > top)
{
top = i->y;
}
}
auto width = right - left;
auto height = top - bot;
setContentSize(Size(width, height));
return Rect(left,bot,width,height);
}
bool PolySprite::initWithRect(const std::string& filename, std::vector<cocos2d::Vec2>& verts, std::vector<unsigned short>& indices, const cocos2d::Rect& rect, bool rotated)
{
CCASSERT(filename.size()>0, "Invalid filename for sprite");
_rectRotated = rotated;
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
if (texture)
{
init(texture, rect);
}
else{
throw "some error";
}
auto bb = setContentSizeFromVecs(verts);
//build v3f_c4b_t2f verts from vec2 vector
_verts.clear();
_indices.clear();
unsigned short idx = 0;
auto textureWidth = (float)texture->getPixelsWide();
auto textureHeight = (float)texture->getPixelsHigh();
auto scaledRect = CC_RECT_POINTS_TO_PIXELS(rect);
for(std::vector<Vec2>::const_iterator it = verts.begin(); it<verts.end(); it++, idx++)
{
auto v3 = Vec3(it->x, it->y, 0);
auto c4b = Color4B::WHITE;
auto u = (scaledRect.origin.x + scaledRect.size.width* (it->x - bb.origin.x)/_contentSize.width)/textureWidth;
auto v = (scaledRect.origin.y + scaledRect.size.height* (it->y - bb.origin.y)/_contentSize.height)/textureHeight;
auto t2f = Tex2F(u,1-v);
_verts.push_back(V3F_C4B_T2F{v3,c4b,t2f});
// _indices.push_back(idx);
}
_indices = indices;
_triangles = TrianglesCommand::Triangles{&_verts[0], &_indices[0], (ssize_t)_verts.size(), (ssize_t)_indices.size()};
#if CC_SPRITE_DEBUG_DRAW
debugDraw();
#endif
return true;
}
bool PolySprite::init(Texture2D *texture, const Rect &rect)
{
Node::init();
//init the triangles command
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP));
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
setTexture(texture);
_textureRect = (rect.equals(Rect::ZERO))? Rect(0,0,texture->getPixelsWide(), texture->getPixelsHigh()) : rect;
#if CC_SPRITE_DEBUG_DRAW
_debugDrawNode = DrawNode::create();
addChild(_debugDrawNode);
#endif //CC_SPRITE_DEBUG_DRAW
return true;
}
void PolySprite::setTexture(const std::string &filename)
{
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
setTexture(texture);
// Rect rect = Rect::ZERO;
// if (texture)
// rect.size = texture->getContentSize();
// setTextureRect(rect);
}
static unsigned char cc_2x2_white_image[] = {
// RGBA8888
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF
};
#define CC_2x2_WHITE_IMAGE_KEY "/cc_2x2_white_image"
void PolySprite::setTexture(Texture2D *texture)
{
// accept texture==nil as argument
CCASSERT( !texture || dynamic_cast<Texture2D*>(texture), "setTexture expects a Texture2D. Invalid argument");
if (texture == nullptr)
{
// Gets the texture by key firstly.
texture = Director::getInstance()->getTextureCache()->getTextureForKey(CC_2x2_WHITE_IMAGE_KEY);
// If texture wasn't in cache, create it from RAW data.
if (texture == nullptr)
{
Image* image = new (std::nothrow) Image();
bool isOK = image->initWithRawData(cc_2x2_white_image, sizeof(cc_2x2_white_image), 2, 2, 8);
CC_UNUSED_PARAM(isOK);
CCASSERT(isOK, "The 2x2 empty texture was created unsuccessfully.");
texture = Director::getInstance()->getTextureCache()->addImage(image, CC_2x2_WHITE_IMAGE_KEY);
CC_SAFE_RELEASE(image);
}
}
if (_texture != texture)
{
CC_SAFE_RETAIN(texture);
CC_SAFE_RELEASE(_texture);
_texture = texture;
// updateBlendFunc();
}
}
const float PolySprite::getArea(){
float area = 0;
for(int i = 0; i < _indices.size(); i=i+3)
{
auto A = _verts[_indices[i]].vertices;
auto B = _verts[_indices[i+1]].vertices;
auto C = _verts[_indices[i+2]].vertices;
area += (A.x*(B.y-C.y) + B.x*(C.y-A.y) + C.x*(A.y - B.y))/2;
}
return area;
}
void PolySprite::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
{
_tcmd.init(0, _texture->getName(), getGLProgramState(), _blendFunc, _triangles, transform, flags);
renderer->addCommand(&_tcmd);
}
#if CC_SPRITE_DEBUG_DRAW
void PolySprite::debugDraw()
{
//draw all points
auto positions = new (std::nothrow) Vec2[_verts.size()];
for(unsigned int i = 0; i < _verts.size(); i++)
{
positions[i].x = _verts[i].vertices.x;
positions[i].y = _verts[i].vertices.y;
}
_debugDrawNode->drawPoints(positions, _verts.size(), 8, Color4F{0.0,1.0,1.0,1.0});
//draw lines
for(unsigned int i = 0; i < _indices.size()/3; i++)
{
//draw 3 lines
Vec3 from =_verts[_indices[i*3]].vertices;
Vec3 to = _verts[_indices[i*3+1]].vertices;
_debugDrawNode->drawLine(Vec2(from.x, from.y), Vec2(to.x,to.y), Color4F::GREEN);
from =_verts[_indices[i*3+1]].vertices;
to = _verts[_indices[i*3+2]].vertices;
_debugDrawNode->drawLine(Vec2(from.x, from.y), Vec2(to.x,to.y), Color4F::GREEN);
from =_verts[_indices[i*3+2]].vertices;
to = _verts[_indices[i*3]].vertices;
_debugDrawNode->drawLine(Vec2(from.x, from.y), Vec2(to.x,to.y), Color4F::GREEN);
}
CC_SAFE_DELETE_ARRAY(positions);
}
#endif //CC_SPRITE_DEBUG_DRAW

99
cocos/2d/PolySprite.h Normal file
View File

@ -0,0 +1,99 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc.
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 COCOS_2D_POLYSPRITE_H__
#define COCOS_2D_POLYSPRITE_H__
#include <vector>
#include "platform/CCPlatformMacros.h"
#include "2d/CCNode.h"
#include "renderer/CCTrianglesCommand.h"
#include "CCDrawNode.h"
NS_CC_BEGIN
namespace experimental{
class CC_DLL PolySprite : public cocos2d::Node
{
public:
//create with manually created vertices, color and uv and
static PolySprite *create(const std::string&, std::vector<cocos2d::V3F_C4B_T2F>&, std::vector<unsigned short>&);
bool initWithVerts(const std::string&, std::vector<cocos2d::V3F_C4B_T2F>&, std::vector<unsigned short>&);
//create from list of vertices, with texture rect, and triangle indices, UV is calculated from the texture rect
static PolySprite *create(const std::string&, std::vector<cocos2d::Vec2>&, std::vector<unsigned short>&, const cocos2d::Rect& rect = cocos2d::Rect::ZERO, bool rotated = false);
bool initWithRect(const std::string&, std::vector<cocos2d::Vec2>&, std::vector<unsigned short>&, const cocos2d::Rect&, bool);
// //create from ordered list of vertices, with texture rect, and rotated property, Triangles and UV is calculated on the fly
static PolySprite *create(const std::string&, std::vector<cocos2d::Vec2>&, const cocos2d::Rect& rect = cocos2d::Rect::ZERO, bool rotated = false);
bool initWithPoly2tri(const std::string&, std::vector<cocos2d::Vec2>&, const cocos2d::Rect&, bool);
//create from a texture (rect), and automatically trace and optimize the points.
//not recommended for production, its better to use the vec2 list for better performance
static PolySprite *create(const std::string&, const cocos2d::Rect& rect = cocos2d::Rect::ZERO, unsigned short optimization = 1);
bool initWithMarching(const std::string &file, const cocos2d::Rect &rect, unsigned short optimization);
bool init(cocos2d::Texture2D *texture, const cocos2d::Rect &rect = cocos2d::Rect::ZERO);
virtual void setTexture(const std::string &filename );
virtual void setTexture(cocos2d::Texture2D *texture);
/** returns the Texture2D object used by the sprite */
virtual cocos2d::Texture2D* getTexture(){return _texture;};
const float getArea();
const size_t getTrianglesCount(){return _indices.size()/3;};
protected:
#if CC_SPRITE_DEBUG_DRAW
cocos2d::DrawNode *_debugDrawNode;
void debugDraw();
#endif //CC_SPRITE_DEBUG_DRAW
bool _triangleDirty; //if triangle is dirty, then it needs to be recalculated from verts and indices
bool _rectRotated;
std::vector<cocos2d::V3F_C4B_T2F> _verts;
std::vector<unsigned short> _indices;
cocos2d::TrianglesCommand _tcmd;
cocos2d::BlendFunc _blendFunc;
cocos2d::TrianglesCommand::Triangles _triangles;
cocos2d::Texture2D *_texture;
cocos2d::Rect _textureRect;
virtual void draw(cocos2d::Renderer *renderer, const cocos2d::Mat4 &transform, uint32_t flags);
//======Triangulation
void triangulate(std::vector<cocos2d::Vec2> & verts);
cocos2d::Rect setContentSizeFromVecs(std::vector<cocos2d::Vec2>& verts);
//TODO: move those to ccUtils
};
}
NS_CC_END
#endif // #ifndef COCOS_2D_POLYSPRITE_H__

View File

@ -0,0 +1,182 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc.
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.
****************************************************************************/
#include "PolySpriteCache.h"
#include "3d/CCMesh.h"
#include "3d/CCMeshVertexIndexData.h"
#include "base/CCDirector.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCTextureCache.h"
#include "renderer/CCGLProgramState.h"
#include "renderer/CCGLProgramCache.h"
#include <vector>
#include "poly2tri/poly2tri.h"
#include "platform/CCFileUtils.h"
using namespace std;
USING_NS_CC;
PolySpriteCache* PolySpriteCache::_polySpriteCache = nullptr;
PolySpriteCache::PolySpriteCache()
{
}
PolySpriteCache::~PolySpriteCache()
{
}
PolySpriteCache* PolySpriteCache::getInstance()
{
if (NULL == _polySpriteCache)
{
_polySpriteCache = new (std::nothrow) PolySpriteCache();
_polySpriteCache->init();
}
return _polySpriteCache;
}
void PolySpriteCache::destroyInstance()
{
CC_SAFE_DELETE(_polySpriteCache);
}
void PolySpriteCache::init()
{
}
void PolySpriteCache::addPolySpriteCache(const std::string& filePath, const PolySpriteInfo& polySpriteInfo)
{
std::string fullpath = FileUtils::getInstance()->fullPathForFilename(filePath);
if (fullpath.size() == 0)
return;
auto it = _polySpriteCacheMap.find(fullpath);
if (_polySpriteCacheMap.end() != it)
{
VecPolySpriteInfo vecInfo = it->second;
auto infoIt = vecInfo.begin();
for (; infoIt != vecInfo.end(); infoIt++)
{
if ((*infoIt)->_rect.equals(polySpriteInfo._rect))
{
(*infoIt)->_triangles = polySpriteInfo._triangles;
(*infoIt)->_textureRect = polySpriteInfo._textureRect;
return;
}
}
}
VecPolySpriteInfo vecInfo;
vecInfo.clear();
PolySpriteInfo* info = new (std::nothrow)PolySpriteInfo;
if (nullptr != info)
{
info->_rect = polySpriteInfo._rect;
info->_triangles = polySpriteInfo._triangles;
info->_textureRect = polySpriteInfo._textureRect;
vecInfo.push_back(info);
_polySpriteCacheMap[filePath] = vecInfo;
}
}
PolySpriteInfo* PolySpriteCache::getPolySpriteCache(const std::string& filePath, const cocos2d::Rect& rect)
{
std::string fullpath = FileUtils::getInstance()->fullPathForFilename(filePath);
if (fullpath.size() == 0)
return nullptr;
auto it = _polySpriteCacheMap.find(fullpath);
if (_polySpriteCacheMap.end() == it)
return nullptr;
auto infoIter = it->second.begin();
for (; infoIter != it->second.end(); infoIter++)
{
if ((*infoIter)->_rect.equals(rect))
return *infoIter;
}
return nullptr;
}
void PolySpriteCache::removePolySpriteCache(const std::string& filePath, const cocos2d::Rect* rect)
{
std::string fullpath = FileUtils::getInstance()->fullPathForFilename(filePath);
if (fullpath.size() == 0)
return;
auto it = _polySpriteCacheMap.find(fullpath);
if (_polySpriteCacheMap.end() == it)
return;
if (nullptr == rect)
{
}
auto infoIter = it->second.begin();
for (; infoIter != it->second.end(); infoIter++)
{
}
return;
}
void PolySpriteCache::removeAllPolySpriteCache()
{
}
bool PolySpriteCache::isPolySpriteCachExist(const std::string& filePath, const cocos2d::Rect& rect)
{
std::string fullpath = FileUtils::getInstance()->fullPathForFilename(filePath);
if (fullpath.size() == 0)
return false;
auto it = _polySpriteCacheMap.find(fullpath);
if (_polySpriteCacheMap.end() == it)
return false;
auto infoIter = it->second.begin();
for (; infoIter != it->second.end(); infoIter++)
{
if ((*infoIter)->_rect.equals(rect))
return true;
}
return false;
}
USING_NS_CC;

View File

@ -0,0 +1,73 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc.
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 COCOS_2D_POLYSPRITECACHE_H__
#define COCOS_2D_POLYSPRITECACHE_H__
#include <vector>
#include "platform/CCPlatformMacros.h"
#include "2d/CCNode.h"
#include "renderer/CCTrianglesCommand.h"
#include "CCDrawNode.h"
#include "PolySprite.h"
NS_CC_BEGIN
struct CC_DLL PolySpriteInfo
{
cocos2d::Rect _rect;
cocos2d::TrianglesCommand::Triangles _triangles;
cocos2d::Rect _textureRect;
};
typedef std::vector<PolySpriteInfo*> VecPolySpriteInfo;
typedef std::unordered_map<std::string, VecPolySpriteInfo> MapPolySpriteInfo;
class CC_DLL PolySpriteCache: public cocos2d::Ref
{
public:
virtual ~PolySpriteCache();
static PolySpriteCache* getInstance();
static void destroyInstance();
void addPolySpriteCache(const std::string& filePath, const PolySpriteInfo& polySpriteInfo);
PolySpriteInfo* getPolySpriteCache(const std::string& filePath, const cocos2d::Rect& rect);
void removePolySpriteCache(const std::string& filePath, const cocos2d::Rect* rect = nullptr);
void removeAllPolySpriteCache();
bool isPolySpriteCachExist(const std::string& filePath, const cocos2d::Rect& rect);
protected:
PolySpriteCache();
private:
void init();
private:
static PolySpriteCache* _polySpriteCache;
MapPolySpriteInfo _polySpriteCacheMap;
};
NS_CC_END
#endif // #ifndef COCOS_2D_POLYSPRITECACHE_H__

22
cocos/2d/libcocos2d.vcxproj Executable file → Normal file
View File

@ -77,7 +77,7 @@
</PreBuildEvent>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)external\box2d;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\win32;$(EngineRoot)external\jpeg\include\win32;$(EngineRoot)external\tiff\include\win32;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\win32;$(EngineRoot)external\win32-specific\OpenalSoft\include;$(EngineRoot)external\win32-specific\MP3Decoder\include;$(EngineRoot)external\win32-specific\OggDecoder\include;$(EngineRoot)external\win32-specific\icon\include;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\curl\include\win32;$(EngineRoot)external\websockets\include\win32;$(EngineRoot)external;$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)external\box2d;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\win32;$(EngineRoot)external\jpeg\include\win32;$(EngineRoot)external\tiff\include\win32;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\win32;$(EngineRoot)external\win32-specific\OpenalSoft\include;$(EngineRoot)external\win32-specific\MP3Decoder\include;$(EngineRoot)external\win32-specific\OggDecoder\include;$(EngineRoot)external\win32-specific\icon\include;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\curl\include\win32;$(EngineRoot)external\websockets\include\win32;$(EngineRoot)external\poly2tri\common;$(EngineRoot)external\poly2tri\sweep;$(EngineRoot)external\poly2tri;$(EngineRoot)external;$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_USRDLL;_DEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;PROTOBUF_USE_DLLS;LIBPROTOBUF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -132,7 +132,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\debug-lib\*.*"
</Command>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\win32;$(EngineRoot)external\jpeg\include\win32;$(EngineRoot)external\tiff\include\win32;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\win32;$(EngineRoot)external\win32-specific\MP3Decoder\include;$(EngineRoot)external\win32-specific\OggDecoder\include;$(EngineRoot)external\win32-specific\OpenalSoft\include;$(EngineRoot)external\win32-specific\icon\include;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\Box2d;$(EngineRoot)external\curl\include\win32;$(EngineRoot)external\websockets\include\win32\;$(EngineRoot)external;$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\win32;$(EngineRoot)external\jpeg\include\win32;$(EngineRoot)external\tiff\include\win32;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\win32;$(EngineRoot)external\win32-specific\MP3Decoder\include;$(EngineRoot)external\win32-specific\OggDecoder\include;$(EngineRoot)external\win32-specific\OpenalSoft\include;$(EngineRoot)external\win32-specific\icon\include;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\Box2d;$(EngineRoot)external\curl\include\win32;$(EngineRoot)external\websockets\include\win32\;$(EngineRoot)external\poly2tri\common;$(EngineRoot)external\poly2tri\sweep;$(EngineRoot)external\poly2tri;$(EngineRoot)external;$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_USRDLL;NDEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;PROTOBUF_USE_DLLS;LIBPROTOBUF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
@ -367,6 +367,11 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<ClCompile Include="..\..\external\flatbuffers\idl_gen_go.cpp" />
<ClCompile Include="..\..\external\flatbuffers\idl_gen_text.cpp" />
<ClCompile Include="..\..\external\flatbuffers\idl_parser.cpp" />
<ClCompile Include="..\..\external\poly2tri\common\shapes.cc" />
<ClCompile Include="..\..\external\poly2tri\sweep\advancing_front.cc" />
<ClCompile Include="..\..\external\poly2tri\sweep\cdt.cc" />
<ClCompile Include="..\..\external\poly2tri\sweep\sweep.cc" />
<ClCompile Include="..\..\external\poly2tri\sweep\sweep_context.cc" />
<ClCompile Include="..\..\external\tinyxml2\tinyxml2.cpp" />
<ClCompile Include="..\..\external\unzip\ioapi_mem.cpp" />
<ClCompile Include="..\..\external\unzip\ioapi.cpp" />
@ -697,6 +702,9 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<ClCompile Include="CCTransitionPageTurn.cpp" />
<ClCompile Include="CCTransitionProgress.cpp" />
<ClCompile Include="CCTweenFunction.cpp" />
<ClCompile Include="MarchingSquare.cpp" />
<ClCompile Include="PolySprite.cpp" />
<ClCompile Include="PolySpriteCache.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\extensions\assets-manager\AssetsManager.h" />
@ -891,6 +899,13 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<ClInclude Include="..\..\external\json\reader.h" />
<ClInclude Include="..\..\external\json\stringbuffer.h" />
<ClInclude Include="..\..\external\json\writer.h" />
<ClInclude Include="..\..\external\poly2tri\common\shapes.h" />
<ClInclude Include="..\..\external\poly2tri\common\utils.h" />
<ClInclude Include="..\..\external\poly2tri\poly2tri.h" />
<ClInclude Include="..\..\external\poly2tri\sweep\advancing_front.h" />
<ClInclude Include="..\..\external\poly2tri\sweep\cdt.h" />
<ClInclude Include="..\..\external\poly2tri\sweep\sweep.h" />
<ClInclude Include="..\..\external\poly2tri\sweep\sweep_context.h" />
<ClInclude Include="..\..\external\tinyxml2\tinyxml2.h" />
<ClInclude Include="..\..\external\unzip\ioapi_mem.h" />
<ClInclude Include="..\..\external\unzip\ioapi.h" />
@ -1273,6 +1288,9 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<ClInclude Include="CCTransitionPageTurn.h" />
<ClInclude Include="CCTransitionProgress.h" />
<ClInclude Include="CCTweenFunction.h" />
<ClInclude Include="MarchingSquare.h" />
<ClInclude Include="PolySprite.h" />
<ClInclude Include="PolySpriteCache.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\3d\CCAnimationCurve.inl" />

63
cocos/2d/libcocos2d.vcxproj.filters Executable file → Normal file
View File

@ -259,6 +259,15 @@
<Filter Include="cocostudio\reader\WidgetReader\ArmatureNodeReader">
<UniqueIdentifier>{e1848cce-b225-42c4-bb6e-6430b6da123b}</UniqueIdentifier>
</Filter>
<Filter Include="external\poly2tri">
<UniqueIdentifier>{46294cdb-c29a-4480-9988-2e017f5f7846}</UniqueIdentifier>
</Filter>
<Filter Include="external\poly2tri\common">
<UniqueIdentifier>{b0703876-33ee-433c-bba3-45304ce83813}</UniqueIdentifier>
</Filter>
<Filter Include="external\poly2tri\sweep">
<UniqueIdentifier>{c37eceeb-5702-4ff7-88de-94680a22266f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\physics\CCPhysicsBody.cpp">
@ -1794,6 +1803,30 @@
<ClCompile Include="..\editor-support\cocostudio\CocoStudio.cpp">
<Filter>cocostudio\json</Filter>
</ClCompile>
<ClCompile Include="MarchingSquare.cpp">
<Filter>2d</Filter>
</ClCompile>
<ClCompile Include="PolySprite.cpp">
<Filter>2d</Filter>
</ClCompile>
<ClCompile Include="PolySpriteCache.cpp">
<Filter>2d</Filter>
</ClCompile>
<ClCompile Include="..\..\external\poly2tri\common\shapes.cc">
<Filter>external\poly2tri\common</Filter>
</ClCompile>
<ClCompile Include="..\..\external\poly2tri\sweep\advancing_front.cc">
<Filter>external\poly2tri\sweep</Filter>
</ClCompile>
<ClCompile Include="..\..\external\poly2tri\sweep\cdt.cc">
<Filter>external\poly2tri\sweep</Filter>
</ClCompile>
<ClCompile Include="..\..\external\poly2tri\sweep\sweep.cc">
<Filter>external\poly2tri\sweep</Filter>
</ClCompile>
<ClCompile Include="..\..\external\poly2tri\sweep\sweep_context.cc">
<Filter>external\poly2tri\sweep</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\physics\CCPhysicsBody.h">
@ -3512,6 +3545,36 @@
<ClInclude Include="..\editor-support\cocostudio\CCObjectExtensionData.h">
<Filter>cocostudio\json</Filter>
</ClInclude>
<ClInclude Include="MarchingSquare.h">
<Filter>2d</Filter>
</ClInclude>
<ClInclude Include="PolySprite.h">
<Filter>2d</Filter>
</ClInclude>
<ClInclude Include="PolySpriteCache.h">
<Filter>2d</Filter>
</ClInclude>
<ClInclude Include="..\..\external\poly2tri\poly2tri.h">
<Filter>external\poly2tri</Filter>
</ClInclude>
<ClInclude Include="..\..\external\poly2tri\common\shapes.h">
<Filter>external\poly2tri\common</Filter>
</ClInclude>
<ClInclude Include="..\..\external\poly2tri\common\utils.h">
<Filter>external\poly2tri\common</Filter>
</ClInclude>
<ClInclude Include="..\..\external\poly2tri\sweep\advancing_front.h">
<Filter>external\poly2tri\sweep</Filter>
</ClInclude>
<ClInclude Include="..\..\external\poly2tri\sweep\cdt.h">
<Filter>external\poly2tri\sweep</Filter>
</ClInclude>
<ClInclude Include="..\..\external\poly2tri\sweep\sweep.h">
<Filter>external\poly2tri\sweep</Filter>
</ClInclude>
<ClInclude Include="..\..\external\poly2tri\sweep\sweep_context.h">
<Filter>external\poly2tri\sweep</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\math\Mat4.inl">

View File

@ -196,6 +196,13 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\flatbuffers\flatbuffers.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\flatbuffers\idl.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\flatbuffers\util.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\common\shapes.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\common\utils.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\poly2tri.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\sweep\advancing_front.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\sweep\cdt.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\sweep\sweep.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\sweep\sweep_context.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\tinyxml2\tinyxml2.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\unzip\ioapi.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\unzip\ioapi_mem.h" />
@ -594,6 +601,9 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCTransitionPageTurn.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCTransitionProgress.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCTweenFunction.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\MarchingSquare.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\PolySprite.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\PolySpriteCache.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)targetver.h" />
</ItemGroup>
<ItemGroup>
@ -781,6 +791,11 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\flatbuffers\idl_gen_go.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\flatbuffers\idl_gen_text.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\flatbuffers\idl_parser.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\common\shapes.cc" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\sweep\advancing_front.cc" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\sweep\cdt.cc" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\sweep\sweep.cc" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\sweep\sweep_context.cc" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\tinyxml2\tinyxml2.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\unzip\ioapi.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\unzip\ioapi_mem.cpp" />
@ -1146,6 +1161,9 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCTransitionPageTurn.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCTransitionProgress.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCTweenFunction.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\MarchingSquare.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\PolySprite.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\PolySpriteCache.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectCapability Include="SourceItemsFromImports" />

View File

@ -1743,6 +1743,36 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\WICImageLoader-winrt.h">
<Filter>platform\winrt</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\MarchingSquare.h">
<Filter>2d</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\PolySprite.h">
<Filter>2d</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\PolySpriteCache.h">
<Filter>2d</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\common\shapes.h">
<Filter>external\poly2tri\common</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\common\utils.h">
<Filter>external\poly2tri\common</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\sweep\advancing_front.h">
<Filter>external\poly2tri\sweep</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\sweep\cdt.h">
<Filter>external\poly2tri\sweep</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\sweep\sweep.h">
<Filter>external\poly2tri\sweep</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\sweep\sweep_context.h">
<Filter>external\poly2tri\sweep</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\poly2tri.h">
<Filter>external\poly2tri</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\cocos2d.cpp" />
@ -3315,6 +3345,30 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\WICImageLoader-winrt.cpp">
<Filter>platform\winrt</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\MarchingSquare.cpp">
<Filter>2d</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\PolySprite.cpp">
<Filter>2d</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\PolySpriteCache.cpp">
<Filter>2d</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\common\shapes.cc">
<Filter>external\poly2tri\common</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\sweep\advancing_front.cc">
<Filter>external\poly2tri\sweep</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\sweep\cdt.cc">
<Filter>external\poly2tri\sweep</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\sweep\sweep.cc">
<Filter>external\poly2tri\sweep</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\poly2tri\sweep\sweep_context.cc">
<Filter>external\poly2tri\sweep</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="2d">
@ -3563,6 +3617,15 @@
<Filter Include="extension\Particle3D\PU">
<UniqueIdentifier>{ed044d4b-058f-4cee-911e-49fad0a03953}</UniqueIdentifier>
</Filter>
<Filter Include="external\poly2tri">
<UniqueIdentifier>{1567b8a7-947d-4cf9-883d-5e0cd06efffc}</UniqueIdentifier>
</Filter>
<Filter Include="external\poly2tri\common">
<UniqueIdentifier>{292e8d6b-015b-40ad-a77c-8d190940da04}</UniqueIdentifier>
</Filter>
<Filter Include="external\poly2tri\sweep">
<UniqueIdentifier>{932c5f6e-07b3-4b34-97ae-2f3d42024149}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\..\..\cocos2d.def" />

View File

@ -7,7 +7,7 @@
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\angle\include;$(EngineRoot)external\freetype2\include\$(COCOS2D_PLATFORM)\freetype2;$(EngineRoot)external\curl\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\websockets\include\$(COCOS2D_PLATFORM);$(EngineRoot)cocos\platform\winrt;$(EngineRoot)cocos\platform;$(EngineRoot)cocos\editor-support;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\sqlite3\include;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos;$(EngineRoot)extensions;$(EngineRoot)external;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\unzip;$(EngineRoot)external\tinyxml2;$(EngineRoot);$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\xxhash;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\angle\include;$(EngineRoot)external\freetype2\include\$(COCOS2D_PLATFORM)\freetype2;$(EngineRoot)external\curl\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\websockets\include\$(COCOS2D_PLATFORM);$(EngineRoot)cocos\platform\winrt;$(EngineRoot)cocos\platform;$(EngineRoot)cocos\editor-support;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\sqlite3\include;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos;$(EngineRoot)extensions;$(EngineRoot)external;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\unzip;$(EngineRoot)external\tinyxml2;$(EngineRoot);$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\xxhash;$(EngineRoot)external\poly2tri;$(EngineRoot)external\poly2tri\common;$(EngineRoot)external\poly2tri\sweep;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ClCompile>
<PreprocessorDefinitions>WINRT;_VARIADIC_MAX=10;NOMINMAX;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -19,7 +19,7 @@
</ClCompile>
<Link>
<AdditionalDependencies>libGLESv2.lib;libEGL.lib;ws2_32.lib;libwebsockets.lib;libcurl.lib;chipmunk.lib;zlib.lib;freetype.lib;sqlite3.lib;d2d1.lib;d3d11.lib;dxgi.lib;windowscodecs.lib;dwrite.lib;dxguid.lib;xaudio2.lib;mfcore.lib;mfplat.lib;mfreadwrite.lib;mfuuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\angle\prebuilt\$(Platform);$(EngineRoot)external\curl\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\websockets\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\chipmunk\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\zlib\prebuilt\$(Platform);$(EngineRoot)external\sqlite3\libraries\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\freetype2\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);%(AdditionalLibraryDirectories);</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\angle\prebuilt\$(Platform);$(EngineRoot)external\curl\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\websockets\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\chipmunk\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\zlib\prebuilt\$(Platform);$(EngineRoot)external\sqlite3\libraries\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\freetype2\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\poly2tri;$(EngineRoot)external\poly2tri\common;$(EngineRoot)external\poly2tri\sweep;%(AdditionalLibraryDirectories);</AdditionalLibraryDirectories>
<AdditionalOptions>/IGNORE:4264 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>

View File

@ -7,7 +7,7 @@
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(EngineRoot)external\winrt-specific\angle\include;$(EngineRoot)external\freetype2\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\curl\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\websockets\include\$(COCOS2D_PLATFORM);$(EngineRoot)cocos\platform\winrt;$(EngineRoot)cocos\platform;$(EngineRoot)cocos\editor-support;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\sqlite3\include;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos;$(EngineRoot)extensions;$(EngineRoot)external;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\unzip;$(EngineRoot)external\tinyxml2;$(EngineRoot);$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\xxhash;%(AdditionalIncludeDirectories);</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)external\winrt-specific\angle\include;$(EngineRoot)external\freetype2\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\curl\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\websockets\include\$(COCOS2D_PLATFORM);$(EngineRoot)cocos\platform\winrt;$(EngineRoot)cocos\platform;$(EngineRoot)cocos\editor-support;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\sqlite3\include;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos;$(EngineRoot)extensions;$(EngineRoot)external;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\unzip;$(EngineRoot)external\tinyxml2;$(EngineRoot);$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\xxhash;$(EngineRoot)external\poly2tri;$(EngineRoot)external\poly2tri\common;$(EngineRoot)external\poly2tri\sweep;%(AdditionalIncludeDirectories);</AdditionalIncludeDirectories>
</ClCompile>
<ClCompile>
<PreprocessorDefinitions>WINRT;_VARIADIC_MAX=10;NOMINMAX;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -19,7 +19,7 @@
</ClCompile>
<Link>
<AdditionalDependencies>libGLESv2.lib;libEGL.lib;ws2_32.lib;libwebsockets.lib;libcurl.lib;libchipmunk.lib;zlib.lib;libpng.lib;libjpeg.lib;libtiff.lib;freetype250.lib;sqlite3.lib;d2d1.lib;d3d11.lib;dxgi.lib;windowscodecs.lib;dwrite.lib;dxguid.lib;xaudio2.lib;mfcore.lib;mfplat.lib;mfreadwrite.lib;mfuuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(EngineRoot)external\winrt-specific\angle\prebuilt\$(Platform);$(EngineRoot)external\curl\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\websockets\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\chipmunk\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\zlib\prebuilt\$(Platform);$(EngineRoot)external\png\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\tiff\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\jpeg\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\sqlite3\libraries\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\freetype2\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);%(AdditionalLibraryDirectories);</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(EngineRoot)external\winrt-specific\angle\prebuilt\$(Platform);$(EngineRoot)external\curl\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\websockets\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\chipmunk\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\zlib\prebuilt\$(Platform);$(EngineRoot)external\png\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\tiff\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\jpeg\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\sqlite3\libraries\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\freetype2\prebuilt\$(COCOS2D_PLATFORM)\$(Platform);$(EngineRoot)external\poly2tri;$(EngineRoot)external\poly2tri\common;$(EngineRoot)external\poly2tri\sweep;%(AdditionalLibraryDirectories);</AdditionalLibraryDirectories>
<AdditionalOptions>/IGNORE:4264 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>

View File

@ -71,6 +71,9 @@ cocos2d.cpp \
2d/CCSpriteBatchNode.cpp \
2d/CCSpriteFrame.cpp \
2d/CCSpriteFrameCache.cpp \
2d/MarchingSquare.cpp \
2d/PolySprite.cpp \
2d/PolySpriteCache.cpp \
2d/CCTMXLayer.cpp \
2d/CCFastTMXLayer.cpp \
2d/CCTMXObjectGroup.cpp \
@ -192,7 +195,12 @@ physics/CCPhysicsWorld.cpp \
../external/unzip/ioapi.cpp \
../external/unzip/unzip.cpp \
../external/edtaa3func/edtaa3func.cpp \
../external/xxhash/xxhash.c
../external/xxhash/xxhash.c \
../external/poly2tri/common/shapes.cc \
../external/poly2tri/sweep/advancing_front.cc \
../external/poly2tri/sweep/cdt.cc \
../external/poly2tri/sweep/sweep_context.cc \
../external/poly2tri/sweep/sweep.cc
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) \
@ -205,7 +213,10 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/../external/unzip \
$(LOCAL_PATH)/../external/chipmunk/include/chipmunk \
$(LOCAL_PATH)/../external/xxhash \
$(LOCAL_PATH)/../external/nslog
$(LOCAL_PATH)/../external/nslog \
$(LOCAL_PATH)/../external/poly2tri \
$(LOCAL_PATH)/../external/poly2tri/common \
$(LOCAL_PATH)/../external/poly2tri/sweep
LOCAL_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/. \
@ -217,7 +228,10 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/../external/edtaa3func \
$(LOCAL_PATH)/../external/xxhash \
$(LOCAL_PATH)/../external/ConvertUTF \
$(LOCAL_PATH)/../external/nslog
$(LOCAL_PATH)/../external/nslog \
$(LOCAL_PATH)/../external/poly2tri \
$(LOCAL_PATH)/../external/poly2tri/common \
$(LOCAL_PATH)/../external/poly2tri/sweep
LOCAL_EXPORT_LDLIBS := -lGLESv2 \
-llog \
@ -235,6 +249,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dxandroid_static
# define the macro to compile through support/zip_support/ioapi.c
LOCAL_CFLAGS := -DUSE_FILE32API
LOCAL_CFLAGS += -fexceptions
LOCAL_CPPFLAGS := -Wno-deprecated-declarations -Wno-extern-c-compat
LOCAL_EXPORT_CFLAGS := -DUSE_FILE32API
LOCAL_EXPORT_CPPFLAGS := -Wno-deprecated-declarations -Wno-extern-c-compat

View File

@ -68,6 +68,9 @@ include_directories(
platform
../external/ConvertUTF
../external/edtaa3func
../external/poly2tri
../external/poly2tri/common
../external/poly2tri/sweep
)
set(COCOS_PLATFORM_SRC
@ -80,6 +83,11 @@ set(COCOS_PLATFORM_SRC
../external/edtaa3func/edtaa3func.cpp
../external/ConvertUTF/ConvertUTFWrapper.cpp
../external/ConvertUTF/ConvertUTF.c
../external/poly2tri/common/shapes.cc
../external/poly2tri/sweep/advancing_front.cc
../external/poly2tri/sweep/cdt.cc
../external/poly2tri/sweep/sweep_context.cc
../external/poly2tri/sweep/sweep.cc
${COCOS_PLATFORM_SPECIFIC_SRC}
)

View File

@ -0,0 +1,28 @@
Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
http://code.google.com/p/poly2tri/
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Poly2Tri nor the names of its contributors may be
used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"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 THE COPYRIGHT OWNER OR
CONTRIBUTORS 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.