Merge pull request #11656 from minggo/merge-v36

Merge v36
This commit is contained in:
minggo 2015-04-30 14:47:42 +08:00
commit 561e57b47f
93 changed files with 11459 additions and 6868 deletions

View File

@ -1114,6 +1114,9 @@ Developers:
qiutaoleo
Added a feature to check case characters for filename on windows
HueyPark
Fixed memory leak in HttpClient on iOS
Retired Core Developers:
WenSheng Yang

View File

@ -38,7 +38,7 @@ endif()
project (Cocos2d-X)
# The version number
set(COCOS2D_X_VERSION 3.6beta0)
set(COCOS2D_X_VERSION 3.6)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules/")
include(CocosBuildHelpers)

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 /* SpritePolygon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15FB20661AE7BE7400C31518 /* SpritePolygon.cpp */; };
15FB206B1AE7BE7400C31518 /* SpritePolygon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15FB20661AE7BE7400C31518 /* SpritePolygon.cpp */; };
15FB206C1AE7BE7400C31518 /* SpritePolygon.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20671AE7BE7400C31518 /* SpritePolygon.h */; };
15FB206D1AE7BE7400C31518 /* SpritePolygon.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20671AE7BE7400C31518 /* SpritePolygon.h */; };
15FB206E1AE7BE7400C31518 /* SpritePolygonCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15FB20681AE7BE7400C31518 /* SpritePolygonCache.cpp */; };
15FB206F1AE7BE7400C31518 /* SpritePolygonCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15FB20681AE7BE7400C31518 /* SpritePolygonCache.cpp */; };
15FB20701AE7BE7400C31518 /* SpritePolygonCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20691AE7BE7400C31518 /* SpritePolygonCache.h */; };
15FB20711AE7BE7400C31518 /* SpritePolygonCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 15FB20691AE7BE7400C31518 /* SpritePolygonCache.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 /* SpritePolygon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpritePolygon.cpp; sourceTree = "<group>"; };
15FB20671AE7BE7400C31518 /* SpritePolygon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpritePolygon.h; sourceTree = "<group>"; };
15FB20681AE7BE7400C31518 /* SpritePolygonCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpritePolygonCache.cpp; sourceTree = "<group>"; };
15FB20691AE7BE7400C31518 /* SpritePolygonCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpritePolygonCache.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 /* SpritePolygon.cpp */,
15FB20671AE7BE7400C31518 /* SpritePolygon.h */,
15FB20681AE7BE7400C31518 /* SpritePolygonCache.cpp */,
15FB20691AE7BE7400C31518 /* SpritePolygonCache.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 /* SpritePolygonCache.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 /* SpritePolygon.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 /* SpritePolygonCache.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 /* SpritePolygon.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 /* SpritePolygonCache.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 /* SpritePolygon.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 /* SpritePolygon.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 /* SpritePolygonCache.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

@ -803,6 +803,8 @@
59E170151AB42EB10007F2BF /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 826294421AAF071500CB7CF7 /* Security.framework */; };
5EBEECB01995247000429821 /* DrawNode3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EBEECAE1995247000429821 /* DrawNode3D.cpp */; };
5EBEECB11995247000429821 /* DrawNode3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EBEECAE1995247000429821 /* DrawNode3D.cpp */; };
688669711AE8E8B500C2CFD9 /* SpritePolygonTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6886696F1AE8E8B500C2CFD9 /* SpritePolygonTest.cpp */; };
688669721AE8E8B500C2CFD9 /* SpritePolygonTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6886696F1AE8E8B500C2CFD9 /* SpritePolygonTest.cpp */; };
826294431AAF071500CB7CF7 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 826294421AAF071500CB7CF7 /* Security.framework */; };
A05FCACA177C124500BE600E /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64822165F391E007D4F18 /* Cocoa.framework */; };
A07A521E1783A1D20073F6A7 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C6482E165F399D007D4F18 /* libz.dylib */; };
@ -1748,6 +1750,8 @@
59620E8E1921E5CF002021B6 /* Bug-Child.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Bug-Child.h"; sourceTree = "<group>"; };
5EBEECAE1995247000429821 /* DrawNode3D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DrawNode3D.cpp; path = Sprite3DTest/DrawNode3D.cpp; sourceTree = "<group>"; };
5EBEECAF1995247000429821 /* DrawNode3D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DrawNode3D.h; path = Sprite3DTest/DrawNode3D.h; sourceTree = "<group>"; };
6886696F1AE8E8B500C2CFD9 /* SpritePolygonTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpritePolygonTest.cpp; sourceTree = "<group>"; };
688669701AE8E8B500C2CFD9 /* SpritePolygonTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpritePolygonTest.h; sourceTree = "<group>"; };
70A7F72D191D3E4900F0F206 /* shaderTest.psh.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = shaderTest.psh.h; sourceTree = "<group>"; };
70A7F730191D421B00F0F206 /* ShaderTest.vsh.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShaderTest.vsh.h; sourceTree = "<group>"; };
826294421AAF071500CB7CF7 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
@ -2190,6 +2194,7 @@
1AC3592418CECF0A00F37B72 /* Classes */ = {
isa = PBXGroup;
children = (
6886696E1AE8E8A000C2CFD9 /* SpritePolygonTest */,
B603F1AC1AC8EA2E00A9579C /* TerrainTest */,
182C5CB71A95B28A00C30D34 /* CocosStudio3DTest */,
B639932B1A490E9900B07923 /* Particle3DTest */,
@ -3955,6 +3960,15 @@
name = Products;
sourceTree = "<group>";
};
6886696E1AE8E8A000C2CFD9 /* SpritePolygonTest */ = {
isa = PBXGroup;
children = (
6886696F1AE8E8B500C2CFD9 /* SpritePolygonTest.cpp */,
688669701AE8E8B500C2CFD9 /* SpritePolygonTest.h */,
);
path = SpritePolygonTest;
sourceTree = "<group>";
};
A5030C3219D059AB000E78E7 /* OpenURLTest */ = {
isa = PBXGroup;
children = (
@ -4868,6 +4882,7 @@
1AC35B2718CECF0C00F37B72 /* ActionsTest.cpp in Sources */,
1AC35C4918CECF0C00F37B72 /* ShaderTest.cpp in Sources */,
1AC35B4318CECF0C00F37B72 /* Bug-624.cpp in Sources */,
688669711AE8E8B500C2CFD9 /* SpritePolygonTest.cpp in Sources */,
1AC35BF718CECF0C00F37B72 /* SocketIOTest.cpp in Sources */,
1AC35C4F18CECF0C00F37B72 /* SpriteTest.cpp in Sources */,
29080D9D191B595E0066F8DF /* CustomParticleWidgetReader.cpp in Sources */,
@ -5010,6 +5025,7 @@
buildActionMask = 2147483647;
files = (
1AC35B3218CECF0C00F37B72 /* GLES-Render.cpp in Sources */,
688669721AE8E8B500C2CFD9 /* SpritePolygonTest.cpp in Sources */,
1AC35C5418CECF0C00F37B72 /* TextInputTest.cpp in Sources */,
1AC35B4618CECF0C00F37B72 /* Bug-886.cpp in Sources */,
1AC35BE218CECF0C00F37B72 /* CCControlButtonTest.cpp in Sources */,

View File

@ -1313,6 +1313,9 @@ uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFl
}
}
if (!isVisitableByVisitingCamera())
return parentFlags;
uint32_t flags = parentFlags;
flags |= (_transformUpdated ? FLAGS_TRANSFORM_DIRTY : 0);
flags |= (_contentSizeDirty ? FLAGS_CONTENT_SIZE_DIRTY : 0);

View File

@ -292,6 +292,18 @@ void SpriteFrameCache::addSpriteFramesWithFile(const std::string& plist)
}
}
bool SpriteFrameCache::isSpriteFramesWithFileLoaded(const std::string& plist) const
{
bool result = false;
if (_loadedFileNames->find(plist) != _loadedFileNames->end())
{
result = true;
}
return result;
}
void SpriteFrameCache::addSpriteFrame(SpriteFrame* frame, const std::string& frameName)
{
_spriteFrames.insert(frameName, frame);

View File

@ -140,6 +140,15 @@ public:
*/
void addSpriteFrame(SpriteFrame *frame, const std::string& frameName);
/** Check if multiple Sprite Frames from a plist file have been loaded.
* @js NA
* @lua NA
*
* @param plist Plist file name.
* @return True if the file is loaded.
*/
bool isSpriteFramesWithFileLoaded(const std::string& plist) const;
/** Purges the dictionary of loaded sprite frames.
* Call this method if you receive the "Memory Warning".
* In the short term: it will free some resources preventing your app from being killed.

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/SpritePolygon.cpp
2d/SpritePolygonCache.cpp
2d/CCTextFieldTTF.cpp
2d/CCTileMapAtlas.cpp
2d/CCTMXLayer.cpp

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

@ -0,0 +1,354 @@
/****************************************************************************
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();
scaleFactor = Director::getInstance()->getContentScaleFactor();
}
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;
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) / scaleFactor;
points.back().y = (float)(height-cury) / scaleFactor;
}
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, (float)height-cury)/ scaleFactor);
}
else{
points.push_back(Vec2((float)curx, (float)height-cury)/ scaleFactor);
}
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);
auto last = points.back();
if(last.y > points.front().y)
points.front().y = last.y;
points.pop_back();
//delete the last point, because its almost the same as the starting point
// CCLOG("%.1f, %.1f, %.1f, %.1f", points[0].x, points[0].y, points.back().x, points.back().y);
}

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

@ -0,0 +1,78 @@
/****************************************************************************
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 "base/CCConsole.h"
#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();
void setThreshold(unsigned int threshold){_threshold = threshold;};
unsigned int getThreshold(){return _threshold;};
ssize_t 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);
float scaleFactor;
};
NS_CC_END
#endif // #ifndef COCOS_2D_MARCHINGSQUARE_H__

506
cocos/2d/SpritePolygon.cpp Normal file
View File

@ -0,0 +1,506 @@
/****************************************************************************
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 "SpritePolygon.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 "SpritePolygonCache.h"
#include "platform/CCFileUtils.h"
using namespace std;
USING_NS_CC;
using namespace cocos2d::experimental;
SpritePolygon *SpritePolygon::create(const std::string& file, std::vector<cocos2d::V3F_C4B_T2F>& verts, std::vector<unsigned short>& indices)
{
SpritePolygon *ret = new (std::nothrow) SpritePolygon();
if (ret && ret->initWithVerts(file, verts, indices))
{
ret->autorelease();
return ret;
}
else
{
CC_SAFE_DELETE(ret);
return nullptr;
}
}
SpritePolygon *SpritePolygon::create(const std::string& file, std::vector<cocos2d::Vec2>& verts,std::vector<unsigned short>& indices, const cocos2d::Rect& rect)
{
SpritePolygon *ret = new (std::nothrow) SpritePolygon();
if (ret && ret->initWithRect(file, verts, indices, rect))
{
ret->autorelease();
return ret;
}
else
{
CC_SAFE_DELETE(ret);
return nullptr;
}
}
SpritePolygon *SpritePolygon::create(const std::string& file, std::vector<cocos2d::Vec2>& verts, const cocos2d::Rect& rect)
{
SpritePolygon *ret = new (std::nothrow) SpritePolygon();
if (ret && ret->initWithPoly2tri(file, verts, rect))
{
ret->autorelease();
return ret;
}
else
{
CC_SAFE_DELETE(ret);
return nullptr;
}
}
SpritePolygon *SpritePolygon::create(const std::string &file, const cocos2d::Rect &rect, float optimization)
{
SpritePolygon *ret = new (std::nothrow) SpritePolygon();
if (ret)
{
auto info = SpritePolygonCache::getInstance()->getSpritePolygonCache(file, rect);
if(info)
{
// CCLOG("created from cache");
ret->initWithCache(file, info);
}
else{
// CCLOG("created with marching square");
ret->initWithMarching(file, rect, optimization);
}
ret->autorelease();
return ret;
}
else
{
CC_SAFE_DELETE(ret);
return nullptr;
}
}
void SpritePolygon::calculateUVandContentSize()
{
/*
whole texture UV coordination
0,0 1,0
+---------------------+
| |0.1
| |0.2
| +--------+ |0.3
| |texRect | |0.4
| | | |0.5
| | | |0.6
| +--------+ |0.7
| |0.8
| |0.9
+---------------------+
0,1 1,1
because when we scanned the image upside down, our uv is now upside down too
*/
float scaleFactor = Director::getInstance()->getContentScaleFactor();
float texWidth = _texture->getPixelsWide()/scaleFactor;
float texHeight = _texture->getPixelsHigh()/scaleFactor;
// the texture rect in pixels, for example, an image is 32x32 pixels
Rect* textRect = &_polygonInfo->_rect;
bool needDelete = false;
if(textRect->equals(Rect::ZERO))
{
//zero sized rect specified, so it means the whole image, for our calculation, we need actual image rect
textRect = new Rect(0,0, texWidth, texHeight);
needDelete = true;
}
setContentSize(textRect->size);
auto end = &_polygonInfo->_triangles.verts[_polygonInfo->_triangles.vertCount];
for(auto i = _polygonInfo->_triangles.verts; i != end; i++)
{
// for every point, offset with the centerpoint
float u = i->vertices.x / texWidth;
float v = (texHeight - i->vertices.y) / texHeight;
i->texCoords.u = u;
i->texCoords.v = v;
}
if(needDelete)
delete textRect;
}
TrianglesCommand::Triangles SpritePolygon::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();
vector<V3F_C4B_T2F> *_verts = new vector<V3F_C4B_T2F>();
vector<unsigned short> *_indices = new vector<unsigned short>;
unsigned short idx = 0;
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);
bool found = false;
int j;
for(j = 0; j < _verts->size(); j++)
{
if((*_verts)[j].vertices == v3)
{
found = true;
break;
}
}
if(found)
{
//if we found the same vertice, don't add to verts, but use the same vert with indices
_indices->push_back(j);
}
else
{
//vert does not exist yet, so we need to create a new one,
auto c4b = Color4B::WHITE;
auto t2f = Tex2F(0,0); // don't worry about tex coords now, we calculate that later
V3F_C4B_T2F vert = {v3,c4b,t2f};
_verts->push_back(vert);
_indices->push_back(idx);
idx++;
}
}
}
for(auto j : points)
{
delete j;
}
delete cdt;
TrianglesCommand::Triangles triangles = {&(*_verts)[0], &(*_indices)[0], (ssize_t)_verts->size(), (ssize_t)_indices->size()};
return triangles;
}
bool SpritePolygon::initWithCache(const std::string &file, SpritePolygonInfo *info)
{
CCASSERT(file.size()>0, "Invalid filename for sprite");
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(file);
CCASSERT(texture, "texture was not loaded properly");
_polygonInfo = info;
initWithTexture(texture);
if(_polygonInfo->_rect.equals(Rect::ZERO))
{
setContentSize(Size(texture->getPixelsWide(), texture->getPixelsHigh())/Director::getInstance()->getContentScaleFactor());
}
else
{
setContentSize(_polygonInfo->_rect.size);
}
setAnchorPoint(Vec2(0.5,0.5));
return true;
}
bool SpritePolygon::initWithMarching(const std::string &file, const cocos2d::Rect &rect, float optimization)
{
CCASSERT(file.size()>0, "Invalid filename for sprite");
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(file);
CCASSERT(texture, "texture was not loaded properly");
initWithTexture(texture);
optimization = (optimization < 0)? (float)texture->getPixelsHigh()*(float)texture->getPixelsWide()*0.00015/Director::getInstance()->getContentScaleFactor() : optimization/Director::getInstance()->getContentScaleFactor();
//Marching Square
auto marcher = new MarchingSquare(file);
marcher->trace();
marcher->optimize(optimization);
// marcher->test();
auto p = marcher->getPoints();
auto triangles = triangulate(p);
delete marcher;
//save result to cache
_polygonInfo = SpritePolygonCache::getInstance()->addSpritePolygonCache(file, rect, triangles);
setAnchorPoint(Vec2(0.5,0.5));
calculateUVandContentSize();
// SpritePolygonCache::printInfo(*_polygonInfo);
#if CC_SPRITE_DEBUG_DRAW
debugDraw();
#endif
return true;
}
bool SpritePolygon::initWithPoly2tri(const std::string &filename, std::vector<cocos2d::Vec2> & verts, const cocos2d::Rect &Rect)
{
CCASSERT(filename.size()>0, "Invalid filename for sprite");
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
CCASSERT(texture, "texture was not loaded properly");
initWithTexture(texture);
_polygonInfo = SpritePolygonCache::getInstance()->addSpritePolygonCache(filename, Rect, triangulate(verts));
setAnchorPoint(Vec2(0.5,0.5));
calculateUVandContentSize();
#if CC_SPRITE_DEBUG_DRAW
debugDraw();
#endif
return true;
}
Rect SpritePolygon::getTextRectFromTriangles(std::vector<cocos2d::V3F_C4B_T2F>& _verts)
{
// CCASSERT(_polygonInfo, "cannot get texture rect because triangles were not defined");
auto text = getTexture();
int width = text->getPixelsWide();
int height = text->getPixelsHigh();
auto firstV = _verts[0];
auto left = firstV.texCoords.u;
auto right = firstV.texCoords.u;
auto top = firstV.texCoords.v;
auto bot = firstV.texCoords.v;
for(std::vector<V3F_C4B_T2F>::const_iterator v = _verts.begin(); v < _verts.end(); v++)
{
if(v->texCoords.u < left)
{
left = v->texCoords.u;
}
else if (v->texCoords.u > right)
{
right = v->texCoords.u;
}
if(v->texCoords.v < bot)
{
bot = v->texCoords.v;
}
else if (v->texCoords.v > top)
{
top = v->texCoords.v;
}
}
return Rect(left*width, bot*height, right*width, top*height);
}
bool SpritePolygon::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);
CCASSERT(texture, "texture was not loaded properly");
initWithTexture(texture);
auto _textureRect = getTextRectFromTriangles(verts);
setContentSize(_textureRect.size/Director::getInstance()->getContentScaleFactor());
setAnchorPoint(Vec2(0.5,0.5));
_transformDirty = true;
TrianglesCommand::Triangles triangles = {&verts[0], &indices[0], (ssize_t)verts.size(), (ssize_t)indices.size()};
_polygonInfo = SpritePolygonCache::getInstance()->addSpritePolygonCache(filename, _textureRect, triangles);
#if CC_SPRITE_DEBUG_DRAW
debugDraw();
#endif
return true;
}
bool SpritePolygon::initWithRect(const std::string& filename, std::vector<cocos2d::Vec2>& verts, std::vector<unsigned short>& indices, const cocos2d::Rect& rect)
{
CCASSERT(filename.size()>0, "Invalid filename for sprite");
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
CCASSERT(texture, "texture was not loaded properly");
initWithTexture(texture);
//build v3f_c4b_t2f verts from vec2 vector
vector<V3F_C4B_T2F> _verts;
for(std::vector<Vec2>::const_iterator it = verts.begin(); it<verts.end(); it++)
{
auto v3 = Vec3(it->x, it->y, 0);
auto c4b = Color4B::WHITE;
auto t2f = Tex2F(0,0);
V3F_C4B_T2F vert = {v3,c4b,t2f};
_verts.push_back(vert);
}
TrianglesCommand::Triangles triangles = {&_verts[0], &indices[0], (ssize_t)_verts.size(), (ssize_t)indices.size()};
_polygonInfo = SpritePolygonCache::getInstance()->addSpritePolygonCache(filename, rect, triangles);
calculateUVandContentSize();
setAnchorPoint(Vec2(0.5,0.5));
#if CC_SPRITE_DEBUG_DRAW
debugDraw();
#endif
return true;
}
bool SpritePolygon::initWithTexture(Texture2D *texture)
{
Node::init();
//init the triangles command
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP));
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
setTexture(texture);
return true;
}
void SpritePolygon::setTexture(const std::string &filename)
{
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
setTexture(texture);
}
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 SpritePolygon::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;
}
}
const float SpritePolygon::getArea(){
float area = 0;
V3F_C4B_T2F *verts = _polygonInfo->_triangles.verts;
unsigned short *indices = _polygonInfo->_triangles.indices;
for(int i = 0; i < _polygonInfo->_triangles.indexCount; 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 SpritePolygon::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
{
_tcmd.init(0, _texture->getName(), getGLProgramState(), _blendFunc, _polygonInfo->_triangles, transform, flags);
renderer->addCommand(&_tcmd);
}
void SpritePolygon::debugDraw()
{
if(!_debugDrawNode)
{
_debugDrawNode = DrawNode::create();
addChild(_debugDrawNode);
}
else{
_debugDrawNode->clear();
}
//draw all points
auto positions = new (std::nothrow) Vec2[_polygonInfo->_triangles.vertCount];
Vec2 *pos = &positions[0];
auto verts = _polygonInfo->_triangles.verts;
auto end = &verts[_polygonInfo->_triangles.vertCount];
for(V3F_C4B_T2F *v = verts; v != end; pos++, v++)
{
pos->x = v->vertices.x;
pos->y = v->vertices.y;
}
_debugDrawNode->drawPoints(positions, (unsigned int)_polygonInfo->_triangles.vertCount, 8, Color4F(0.0f, 1.0f, 1.0f, 1.0f));
//draw lines
auto last = _polygonInfo->_triangles.indexCount/3;
auto _indices = _polygonInfo->_triangles.indices;
auto _verts = _polygonInfo->_triangles.verts;
for(unsigned int i = 0; i < last; 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);
}
void SpritePolygon::showDebug(const bool val)
{
if(val)
{
if(!_debugDrawNode)
{
debugDraw();
}
else{
_debugDrawNode->setVisible(val);
}
}
else{
if(_debugDrawNode)
{
_debugDrawNode->setVisible(val);
}
}
}

108
cocos/2d/SpritePolygon.h Normal file
View File

@ -0,0 +1,108 @@
/****************************************************************************
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_SpritePolygon_H__
#define COCOS_2D_SpritePolygon_H__
#include <vector>
#include "platform/CCPlatformMacros.h"
#include "2d/CCNode.h"
#include "renderer/CCTrianglesCommand.h"
#include "CCDrawNode.h"
#include "SpritePolygonCache.h"
NS_CC_BEGIN
namespace experimental{
class CC_DLL SpritePolygon : public cocos2d::Node
{
public:
//create with manually created vertices, color and uv and
static SpritePolygon *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 SpritePolygon *create(const std::string&, std::vector<cocos2d::Vec2>&, std::vector<unsigned short>&, const cocos2d::Rect&rect = cocos2d::Rect::ZERO);
bool initWithRect(const std::string&, std::vector<cocos2d::Vec2>&, std::vector<unsigned short>&, const cocos2d::Rect&rect = cocos2d::Rect::ZERO);
// //create from ordered list of vertices, with texture rect, Triangles and UV is calculated on the fly
static SpritePolygon *create(const std::string&, std::vector<cocos2d::Vec2>&, const cocos2d::Rect& rect = cocos2d::Rect::ZERO);
bool initWithPoly2tri(const std::string&, std::vector<cocos2d::Vec2>&, const cocos2d::Rect&);
//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 SpritePolygon *create(const std::string&, const cocos2d::Rect& rect = cocos2d::Rect::ZERO, float optimization = -1);
bool initWithMarching(const std::string &file, const cocos2d::Rect &rect, float optimization);
bool initWithCache(const std::string &file, SpritePolygonInfo *info);
bool initWithTexture(cocos2d::Texture2D *texture);
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 ssize_t getTrianglesCount(){return _polygonInfo->_triangles.indexCount/3;};
const ssize_t getVertCount(){return _polygonInfo->_triangles.vertCount;};
void showDebug(const bool val);
protected:
SpritePolygon()
: _debugDrawNode(nullptr)
, _texture(nullptr)
, _polygonInfo(nullptr)
{
}
cocos2d::DrawNode *_debugDrawNode;
void debugDraw();
void calculateUVandContentSize();
cocos2d::TrianglesCommand _tcmd;
cocos2d::BlendFunc _blendFunc;
cocos2d::Texture2D *_texture;
SpritePolygonInfo *_polygonInfo;
virtual void draw(cocos2d::Renderer *renderer, const cocos2d::Mat4 &transform, uint32_t flags);
cocos2d::Rect getTextRectFromTriangles(std::vector<cocos2d::V3F_C4B_T2F>& verts);
//======Triangulation
cocos2d::TrianglesCommand::Triangles triangulate(std::vector<cocos2d::Vec2> & verts);
//TODO: move those to ccUtils
};
}
NS_CC_END
#endif // #ifndef COCOS_2D_SpritePolygon_H__

View File

@ -0,0 +1,231 @@
/****************************************************************************
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 "SpritePolygonCache.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;
SpritePolygonCache* SpritePolygonCache::_SpritePolygonCache = nullptr;
SpritePolygonCache::SpritePolygonCache()
{
}
SpritePolygonCache::~SpritePolygonCache()
{
}
SpritePolygonCache* SpritePolygonCache::getInstance()
{
if (NULL == _SpritePolygonCache)
{
_SpritePolygonCache = new (std::nothrow) SpritePolygonCache();
_SpritePolygonCache->init();
}
return _SpritePolygonCache;
}
void SpritePolygonCache::destroyInstance()
{
CC_SAFE_DELETE(_SpritePolygonCache);
}
void SpritePolygonCache::init()
{
}
SpritePolygonInfo* SpritePolygonCache::addSpritePolygonCache(const std::string& filePath, const cocos2d::Rect& rect, const cocos2d::TrianglesCommand::Triangles trianglesCommand)
{
auto fullpath = filePath;
auto it = _SpritePolygonCacheMap.find(fullpath);
if (_SpritePolygonCacheMap.end() != it)
{
VecSpritePolygonInfo vecInfo = it->second;
auto infoIt = vecInfo.begin();
for (; infoIt != vecInfo.end(); infoIt++)
{
if ((*infoIt)->_rect.equals(rect))
{
//Update
CC_SAFE_DELETE((*infoIt)->_triangles.verts);
CC_SAFE_DELETE((*infoIt)->_triangles.indices);
(*infoIt)->_triangles.verts = new V3F_C4B_T2F[trianglesCommand.vertCount];
(*infoIt)->_triangles.indices = new unsigned short[trianglesCommand.indexCount];
(*infoIt)->_triangles.vertCount = trianglesCommand.vertCount;
(*infoIt)->_triangles.indexCount = trianglesCommand.indexCount;
memcpy((*infoIt)->_triangles.verts, trianglesCommand.verts, trianglesCommand.vertCount*sizeof(V3F_C4B_T2F));
memcpy((*infoIt)->_triangles.indices, trianglesCommand.indices, trianglesCommand.indexCount*sizeof(unsigned short));
return *infoIt;
}
}
}
VecSpritePolygonInfo vecInfo;
vecInfo.clear();
if (it != _SpritePolygonCacheMap.end())
{
vecInfo = it->second;
}
SpritePolygonInfo* info = new SpritePolygonInfo;
if (nullptr != info)
{
info->_rect = rect;
info->_triangles.verts = new V3F_C4B_T2F[trianglesCommand.vertCount];
info->_triangles.indices = new unsigned short[trianglesCommand.indexCount];
info->_triangles.vertCount = trianglesCommand.vertCount;
info->_triangles.indexCount = trianglesCommand.indexCount;
memcpy(info->_triangles.verts, trianglesCommand.verts, trianglesCommand.vertCount*sizeof(V3F_C4B_T2F));
memcpy(info->_triangles.indices, trianglesCommand.indices, trianglesCommand.indexCount*sizeof(unsigned short));
vecInfo.push_back(info);
_SpritePolygonCacheMap[filePath] = vecInfo;
}
return info;
}
SpritePolygonInfo* SpritePolygonCache::getSpritePolygonCache(const std::string& filePath, const cocos2d::Rect& rect)
{
auto fullpath = filePath;
auto it = _SpritePolygonCacheMap.find(fullpath);
if (_SpritePolygonCacheMap.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 SpritePolygonCache::removeSpritePolygonCache(const std::string& filePath, const cocos2d::Rect* rect)
{
std::string fullpath = FileUtils::getInstance()->fullPathForFilename(filePath);
if (fullpath.size() == 0)
return;
auto it = _SpritePolygonCacheMap.find(fullpath);
if (_SpritePolygonCacheMap.end() == it)
return;
if (nullptr == rect)
return;
auto infoIter = it->second.begin();
for (; infoIter != it->second.end(); infoIter++)
{
if((*infoIter)->_rect.equals(*rect))
{
CC_SAFE_DELETE(*infoIter);
it->second.erase(infoIter);
break;
}
}
return;
}
void SpritePolygonCache::removeAllSpritePolygonCache()
{
for (std::unordered_map<std::string, VecSpritePolygonInfo>::iterator it = _SpritePolygonCacheMap.begin(); it != _SpritePolygonCacheMap.end(); ++it)
{
for (auto infoIter = it->second.begin(); infoIter != it->second.end(); infoIter++)
{
CC_SAFE_DELETE(*infoIter);
}
it->second.clear();
}
_SpritePolygonCacheMap.clear();
}
bool SpritePolygonCache::isSpritePolygonCachExist(const std::string& filePath, const cocos2d::Rect& rect)
{
std::string fullpath = FileUtils::getInstance()->fullPathForFilename(filePath);
if (fullpath.size() == 0)
return false;
auto it = _SpritePolygonCacheMap.find(fullpath);
if (_SpritePolygonCacheMap.end() == it)
return false;
auto infoIter = it->second.begin();
for (; infoIter != it->second.end(); infoIter++)
{
if ((*infoIter)->_rect.equals(rect))
return true;
}
return false;
}
void SpritePolygonCache::printInfo(SpritePolygonInfo &info){
CCLOG("========================");
CCLOG("%zd, %zd", info._triangles.vertCount, info._triangles.indexCount);
auto vertEnd = &info._triangles.verts[info._triangles.vertCount];
for(auto v = info._triangles.verts; v < vertEnd; v++)
{
CCLOG("%f, %f", v->vertices.x, v->vertices.y);
}
auto indEnd = &info._triangles.indices[info._triangles.indexCount];
for(auto i = info._triangles.indices; i < indEnd; i+=3)
{
CCLOG("%d, %d, %d,", *i,*(i+1), *(i+2));
}
auto uvEnd = &info._triangles.verts[info._triangles.vertCount];
for(auto v = info._triangles.verts; v < uvEnd; v++)
{
CCLOG("%f, %f", v->texCoords.u, v->texCoords.v);
}
}
USING_NS_CC;

View File

@ -0,0 +1,85 @@
/****************************************************************************
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_SpritePolygonCACHE_H__
#define COCOS_2D_SpritePolygonCACHE_H__
#include <vector>
#include "platform/CCPlatformMacros.h"
#include "2d/CCNode.h"
#include "renderer/CCTrianglesCommand.h"
#include "CCDrawNode.h"
NS_CC_BEGIN
typedef struct CC_DLL _SpritePolygonInfo
{
cocos2d::Rect _rect;
cocos2d::TrianglesCommand::Triangles _triangles;
~_SpritePolygonInfo()
{
if(nullptr != _triangles.verts)
{
CC_SAFE_DELETE_ARRAY(_triangles.verts);
}
if(nullptr != _triangles.indices)
{
CC_SAFE_DELETE_ARRAY(_triangles.indices);
}
}
} SpritePolygonInfo;
typedef std::vector<SpritePolygonInfo*> VecSpritePolygonInfo;
typedef std::unordered_map<std::string, VecSpritePolygonInfo> MapSpritePolygonInfo;
class CC_DLL SpritePolygonCache: public cocos2d::Ref
{
public:
virtual ~SpritePolygonCache();
static SpritePolygonCache* getInstance();
static void destroyInstance();
SpritePolygonInfo* addSpritePolygonCache(const std::string& filePath, const cocos2d::Rect& rect, const cocos2d::TrianglesCommand::Triangles trianglesCommand);
SpritePolygonInfo* getSpritePolygonCache(const std::string& filePath, const cocos2d::Rect& rect);
void removeSpritePolygonCache(const std::string& filePath, const cocos2d::Rect* rect = nullptr);
void removeAllSpritePolygonCache();
bool isSpritePolygonCachExist(const std::string& filePath, const cocos2d::Rect& rect);
static void printInfo(SpritePolygonInfo &info);
protected:
SpritePolygonCache();
private:
void init();
private:
static SpritePolygonCache* _SpritePolygonCache;
MapSpritePolygonInfo _SpritePolygonCacheMap;
};
NS_CC_END
#endif // #ifndef COCOS_2D_SpritePolygonCACHE_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="SpritePolygon.cpp" />
<ClCompile Include="SpritePolygonCache.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="SpritePolygon.h" />
<ClInclude Include="SpritePolygonCache.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="..\..\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>
<ClCompile Include="MarchingSquare.cpp">
<Filter>2d</Filter>
</ClCompile>
<ClCompile Include="SpritePolygon.cpp">
<Filter>2d</Filter>
</ClCompile>
<ClCompile Include="SpritePolygonCache.cpp">
<Filter>2d</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="..\..\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>
<ClInclude Include="MarchingSquare.h">
<Filter>2d</Filter>
</ClInclude>
<ClInclude Include="SpritePolygon.h">
<Filter>2d</Filter>
</ClInclude>
<ClInclude Include="SpritePolygonCache.h">
<Filter>2d</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)..\..\..\SpritePolygon.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\SpritePolygonCache.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)..\..\..\SpritePolygon.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\SpritePolygonCache.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)..\..\..\..\..\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>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\SpritePolygon.h">
<Filter>2d</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\SpritePolygonCache.h">
<Filter>2d</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)..\..\..\..\..\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>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\SpritePolygon.cpp">
<Filter>2d</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\SpritePolygonCache.cpp">
<Filter>2d</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

@ -111,7 +111,7 @@
<AdditionalOptions>/Zm384 /bigobj %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1\freetype2;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CC_WINDOWS_PHONE_8_1;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>false</SDLCheck>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@ -131,7 +131,7 @@
<AdditionalOptions>/Zm384 /bigobj %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1\freetype2;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CC_WINDOWS_PHONE_8_1;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>false</SDLCheck>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@ -151,7 +151,7 @@
<AdditionalOptions>/Zm384 /bigobj %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1\freetype2;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CC_WINDOWS_PHONE_8_1;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>false</SDLCheck>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@ -171,7 +171,7 @@
<AdditionalOptions>/Zm384 /bigobj %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1\freetype2;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CC_WINDOWS_PHONE_8_1;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>false</SDLCheck>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>

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

@ -69,7 +69,7 @@ bool Animate3D::init(Animation3D* animation)
animation->retain();
setDuration(animation->getDuration());
setOriginInterval(animation->getDuration());
setHighQuality(Configuration::getInstance()->isHighAnimate3DQuality());
setQuality(Configuration::getInstance()->getAnimate3DQuality());
return true;
}
@ -85,7 +85,7 @@ bool Animate3D::init(Animation3D* animation, float fromTime, float duration)
setOriginInterval(duration);
_animation = animation;
animation->retain();
setHighQuality(Configuration::getInstance()->isHighAnimate3DQuality());
setQuality(Configuration::getInstance()->getAnimate3DQuality());
return true;
}
@ -312,58 +312,61 @@ void Animate3D::update(float t)
}
_lastTime = t;
if (_weight > 0.0f)
if (_quality != Animate3DQuality::QUALITY_NONE)
{
float transDst[3], rotDst[4], scaleDst[3];
float* trans = nullptr, *rot = nullptr, *scale = nullptr;
if (_playReverse)
t = 1 - t;
t = _start + t * _last;
for (const auto& it : _boneCurves) {
auto bone = it.first;
auto curve = it.second;
if (curve->translateCurve)
{
curve->translateCurve->evaluate(t, transDst, _translateEvaluate);
trans = &transDst[0];
}
if (curve->rotCurve)
{
curve->rotCurve->evaluate(t, rotDst, _roteEvaluate);
rot = &rotDst[0];
}
if (curve->scaleCurve)
{
curve->scaleCurve->evaluate(t, scaleDst, _scaleEvaluate);
scale = &scaleDst[0];
}
bone->setAnimationValue(trans, rot, scale, this, _weight);
}
for (const auto& it : _nodeCurves)
if (_weight > 0.0f)
{
auto node = it.first;
auto curve = it.second;
Mat4 transform;
if (curve->translateCurve)
{
curve->translateCurve->evaluate(t, transDst, _translateEvaluate);
transform.translate(transDst[0], transDst[1], transDst[2]);
float transDst[3], rotDst[4], scaleDst[3];
float* trans = nullptr, *rot = nullptr, *scale = nullptr;
if (_playReverse)
t = 1 - t;
t = _start + t * _last;
for (const auto& it : _boneCurves) {
auto bone = it.first;
auto curve = it.second;
if (curve->translateCurve)
{
curve->translateCurve->evaluate(t, transDst, _translateEvaluate);
trans = &transDst[0];
}
if (curve->rotCurve)
{
curve->rotCurve->evaluate(t, rotDst, _roteEvaluate);
rot = &rotDst[0];
}
if (curve->scaleCurve)
{
curve->scaleCurve->evaluate(t, scaleDst, _scaleEvaluate);
scale = &scaleDst[0];
}
bone->setAnimationValue(trans, rot, scale, this, _weight);
}
if (curve->rotCurve)
for (const auto& it : _nodeCurves)
{
curve->rotCurve->evaluate(t, rotDst, _roteEvaluate);
Quaternion qua(rotDst[0], rotDst[1], rotDst[2], rotDst[3]);
transform.rotate(qua);
auto node = it.first;
auto curve = it.second;
Mat4 transform;
if (curve->translateCurve)
{
curve->translateCurve->evaluate(t, transDst, _translateEvaluate);
transform.translate(transDst[0], transDst[1], transDst[2]);
}
if (curve->rotCurve)
{
curve->rotCurve->evaluate(t, rotDst, _roteEvaluate);
Quaternion qua(rotDst[0], rotDst[1], rotDst[2], rotDst[3]);
transform.rotate(qua);
}
if (curve->scaleCurve)
{
curve->scaleCurve->evaluate(t, scaleDst, _scaleEvaluate);
transform.scale(scaleDst[0], scaleDst[1], scaleDst[2]);
}
node->setAdditionalTransform(&transform);
}
if (curve->scaleCurve)
{
curve->scaleCurve->evaluate(t, scaleDst, _scaleEvaluate);
transform.scale(scaleDst[0], scaleDst[1], scaleDst[2]);
}
node->setAdditionalTransform(&transform);
}
}
}
@ -391,26 +394,26 @@ void Animate3D::setOriginInterval(float interval)
_originInterval = interval;
}
void Animate3D::setHighQuality(bool isHighQuality)
void Animate3D::setQuality(Animate3DQuality quality)
{
if (isHighQuality)
if (quality == Animate3DQuality::QUALITY_HIGH)
{
_translateEvaluate = EvaluateType::INT_LINEAR;
_roteEvaluate = EvaluateType::INT_QUAT_SLERP;
_scaleEvaluate = EvaluateType::INT_LINEAR;
}
else
else if(quality == Animate3DQuality::QUALITY_LOW)
{
_translateEvaluate = EvaluateType::INT_NEAR;
_roteEvaluate = EvaluateType::INT_NEAR;
_scaleEvaluate = EvaluateType::INT_NEAR;
}
_isHighQuality = isHighQuality;
_quality = quality;
}
bool Animate3D::isHighQuality() const
Animate3DQuality Animate3D::getQuality() const
{
return _isHighQuality;
return _quality;
}
Animate3D::Animate3D()
@ -425,7 +428,7 @@ Animate3D::Animate3D()
, _lastTime(0.0f)
, _originInterval(0.0f)
{
setHighQuality(true);
setQuality(Animate3DQuality::QUALITY_HIGH);
}
Animate3D::~Animate3D()
{

View File

@ -38,6 +38,14 @@ NS_CC_BEGIN
class Bone3D;
class Sprite3D;
enum class Animate3DQuality
{
QUALITY_NONE = 0, // it'll be ignore the curve-evaluating(the animation looks like stop), just acculate transition time.
QUALITY_LOW, // low animation quality, it'll be more efficient.
QUALITY_HIGH, // high animation quality.
};
/**
* @addtogroup _3d
* @{
@ -105,16 +113,11 @@ public:
CC_DEPRECATED_ATTRIBUTE bool getPlayBack() const { return _playReverse; }
CC_DEPRECATED_ATTRIBUTE void setPlayBack(bool reverse) { _playReverse = reverse; }
/**set high quality
* The default value is based on Configuration::isHighAnimate3DQuality(). You can configure it in the config.plist. However, you can modify it using the following function
* @param true: is high quality, false: is low quality.
*/
void setHighQuality(bool isHighQuality);
/**set animate quality*/
void setQuality(Animate3DQuality quality);
/**get high quality
* is it high quality
*/
bool isHighQuality() const;
/**get animate quality*/
Animate3DQuality getQuality() const;
CC_CONSTRUCTOR_ACCESS:
@ -153,7 +156,7 @@ protected:
EvaluateType _translateEvaluate;
EvaluateType _roteEvaluate;
EvaluateType _scaleEvaluate;
bool _isHighQuality; // true: is high quality, false: is low quality
Animate3DQuality _quality;
std::unordered_map<Bone3D*, Animation3D::Curve*> _boneCurves; //weak ref
std::unordered_map<Node*, Animation3D::Curve*> _nodeCurves;

View File

@ -114,8 +114,8 @@ AnimationCurve<componentSize>::AnimationCurve()
template <int componentSize>
AnimationCurve<componentSize>::~AnimationCurve()
{
CC_SAFE_DELETE(_keytime);
CC_SAFE_DELETE(_value);
CC_SAFE_DELETE_ARRAY(_keytime);
CC_SAFE_DELETE_ARRAY(_value);
}
template <int componentSize>

View File

@ -487,6 +487,7 @@ bool Bundle3D::loadMeshDatasBinary_0_1(MeshDatas& meshdatas)
if (_binaryReader.read(&attribSize, 4, 1) != 1 || attribSize < 1)
{
CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
CC_SAFE_DELETE(meshdata);
return false;
}
enum
@ -509,6 +510,7 @@ bool Bundle3D::loadMeshDatasBinary_0_1(MeshDatas& meshdatas)
if (_binaryReader.read(&vUsage, 4, 1) != 1 || _binaryReader.read(&vSize, 4, 1) != 1)
{
CCLOG("warning: Failed to read meshdata: usage or size '%s'.", _path.c_str());
CC_SAFE_DELETE(meshdata);
return false;
}
@ -545,6 +547,7 @@ bool Bundle3D::loadMeshDatasBinary_0_1(MeshDatas& meshdatas)
if (_binaryReader.read(&meshdata->vertexSizeInFloat, 4, 1) != 1 || meshdata->vertexSizeInFloat == 0)
{
CCLOG("warning: Failed to read meshdata: vertexSizeInFloat '%s'.", _path.c_str());
CC_SAFE_DELETE(meshdata);
return false;
}
@ -552,6 +555,7 @@ bool Bundle3D::loadMeshDatasBinary_0_1(MeshDatas& meshdatas)
if (_binaryReader.read(&meshdata->vertex[0], 4, meshdata->vertexSizeInFloat) != meshdata->vertexSizeInFloat)
{
CCLOG("warning: Failed to read meshdata: vertex element '%s'.", _path.c_str());
CC_SAFE_DELETE(meshdata);
return false;
}
@ -563,6 +567,7 @@ bool Bundle3D::loadMeshDatasBinary_0_1(MeshDatas& meshdatas)
if (_binaryReader.read(&nIndexCount, 4, 1) != 1)
{
CCLOG("warning: Failed to read meshdata: nIndexCount '%s'.", _path.c_str());
CC_SAFE_DELETE(meshdata);
return false;
}
@ -571,6 +576,7 @@ bool Bundle3D::loadMeshDatasBinary_0_1(MeshDatas& meshdatas)
if (_binaryReader.read(&indices[0], 2, nIndexCount) != nIndexCount)
{
CCLOG("warning: Failed to read meshdata: indices '%s'.", _path.c_str());
CC_SAFE_DELETE(meshdata);
return false;
}
@ -596,6 +602,7 @@ bool Bundle3D::loadMeshDatasBinary_0_2(MeshDatas& meshdatas)
if (_binaryReader.read(&attribSize, 4, 1) != 1 || attribSize < 1)
{
CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
CC_SAFE_DELETE(meshdata);
return false;
}
enum
@ -618,6 +625,7 @@ bool Bundle3D::loadMeshDatasBinary_0_2(MeshDatas& meshdatas)
if (_binaryReader.read(&vUsage, 4, 1) != 1 || _binaryReader.read(&vSize, 4, 1) != 1)
{
CCLOG("warning: Failed to read meshdata: usage or size '%s'.", _path.c_str());
CC_SAFE_DELETE(meshdata);
return false;
}
@ -654,6 +662,7 @@ bool Bundle3D::loadMeshDatasBinary_0_2(MeshDatas& meshdatas)
if (_binaryReader.read(&meshdata->vertexSizeInFloat, 4, 1) != 1 || meshdata->vertexSizeInFloat == 0)
{
CCLOG("warning: Failed to read meshdata: vertexSizeInFloat '%s'.", _path.c_str());
CC_SAFE_DELETE(meshdata);
return false;
}
@ -661,6 +670,7 @@ bool Bundle3D::loadMeshDatasBinary_0_2(MeshDatas& meshdatas)
if (_binaryReader.read(&meshdata->vertex[0], 4, meshdata->vertexSizeInFloat) != meshdata->vertexSizeInFloat)
{
CCLOG("warning: Failed to read meshdata: vertex element '%s'.", _path.c_str());
CC_SAFE_DELETE(meshdata);
return false;
}
@ -669,6 +679,7 @@ bool Bundle3D::loadMeshDatasBinary_0_2(MeshDatas& meshdatas)
if (_binaryReader.read(&submeshCount, 4, 1) != 1)
{
CCLOG("warning: Failed to read meshdata: submeshCount '%s'.", _path.c_str());
CC_SAFE_DELETE(meshdata);
return false;
}
@ -678,6 +689,7 @@ bool Bundle3D::loadMeshDatasBinary_0_2(MeshDatas& meshdatas)
if (_binaryReader.read(&nIndexCount, 4, 1) != 1)
{
CCLOG("warning: Failed to read meshdata: nIndexCount '%s'.", _path.c_str());
CC_SAFE_DELETE(meshdata);
return false;
}
@ -686,6 +698,7 @@ bool Bundle3D::loadMeshDatasBinary_0_2(MeshDatas& meshdatas)
if (_binaryReader.read(&indices[0], 2, nIndexCount) != nIndexCount)
{
CCLOG("warning: Failed to read meshdata: indices '%s'.", _path.c_str());
CC_SAFE_DELETE(meshdata);
return false;
}
@ -815,6 +828,7 @@ bool Bundle3D::loadNodes(NodeDatas& nodedatas)
modelnode->invBindPose = skinData.inverseBindPoseMatrices;
node->modelNodeDatas.push_back(modelnode);
nodedatas.nodes.push_back(node);
delete[] nodeDatas;
}
else
{
@ -1002,8 +1016,8 @@ bool Bundle3D::loadJson(const std::string& path)
_jsonBuffer[size] = '\0';
if (_jsonReader.ParseInsitu<0>(_jsonBuffer).HasParseError())
{
CCASSERT(false, "Parse json failed");
clear();
CCASSERT(false, "Parse json failed");
return false;
}
@ -1663,6 +1677,8 @@ NodeData* Bundle3D::parseNodesRecursivelyJson(const rapidjson::Value& jvalue, bo
if (modelnodedata->subMeshId == "" || modelnodedata->matrialId == "")
{
CCLOG("warning: Node %s part is missing meshPartId or materialId", nodedata->id.c_str());
CC_SAFE_DELETE(modelnodedata);
CC_SAFE_DELETE(nodedata);
return nullptr;
}
@ -1678,6 +1694,8 @@ NodeData* Bundle3D::parseNodesRecursivelyJson(const rapidjson::Value& jvalue, bo
if (!bone.HasMember(NODE))
{
CCLOG("warning: Bone node ID missing");
CC_SAFE_DELETE(modelnodedata);
CC_SAFE_DELETE(nodedata);
return nullptr;
}
@ -1804,6 +1822,8 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton, bool singleSprit
{
std::string err = "Node " + nodedata->id + " part is missing meshPartId or materialId";
CCLOG("Node %s part is missing meshPartId or materialId", nodedata->id.c_str());
CC_SAFE_DELETE(modelnodedata);
CC_SAFE_DELETE(nodedata);
return nullptr;
}
@ -1812,6 +1832,8 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton, bool singleSprit
if (_binaryReader.read(&bonesSize, 4, 1) != 1)
{
CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
CC_SAFE_DELETE(modelnodedata);
CC_SAFE_DELETE(nodedata);
return nullptr;
}
@ -1825,6 +1847,8 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton, bool singleSprit
Mat4 invbindpos;
if (!_binaryReader.readMatrix(invbindpos.m))
{
CC_SAFE_DELETE(modelnodedata);
CC_SAFE_DELETE(nodedata);
return nullptr;
}
@ -1836,6 +1860,8 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton, bool singleSprit
if (_binaryReader.read(&uvMapping, 4, 1) != 1)
{
CCLOG("warning: Failed to read nodedata: uvMapping '%s'.", _path.c_str());
CC_SAFE_DELETE(modelnodedata);
CC_SAFE_DELETE(nodedata);
return nullptr;
}
for(unsigned int j = 0; j < uvMapping; j++)
@ -1844,6 +1870,8 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton, bool singleSprit
if (_binaryReader.read(&textureIndexSize, 4, 1) != 1)
{
CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
CC_SAFE_DELETE(modelnodedata);
CC_SAFE_DELETE(nodedata);
return nullptr;
}
for(unsigned int k = 0; k < textureIndexSize; k++)
@ -1851,6 +1879,8 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton, bool singleSprit
unsigned int index=0;
if (_binaryReader.read(&index, 4, 1) != 1)
{
CC_SAFE_DELETE(modelnodedata);
CC_SAFE_DELETE(nodedata);
return nullptr;
}
}
@ -1880,6 +1910,7 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton, bool singleSprit
if (_binaryReader.read(&childrenSize, 4, 1) != 1)
{
CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
CC_SAFE_DELETE(nodedata);
return nullptr;
}
if (childrenSize > 0)
@ -2081,14 +2112,14 @@ Reference* Bundle3D::seekToFirstType(unsigned int type, const std::string& id)
}
Bundle3D::Bundle3D()
: _modelPath(""),
_path(""),
_version(""),
_jsonBuffer(nullptr),
_binaryBuffer(nullptr),
_referenceCount(0),
_references(nullptr),
_isBinary(false)
: _modelPath(""),
_path(""),
_version(""),
_jsonBuffer(nullptr),
_binaryBuffer(nullptr),
_referenceCount(0),
_references(nullptr),
_isBinary(false)
{
}

View File

@ -117,6 +117,11 @@ struct NodeDatas
std::vector<NodeData*> skeleton; //skeleton
std::vector<NodeData*> nodes; // nodes, CCNode, Sprite3D or part of Sprite3D
virtual ~NodeDatas()
{
resetData();
}
void resetData()
{
for(auto& it : skeleton)

View File

@ -479,7 +479,8 @@ void Sprite3D::createNode(NodeData* nodedata, Node* root, const MaterialDatas& m
{
if(it->bones.size() > 0 || singleSprite)
{
this->setName(nodedata->id);
if(singleSprite)
root->setName(nodedata->id);
auto mesh = Mesh::create(nodedata->id, getMeshIndexData(it->subMeshId));
if(mesh)
{
@ -644,14 +645,18 @@ void Sprite3D::removeAllAttachNode()
}
_attachments.clear();
}
#if (!defined NDEBUG) || (defined CC_MODEL_VIEWER)
//Generate a dummy texture when the texture file is missing
static Texture2D * getDummyTexture()
{
auto texture = Director::getInstance()->getTextureCache()->getTextureForKey("/dummyTexture");
if(!texture)
{
unsigned char data[] ={255,0,0,255};//1*1 pure red picture
#ifdef NDEBUG
unsigned char data[] ={0,0,0,0};//1*1 transparent picture
#else
unsigned char data[] ={255,0,0,255};//1*1 red picture
#endif
Image * image =new (std::nothrow) Image();
image->initWithRawData(data,sizeof(data),1,1,sizeof(unsigned char));
texture=Director::getInstance()->getTextureCache()->addImage(image,"/dummyTexture");
@ -659,7 +664,6 @@ static Texture2D * getDummyTexture()
}
return texture;
}
#endif
void Sprite3D::visit(cocos2d::Renderer *renderer, const cocos2d::Mat4 &parentTransform, uint32_t parentFlags)
{
@ -748,7 +752,6 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
auto programstate = mesh->getGLProgramState();
auto& meshCommand = mesh->getMeshCommand();
#if (!defined NDEBUG) || (defined CC_MODEL_VIEWER)
GLuint textureID = 0;
if(mesh->getTexture())
{
@ -760,10 +763,6 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
textureID = texture->getName();
}
#else
GLuint textureID = mesh->getTexture() ? mesh->getTexture()->getName() : 0;
#endif
bool isTransparent = (mesh->_isTransparent || color.a < 1.f);
float globalZ = isTransparent ? 0 : _globalZOrder;
if (isTransparent)

View File

@ -71,6 +71,9 @@ cocos2d.cpp \
2d/CCSpriteBatchNode.cpp \
2d/CCSpriteFrame.cpp \
2d/CCSpriteFrameCache.cpp \
2d/MarchingSquare.cpp \
2d/SpritePolygon.cpp \
2d/SpritePolygonCache.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

@ -50,7 +50,7 @@ Configuration::Configuration()
, _maxDirLightInShader(1)
, _maxPointLightInShader(1)
, _maxSpotLightInShader(1)
, _isAnimate3DHighQuality(true)
, _animate3DQuality(Animate3DQuality::QUALITY_HIGH)
{
}
@ -263,9 +263,9 @@ int Configuration::getMaxSupportSpotLightInShader() const
return _maxSpotLightInShader;
}
bool Configuration::isHighAnimate3DQuality() const
Animate3DQuality Configuration::getAnimate3DQuality() const
{
return _isAnimate3DHighQuality;
return _animate3DQuality;
}
//
@ -357,11 +357,11 @@ void Configuration::loadConfigFile(const std::string& filename)
else
_valueDict[name] = Value(_maxSpotLightInShader);
name = "cocos2d.x.3d.animate_high_quality";
name = "cocos2d.x.3d.animate_quality";
if (_valueDict.find(name) != _valueDict.end())
_isAnimate3DHighQuality = _valueDict[name].asBool();
_animate3DQuality = (Animate3DQuality)_valueDict[name].asInt();
else
_valueDict[name] = Value(_isAnimate3DHighQuality);
_valueDict[name] = Value((int)_animate3DQuality);
}
NS_CC_END

View File

@ -32,6 +32,7 @@ THE SOFTWARE.
#include "base/CCRef.h"
#include "base/CCValue.h"
#include "platform/CCGL.h"
#include "3d/CCAnimate3D.h"
/**
* @addtogroup base
@ -164,11 +165,8 @@ public:
*/
int getMaxSupportSpotLightInShader() const;
/** is 3d animate quality? Configure it in the config.plist, the key is cocos2d.x.3d.animate_high_quality, it is true by default.
* Animation quality of created Animate3D is based on the return value. However, animation quality of Animate3D can be modified by calling setHighQuality after it is created.
* @return true: is high quality, false: is low quality
*/
bool isHighAnimate3DQuality() const;
/** get 3d animate quality*/
Animate3DQuality getAnimate3DQuality() const;
/** Returns whether or not an OpenGL is supported.
*
@ -236,7 +234,7 @@ protected:
int _maxDirLightInShader; //max support directional light in shader
int _maxPointLightInShader; // max support point light in shader
int _maxSpotLightInShader; // max support spot light in shader
bool _isAnimate3DHighQuality; // animation 3d quality, true: is high quality, false: is low quality
Animate3DQuality _animate3DQuality; // animate 3d quality
ValueMap _valueDict;
};

View File

@ -31,7 +31,7 @@ NS_CC_BEGIN
CC_DLL const char* cocos2dVersion()
{
return "cocos2d-x 3.6beta0";
return "cocos2d-x 3.6";
}
NS_CC_END

View File

@ -225,7 +225,7 @@ void RotationFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void RotationFrame::onApply(float percent)
{
if (_betwennRotation != 0)
if (nullptr != _node && _betwennRotation != 0)
{
float rotation = _rotation + percent * _betwennRotation;
_node->setRotation(rotation);
@ -282,7 +282,7 @@ void SkewFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void SkewFrame::onApply(float percent)
{
if (_betweenSkewX != 0 || _betweenSkewY != 0)
if (nullptr != _node && _betweenSkewX != 0 || _betweenSkewY != 0)
{
float skewx = _skewX + percent * _betweenSkewX;
float skewy = _skewY + percent * _betweenSkewY;
@ -342,7 +342,7 @@ void RotationSkewFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void RotationSkewFrame::onApply(float percent)
{
if (_betweenSkewX != 0 || _betweenSkewY != 0)
if (nullptr != _node && _betweenSkewX != 0 || _betweenSkewY != 0)
{
float skewx = _skewX + percent * _betweenSkewX;
float skewy = _skewY + percent * _betweenSkewY;
@ -400,7 +400,7 @@ void PositionFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void PositionFrame::onApply(float percent)
{
if (_betweenX != 0 || _betweenY != 0)
if (nullptr != _node && (_betweenX != 0 || _betweenY != 0))
{
Point p;
p.x = _position.x + _betweenX * percent;
@ -460,7 +460,7 @@ void ScaleFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void ScaleFrame::onApply(float percent)
{
if (_betweenScaleX != 0 || _betweenScaleY != 0)
if (nullptr != _node && _betweenScaleX != 0 || _betweenScaleY != 0)
{
float scaleX = _scaleX + _betweenScaleX * percent;
float scaleY = _scaleY + _betweenScaleY * percent;
@ -694,7 +694,7 @@ void ColorFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void ColorFrame::onApply(float percent)
{
if (_betweenRed != 0 || _betweenGreen != 0 || _betweenBlue != 0)
if (nullptr != _node && _betweenRed != 0 || _betweenGreen != 0 || _betweenBlue != 0)
{
Color3B color;
color.r = _color.r+ _betweenRed * percent;
@ -750,8 +750,11 @@ void AlphaFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void AlphaFrame::onApply(float percent)
{
GLubyte alpha = _alpha + _betweenAlpha * percent;
_node->setOpacity(alpha);
if (nullptr != _node)
{
GLubyte alpha = _alpha + _betweenAlpha * percent;
_node->setOpacity(alpha);
}
}
Frame* AlphaFrame::clone()

View File

@ -1334,10 +1334,13 @@ void DataReaderHelper::addDataFromJsonCache(const std::string& fileContent, Data
{
std::string plistPath = filePath + ".plist";
std::string pngPath = filePath + ".png";
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(dataInfo->baseFilePath + plistPath);
if (dict.find("particleLifespan") != dict.end()) continue;
if (FileUtils::getInstance()->isFileExist(dataInfo->baseFilePath + plistPath) && FileUtils::getInstance()->isFileExist(dataInfo->baseFilePath + pngPath))
{
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(dataInfo->baseFilePath + plistPath);
if (dict.find("particleLifespan") != dict.end()) continue;
ArmatureDataManager::getInstance()->addSpriteFrameFromFile((dataInfo->baseFilePath + plistPath).c_str(), (dataInfo->baseFilePath + pngPath).c_str(), dataInfo->filename.c_str());
ArmatureDataManager::getInstance()->addSpriteFrameFromFile((dataInfo->baseFilePath + plistPath).c_str(), (dataInfo->baseFilePath + pngPath).c_str(), dataInfo->filename.c_str());
}
}
}
}

View File

@ -469,11 +469,20 @@ namespace cocostudio
label->enableShadow(shadowColor, Size(options->shadowOffsetX(), options->shadowOffsetY()), options->shadowBlurRadius());
}
}
// Save node color before set widget properties
auto oldColor = node->getColor();
auto widgetReader = WidgetReader::getInstance();
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
// restore node color and set color to text to fix shadow & outline color won't show correct bug
node->setColor(oldColor);
auto optionsWidget = (WidgetOptions*)options->widgetOptions();
auto f_color = optionsWidget->color();
Color4B color(f_color->r(), f_color->g(), f_color->b(), f_color->a());
((Text *)node)->setTextColor(color);
label->setUnifySizeEnabled(false);
bool IsCustomSize = options->isCustomSize() != 0;

View File

@ -422,6 +422,7 @@ private:
jobject jObj = methodInfo.env->CallStaticObjectMethod(methodInfo.classID, methodInfo.methodID, jurl);
_httpURLConnection = methodInfo.env->NewGlobalRef(jObj);
methodInfo.env->DeleteLocalRef(jurl);
methodInfo.env->DeleteLocalRef(jObj);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
}
}

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

@ -40,9 +40,9 @@ import java.util.Map;
import com.chukong.cocosplay.client.CocosPlayClient;
public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl {
private String TAG = "VideoView";
private String TAG = "Cocos2dxVideoView";
private Uri mUri;
private Uri mVideoUri;
private int mDuration;
// all possible internal states
@ -123,9 +123,7 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
mViewWidth = maxWidth;
mViewHeight = maxHeight;
if (mVideoWidth != 0 && mVideoHeight != 0) {
fixSize(mViewLeft, mViewTop, mViewWidth, mViewHeight);
}
fixSize(mViewLeft, mViewTop, mViewWidth, mViewHeight);
}
public void setFullScreenEnabled(boolean enabled, int width, int height) {
@ -166,8 +164,9 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
result = specSize;
break;
}
return result;
}
}
private boolean mNeedResume = false;
@ -190,6 +189,8 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
mVideoWidth = 0;
mVideoHeight = 0;
getHolder().addCallback(mSHCallback);
//Fix issue#11516:Can't play video on Android 2.3.x
getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
setFocusable(true);
setFocusableInTouchMode(true);
mCurrentState = STATE_IDLE;
@ -210,30 +211,31 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
return true;
}
private boolean isAssetRouse = false;
private String fileName = null;
private String assetResourceRoot = "assets/";
private boolean mIsAssetRouse = false;
private String mVideoFilePath = null;
private static final String AssetResourceRoot = "assets/";
public void setVideoFileName(String path) {
if (path.startsWith(assetResourceRoot)) {
path = path.substring(assetResourceRoot.length());
if (path.startsWith(AssetResourceRoot)) {
path = path.substring(AssetResourceRoot.length());
}
if (CocosPlayClient.isEnabled() && !CocosPlayClient.isDemo()) {
CocosPlayClient.updateAssets(path);
}
CocosPlayClient.notifyFileLoaded(path);
if (path.startsWith("/")) {
isAssetRouse = false;
mIsAssetRouse = false;
setVideoURI(Uri.parse(path),null);
}
else {
fileName = path;
isAssetRouse = true;
mVideoFilePath = path;
mIsAssetRouse = true;
setVideoURI(Uri.parse(path),null);
}
}
public void setVideoURL(String url) {
isAssetRouse = false;
mIsAssetRouse = false;
setVideoURI(Uri.parse(url), null);
}
@ -241,7 +243,7 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
* @hide
*/
private void setVideoURI(Uri uri, Map<String, String> headers) {
mUri = uri;
mVideoUri = uri;
mSeekWhenPrepared = 0;
mVideoWidth = 0;
mVideoHeight = 0;
@ -265,12 +267,11 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
// not ready for playback just yet, will try again later
return;
}
if (isAssetRouse) {
if(fileName == null)
return;
} else {
if(mUri == null)
if (mIsAssetRouse) {
if(mVideoFilePath == null)
return;
} else if(mVideoUri == null) {
return;
}
// Tell the music playback service to pause
@ -299,11 +300,11 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
mDuration = -1;
mCurrentBufferPercentage = 0;
if (isAssetRouse) {
AssetFileDescriptor afd = mCocos2dxActivity.getAssets().openFd(fileName);
if (mIsAssetRouse) {
AssetFileDescriptor afd = mCocos2dxActivity.getAssets().openFd(mVideoFilePath);
mMediaPlayer.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength());
} else {
mMediaPlayer.setDataSource(mCocos2dxActivity, mUri);
mMediaPlayer.setDataSource(mCocos2dxActivity, mVideoUri);
}
mMediaPlayer.prepareAsync();
@ -313,13 +314,13 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
*/
mCurrentState = STATE_PREPARING;
} catch (IOException ex) {
Log.w(TAG, "Unable to open content: " + mUri, ex);
Log.w(TAG, "Unable to open content: " + mVideoUri, ex);
mCurrentState = STATE_ERROR;
mTargetState = STATE_ERROR;
mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0);
return;
} catch (IllegalArgumentException ex) {
Log.w(TAG, "Unable to open content: " + mUri, ex);
Log.w(TAG, "Unable to open content: " + mVideoUri, ex);
mCurrentState = STATE_ERROR;
mTargetState = STATE_ERROR;
mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0);
@ -343,7 +344,13 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
}
public void fixSize(int left, int top, int width, int height) {
if (width != 0 && height != 0) {
if (mVideoWidth == 0 || mVideoHeight == 0) {
mVisibleLeft = left;
mVisibleTop = top;
mVisibleWidth = width;
mVisibleHeight = height;
}
else if (width != 0 && height != 0) {
if (mKeepRatio) {
if ( mVideoWidth * height > width * mVideoHeight ) {
mVisibleWidth = width;
@ -407,6 +414,7 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
if (seekToPosition != 0) {
seekTo(seekToPosition);
}
if (mVideoWidth != 0 && mVideoHeight != 0) {
fixSize();
}
@ -691,24 +699,20 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
@Override
public boolean canPause() {
// TODO Auto-generated method stub
return true;
}
@Override
public boolean canSeekBackward() {
// TODO Auto-generated method stub
return true;
}
@Override
public boolean canSeekForward() {
// TODO Auto-generated method stub
return true;
}
public int getAudioSessionId () {
// TODO Auto-generated method stub
return mMediaPlayer.getAudioSessionId();
}
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2013-2015 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.
*/
const char* ccPositionColorTextureAsPointsize_vert = STRINGIFY(
attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord;
\n#ifdef GL_ES\n
varying lowp vec4 v_fragmentColor;
\n#else\n
varying vec4 v_fragmentColor;
\n#endif\n
void main()
{
gl_Position = CC_MVPMatrix * a_position;
v_fragmentColor = a_color;
}
);

View File

@ -0,0 +1,43 @@
/*
* cocos2d for iPhone: http://www.cocos2d-iphone.org
*
* Copyright (c) 2011 Ricardo Quesada
* Copyright (c) 2012 Zynga Inc.
*
* 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.
*/
const char* ccPosition_uColor_vert = STRINGIFY(
attribute vec4 a_position;
uniform vec4 u_color;
uniform float u_pointSize;
\n#ifdef GL_ES\n
varying lowp vec4 v_fragmentColor;
\n#else\n
varying vec4 v_fragmentColor;
\n#endif\n
void main()
{
gl_Position = CC_MVPMatrix * a_position;
v_fragmentColor = u_color;
}
);

View File

@ -30,15 +30,25 @@ THE SOFTWARE.
NS_CC_BEGIN
//
#include "ccShader_Position_uColor.frag"
#ifdef CC_WINDOWS_PHONE_8_1
#include "ccShader_Position_uColor_wp81.vert"
#else
#include "ccShader_Position_uColor.vert"
#endif
//
#include "ccShader_PositionColor.frag"
#include "ccShader_PositionColor.vert"
//
#ifdef CC_WINDOWS_PHONE_8_1
#include "ccShader_PositionColorTextureAsPointsize_wp81.vert"
#else
#include "ccShader_PositionColorTextureAsPointsize.vert"
#endif
//
#include "ccShader_PositionTexture.frag"

View File

@ -11,12 +11,10 @@
-- @return float#float ret (return value: float)
--------------------------------
-- set high quality<br>
-- The default value is based on Configuration::isHighAnimate3DQuality(). You can configure it in the config.plist. However, you can modify it using the following function<br>
-- param true: is high quality, false: is low quality.
-- @function [parent=#Animate3D] setHighQuality
-- set animate quality
-- @function [parent=#Animate3D] setQuality
-- @param self
-- @param #bool isHighQuality
-- @param #int quality
-- @return Animate3D#Animate3D self (return value: cc.Animate3D)
--------------------------------
@ -39,13 +37,6 @@
-- @param #float speed
-- @return Animate3D#Animate3D self (return value: cc.Animate3D)
--------------------------------
-- get high quality<br>
-- is it high quality
-- @function [parent=#Animate3D] isHighQuality
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- get & set origin interval
-- @function [parent=#Animate3D] setOriginInterval
@ -59,6 +50,12 @@
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- get animate quality
-- @function [parent=#Animate3D] getQuality
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- @overload self, cc.Animation3D, float, float
-- @overload self, cc.Animation3D

View File

@ -16,16 +16,6 @@
-- @param #cc.Texture2D texture
-- @return SpriteFrameCache#SpriteFrameCache self (return value: cc.SpriteFrameCache)
--------------------------------
-- @overload self, string, string
-- @overload self, string
-- @overload self, string, cc.Texture2D
-- @function [parent=#SpriteFrameCache] addSpriteFramesWithFile
-- @param self
-- @param #string plist
-- @param #cc.Texture2D texture
-- @return SpriteFrameCache#SpriteFrameCache self (return value: cc.SpriteFrameCache)
--------------------------------
-- Adds an sprite frame with a given name.<br>
-- If the name already exists, then the contents of the old name will be replaced with the new one.<br>
@ -38,14 +28,15 @@
-- @return SpriteFrameCache#SpriteFrameCache self (return value: cc.SpriteFrameCache)
--------------------------------
-- Removes unused sprite frames.<br>
-- Sprite Frames that have a retain count of 1 will be deleted.<br>
-- It is convenient to call this method after when starting a new Scene.<br>
-- js NA
-- @function [parent=#SpriteFrameCache] removeUnusedSpriteFrames
-- @overload self, string, string
-- @overload self, string
-- @overload self, string, cc.Texture2D
-- @function [parent=#SpriteFrameCache] addSpriteFramesWithFile
-- @param self
-- @param #string plist
-- @param #cc.Texture2D texture
-- @return SpriteFrameCache#SpriteFrameCache self (return value: cc.SpriteFrameCache)
--------------------------------
-- Returns an Sprite Frame that was previously added.<br>
-- If the name is not found it will return nil.<br>
@ -88,13 +79,12 @@
-- @return SpriteFrameCache#SpriteFrameCache self (return value: cc.SpriteFrameCache)
--------------------------------
-- Removes all Sprite Frames associated with the specified textures.<br>
-- It is convenient to call this method when a specific texture needs to be removed.<br>
-- since v0.995.<br>
-- param texture The texture that needs to removed.
-- @function [parent=#SpriteFrameCache] removeSpriteFramesFromTexture
-- Removes unused sprite frames.<br>
-- Sprite Frames that have a retain count of 1 will be deleted.<br>
-- It is convenient to call this method after when starting a new Scene.<br>
-- js NA
-- @function [parent=#SpriteFrameCache] removeUnusedSpriteFrames
-- @param self
-- @param #cc.Texture2D texture
-- @return SpriteFrameCache#SpriteFrameCache self (return value: cc.SpriteFrameCache)
--------------------------------
@ -116,6 +106,27 @@
-- @param #string name
-- @return SpriteFrameCache#SpriteFrameCache self (return value: cc.SpriteFrameCache)
--------------------------------
-- Check if multiple Sprite Frames from a plist file have been loaded.<br>
-- js NA<br>
-- lua NA<br>
-- param plist Plist file name.<br>
-- return True if the file is loaded.
-- @function [parent=#SpriteFrameCache] isSpriteFramesWithFileLoaded
-- @param self
-- @param #string plist
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Removes all Sprite Frames associated with the specified textures.<br>
-- It is convenient to call this method when a specific texture needs to be removed.<br>
-- since v0.995.<br>
-- param texture The texture that needs to removed.
-- @function [parent=#SpriteFrameCache] removeSpriteFramesFromTexture
-- @param self
-- @param #cc.Texture2D texture
-- @return SpriteFrameCache#SpriteFrameCache self (return value: cc.SpriteFrameCache)
--------------------------------
-- Destroys the cache. It releases all the Sprite Frames and the retained instance.<br>
-- js NA

View File

@ -0,0 +1,61 @@
--------------------------------
-- @module SpritePolygon
-- @extend Node
-- @parent_module ccexp
--------------------------------
-- @overload self, cc.Texture2D
-- @overload self, string
-- @function [parent=#SpritePolygon] setTexture
-- @param self
-- @param #string filename
-- @return experimental::SpritePolygon#experimental::SpritePolygon self (return value: cc.experimental::SpritePolygon)
--------------------------------
--
-- @function [parent=#SpritePolygon] initWithTexture
-- @param self
-- @param #cc.Texture2D texture
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#SpritePolygon] showDebug
-- @param self
-- @param #bool val
-- @return experimental::SpritePolygon#experimental::SpritePolygon self (return value: cc.experimental::SpritePolygon)
--------------------------------
-- returns the Texture2D object used by the sprite
-- @function [parent=#SpritePolygon] getTexture
-- @param self
-- @return Texture2D#Texture2D ret (return value: cc.Texture2D)
--------------------------------
--
-- @function [parent=#SpritePolygon] getArea
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
--
-- @function [parent=#SpritePolygon] initWithCache
-- @param self
-- @param #string file
-- @param #cc._SpritePolygonInfo info
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#SpritePolygon] getVertCount
-- @param self
-- @return long#long ret (return value: long)
--------------------------------
--
-- @function [parent=#SpritePolygon] getTrianglesCount
-- @param self
-- @return long#long ret (return value: long)
return nil

View File

@ -0,0 +1,48 @@
--------------------------------
-- @module SpritePolygonCache
-- @extend Ref
-- @parent_module cc
--------------------------------
--
-- @function [parent=#SpritePolygonCache] isSpritePolygonCachExist
-- @param self
-- @param #string filePath
-- @param #rect_table rect
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#SpritePolygonCache] removeAllSpritePolygonCache
-- @param self
-- @return SpritePolygonCache#SpritePolygonCache self (return value: cc.SpritePolygonCache)
--------------------------------
--
-- @function [parent=#SpritePolygonCache] removeSpritePolygonCache
-- @param self
-- @param #string filePath
-- @param #rect_table rect
-- @return SpritePolygonCache#SpritePolygonCache self (return value: cc.SpritePolygonCache)
--------------------------------
--
-- @function [parent=#SpritePolygonCache] destroyInstance
-- @param self
-- @return SpritePolygonCache#SpritePolygonCache self (return value: cc.SpritePolygonCache)
--------------------------------
--
-- @function [parent=#SpritePolygonCache] printInfo
-- @param self
-- @param #cc._SpritePolygonInfo info
-- @return SpritePolygonCache#SpritePolygonCache self (return value: cc.SpritePolygonCache)
--------------------------------
--
-- @function [parent=#SpritePolygonCache] getInstance
-- @param self
-- @return SpritePolygonCache#SpritePolygonCache ret (return value: cc.SpritePolygonCache)
return nil

View File

@ -1,6 +1,16 @@
--------------------------------
-- @module cc
--------------------------------------------------------
-- the cc Animation3D
-- @field [parent=#cc] Animation3D#Animation3D Animation3D preloaded module
--------------------------------------------------------
-- the cc Animate3D
-- @field [parent=#cc] Animate3D#Animate3D Animate3D preloaded module
--------------------------------------------------------
-- the cc Skeleton3D
-- @field [parent=#cc] Skeleton3D#Skeleton3D Skeleton3D preloaded module
@ -21,16 +31,6 @@
-- @field [parent=#cc] Mesh#Mesh Mesh preloaded module
--------------------------------------------------------
-- the cc Animation3D
-- @field [parent=#cc] Animation3D#Animation3D Animation3D preloaded module
--------------------------------------------------------
-- the cc Animate3D
-- @field [parent=#cc] Animate3D#Animate3D Animate3D preloaded module
--------------------------------------------------------
-- the cc AttachNode
-- @field [parent=#cc] AttachNode#AttachNode AttachNode preloaded module

View File

@ -11,6 +11,26 @@
-- @field [parent=#cc] Console#Console Console preloaded module
--------------------------------------------------------
-- the cc Action
-- @field [parent=#cc] Action#Action Action preloaded module
--------------------------------------------------------
-- the cc FiniteTimeAction
-- @field [parent=#cc] FiniteTimeAction#FiniteTimeAction FiniteTimeAction preloaded module
--------------------------------------------------------
-- the cc Speed
-- @field [parent=#cc] Speed#Speed Speed preloaded module
--------------------------------------------------------
-- the cc Follow
-- @field [parent=#cc] Follow#Follow Follow preloaded module
--------------------------------------------------------
-- the cc Texture2D
-- @field [parent=#cc] Texture2D#Texture2D Texture2D preloaded module
@ -41,126 +61,6 @@
-- @field [parent=#cc] Node#Node Node preloaded module
--------------------------------------------------------
-- the cc Scene
-- @field [parent=#cc] Scene#Scene Scene preloaded module
--------------------------------------------------------
-- the cc GLView
-- @field [parent=#cc] GLView#GLView GLView preloaded module
--------------------------------------------------------
-- the cc Director
-- @field [parent=#cc] Director#Director Director preloaded module
--------------------------------------------------------
-- the cc Timer
-- @field [parent=#cc] Timer#Timer Timer preloaded module
--------------------------------------------------------
-- the cc Scheduler
-- @field [parent=#cc] Scheduler#Scheduler Scheduler preloaded module
--------------------------------------------------------
-- the cc FileUtils
-- @field [parent=#cc] FileUtils#FileUtils FileUtils preloaded module
--------------------------------------------------------
-- the cc UserDefault
-- @field [parent=#cc] UserDefault#UserDefault UserDefault preloaded module
--------------------------------------------------------
-- the cc EventListener
-- @field [parent=#cc] EventListener#EventListener EventListener preloaded module
--------------------------------------------------------
-- the cc EventDispatcher
-- @field [parent=#cc] EventDispatcher#EventDispatcher EventDispatcher preloaded module
--------------------------------------------------------
-- the cc EventListenerTouchOneByOne
-- @field [parent=#cc] EventListenerTouchOneByOne#EventListenerTouchOneByOne EventListenerTouchOneByOne preloaded module
--------------------------------------------------------
-- the cc EventListenerTouchAllAtOnce
-- @field [parent=#cc] EventListenerTouchAllAtOnce#EventListenerTouchAllAtOnce EventListenerTouchAllAtOnce preloaded module
--------------------------------------------------------
-- the cc EventListenerKeyboard
-- @field [parent=#cc] EventListenerKeyboard#EventListenerKeyboard EventListenerKeyboard preloaded module
--------------------------------------------------------
-- the cc EventMouse
-- @field [parent=#cc] EventMouse#EventMouse EventMouse preloaded module
--------------------------------------------------------
-- the cc EventListenerMouse
-- @field [parent=#cc] EventListenerMouse#EventListenerMouse EventListenerMouse preloaded module
--------------------------------------------------------
-- the cc EventAcceleration
-- @field [parent=#cc] EventAcceleration#EventAcceleration EventAcceleration preloaded module
--------------------------------------------------------
-- the cc EventListenerAcceleration
-- @field [parent=#cc] EventListenerAcceleration#EventListenerAcceleration EventListenerAcceleration preloaded module
--------------------------------------------------------
-- the cc EventCustom
-- @field [parent=#cc] EventCustom#EventCustom EventCustom preloaded module
--------------------------------------------------------
-- the cc EventListenerCustom
-- @field [parent=#cc] EventListenerCustom#EventListenerCustom EventListenerCustom preloaded module
--------------------------------------------------------
-- the cc EventFocus
-- @field [parent=#cc] EventFocus#EventFocus EventFocus preloaded module
--------------------------------------------------------
-- the cc EventListenerFocus
-- @field [parent=#cc] EventListenerFocus#EventListenerFocus EventListenerFocus preloaded module
--------------------------------------------------------
-- the cc Action
-- @field [parent=#cc] Action#Action Action preloaded module
--------------------------------------------------------
-- the cc FiniteTimeAction
-- @field [parent=#cc] FiniteTimeAction#FiniteTimeAction FiniteTimeAction preloaded module
--------------------------------------------------------
-- the cc Speed
-- @field [parent=#cc] Speed#Speed Speed preloaded module
--------------------------------------------------------
-- the cc Follow
-- @field [parent=#cc] Follow#Follow Follow preloaded module
--------------------------------------------------------
-- the cc SpriteFrame
-- @field [parent=#cc] SpriteFrame#SpriteFrame SpriteFrame preloaded module
@ -306,6 +206,106 @@
-- @field [parent=#cc] TargetedAction#TargetedAction TargetedAction preloaded module
--------------------------------------------------------
-- the cc Scene
-- @field [parent=#cc] Scene#Scene Scene preloaded module
--------------------------------------------------------
-- the cc GLView
-- @field [parent=#cc] GLView#GLView GLView preloaded module
--------------------------------------------------------
-- the cc Director
-- @field [parent=#cc] Director#Director Director preloaded module
--------------------------------------------------------
-- the cc Timer
-- @field [parent=#cc] Timer#Timer Timer preloaded module
--------------------------------------------------------
-- the cc Scheduler
-- @field [parent=#cc] Scheduler#Scheduler Scheduler preloaded module
--------------------------------------------------------
-- the cc FileUtils
-- @field [parent=#cc] FileUtils#FileUtils FileUtils preloaded module
--------------------------------------------------------
-- the cc UserDefault
-- @field [parent=#cc] UserDefault#UserDefault UserDefault preloaded module
--------------------------------------------------------
-- the cc EventListener
-- @field [parent=#cc] EventListener#EventListener EventListener preloaded module
--------------------------------------------------------
-- the cc EventDispatcher
-- @field [parent=#cc] EventDispatcher#EventDispatcher EventDispatcher preloaded module
--------------------------------------------------------
-- the cc EventListenerTouchOneByOne
-- @field [parent=#cc] EventListenerTouchOneByOne#EventListenerTouchOneByOne EventListenerTouchOneByOne preloaded module
--------------------------------------------------------
-- the cc EventListenerTouchAllAtOnce
-- @field [parent=#cc] EventListenerTouchAllAtOnce#EventListenerTouchAllAtOnce EventListenerTouchAllAtOnce preloaded module
--------------------------------------------------------
-- the cc EventListenerKeyboard
-- @field [parent=#cc] EventListenerKeyboard#EventListenerKeyboard EventListenerKeyboard preloaded module
--------------------------------------------------------
-- the cc EventMouse
-- @field [parent=#cc] EventMouse#EventMouse EventMouse preloaded module
--------------------------------------------------------
-- the cc EventListenerMouse
-- @field [parent=#cc] EventListenerMouse#EventListenerMouse EventListenerMouse preloaded module
--------------------------------------------------------
-- the cc EventAcceleration
-- @field [parent=#cc] EventAcceleration#EventAcceleration EventAcceleration preloaded module
--------------------------------------------------------
-- the cc EventListenerAcceleration
-- @field [parent=#cc] EventListenerAcceleration#EventListenerAcceleration EventListenerAcceleration preloaded module
--------------------------------------------------------
-- the cc EventCustom
-- @field [parent=#cc] EventCustom#EventCustom EventCustom preloaded module
--------------------------------------------------------
-- the cc EventListenerCustom
-- @field [parent=#cc] EventListenerCustom#EventListenerCustom EventListenerCustom preloaded module
--------------------------------------------------------
-- the cc EventFocus
-- @field [parent=#cc] EventFocus#EventFocus EventFocus preloaded module
--------------------------------------------------------
-- the cc EventListenerFocus
-- @field [parent=#cc] EventListenerFocus#EventListenerFocus EventListenerFocus preloaded module
--------------------------------------------------------
-- the cc ActionCamera
-- @field [parent=#cc] ActionCamera#ActionCamera ActionCamera preloaded module
@ -1251,4 +1251,9 @@
-- @field [parent=#cc] AsyncTaskPool#AsyncTaskPool AsyncTaskPool preloaded module
--------------------------------------------------------
-- the cc SpritePolygonCache
-- @field [parent=#cc] SpritePolygonCache#SpritePolygonCache SpritePolygonCache preloaded module
return nil

View File

@ -11,4 +11,9 @@
-- @field [parent=#ccexp] TMXTiledMap#TMXTiledMap TMXTiledMap preloaded module
--------------------------------------------------------
-- the ccexp SpritePolygon
-- @field [parent=#ccexp] SpritePolygon#SpritePolygon SpritePolygon preloaded module
return nil

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1632,6 +1632,13 @@ int register_all_cocos2dx(lua_State* tolua_S);

View File

@ -1,6 +1,7 @@
#include "lua_cocos2dx_experimental_auto.hpp"
#include "CCFastTMXLayer.h"
#include "CCFastTMXTiledMap.h"
#include "SpritePolygon.h"
#include "tolua_fix.h"
#include "LuaBasicConversions.h"
@ -1868,6 +1869,430 @@ int lua_register_cocos2dx_experimental_TMXTiledMap(lua_State* tolua_S)
g_typeCast["TMXTiledMap"] = "ccexp.TMXTiledMap";
return 1;
}
int lua_cocos2dx_experimental_SpritePolygon_setTexture(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::SpritePolygon* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.SpritePolygon",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::SpritePolygon*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_SpritePolygon_setTexture'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
do{
if (argc == 1) {
cocos2d::Texture2D* arg0;
ok &= luaval_to_object<cocos2d::Texture2D>(tolua_S, 2, "cc.Texture2D",&arg0);
if (!ok) { break; }
cobj->setTexture(arg0);
lua_settop(tolua_S, 1);
return 1;
}
}while(0);
ok = true;
do{
if (argc == 1) {
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.SpritePolygon:setTexture");
if (!ok) { break; }
cobj->setTexture(arg0);
lua_settop(tolua_S, 1);
return 1;
}
}while(0);
ok = true;
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.SpritePolygon:setTexture",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_SpritePolygon_setTexture'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_SpritePolygon_initWithTexture(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::SpritePolygon* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.SpritePolygon",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::SpritePolygon*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_SpritePolygon_initWithTexture'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
cocos2d::Texture2D* arg0;
ok &= luaval_to_object<cocos2d::Texture2D>(tolua_S, 2, "cc.Texture2D",&arg0);
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_SpritePolygon_initWithTexture'", nullptr);
return 0;
}
bool ret = cobj->initWithTexture(arg0);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.SpritePolygon:initWithTexture",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_SpritePolygon_initWithTexture'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_SpritePolygon_showDebug(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::SpritePolygon* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.SpritePolygon",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::SpritePolygon*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_SpritePolygon_showDebug'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
bool arg0;
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "ccexp.SpritePolygon:showDebug");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_SpritePolygon_showDebug'", nullptr);
return 0;
}
cobj->showDebug(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.SpritePolygon:showDebug",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_SpritePolygon_showDebug'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_SpritePolygon_getTexture(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::SpritePolygon* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.SpritePolygon",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::SpritePolygon*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_SpritePolygon_getTexture'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_SpritePolygon_getTexture'", nullptr);
return 0;
}
cocos2d::Texture2D* ret = cobj->getTexture();
object_to_luaval<cocos2d::Texture2D>(tolua_S, "cc.Texture2D",(cocos2d::Texture2D*)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.SpritePolygon:getTexture",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_SpritePolygon_getTexture'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_SpritePolygon_getArea(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::SpritePolygon* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.SpritePolygon",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::SpritePolygon*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_SpritePolygon_getArea'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_SpritePolygon_getArea'", nullptr);
return 0;
}
const float ret = cobj->getArea();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.SpritePolygon:getArea",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_SpritePolygon_getArea'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_SpritePolygon_initWithCache(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::SpritePolygon* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.SpritePolygon",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::SpritePolygon*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_SpritePolygon_initWithCache'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 2)
{
std::string arg0;
cocos2d::_SpritePolygonInfo* arg1;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.SpritePolygon:initWithCache");
#pragma warning NO CONVERSION TO NATIVE FOR _SpritePolygonInfo*
ok = false;
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_SpritePolygon_initWithCache'", nullptr);
return 0;
}
bool ret = cobj->initWithCache(arg0, arg1);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.SpritePolygon:initWithCache",argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_SpritePolygon_initWithCache'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_SpritePolygon_getVertCount(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::SpritePolygon* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.SpritePolygon",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::SpritePolygon*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_SpritePolygon_getVertCount'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_SpritePolygon_getVertCount'", nullptr);
return 0;
}
const ssize_t ret = cobj->getVertCount();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.SpritePolygon:getVertCount",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_SpritePolygon_getVertCount'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_SpritePolygon_getTrianglesCount(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::SpritePolygon* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.SpritePolygon",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::SpritePolygon*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_SpritePolygon_getTrianglesCount'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_SpritePolygon_getTrianglesCount'", nullptr);
return 0;
}
const ssize_t ret = cobj->getTrianglesCount();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.SpritePolygon:getTrianglesCount",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_SpritePolygon_getTrianglesCount'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_experimental_SpritePolygon_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (SpritePolygon)");
return 0;
}
int lua_register_cocos2dx_experimental_SpritePolygon(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"ccexp.SpritePolygon");
tolua_cclass(tolua_S,"SpritePolygon","ccexp.SpritePolygon","cc.Node",nullptr);
tolua_beginmodule(tolua_S,"SpritePolygon");
tolua_function(tolua_S,"setTexture",lua_cocos2dx_experimental_SpritePolygon_setTexture);
tolua_function(tolua_S,"initWithTexture",lua_cocos2dx_experimental_SpritePolygon_initWithTexture);
tolua_function(tolua_S,"showDebug",lua_cocos2dx_experimental_SpritePolygon_showDebug);
tolua_function(tolua_S,"getTexture",lua_cocos2dx_experimental_SpritePolygon_getTexture);
tolua_function(tolua_S,"getArea",lua_cocos2dx_experimental_SpritePolygon_getArea);
tolua_function(tolua_S,"initWithCache",lua_cocos2dx_experimental_SpritePolygon_initWithCache);
tolua_function(tolua_S,"getVertCount",lua_cocos2dx_experimental_SpritePolygon_getVertCount);
tolua_function(tolua_S,"getTrianglesCount",lua_cocos2dx_experimental_SpritePolygon_getTrianglesCount);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::experimental::SpritePolygon).name();
g_luaType[typeName] = "ccexp.SpritePolygon";
g_typeCast["SpritePolygon"] = "ccexp.SpritePolygon";
return 1;
}
TOLUA_API int register_all_cocos2dx_experimental(lua_State* tolua_S)
{
tolua_open(tolua_S);
@ -1876,6 +2301,7 @@ TOLUA_API int register_all_cocos2dx_experimental(lua_State* tolua_S)
tolua_beginmodule(tolua_S,"ccexp");
lua_register_cocos2dx_experimental_TMXTiledMap(tolua_S);
lua_register_cocos2dx_experimental_SpritePolygon(tolua_S);
lua_register_cocos2dx_experimental_TMXLayer(tolua_S);
tolua_endmodule(tolua_S);

View File

@ -41,6 +41,15 @@ int register_all_cocos2dx_experimental(lua_State* tolua_S);

View File

@ -2097,6 +2097,194 @@ bool luaval_to_texparams(lua_State* L,int lo,cocos2d::Texture2D::TexParams* outV
return ok;
}
bool luaval_to_tex2f(lua_State* L, int lo, cocos2d::Tex2F* outValue, const char* funcName)
{
if (nullptr == L || nullptr == outValue)
return false;
bool ok = true;
tolua_Error tolua_err;
if (!tolua_istable(L, lo, 0, &tolua_err) )
{
#if COCOS2D_DEBUG >=1
luaval_to_native_err(L,"#ferror:",&tolua_err,funcName);
#endif
ok = false;
}
if (ok)
{
lua_pushstring(L, "u");
lua_gettable(L, lo);
outValue->u = lua_isnil(L, -1) ? 0 : lua_tonumber(L, -1);
lua_pop(L, 1);
lua_pushstring(L, "v");
lua_gettable(L, lo);
outValue->v = lua_isnil(L, -1) ? 0 : lua_tonumber(L, -1);
lua_pop(L, 1);
}
return ok;
}
bool luaval_to_v3f_c4b_t2f(lua_State* L,int lo,cocos2d::V3F_C4B_T2F * outValue, const char* funcName)
{
if (nullptr == L || nullptr == outValue)
return false;
bool ok = true;
tolua_Error tolua_err;
if (!tolua_istable(L, lo, 0, &tolua_err) )
{
#if COCOS2D_DEBUG >=1
luaval_to_native_err(L,"#ferror:",&tolua_err,funcName);
#endif
ok = false;
}
if (ok)
{
lua_pushstring(L, "vertices");
lua_gettable(L, lo);
if (!tolua_istable(L,lua_gettop(L), 0, &tolua_err))
{
lua_pop(L, 1);
return false;
}
ok &= luaval_to_vec3(L, lua_gettop(L), &outValue->vertices);
if (!ok)
{
lua_pop(L, 1);
return false;
}
lua_pop(L, 1);
lua_pushstring(L, "colors");
lua_gettable(L, lo);
if (!tolua_istable(L, lua_gettop(L), 0, &tolua_err))
{
lua_pop(L, 1);
return false;
}
ok &= luaval_to_color4b(L, lua_gettop(L), &outValue->colors);
if (!ok)
{
lua_pop(L, 1);
return false;
}
lua_pop(L, 1);
lua_pushstring(L, "texCoords");
lua_gettable(L, lo);
if (!tolua_istable(L, lua_gettop(L), 0, &tolua_err))
{
lua_pop(L, 1);
return false;
}
ok &= luaval_to_tex2f(L, lua_gettop(L), &outValue->texCoords);
if (!ok)
{
lua_pop(L, 1);
return false;
}
lua_pop(L, 1);
}
return ok;
}
bool luaval_to_std_vector_vec2(lua_State* L, int lo, std::vector<cocos2d::Vec2>* ret, const char* funcName)
{
if (nullptr == L || nullptr == ret || lua_gettop(L) < lo)
return false;
tolua_Error tolua_err;
bool ok = true;
if (!tolua_istable(L, lo, 0, &tolua_err))
{
#if COCOS2D_DEBUG >=1
luaval_to_native_err(L,"#ferror:",&tolua_err,funcName);
#endif
ok = false;
}
if (ok)
{
size_t len = lua_objlen(L, lo);
cocos2d::Vec2 value;
for (size_t i = 0; i < len; i++)
{
lua_pushnumber(L, i + 1);
lua_gettable(L,lo);
if (lua_istable(L, lua_gettop(L)))
{
ok &= luaval_to_vec2(L, lua_gettop(L), &value);
if (ok)
{
ret->push_back(value);
}
}
else
{
CCASSERT(false, "vec2 type is needed");
}
lua_pop(L, 1);
}
}
return ok;
}
bool luaval_to_std_vector_v3f_c4b_t2f(lua_State* L, int lo, std::vector<cocos2d::V3F_C4B_T2F>* ret, const char* funcName)
{
if (nullptr == L || nullptr == ret || lua_gettop(L) < lo)
return false;
tolua_Error tolua_err;
bool ok = true;
if (!tolua_istable(L, lo, 0, &tolua_err))
{
#if COCOS2D_DEBUG >=1
luaval_to_native_err(L,"#ferror:",&tolua_err,funcName);
#endif
ok = false;
}
if (ok)
{
size_t len = lua_objlen(L, lo);
cocos2d::V3F_C4B_T2F value;
for (size_t i = 0; i < len; i++)
{
lua_pushnumber(L, i + 1);
lua_gettable(L,lo);
if (lua_istable(L, lua_gettop(L)))
{
ok &= luaval_to_v3f_c4b_t2f(L, lua_gettop(L), &value);
if (ok)
{
ret->push_back(value);
}
}
else
{
CCASSERT(false, "V3F_C4B_T2F type is needed");
}
lua_pop(L, 1);
}
}
return ok;
}
void vec2_array_to_luaval(lua_State* L,const cocos2d::Vec2* points, int count)
{
if (NULL == L)

View File

@ -771,6 +771,53 @@ extern bool luaval_to_quaternion(lua_State* L,int lo,cocos2d::Quaternion* outVal
*/
extern bool luaval_to_texparams(lua_State* L,int lo,cocos2d::Texture2D::TexParams* outValue, const char* funcName = "");
/**
* Get a cocos2d::V3F_C4B_T2F object value from the given accpetable index of stack.
* If the value at the given accpetable index of stack is a table it returns true, otherwise returns false.
* If the table has the `vertices`, `colors`, and `texCoords` keys and the corresponding values are not nil, this function would assign the values to the corresponding members of outValue.
* @param L the current lua_State.
* @param lo the given accpetable index of stack.
* @param outValue the pointer to a cocos2d::V3F_C4B_T2F object which stores the values from the Lua table.
* @param funcName the name of calling function, it is used for error output in the debug model.
* @return true if the value at the given accpetable index of stack is a table, otherwise return false.
*/
extern bool luaval_to_v3f_c4b_t2f(lua_State* L,int lo,cocos2d::V3F_C4B_T2F* outValue, const char* funcName = "");
/**
* Get a cocos2d::Tex2F object value from the given accpetable index of stack.
* If the value at the given accpetable index of stack is a table it returns true, otherwise returns false.
* If the table has the `u`, and `v` keys and the corresponding values are not nil, this function would assign the values to the corresponding members of outValue.Otherwise, the value of members of outValue would be 0.
* @param L the current lua_State.
* @param lo the given accpetable index of stack.
* @param outValue the pointer to a cocos2d::Tex2F object which stores the values from the Lua table.
* @param funcName the name of calling function, it is used for error output in the debug model.
* @return true if the value at the given accpetable index of stack is a table, otherwise return false.
*/
extern bool luaval_to_tex2f(lua_State* L, int lo, cocos2d::Tex2F* outValue, const char* funcName = "");
/**
* Get a pointer points to a std::vector<cocos2d::V3F_C4B_T2F> from a Lua array table in the stack.
*
* @param L the current lua_State.
* @param lo the given accpetable index of stack.
* @param ret a pointer points to a std::vector<cocos2d::V3F_C4B_T2F>.
* @param funcName the name of calling function, it is used for error output in the debug model.
* @return Return true if the value at the given accpetable index of stack is a table, otherwise return false.
*/
extern bool luaval_to_std_vector_v3f_c4b_t2f(lua_State* L, int lo, std::vector<cocos2d::V3F_C4B_T2F>* ret, const char* funcName = "");
/**
* Get a pointer points to a std::vector<cocos2d::Vec2> from a Lua array table in the stack.
*
* @param L the current lua_State.
* @param lo the given accpetable index of stack.
* @param ret a pointer points to a std::vector<cocos2d::Vec2>.
* @param funcName the name of calling function, it is used for error output in the debug model.
* @return Return true if the value at the given accpetable index of stack is a table, otherwise return false.
*/
extern bool luaval_to_std_vector_vec2(lua_State* L, int lo, std::vector<cocos2d::Vec2>* ret, const char* funcName = "");
/**@}**/
// from native

View File

@ -3,6 +3,7 @@
#include "LuaBasicConversions.h"
#include "CCLuaValue.h"
#include "CCLuaEngine.h"
#include "2d/SpritePolygon.h"
static int lua_cocos2dx_experimental_TMXLayer_getTileGIDAt(lua_State* tolua_S)
{
@ -80,12 +81,237 @@ static void extendExperimentalTMXLayer(lua_State* tolua_S)
lua_pop(tolua_S, 1);
}
bool isVectorV3FC4BT2F(lua_State* tolua_S, int lo)
{
if (!lua_istable(tolua_S, lo))
return false;
lua_pushnumber(tolua_S, 1);
lua_gettable(tolua_S,lo);
if (!lua_istable(tolua_S, -1))
return false;
lua_pushstring(tolua_S, "vertices");
lua_gettable(tolua_S, -2);
if (lua_isnil(tolua_S, -1))
return false;
lua_pop(tolua_S, 1);
lua_pushstring(tolua_S, "colors");
lua_gettable(tolua_S, -2);
if (lua_isnil(tolua_S, -1))
return false;
lua_pop(tolua_S, 1);
lua_pushstring(tolua_S, "texCoords");
lua_gettable(tolua_S, -2);
if (lua_isnil(tolua_S, -1))
return false;
lua_pop(tolua_S, 1);
return true;
}
int lua_cocos2dx_experimental_SpritePolygon_create(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"ccexp.SpritePolygon",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S)-1;
do
{
if (argc == 3)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.SpritePolygon:create");
if (!ok) { break; }
std::vector<cocos2d::Vec2> arg1;
if (isVectorV3FC4BT2F(tolua_S, 3))
break;
ok &= luaval_to_std_vector_vec2(tolua_S, 3, &arg1);
if (!ok) { break; }
std::vector<unsigned short> arg2;
ok &= luaval_to_std_vector_ushort(tolua_S, 4, &arg2, "ccexp.SpritePolygon:create");
if (!ok) { break; }
cocos2d::experimental::SpritePolygon* ret = cocos2d::experimental::SpritePolygon::create(arg0, arg1, arg2);
object_to_luaval<cocos2d::experimental::SpritePolygon>(tolua_S, "ccexp.SpritePolygon",(cocos2d::experimental::SpritePolygon*)ret);
return 1;
}
} while (0);
ok = true;
do
{
if (argc == 4)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.SpritePolygon:create");
if (!ok) { break; }
std::vector<cocos2d::Vec2> arg1;
ok &= luaval_to_std_vector_vec2(tolua_S, 3, &arg1);
if (!ok) { break; }
std::vector<unsigned short> arg2;
ok &= luaval_to_std_vector_ushort(tolua_S, 4, &arg2, "ccexp.SpritePolygon:create");
if (!ok) { break; }
cocos2d::Rect arg3;
ok &= luaval_to_rect(tolua_S, 5, &arg3, "ccexp.SpritePolygon:create");
if (!ok) { break; }
cocos2d::experimental::SpritePolygon* ret = cocos2d::experimental::SpritePolygon::create(arg0, arg1, arg2, arg3);
object_to_luaval<cocos2d::experimental::SpritePolygon>(tolua_S, "ccexp.SpritePolygon",(cocos2d::experimental::SpritePolygon*)ret);
return 1;
}
} while (0);
ok = true;
do
{
if (argc == 3)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.SpritePolygon:create");
if (!ok) { break; }
std::vector<cocos2d::V3F_C4B_T2F> arg1;
if (!isVectorV3FC4BT2F(tolua_S, 3))
break;
ok &= luaval_to_std_vector_v3f_c4b_t2f(tolua_S, 3, &arg1);
if (!ok) { break; }
std::vector<unsigned short> arg2;
ok &= luaval_to_std_vector_ushort(tolua_S, 4, &arg2, "ccexp.SpritePolygon:create");
if (!ok) { break; }
cocos2d::experimental::SpritePolygon* ret = cocos2d::experimental::SpritePolygon::create(arg0, arg1, arg2);
object_to_luaval<cocos2d::experimental::SpritePolygon>(tolua_S, "ccexp.SpritePolygon",(cocos2d::experimental::SpritePolygon*)ret);
return 1;
}
} while (0);
ok = true;
do
{
if (argc == 2)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.SpritePolygon:create");
if (!ok) { break; }
std::vector<cocos2d::Vec2> arg1;
ok &= luaval_to_std_vector_vec2(tolua_S, 3, &arg1);
if (!ok) { break; }
cocos2d::experimental::SpritePolygon* ret = cocos2d::experimental::SpritePolygon::create(arg0, arg1);
object_to_luaval<cocos2d::experimental::SpritePolygon>(tolua_S, "ccexp.SpritePolygon",(cocos2d::experimental::SpritePolygon*)ret);
return 1;
}
} while (0);
ok = true;
do
{
if (argc == 3)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.SpritePolygon:create");
if (!ok) { break; }
std::vector<cocos2d::Vec2> arg1;
if (isVectorV3FC4BT2F(tolua_S, 3))
break;
ok &= luaval_to_std_vector_vec2(tolua_S, 3, &arg1);
if (!ok) { break; }
cocos2d::Rect arg2;
ok &= luaval_to_rect(tolua_S, 4, &arg2, "ccexp.SpritePolygon:create");
if (!ok) { break; }
cocos2d::experimental::SpritePolygon* ret = cocos2d::experimental::SpritePolygon::create(arg0, arg1, arg2);
object_to_luaval<cocos2d::experimental::SpritePolygon>(tolua_S, "ccexp.SpritePolygon",(cocos2d::experimental::SpritePolygon*)ret);
return 1;
}
} while (0);
ok = true;
do
{
if (argc == 1)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.SpritePolygon:create");
if (!ok) { break; }
cocos2d::experimental::SpritePolygon* ret = cocos2d::experimental::SpritePolygon::create(arg0);
object_to_luaval<cocos2d::experimental::SpritePolygon>(tolua_S, "ccexp.SpritePolygon",(cocos2d::experimental::SpritePolygon*)ret);
return 1;
}
} while (0);
ok = true;
do
{
if (argc == 2)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.SpritePolygon:create");
if (!ok) { break; }
cocos2d::Rect arg1;
ok &= luaval_to_rect(tolua_S, 3, &arg1, "ccexp.SpritePolygon:create");
if (!ok) { break; }
cocos2d::experimental::SpritePolygon* ret = cocos2d::experimental::SpritePolygon::create(arg0, arg1);
object_to_luaval<cocos2d::experimental::SpritePolygon>(tolua_S, "ccexp.SpritePolygon",(cocos2d::experimental::SpritePolygon*)ret);
return 1;
}
} while (0);
ok = true;
do
{
if (argc == 3)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.SpritePolygon:create");
if (!ok) { break; }
cocos2d::Rect arg1;
ok &= luaval_to_rect(tolua_S, 3, &arg1, "ccexp.SpritePolygon:create");
if (!ok) { break; }
double arg2;
ok &= luaval_to_number(tolua_S, 4,&arg2, "ccexp.SpritePolygon:create");
if (!ok) { break; }
cocos2d::experimental::SpritePolygon* ret = cocos2d::experimental::SpritePolygon::create(arg0, arg1, arg2);
object_to_luaval<cocos2d::experimental::SpritePolygon>(tolua_S, "ccexp.SpritePolygon",(cocos2d::experimental::SpritePolygon*)ret);
return 1;
}
} while (0);
ok = true;
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "ccexp.SpritePolygon:create",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_SpritePolygon_create'.",&tolua_err);
#endif
return 0;
}
static void extendExperimentalSpritePolygon(lua_State* tolua_S)
{
lua_pushstring(tolua_S, "ccexp.SpritePolygon");
lua_rawget(tolua_S, LUA_REGISTRYINDEX);
if (lua_istable(tolua_S,-1))
{
tolua_function(tolua_S, "create", lua_cocos2dx_experimental_SpritePolygon_create);
}
lua_pop(tolua_S, 1);
}
int register_all_cocos2dx_experimental_manual(lua_State* L)
{
if (nullptr == L)
return 0;
extendExperimentalTMXLayer(L);
extendExperimentalSpritePolygon(L);
return 0;
}

View File

@ -3355,6 +3355,46 @@ int tolua_cocos2dx_DrawNode_drawPoints(lua_State* tolua_S)
return 0;
}
}
else if (argc == 4)
{
unsigned int size;
luaval_to_uint32(tolua_S, 3, &size, "cc.DrawNode:drawPoints");
if ( size > 0 )
{
cocos2d::Vec2* points = new cocos2d::Vec2[size];
if (nullptr == points)
return 0;
for (int i = 0; i < size; i++)
{
lua_pushnumber(tolua_S,i + 1);
lua_gettable(tolua_S,2);
if (!tolua_istable(tolua_S,-1, 0, &tolua_err))
{
CC_SAFE_DELETE_ARRAY(points);
#if COCOS2D_DEBUG >= 1
goto tolua_lerror;
#endif
}
if(!luaval_to_vec2(tolua_S, lua_gettop(tolua_S), &points[i], "cc.DrawNode:drawPoints"))
{
lua_pop(tolua_S, 1);
CC_SAFE_DELETE_ARRAY(points);
return 0;
}
lua_pop(tolua_S, 1);
}
float pointSize = (float)tolua_tonumber(tolua_S, 4, 0);
cocos2d::Color4F color;
ok &=luaval_to_color4f(tolua_S, 5, &color, "cc.DrawNode:drawPoints");
if(!ok)
return 0;
self->drawPoints(points, size, pointSize, color);
return 0;
}
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawPoints",argc, 3);
return 0;

View File

@ -7,3 +7,10 @@ cc.Terrain.CrackFixedType =
SKIRT = 0,
INCREASE_LOWER = 1,
}
cc.Animate3DQuality =
{
QUALITY_NONE = 0,
QUALITY_LOW = 1,
QUALITY_HIGH = 2,
}

View File

@ -32,13 +32,13 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.
PROJECT_NAME = cocos2d-x
PROJECT_NAME = Cocos2d-x
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 3.5
PROJECT_NUMBER = v3.6
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
@ -125,7 +125,7 @@ ABBREVIATE_BRIEF = "The $name class" \
# description.
# The default value is: NO.
ALWAYS_DETAILED_SEC = YES
ALWAYS_DETAILED_SEC = NO
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
# inherited members of a class in the documentation of that class as if those
@ -140,7 +140,7 @@ INLINE_INHERITED_MEMB = NO
# shortest path that makes the file name unique will be used
# The default value is: YES.
FULL_PATH_NAMES = YES
FULL_PATH_NAMES = NO
# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
# Stripping is only done if one of the specified strings matches the left-hand
@ -406,7 +406,7 @@ LOOKUP_CACHE_SIZE = 0
# normally produced when WARNINGS is set to YES.
# The default value is: NO.
EXTRACT_ALL = YES
EXTRACT_ALL = NO
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
# be included in the documentation.
@ -508,7 +508,7 @@ HIDE_SCOPE_NAMES = YES
# the files that are included by a file in the documentation of that file.
# The default value is: YES.
SHOW_INCLUDE_FILES = YES
SHOW_INCLUDE_FILES = NO
# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
# files with double quotes in the documentation rather than with sharp brackets.
@ -527,7 +527,7 @@ INLINE_INFO = YES
# name. If set to NO the members will appear in declaration order.
# The default value is: YES.
SORT_MEMBER_DOCS = YES
SORT_MEMBER_DOCS = NO
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
# descriptions of file, namespace and class members alphabetically by member
@ -546,7 +546,7 @@ SORT_BRIEF_DOCS = NO
# detailed member documentation.
# The default value is: NO.
SORT_MEMBERS_CTORS_1ST = YES
SORT_MEMBERS_CTORS_1ST = NO
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
# of group names into alphabetical order. If set to NO the group names will
@ -580,7 +580,7 @@ STRICT_PROTO_MATCHING = NO
# documentation.
# The default value is: YES.
GENERATE_TODOLIST = YES
GENERATE_TODOLIST = NO
# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
# test list. This list is created by putting \test commands in the
@ -600,7 +600,7 @@ GENERATE_BUGLIST = YES
# the documentation.
# The default value is: YES.
GENERATE_DEPRECATEDLIST= YES
GENERATE_DEPRECATEDLIST= NO
# The ENABLED_SECTIONS tag can be used to enable conditional documentation
# sections, marked by \if <section_label> ... \endif and \cond <section_label>
@ -631,14 +631,14 @@ SHOW_USED_FILES = YES
# (if specified).
# The default value is: YES.
SHOW_FILES = YES
SHOW_FILES = NO
# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
# page. This will remove the Namespaces entry from the Quick Index and from the
# Folder Tree View (if specified).
# The default value is: YES.
SHOW_NAMESPACES = YES
SHOW_NAMESPACES = NO
# The FILE_VERSION_FILTER tag can be used to specify a program or script that
# doxygen should invoke to get the current version for each file (typically from
@ -744,10 +744,9 @@ WARN_LOGFILE =
# Note: If this tag is empty the current directory is searched.
INPUT = ../cocos \
../cocos/2d/platform \
../docs \
../extensions \
../cocos/scripting/lua/bindings
../docs \
../extensions/GUI/CCScrollView \
../external/lua/luajit/include
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@ -782,7 +781,39 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.
EXCLUDE = ../cocos2dx/platform/third_party
EXCLUDE = ../cocos/audio/android \
../cocos/audio/apple \
../cocos/audio/ios \
../cocos/audio/linux \
../cocos/audio/mac \
../cocos/audio/openal \
../cocos/audio/win32 \
../cocos/audio/winrt \
../cocos/audio/wp8 \
../cocos/deprecated \
../cocos/editor-support \
../cocos/platform/android \
../cocos/platform/apple \
../cocos/platform/desktop \
../cocos/platform/ios \
../cocos/platform/linux \
../cocos/platform/mac \
../cocos/platform/win32 \
../cocos/platform/win8.1-universal \
../cocos/platform/winrt \
../cocos/platform/wp8 \
../cocos/platform/wp8-xaml \
../cocos/scripting/lua-bindings/auto \
../cocos/scripting/lua-bindings/manual/cocosbuilder \
../cocos/scripting/lua-bindings/manual/cocostudio \
../cocos/scripting/lua-bindings/manual/spine \
../cocos/scripting/lua-bindings/manual/extension \
../cocos/scripting/lua-bindings/manual/cocosdenshion \
../cocos/scripting/lua-bindings/manual/audioengine \
../cocos/scripting/lua-bindings/manual/3d \
../cocos/scripting/lua-bindings/manual/ui \
../cocos/scripting/lua-bindings/manual/network \
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
@ -804,7 +835,15 @@ EXCLUDE_PATTERNS = .svn \
proj.ios \
data_support \
image_support \
zip_support
zip_support \
*/UIEditBox/UIEditBoxImpl* \
*/ui/UIWebViewImpl* \
UIVideoPlayer-android.cpp \
UIVideoPlayer-ios.mm \
LuaBasicConversions.h \
tolua_fix.h \
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@ -816,7 +855,16 @@ EXCLUDE_PATTERNS = .svn \
# exclude all test directories use the pattern */test/*
EXCLUDE_SYMBOLS = ccArray \
ccCArray
ccCArray \
__CCCallFuncND \
__CCCallFuncO \
__LayerRGBA \
__NodeRGBA \
__RGBAProtocol \
RelativeLayoutManager \
LinearHorizontalLayoutManager \
LinearVerticalLayoutManager \
LayoutProtocol \
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
# that contain example code fragments that are included (see the \include
@ -1365,7 +1413,7 @@ ECLIPSE_DOC_ID = org.doxygen.Project
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
DISABLE_INDEX = NO
DISABLE_INDEX = YES
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
# structure should be generated to display hierarchical information. If the tag
@ -1437,7 +1485,7 @@ FORMULA_TRANSPARENT = YES
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
USE_MATHJAX = NO
USE_MATHJAX = YES
# When MathJax is enabled you can set the default output format to be used for
# the MathJax output. See the MathJax site (see:
@ -1460,7 +1508,7 @@ MATHJAX_FORMAT = HTML-CSS
# The default value is: http://cdn.mathjax.org/mathjax/latest.
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
# MATHJAX_RELPATH = ../
# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
# extension names that should be enabled during MathJax rendering. For example
@ -1933,7 +1981,9 @@ MACRO_EXPANSION = YES
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
EXPAND_ONLY_PREDEF = YES
E /*
* \internal
*_ONLY_PREDEF = YES
# If the SEARCH_INCLUDES tag is set to YES the includes files in the
# INCLUDE_PATH will be searched if a #include is found.
@ -1976,12 +2026,28 @@ PREDEFINED = "CC_PROPERTY_READONLY(varType, varName, funName)=protec
"CC_SYNTHESIZE_READONLY_PASS_BY_REF(varType, varName, funName)=protected: varType varName;\n /** get##funName */ \n public: virtual const varType& get##funName(void);" \
"NS_CC_BEGIN=namespace cocos2d {" \
"NS_CC_END=}" \
"NS_CC_MATH_BEGIN=namespace cocos2d {" \
"NS_CC_MATH_END=}" \
"USING_NS_CC=using namsspace cocos2d" \
"USING_NS_CC_MATH=using namsspace cocos2d" \
"NS_CC_EXT_BEGIN=namespace cocos2d { namespace extension {" \
"NS_CC_EXT_END=}}" \
"USING_NS_CC_EXT=using namespace cocos2d::extension" \
"CC_USE_PHYSICS" \
"CC_DEPRECATED_ATTRIBUTE"
"CC_DEPRECATED_ATTRIBUTE" \
"CC_CONSTRUCTOR_ACCESS=protected" \
"protected=private" \
"CC_DLL=" \
"CC_GUI_DLL=" \
"_USRDLL=" \
"_EXPORT_DLL_=" \
"EXPORT_DLL_=" \
"_USEGUIDLL=" \
"_USREXDLL=" \
"_USRSTUDIODLL=" \
"TOLUA_API=extern" \
"CC_ENABLE_SCRIPT_BINDING=1" \
"CC_USE_PHYSICS=1"
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
@ -2064,7 +2130,7 @@ PERL_PATH = /usr/bin/perl
# powerful graphs.
# The default value is: YES.
CLASS_DIAGRAMS = YES
CLASS_DIAGRAMS = NO
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see:

View File

@ -238,19 +238,35 @@ PUParticleSystem3D* PUParticleSystem3D::create()
PUParticleSystem3D* PUParticleSystem3D::create( const std::string &filePath, const std::string &materialPath )
{
std::string matfullPath = FileUtils::getInstance()->fullPathForFilename(materialPath);
convertToUnixStylePath(matfullPath);
PUMaterialCache::Instance()->loadMaterials(matfullPath);
PUParticleSystem3D* ps = PUParticleSystem3D::create();
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
convertToUnixStylePath(fullPath);
if (!ps->initSystem(fullPath)){
CC_SAFE_DELETE(ps);
PUParticleSystem3D *ret = new (std::nothrow) PUParticleSystem3D();
if (ret && ret->initWithFilePathAndMaterialPath(filePath, materialPath))
{
ret->autorelease();
return ret;
}
else
{
CC_SAFE_DELETE(ret);
return nullptr;
}
return ps;
}
PUParticleSystem3D* PUParticleSystem3D::create( const std::string &filePath )
{
PUParticleSystem3D *ret = new (std::nothrow) PUParticleSystem3D();
if (ret && ret->initWithFilePath(filePath))
{
ret->autorelease();
return ret;
}
else
{
CC_SAFE_DELETE(ret);
return nullptr;
}
}
bool PUParticleSystem3D::initWithFilePath( const std::string &filePath )
{
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
convertToUnixStylePath(fullPath);
@ -269,12 +285,24 @@ PUParticleSystem3D* PUParticleSystem3D::create( const std::string &filePath )
PUMaterialCache::Instance()->loadMaterialsFromSearchPaths(materialFolder);
loadedFolder.push_back(materialFolder);
}
PUParticleSystem3D* ps = PUParticleSystem3D::create();
if (!ps->initSystem(fullPath)){
CC_SAFE_DELETE(ps);
if (!initSystem(fullPath)){
return false;
}
return ps;
return true;
}
bool PUParticleSystem3D::initWithFilePathAndMaterialPath( const std::string &filePath, const std::string &materialPath )
{
std::string matfullPath = FileUtils::getInstance()->fullPathForFilename(materialPath);
convertToUnixStylePath(matfullPath);
PUMaterialCache::Instance()->loadMaterials(matfullPath);
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
convertToUnixStylePath(fullPath);
if (!initSystem(fullPath)){
return false;
}
return true;
}
void PUParticleSystem3D::startParticleSystem()

View File

@ -357,6 +357,9 @@ CC_CONSTRUCTOR_ACCESS:
PUParticleSystem3D();
virtual ~PUParticleSystem3D();
bool initWithFilePath(const std::string &filePath);
bool initWithFilePathAndMaterialPath (const std::string &filePath, const std::string &materialPath);
protected:
void prepared();

View File

@ -1,6 +1,6 @@
{
"version":"v3-deps-45",
"zip_file_size":"117286481",
"version":"v3-deps-47",
"zip_file_size":"74127526",
"repo_name":"cocos2d-x-3rd-party-libs-bin",
"repo_parent":"https://github.com/cocos2d/",
"move_dirs":{

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.

View File

@ -181,6 +181,12 @@
"cocos/2d/CCTweenFunction.cpp",
"cocos/2d/CCTweenFunction.h",
"cocos/2d/CMakeLists.txt",
"cocos/2d/MarchingSquare.cpp",
"cocos/2d/MarchingSquare.h",
"cocos/2d/SpritePolygon.cpp",
"cocos/2d/SpritePolygon.h",
"cocos/2d/SpritePolygonCache.cpp",
"cocos/2d/SpritePolygonCache.h",
"cocos/2d/cocos2d.def",
"cocos/2d/cocos2d_headers.props",
"cocos/2d/cocos2dx.props",
@ -1066,6 +1072,7 @@
"cocos/renderer/ccShader_PositionColorLengthTexture.frag",
"cocos/renderer/ccShader_PositionColorLengthTexture.vert",
"cocos/renderer/ccShader_PositionColorTextureAsPointsize.vert",
"cocos/renderer/ccShader_PositionColorTextureAsPointsize_wp81.vert",
"cocos/renderer/ccShader_PositionTexture.frag",
"cocos/renderer/ccShader_PositionTexture.vert",
"cocos/renderer/ccShader_PositionTextureA8Color.frag",
@ -1079,6 +1086,7 @@
"cocos/renderer/ccShader_PositionTexture_uColor.vert",
"cocos/renderer/ccShader_Position_uColor.frag",
"cocos/renderer/ccShader_Position_uColor.vert",
"cocos/renderer/ccShader_Position_uColor_wp81.vert",
"cocos/renderer/ccShader_UI_Gray.frag",
"cocos/renderer/ccShaders.cpp",
"cocos/renderer/ccShaders.h",
@ -2282,6 +2290,18 @@
"external/png/prebuilt/ios/libpng.a",
"external/png/prebuilt/mac/libpng.a",
"external/png/prebuilt/win32/libpng.lib",
"external/poly2tri/common/shapes.cc",
"external/poly2tri/common/shapes.h",
"external/poly2tri/common/utils.h",
"external/poly2tri/poly2tri.h",
"external/poly2tri/sweep/advancing_front.cc",
"external/poly2tri/sweep/advancing_front.h",
"external/poly2tri/sweep/cdt.cc",
"external/poly2tri/sweep/cdt.h",
"external/poly2tri/sweep/sweep.cc",
"external/poly2tri/sweep/sweep.h",
"external/poly2tri/sweep/sweep_context.cc",
"external/poly2tri/sweep/sweep_context.h",
"external/sqlite3/Android.mk",
"external/sqlite3/include/sqlite3.h",
"external/sqlite3/include/sqlite3ext.h",
@ -2535,6 +2555,7 @@
"licenses/LICENSE_JSON4Lua.txt",
"licenses/LICENSE_Kazmath.txt",
"licenses/LICENSE_LuaSocket.txt",
"licenses/LICENSE_Poly2Tri.txt",
"licenses/LICENSE_SpiderMonkey.txt",
"licenses/LICENSE_artwork.txt",
"licenses/LICENSE_box2d.txt",
@ -6068,6 +6089,8 @@
"cocos/scripting/lua-bindings/auto/api/SpriteDisplayData.lua",
"cocos/scripting/lua-bindings/auto/api/SpriteFrame.lua",
"cocos/scripting/lua-bindings/auto/api/SpriteFrameCache.lua",
"cocos/scripting/lua-bindings/auto/api/SpritePolygon.lua",
"cocos/scripting/lua-bindings/auto/api/SpritePolygonCache.lua",
"cocos/scripting/lua-bindings/auto/api/StopGrid.lua",
"cocos/scripting/lua-bindings/auto/api/TMXLayer.lua",
"cocos/scripting/lua-bindings/auto/api/TMXLayerInfo.lua",

View File

@ -89,6 +89,7 @@
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>../../Classes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>CC_WINDOWS_PHONE_8_1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
@ -98,6 +99,7 @@
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>../../Classes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>CC_WINDOWS_PHONE_8_1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@ -107,6 +109,7 @@
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>../../Classes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>CC_WINDOWS_PHONE_8_1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -116,6 +119,7 @@
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>../../Classes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>CC_WINDOWS_PHONE_8_1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -89,6 +89,7 @@
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>CC_WINDOWS_PHONE_8_1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
@ -98,6 +99,7 @@
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>CC_WINDOWS_PHONE_8_1;WINRT;_VARIADIC_MAX=10;NOMINMAX;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@ -107,6 +109,7 @@
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>CC_WINDOWS_PHONE_8_1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -116,6 +119,7 @@
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>CC_WINDOWS_PHONE_8_1;WINRT;_VARIADIC_MAX=10;NOMINMAX;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -176,6 +176,7 @@ set(TESTS_SRC
Classes/ShaderTest/ShaderTest.cpp
Classes/ShaderTest/ShaderTest2.cpp
Classes/SpriteTest/SpriteTest.cpp
Classes/SpritePolygonTest/SpritePolygonTest.cpp
Classes/Sprite3DTest/Sprite3DTest.cpp
Classes/Sprite3DTest/DrawNode3D.cpp
Classes/TerrainTest/TerrainTest.cpp

View File

@ -305,7 +305,7 @@ void TestSuite::restartCurrTest()
testCase->setTestSuite(this);
testCase->setTestCaseName(_childTestNames[_currTestIndex]);
Director::getInstance()->replaceScene(testCase);
Director::getInstance()->replaceScene(scene);
}
void TestSuite::enterNextTest()
@ -317,7 +317,7 @@ void TestSuite::enterNextTest()
testCase->setTestSuite(this);
testCase->setTestCaseName(_childTestNames[_currTestIndex]);
Director::getInstance()->replaceScene(testCase);
Director::getInstance()->replaceScene(scene);
}
void TestSuite::enterPreviousTest()
@ -336,7 +336,7 @@ void TestSuite::enterPreviousTest()
testCase->setTestSuite(this);
testCase->setTestCaseName(_childTestNames[_currTestIndex]);
Director::getInstance()->replaceScene(testCase);
Director::getInstance()->replaceScene(scene);
}
//TestCase

View File

@ -1265,7 +1265,7 @@ Sprite3DWithSkinTest::Sprite3DWithSkinTest()
_menuItem->setPosition(VisibleRect::left().x + 50, VisibleRect::top().y -70);
addChild(menu, 1);
_highQuality = true;
_animateQuality = (int)Animate3DQuality::QUALITY_HIGH;
_sprits.clear();
auto s = Director::getInstance()->getWinSize();
@ -1308,7 +1308,7 @@ void Sprite3DWithSkinTest::addNewSpriteWithCoords(Vec2 p)
}
animate->setSpeed(inverse ? -speed : speed);
animate->setTag(110);
animate->setHighQuality(_highQuality);
animate->setQuality((Animate3DQuality)_animateQuality);
auto repeate = RepeatForever::create(animate);
repeate->setTag(110);
sprite->runAction(repeate);
@ -1317,18 +1317,22 @@ void Sprite3DWithSkinTest::addNewSpriteWithCoords(Vec2 p)
void Sprite3DWithSkinTest::switchAnimationQualityCallback(Ref* sender)
{
_highQuality = !_highQuality;
++_animateQuality;
if (_animateQuality > (int)Animate3DQuality::QUALITY_HIGH)
_animateQuality = (int)Animate3DQuality::QUALITY_NONE;
if (_highQuality)
_menuItem->setString("High Quality");
else
if (_animateQuality == (int)Animate3DQuality::QUALITY_NONE)
_menuItem->setString("None Quality");
else if (_animateQuality == (int)Animate3DQuality::QUALITY_LOW)
_menuItem->setString("Low Quality");
else if (_animateQuality == (int)Animate3DQuality::QUALITY_HIGH)
_menuItem->setString("High Quality");
for (auto iter: _sprits)
{
RepeatForever* repAction = dynamic_cast<RepeatForever*>(iter->getActionByTag(110));
Animate3D* animate3D = dynamic_cast<Animate3D*>(repAction->getInnerAction());
animate3D->setHighQuality(_highQuality);
animate3D->setQuality((Animate3DQuality)_animateQuality);
}
}

View File

@ -289,7 +289,7 @@ public:
void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
private:
std::vector<cocos2d::Sprite3D*> _sprits;
bool _highQuality;
int _animateQuality;
cocos2d::MenuItemFont* _menuItem;
};

View File

@ -0,0 +1,497 @@
//
// SpritePolygonTest.cpp
// cocos2d_tests
//
// Created by WuHao on 15/4/23.
//
//
#include "SpritePolygonTest.h"
#include "2d/SpritePolygon.h"
#include "../testResource.h"
USING_NS_CC;
SpritePolygonTest::SpritePolygonTest()
{
ADD_TEST_CASE(SpritePolygonTest1);
ADD_TEST_CASE(SpritePolygonTest2);
ADD_TEST_CASE(SpritePolygonTest3);
ADD_TEST_CASE(SpritePolygonTest4);
ADD_TEST_CASE(SpritePolygonPerformanceTestStatic);
ADD_TEST_CASE(SpritePerformanceTestStatic);
ADD_TEST_CASE(SpritePolygonPerformanceTestDynamic);
ADD_TEST_CASE(SpritePerformanceTestDynamic);
}
SpritePolygonPerformance::SpritePolygonPerformance()
{
SpritePolygonCache::getInstance()->removeAllSpritePolygonCache();
Director::getInstance()->setClearColor(Color4F(102.f/255, 184.f/255, 204.f/255, 255.f));
TTFConfig ttfConfig("fonts/arial.ttf", 10);
perfLabel = Label::createWithTTF(ttfConfig, "performance test");
addChild(perfLabel);
perfLabel->setPosition(Director::getInstance()->getVisibleSize().width/2, 80);
spriteCount = vertCount = triCount = pixelCount = continuousLowDt =0;
auto size = Director::getInstance()->getVisibleSize();
elapsedTime = 0;
_posX = _leftX = size.width*0.15;
_rightX = size.width*0.85;
_posY = size.height/2;
prevDt = 0.016f;
goRight = true;
ended = false;
scheduleUpdate();
continuousHighDtTime = 0.0;
waitingTime = 0.0;
}
void SpritePolygonPerformance::updateLabel()
{
// std::string temp = "Nodes: " + Value(spriteCount).asString() + " Triangles: " + Value(triCount).asString() + "\nPixels: " + Value(pixelCount).asString() + " Vertices: " + Value(vertCount).asString();
if(!ended)
perfLabel->setString("Nodes: " + Value(spriteCount).asString() + " Triangles: " + Value(triCount).asString() + "\nPixels: " + Value(pixelCount).asString() + " Vertices: " + Value(vertCount).asString());
}
Node *SpritePolygonPerformance::makeSprite()
{
return Node::create();
}
void SpritePolygonPerformance::update(float dt)
{
dt = dt*0.3 + prevDt*0.7;
prevDt = dt;
elapsedTime += dt;
int loops = (0.025-dt)*1000;
if(dt < 0.025 && loops>0)
{
continuousHighDtTime = clampf(continuousHighDtTime-dt*2, 0.0, 1.0);
waitingTime = clampf(waitingTime-dt, 0.0, 5.0);
continuousLowDt++;
}
else
{
continuousHighDtTime+=dt;
continuousLowDt = 0;
}
if (continuousLowDt >= 5 && loops > 0) {
for(int i = 0; i < loops; i++)
{
if(_posX >= _rightX)
{
goRight = false;
}
else if(_posX <= _leftX)
{
goRight = true;
}
auto s = makeSprite();
addChild(s);
s->setPosition(_posX, _posY);
if(goRight)
_posX++;
else
_posX--;
incrementStats();
}
updateLabel();
}
//if we have 10 continuous low dt, then we will start to create more sprites
else if(continuousHighDtTime >= .5 || waitingTime > 3.0){
// its now 1 seconds with high DT time, time to end
ended = true;
unscheduleUpdate();
perfLabel->setString("Test ended in " + Value(elapsedTime).asString() + " seconds\nNodes: " + Value(spriteCount).asString() + " Triangles: " + Value(triCount).asString() + "\nPixels: " + Value(pixelCount).asString() + " Vertices: " + Value(vertCount).asString());
_subtitleLabel->setString("Test ended");
}
else{
waitingTime += dt;
}
}
void SpritePolygonPerformance::incrementStats()
{
spriteCount ++;
vertCount += _incVert;
triCount += _incTri;
pixelCount += _incPix;
}
SpritePolygonPerformanceTestStatic::SpritePolygonPerformanceTestStatic()
{
_title = "Static SpritePolygon Performance";
_subtitle = "Test running, please wait until it ends";
initIncrementStats();
}
experimental::SpritePolygon* SpritePolygonPerformanceTestStatic::makeSprite()
{
return experimental::SpritePolygon::create(s_pathGrossini);
}
void SpritePolygonPerformanceTestStatic::initIncrementStats()
{
auto t = experimental::SpritePolygon::create(s_pathGrossini);
_incVert = (int)t->getVertCount();
_incTri = (int)t->getTrianglesCount();
_incPix = (int)t->getArea();
}
SpritePolygonPerformanceTestDynamic::SpritePolygonPerformanceTestDynamic()
{
_title = "Dynamic SpritePolygon Performance";
_subtitle = "Test running, please wait until it ends";
initIncrementStats();
}
experimental::SpritePolygon* SpritePolygonPerformanceTestDynamic::makeSprite()
{
auto ret = experimental::SpritePolygon::create(s_pathGrossini);
ret->runAction(RepeatForever::create(RotateBy::create(1.0,360.0)));
return ret;
}
SpritePerformanceTestStatic::SpritePerformanceTestStatic()
{
_title = "Static Sprite Performance";
_subtitle = "Test running, please wait until it ends";
initIncrementStats();
}
Sprite* SpritePerformanceTestStatic::makeSprite()
{
return Sprite::create(s_pathGrossini);
}
void SpritePerformanceTestStatic::initIncrementStats()
{
auto t = Sprite::create(s_pathGrossini);
_incVert = 4;
_incTri = 2;
_incPix = t->getContentSize().width * t->getContentSize().height;
}
SpritePerformanceTestDynamic::SpritePerformanceTestDynamic()
{
_title = "Dynamic Sprite Performance";
_subtitle = "Test running, please wait until it ends";
initIncrementStats();
}
Sprite* SpritePerformanceTestDynamic::makeSprite()
{
auto ret = Sprite::create(s_pathGrossini);
ret->runAction(RepeatForever::create(RotateBy::create(1.0,360.0)));
return ret;
}
void SpritePolygonTestDemo::initDefaultSprite(const std::string &filename, cocos2d::experimental::SpritePolygon * inst)
{
Director::getInstance()->setClearColor(Color4F(102.f/255, 184.f/255, 204.f/255, 255.f));
spp = inst;
addChild(spp);
auto s = Director::getInstance()->getWinSize();
auto offset = Vec2(0.15*s.width,0);
spp->setPosition(Vec2(s)/2 + offset);
sp = Sprite::create(filename);
addChild(sp);
sp->setPosition(Vec2(s)/2 - offset);
auto touchListener = EventListenerTouchOneByOne::create();
touchListener->onTouchBegan = [&](Touch* touch, Event* event){
spp->showDebug(true);
debugForNormalSprite->setVisible(true);
return true;
};
touchListener->onTouchMoved = [&](Touch* touch, Event* event){
auto pos = touch->getDelta();
float newScale = clampf(spp->getScale() + pos.x * 0.01f, 0.1f, 2.f);
spp->setScale(newScale);
sp->setScale(newScale);
};
touchListener->onTouchEnded = [&](Touch* touch, Event* event){
spp->showDebug(false);
debugForNormalSprite->setVisible(false);
};
_eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this);
debugForNormalSprite = DrawNode::create();
sp->addChild(debugForNormalSprite);
auto positions = new Vec2[4];
auto spSize = sp->getContentSize();
positions[0] = Vec2(0, spSize.height);
positions[1] = Vec2(spSize);
positions[2] = Vec2(spSize.width, 0);
positions[3] = Vec2(0,0);
debugForNormalSprite->drawPoints(positions, 4, 8, Color4F{0.0,1.0,1.0,1.0});
debugForNormalSprite->drawLine(positions[0], positions[1], Color4F::GREEN);
debugForNormalSprite->drawLine(positions[1], positions[2], Color4F::GREEN);
debugForNormalSprite->drawLine(positions[2], positions[3], Color4F::GREEN);
debugForNormalSprite->drawLine(positions[3], positions[0], Color4F::GREEN);
debugForNormalSprite->drawLine(positions[0], positions[2], Color4F::GREEN);
debugForNormalSprite->setVisible(false);
TTFConfig ttfConfig("fonts/arial.ttf", 8);
std::string temp = "Sprite:\nPixels drawn: ";
auto spArea = Label::createWithTTF(ttfConfig, temp+Value((int)spSize.width*(int)spSize.height).asString());
sp->addChild(spArea);
spArea->setAnchorPoint(Vec2(0,1));
temp = "SpritePolygon:\nPixels drawn: ";
auto vertCount = "\nverts:"+Value((int)spp->getVertCount()).asString();
auto sppArea = Label::createWithTTF(ttfConfig, temp+Value((int)spp->getArea()).asString()+vertCount);
spp->addChild(sppArea);
sppArea->setAnchorPoint(Vec2(0,1));
}
void SpritePolygonTestCase::onBackCallback(cocos2d::Ref *sender)
{
TestCase::onBackCallback(sender);
Director::getInstance()->setClearColor(Color4F::BLACK);
}
SpritePolygonTest1::SpritePolygonTest1()
{
SpritePolygonCache::getInstance()->removeAllSpritePolygonCache();
_title = "SpritePolygon Creation";
_subtitle = "SpritePolygon::create(\"Images/grossini.png\")";
cocos2d::experimental::SpritePolygon *s;
for(int i = 0; i < 10; i ++)
{
s= experimental::SpritePolygon::create(s_pathGrossini);
}
initDefaultSprite(s_pathGrossini, s);
}
SpritePolygonTest2::SpritePolygonTest2()
{
/*
36.5 128.5
27.5 133.5
24.5 145.5
26.5 161.5
33.5 168.5
27.5 168.5
16.5 179.5
30.5 197.5
28.5 237.5
56.5 237.5
54.5 197.5
68.5 184.5
57.5 168.5
51.5 168.5
60.5 154.5
57.5 133.5
48.5 127.5
36.5 127.5
*/
std::vector<Vec2> verts;
verts.push_back(Vec2(36.5, 242.0-128.5));
verts.push_back(Vec2(27.5, 242.0-133.5));
verts.push_back(Vec2(24.5, 242.0-145.5));
verts.push_back(Vec2(26.5, 242.0-161.5));
verts.push_back(Vec2(33.5, 242.0-168.5));
verts.push_back(Vec2(27.5, 242.0-168.5));
verts.push_back(Vec2(16.5, 242.0-179.5));
verts.push_back(Vec2(30.5, 242.0-197.5));
verts.push_back(Vec2(28.5, 242.0-237.5));
verts.push_back(Vec2(56.5, 242.0-237.5));
verts.push_back(Vec2(54.5, 242.0-197.5));
verts.push_back(Vec2(68.5, 242.0-184.5));
verts.push_back(Vec2(57.5, 242.0-168.5));
verts.push_back(Vec2(51.5, 242.0-168.5));
verts.push_back(Vec2(60.5, 242.0-154.5));
verts.push_back(Vec2(57.5, 242.0-133.5));
verts.push_back(Vec2(48.5, 242.0-127.5));
verts.push_back(Vec2(36.5, 242.0-127.5));
SpritePolygonCache::getInstance()->removeAllSpritePolygonCache();
_title = "SpritePolygon Creation";
_subtitle = "SpritePolygon::create(\"Images/grossini.png\", verts)";
auto s = experimental::SpritePolygon::create(s_pathGrossini, verts);
initDefaultSprite(s_pathGrossini, s);
}
SpritePolygonTest3::SpritePolygonTest3()
{
/*
18, 48
33.500000, 73.500000
27.500000, 73.500000
16.500000, 62.500000
30.500000, 44.500000
54.500000, 44.500000
51.500000, 73.500000
60.500000, 87.500000
26.500000, 80.500000
24.500000, 96.500000
57.500000, 108.500000
36.500000, 113.500000
48.500000, 114.500000
36.500000, 114.500000
27.500000, 108.500000
68.500000, 57.500000
57.500000, 73.500000
56.500000, 4.500000
28.500000, 4.500000
0, 1, 2
3, 0, 2
4, 0, 3
5, 0, 4
5, 6, 0
0, 6, 7
8, 7, 6
6, 9, 8
9, 10, 8
9, 11, 10
11, 12, 10
8, 10, 13
14, 5, 4
15, 5, 14
4, 3, 16
3, 17, 16
*/
std::vector<Vec2> verts;
verts.push_back(Vec2(33.500000, 73.500000));
verts.push_back(Vec2(27.500000, 73.500000));
verts.push_back(Vec2(16.500000, 62.500000));
verts.push_back(Vec2(30.500000, 44.500000));
verts.push_back(Vec2(54.500000, 44.500000));
verts.push_back(Vec2(51.500000, 73.500000));
verts.push_back(Vec2(60.500000, 87.500000));
verts.push_back(Vec2(26.500000, 80.500000));
verts.push_back(Vec2(24.500000, 96.500000));
verts.push_back(Vec2(57.500000, 108.500000));
verts.push_back(Vec2(36.500000, 113.500000));
verts.push_back(Vec2(48.500000, 114.500000));
verts.push_back(Vec2(36.500000, 114.500000));
verts.push_back(Vec2(27.500000, 108.500000));
verts.push_back(Vec2(68.500000, 57.500000));
verts.push_back(Vec2(57.500000, 73.500000));
verts.push_back(Vec2(56.500000, 4.500000));
verts.push_back(Vec2(28.500000, 4.500000));
unsigned short indicesArr[] = {0, 1, 2, 3, 0, 2, 4, 0, 3, 5, 0, 4, 5, 6, 0, 0, 6, 7, 8, 7, 6, 6, 9, 8, 9, 10, 8, 9, 11, 10, 11, 12, 10, 8, 10, 13, 14, 5, 4, 15, 5, 14, 4, 3, 16, 3, 17, 16};
std::vector<unsigned short> indices(indicesArr, indicesArr + sizeof indicesArr / sizeof indicesArr[0]);
SpritePolygonCache::getInstance()->removeAllSpritePolygonCache();
_title = "SpritePolygon Creation";
_subtitle = "SpritePolygon::create(\"Images/grossini.png\", verts, indices)";
auto s = experimental::SpritePolygon::create(s_pathGrossini, verts, indices);
initDefaultSprite(s_pathGrossini, s);
}
SpritePolygonTest4::SpritePolygonTest4(){
/*
18, 48
33.500000, 73.500000
27.500000, 73.500000
16.500000, 62.500000
30.500000, 44.500000
54.500000, 44.500000
51.500000, 73.500000
60.500000, 87.500000
26.500000, 80.500000
24.500000, 96.500000
57.500000, 108.500000
36.500000, 113.500000
48.500000, 114.500000
36.500000, 114.500000
27.500000, 108.500000
68.500000, 57.500000
57.500000, 73.500000
56.500000, 4.500000
28.500000, 4.500000
0, 1, 2,
3, 0, 2,
4, 0, 3,
5, 0, 4,
5, 6, 0,
0, 6, 7,
8, 7, 6,
6, 9, 8,
9, 10, 8,
9, 11, 10,
11, 12, 10,
8, 10, 13,
14, 5, 4,
15, 5, 14,
4, 3, 16,
3, 17, 16,
0.394118, 0.392562
0.323529, 0.392562
0.194118, 0.483471
0.358824, 0.632231
0.641176, 0.632231
0.605882, 0.392562
0.711765, 0.276859
0.311765, 0.334711
0.288235, 0.202479
0.676471, 0.103306
0.429412, 0.061983
0.570588, 0.053719
0.429412, 0.053719
0.323529, 0.103306
0.805882, 0.524793
0.676471, 0.392562
0.664706, 0.962810
0.335294, 0.962810
*/
Vec3 poss[] = {Vec3(33.500000, 73.500000,0),
Vec3(27.500000, 73.500000,0),
Vec3(16.500000, 62.500000,0),
Vec3(30.500000, 44.500000,0),
Vec3(54.500000, 44.500000,0),
Vec3(51.500000, 73.500000,0),
Vec3(60.500000, 87.500000,0),
Vec3(26.500000, 80.500000,0),
Vec3(24.500000, 96.500000,0),
Vec3(57.500000, 108.500000,0),
Vec3(36.500000, 113.500000,0),
Vec3(48.500000, 114.500000,0),
Vec3(36.500000, 114.500000,0),
Vec3(27.500000, 108.500000,0),
Vec3(68.500000, 57.500000,0),
Vec3(57.500000, 73.500000,0),
Vec3(56.500000, 4.500000,0),
Vec3(28.500000, 4.50000, 0)
};
unsigned short idxs[] = {0, 1, 2, 3, 0, 2, 4, 0, 3, 5, 0, 4, 5, 6, 0, 0, 6, 7, 8, 7, 6, 6, 9, 8, 9, 10, 8, 9, 11, 10, 11, 12, 10, 8, 10, 13, 14, 5, 4, 15, 5, 14, 4, 3, 16, 3, 17, 16};
std::vector<unsigned short> indices(idxs, idxs + sizeof idxs / sizeof idxs[0]);
Tex2F t2f[] = {
Tex2F(0.394118f, 0.392562f),
Tex2F(0.323529f, 0.392562f),
Tex2F(0.194118f, 0.483471f),
Tex2F(0.358824f, 0.632231f),
Tex2F(0.641176f, 0.632231f),
Tex2F(0.605882f, 0.392562f),
Tex2F(0.711765f, 0.276859f),
Tex2F(0.311765f, 0.334711f),
Tex2F(0.288235f, 0.202479f),
Tex2F(0.676471f, 0.103306f),
Tex2F(0.429412f, 0.061983f),
Tex2F(0.570588f, 0.053719f),
Tex2F(0.429412f, 0.053719f),
Tex2F(0.323529f, 0.103306f),
Tex2F(0.805882f, 0.524793f),
Tex2F(0.676471f, 0.392562f),
Tex2F(0.664706f, 0.962810f),
Tex2F(0.335294f, 0.962810f)
};
std::vector<V3F_C4B_T2F> vs;
for(int i = 0; i < 18; i++)
{
V3F_C4B_T2F t = {poss[i],Color4B::WHITE, t2f[i]};
vs.push_back(t);
}
SpritePolygonCache::getInstance()->removeAllSpritePolygonCache();
_title = "SpritePolygon Creation";
_subtitle = "SpritePolygon::create(\"Images/grossini.png\", vector<V3F_C4B_T2F> v, vector<unsigned short> indices)";
auto s = experimental::SpritePolygon::create(s_pathGrossini, vs, indices);
initDefaultSprite(s_pathGrossini, s);
}

View File

@ -0,0 +1,130 @@
#ifndef __cocos2d_tests__SpritePolygonTest__
#include "../testBasic.h"
#include "../BaseTest.h"
#include "2d/SpritePolygon.h"
DEFINE_TEST_SUITE(SpritePolygonTest);
class SpritePolygonTestCase : public TestCase
{
protected:
virtual void onBackCallback(Ref* sender);
std::string _title;
std::string _subtitle;
virtual std::string title() const override {return _title;};
virtual std::string subtitle() const override {return _subtitle;};
};
class SpritePolygonTestDemo : public SpritePolygonTestCase
{
public:
void initDefaultSprite(const std::string &filename, cocos2d::experimental::SpritePolygon *inst);
protected:
cocos2d::experimental::SpritePolygon* spp;
cocos2d::Sprite* sp;
cocos2d::DrawNode *debugForNormalSprite;
};
class SpritePolygonPerformance : public SpritePolygonTestCase
{
public:
CREATE_FUNC(SpritePolygonPerformance);
SpritePolygonPerformance();
virtual void update(float dt);
protected:
int spriteCount;
int vertCount;
int triCount;
int pixelCount;
float elapsedTime;
cocos2d::Label * perfLabel;
void updateLabel();
int continuousLowDt;
float continuousHighDtTime;
float waitingTime;
int _posX;
int _posY;
int _leftX;
int _rightX;
bool goRight;
bool ended;
float prevDt;
virtual Node* makeSprite();
virtual void incrementStats();
void initIncrementStats();
int _incVert;
int _incTri;
int _incPix;
};
class SpritePolygonPerformanceTestStatic : public SpritePolygonPerformance
{
public:
CREATE_FUNC(SpritePolygonPerformanceTestStatic);
SpritePolygonPerformanceTestStatic();
protected:
cocos2d::experimental::SpritePolygon* makeSprite();
void initIncrementStats();
};
class SpritePerformanceTestStatic : public SpritePolygonPerformance
{
public:
CREATE_FUNC(SpritePerformanceTestStatic);
SpritePerformanceTestStatic();
protected:
cocos2d::Sprite* makeSprite();
void initIncrementStats();
};
class SpritePolygonPerformanceTestDynamic : public SpritePolygonPerformanceTestStatic
{
public:
CREATE_FUNC(SpritePolygonPerformanceTestDynamic);
SpritePolygonPerformanceTestDynamic();
protected:
cocos2d::experimental::SpritePolygon* makeSprite();
};
class SpritePerformanceTestDynamic : public SpritePerformanceTestStatic
{
public:
CREATE_FUNC(SpritePerformanceTestDynamic);
SpritePerformanceTestDynamic();
protected:
cocos2d::Sprite* makeSprite();
};
class SpritePolygonTest1 : public SpritePolygonTestDemo
{
public:
CREATE_FUNC(SpritePolygonTest1);
SpritePolygonTest1();
};
class SpritePolygonTest2 : public SpritePolygonTestDemo
{
public:
CREATE_FUNC(SpritePolygonTest2);
SpritePolygonTest2();
};
class SpritePolygonTest3 : public SpritePolygonTestDemo
{
public:
CREATE_FUNC(SpritePolygonTest3);
SpritePolygonTest3();
};
class SpritePolygonTest4 : public SpritePolygonTestDemo
{
public:
CREATE_FUNC(SpritePolygonTest4);
SpritePolygonTest4();
};
#endif /* defined(__cocos2d_tests__SpritePolygonTest__) */

View File

@ -31,7 +31,7 @@ bool UISliderTest::init()
Size widgetSize = _widget->getContentSize();
// Add a label in which the slider alert will be displayed
_displayValueLabel = Text::create("Move the slider thumb","Move the slider thumb",32);
_displayValueLabel = TextBMFont::create("Move the slider thumb", "ccb/markerfelt24shadow.fnt");
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1));
_displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
_uiLayer->addChild(_displayValueLabel);

View File

@ -40,7 +40,7 @@ public:
void sliderEvent(cocos2d::Ref* sender, cocos2d::ui::Slider::EventType type);
protected:
cocos2d::ui::Text* _displayValueLabel;
cocos2d::ui::TextBMFont* _displayValueLabel;
};
class UISliderTest_Scale9 : public UIScene

View File

@ -16,6 +16,7 @@ class RootTests : public TestList
public:
RootTests()
{
addTest("SpritePolygon", [](){return new (std::nothrow) SpritePolygonTest(); });
addTest("ActionManager", [](){return new (std::nothrow) ActionManagerTests(); });
addTest("Actions - Basic", [](){ return new (std::nothrow) ActionsTests(); });
addTest("Actions - Ease", [](){return new (std::nothrow) ActionsEaseTests(); });

View File

@ -1,6 +1,7 @@
#ifndef _TESTS_H_
#define _TESTS_H_
#include "SpritePolygonTest/SpritePolygonTest.h"
#include "UnitTest/UnitTest.h"
#include "NewRendererTest/NewRendererTest.h"
#include "ConsoleTest/ConsoleTest.h"

View File

@ -22,8 +22,8 @@
<integer>1</integer>
<key>cocos2d.x.3d.max_spot_light_in_shader</key>
<integer>1</integer>
<key>cocos2d.x.3d.animate_high_quality</key>
<true/>
<key>cocos2d.x.3d.animate_quality</key>
<integer>2</integer>
</dict>
<key>metadata</key>
<dict>

View File

@ -198,7 +198,8 @@ LOCAL_SRC_FILES := main.cpp \
../../Classes/UserDefaultTest/UserDefaultTest.cpp \
../../Classes/OpenURLTest/OpenURLTest.cpp \
../../Classes/ZwoptexTest/ZwoptexTest.cpp \
../../Classes/TerrainTest/TerrainTest.cpp
../../Classes/TerrainTest/TerrainTest.cpp \
../../Classes/SpritePolygonTest/SpritePolygonTest.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
$(LOCAL_PATH)/../../../..

View File

@ -204,6 +204,7 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y</Command>
<ClCompile Include="..\Classes\SpineTest\SpineTest.cpp" />
<ClCompile Include="..\Classes\Sprite3DTest\DrawNode3D.cpp" />
<ClCompile Include="..\Classes\Sprite3DTest\Sprite3DTest.cpp" />
<ClCompile Include="..\Classes\SpritePolygonTest\SpritePolygonTest.cpp" />
<ClCompile Include="..\Classes\TerrainTest\TerrainTest.cpp" />
<ClCompile Include="..\Classes\TexturePackerEncryptionTest\TextureAtlasEncryptionTest.cpp" />
<ClCompile Include="..\Classes\TileMapTest\TileMapTest2.cpp" />
@ -405,6 +406,7 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y</Command>
<ClInclude Include="..\Classes\SpineTest\SpineTest.h" />
<ClInclude Include="..\Classes\Sprite3DTest\DrawNode3D.h" />
<ClInclude Include="..\Classes\Sprite3DTest\Sprite3DTest.h" />
<ClInclude Include="..\Classes\SpritePolygonTest\SpritePolygonTest.h" />
<ClInclude Include="..\Classes\TerrainTest\TerrainTest.h" />
<ClInclude Include="..\Classes\TexturePackerEncryptionTest\TextureAtlasEncryptionTest.h" />
<ClInclude Include="..\Classes\TileMapTest\TileMapTest2.h" />

View File

@ -355,6 +355,9 @@
<Filter Include="Classes\TerrainTest">
<UniqueIdentifier>{3f5069e6-78e5-4388-b614-04c0ea943b4c}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\SpritePolygonTest">
<UniqueIdentifier>{b35cfbde-9e13-4981-8458-f7596f089bde}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
@ -930,6 +933,9 @@
<ClCompile Include="..\Classes\PerformanceTest\PerformanceParticle3DTest.cpp">
<Filter>Classes\PerformanceTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\SpritePolygonTest\SpritePolygonTest.cpp">
<Filter>Classes\SpritePolygonTest</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="main.h">
@ -1703,5 +1709,8 @@
<ClInclude Include="..\Classes\PerformanceTest\PerformanceParticle3DTest.h">
<Filter>Classes\PerformanceTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\SpritePolygonTest\SpritePolygonTest.h">
<Filter>Classes\SpritePolygonTest</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -143,6 +143,7 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\SpineTest\SpineTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\Sprite3DTest\DrawNode3D.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\Sprite3DTest\Sprite3DTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\SpritePolygonTest\SpritePolygonTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\SpriteTest\SpriteTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\TerrainTest\TerrainTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\testBasic.cpp" />
@ -407,6 +408,7 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\SpineTest\SpineTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\Sprite3DTest\DrawNode3D.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\Sprite3DTest\Sprite3DTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\SpritePolygonTest\SpritePolygonTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\SpriteTest\SpriteTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\TerrainTest\TerrainTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\testBasic.h" />

View File

@ -778,6 +778,9 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\TerrainTest\TerrainTest.cpp">
<Filter>Classes\TerrainTest</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\SpritePolygonTest\SpritePolygonTest.cpp">
<Filter>Classes\SpritePolygonTest</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\ActionManagerTest\ActionManagerTest.cpp">
@ -1683,6 +1686,9 @@
<Filter Include="Classes\TerrainTest">
<UniqueIdentifier>{56386912-b41e-4559-bd2c-b256434179d4}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\SpritePolygonTest">
<UniqueIdentifier>{ee1c5d87-3c80-4a10-892e-985fcd93a6c1}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<Page Include="$(MSBuildThisFileDirectory)..\..\..\..\cocos\platform\win8.1-universal\OpenGLESPage.xaml" />
@ -1716,5 +1722,8 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\TerrainTest\TerrainTest.h">
<Filter>Classes\TerrainTest</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\SpritePolygonTest\SpritePolygonTest.h">
<Filter>Classes\SpritePolygonTest</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -83,8 +83,8 @@
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</ForcedIncludeFiles>
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(DisableSpecificWarnings)</DisableSpecificWarnings>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CC_WINDOWS_PHONE_8_1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CC_WINDOWS_PHONE_8_1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</SDLCheck>
@ -105,8 +105,8 @@
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">pch.h</ForcedIncludeFiles>
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">%(DisableSpecificWarnings)</DisableSpecificWarnings>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">CC_WINDOWS_PHONE_8_1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">CC_WINDOWS_PHONE_8_1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">Use</PrecompiledHeader>
<SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</SDLCheck>

View File

@ -1,3 +1,5 @@
require "cocos.3d.3dConstants"
local size = cc.Director:getInstance():getWinSize()
local scheduler = cc.Director:getInstance():getScheduler()
local attributeNames =
@ -140,6 +142,8 @@ end
----------------------------------------
local Sprite3DWithSkinTest = {}
Sprite3DWithSkinTest.__index = Sprite3DWithSkinTest
Sprite3DWithSkinTest._animateQuality = cc.Animate3DQuality.QUALITY_HIGH
Sprite3DWithSkinTest._sprites = {}
function Sprite3DWithSkinTest.onTouchesEnd(touches, event)
for i = 1,table.getn(touches) do
@ -154,6 +158,7 @@ function Sprite3DWithSkinTest.addNewSpriteWithCoords(parent,x,y)
sprite:setRotation3D({x = 0, y = 180, z = 0})
sprite:setPosition(cc.p(x, y))
parent:addChild(sprite)
table.insert(Sprite3DWithSkinTest._sprites, sprite)
local animation = cc.Animation3D:create("Sprite3DTest/orc.c3b")
if nil ~= animation then
@ -177,8 +182,11 @@ function Sprite3DWithSkinTest.addNewSpriteWithCoords(parent,x,y)
else
animate:setSpeed(speed)
end
sprite:runAction(cc.RepeatForever:create(animate))
animate:setTag(110)
animate:setQuality(Sprite3DWithSkinTest._animateQuality)
local repeate = cc.RepeatForever:create(animate)
repeate:setTag(110)
sprite:runAction(repeate)
end
end
@ -193,8 +201,39 @@ function Sprite3DWithSkinTest.create()
local eventDispatcher = layer:getEventDispatcher()
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, layer)
Sprite3DWithSkinTest._sprites = {}
Sprite3DWithSkinTest.addNewSpriteWithCoords(layer, size.width / 2, size.height / 2)
cc.MenuItemFont:setFontName("fonts/arial.ttf")
cc.MenuItemFont:setFontSize(15)
local menuItem = cc.MenuItemFont:create("High Quality")
Sprite3DWithSkinTest._animateQuality = cc.Animate3DQuality.QUALITY_HIGH
menuItem:registerScriptTapHandler(function(tag, sender)
Sprite3DWithSkinTest._animateQuality = Sprite3DWithSkinTest._animateQuality + 1
if Sprite3DWithSkinTest._animateQuality > cc.Animate3DQuality.QUALITY_HIGH then
Sprite3DWithSkinTest._animateQuality = cc.Animate3DQuality.QUALITY_NONE
end
if Sprite3DWithSkinTest._animateQuality == cc.Animate3DQuality.QUALITY_NONE then
menuItem:setString("None Quality")
elseif Sprite3DWithSkinTest._animateQuality == cc.Animate3DQuality.QUALITY_LOW then
menuItem:setString("Low Quality")
elseif Sprite3DWithSkinTest._animateQuality == cc.Animate3DQuality.QUALITY_HIGH then
menuItem:setString("High Quality")
end
for i,spriteIter in ipairs(Sprite3DWithSkinTest._sprites) do
local repAction = spriteIter:getActionByTag(110)
local animate3D = repAction:getInnerAction()
animate3D:setQuality(Sprite3DWithSkinTest._animateQuality)
end
end)
local menu = cc.Menu:create(menuItem)
menu:setPosition(cc.p(0.0, 0.0))
menuItem:setPosition(VisibleRect:left().x + 50, VisibleRect:top().y -70)
layer:addChild(menu, 1)
return layer
end
@ -1078,7 +1117,8 @@ end
function Sprite3DCubeMapTest:addNewSpriteWithCoords(pos)
local visibleSize = cc.Director:getInstance():getVisibleSize()
local camera = cc.Camera:createPerspective(60, visibleSize.width / visibleSize.height, 0.1, 200)
local camera = cc.Camera:createPerspective(60, visibleSize.width / visibleSize.height, 10, 1000)
camera:setPosition3D(cc.vec3(0.0, 0.0, 50.0))
camera:setCameraFlag(cc.CameraFlag.USER1)
--create a teapot
self._teapot = cc.Sprite3D:create("Sprite3DTest/teapot.c3b")
@ -1091,14 +1131,14 @@ function Sprite3DCubeMapTest:addNewSpriteWithCoords(pos)
"Sprite3DTest/skybox/front.jpg", "Sprite3DTest/skybox/back.jpg")
--set texture parameters
local tRepeatParams = { magFilter=gl.NEAREST , minFilter=gl.NEAREST , wrapS=gl.MIRRORED_REPEAT , wrapT=gl.MIRRORED_REPEAT }
local tRepeatParams = { magFilter=gl.LINEAR , minFilter=gl.LINEAR , wrapS=gl.MIRRORED_REPEAT , wrapT=gl.MIRRORED_REPEAT }
self._textureCube:setTexParameters(tRepeatParams)
--pass the texture sampler to our custom shader
state:setUniformTexture("u_cubeTex", self._textureCube)
self._teapot:setGLProgramState(state)
self._teapot:setPosition3D(cc.vec3(0, -5, -20))
self._teapot:setPosition3D(cc.vec3(0, -5, 0))
self._teapot:setRotation3D(cc.vec3(-90, 180, 0))
local rotate_action = cc.RotateBy:create(1.5, cc.vec3(0, 30, 0))
@ -1133,15 +1173,16 @@ function Sprite3DCubeMapTest:addNewSpriteWithCoords(pos)
end
self:addChild(self._teapot)
self:addChild(camera)
self:setCameraMask(2)
--config skybox
self._skyBox = cc.Skybox:create()
self._skyBox:setTexture(self._textureCube)
self:addChild(self._skyBox)
self._skyBox:setScale(700)
self:addChild(camera)
self:setCameraMask(2)
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
if targetPlatform == cc.PLATFORM_OS_ANDROID or targetPlatform == cc.PLATFORM_OS_WINRT or targetPlatform == cc.PLATFORM_OS_WP8 then

View File

@ -0,0 +1,407 @@
local imageFileName = "Images/grossini.png"
local function initDefaultSprite(filename, spp, layer)
layer:addChild(spp)
local s = cc.Director:getInstance():getWinSize()
local offset = cc.p(0.15 * s.width, 0)
spp:setPosition(s.width/2 + 0.15 * s.width, s.height/2)
local sp = cc.Sprite:create(imageFileName)
layer:addChild(sp)
sp:setPosition(s.width/2 - 0.15 * s.width, s.height/2)
local debugForNormalSprite = cc.DrawNode:create()
sp:addChild(debugForNormalSprite)
local touchListener = cc.EventListenerTouchOneByOne:create()
touchListener:registerScriptHandler(function (touch, event)
spp:showDebug(true)
debugForNormalSprite:setVisible(true)
return true
end,cc.Handler.EVENT_TOUCH_BEGAN)
touchListener:registerScriptHandler(function (touch, event)
local pos = touch:getDelta()
local newScale = cc.clampf(spp:getScale()+pos.x*0.01, 0.1, 2)
spp:setScale(newScale)
sp:setScale(newScale)
end,cc.Handler.EVENT_TOUCH_MOVED)
touchListener:registerScriptHandler(function (touch, event)
spp:showDebug(false)
debugForNormalSprite:setVisible(false)
end,cc.Handler.EVENT_TOUCH_ENDED)
local eventDispatcher = layer:getEventDispatcher()
eventDispatcher:addEventListenerWithSceneGraphPriority(touchListener, layer)
local positions = {}
local spSize = sp:getContentSize()
positions[1] = cc.p(0, spSize.height)
positions[2] = cc.p(spSize.width, spSize.height)
positions[3] = cc.p(spSize.width, 0)
positions[4] = cc.p(0,0)
debugForNormalSprite:drawPoints(positions, 4, 8, cc.c4f(0.0,1.0,1.0,1.0))
debugForNormalSprite:drawLine(positions[1], positions[2], cc.c4f(0.0,1.0,0.0,1.0))
debugForNormalSprite:drawLine(positions[2], positions[3], cc.c4f(0.0,1.0,0.0,1.0))
debugForNormalSprite:drawLine(positions[3], positions[4], cc.c4f(0.0,1.0,0.0,1.0))
debugForNormalSprite:drawLine(positions[4], positions[1], cc.c4f(0.0,1.0,0.0,1.0))
debugForNormalSprite:drawLine(positions[1], positions[3], cc.c4f(0.0,1.0,0.0,1.0))
debugForNormalSprite:setVisible(false)
local ttfConfig = {}
ttfConfig.fontFilePath = "fonts/arial.ttf"
ttfConfig.fontSize = 8
local temp = "Sprite:\nPixels drawn: ".. spSize.width*spSize.height
local spArea = cc.Label:createWithTTF(ttfConfig, temp)
sp:addChild(spArea)
spArea:setAnchorPoint(cc.p(0,1))
temp = "SpritePolygon:\nPixels drawn: "
local vertCount = "\nverts:" .. spp:getVertCount()
local sppArea = cc.Label:createWithTTF(ttfConfig, temp .. spp:getArea() .. vertCount)
spp:addChild(sppArea)
sppArea:setAnchorPoint(cc.p(0,1))
Helper.initWithLayer(layer)
Helper.titleLabel:setString(layer:title())
Helper.subtitleLabel:setString(layer:subtitle())
local function onNodeEvent(event)
if "enter" == event then
layer:onEnter()
elseif "exit" == event then
layer:onExit()
end
end
layer:registerScriptHandler(onNodeEvent)
end
----------------------------------------
----SpritePolygonTest1
----------------------------------------
local SpritePolygonTest1 = class("SpritePolygonTest1", function ()
local layer = cc.Layer:create()
return layer
end)
function SpritePolygonTest1:ctor()
cc.SpritePolygonCache:getInstance():removeAllSpritePolygonCache()
local spp = ccexp.SpritePolygon:create(imageFileName)
cc.Director:getInstance():setClearColor(cc.c4f(102.0/255, 184.0/255, 204.0/255, 255.0))
self:addChild(spp)
local s = cc.Director:getInstance():getWinSize()
local offset = cc.p(0.15 * s.width, 0)
spp:setPosition(s.width/2 + 0.15 * s.width, s.height/2)
local sp = cc.Sprite:create(imageFileName)
self:addChild(sp)
sp:setPosition(s.width/2 - 0.15 * s.width, s.height/2)
local debugForNormalSprite = cc.DrawNode:create()
sp:addChild(debugForNormalSprite)
local touchListener = cc.EventListenerTouchOneByOne:create()
touchListener:registerScriptHandler(function (touch, event)
spp:showDebug(true)
debugForNormalSprite:setVisible(true)
return true
end,cc.Handler.EVENT_TOUCH_BEGAN)
touchListener:registerScriptHandler(function (touch, event)
local pos = touch:getDelta()
local newScale = cc.clampf(spp:getScale()+pos.x*0.01, 0.1, 2)
spp:setScale(newScale)
sp:setScale(newScale)
end,cc.Handler.EVENT_TOUCH_MOVED)
touchListener:registerScriptHandler(function (touch, event)
spp:showDebug(false)
debugForNormalSprite:setVisible(false)
end,cc.Handler.EVENT_TOUCH_ENDED)
local eventDispatcher = self:getEventDispatcher()
eventDispatcher:addEventListenerWithSceneGraphPriority(touchListener, self)
local positions = {}
local spSize = sp:getContentSize()
positions[1] = cc.p(0, spSize.height)
positions[2] = cc.p(spSize.width, spSize.height)
positions[3] = cc.p(spSize.width, 0)
positions[4] = cc.p(0,0)
debugForNormalSprite:drawPoints(positions, 4, 8, cc.c4f(0.0,1.0,1.0,1.0))
debugForNormalSprite:drawLine(positions[1], positions[2], cc.c4f(0.0,1.0,0.0,1.0))
debugForNormalSprite:drawLine(positions[2], positions[3], cc.c4f(0.0,1.0,0.0,1.0))
debugForNormalSprite:drawLine(positions[3], positions[4], cc.c4f(0.0,1.0,0.0,1.0))
debugForNormalSprite:drawLine(positions[4], positions[1], cc.c4f(0.0,1.0,0.0,1.0))
debugForNormalSprite:drawLine(positions[1], positions[3], cc.c4f(0.0,1.0,0.0,1.0))
debugForNormalSprite:setVisible(false)
local ttfConfig = {}
ttfConfig.fontFilePath = "fonts/arial.ttf"
ttfConfig.fontSize = 8
local temp = "Sprite:\nPixels drawn: ".. spSize.width*spSize.height
local spArea = cc.Label:createWithTTF(ttfConfig, temp)
sp:addChild(spArea)
spArea:setAnchorPoint(cc.p(0,1))
temp = "SpritePolygon:\nPixels drawn: "
local vertCount = "\nverts:" .. spp:getVertCount()
local sppArea = cc.Label:createWithTTF(ttfConfig, temp .. spp:getArea() .. vertCount)
spp:addChild(sppArea)
sppArea:setAnchorPoint(cc.p(0,1))
Helper.initWithLayer(self)
Helper.titleLabel:setString(self:title())
Helper.subtitleLabel:setString(self:subtitle())
local function onNodeEvent(event)
if "enter" == event then
self:onEnter()
elseif "exit" == event then
self:onExit()
end
end
self:registerScriptHandler(onNodeEvent)
end
function SpritePolygonTest1:title()
return "SpritePolygon Creation"
end
function SpritePolygonTest1:subtitle()
return "SpritePolygon:create(\"Images/grossini.png\")"
end
function SpritePolygonTest1:onEnter()
cc.Director:getInstance():setClearColor(cc.c4f(102.0/255, 184.0/255, 204.0/255, 255.0))
end
function SpritePolygonTest1:onExit()
cc.Director:getInstance():setClearColor(cc.c4f(0.0, 0.0, 0.0, 1.0))
end
----------------------------------------
----SpritePolygonTest2
----------------------------------------
local SpritePolygonTest2 = class("SpritePolygonTest2", function ()
local layer = cc.Layer:create()
return layer
end)
function SpritePolygonTest2:ctor()
local verts = {}
verts[1]= cc.p(36.5, 242.0-128.5)
verts[2]= cc.p(27.5, 242.0-133.5)
verts[3]= cc.p(24.5, 242.0-145.5)
verts[4]= cc.p(26.5, 242.0-161.5)
verts[5]= cc.p(33.5, 242.0-168.5)
verts[6]= cc.p(27.5, 242.0-168.5)
verts[7]= cc.p(16.5, 242.0-179.5)
verts[8]= cc.p(30.5, 242.0-197.5)
verts[9]= cc.p(28.5, 242.0-237.5)
verts[10]= cc.p(56.5, 242.0-237.5)
verts[11]= cc.p(54.5, 242.0-197.5)
verts[12]= cc.p(68.5, 242.0-184.5)
verts[13]= cc.p(57.5, 242.0-168.5)
verts[14]= cc.p(51.5, 242.0-168.5)
verts[15]= cc.p(60.5, 242.0-154.5)
verts[16]= cc.p(57.5, 242.0-133.5)
verts[17]= cc.p(48.5, 242.0-127.5)
verts[18]= cc.p(36.5, 242.0-127.5)
cc.SpritePolygonCache:getInstance():removeAllSpritePolygonCache()
local s = ccexp.SpritePolygon:create(imageFileName, verts)
initDefaultSprite(imageFileName, s, self)
end
function SpritePolygonTest2:title()
return "SpritePolygon Creation"
end
function SpritePolygonTest2:subtitle()
return "SpritePolygon:create(\"Images/grossini.png\", verts)"
end
function SpritePolygonTest2:onEnter()
cc.Director:getInstance():setClearColor(cc.c4f(102.0/255, 184.0/255, 204.0/255, 255.0))
end
function SpritePolygonTest2:onExit()
cc.Director:getInstance():setClearColor(cc.c4f(0.0, 0.0, 0.0, 1.0))
end
----------------------------------------
----SpritePolygonTest3
----------------------------------------
local SpritePolygonTest3 = class("SpritePolygonTest3", function ()
local layer = cc.Layer:create()
return layer
end)
function SpritePolygonTest3:ctor()
local verts = {}
verts[1] = cc.p(33.500000, 73.500000)
verts[2] = cc.p(27.500000, 73.500000)
verts[3] = cc.p(16.500000, 62.500000)
verts[4] = cc.p(30.500000, 44.500000)
verts[5] = cc.p(54.500000, 44.500000)
verts[6] = cc.p(51.500000, 73.500000)
verts[7] = cc.p(60.500000, 87.500000)
verts[8] = cc.p(26.500000, 80.500000)
verts[9] = cc.p(24.500000, 96.500000)
verts[10] = cc.p(57.500000, 108.500000)
verts[11] = cc.p(36.500000, 113.500000)
verts[12] = cc.p(48.500000, 114.500000)
verts[13] = cc.p(36.500000, 114.500000)
verts[14] = cc.p(27.500000, 108.500000)
verts[15] = cc.p(68.500000, 57.500000)
verts[16] = cc.p(57.500000, 73.500000)
verts[17] = cc.p(56.500000, 4.500000)
verts[18] = cc.p(28.500000, 4.500000)
local indices = {0, 1, 2, 3, 0, 2, 4, 0, 3, 5, 0, 4, 5, 6, 0, 0, 6, 7, 8, 7, 6, 6, 9, 8, 9, 10, 8, 9, 11, 10, 11, 12, 10, 8, 10, 13, 14, 5, 4, 15, 5, 14, 4, 3, 16, 3, 17, 16}
cc.SpritePolygonCache:getInstance():removeAllSpritePolygonCache()
local s = ccexp.SpritePolygon:create(imageFileName, verts, indices)
initDefaultSprite(imageFileName, s, self)
end
function SpritePolygonTest3:title()
return "SpritePolygon Creation"
end
function SpritePolygonTest3:subtitle()
return "SpritePolygon::create(\"Images/grossini.png\", verts, indices)"
end
function SpritePolygonTest3:onEnter()
cc.Director:getInstance():setClearColor(cc.c4f(102.0/255, 184.0/255, 204.0/255, 255.0))
end
function SpritePolygonTest3:onExit()
cc.Director:getInstance():setClearColor(cc.c4f(0.0, 0.0, 0.0, 1.0))
end
----------------------------------------
----SpritePolygonTest4
----------------------------------------
local SpritePolygonTest4 = class("SpritePolygonTest4", function ()
local layer = cc.Layer:create()
return layer
end)
function SpritePolygonTest4:ctor()
local poss = {
cc.vec3(33.500000, 73.500000,0),
cc.vec3(27.500000, 73.500000,0),
cc.vec3(16.500000, 62.500000,0),
cc.vec3(30.500000, 44.500000,0),
cc.vec3(54.500000, 44.500000,0),
cc.vec3(51.500000, 73.500000,0),
cc.vec3(60.500000, 87.500000,0),
cc.vec3(26.500000, 80.500000,0),
cc.vec3(24.500000, 96.500000,0),
cc.vec3(57.500000, 108.500000,0),
cc.vec3(36.500000, 113.500000,0),
cc.vec3(48.500000, 114.500000,0),
cc.vec3(36.500000, 114.500000,0),
cc.vec3(27.500000, 108.500000,0),
cc.vec3(68.500000, 57.500000,0),
cc.vec3(57.500000, 73.500000,0),
cc.vec3(56.500000, 4.500000,0),
cc.vec3(28.500000, 4.50000, 0),
}
local indices = {0, 1, 2, 3, 0, 2, 4, 0, 3, 5, 0, 4, 5, 6, 0, 0, 6, 7, 8, 7, 6, 6, 9, 8, 9, 10, 8, 9, 11, 10, 11, 12, 10, 8, 10, 13, 14, 5, 4, 15, 5, 14, 4, 3, 16, 3, 17, 16}
local t2f = {
cc.tex2F(0.394118, 0.392562),
cc.tex2F(0.323529, 0.392562),
cc.tex2F(0.194118, 0.483471),
cc.tex2F(0.358824, 0.632231),
cc.tex2F(0.641176, 0.632231),
cc.tex2F(0.605882, 0.392562),
cc.tex2F(0.711765, 0.276859),
cc.tex2F(0.311765, 0.334711),
cc.tex2F(0.288235, 0.202479),
cc.tex2F(0.676471, 0.103306),
cc.tex2F(0.429412, 0.061983),
cc.tex2F(0.570588, 0.053719),
cc.tex2F(0.429412, 0.053719),
cc.tex2F(0.323529, 0.103306),
cc.tex2F(0.805882, 0.524793),
cc.tex2F(0.676471, 0.392562),
cc.tex2F(0.664706, 0.962810),
cc.tex2F(0.335294, 0.962810),
}
local v3f_c4b_t2f_table = {
{ vertices = poss[1], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[1]},
{ vertices = poss[2], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[2]},
{ vertices = poss[3], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[3]},
{ vertices = poss[4], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[4]},
{ vertices = poss[5], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[5]},
{ vertices = poss[6], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[6]},
{ vertices = poss[7], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[7]},
{ vertices = poss[8], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[8]},
{ vertices = poss[9], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[9]},
{ vertices = poss[10], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[10]},
{ vertices = poss[11], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[11]},
{ vertices = poss[12], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[12]},
{ vertices = poss[13], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[13]},
{ vertices = poss[14], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[14]},
{ vertices = poss[15], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[15]},
{ vertices = poss[16], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[16]},
{ vertices = poss[17], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[17]},
{ vertices = poss[18], colors = cc.c4b(255, 255, 255, 255), texCoords = t2f[18]},
}
cc.SpritePolygonCache:getInstance():removeAllSpritePolygonCache()
local s = ccexp.SpritePolygon:create(imageFileName, v3f_c4b_t2f_table, indices)
initDefaultSprite(imageFileName, s, self)
end
function SpritePolygonTest4:title()
return "SpritePolygon Creation"
end
function SpritePolygonTest4:subtitle()
return "SpritePolygon::create(\"Images/grossini.png\", vector<V3F_C4B_T2F> v, vector<unsigned short> indices)"
end
function SpritePolygonTest4:onEnter()
cc.Director:getInstance():setClearColor(cc.c4f(102.0/255, 184.0/255, 204.0/255, 255.0))
end
function SpritePolygonTest4:onExit()
cc.Director:getInstance():setClearColor(cc.c4f(0.0, 0.0, 0.0, 1.0))
end
function SpritePolygonTest()
local scene = cc.Scene:create()
Helper.createFunctionTable =
{
SpritePolygonTest1.create,
SpritePolygonTest2.create,
SpritePolygonTest3.create,
SpritePolygonTest4.create,
}
scene:addChild(SpritePolygonTest1.create())
scene:addChild(CreateBackMenuItem())
return scene
end

View File

@ -106,7 +106,7 @@ local function VideoPlayerTest()
local function menuOnlineVideoCallback(tag, sender)
if nil ~= videoPlayer then
videoPlayer:setURL("http://video001.smgbb.cn/gslb/program/FDN/FDN1190949/HLSVodService.m3u8?_mdCode=6065719&_cdnCode=B2B_XL_TEST&_type=0&_rCode=TerOut_18865&_userId=020341000456068&_categoryCode=SMG_HUAYU&_categoryPath=SMG_1002,SMG_HUAYU,&_adPositionId=01001000&_adCategorySource=0&_flag=.m3u8&_enCode=m3u8&taskID=ysh_ps_002-ott_1397459105893_020341000456068&_client=103&_cms=ctv&_CDNToken=76C043FD4969501754DC19E54EC8DC2C")
videoPlayer:setURL("http://benchmark.cocos2d-x.org/cocosvideo.mp4")
videoPlayer:play()
end
end

View File

@ -59,6 +59,7 @@ require "FastTiledMapTest/FastTiledMapTest"
require "NewAudioEngineTest/NewAudioEngineTest"
require "CocosStudio3DTest/CocosStudio3DTest"
require "WebViewTest/WebViewTest"
require "SpritePolygonTest/SpritePolygonTest"
local LINE_SPACE = 40
@ -127,6 +128,7 @@ local _allTests = {
{ isSupported = true, name = "Sprite3DTest" , create_func = Sprite3DTest },
{ isSupported = true, name = "TerrainTest" , create_func = TerrainTest },
{ isSupported = true, name = "SpriteTest" , create_func = SpriteTest },
{ isSupported = true, name = "SpritePolygonTest" , create_func = SpritePolygonTest },
{ isSupported = false, name = "TextInputTest" , create_func= TextInputTestMain },
{ isSupported = true, name = "Texture2DTest" , create_func = Texture2dTestMain },
{ isSupported = false, name = "TextureCacheTest" , create_func= TextureCacheTestMain },

View File

@ -116,7 +116,7 @@ def syntronize_remote_pr():
git_fetch_pr = "git fetch origin pull/" + str(pr_num) + "/head"
ret = os.system(git_fetch_pr)
if(ret != 0):
sys.exit(ret)
sys.exit(1)
#checkout a new branch from v3 or v4-develop
git_checkout = "git checkout -b " + "pull" + str(pr_num)
@ -140,7 +140,7 @@ def syntronize_remote_pr():
git_update_submodule = "git submodule update --init --force"
ret = os.system(git_update_submodule)
if(ret != 0):
sys.exit(ret)
sys.exit(1)
def gen_scripting_bindings():
@ -149,7 +149,7 @@ def gen_scripting_bindings():
if(branch != 'v1' and branch != 'v2'):
ret = os.system("python tools/jenkins-scripts/slave-scripts/gen_jsb.py")
if(ret != 0):
sys.exit(ret)
sys.exit(1)
def do_build_slaves():
@ -236,4 +236,8 @@ if __name__ == '__main__':
traceback.print_exc()
sys_ret = 1
finally:
sys.exit(sys_ret)
print "return value is " + str(sys_ret)
if sys_ret != 0:
sys.exit(1)
else:
sys.exit(0)

View File

@ -12,4 +12,7 @@ if __name__ == '__main__':
traceback.print_exc()
sys_ret = 1
finally:
sys.exit(sys_ret)
if sys_ret != 0:
sys.exit(1)
else:
sys.exit(0)

View File

@ -3,3 +3,5 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
COCOS2DX_ROOT="$DIR"/../../..
xcodebuild -project "$COCOS2DX_ROOT"/build/cocos2d_tests.xcodeproj -scheme "build all tests iOS" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" clean | xcpretty
xcodebuild -project "$COCOS2DX_ROOT"/build/cocos2d_tests.xcodeproj -scheme "build all tests iOS" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build | xcpretty
#the following commands must not be removed
xcodebuild -project "$COCOS2DX_ROOT"/build/cocos2d_tests.xcodeproj -scheme "build all tests iOS" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build

View File

@ -5,4 +5,8 @@ cd ${COCOS2DX_ROOT}
mkdir linux-build
cd linux-build
cmake ..
if [ ! $? = 0 ]; then
echo "cmake generate error"
exit 1
fi
make -j4

View File

@ -18,3 +18,5 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
COCOS2DX_ROOT="$DIR"/../../..
xcodebuild -project "$COCOS2DX_ROOT"/build/cocos2d_tests.xcodeproj -scheme "build all tests Mac" clean | xcpretty
xcodebuild -project "$COCOS2DX_ROOT"/build/cocos2d_tests.xcodeproj -scheme "build all tests Mac" build | xcpretty
#xcpretty has a bug, some xcodebuid fails return value would be treated as 0.
xcodebuild -project "$COCOS2DX_ROOT"/build/cocos2d_tests.xcodeproj -scheme "build all tests Mac" build

View File

@ -22,11 +22,11 @@ cxxgenerator_headers =
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/2d/CCProtectedNode.h %(cocosdir)s/cocos/base/CCAsyncTaskPool.h
headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/2d/CCProtectedNode.h %(cocosdir)s/cocos/base/CCAsyncTaskPool.h %(cocosdir)s/cocos/2d/SpritePolygonCache.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* .*TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Ref$ UserDefault GLViewImpl GLView Image Event(?!.*(Physics).*).* Component ProtectedNode Console GLProgramCache GLProgramState Device ClippingRectangleNode .*Light$ AsyncTaskPool
classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* .*TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Ref$ UserDefault GLViewImpl GLView Image Event(?!.*(Physics).*).* Component ProtectedNode Console GLProgramCache GLProgramState Device ClippingRectangleNode .*Light$ AsyncTaskPool SpritePolygonCache
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
@ -136,7 +136,8 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS
Bone3D::[*],
Device::[getTextureDataForText],
BillBoard::[*],
Camera::[unproject]
Camera::[unproject],
SpritePolygonCache::[addSpritePolygonCache getSpritePolygonCache]
rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames getSpriteFrameByName=getSpriteFrame],
ProgressTimer::[setReverseProgress=setReverseDirection],

View File

@ -23,11 +23,11 @@ cxxgenerator_headers =
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/2d/CCFastTMXLayer.h %(cocosdir)s/cocos/2d/CCFastTMXTiledMap.h
headers = %(cocosdir)s/cocos/2d/CCFastTMXLayer.h %(cocosdir)s/cocos/2d/CCFastTMXTiledMap.h %(cocosdir)s/cocos/2d/SpritePolygon.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = TMXLayer TMXTiledMap
classes = TMXLayer TMXTiledMap SpritePolygon
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
@ -36,7 +36,8 @@ classes = TMXLayer TMXTiledMap
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = TMXLayer::[(g|s)etTiles getTileGIDAt]
skip = TMXLayer::[(g|s)etTiles getTileGIDAt],
SpritePolygon::[create initWithVerts initWithRect initWithPoly2tri initWithMarching]
rename_functions =