mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3
This commit is contained in:
commit
e31b03ab2e
6
AUTHORS
6
AUTHORS
|
@ -11,6 +11,7 @@ Core Developers:
|
|||
Huabing Xu (dabingnn)
|
||||
Bo Yu (boyu0)
|
||||
Wenhai Lin(Dhilan007)
|
||||
Guanghui Qu(andyque)
|
||||
|
||||
|
||||
Developers:
|
||||
|
@ -843,6 +844,8 @@ Developers:
|
|||
zifter
|
||||
Fixed a bug that the effect of particle loaded from CocosBuilder is incorrectly
|
||||
Fix twice calling onExit
|
||||
Fixed bug with cascade opacity and color for control button
|
||||
Fix Progress Action. Not working with charging from 100 to 0.
|
||||
|
||||
twhittock
|
||||
Fixed a bug that Application::run returns wrong value on Mac platform
|
||||
|
@ -855,6 +858,9 @@ Developers:
|
|||
|
||||
NatWeiss
|
||||
Fix compilation error using arch i386
|
||||
|
||||
favorcode
|
||||
Correct some doxygen comment
|
||||
|
||||
Retired Core Developers:
|
||||
WenSheng Yang
|
||||
|
|
13
CHANGELOG
13
CHANGELOG
|
@ -1,7 +1,18 @@
|
|||
cocos2d-x-3.1-rc0 May.16 2014
|
||||
cocos2d-x-3.1 ???
|
||||
[FIX] Label: may crash when using outline effect
|
||||
[FIX] Label: using outline and invoking 'Director::setContentScaleFactor' cause label show nothing
|
||||
[FIX] ProgressTo: will start from 0 when it reaches 100
|
||||
[FIX] Physics integration: may crashes if remove bodies at physics contact callback
|
||||
[FIX] WP8: orientation is not correct when it is set to portrait
|
||||
[FIX] WP8: fix for precompiled shaders and precompiled headers
|
||||
|
||||
cocos2d-x-3.1-rc0 May.18 2014
|
||||
[NEW] Cocos2dxActivity: Adds a virtual method to load native libraries.
|
||||
[NEW] Directory Structure: reorder some files within the cocos/ folder
|
||||
[NEW] Sprite3D: a node that renders 3d models
|
||||
[NEW] EditBox: support secure input on Mac
|
||||
|
||||
[FIX] ControlButton: cascade opacity and color error
|
||||
[FIX] Director: twice calling of onExit
|
||||
[FIX] Math: Vector2->Vec2, Vector3->Vec3, Vector4->Vec4, Matrix->Mat4
|
||||
[FIX] GLProgram: uniform CC_Texture0 is pre-defined by cocos2d. MUST NOT be defined in shaders
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.30324.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
# Visual Studio 2012
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\cocos\2d\cocos2d_wp8.vcxproj", "{B5AF91B3-64EA-44E1-84B0-D759E93758FB}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine", "..\cocos\editor-support\spine\proj.wp8\libSpine.vcxproj", "{7D4FC6EB-9497-4804-98F3-3EAEDC896154}"
|
||||
|
@ -46,9 +44,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cpp-tests", "..\tests\cpp-t
|
|||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-testsComponent", "..\tests\cpp-tests\proj.wp8-xaml\cpp-testsComponent\cpp-testsComponent.vcxproj", "{86B2C23C-3A6C-4C4E-AB0E-16A8CC1523E9}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{271FEE84-9198-4C26-8567-4247C563B0B1} = {271FEE84-9198-4C26-8567-4247C563B0B1}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libNetwork", "..\cocos\network\proj.wp8\libNetwork.vcxproj", "{7DAA99E7-8E07-4FEF-8374-8EC04E395D2E}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
|
@ -63,9 +58,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cpp-empty-test", "..\tests\
|
|||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-empty-testComponent", "..\tests\cpp-empty-test\proj-wp8-xaml\cpp-empty-testComponent\cpp-empty-testComponent.vcxproj", "{F5D665F8-AE19-4F3F-99A7-230A1E8305D2}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{271FEE84-9198-4C26-8567-4247C563B0B1} = {271FEE84-9198-4C26-8567-4247C563B0B1}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGUI", "..\cocos\ui\proj.wp8\libGUI.vcxproj", "{08FB23E4-1517-4EDC-B682-DA238CDAA83D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
|
@ -73,6 +65,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGUI", "..\cocos\ui\proj.
|
|||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CopyTemplateFiles", "..\cocos\platform\wp8-xaml\CopyTemplateFiles.vcxproj", "{271FEE84-9198-4C26-8567-4247C563B0B1}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{5921FE12-7EF3-4847-8453-42EF286DDBE7} = {5921FE12-7EF3-4847-8453-42EF286DDBE7}
|
||||
{60D53713-1675-4466-81DC-D67A031C3D21} = {60D53713-1675-4466-81DC-D67A031C3D21}
|
||||
{86B2C23C-3A6C-4C4E-AB0E-16A8CC1523E9} = {86B2C23C-3A6C-4C4E-AB0E-16A8CC1523E9}
|
||||
{F5D665F8-AE19-4F3F-99A7-230A1E8305D2} = {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
|
@ -1723,6 +1723,26 @@
|
|||
50FCEBCB18C72017004AD434 /* WidgetReaderProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 50FCEB9218C72017004AD434 /* WidgetReaderProtocol.h */; };
|
||||
50FCEBCC18C72017004AD434 /* WidgetReaderProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 50FCEB9218C72017004AD434 /* WidgetReaderProtocol.h */; };
|
||||
A07A4CAF1783777C0073F6A7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1551A342158F2AB200E66CFE /* Foundation.framework */; };
|
||||
B29594B41926D5EC003EEF37 /* CCMeshCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594B21926D5EC003EEF37 /* CCMeshCommand.cpp */; };
|
||||
B29594B51926D5EC003EEF37 /* CCMeshCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594B21926D5EC003EEF37 /* CCMeshCommand.cpp */; };
|
||||
B29594B61926D5EC003EEF37 /* CCMeshCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594B31926D5EC003EEF37 /* CCMeshCommand.h */; };
|
||||
B29594B71926D5EC003EEF37 /* CCMeshCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594B31926D5EC003EEF37 /* CCMeshCommand.h */; };
|
||||
B29594C21926D61F003EEF37 /* CCMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594B91926D61F003EEF37 /* CCMesh.cpp */; };
|
||||
B29594C31926D61F003EEF37 /* CCMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594B91926D61F003EEF37 /* CCMesh.cpp */; };
|
||||
B29594C41926D61F003EEF37 /* CCMesh.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594BA1926D61F003EEF37 /* CCMesh.h */; };
|
||||
B29594C51926D61F003EEF37 /* CCMesh.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594BA1926D61F003EEF37 /* CCMesh.h */; };
|
||||
B29594C61926D61F003EEF37 /* CCObjLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594BB1926D61F003EEF37 /* CCObjLoader.cpp */; };
|
||||
B29594C71926D61F003EEF37 /* CCObjLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594BB1926D61F003EEF37 /* CCObjLoader.cpp */; };
|
||||
B29594C81926D61F003EEF37 /* CCObjLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594BC1926D61F003EEF37 /* CCObjLoader.h */; };
|
||||
B29594C91926D61F003EEF37 /* CCObjLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594BC1926D61F003EEF37 /* CCObjLoader.h */; };
|
||||
B29594CA1926D61F003EEF37 /* CCSprite3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594BD1926D61F003EEF37 /* CCSprite3D.cpp */; };
|
||||
B29594CB1926D61F003EEF37 /* CCSprite3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594BD1926D61F003EEF37 /* CCSprite3D.cpp */; };
|
||||
B29594CC1926D61F003EEF37 /* CCSprite3D.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594BE1926D61F003EEF37 /* CCSprite3D.h */; };
|
||||
B29594CD1926D61F003EEF37 /* CCSprite3D.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594BE1926D61F003EEF37 /* CCSprite3D.h */; };
|
||||
B29594CE1926D61F003EEF37 /* CCSprite3DDataCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594BF1926D61F003EEF37 /* CCSprite3DDataCache.cpp */; };
|
||||
B29594CF1926D61F003EEF37 /* CCSprite3DDataCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594BF1926D61F003EEF37 /* CCSprite3DDataCache.cpp */; };
|
||||
B29594D01926D61F003EEF37 /* CCSprite3DDataCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594C01926D61F003EEF37 /* CCSprite3DDataCache.h */; };
|
||||
B29594D11926D61F003EEF37 /* CCSprite3DDataCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594C01926D61F003EEF37 /* CCSprite3DDataCache.h */; };
|
||||
B37510711823AC9F00B3BA6A /* CCPhysicsBodyInfo_chipmunk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37510451823AC7B00B3BA6A /* CCPhysicsBodyInfo_chipmunk.cpp */; };
|
||||
B37510721823AC9F00B3BA6A /* CCPhysicsBodyInfo_chipmunk.h in Headers */ = {isa = PBXBuildFile; fileRef = B37510461823AC7B00B3BA6A /* CCPhysicsBodyInfo_chipmunk.h */; };
|
||||
B37510731823AC9F00B3BA6A /* CCPhysicsContactInfo_chipmunk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37510471823AC7B00B3BA6A /* CCPhysicsContactInfo_chipmunk.cpp */; };
|
||||
|
@ -2473,20 +2493,6 @@
|
|||
46A169981807AFD6005B8026 /* cpSweep1D.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cpSweep1D.c; sourceTree = "<group>"; };
|
||||
46A169991807AFD6005B8026 /* cpVect.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cpVect.c; sourceTree = "<group>"; };
|
||||
46A1699A1807AFD6005B8026 /* prime.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = prime.h; sourceTree = "<group>"; };
|
||||
46A16E1B1807C948005B8026 /* libcurl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcurl.a; path = ../cocos/2d/platform/third_party/ios/libraries/libcurl.a; sourceTree = "<group>"; };
|
||||
46A16E1C1807C948005B8026 /* libfreetype.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfreetype.a; path = ../cocos/2d/platform/third_party/ios/libraries/libfreetype.a; sourceTree = "<group>"; };
|
||||
46A16E1D1807C948005B8026 /* libjpeg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjpeg.a; path = ../cocos/2d/platform/third_party/ios/libraries/libjpeg.a; sourceTree = "<group>"; };
|
||||
46A16E1E1807C948005B8026 /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = ../cocos/2d/platform/third_party/ios/libraries/libpng.a; sourceTree = "<group>"; };
|
||||
46A16E1F1807C948005B8026 /* libtiff.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libtiff.a; path = ../cocos/2d/platform/third_party/ios/libraries/libtiff.a; sourceTree = "<group>"; };
|
||||
46A16E201807C948005B8026 /* libwebp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebp.a; path = ../cocos/2d/platform/third_party/ios/libraries/libwebp.a; sourceTree = "<group>"; };
|
||||
46A16E211807C95C005B8026 /* libfreetype.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfreetype.a; path = ../cocos/2d/platform/third_party/mac/libraries/libfreetype.a; sourceTree = "<group>"; };
|
||||
46A16E221807C95C005B8026 /* libglfw3.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libglfw3.a; path = ../cocos/2d/platform/third_party/mac/libraries/libglfw3.a; sourceTree = "<group>"; };
|
||||
46A16E231807C95C005B8026 /* libjpeg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjpeg.a; path = ../cocos/2d/platform/third_party/mac/libraries/libjpeg.a; sourceTree = "<group>"; };
|
||||
46A16E241807C95C005B8026 /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = ../cocos/2d/platform/third_party/mac/libraries/libpng.a; sourceTree = "<group>"; };
|
||||
46A16E251807C95C005B8026 /* libtiff.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libtiff.a; path = ../cocos/2d/platform/third_party/mac/libraries/libtiff.a; sourceTree = "<group>"; };
|
||||
46A16E261807C95C005B8026 /* libwebp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebp.a; path = ../cocos/2d/platform/third_party/mac/libraries/libwebp.a; sourceTree = "<group>"; };
|
||||
46A16E271807C992005B8026 /* libwebsockets.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebsockets.a; path = ../external/libwebsockets/ios/lib/libwebsockets.a; sourceTree = "<group>"; };
|
||||
46A16E281807C99F005B8026 /* libwebsockets.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebsockets.a; path = ../external/libwebsockets/mac/lib/libwebsockets.a; sourceTree = "<group>"; };
|
||||
46A1706E1807CE7A005B8026 /* CCPhysicsBody.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CCPhysicsBody.cpp; sourceTree = "<group>"; };
|
||||
46A1706F1807CE7A005B8026 /* CCPhysicsBody.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCPhysicsBody.h; sourceTree = "<group>"; };
|
||||
46A170701807CE7A005B8026 /* CCPhysicsContact.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CCPhysicsContact.cpp; sourceTree = "<group>"; };
|
||||
|
@ -2772,6 +2778,19 @@
|
|||
A07A4F3B178387670073F6A7 /* libchipmunk iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libchipmunk iOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
A07A4F9E1783876B0073F6A7 /* libbox2d iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libbox2d iOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
A07A4FB4178387730073F6A7 /* libCocosDenshion iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libCocosDenshion iOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
B29594AF1926D5D9003EEF37 /* ccShader_3D_Color.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_Color.frag; sourceTree = "<group>"; };
|
||||
B29594B01926D5D9003EEF37 /* ccShader_3D_ColorTex.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_ColorTex.frag; sourceTree = "<group>"; };
|
||||
B29594B11926D5D9003EEF37 /* ccShader_3D_PositionTex.vert */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_PositionTex.vert; sourceTree = "<group>"; };
|
||||
B29594B21926D5EC003EEF37 /* CCMeshCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCMeshCommand.cpp; sourceTree = "<group>"; };
|
||||
B29594B31926D5EC003EEF37 /* CCMeshCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCMeshCommand.h; sourceTree = "<group>"; };
|
||||
B29594B91926D61F003EEF37 /* CCMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCMesh.cpp; sourceTree = "<group>"; };
|
||||
B29594BA1926D61F003EEF37 /* CCMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCMesh.h; sourceTree = "<group>"; };
|
||||
B29594BB1926D61F003EEF37 /* CCObjLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCObjLoader.cpp; sourceTree = "<group>"; };
|
||||
B29594BC1926D61F003EEF37 /* CCObjLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCObjLoader.h; sourceTree = "<group>"; };
|
||||
B29594BD1926D61F003EEF37 /* CCSprite3D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSprite3D.cpp; sourceTree = "<group>"; };
|
||||
B29594BE1926D61F003EEF37 /* CCSprite3D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSprite3D.h; sourceTree = "<group>"; };
|
||||
B29594BF1926D61F003EEF37 /* CCSprite3DDataCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSprite3DDataCache.cpp; sourceTree = "<group>"; };
|
||||
B29594C01926D61F003EEF37 /* CCSprite3DDataCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSprite3DDataCache.h; sourceTree = "<group>"; };
|
||||
B37510451823AC7B00B3BA6A /* CCPhysicsBodyInfo_chipmunk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCPhysicsBodyInfo_chipmunk.cpp; sourceTree = "<group>"; };
|
||||
B37510461823AC7B00B3BA6A /* CCPhysicsBodyInfo_chipmunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPhysicsBodyInfo_chipmunk.h; sourceTree = "<group>"; };
|
||||
B37510471823AC7B00B3BA6A /* CCPhysicsContactInfo_chipmunk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCPhysicsContactInfo_chipmunk.cpp; sourceTree = "<group>"; };
|
||||
|
@ -2886,10 +2905,12 @@
|
|||
children = (
|
||||
46A15FCC1807A544005B8026 /* AUTHORS */,
|
||||
1A57FFF7180BC5160088DEC7 /* CHANGELOG */,
|
||||
50272539190BF1B900AAF4ED /* cocos2d.cpp */,
|
||||
50272538190BF1B900AAF4ED /* cocos2d.h */,
|
||||
46A15FCE1807A544005B8026 /* README.md */,
|
||||
50DC5180187B817900A9C23F /* RELEASE_NOTES.md */,
|
||||
46A169A11807B037005B8026 /* 2d */,
|
||||
50ABBEDB1926664700A911A9 /* platform */,
|
||||
B29594B81926D61F003EEF37 /* 3d */,
|
||||
46A15FD01807A56F005B8026 /* audio */,
|
||||
1A5700A2180BC5E60088DEC7 /* base */,
|
||||
1A01C67518F57BE800EFE3A6 /* deprecated */,
|
||||
|
@ -2900,12 +2921,11 @@
|
|||
46A170851807CE87005B8026 /* math */,
|
||||
1AAF5360180E3374000584C8 /* network */,
|
||||
46A170611807CE7A005B8026 /* physics */,
|
||||
50ABBEDB1926664700A911A9 /* platform */,
|
||||
1551A340158F2AB200E66CFE /* Products */,
|
||||
500DC89819105D41007B91BF /* renderer */,
|
||||
1AAF5849180E40B8000584C8 /* storage */,
|
||||
2905F9E618CF08D000240AA3 /* ui */,
|
||||
50272538190BF1B900AAF4ED /* cocos2d.h */,
|
||||
50272539190BF1B900AAF4ED /* cocos2d.cpp */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
|
@ -2929,8 +2949,6 @@
|
|||
1551A341158F2AB200E66CFE /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B3D8D44B179921D50039C204 /* ios */,
|
||||
B3D8D4471799219B0039C204 /* mac */,
|
||||
1551A342158F2AB200E66CFE /* Foundation.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
|
@ -4464,7 +4482,6 @@
|
|||
500DC89819105D41007B91BF /* renderer */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5034CA5D191D591900CE6051 /* shaders */,
|
||||
50ABBD641925AB4100A911A9 /* CCBatchCommand.cpp */,
|
||||
50ABBD651925AB4100A911A9 /* CCBatchCommand.h */,
|
||||
50ABBD661925AB4100A911A9 /* CCCustomCommand.cpp */,
|
||||
|
@ -4481,6 +4498,8 @@
|
|||
50ABBD711925AB4100A911A9 /* ccGLStateCache.h */,
|
||||
50ABBD721925AB4100A911A9 /* CCGroupCommand.cpp */,
|
||||
50ABBD731925AB4100A911A9 /* CCGroupCommand.h */,
|
||||
B29594B21926D5EC003EEF37 /* CCMeshCommand.cpp */,
|
||||
B29594B31926D5EC003EEF37 /* CCMeshCommand.h */,
|
||||
50ABBD741925AB4100A911A9 /* CCQuadCommand.cpp */,
|
||||
50ABBD751925AB4100A911A9 /* CCQuadCommand.h */,
|
||||
50ABBD761925AB4100A911A9 /* CCRenderCommand.cpp */,
|
||||
|
@ -4496,6 +4515,7 @@
|
|||
50ABBD801925AB4100A911A9 /* CCTextureAtlas.h */,
|
||||
50ABBD811925AB4100A911A9 /* CCTextureCache.cpp */,
|
||||
50ABBD821925AB4100A911A9 /* CCTextureCache.h */,
|
||||
5034CA5D191D591900CE6051 /* shaders */,
|
||||
);
|
||||
name = renderer;
|
||||
path = ../cocos/renderer;
|
||||
|
@ -4504,6 +4524,9 @@
|
|||
5034CA5D191D591900CE6051 /* shaders */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B29594AF1926D5D9003EEF37 /* ccShader_3D_Color.frag */,
|
||||
B29594B01926D5D9003EEF37 /* ccShader_3D_ColorTex.frag */,
|
||||
B29594B11926D5D9003EEF37 /* ccShader_3D_PositionTex.vert */,
|
||||
5034CA60191D91CF00CE6051 /* ccShader_PositionTextureColor.vert */,
|
||||
5034CA61191D91CF00CE6051 /* ccShader_PositionTextureColor.frag */,
|
||||
5034CA62191D91CF00CE6051 /* ccShader_PositionTextureColor_noMVP.vert */,
|
||||
|
@ -4755,32 +4778,20 @@
|
|||
path = TextReader;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B3D8D4471799219B0039C204 /* mac */ = {
|
||||
B29594B81926D61F003EEF37 /* 3d */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
46A16E281807C99F005B8026 /* libwebsockets.a */,
|
||||
46A16E211807C95C005B8026 /* libfreetype.a */,
|
||||
46A16E221807C95C005B8026 /* libglfw3.a */,
|
||||
46A16E231807C95C005B8026 /* libjpeg.a */,
|
||||
46A16E241807C95C005B8026 /* libpng.a */,
|
||||
46A16E251807C95C005B8026 /* libtiff.a */,
|
||||
46A16E261807C95C005B8026 /* libwebp.a */,
|
||||
B29594B91926D61F003EEF37 /* CCMesh.cpp */,
|
||||
B29594BA1926D61F003EEF37 /* CCMesh.h */,
|
||||
B29594BB1926D61F003EEF37 /* CCObjLoader.cpp */,
|
||||
B29594BC1926D61F003EEF37 /* CCObjLoader.h */,
|
||||
B29594BD1926D61F003EEF37 /* CCSprite3D.cpp */,
|
||||
B29594BE1926D61F003EEF37 /* CCSprite3D.h */,
|
||||
B29594BF1926D61F003EEF37 /* CCSprite3DDataCache.cpp */,
|
||||
B29594C01926D61F003EEF37 /* CCSprite3DDataCache.h */,
|
||||
);
|
||||
name = mac;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B3D8D44B179921D50039C204 /* ios */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
46A16E271807C992005B8026 /* libwebsockets.a */,
|
||||
46A16E1B1807C948005B8026 /* libcurl.a */,
|
||||
46A16E1C1807C948005B8026 /* libfreetype.a */,
|
||||
46A16E1D1807C948005B8026 /* libjpeg.a */,
|
||||
46A16E1E1807C948005B8026 /* libpng.a */,
|
||||
46A16E1F1807C948005B8026 /* libtiff.a */,
|
||||
46A16E201807C948005B8026 /* libwebp.a */,
|
||||
);
|
||||
name = ios;
|
||||
name = 3d;
|
||||
path = ../cocos/3d;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
@ -4803,6 +4814,7 @@
|
|||
06CAAAC9186AD7EE0012A414 /* TriggerMng.h in Headers */,
|
||||
2905FA6018CF08D100240AA3 /* UILayoutParameter.h in Headers */,
|
||||
50ABBEA51925AB6F00A911A9 /* CCScriptSupport.h in Headers */,
|
||||
B29594D01926D61F003EEF37 /* CCSprite3DDataCache.h in Headers */,
|
||||
1ABA68B01888D700007D1BB4 /* CCFontCharMap.h in Headers */,
|
||||
5034CA3F191D591100CE6051 /* ccShader_Position_uColor.vert in Headers */,
|
||||
50ABBD461925AB0000A911A9 /* CCVertex.h in Headers */,
|
||||
|
@ -4929,6 +4941,7 @@
|
|||
50ABBD421925AB0000A911A9 /* CCMathBase.h in Headers */,
|
||||
1A570298180BCCAB0088DEC7 /* CCAnimationCache.h in Headers */,
|
||||
50FCEB9D18C72017004AD434 /* ImageViewReader.h in Headers */,
|
||||
B29594C81926D61F003EEF37 /* CCObjLoader.h in Headers */,
|
||||
50ABBE911925AB6F00A911A9 /* CCPlatformMacros.h in Headers */,
|
||||
50ABC05D1926664800A911A9 /* CCApplication.h in Headers */,
|
||||
50ABC0071926664800A911A9 /* CCApplicationProtocol.h in Headers */,
|
||||
|
@ -4963,6 +4976,7 @@
|
|||
2905FA5818CF08D100240AA3 /* UILayout.h in Headers */,
|
||||
1A57034D180BD09B0088DEC7 /* tinyxml2.h in Headers */,
|
||||
1A570356180BD0B00088DEC7 /* ioapi.h in Headers */,
|
||||
B29594C41926D61F003EEF37 /* CCMesh.h in Headers */,
|
||||
50ABBE331925AB6F00A911A9 /* CCConfiguration.h in Headers */,
|
||||
50ABC01F1926664800A911A9 /* CCThread.h in Headers */,
|
||||
1A57035A180BD0B00088DEC7 /* unzip.h in Headers */,
|
||||
|
@ -5017,6 +5031,7 @@
|
|||
1A01C69218F57BE800EFE3A6 /* CCDouble.h in Headers */,
|
||||
50ABBE251925AB6F00A911A9 /* base64.h in Headers */,
|
||||
50ABBEC91925AB6F00A911A9 /* firePngData.h in Headers */,
|
||||
B29594CC1926D61F003EEF37 /* CCSprite3D.h in Headers */,
|
||||
1AD71E9F180E26E600808F54 /* AnimationStateData.h in Headers */,
|
||||
1AD71EA3180E26E600808F54 /* Atlas.h in Headers */,
|
||||
1AD71EA7180E26E600808F54 /* AtlasAttachmentLoader.h in Headers */,
|
||||
|
@ -5081,6 +5096,7 @@
|
|||
50ABBE211925AB6F00A911A9 /* atitc.h in Headers */,
|
||||
1A8C5999180E930E00EF57C3 /* CCActionNode.h in Headers */,
|
||||
1A8C599D180E930E00EF57C3 /* CCActionObject.h in Headers */,
|
||||
B29594B61926D5EC003EEF37 /* CCMeshCommand.h in Headers */,
|
||||
50ABBE371925AB6F00A911A9 /* CCConsole.h in Headers */,
|
||||
1A8C59A1180E930E00EF57C3 /* CCArmature.h in Headers */,
|
||||
1A8C59A5180E930E00EF57C3 /* CCArmatureAnimation.h in Headers */,
|
||||
|
@ -5287,9 +5303,11 @@
|
|||
50ABBD3B1925AB0000A911A9 /* CCAffineTransform.h in Headers */,
|
||||
5034CA38191D591100CE6051 /* ccShader_PositionColorLengthTexture.vert in Headers */,
|
||||
50ABBE7C1925AB6F00A911A9 /* CCEventMouse.h in Headers */,
|
||||
B29594D11926D61F003EEF37 /* CCSprite3DDataCache.h in Headers */,
|
||||
46A171011807CECB005B8026 /* CCPhysicsJoint.h in Headers */,
|
||||
46A170FD1807CECB005B8026 /* CCPhysicsBody.h in Headers */,
|
||||
2905FA6118CF08D100240AA3 /* UILayoutParameter.h in Headers */,
|
||||
B29594C51926D61F003EEF37 /* CCMesh.h in Headers */,
|
||||
50ABBE9C1925AB6F00A911A9 /* CCRef.h in Headers */,
|
||||
50ABBD961925AB4100A911A9 /* CCGLProgramState.h in Headers */,
|
||||
46A171061807CECB005B8026 /* CCPhysicsWorld.h in Headers */,
|
||||
|
@ -5493,11 +5511,13 @@
|
|||
1AD71DEE180E26E600808F54 /* CCMenuLoader.h in Headers */,
|
||||
1AD71DF2180E26E600808F54 /* CCNode+CCBRelativePositioning.h in Headers */,
|
||||
50ABBDB01925AB4100A911A9 /* CCRenderer.h in Headers */,
|
||||
B29594B71926D5EC003EEF37 /* CCMeshCommand.h in Headers */,
|
||||
1AD71DF6180E26E600808F54 /* CCNodeLoader.h in Headers */,
|
||||
50ABBD861925AB4100A911A9 /* CCBatchCommand.h in Headers */,
|
||||
1AD71DFA180E26E600808F54 /* CCNodeLoaderLibrary.h in Headers */,
|
||||
50ABBE481925AB6F00A911A9 /* CCEvent.h in Headers */,
|
||||
5027253B190BF1B900AAF4ED /* cocos2d.h in Headers */,
|
||||
B29594CD1926D61F003EEF37 /* CCSprite3D.h in Headers */,
|
||||
1AD71DFC180E26E600808F54 /* CCNodeLoaderListener.h in Headers */,
|
||||
3EA0FB6B191C841D00B170C8 /* UIVideoPlayer.h in Headers */,
|
||||
50ABBE641925AB6F00A911A9 /* CCEventListenerAcceleration.h in Headers */,
|
||||
|
@ -5507,6 +5527,7 @@
|
|||
1AD71E0C180E26E600808F54 /* CCSpriteLoader.h in Headers */,
|
||||
50ABBD921925AB4100A911A9 /* CCGLProgramCache.h in Headers */,
|
||||
1AD71E0E180E26E600808F54 /* CocosBuilder.h in Headers */,
|
||||
B29594C91926D61F003EEF37 /* CCObjLoader.h in Headers */,
|
||||
1AD71E98180E26E600808F54 /* Animation.h in Headers */,
|
||||
1AD71E9C180E26E600808F54 /* AnimationState.h in Headers */,
|
||||
50ABBE961925AB6F00A911A9 /* CCProfiling.h in Headers */,
|
||||
|
@ -6098,6 +6119,7 @@
|
|||
50FCEBBF18C72017004AD434 /* TextFieldReader.cpp in Sources */,
|
||||
50FCEBAF18C72017004AD434 /* ScrollViewReader.cpp in Sources */,
|
||||
50ABC0111926664800A911A9 /* CCGLViewProtocol.cpp in Sources */,
|
||||
B29594C21926D61F003EEF37 /* CCMesh.cpp in Sources */,
|
||||
50ABBE3D1925AB6F00A911A9 /* CCDataVisitor.cpp in Sources */,
|
||||
1A5702C8180BCE370088DEC7 /* CCTextFieldTTF.cpp in Sources */,
|
||||
50ABBE7D1925AB6F00A911A9 /* CCEventTouch.cpp in Sources */,
|
||||
|
@ -6147,6 +6169,7 @@
|
|||
1AD71DE9180E26E600808F54 /* CCMenuItemLoader.cpp in Sources */,
|
||||
50ABBDA31925AB4100A911A9 /* CCQuadCommand.cpp in Sources */,
|
||||
2905FA6A18CF08D100240AA3 /* UIPageView.cpp in Sources */,
|
||||
B29594C61926D61F003EEF37 /* CCObjLoader.cpp in Sources */,
|
||||
06CAAAC7186AD7E90012A414 /* TriggerObj.cpp in Sources */,
|
||||
1AD71DEF180E26E600808F54 /* CCNode+CCBRelativePositioning.cpp in Sources */,
|
||||
50ABC01D1926664800A911A9 /* CCThread.cpp in Sources */,
|
||||
|
@ -6185,6 +6208,7 @@
|
|||
1AD71ECD180E26E600808F54 /* Skeleton.cpp in Sources */,
|
||||
1AD71ED1180E26E600808F54 /* SkeletonData.cpp in Sources */,
|
||||
1AD71ED5180E26E600808F54 /* SkeletonJson.cpp in Sources */,
|
||||
B29594CA1926D61F003EEF37 /* CCSprite3D.cpp in Sources */,
|
||||
1AD71ED9180E26E600808F54 /* Skin.cpp in Sources */,
|
||||
1AD71EDD180E26E600808F54 /* Slot.cpp in Sources */,
|
||||
1AD71EE1180E26E600808F54 /* SlotData.cpp in Sources */,
|
||||
|
@ -6229,6 +6253,7 @@
|
|||
1A8C59C3180E930E00EF57C3 /* CCComController.cpp in Sources */,
|
||||
2905FA5218CF08D100240AA3 /* UIImageView.cpp in Sources */,
|
||||
50ABBDBD1925AB4100A911A9 /* CCTextureCache.cpp in Sources */,
|
||||
B29594CE1926D61F003EEF37 /* CCSprite3DDataCache.cpp in Sources */,
|
||||
2905FA7C18CF08D100240AA3 /* UIText.cpp in Sources */,
|
||||
50FCEB9F18C72017004AD434 /* LayoutReader.cpp in Sources */,
|
||||
50ABC0211926664800A911A9 /* CCGLView.cpp in Sources */,
|
||||
|
@ -6255,6 +6280,7 @@
|
|||
1A8C59EF180E930E00EF57C3 /* CCSpriteFrameCacheHelper.cpp in Sources */,
|
||||
1A8C59F3180E930E00EF57C3 /* CCSSceneReader.cpp in Sources */,
|
||||
2905FA6E18CF08D100240AA3 /* UIRichText.cpp in Sources */,
|
||||
B29594B41926D5EC003EEF37 /* CCMeshCommand.cpp in Sources */,
|
||||
1A01C68E18F57BE800EFE3A6 /* CCDictionary.cpp in Sources */,
|
||||
1A8C59F7180E930E00EF57C3 /* CCTransformHelp.cpp in Sources */,
|
||||
50ABBD381925AB0000A911A9 /* CCAffineTransform.cpp in Sources */,
|
||||
|
@ -6442,6 +6468,7 @@
|
|||
50ABBE621925AB6F00A911A9 /* CCEventListenerAcceleration.cpp in Sources */,
|
||||
B37510811823ACA100B3BA6A /* CCPhysicsJointInfo_chipmunk.cpp in Sources */,
|
||||
2905FA8D18CF08D100240AA3 /* UIWidget.cpp in Sources */,
|
||||
B29594B51926D5EC003EEF37 /* CCMeshCommand.cpp in Sources */,
|
||||
50ABBE7E1925AB6F00A911A9 /* CCEventTouch.cpp in Sources */,
|
||||
50FCEB9818C72017004AD434 /* CheckBoxReader.cpp in Sources */,
|
||||
50ABBE6E1925AB6F00A911A9 /* CCEventListenerKeyboard.cpp in Sources */,
|
||||
|
@ -6461,6 +6488,7 @@
|
|||
1A570082180BC5A10088DEC7 /* CCActionManager.cpp in Sources */,
|
||||
1A570086180BC5A10088DEC7 /* CCActionPageTurn3D.cpp in Sources */,
|
||||
1A57008A180BC5A10088DEC7 /* CCActionProgressTimer.cpp in Sources */,
|
||||
B29594CB1926D61F003EEF37 /* CCSprite3D.cpp in Sources */,
|
||||
2905FA6F18CF08D100240AA3 /* UIRichText.cpp in Sources */,
|
||||
50ABBED81925AB6F00A911A9 /* ZipUtils.cpp in Sources */,
|
||||
1A57008E180BC5A10088DEC7 /* CCActionTiledGrid.cpp in Sources */,
|
||||
|
@ -6470,6 +6498,7 @@
|
|||
50ABBE3E1925AB6F00A911A9 /* CCDataVisitor.cpp in Sources */,
|
||||
1A57009F180BC5D20088DEC7 /* CCNode.cpp in Sources */,
|
||||
B37510831823ACA100B3BA6A /* CCPhysicsShapeInfo_chipmunk.cpp in Sources */,
|
||||
B29594CF1926D61F003EEF37 /* CCSprite3DDataCache.cpp in Sources */,
|
||||
1A57010F180BC8EE0088DEC7 /* CCDrawingPrimitives.cpp in Sources */,
|
||||
1A570113180BC8EE0088DEC7 /* CCDrawNode.cpp in Sources */,
|
||||
1A57011C180BC90D0088DEC7 /* CCGrabber.cpp in Sources */,
|
||||
|
@ -6572,6 +6601,7 @@
|
|||
1AD71DDA180E26E600808F54 /* CCLayerColorLoader.cpp in Sources */,
|
||||
50FCEBC018C72017004AD434 /* TextFieldReader.cpp in Sources */,
|
||||
1AD71DDE180E26E600808F54 /* CCLayerGradientLoader.cpp in Sources */,
|
||||
B29594C31926D61F003EEF37 /* CCMesh.cpp in Sources */,
|
||||
1AD71DE2180E26E600808F54 /* CCLayerLoader.cpp in Sources */,
|
||||
1AD71DE6180E26E600808F54 /* CCMenuItemImageLoader.cpp in Sources */,
|
||||
50ABBEA81925AB6F00A911A9 /* CCTouch.cpp in Sources */,
|
||||
|
@ -6600,6 +6630,7 @@
|
|||
1AD71EB2180E26E600808F54 /* Bone.cpp in Sources */,
|
||||
50ABBD451925AB0000A911A9 /* CCVertex.cpp in Sources */,
|
||||
2905FA8118CF08D100240AA3 /* UITextAtlas.cpp in Sources */,
|
||||
B29594C71926D61F003EEF37 /* CCObjLoader.cpp in Sources */,
|
||||
50ABBEB01925AB6F00A911A9 /* CCUserDefault.cpp in Sources */,
|
||||
50FCEBB818C72017004AD434 /* TextAtlasReader.cpp in Sources */,
|
||||
1AD71EB6180E26E600808F54 /* BoneData.cpp in Sources */,
|
||||
|
@ -6997,7 +7028,7 @@
|
|||
"\"$(SRCROOT)/../external/freetype2/prebuilt/mac\"",
|
||||
"\"$(SRCROOT)/../external/websockets/prebuilt/mac\"",
|
||||
);
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/png/include/mac $(SRCROOT)/../external/tiff/include/mac $(SRCROOT)/../external/webp/include/mac $(SRCROOT)/../external/jpeg/include/mac $(SRCROOT)/../external/freetype2/include/mac $(SRCROOT)/../external/websockets/include/mac $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../cocos/platform/mac $(SRCROOT)/../cocos/platform/desktop";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/png/include/mac $(SRCROOT)/../external/tiff/include/mac $(SRCROOT)/../external/webp/include/mac $(SRCROOT)/../external/jpeg/include/mac $(SRCROOT)/../external/freetype2/include/mac $(SRCROOT)/../external/websockets/include/mac $(SRCROOT)/../external/glfw3/include/mac";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -7023,7 +7054,7 @@
|
|||
"\"$(SRCROOT)/../external/freetype2/prebuilt/mac\"",
|
||||
"\"$(SRCROOT)/../external/websockets/prebuilt/mac\"",
|
||||
);
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/png/include/mac $(SRCROOT)/../external/tiff/include/mac $(SRCROOT)/../external/webp/include/mac $(SRCROOT)/../external/jpeg/include/mac $(SRCROOT)/../external/freetype2/include/mac $(SRCROOT)/../external/websockets/include/mac $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../cocos/platform/mac $(SRCROOT)/../cocos/platform/desktop";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/png/include/mac $(SRCROOT)/../external/tiff/include/mac $(SRCROOT)/../external/webp/include/mac $(SRCROOT)/../external/jpeg/include/mac $(SRCROOT)/../external/freetype2/include/mac $(SRCROOT)/../external/websockets/include/mac $(SRCROOT)/../external/glfw3/include/mac";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -7183,7 +7214,7 @@
|
|||
);
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external/websockets/include/ios $(SRCROOT)/../external/freetype2/include/ios $(SRCROOT)/../external/curl/include/ios $(SRCROOT)/../external/webp/include/ios $(SRCROOT)/../external/tiff/include/ios $(SRCROOT)/../external/jpeg/include/ios $(SRCROOT)/../external/png/include/ios";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/websockets/include/ios $(SRCROOT)/../external/freetype2/include/ios $(SRCROOT)/../external/curl/include/ios $(SRCROOT)/../external/webp/include/ios $(SRCROOT)/../external/tiff/include/ios $(SRCROOT)/../external/jpeg/include/ios $(SRCROOT)/../external/png/include/ios";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -7221,7 +7252,7 @@
|
|||
);
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external/websockets/include/ios $(SRCROOT)/../external/freetype2/include/ios $(SRCROOT)/../external/curl/include/ios $(SRCROOT)/../external/webp/include/ios $(SRCROOT)/../external/tiff/include/ios $(SRCROOT)/../external/jpeg/include/ios $(SRCROOT)/../external/png/include/ios";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/websockets/include/ios $(SRCROOT)/../external/freetype2/include/ios $(SRCROOT)/../external/curl/include/ios $(SRCROOT)/../external/webp/include/ios $(SRCROOT)/../external/tiff/include/ios $(SRCROOT)/../external/jpeg/include/ios $(SRCROOT)/../external/png/include/ios";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
|
|
@ -85,6 +85,8 @@
|
|||
15C90B4A18E66C2B00D69802 /* tp.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB118DA8B6C00F6518C /* tp.lua */; };
|
||||
15C90B4B18E66C2F00D69802 /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB218DA8B6C00F6518C /* url.lua */; };
|
||||
15C90B4C18E66C3100D69802 /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB218DA8B6C00F6518C /* url.lua */; };
|
||||
15E66FC8192D957100C20A52 /* Sprite3DTest in Resources */ = {isa = PBXBuildFile; fileRef = 3E92EA841921A7720094CD21 /* Sprite3DTest */; };
|
||||
15E66FD6192DC8C700C20A52 /* Sprite3DTest in Resources */ = {isa = PBXBuildFile; fileRef = 3E92EA841921A7720094CD21 /* Sprite3DTest */; };
|
||||
1A0EE2A118CDF6DA004CD58F /* libchipmunk Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FB41807A4F9005B8026 /* libchipmunk Mac.a */; };
|
||||
1A0EE2A218CDF6DA004CD58F /* libcocos2dx Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FB01807A4F9005B8026 /* libcocos2dx Mac.a */; };
|
||||
1A0EE2A418CDF6DA004CD58F /* libCocosDenshion Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FB81807A4F9005B8026 /* libCocosDenshion Mac.a */; };
|
||||
|
@ -812,6 +814,10 @@
|
|||
29080DE4191B595E0066F8DF /* UIWidgetAddNodeTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D89191B595E0066F8DF /* UIWidgetAddNodeTest.cpp */; };
|
||||
29080DE5191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D8B191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp */; };
|
||||
29080DE6191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D8B191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp */; };
|
||||
3E92EA821921A1400094CD21 /* Sprite3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E92EA801921A1400094CD21 /* Sprite3DTest.cpp */; };
|
||||
3E92EA831921A1400094CD21 /* Sprite3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E92EA801921A1400094CD21 /* Sprite3DTest.cpp */; };
|
||||
3E92EA851921A7720094CD21 /* Sprite3DTest in Resources */ = {isa = PBXBuildFile; fileRef = 3E92EA841921A7720094CD21 /* Sprite3DTest */; };
|
||||
3E92EA861921A7720094CD21 /* Sprite3DTest in Resources */ = {isa = PBXBuildFile; fileRef = 3E92EA841921A7720094CD21 /* Sprite3DTest */; };
|
||||
3EA0FB5E191B92F100B170C8 /* cocosvideo.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */; };
|
||||
3EA0FB66191B933000B170C8 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EA0FB65191B933000B170C8 /* MediaPlayer.framework */; };
|
||||
3EA0FB72191C844400B170C8 /* UIVideoPlayerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EA0FB70191C844400B170C8 /* UIVideoPlayerTest.cpp */; };
|
||||
|
@ -827,6 +833,8 @@
|
|||
A07A52BF1783AF210073F6A7 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07A52B91783AE900073F6A7 /* OpenGLES.framework */; };
|
||||
A07A52C01783AF250073F6A7 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07A52B71783AE6D0073F6A7 /* UIKit.framework */; };
|
||||
A07A52C31783B02C0073F6A7 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07A52C11783B01F0073F6A7 /* AVFoundation.framework */; };
|
||||
B2507B6B192589AF00FA4972 /* Shaders3D in Resources */ = {isa = PBXBuildFile; fileRef = B2507B6A192589AF00FA4972 /* Shaders3D */; };
|
||||
B2507B6C192589AF00FA4972 /* Shaders3D in Resources */ = {isa = PBXBuildFile; fileRef = B2507B6A192589AF00FA4972 /* Shaders3D */; };
|
||||
C08689C118D370C90093E810 /* background.caf in Resources */ = {isa = PBXBuildFile; fileRef = C08689C018D370C90093E810 /* background.caf */; };
|
||||
C08689C218D370C90093E810 /* background.caf in Resources */ = {isa = PBXBuildFile; fileRef = C08689C018D370C90093E810 /* background.caf */; };
|
||||
C08689C318D370C90093E810 /* background.caf in Resources */ = {isa = PBXBuildFile; fileRef = C08689C018D370C90093E810 /* background.caf */; };
|
||||
|
@ -1849,6 +1857,9 @@
|
|||
29080D8A191B595E0066F8DF /* UIWidgetAddNodeTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidgetAddNodeTest.h; sourceTree = "<group>"; };
|
||||
29080D8B191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIWidgetAddNodeTest_Editor.cpp; sourceTree = "<group>"; };
|
||||
29080D8C191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidgetAddNodeTest_Editor.h; sourceTree = "<group>"; };
|
||||
3E92EA801921A1400094CD21 /* Sprite3DTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sprite3DTest.cpp; path = Sprite3DTest/Sprite3DTest.cpp; sourceTree = "<group>"; };
|
||||
3E92EA811921A1400094CD21 /* Sprite3DTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sprite3DTest.h; path = Sprite3DTest/Sprite3DTest.h; sourceTree = "<group>"; };
|
||||
3E92EA841921A7720094CD21 /* Sprite3DTest */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Sprite3DTest; path = "../tests/cpp-tests/Resources/Sprite3DTest"; sourceTree = "<group>"; };
|
||||
3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; name = cocosvideo.mp4; path = "../tests/cpp-tests/Resources/cocosvideo.mp4"; sourceTree = "<group>"; };
|
||||
3EA0FB65191B933000B170C8 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/MediaPlayer.framework; sourceTree = DEVELOPER_DIR; };
|
||||
3EA0FB70191C844400B170C8 /* UIVideoPlayerTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIVideoPlayerTest.cpp; sourceTree = "<group>"; };
|
||||
|
@ -1864,6 +1875,7 @@
|
|||
A07A52B91783AE900073F6A7 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
|
||||
A07A52BB1783AEB80073F6A7 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; };
|
||||
A07A52C11783B01F0073F6A7 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; };
|
||||
B2507B6A192589AF00FA4972 /* Shaders3D */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Shaders3D; path = "../tests/cpp-tests/Resources/Shaders3D"; sourceTree = "<group>"; };
|
||||
C08689C018D370C90093E810 /* background.caf */ = {isa = PBXFileReference; lastKnownFileType = file; name = background.caf; path = "../tests/cpp-tests/Resources/background.caf"; sourceTree = "<group>"; };
|
||||
D60AE43317F7FFE100757E4B /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; };
|
||||
EDCC747E17C455FD007B692C /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
|
||||
|
@ -2258,6 +2270,7 @@
|
|||
1AC35AE918CECF0C00F37B72 /* SchedulerTest */,
|
||||
1AC35AEC18CECF0C00F37B72 /* ShaderTest */,
|
||||
1AC35AF118CECF0C00F37B72 /* SpineTest */,
|
||||
3E92EA7D1921A0C60094CD21 /* Sprite3DTest */,
|
||||
1AC35AF418CECF0C00F37B72 /* SpriteTest */,
|
||||
1AC35AF718CECF0C00F37B72 /* testBasic.cpp */,
|
||||
1AC35AF818CECF0C00F37B72 /* testBasic.h */,
|
||||
|
@ -3274,6 +3287,8 @@
|
|||
1AC35CA818CED83500F37B72 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B2507B6A192589AF00FA4972 /* Shaders3D */,
|
||||
3E92EA841921A7720094CD21 /* Sprite3DTest */,
|
||||
3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */,
|
||||
1AC35CA918CED84500F37B72 /* animations */,
|
||||
1AC35CAE18CED84500F37B72 /* ccb */,
|
||||
|
@ -3790,6 +3805,15 @@
|
|||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3E92EA7D1921A0C60094CD21 /* Sprite3DTest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3E92EA801921A1400094CD21 /* Sprite3DTest.cpp */,
|
||||
3E92EA811921A1400094CD21 /* Sprite3DTest.h */,
|
||||
);
|
||||
name = Sprite3DTest;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3EA0FB6F191C844400B170C8 /* UIVideoPlayerTest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -4264,6 +4288,7 @@
|
|||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
15E66FD6192DC8C700C20A52 /* Sprite3DTest in Resources */,
|
||||
1AC35DC318CEE65100F37B72 /* Misc in Resources */,
|
||||
1AC35DC618CEE65100F37B72 /* Shaders in Resources */,
|
||||
1AC35DBB18CEE65100F37B72 /* components in Resources */,
|
||||
|
@ -4332,6 +4357,7 @@
|
|||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
15E66FC8192D957100C20A52 /* Sprite3DTest in Resources */,
|
||||
15C90B4418E66C1800D69802 /* mime.lua in Resources */,
|
||||
15C90B4C18E66C3100D69802 /* url.lua in Resources */,
|
||||
1AC35DD618CEE65200F37B72 /* Misc in Resources */,
|
||||
|
@ -4415,6 +4441,7 @@
|
|||
1AC35D0418CED84500F37B72 /* Shaders in Resources */,
|
||||
1AC35CD818CED84500F37B72 /* CocosBuilderExample.ccbresourcelog in Resources */,
|
||||
1AC35CDC18CED84500F37B72 /* commonly_used_words.txt in Resources */,
|
||||
B2507B6B192589AF00FA4972 /* Shaders3D in Resources */,
|
||||
1AC35D0618CED84500F37B72 /* spine in Resources */,
|
||||
1AC35CE818CED84500F37B72 /* extensions in Resources */,
|
||||
1AC35CDE18CED84500F37B72 /* components in Resources */,
|
||||
|
@ -4433,6 +4460,7 @@
|
|||
1AC35D0018CED84500F37B72 /* pew-pew-lei.wav in Resources */,
|
||||
1AC35CD018CED84500F37B72 /* background.mp3 in Resources */,
|
||||
1AC35CD618CED84500F37B72 /* CocosBuilderExample.ccbproj in Resources */,
|
||||
3E92EA851921A7720094CD21 /* Sprite3DTest in Resources */,
|
||||
1AC35CA318CECF1E00F37B72 /* InfoPlist.strings in Resources */,
|
||||
1AC35CA418CECF1E00F37B72 /* MainMenu.xib in Resources */,
|
||||
1AC35CD418CED84500F37B72 /* ccb in Resources */,
|
||||
|
@ -4471,6 +4499,7 @@
|
|||
1AC35CD318CED84500F37B72 /* background.ogg in Resources */,
|
||||
1AC35CCB18CED84500F37B72 /* animations in Resources */,
|
||||
3EA0FB5E191B92F100B170C8 /* cocosvideo.mp4 in Resources */,
|
||||
3E92EA861921A7720094CD21 /* Sprite3DTest in Resources */,
|
||||
1AC35C8C18CECF1400F37B72 /* Icon-114.png in Resources */,
|
||||
1AC35CF118CED84500F37B72 /* hd in Resources */,
|
||||
1AC35C9318CECF1400F37B72 /* Icon-57.png in Resources */,
|
||||
|
@ -4486,6 +4515,7 @@
|
|||
1AC35C9418CECF1400F37B72 /* Icon-58.png in Resources */,
|
||||
1AC35CD118CED84500F37B72 /* background.mp3 in Resources */,
|
||||
1AC35CD918CED84500F37B72 /* CocosBuilderExample.ccbresourcelog in Resources */,
|
||||
B2507B6C192589AF00FA4972 /* Shaders3D in Resources */,
|
||||
1AC35CED18CED84500F37B72 /* fonts in Resources */,
|
||||
1AC35CD718CED84500F37B72 /* CocosBuilderExample.ccbproj in Resources */,
|
||||
1AC35CDD18CED84500F37B72 /* commonly_used_words.txt in Resources */,
|
||||
|
@ -4574,6 +4604,7 @@
|
|||
1AC35BE118CECF0C00F37B72 /* CCControlButtonTest.cpp in Sources */,
|
||||
1AC35BEB18CECF0C00F37B72 /* CCControlSliderTest.cpp in Sources */,
|
||||
1AC35C4D18CECF0C00F37B72 /* SpineTest.cpp in Sources */,
|
||||
3E92EA821921A1400094CD21 /* Sprite3DTest.cpp in Sources */,
|
||||
1AC35C1D18CECF0C00F37B72 /* NewRendererTest.cpp in Sources */,
|
||||
1AC35B6718CECF0C00F37B72 /* AnimationsTestLayer.cpp in Sources */,
|
||||
29080DB7191B595E0066F8DF /* UIListViewTest_Editor.cpp in Sources */,
|
||||
|
@ -4906,6 +4937,7 @@
|
|||
1AC35B5418CECF0C00F37B72 /* CocosDenshionTest.cpp in Sources */,
|
||||
1AC35B8018CECF0C00F37B72 /* ProjectileController.cpp in Sources */,
|
||||
1AC35C2618CECF0C00F37B72 /* PerformanceAllocTest.cpp in Sources */,
|
||||
3E92EA831921A1400094CD21 /* Sprite3DTest.cpp in Sources */,
|
||||
1AC35B5A18CECF0C00F37B72 /* controller.cpp in Sources */,
|
||||
1AC35C2A18CECF0C00F37B72 /* PerformanceEventDispatcherTest.cpp in Sources */,
|
||||
1AC35BEA18CECF0C00F37B72 /* CCControlSceneManager.cpp in Sources */,
|
||||
|
|
|
@ -72,13 +72,6 @@ void ProgressTo::startWithTarget(Node *target)
|
|||
{
|
||||
ActionInterval::startWithTarget(target);
|
||||
_from = ((kProgressTimerCast)(target))->getPercentage();
|
||||
|
||||
// XXX: Is this correct ?
|
||||
// Adding it to support Repeat
|
||||
if (_from == 100)
|
||||
{
|
||||
_from = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ProgressTo::update(float time)
|
||||
|
|
|
@ -69,8 +69,8 @@ FontAtlas * FontAtlasCache::getFontAtlasTTF(const TTFConfig & config)
|
|||
|
||||
if ( it == _atlasMap.end() )
|
||||
{
|
||||
auto font = FontFreeType::create(config.fontFilePath, fontSize * contentScaleFactor, config.glyphs,
|
||||
config.customGlyphs,useDistanceField,config.outlineSize * contentScaleFactor);
|
||||
auto font = FontFreeType::create(config.fontFilePath, fontSize, config.glyphs,
|
||||
config.customGlyphs, useDistanceField, config.outlineSize);
|
||||
if (font)
|
||||
{
|
||||
auto tempAtlas = font->createFontAtlas();
|
||||
|
|
|
@ -695,12 +695,12 @@ FontFNT::FontFNT(BMFontConfiguration *theContfig, const Vec2& imageOffset /* = V
|
|||
:_configuration(theContfig)
|
||||
,_imageOffset(CC_POINT_PIXELS_TO_POINTS(imageOffset))
|
||||
{
|
||||
|
||||
_configuration->retain();
|
||||
}
|
||||
|
||||
FontFNT::~FontFNT()
|
||||
{
|
||||
|
||||
_configuration->release();
|
||||
}
|
||||
|
||||
void FontFNT::purgeCachedData()
|
||||
|
|
|
@ -27,7 +27,7 @@ THE SOFTWARE.
|
|||
|
||||
#include <stdio.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/CCDirector.h"
|
||||
#include "base/ccUTF8.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "edtaa3func.h"
|
||||
|
@ -102,6 +102,7 @@ FontFreeType::FontFreeType(bool distanceFieldEnabled /* = false */,int outline /
|
|||
{
|
||||
if (_outlineSize > 0)
|
||||
{
|
||||
_outlineSize *= CC_CONTENT_SCALE_FACTOR();
|
||||
FT_Stroker_New(FontFreeType::getFTLibrary(), &_stroker);
|
||||
FT_Stroker_Set(_stroker,
|
||||
(int)(_outlineSize * 64),
|
||||
|
@ -142,7 +143,7 @@ bool FontFreeType::createFontObject(const std::string &fontName, int fontSize)
|
|||
|
||||
// set the requested font size
|
||||
int dpi = 72;
|
||||
int fontSizePoints = (int)(64.f * fontSize);
|
||||
int fontSizePoints = (int)(64.f * fontSize * CC_CONTENT_SCALE_FACTOR());
|
||||
if (FT_Set_Char_Size(face, fontSizePoints, fontSizePoints, dpi, dpi))
|
||||
return false;
|
||||
|
||||
|
@ -286,8 +287,6 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWid
|
|||
auto copyBitmap = new unsigned char[outWidth * outHeight];
|
||||
memcpy(copyBitmap,ret,outWidth * outHeight * sizeof(unsigned char));
|
||||
|
||||
long bitmapWidth;
|
||||
long bitmapHeight;
|
||||
FT_BBox bbox;
|
||||
auto outlineBitmap = getGlyphBitmapWithOutline(theChar,bbox);
|
||||
if(outlineBitmap == nullptr)
|
||||
|
@ -297,42 +296,47 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWid
|
|||
break;
|
||||
}
|
||||
|
||||
bitmapWidth = (bbox.xMax - bbox.xMin)>>6;
|
||||
bitmapHeight = (bbox.yMax - bbox.yMin)>>6;
|
||||
long outlineWidth = (bbox.xMax - bbox.xMin)>>6;
|
||||
long outlineHeight = (bbox.yMax - bbox.yMin)>>6;
|
||||
|
||||
long index;
|
||||
auto blendImage = new unsigned char[bitmapWidth * bitmapHeight * 2];
|
||||
memset(blendImage, 0, bitmapWidth * bitmapHeight * 2);
|
||||
for (int x = 0; x < bitmapWidth; ++x)
|
||||
long blendWidth = outlineWidth > outWidth ? outlineWidth : outWidth;
|
||||
long blendHeight = outlineHeight > outHeight ? outlineHeight : outHeight;
|
||||
|
||||
long index,index2;
|
||||
auto blendImage = new unsigned char[blendWidth * blendHeight * 2];
|
||||
memset(blendImage, 0, blendWidth * blendHeight * 2);
|
||||
|
||||
int px = (blendWidth - outlineWidth) / 2;
|
||||
int py = (blendHeight - outlineHeight) / 2;
|
||||
for (int x = 0; x < outlineWidth; ++x)
|
||||
{
|
||||
for (int y = 0; y < bitmapHeight; ++y)
|
||||
for (int y = 0; y < outlineHeight; ++y)
|
||||
{
|
||||
index = x + ( y * bitmapWidth );
|
||||
blendImage[2 * index] = outlineBitmap[index];
|
||||
index = px + x + ( (py + y) * blendWidth );
|
||||
index2 = x + (y * outlineWidth);
|
||||
blendImage[2 * index] = outlineBitmap[index2];
|
||||
}
|
||||
}
|
||||
|
||||
long maxX = outWidth + _outlineSize;
|
||||
long maxY = outHeight + _outlineSize;
|
||||
for (int x = _outlineSize; x < maxX; ++x)
|
||||
px = (blendWidth - outWidth) / 2;
|
||||
py = (blendHeight - outHeight) / 2;
|
||||
for (int x = 0; x < outWidth; ++x)
|
||||
{
|
||||
for (int y = _outlineSize; y < maxY; ++y)
|
||||
for (int y = 0; y < outHeight; ++y)
|
||||
{
|
||||
index = x + ( y * bitmapWidth );
|
||||
|
||||
blendImage[2 * index + 1] = copyBitmap[outWidth * (y - _outlineSize) + x - _outlineSize];
|
||||
index = px + x + ( (y + py) * blendWidth );
|
||||
index2 = x + (y * outWidth);
|
||||
blendImage[2 * index + 1] = copyBitmap[index2];
|
||||
}
|
||||
}
|
||||
|
||||
outRect.origin.x = bbox.xMin >> 6;
|
||||
outRect.origin.y = - (bbox.yMax >> 6);
|
||||
|
||||
xAdvance += bitmapWidth - outRect.size.width;
|
||||
|
||||
outRect.size.width = bitmapWidth;
|
||||
outRect.size.height = bitmapHeight;
|
||||
outWidth = bitmapWidth;
|
||||
outHeight = bitmapHeight;
|
||||
xAdvance += 2 * _outlineSize;
|
||||
outRect.size.width = blendWidth;
|
||||
outRect.size.height = blendHeight;
|
||||
outWidth = blendWidth;
|
||||
outHeight = blendHeight;
|
||||
|
||||
delete [] outlineBitmap;
|
||||
delete [] copyBitmap;
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
static void shutdownFreeType();
|
||||
|
||||
bool isDistanceFieldEnabled() const { return _distanceFieldEnabled;}
|
||||
int getOutlineSize() const { return _outlineSize; }
|
||||
float getOutlineSize() const { return _outlineSize; }
|
||||
void renderCharAt(unsigned char *dest,int posX, int posY, unsigned char* bitmap,long bitmapWidth,long bitmapHeight);
|
||||
|
||||
virtual FontAtlas * createFontAtlas() override;
|
||||
|
@ -89,7 +89,7 @@ private:
|
|||
FT_Stroker _stroker;
|
||||
std::string _fontName;
|
||||
bool _distanceFieldEnabled;
|
||||
int _outlineSize;
|
||||
float _outlineSize;
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -181,7 +181,7 @@ const BlendFunc &LabelBMFont::getBlendFunc() const
|
|||
return _label->getBlendFunc();
|
||||
}
|
||||
|
||||
Node* LabelBMFont::getChildByTag(int tag)
|
||||
Node* LabelBMFont::getChildByTag(int tag) const
|
||||
{
|
||||
return _label->getLetter(tag);
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ public:
|
|||
virtual const BlendFunc &getBlendFunc() const override;
|
||||
|
||||
virtual Sprite * getLetter(int ID);
|
||||
virtual Node * getChildByTag(int tag) override;
|
||||
virtual Node * getChildByTag(int tag) const override;
|
||||
|
||||
virtual void setColor(const Color3B& color) override;
|
||||
|
||||
|
|
|
@ -718,7 +718,7 @@ void Node::childrenAlloc(void)
|
|||
_children.reserve(4);
|
||||
}
|
||||
|
||||
Node* Node::getChildByTag(int tag)
|
||||
Node* Node::getChildByTag(int tag) const
|
||||
{
|
||||
CCASSERT( tag != Node::INVALID_TAG, "Invalid tag");
|
||||
|
||||
|
|
|
@ -643,7 +643,7 @@ public:
|
|||
*
|
||||
* @return a Node object whose tag equals to the input parameter
|
||||
*/
|
||||
virtual Node * getChildByTag(int tag);
|
||||
virtual Node * getChildByTag(int tag) const;
|
||||
/**
|
||||
* Returns the array of the node's children
|
||||
*
|
||||
|
|
|
@ -175,6 +175,10 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
|||
<ClCompile Include="..\..\external\unzip\ioapi.cpp" />
|
||||
<ClCompile Include="..\..\external\unzip\unzip.cpp" />
|
||||
<ClCompile Include="..\..\external\xxhash\xxhash.c" />
|
||||
<ClCompile Include="..\3d\CCMesh.cpp" />
|
||||
<ClCompile Include="..\3d\CCObjLoader.cpp" />
|
||||
<ClCompile Include="..\3d\CCSprite3D.cpp" />
|
||||
<ClCompile Include="..\3d\CCSprite3DDataCache.cpp" />
|
||||
<ClCompile Include="..\base\atitc.cpp" />
|
||||
<ClCompile Include="..\base\base64.cpp" />
|
||||
<ClCompile Include="..\base\CCAutoreleasePool.cpp" />
|
||||
|
@ -263,6 +267,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
|||
<ClCompile Include="..\renderer\CCGLProgramStateCache.cpp" />
|
||||
<ClCompile Include="..\renderer\ccGLStateCache.cpp" />
|
||||
<ClCompile Include="..\renderer\CCGroupCommand.cpp" />
|
||||
<ClCompile Include="..\renderer\CCMeshCommand.cpp" />
|
||||
<ClCompile Include="..\renderer\CCQuadCommand.cpp" />
|
||||
<ClCompile Include="..\renderer\CCRenderCommand.cpp" />
|
||||
<ClCompile Include="..\renderer\CCRenderer.cpp" />
|
||||
|
@ -341,6 +346,10 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
|||
<ClInclude Include="..\..\external\unzip\ioapi.h" />
|
||||
<ClInclude Include="..\..\external\unzip\unzip.h" />
|
||||
<ClInclude Include="..\..\external\xxhash\xxhash.h" />
|
||||
<ClInclude Include="..\3d\CCMesh.h" />
|
||||
<ClInclude Include="..\3d\CCObjLoader.h" />
|
||||
<ClInclude Include="..\3d\CCSprite3D.h" />
|
||||
<ClInclude Include="..\3d\CCSprite3DDataCache.h" />
|
||||
<ClInclude Include="..\base\atitc.h" />
|
||||
<ClInclude Include="..\base\base64.h" />
|
||||
<ClInclude Include="..\base\CCAutoreleasePool.h" />
|
||||
|
@ -452,6 +461,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
|||
<ClInclude Include="..\renderer\CCGLProgramStateCache.h" />
|
||||
<ClInclude Include="..\renderer\ccGLStateCache.h" />
|
||||
<ClInclude Include="..\renderer\CCGroupCommand.h" />
|
||||
<ClInclude Include="..\renderer\CCMeshCommand.h" />
|
||||
<ClInclude Include="..\renderer\CCQuadCommand.h" />
|
||||
<ClInclude Include="..\renderer\CCRenderCommand.h" />
|
||||
<ClInclude Include="..\renderer\CCRenderCommandPool.h" />
|
||||
|
|
|
@ -52,6 +52,9 @@
|
|||
<Filter Include="external\xxhash">
|
||||
<UniqueIdentifier>{b4e2b1e5-2d79-44a3-af45-728d47b7bdb2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="3d">
|
||||
<UniqueIdentifier>{a20c4bdc-bd4c-40c1-a78a-fe31cd3ec76a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\physics\CCPhysicsBody.cpp">
|
||||
|
@ -547,6 +550,21 @@
|
|||
<ClCompile Include="..\base\CCIMEDispatcher.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCMeshCommand.cpp">
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCMesh.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCObjLoader.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCSprite3D.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCSprite3DDataCache.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
||||
|
@ -1111,6 +1129,21 @@
|
|||
<ClInclude Include="..\base\CCIMEDispatcher.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCMeshCommand.h">
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\CCMesh.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\CCObjLoader.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\CCSprite3D.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\CCSprite3DDataCache.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\math\Mat4.inl">
|
||||
|
|
|
@ -265,6 +265,18 @@
|
|||
</ImportGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\external\ConvertUTF\ConvertUTF.c">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">CompileAsCpp</CompileAs>
|
||||
|
@ -278,34 +290,33 @@
|
|||
<ClCompile Include="..\..\external\unzip\ioapi.cpp" />
|
||||
<ClCompile Include="..\..\external\unzip\unzip.cpp" />
|
||||
<ClCompile Include="..\..\external\xxhash\xxhash.c">
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsWinRT>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
</ForcedIncludeFiles>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
</ForcedIncludeFiles>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
</ForcedIncludeFiles>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
</ForcedIncludeFiles>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
</ForcedIncludeFiles>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
</ForcedIncludeFiles>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCMesh.cpp" />
|
||||
<ClCompile Include="..\3d\CCObjLoader.cpp" />
|
||||
<ClCompile Include="..\3d\CCSprite3D.cpp" />
|
||||
<ClCompile Include="..\3d\CCSprite3DDataCache.cpp" />
|
||||
<ClCompile Include="..\base\atitc.cpp" />
|
||||
<ClCompile Include="..\base\base64.cpp" />
|
||||
<ClCompile Include="..\base\CCAutoreleasePool.cpp" />
|
||||
<ClCompile Include="..\base\ccCArray.cpp" />
|
||||
<ClCompile Include="..\base\CCConfiguration.cpp" />
|
||||
<ClCompile Include="..\base\CCConsole.cpp" />
|
||||
<ClCompile Include="..\base\CCData.cpp" />
|
||||
|
@ -326,15 +337,30 @@
|
|||
<ClCompile Include="..\base\CCEventListenerTouch.cpp" />
|
||||
<ClCompile Include="..\base\CCEventMouse.cpp" />
|
||||
<ClCompile Include="..\base\CCEventTouch.cpp" />
|
||||
<ClCompile Include="..\base\ccFPSImages.c">
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\base\CCIMEDispatcher.cpp" />
|
||||
<ClCompile Include="..\base\CCNS.cpp" />
|
||||
<ClCompile Include="..\base\CCProfiling.cpp" />
|
||||
<ClCompile Include="..\base\CCRef.cpp" />
|
||||
<ClCompile Include="..\base\CCScheduler.cpp" />
|
||||
<ClCompile Include="..\base\CCScriptSupport.cpp" />
|
||||
<ClCompile Include="..\base\CCTouch.cpp" />
|
||||
<ClCompile Include="..\base\ccTypes.cpp" />
|
||||
<ClCompile Include="..\base\CCUserDefault.cpp" />
|
||||
<ClCompile Include="..\base\CCUserDefaultAndroid.cpp" />
|
||||
<ClCompile Include="..\base\ccUTF8.cpp" />
|
||||
<ClCompile Include="..\base\ccUtils.cpp" />
|
||||
<ClCompile Include="..\base\CCValue.cpp" />
|
||||
<ClCompile Include="..\base\etc1.cpp" />
|
||||
<ClCompile Include="..\base\s3tc.cpp" />
|
||||
<ClCompile Include="..\base\TGAlib.cpp" />
|
||||
<ClCompile Include="..\base\ZipUtils.cpp" />
|
||||
<ClCompile Include="..\cocos2d.cpp" />
|
||||
<ClCompile Include="..\deprecated\CCArray.cpp" />
|
||||
|
@ -345,13 +371,14 @@
|
|||
<ClCompile Include="..\deprecated\CCString.cpp" />
|
||||
<ClCompile Include="..\math\CCAffineTransform.cpp" />
|
||||
<ClCompile Include="..\math\CCGeometry.cpp" />
|
||||
<ClCompile Include="..\math\CCVertex.cpp" />
|
||||
<ClCompile Include="..\math\Mat4.cpp" />
|
||||
<ClCompile Include="..\math\MathUtil.cpp" />
|
||||
<ClCompile Include="..\math\Matrix.cpp" />
|
||||
<ClCompile Include="..\math\Quaternion.cpp" />
|
||||
<ClCompile Include="..\math\TransformUtils.cpp" />
|
||||
<ClCompile Include="..\math\Vector2.cpp" />
|
||||
<ClCompile Include="..\math\Vector3.cpp" />
|
||||
<ClCompile Include="..\math\Vector4.cpp" />
|
||||
<ClCompile Include="..\math\Vec2.cpp" />
|
||||
<ClCompile Include="..\math\Vec3.cpp" />
|
||||
<ClCompile Include="..\math\Vec4.cpp" />
|
||||
<ClCompile Include="..\physics\CCPhysicsBody.cpp" />
|
||||
<ClCompile Include="..\physics\CCPhysicsContact.cpp" />
|
||||
<ClCompile Include="..\physics\CCPhysicsJoint.cpp" />
|
||||
|
@ -362,6 +389,32 @@
|
|||
<ClCompile Include="..\physics\chipmunk\CCPhysicsJointInfo_chipmunk.cpp" />
|
||||
<ClCompile Include="..\physics\chipmunk\CCPhysicsShapeInfo_chipmunk.cpp" />
|
||||
<ClCompile Include="..\physics\chipmunk\CCPhysicsWorldInfo_chipmunk.cpp" />
|
||||
<ClCompile Include="..\platform\CCFileUtils.cpp" />
|
||||
<ClCompile Include="..\platform\CCGLViewProtocol.cpp" />
|
||||
<ClCompile Include="..\platform\CCImage.cpp" />
|
||||
<ClCompile Include="..\platform\CCSAXParser.cpp" />
|
||||
<ClCompile Include="..\platform\CCThread.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\CCApplication.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\CCCommon.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\CCDevice.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\CCFileUtilsWinRT.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\CCFreeTypeFont.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\CCGLView.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\CCPrecompiledShaders.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\CCPThreadWinRT.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\CCStdC.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\CCWinRTUtils.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\DirectXBase.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\InputEvent.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\winrt\sha1.cpp" />
|
||||
<ClCompile Include="..\renderer\CCBatchCommand.cpp" />
|
||||
<ClCompile Include="..\renderer\CCCustomCommand.cpp" />
|
||||
<ClCompile Include="..\renderer\CCGLProgram.cpp" />
|
||||
|
@ -370,10 +423,14 @@
|
|||
<ClCompile Include="..\renderer\CCGLProgramStateCache.cpp" />
|
||||
<ClCompile Include="..\renderer\ccGLStateCache.cpp" />
|
||||
<ClCompile Include="..\renderer\CCGroupCommand.cpp" />
|
||||
<ClCompile Include="..\renderer\CCMeshCommand.cpp" />
|
||||
<ClCompile Include="..\renderer\CCQuadCommand.cpp" />
|
||||
<ClCompile Include="..\renderer\CCRenderCommand.cpp" />
|
||||
<ClCompile Include="..\renderer\CCRenderer.cpp" />
|
||||
<ClCompile Include="..\renderer\ccShaders.cpp" />
|
||||
<ClCompile Include="..\renderer\CCTexture2D.cpp" />
|
||||
<ClCompile Include="..\renderer\CCTextureAtlas.cpp" />
|
||||
<ClCompile Include="..\renderer\CCTextureCache.cpp" />
|
||||
<ClCompile Include="CCAction.cpp" />
|
||||
<ClCompile Include="CCActionCamera.cpp" />
|
||||
<ClCompile Include="CCActionCatmullRom.cpp" />
|
||||
|
@ -390,7 +447,6 @@
|
|||
<ClCompile Include="CCAnimation.cpp" />
|
||||
<ClCompile Include="CCAnimationCache.cpp" />
|
||||
<ClCompile Include="CCAtlasNode.cpp" />
|
||||
<ClCompile Include="ccCArray.cpp" />
|
||||
<ClCompile Include="CCClippingNode.cpp" />
|
||||
<ClCompile Include="CCComponent.cpp" />
|
||||
<ClCompile Include="CCComponentContainer.cpp" />
|
||||
|
@ -402,36 +458,9 @@
|
|||
<ClCompile Include="CCFontCharMap.cpp" />
|
||||
<ClCompile Include="CCFontFNT.cpp" />
|
||||
<ClCompile Include="CCFontFreeType.cpp" />
|
||||
<ClCompile Include="ccFPSImages.c">
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsWinRT>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
</ForcedIncludeFiles>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
</ForcedIncludeFiles>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
</ForcedIncludeFiles>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
</ForcedIncludeFiles>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
</ForcedIncludeFiles>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CCGLBufferedNode.cpp" />
|
||||
<ClCompile Include="CCGrabber.cpp" />
|
||||
<ClCompile Include="CCGrid.cpp" />
|
||||
<ClCompile Include="CCNodeGrid.cpp" />
|
||||
<ClCompile Include="CCIMEDispatcher.cpp" />
|
||||
<ClCompile Include="CCLabel.cpp" />
|
||||
<ClCompile Include="CCLabelAtlas.cpp" />
|
||||
<ClCompile Include="CCLabelBMFont.cpp" />
|
||||
|
@ -442,6 +471,7 @@
|
|||
<ClCompile Include="CCMenuItem.cpp" />
|
||||
<ClCompile Include="CCMotionStreak.cpp" />
|
||||
<ClCompile Include="CCNode.cpp" />
|
||||
<ClCompile Include="CCNodeGrid.cpp" />
|
||||
<ClCompile Include="CCParallaxNode.cpp" />
|
||||
<ClCompile Include="CCParticleBatchNode.cpp" />
|
||||
<ClCompile Include="CCParticleExamples.cpp" />
|
||||
|
@ -450,15 +480,11 @@
|
|||
<ClCompile Include="CCProgressTimer.cpp" />
|
||||
<ClCompile Include="CCRenderTexture.cpp" />
|
||||
<ClCompile Include="CCScene.cpp" />
|
||||
<ClCompile Include="CCScriptSupport.cpp" />
|
||||
<ClCompile Include="CCSprite.cpp" />
|
||||
<ClCompile Include="CCSpriteBatchNode.cpp" />
|
||||
<ClCompile Include="CCSpriteFrame.cpp" />
|
||||
<ClCompile Include="CCSpriteFrameCache.cpp" />
|
||||
<ClCompile Include="CCTextFieldTTF.cpp" />
|
||||
<ClCompile Include="CCTexture2D.cpp" />
|
||||
<ClCompile Include="CCTextureAtlas.cpp" />
|
||||
<ClCompile Include="CCTextureCache.cpp" />
|
||||
<ClCompile Include="CCTileMapAtlas.cpp" />
|
||||
<ClCompile Include="CCTMXLayer.cpp" />
|
||||
<ClCompile Include="CCTMXObjectGroup.cpp" />
|
||||
|
@ -468,37 +494,6 @@
|
|||
<ClCompile Include="CCTransitionPageTurn.cpp" />
|
||||
<ClCompile Include="CCTransitionProgress.cpp" />
|
||||
<ClCompile Include="CCTweenFunction.cpp" />
|
||||
<ClCompile Include="CCUserDefault.cpp" />
|
||||
<ClCompile Include="ccUTF8.cpp" />
|
||||
<ClCompile Include="ccUtils.cpp" />
|
||||
<ClCompile Include="CCVertex.cpp" />
|
||||
<ClCompile Include="platform\CCGLViewProtocol.cpp" />
|
||||
<ClCompile Include="platform\CCFileUtils.cpp" />
|
||||
<ClCompile Include="platform\CCImage.cpp" />
|
||||
<ClCompile Include="platform\CCSAXParser.cpp" />
|
||||
<ClCompile Include="platform\CCThread.cpp" />
|
||||
<ClCompile Include="platform\winrt\CCApplication.cpp" />
|
||||
<ClCompile Include="platform\winrt\CCCommon.cpp" />
|
||||
<ClCompile Include="platform\winrt\CCDevice.cpp" />
|
||||
<ClCompile Include="platform\winrt\CCFileUtilsWinRT.cpp" />
|
||||
<ClCompile Include="platform\winrt\CCFreeTypeFont.cpp" />
|
||||
<ClCompile Include="platform\winrt\CCGLView.cpp" />
|
||||
<ClCompile Include="platform\winrt\CCPrecompiledShaders.cpp" />
|
||||
<ClCompile Include="platform\winrt\CCPThreadWinRT.cpp" />
|
||||
<ClCompile Include="platform\winrt\CCStdC.cpp" />
|
||||
<ClCompile Include="platform\winrt\CCWinRTUtils.cpp" />
|
||||
<ClCompile Include="platform\winrt\DirectXBase.cpp" />
|
||||
<ClCompile Include="platform\winrt\InputEvent.cpp" />
|
||||
<ClCompile Include="platform\winrt\pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="platform\winrt\sha1.cpp" />
|
||||
<ClCompile Include="TGAlib.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\external\ConvertUTF\ConvertUTF.h" />
|
||||
|
@ -507,9 +502,14 @@
|
|||
<ClInclude Include="..\..\external\unzip\ioapi.h" />
|
||||
<ClInclude Include="..\..\external\unzip\unzip.h" />
|
||||
<ClInclude Include="..\..\external\xxhash\xxhash.h" />
|
||||
<ClInclude Include="..\3d\CCMesh.h" />
|
||||
<ClInclude Include="..\3d\CCObjLoader.h" />
|
||||
<ClInclude Include="..\3d\CCSprite3D.h" />
|
||||
<ClInclude Include="..\3d\CCSprite3DDataCache.h" />
|
||||
<ClInclude Include="..\base\atitc.h" />
|
||||
<ClInclude Include="..\base\base64.h" />
|
||||
<ClInclude Include="..\base\CCAutoreleasePool.h" />
|
||||
<ClInclude Include="..\base\ccCArray.h" />
|
||||
<ClInclude Include="..\base\ccConfig.h" />
|
||||
<ClInclude Include="..\base\CCConfiguration.h" />
|
||||
<ClInclude Include="..\base\CCConsole.h" />
|
||||
|
@ -532,21 +532,33 @@
|
|||
<ClInclude Include="..\base\CCEventMouse.h" />
|
||||
<ClInclude Include="..\base\CCEventTouch.h" />
|
||||
<ClInclude Include="..\base\CCEventType.h" />
|
||||
<ClInclude Include="..\base\ccFPSImages.h" />
|
||||
<ClInclude Include="..\base\CCIMEDelegate.h" />
|
||||
<ClInclude Include="..\base\CCIMEDispatcher.h" />
|
||||
<ClInclude Include="..\base\ccMacros.h" />
|
||||
<ClInclude Include="..\base\CCMap.h" />
|
||||
<ClInclude Include="..\base\CCNS.h" />
|
||||
<ClInclude Include="..\base\CCProfiling.h" />
|
||||
<ClInclude Include="..\base\CCRef.h" />
|
||||
<ClInclude Include="..\base\CCPlatformConfig.h" />
|
||||
<ClInclude Include="..\base\CCPlatformMacros.h" />
|
||||
<ClInclude Include="..\base\CCProfiling.h" />
|
||||
<ClInclude Include="..\base\CCProtocols.h" />
|
||||
<ClInclude Include="..\base\CCRef.h" />
|
||||
<ClInclude Include="..\base\CCRefPtr.h" />
|
||||
<ClInclude Include="..\base\CCScheduler.h" />
|
||||
<ClInclude Include="..\base\CCScriptSupport.h" />
|
||||
<ClInclude Include="..\base\CCTouch.h" />
|
||||
<ClInclude Include="..\base\ccTypes.h" />
|
||||
<ClInclude Include="..\base\CCUserDefault.h" />
|
||||
<ClInclude Include="..\base\ccUTF8.h" />
|
||||
<ClInclude Include="..\base\ccUtils.h" />
|
||||
<ClInclude Include="..\base\CCValue.h" />
|
||||
<ClInclude Include="..\base\CCVector.h" />
|
||||
<ClInclude Include="..\base\etc1.h" />
|
||||
<ClInclude Include="..\base\firePngData.h" />
|
||||
<ClInclude Include="..\base\s3tc.h" />
|
||||
<ClInclude Include="..\base\TGAlib.h" />
|
||||
<ClInclude Include="..\base\uthash.h" />
|
||||
<ClInclude Include="..\base\utlist.h" />
|
||||
<ClInclude Include="..\base\ZipUtils.h" />
|
||||
<ClInclude Include="..\cocos2d.h" />
|
||||
<ClInclude Include="..\deprecated\CCArray.h" />
|
||||
|
@ -563,13 +575,14 @@
|
|||
<ClInclude Include="..\math\CCGeometry.h" />
|
||||
<ClInclude Include="..\math\CCMath.h" />
|
||||
<ClInclude Include="..\math\CCMathBase.h" />
|
||||
<ClInclude Include="..\math\CCVertex.h" />
|
||||
<ClInclude Include="..\math\Mat4.h" />
|
||||
<ClInclude Include="..\math\MathUtil.h" />
|
||||
<ClInclude Include="..\math\Matrix.h" />
|
||||
<ClInclude Include="..\math\Quaternion.h" />
|
||||
<ClInclude Include="..\math\TransformUtils.h" />
|
||||
<ClInclude Include="..\math\Vector2.h" />
|
||||
<ClInclude Include="..\math\Vector3.h" />
|
||||
<ClInclude Include="..\math\Vector4.h" />
|
||||
<ClInclude Include="..\math\Vec2.h" />
|
||||
<ClInclude Include="..\math\Vec3.h" />
|
||||
<ClInclude Include="..\math\Vec4.h" />
|
||||
<ClInclude Include="..\physics\CCPhysicsBody.h" />
|
||||
<ClInclude Include="..\physics\CCPhysicsContact.h" />
|
||||
<ClInclude Include="..\physics\CCPhysicsJoint.h" />
|
||||
|
@ -581,6 +594,31 @@
|
|||
<ClInclude Include="..\physics\chipmunk\CCPhysicsJointInfo_chipmunk.h" />
|
||||
<ClInclude Include="..\physics\chipmunk\CCPhysicsShapeInfo_chipmunk.h" />
|
||||
<ClInclude Include="..\physics\chipmunk\CCPhysicsWorldInfo_chipmunk.h" />
|
||||
<ClInclude Include="..\platform\CCApplicationProtocol.h" />
|
||||
<ClInclude Include="..\platform\CCCommon.h" />
|
||||
<ClInclude Include="..\platform\CCDevice.h" />
|
||||
<ClInclude Include="..\platform\CCFileUtils.h" />
|
||||
<ClInclude Include="..\platform\CCGLViewProtocol.h" />
|
||||
<ClInclude Include="..\platform\CCImage.h" />
|
||||
<ClInclude Include="..\platform\CCSAXParser.h" />
|
||||
<ClInclude Include="..\platform\CCThread.h" />
|
||||
<ClInclude Include="..\platform\winrt\CCApplication.h" />
|
||||
<ClInclude Include="..\platform\winrt\CCFileUtilsWinRT.h" />
|
||||
<ClInclude Include="..\platform\winrt\CCFreeTypeFont.h" />
|
||||
<ClInclude Include="..\platform\winrt\CCGL.h" />
|
||||
<ClInclude Include="..\platform\winrt\CCGLView.h" />
|
||||
<ClInclude Include="..\platform\winrt\CCGL_Angle.h" />
|
||||
<ClInclude Include="..\platform\winrt\CCPlatformDefine.h" />
|
||||
<ClInclude Include="..\platform\winrt\CCPrecompiledShaders.h" />
|
||||
<ClInclude Include="..\platform\winrt\CCPThreadWinRT.h" />
|
||||
<ClInclude Include="..\platform\winrt\CCStdC.h" />
|
||||
<ClInclude Include="..\platform\winrt\CCWinRTUtils.h" />
|
||||
<ClInclude Include="..\platform\winrt\DirectXBase.h" />
|
||||
<ClInclude Include="..\platform\winrt\DirectXHelper.h" />
|
||||
<ClInclude Include="..\platform\winrt\InputEvent.h" />
|
||||
<ClInclude Include="..\platform\winrt\InputEventTypes.h" />
|
||||
<ClInclude Include="..\platform\winrt\pch.h" />
|
||||
<ClInclude Include="..\platform\winrt\sha1.h" />
|
||||
<ClInclude Include="..\renderer\CCBatchCommand.h" />
|
||||
<ClInclude Include="..\renderer\CCCustomCommand.h" />
|
||||
<ClInclude Include="..\renderer\CCGLProgram.h" />
|
||||
|
@ -589,11 +627,15 @@
|
|||
<ClInclude Include="..\renderer\CCGLProgramStateCache.h" />
|
||||
<ClInclude Include="..\renderer\ccGLStateCache.h" />
|
||||
<ClInclude Include="..\renderer\CCGroupCommand.h" />
|
||||
<ClInclude Include="..\renderer\CCMeshCommand.h" />
|
||||
<ClInclude Include="..\renderer\CCQuadCommand.h" />
|
||||
<ClInclude Include="..\renderer\CCRenderCommand.h" />
|
||||
<ClInclude Include="..\renderer\CCRenderCommandPool.h" />
|
||||
<ClInclude Include="..\renderer\CCRenderer.h" />
|
||||
<ClInclude Include="..\renderer\ccShaders.h" />
|
||||
<ClInclude Include="..\renderer\CCTexture2D.h" />
|
||||
<ClInclude Include="..\renderer\CCTextureAtlas.h" />
|
||||
<ClInclude Include="..\renderer\CCTextureCache.h" />
|
||||
<ClInclude Include="CCAction.h" />
|
||||
<ClInclude Include="CCActionCamera.h" />
|
||||
<ClInclude Include="CCActionCatmullRom.h" />
|
||||
|
@ -610,56 +652,44 @@
|
|||
<ClInclude Include="CCAnimation.h" />
|
||||
<ClInclude Include="CCAnimationCache.h" />
|
||||
<ClInclude Include="CCAtlasNode.h" />
|
||||
<ClInclude Include="ccCArray.h" />
|
||||
<ClInclude Include="CCClippingNode.h" />
|
||||
<ClInclude Include="CCComponent.h" />
|
||||
<ClInclude Include="CCComponentContainer.h" />
|
||||
<ClInclude Include="ccConfig.h" />
|
||||
<ClInclude Include="CCDeprecated.h" />
|
||||
<ClInclude Include="CCDrawingPrimitives.h" />
|
||||
<ClInclude Include="CCDrawNode.h" />
|
||||
<ClInclude Include="CCEventType.h" />
|
||||
<ClInclude Include="CCFont.h" />
|
||||
<ClInclude Include="CCFontAtlas.h" />
|
||||
<ClInclude Include="CCFontAtlasCache.h" />
|
||||
<ClInclude Include="CCFontCharMap.h" />
|
||||
<ClInclude Include="CCFontFNT.h" />
|
||||
<ClInclude Include="CCFontFreeType.h" />
|
||||
<ClInclude Include="ccFPSImages.h" />
|
||||
<ClInclude Include="CCGLBufferedNode.h" />
|
||||
<ClInclude Include="CCGrabber.h" />
|
||||
<ClInclude Include="CCGrid.h" />
|
||||
<ClInclude Include="CCNodeGrid.h" />
|
||||
<ClInclude Include="CCIMEDelegate.h" />
|
||||
<ClInclude Include="CCIMEDispatcher.h" />
|
||||
<ClInclude Include="CCLabel.h" />
|
||||
<ClInclude Include="CCLabelAtlas.h" />
|
||||
<ClInclude Include="CCLabelBMFont.h" />
|
||||
<ClInclude Include="CCLabelTextFormatter.h" />
|
||||
<ClInclude Include="CCLabelTTF.h" />
|
||||
<ClInclude Include="CCLayer.h" />
|
||||
<ClInclude Include="ccMacros.h" />
|
||||
<ClInclude Include="CCMenu.h" />
|
||||
<ClInclude Include="CCMenuItem.h" />
|
||||
<ClInclude Include="CCMotionStreak.h" />
|
||||
<ClInclude Include="CCNode.h" />
|
||||
<ClInclude Include="CCNodeGrid.h" />
|
||||
<ClInclude Include="CCParallaxNode.h" />
|
||||
<ClInclude Include="CCParticleBatchNode.h" />
|
||||
<ClInclude Include="CCParticleExamples.h" />
|
||||
<ClInclude Include="CCParticleSystem.h" />
|
||||
<ClInclude Include="CCParticleSystemQuad.h" />
|
||||
<ClInclude Include="CCProgressTimer.h" />
|
||||
<ClInclude Include="CCProtocols.h" />
|
||||
<ClInclude Include="CCRenderTexture.h" />
|
||||
<ClInclude Include="CCScene.h" />
|
||||
<ClInclude Include="CCScriptSupport.h" />
|
||||
<ClInclude Include="CCSprite.h" />
|
||||
<ClInclude Include="CCSpriteBatchNode.h" />
|
||||
<ClInclude Include="CCSpriteFrame.h" />
|
||||
<ClInclude Include="CCSpriteFrameCache.h" />
|
||||
<ClInclude Include="CCTextFieldTTF.h" />
|
||||
<ClInclude Include="CCTexture2D.h" />
|
||||
<ClInclude Include="CCTextureAtlas.h" />
|
||||
<ClInclude Include="CCTextureCache.h" />
|
||||
<ClInclude Include="CCTileMapAtlas.h" />
|
||||
<ClInclude Include="CCTMXLayer.h" />
|
||||
<ClInclude Include="CCTMXObjectGroup.h" />
|
||||
|
@ -668,53 +698,20 @@
|
|||
<ClInclude Include="CCTransition.h" />
|
||||
<ClInclude Include="CCTransitionPageTurn.h" />
|
||||
<ClInclude Include="CCTransitionProgress.h" />
|
||||
<ClInclude Include="ccTypes.h" />
|
||||
<ClInclude Include="CCTweenFunction.h" />
|
||||
<ClInclude Include="CCUserDefault.h" />
|
||||
<ClInclude Include="ccUTF8.h" />
|
||||
<ClInclude Include="ccUtils.h" />
|
||||
<ClInclude Include="CCVertex.h" />
|
||||
<ClInclude Include="cocos2d.h" />
|
||||
<ClInclude Include="platform\CCApplicationProtocol.h" />
|
||||
<ClInclude Include="platform\CCCommon.h" />
|
||||
<ClInclude Include="platform\CCDevice.h" />
|
||||
<ClInclude Include="platform\CCGLViewProtocol.h" />
|
||||
<ClInclude Include="platform\CCFileUtils.h" />
|
||||
<ClInclude Include="platform\CCImage.h" />
|
||||
<ClInclude Include="platform\CCSAXParser.h" />
|
||||
<ClInclude Include="platform\CCThread.h" />
|
||||
<ClInclude Include="platform\winrt\CCApplication.h" />
|
||||
<ClInclude Include="platform\winrt\CCFileUtilsWinRT.h" />
|
||||
<ClInclude Include="platform\winrt\CCFreeTypeFont.h" />
|
||||
<ClInclude Include="platform\winrt\CCGL.h" />
|
||||
<ClInclude Include="platform\winrt\CCGLView.h" />
|
||||
<ClInclude Include="platform\winrt\CCGL_Angle.h" />
|
||||
<ClInclude Include="platform\winrt\CCPlatformDefine.h" />
|
||||
<ClInclude Include="platform\winrt\CCPrecompiledShaders.h" />
|
||||
<ClInclude Include="platform\winrt\CCPThreadWinRT.h" />
|
||||
<ClInclude Include="platform\winrt\CCStdC.h" />
|
||||
<ClInclude Include="platform\winrt\CCWinRTUtils.h" />
|
||||
<ClInclude Include="platform\winrt\DirectXBase.h" />
|
||||
<ClInclude Include="platform\winrt\DirectXHelper.h" />
|
||||
<ClInclude Include="platform\winrt\InputEvent.h" />
|
||||
<ClInclude Include="platform\winrt\InputEventTypes.h" />
|
||||
<ClInclude Include="platform\winrt\pch.h" />
|
||||
<ClInclude Include="platform\winrt\sha1.h" />
|
||||
<ClInclude Include="TGAlib.h" />
|
||||
<ClInclude Include="uthash.h" />
|
||||
<ClInclude Include="utlist.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\math\CMakeLists.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\base\CCUserDefault.mm" />
|
||||
<None Include="..\math\Mat4.inl" />
|
||||
<None Include="..\math\MathUtil.inl" />
|
||||
<None Include="..\math\MathUtilNeon.inl" />
|
||||
<None Include="..\math\Matrix.inl" />
|
||||
<None Include="..\math\Quaternion.inl" />
|
||||
<None Include="..\math\Vector2.inl" />
|
||||
<None Include="..\math\Vector3.inl" />
|
||||
<None Include="..\math\Vector4.inl" />
|
||||
<None Include="..\math\Vec2.inl" />
|
||||
<None Include="..\math\Vec3.inl" />
|
||||
<None Include="..\math\Vec4.inl" />
|
||||
<None Include="..\renderer\ccShader_3D_Color.frag" />
|
||||
<None Include="..\renderer\ccShader_3D_ColorTex.frag" />
|
||||
<None Include="..\renderer\ccShader_3D_PositionTex.vert" />
|
||||
<None Include="..\renderer\ccShader_Label.vert" />
|
||||
<None Include="..\renderer\ccShader_Label_df.frag" />
|
||||
<None Include="..\renderer\ccShader_Label_df_glow.frag" />
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -75,7 +75,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\curl\include\wp8;$(EngineRoot)external\curl\include\wp8\curl;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
|
@ -100,7 +100,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_LIB;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\curl\include\wp8;$(EngineRoot)external\curl\include\wp8\curl;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
|
@ -125,7 +125,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\curl\include\wp8;$(EngineRoot)external\curl\include\wp8\curl;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
|
@ -151,7 +151,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_LIB;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\curl\include\wp8;$(EngineRoot)external\curl\include\wp8\curl;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
|
@ -222,6 +222,10 @@
|
|||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCMesh.cpp" />
|
||||
<ClCompile Include="..\3d\CCObjLoader.cpp" />
|
||||
<ClCompile Include="..\3d\CCSprite3D.cpp" />
|
||||
<ClCompile Include="..\3d\CCSprite3DDataCache.cpp" />
|
||||
<ClCompile Include="..\base\atitc.cpp" />
|
||||
<ClCompile Include="..\base\base64.cpp" />
|
||||
<ClCompile Include="..\base\CCAutoreleasePool.cpp" />
|
||||
|
@ -257,6 +261,10 @@
|
|||
</ForcedIncludeFiles>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
</ForcedIncludeFiles>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\base\CCIMEDispatcher.cpp" />
|
||||
<ClCompile Include="..\base\CCNS.cpp" />
|
||||
|
@ -318,11 +326,16 @@
|
|||
<ClCompile Include="..\platform\winrt\CCWinRTUtils.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\inet_ntop_winrt.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\InputEvent.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\pch.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\sha1.cpp" />
|
||||
<ClCompile Include="..\platform\wp8\CCGLView.cpp" />
|
||||
<ClCompile Include="..\platform\wp8\Direct3DBase.cpp" />
|
||||
<ClCompile Include="..\platform\wp8\DirectXBase.cpp" />
|
||||
<ClCompile Include="..\platform\wp8\pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCBatchCommand.cpp" />
|
||||
<ClCompile Include="..\renderer\CCCustomCommand.cpp" />
|
||||
<ClCompile Include="..\renderer\CCGLProgram.cpp" />
|
||||
|
@ -331,6 +344,7 @@
|
|||
<ClCompile Include="..\renderer\CCGLProgramStateCache.cpp" />
|
||||
<ClCompile Include="..\renderer\ccGLStateCache.cpp" />
|
||||
<ClCompile Include="..\renderer\CCGroupCommand.cpp" />
|
||||
<ClCompile Include="..\renderer\CCMeshCommand.cpp" />
|
||||
<ClCompile Include="..\renderer\CCQuadCommand.cpp" />
|
||||
<ClCompile Include="..\renderer\CCRenderCommand.cpp" />
|
||||
<ClCompile Include="..\renderer\CCRenderer.cpp" />
|
||||
|
@ -409,6 +423,10 @@
|
|||
<ClInclude Include="..\..\external\unzip\ioapi.h" />
|
||||
<ClInclude Include="..\..\external\unzip\unzip.h" />
|
||||
<ClInclude Include="..\..\external\xxhash\xxhash.h" />
|
||||
<ClInclude Include="..\3d\CCMesh.h" />
|
||||
<ClInclude Include="..\3d\CCObjLoader.h" />
|
||||
<ClInclude Include="..\3d\CCSprite3D.h" />
|
||||
<ClInclude Include="..\3d\CCSprite3DDataCache.h" />
|
||||
<ClInclude Include="..\base\atitc.h" />
|
||||
<ClInclude Include="..\base\base64.h" />
|
||||
<ClInclude Include="..\base\CCAutoreleasePool.h" />
|
||||
|
@ -518,11 +536,11 @@
|
|||
<ClInclude Include="..\platform\winrt\inet_ntop_winrt.h" />
|
||||
<ClInclude Include="..\platform\winrt\InputEvent.h" />
|
||||
<ClInclude Include="..\platform\winrt\InputEventTypes.h" />
|
||||
<ClInclude Include="..\platform\winrt\pch.h" />
|
||||
<ClInclude Include="..\platform\winrt\sha1.h" />
|
||||
<ClInclude Include="..\platform\wp8\CCGLView.h" />
|
||||
<ClInclude Include="..\platform\wp8\Direct3DBase.h" />
|
||||
<ClInclude Include="..\platform\wp8\DirectXBase.h" />
|
||||
<ClInclude Include="..\platform\wp8\pch.h" />
|
||||
<ClInclude Include="..\renderer\CCBatchCommand.h" />
|
||||
<ClInclude Include="..\renderer\CCCustomCommand.h" />
|
||||
<ClInclude Include="..\renderer\CCGLProgram.h" />
|
||||
|
@ -531,6 +549,7 @@
|
|||
<ClInclude Include="..\renderer\CCGLProgramStateCache.h" />
|
||||
<ClInclude Include="..\renderer\ccGLStateCache.h" />
|
||||
<ClInclude Include="..\renderer\CCGroupCommand.h" />
|
||||
<ClInclude Include="..\renderer\CCMeshCommand.h" />
|
||||
<ClInclude Include="..\renderer\CCQuadCommand.h" />
|
||||
<ClInclude Include="..\renderer\CCRenderCommand.h" />
|
||||
<ClInclude Include="..\renderer\CCRenderCommandPool.h" />
|
||||
|
|
|
@ -571,15 +571,28 @@
|
|||
<ClCompile Include="..\platform\winrt\InputEvent.cpp">
|
||||
<Filter>platform\winrt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\winrt\pch.cpp">
|
||||
<Filter>platform\winrt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\winrt\sha1.cpp">
|
||||
<Filter>platform\winrt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\base\CCIMEDispatcher.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCMesh.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCObjLoader.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCSprite3D.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCSprite3DDataCache.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCMeshCommand.cpp">
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\wp8\pch.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
||||
|
@ -1167,9 +1180,6 @@
|
|||
<ClInclude Include="..\platform\winrt\InputEventTypes.h">
|
||||
<Filter>platform\winrt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\winrt\pch.h">
|
||||
<Filter>platform\winrt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\winrt\sha1.h">
|
||||
<Filter>platform\winrt</Filter>
|
||||
</ClInclude>
|
||||
|
@ -1179,6 +1189,22 @@
|
|||
<ClInclude Include="..\base\CCIMEDispatcher.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\CCMesh.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\CCObjLoader.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\CCSprite3D.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\CCSprite3DDataCache.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCMeshCommand.h">
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\wp8\pch.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\math\Mat4.inl">
|
||||
|
|
|
@ -0,0 +1,214 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 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 "CCMesh.h"
|
||||
|
||||
#include <list>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "base/ccMacros.h"
|
||||
#include "renderer/ccGLStateCache.h"
|
||||
#include "CCObjLoader.h"
|
||||
#include "CCSprite3DDataCache.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
bool RenderMeshData::hasVertexAttrib(int attrib)
|
||||
{
|
||||
for (auto itr = _vertexAttribs.begin(); itr != _vertexAttribs.end(); itr++)
|
||||
{
|
||||
if ((*itr).vertexAttrib == attrib)
|
||||
return true; //already has
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RenderMeshData::initFrom(const std::vector<float>& positions,
|
||||
const std::vector<float>& normals,
|
||||
const std::vector<float>& texs,
|
||||
const std::vector<unsigned short>& indices)
|
||||
{
|
||||
CC_ASSERT(positions.size()<65536 * 3 && "index may out of bound");
|
||||
|
||||
_vertexAttribs.clear();
|
||||
_vertexsizeBytes = 0;
|
||||
|
||||
_vertexNum = positions.size() / 3; //number of vertex
|
||||
if (_vertexNum == 0)
|
||||
return false;
|
||||
|
||||
if ((normals.size() != 0 && _vertexNum * 3 != normals.size()) || (texs.size() != 0 && _vertexNum * 2 != texs.size()))
|
||||
return false;
|
||||
|
||||
_vertexsizeBytes += 3;
|
||||
MeshVertexAttrib meshvertexattrib;
|
||||
meshvertexattrib.size = 3;
|
||||
meshvertexattrib.type = GL_FLOAT;
|
||||
meshvertexattrib.attribSizeBytes = meshvertexattrib.size * sizeof(float);
|
||||
meshvertexattrib.vertexAttrib = GLProgram::VERTEX_ATTRIB_POSITION;
|
||||
_vertexAttribs.push_back(meshvertexattrib);
|
||||
|
||||
//normal
|
||||
if (normals.size())
|
||||
{
|
||||
//add normal flag
|
||||
_vertexsizeBytes += 3;
|
||||
meshvertexattrib.vertexAttrib = GLProgram::VERTEX_ATTRIB_NORMAL;
|
||||
_vertexAttribs.push_back(meshvertexattrib);
|
||||
}
|
||||
//
|
||||
if (texs.size())
|
||||
{
|
||||
_vertexsizeBytes += 2;
|
||||
meshvertexattrib.size = 2;
|
||||
meshvertexattrib.vertexAttrib = GLProgram::VERTEX_ATTRIB_TEX_COORD;
|
||||
meshvertexattrib.attribSizeBytes = meshvertexattrib.size * sizeof(float);
|
||||
_vertexAttribs.push_back(meshvertexattrib);
|
||||
}
|
||||
|
||||
_vertexs.clear();
|
||||
_vertexs.reserve(_vertexNum * _vertexsizeBytes);
|
||||
_vertexsizeBytes *= sizeof(float);
|
||||
|
||||
bool hasNormal = hasVertexAttrib(GLProgram::VERTEX_ATTRIB_NORMAL);
|
||||
bool hasTexCoord = hasVertexAttrib(GLProgram::VERTEX_ATTRIB_TEX_COORD);
|
||||
//position, normal, texCoordinate into _vertexs
|
||||
for(int i = 0; i < _vertexNum; i++)
|
||||
{
|
||||
_vertexs.push_back(positions[i * 3]);
|
||||
_vertexs.push_back(positions[i * 3 + 1]);
|
||||
_vertexs.push_back(positions[i * 3 + 2]);
|
||||
|
||||
if (hasNormal)
|
||||
{
|
||||
_vertexs.push_back(normals[i * 3]);
|
||||
_vertexs.push_back(normals[i * 3 + 1]);
|
||||
_vertexs.push_back(normals[i * 3 + 2]);
|
||||
}
|
||||
|
||||
if (hasTexCoord)
|
||||
{
|
||||
_vertexs.push_back(texs[i * 2]);
|
||||
_vertexs.push_back(texs[i * 2 + 1]);
|
||||
}
|
||||
}
|
||||
_indices = indices;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Mesh::Mesh()
|
||||
:_vertexBuffer(0)
|
||||
, _indexBuffer(0)
|
||||
, _primitiveType(PrimitiveType::TRIANGLES)
|
||||
, _indexFormat(IndexFormat::INDEX16)
|
||||
, _indexCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
Mesh::~Mesh()
|
||||
{
|
||||
cleanAndFreeBuffers();
|
||||
}
|
||||
|
||||
Mesh* Mesh::create(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices)
|
||||
{
|
||||
auto mesh = new Mesh();
|
||||
if(mesh && mesh->init(positions, normals, texs, indices))
|
||||
{
|
||||
mesh->autorelease();
|
||||
return mesh;
|
||||
}
|
||||
CC_SAFE_DELETE(mesh);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Mesh::init(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices)
|
||||
{
|
||||
bool bRet = _renderdata.initFrom(positions, normals, texs, indices);
|
||||
if (!bRet)
|
||||
return false;
|
||||
|
||||
restore();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Mesh::cleanAndFreeBuffers()
|
||||
{
|
||||
if(glIsBuffer(_vertexBuffer))
|
||||
{
|
||||
glDeleteBuffers(1, &_vertexBuffer);
|
||||
_vertexBuffer = 0;
|
||||
}
|
||||
|
||||
if(glIsBuffer(_indexBuffer))
|
||||
{
|
||||
glDeleteBuffers(1, &_indexBuffer);
|
||||
_indexBuffer = 0;
|
||||
}
|
||||
_primitiveType = PrimitiveType::TRIANGLES;
|
||||
_indexFormat = IndexFormat::INDEX16;
|
||||
_indexCount = 0;
|
||||
}
|
||||
|
||||
void Mesh::buildBuffer()
|
||||
{
|
||||
cleanAndFreeBuffers();
|
||||
|
||||
glGenBuffers(1, &_vertexBuffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER,
|
||||
_renderdata._vertexs.size() * sizeof(_renderdata._vertexs[0]),
|
||||
&_renderdata._vertexs[0],
|
||||
GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
glGenBuffers(1, &_indexBuffer);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
|
||||
|
||||
unsigned int indexSize = 2;
|
||||
IndexFormat indexformat = IndexFormat::INDEX16;
|
||||
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexSize * _renderdata._indices.size(), &_renderdata._indices[0], GL_STATIC_DRAW);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
_primitiveType = PrimitiveType::TRIANGLES;
|
||||
_indexFormat = indexformat;
|
||||
_indexCount = _renderdata._indices.size();
|
||||
}
|
||||
|
||||
void Mesh::restore()
|
||||
{
|
||||
cleanAndFreeBuffers();
|
||||
buildBuffer();
|
||||
}
|
||||
|
||||
NS_CC_END
|
|
@ -0,0 +1,133 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 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 __CCMESH_H__
|
||||
#define __CCMESH_H__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/CCRef.h"
|
||||
#include "base/ccTypes.h"
|
||||
#include "math/CCMath.h"
|
||||
#include "renderer/CCGLProgram.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
//mesh vertex attribute
|
||||
struct MeshVertexAttrib
|
||||
{
|
||||
//attribute size
|
||||
GLint size;
|
||||
//GL_FLOAT
|
||||
GLenum type;
|
||||
//VERTEX_ATTRIB_POSITION,VERTEX_ATTRIB_COLOR,VERTEX_ATTRIB_TEX_COORD,VERTEX_ATTRIB_NORMAL, GLProgram for detail
|
||||
int vertexAttrib;
|
||||
//size in bytes
|
||||
int attribSizeBytes;
|
||||
};
|
||||
|
||||
class RenderMeshData
|
||||
{
|
||||
friend class Mesh;
|
||||
public:
|
||||
RenderMeshData(): _vertexsizeBytes(0)
|
||||
{
|
||||
}
|
||||
bool hasVertexAttrib(int attrib);
|
||||
bool initFrom(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices);
|
||||
|
||||
protected:
|
||||
int _vertexsizeBytes;
|
||||
ssize_t _vertexNum;
|
||||
std::vector<float> _vertexs;
|
||||
std::vector<unsigned short> _indices;
|
||||
std::vector<MeshVertexAttrib> _vertexAttribs;
|
||||
};
|
||||
|
||||
/** Mesh: TODO, add description of Mesh */
|
||||
class Mesh : public Ref
|
||||
{
|
||||
public:
|
||||
/** Defines supported index formats. */
|
||||
enum class IndexFormat
|
||||
{
|
||||
INDEX8 = GL_UNSIGNED_BYTE,
|
||||
INDEX16 = GL_UNSIGNED_SHORT,
|
||||
};
|
||||
|
||||
/** Defines supported primitive types. */
|
||||
enum class PrimitiveType
|
||||
{
|
||||
TRIANGLES = GL_TRIANGLES,
|
||||
TRIANGLE_STRIP = GL_TRIANGLE_STRIP,
|
||||
LINES = GL_LINES,
|
||||
LINE_STRIP = GL_LINE_STRIP,
|
||||
POINTS = GL_POINTS
|
||||
};
|
||||
|
||||
//create
|
||||
static Mesh* create(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices);
|
||||
|
||||
//get vertex buffer
|
||||
inline GLuint getVertexBuffer() const { return _vertexBuffer; }
|
||||
|
||||
//get mesh vertex attribute count
|
||||
ssize_t getMeshVertexAttribCount() const { return _renderdata._vertexAttribs.size(); }
|
||||
//get MeshVertexAttribute by index
|
||||
const MeshVertexAttrib& getMeshVertexAttribute(int idx) const { return _renderdata._vertexAttribs[idx]; }
|
||||
//has vertex attribute?
|
||||
bool hasVertexAttrib(int attrib) { return _renderdata.hasVertexAttrib(attrib); }
|
||||
//get per vertex size in bytes
|
||||
int getVertexSizeInBytes() const { return _renderdata._vertexsizeBytes; }
|
||||
|
||||
PrimitiveType getPrimitiveType() const { return _primitiveType; }
|
||||
ssize_t getIndexCount() const { return _indexCount; }
|
||||
IndexFormat getIndexFormat() const { return _indexFormat; }
|
||||
GLuint getIndexBuffer() const {return _indexBuffer; }
|
||||
|
||||
//build vertex buffer from renderdata
|
||||
void restore();
|
||||
|
||||
protected:
|
||||
Mesh();
|
||||
virtual ~Mesh();
|
||||
bool init(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices);
|
||||
|
||||
//build buffer
|
||||
void buildBuffer();
|
||||
void cleanAndFreeBuffers();
|
||||
|
||||
PrimitiveType _primitiveType;
|
||||
IndexFormat _indexFormat;
|
||||
GLuint _vertexBuffer;
|
||||
GLuint _indexBuffer;
|
||||
ssize_t _indexCount;
|
||||
|
||||
RenderMeshData _renderdata;
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __CCMESH_H_
|
|
@ -0,0 +1,714 @@
|
|||
//
|
||||
// Copyright 2012-2013, Syoyo Fujita.
|
||||
//
|
||||
// Licensed under 2-clause BSD liecense.
|
||||
//
|
||||
|
||||
//
|
||||
// version 0.9.6: Support Ni(index of refraction) mtl parameter.
|
||||
// Parse transmittance material parameter correctly.
|
||||
// version 0.9.5: Parse multiple group name.
|
||||
// Add support of specifying the base path to load material file.
|
||||
// version 0.9.4: Initial suupport of group tag(g)
|
||||
// version 0.9.3: Fix parsing triple 'x/y/z'
|
||||
// version 0.9.2: Add more .mtl load support
|
||||
// version 0.9.1: Add initial .mtl load support
|
||||
// version 0.9.0: Initial
|
||||
//
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include "CCObjLoader.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
struct vertex_index
|
||||
{
|
||||
int v_idx, vt_idx, vn_idx;
|
||||
vertex_index() {};
|
||||
vertex_index(int idx) : v_idx(idx), vt_idx(idx), vn_idx(idx) {};
|
||||
vertex_index(int vidx, int vtidx, int vnidx) : v_idx(vidx), vt_idx(vtidx), vn_idx(vnidx) {};
|
||||
|
||||
};
|
||||
// for std::map
|
||||
static inline bool operator<(const vertex_index& a, const vertex_index& b)
|
||||
{
|
||||
if (a.v_idx != b.v_idx) return (a.v_idx < b.v_idx);
|
||||
if (a.vn_idx != b.vn_idx) return (a.vn_idx < b.vn_idx);
|
||||
if (a.vt_idx != b.vt_idx) return (a.vt_idx < b.vt_idx);
|
||||
return false;
|
||||
}
|
||||
|
||||
struct obj_shape
|
||||
{
|
||||
std::vector<float> v;
|
||||
std::vector<float> vn;
|
||||
std::vector<float> vt;
|
||||
};
|
||||
|
||||
static inline bool isSpace(const char c)
|
||||
{
|
||||
return (c == ' ') || (c == '\t');
|
||||
}
|
||||
|
||||
static inline bool isNewLine(const char c)
|
||||
{
|
||||
return (c == '\r') || (c == '\n') || (c == '\0');
|
||||
}
|
||||
|
||||
// Make index zero-base, and also support relative index.
|
||||
static inline int fixIndex(int idx, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (idx > 0) {
|
||||
i = idx - 1;
|
||||
} else if (idx == 0) {
|
||||
i = 0;
|
||||
} else { // negative value = relative
|
||||
i = n + idx;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
static inline std::string parseString(const char*& token)
|
||||
{
|
||||
std::string s;
|
||||
auto b = strspn(token, " \t");
|
||||
auto e = strcspn(token, " \t\r");
|
||||
s = std::string(&token[b], &token[e]);
|
||||
|
||||
token += (e - b);
|
||||
return s;
|
||||
}
|
||||
|
||||
static inline int parseInt(const char*& token)
|
||||
{
|
||||
token += strspn(token, " \t");
|
||||
int i = atoi(token);
|
||||
token += strcspn(token, " \t\r");
|
||||
return i;
|
||||
}
|
||||
|
||||
static inline float parseFloat(const char*& token)
|
||||
{
|
||||
token += strspn(token, " \t");
|
||||
float f = (float)atof(token);
|
||||
token += strcspn(token, " \t\r");
|
||||
return f;
|
||||
}
|
||||
|
||||
static inline void parseFloat2(float& x, float& y, const char*& token)
|
||||
{
|
||||
x = parseFloat(token);
|
||||
y = parseFloat(token);
|
||||
}
|
||||
|
||||
static inline void parseFloat3(float& x, float& y, float& z, const char*& token)
|
||||
{
|
||||
x = parseFloat(token);
|
||||
y = parseFloat(token);
|
||||
z = parseFloat(token);
|
||||
}
|
||||
|
||||
// Parse triples: i, i/j/k, i//k, i/j
|
||||
static vertex_index parseTriple(const char* &token, int vsize, int vnsize, int vtsize)
|
||||
{
|
||||
vertex_index vi(-1);
|
||||
|
||||
vi.v_idx = fixIndex(atoi(token), vsize);
|
||||
token += strcspn(token, "/ \t\r");
|
||||
if (token[0] != '/') {
|
||||
return vi;
|
||||
}
|
||||
token++;
|
||||
|
||||
// i//k
|
||||
if (token[0] == '/') {
|
||||
token++;
|
||||
vi.vn_idx = fixIndex(atoi(token), vnsize);
|
||||
token += strcspn(token, "/ \t\r");
|
||||
return vi;
|
||||
}
|
||||
|
||||
// i/j/k or i/j
|
||||
vi.vt_idx = fixIndex(atoi(token), vtsize);
|
||||
token += strcspn(token, "/ \t\r");
|
||||
if (token[0] != '/') {
|
||||
return vi;
|
||||
}
|
||||
|
||||
// i/j/k
|
||||
token++; // skip '/'
|
||||
vi.vn_idx = fixIndex(atoi(token), vnsize);
|
||||
token += strcspn(token, "/ \t\r");
|
||||
return vi;
|
||||
}
|
||||
|
||||
static ssize_t updateVertex( std::map<vertex_index, ssize_t>& vertexCache, std::vector<float>& positions, std::vector<float>& normals,
|
||||
std::vector<float>& texcoords, const std::vector<float>& in_positions, const std::vector<float>& in_normals, const std::vector<float>& in_texcoords,
|
||||
const vertex_index& i)
|
||||
{
|
||||
const auto it = vertexCache.find(i);
|
||||
|
||||
if (it != vertexCache.end())
|
||||
{
|
||||
// found cache
|
||||
return it->second;
|
||||
}
|
||||
|
||||
assert(in_positions.size() > (3*i.v_idx+2));
|
||||
|
||||
positions.push_back(in_positions[3*i.v_idx+0]);
|
||||
positions.push_back(in_positions[3*i.v_idx+1]);
|
||||
positions.push_back(in_positions[3*i.v_idx+2]);
|
||||
|
||||
if (i.vn_idx >= 0)
|
||||
{
|
||||
normals.push_back(in_normals[3*i.vn_idx+0]);
|
||||
normals.push_back(in_normals[3*i.vn_idx+1]);
|
||||
normals.push_back(in_normals[3*i.vn_idx+2]);
|
||||
}
|
||||
|
||||
if (i.vt_idx >= 0)
|
||||
{
|
||||
texcoords.push_back(in_texcoords[2*i.vt_idx+0]);
|
||||
texcoords.push_back(in_texcoords[2*i.vt_idx+1]);
|
||||
}
|
||||
|
||||
auto idx = positions.size() / 3 - 1;
|
||||
vertexCache[i] = idx;
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
static bool exportFaceGroupToShape( std::map<vertex_index, ssize_t>& vertexCache, ObjLoader::shapes_t& shapes, const std::vector<float> &in_positions,
|
||||
const std::vector<float> &in_normals, const std::vector<float> &in_texcoords, const std::vector<std::vector<vertex_index> >& faceGroup,
|
||||
const ObjLoader::material_t &material, const std::string &name)
|
||||
{
|
||||
if (faceGroup.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Flattened version of vertex data
|
||||
std::vector<float>& positions = shapes.positions;
|
||||
std::vector<float>& normals = shapes.normals;
|
||||
std::vector<float>& texcoords = shapes.texcoords;
|
||||
std::vector<unsigned short> indices;
|
||||
|
||||
// Flatten vertices and indices
|
||||
for (size_t i = 0; i < faceGroup.size(); i++)
|
||||
{
|
||||
const std::vector<vertex_index>& face = faceGroup[i];
|
||||
|
||||
vertex_index i0 = face[0];
|
||||
vertex_index i1(-1);
|
||||
vertex_index i2 = face[1];
|
||||
|
||||
size_t npolys = face.size();
|
||||
|
||||
// Polygon -> triangle fan conversion
|
||||
for (size_t k = 2; k < npolys; k++)
|
||||
{
|
||||
i1 = i2;
|
||||
i2 = face[k];
|
||||
|
||||
unsigned short v0 = updateVertex(vertexCache, positions, normals, texcoords, in_positions, in_normals, in_texcoords, i0);
|
||||
unsigned short v1 = updateVertex(vertexCache, positions, normals, texcoords, in_positions, in_normals, in_texcoords, i1);
|
||||
unsigned short v2 = updateVertex(vertexCache, positions, normals, texcoords, in_positions, in_normals, in_texcoords, i2);
|
||||
|
||||
indices.push_back(v0);
|
||||
indices.push_back(v1);
|
||||
indices.push_back(v2);
|
||||
}
|
||||
}
|
||||
|
||||
ObjLoader::shape_t shape;
|
||||
shape.name = name;
|
||||
shape.material = material;
|
||||
shape.mesh.indices.swap(indices);
|
||||
|
||||
shapes.shapes.push_back(shape);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
std::string trim(const std::string& str)
|
||||
{
|
||||
if (str.empty())
|
||||
return str;
|
||||
auto len = str.length();
|
||||
char c = str[len - 1];
|
||||
while (c == '\r' || c == '\n')
|
||||
{
|
||||
len--;
|
||||
c = str[len - 1];
|
||||
}
|
||||
return str.substr(0, len);
|
||||
}
|
||||
|
||||
void InitMaterial(ObjLoader::material_t& material)
|
||||
{
|
||||
material.name = "";
|
||||
material.ambient_texname = "";
|
||||
material.diffuse_texname = "";
|
||||
material.specular_texname = "";
|
||||
material.normal_texname = "";
|
||||
for (int i = 0; i < 3; i ++)
|
||||
{
|
||||
material.ambient[i] = 0.f;
|
||||
material.diffuse[i] = 0.f;
|
||||
material.specular[i] = 0.f;
|
||||
material.transmittance[i] = 0.f;
|
||||
material.emission[i] = 0.f;
|
||||
}
|
||||
material.illum = 0;
|
||||
material.dissolve = 1.f;
|
||||
material.shininess = 1.f;
|
||||
material.unknown_parameter.clear();
|
||||
}
|
||||
|
||||
std::string LoadMtl ( std::map<std::string, ObjLoader::material_t>& material_map, const char* filename, const char* mtl_basepath)
|
||||
{
|
||||
material_map.clear();
|
||||
std::stringstream err;
|
||||
|
||||
std::string filepath;
|
||||
|
||||
if (mtl_basepath)
|
||||
{
|
||||
filepath = std::string(mtl_basepath) + std::string(filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
filepath = std::string(filename);
|
||||
}
|
||||
|
||||
std::ifstream ifs(filepath.c_str());
|
||||
if (!ifs)
|
||||
{
|
||||
err << "Cannot open file [" << filepath << "]" << std::endl;
|
||||
return err.str();
|
||||
}
|
||||
|
||||
ObjLoader::material_t material;
|
||||
|
||||
int maxchars = 8192; // Alloc enough size.
|
||||
std::vector<char> buf(maxchars); // Alloc enough size.
|
||||
while (ifs.peek() != -1)
|
||||
{
|
||||
ifs.getline(&buf[0], maxchars);
|
||||
|
||||
std::string linebuf(&buf[0]);
|
||||
|
||||
// Trim newline '\r\n' or '\r'
|
||||
if (linebuf.size() > 0)
|
||||
{
|
||||
if (linebuf[linebuf.size()-1] == '\n') linebuf.erase(linebuf.size()-1);
|
||||
}
|
||||
if (linebuf.size() > 0)
|
||||
{
|
||||
if (linebuf[linebuf.size()-1] == '\n') linebuf.erase(linebuf.size()-1);
|
||||
}
|
||||
|
||||
// Skip if empty line.
|
||||
if (linebuf.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip leading space.
|
||||
const char* token = linebuf.c_str();
|
||||
token += strspn(token, " \t");
|
||||
|
||||
assert(token);
|
||||
if (token[0] == '\0') continue; // empty line
|
||||
|
||||
if (token[0] == '#') continue; // comment line
|
||||
|
||||
// new mtl
|
||||
if ((0 == strncmp(token, "newmtl", 6)) && isSpace((token[6])))
|
||||
{
|
||||
// flush previous material.
|
||||
material_map.insert(std::pair<std::string, ObjLoader::material_t>(material.name, material));
|
||||
|
||||
// initial temporary material
|
||||
InitMaterial(material);
|
||||
|
||||
// set new mtl name
|
||||
char namebuf[4096];
|
||||
token += 7;
|
||||
sscanf(token, "%s", namebuf);
|
||||
material.name = namebuf;
|
||||
continue;
|
||||
}
|
||||
|
||||
// ambient
|
||||
if (token[0] == 'K' && token[1] == 'a' && isSpace((token[2])))
|
||||
{
|
||||
token += 2;
|
||||
float r, g, b;
|
||||
parseFloat3(r, g, b, token);
|
||||
material.ambient[0] = r;
|
||||
material.ambient[1] = g;
|
||||
material.ambient[2] = b;
|
||||
continue;
|
||||
}
|
||||
|
||||
// diffuse
|
||||
if (token[0] == 'K' && token[1] == 'd' && isSpace((token[2])))
|
||||
{
|
||||
token += 2;
|
||||
float r, g, b;
|
||||
parseFloat3(r, g, b, token);
|
||||
material.diffuse[0] = r;
|
||||
material.diffuse[1] = g;
|
||||
material.diffuse[2] = b;
|
||||
continue;
|
||||
}
|
||||
|
||||
// specular
|
||||
if (token[0] == 'K' && token[1] == 's' && isSpace((token[2])))
|
||||
{
|
||||
token += 2;
|
||||
float r, g, b;
|
||||
parseFloat3(r, g, b, token);
|
||||
material.specular[0] = r;
|
||||
material.specular[1] = g;
|
||||
material.specular[2] = b;
|
||||
continue;
|
||||
}
|
||||
|
||||
// transmittance
|
||||
if (token[0] == 'K' && token[1] == 't' && isSpace((token[2])))
|
||||
{
|
||||
token += 2;
|
||||
float r, g, b;
|
||||
parseFloat3(r, g, b, token);
|
||||
material.transmittance[0] = r;
|
||||
material.transmittance[1] = g;
|
||||
material.transmittance[2] = b;
|
||||
continue;
|
||||
}
|
||||
|
||||
// ior(index of refraction)
|
||||
if (token[0] == 'N' && token[1] == 'i' && isSpace((token[2])))
|
||||
{
|
||||
token += 2;
|
||||
material.ior = parseFloat(token);
|
||||
continue;
|
||||
}
|
||||
|
||||
// emission
|
||||
if(token[0] == 'K' && token[1] == 'e' && isSpace(token[2]))
|
||||
{
|
||||
token += 2;
|
||||
float r, g, b;
|
||||
parseFloat3(r, g, b, token);
|
||||
material.emission[0] = r;
|
||||
material.emission[1] = g;
|
||||
material.emission[2] = b;
|
||||
continue;
|
||||
}
|
||||
|
||||
// shininess
|
||||
if(token[0] == 'N' && token[1] == 's' && isSpace(token[2]))
|
||||
{
|
||||
token += 2;
|
||||
material.shininess = parseFloat(token);
|
||||
continue;
|
||||
}
|
||||
|
||||
// illum model
|
||||
if (0 == strncmp(token, "illum", 5) && isSpace(token[5]))
|
||||
{
|
||||
token += 6;
|
||||
material.illum = parseInt(token);
|
||||
continue;
|
||||
}
|
||||
|
||||
// dissolve
|
||||
if ((token[0] == 'd' && isSpace(token[1])))
|
||||
{
|
||||
token += 1;
|
||||
material.dissolve = parseFloat(token);
|
||||
continue;
|
||||
}
|
||||
if (token[0] == 'T' && token[1] == 'r' && isSpace(token[2]))
|
||||
{
|
||||
token += 2;
|
||||
material.dissolve = parseFloat(token);
|
||||
continue;
|
||||
}
|
||||
|
||||
// ambient texture
|
||||
if ((0 == strncmp(token, "map_Ka", 6)) && isSpace(token[6]))
|
||||
{
|
||||
token += 7;
|
||||
material.ambient_texname = trim(token);
|
||||
continue;
|
||||
}
|
||||
|
||||
// diffuse texture
|
||||
if ((0 == strncmp(token, "map_Kd", 6)) && isSpace(token[6]))
|
||||
{
|
||||
token += 7;
|
||||
material.diffuse_texname = trim(token);
|
||||
continue;
|
||||
}
|
||||
|
||||
// specular texture
|
||||
if ((0 == strncmp(token, "map_Ks", 6)) && isSpace(token[6]))
|
||||
{
|
||||
token += 7;
|
||||
material.specular_texname = trim(token);
|
||||
continue;
|
||||
}
|
||||
|
||||
// normal texture
|
||||
if ((0 == strncmp(token, "map_Ns", 6)) && isSpace(token[6]))
|
||||
{
|
||||
token += 7;
|
||||
material.normal_texname = trim(token);
|
||||
continue;
|
||||
}
|
||||
|
||||
// unknown parameter
|
||||
const char* _space = strchr(token, ' ');
|
||||
if(!_space)
|
||||
{
|
||||
_space = strchr(token, '\t');
|
||||
}
|
||||
if(_space)
|
||||
{
|
||||
auto len = _space - token;
|
||||
std::string key(token, len);
|
||||
std::string value = _space + 1;
|
||||
material.unknown_parameter.insert(std::pair<std::string, std::string>(key, value));
|
||||
}
|
||||
}
|
||||
// flush last material.
|
||||
material_map.insert(std::pair<std::string, ObjLoader::material_t>(material.name, material));
|
||||
return err.str();
|
||||
}
|
||||
|
||||
std::string ObjLoader::LoadObj(shapes_t& shapes, const char* filename, const char* mtl_basepath)
|
||||
{
|
||||
shapes.reset();
|
||||
|
||||
std::stringstream err;
|
||||
std::istringstream ifs(FileUtils::getInstance()->getStringFromFile(filename));
|
||||
std::map<vertex_index, ssize_t> vertexCache;
|
||||
//std::ifstream ifs(filename);
|
||||
|
||||
if (!ifs)
|
||||
{
|
||||
err << "Cannot open file [" << filename << "]" << std::endl;
|
||||
return err.str();
|
||||
}
|
||||
|
||||
std::vector<float> v;
|
||||
std::vector<float> vn;
|
||||
std::vector<float> vt;
|
||||
std::vector<std::vector<vertex_index> > faceGroup;
|
||||
std::string name;
|
||||
|
||||
// material
|
||||
std::map<std::string, material_t> material_map;
|
||||
material_t material;
|
||||
|
||||
int maxchars = 8192; // Alloc enough size.
|
||||
std::vector<char> buf(maxchars); // Alloc enough size.
|
||||
while (ifs.peek() != -1)
|
||||
{
|
||||
ifs.getline(&buf[0], maxchars);
|
||||
|
||||
std::string linebuf(&buf[0]);
|
||||
|
||||
// Trim newline '\r\n' or '\r'
|
||||
if (linebuf.size() > 0)
|
||||
{
|
||||
if (linebuf[linebuf.size()-1] == '\n') linebuf.erase(linebuf.size()-1);
|
||||
}
|
||||
if (linebuf.size() > 0)
|
||||
{
|
||||
if (linebuf[linebuf.size()-1] == '\n') linebuf.erase(linebuf.size()-1);
|
||||
}
|
||||
|
||||
// Skip if empty line.
|
||||
if (linebuf.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip leading space.
|
||||
const char* token = linebuf.c_str();
|
||||
token += strspn(token, " \t");
|
||||
|
||||
assert(token);
|
||||
if (token[0] == '\0') continue; // empty line
|
||||
|
||||
if (token[0] == '#') continue; // comment line
|
||||
|
||||
// vertex
|
||||
if (token[0] == 'v' && isSpace((token[1])))
|
||||
{
|
||||
token += 2;
|
||||
float x, y, z;
|
||||
parseFloat3(x, y, z, token);
|
||||
v.push_back(x);
|
||||
v.push_back(y);
|
||||
v.push_back(z);
|
||||
continue;
|
||||
}
|
||||
|
||||
// normal
|
||||
if (token[0] == 'v' && token[1] == 'n' && isSpace((token[2])))
|
||||
{
|
||||
token += 3;
|
||||
float x, y, z;
|
||||
parseFloat3(x, y, z, token);
|
||||
vn.push_back(x);
|
||||
vn.push_back(y);
|
||||
vn.push_back(z);
|
||||
continue;
|
||||
}
|
||||
|
||||
// texcoord
|
||||
if (token[0] == 'v' && token[1] == 't' && isSpace((token[2])))
|
||||
{
|
||||
token += 3;
|
||||
float x, y;
|
||||
parseFloat2(x, y, token);
|
||||
vt.push_back(x);
|
||||
vt.push_back(y);
|
||||
continue;
|
||||
}
|
||||
|
||||
// face
|
||||
if (token[0] == 'f' && isSpace((token[1])))
|
||||
{
|
||||
token += 2;
|
||||
token += strspn(token, " \t");
|
||||
|
||||
std::vector<vertex_index> face;
|
||||
while (!isNewLine(token[0])) {
|
||||
vertex_index vi = parseTriple(token, v.size() / 3, vn.size() / 3, vt.size() / 2);
|
||||
face.push_back(vi);
|
||||
auto n = strspn(token, " \t\r");
|
||||
token += n;
|
||||
}
|
||||
|
||||
faceGroup.push_back(face);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// use mtl
|
||||
if ((0 == strncmp(token, "usemtl", 6)) && isSpace((token[6])))
|
||||
{
|
||||
|
||||
char namebuf[4096];
|
||||
token += 7;
|
||||
sscanf(token, "%s", namebuf);
|
||||
|
||||
if (material_map.find(namebuf) != material_map.end())
|
||||
{
|
||||
material = material_map[namebuf];
|
||||
}
|
||||
else
|
||||
{
|
||||
// { error!! material not found }
|
||||
InitMaterial(material);
|
||||
}
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
// load mtl
|
||||
if ((0 == strncmp(token, "mtllib", 6)) && isSpace((token[6])))
|
||||
{
|
||||
char namebuf[4096];
|
||||
token += 7;
|
||||
sscanf(token, "%s", namebuf);
|
||||
|
||||
std::string err_mtl = LoadMtl(material_map, namebuf, mtl_basepath);
|
||||
if (!err_mtl.empty())
|
||||
{
|
||||
faceGroup.clear(); // for safety
|
||||
//return err_mtl;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// group name
|
||||
if (token[0] == 'g' && isSpace((token[1])))
|
||||
{
|
||||
// flush previous face group.
|
||||
shape_t shape;
|
||||
exportFaceGroupToShape(vertexCache, shapes, v, vn, vt, faceGroup, material, name);
|
||||
|
||||
faceGroup.clear();
|
||||
|
||||
std::vector<std::string> names;
|
||||
while (!isNewLine(token[0]))
|
||||
{
|
||||
std::string str = parseString(token);
|
||||
names.push_back(str);
|
||||
token += strspn(token, " \t\r"); // skip tag
|
||||
}
|
||||
|
||||
assert(names.size() > 0);
|
||||
|
||||
// names[0] must be 'g', so skipt 0th element.
|
||||
if (names.size() > 1)
|
||||
{
|
||||
name = names[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
name = "";
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// object name
|
||||
if (token[0] == 'o' && isSpace((token[1])))
|
||||
{
|
||||
// flush previous face group.
|
||||
shape_t shape;
|
||||
exportFaceGroupToShape(vertexCache, shapes, v, vn, vt, faceGroup, material, name);
|
||||
|
||||
faceGroup.clear();
|
||||
|
||||
// @todo { multiple object name? }
|
||||
char namebuf[4096];
|
||||
token += 2;
|
||||
sscanf(token, "%s", namebuf);
|
||||
name = std::string(namebuf);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore unknown command.
|
||||
}
|
||||
|
||||
shape_t shape;
|
||||
exportFaceGroupToShape(vertexCache, shapes, v, vn, vt, faceGroup, material, name);
|
||||
faceGroup.clear(); // for safety
|
||||
|
||||
return err.str();
|
||||
}
|
||||
|
||||
NS_CC_END
|
|
@ -0,0 +1,87 @@
|
|||
//
|
||||
// Copyright 2012-2013, Syoyo Fujita.
|
||||
//
|
||||
// Licensed under 2-clause BSD liecense.
|
||||
//
|
||||
// copied from Syoyo Fujita
|
||||
// https://github.com/syoyo/tinyobjloader
|
||||
|
||||
#ifndef __CCOBJLOADER_H__
|
||||
#define __CCOBJLOADER_H__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include "base/ccTypes.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class ObjLoader
|
||||
{
|
||||
public:
|
||||
typedef struct
|
||||
{
|
||||
std::string name;
|
||||
|
||||
float ambient[3];
|
||||
float diffuse[3];
|
||||
float specular[3];
|
||||
float transmittance[3];
|
||||
float emission[3];
|
||||
float shininess;
|
||||
float ior; // index of refraction
|
||||
float dissolve; // 1 == opaque; 0 == fully transparent
|
||||
// illumination model (see http://www.fileformat.info/format/material/)
|
||||
int illum;
|
||||
|
||||
std::string ambient_texname;
|
||||
std::string diffuse_texname;
|
||||
std::string specular_texname;
|
||||
std::string normal_texname;
|
||||
std::map<std::string, std::string> unknown_parameter;
|
||||
} material_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
std::vector<unsigned short> indices;
|
||||
} mesh_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
std::string name;
|
||||
material_t material;
|
||||
mesh_t mesh;
|
||||
} shape_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
std::vector<float> positions;
|
||||
std::vector<float> normals;
|
||||
std::vector<float> texcoords;
|
||||
|
||||
std::vector<shape_t> shapes;
|
||||
|
||||
void reset()
|
||||
{
|
||||
positions.clear();
|
||||
normals.clear();
|
||||
texcoords.clear();
|
||||
shapes.clear();
|
||||
}
|
||||
}shapes_t;
|
||||
|
||||
/// Loads .obj from a file.
|
||||
/// 'shapes' will be filled with parsed shape data
|
||||
/// The function returns error string.
|
||||
/// Returns empty string when loading .obj success.
|
||||
/// 'mtl_basepath' is optional, and used for base path for .mtl file.
|
||||
static std::string LoadObj(
|
||||
shapes_t& shapes, // [output]
|
||||
const char* filename,
|
||||
const char* mtl_basepath = NULL);
|
||||
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // _TINY_OBJ_LOADER_H
|
|
@ -0,0 +1,271 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 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 "3d/CCSprite3D.h"
|
||||
#include "3d/CCSprite3DDataCache.h"
|
||||
#include "3d/CCMesh.h"
|
||||
#include "3d/CCObjLoader.h"
|
||||
|
||||
#include "base/CCDirector.h"
|
||||
#include "base/CCPlatformMacros.h"
|
||||
#include "base/ccMacros.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "renderer/CCTextureCache.h"
|
||||
#include "renderer/CCRenderer.h"
|
||||
#include "renderer/CCGLProgramState.h"
|
||||
#include "renderer/CCGLProgramCache.h"
|
||||
|
||||
#include "deprecated/CCString.h" // For StringUtils::format
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
std::string s_attributeNames[] = {GLProgram::ATTRIBUTE_NAME_POSITION, GLProgram::ATTRIBUTE_NAME_COLOR, GLProgram::ATTRIBUTE_NAME_TEX_COORD, GLProgram::ATTRIBUTE_NAME_NORMAL};
|
||||
|
||||
Sprite3D* Sprite3D::create(const std::string &modelPath)
|
||||
{
|
||||
if (modelPath.length() < 4)
|
||||
CCASSERT(false, "improper name specified when creating Sprite3D");
|
||||
|
||||
auto sprite = new Sprite3D();
|
||||
if (sprite && sprite->initWithFile(modelPath))
|
||||
{
|
||||
sprite->autorelease();
|
||||
return sprite;
|
||||
}
|
||||
CC_SAFE_DELETE(sprite);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Sprite3D* Sprite3D::create(const std::string &modelPath, const std::string &texturePath)
|
||||
{
|
||||
auto sprite = create(modelPath);
|
||||
if (sprite)
|
||||
{
|
||||
sprite->setTexture(texturePath);
|
||||
}
|
||||
|
||||
return sprite;
|
||||
}
|
||||
|
||||
// Sprite3D* Sprite3D::create(Mesh* mesh, const std::string& texturePath)
|
||||
// {
|
||||
// CCASSERT(nullptr != mesh, "Could not create a Sprite3D from a null Mesh");
|
||||
// auto sprite = new Sprite3D();
|
||||
// if(sprite)
|
||||
// {
|
||||
// sprite->_mesh = mesh;
|
||||
// sprite->_mesh->retain();
|
||||
// sprite->setTexture(texturePath);
|
||||
// sprite->autorelease();
|
||||
// return sprite;
|
||||
// }
|
||||
// CC_SAFE_DELETE(sprite);
|
||||
// return nullptr;
|
||||
// }
|
||||
|
||||
//.mtl file should at the same directory with the same name if exist
|
||||
bool Sprite3D::loadFromObj(const std::string& path)
|
||||
{
|
||||
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(path);
|
||||
|
||||
//.mtl file directory
|
||||
std::string dir = "";
|
||||
auto last = fullPath.rfind("/");
|
||||
if (last != -1)
|
||||
dir = fullPath.substr(0, last + 1);
|
||||
|
||||
ObjLoader::shapes_t shapes;
|
||||
std::string errstr = ObjLoader::LoadObj(shapes, fullPath.c_str(), dir.c_str());
|
||||
if (!errstr.empty())
|
||||
return false;
|
||||
|
||||
//convert to mesh and material
|
||||
std::vector<unsigned short> indices;
|
||||
std::vector<std::string> matnames;
|
||||
std::string texname;
|
||||
for (auto it = shapes.shapes.begin(); it != shapes.shapes.end(); it++)
|
||||
{
|
||||
indices.insert(indices.end(), (*it).mesh.indices.begin(),(*it).mesh.indices.end());
|
||||
//indices.push_back((*it).mesh.indices);
|
||||
if (texname.empty())
|
||||
texname = (*it).material.diffuse_texname;
|
||||
else if (texname != (*it).material.diffuse_texname)
|
||||
{
|
||||
CCLOGWARN("cocos2d:WARNING: more than one texture in %s", path.c_str());
|
||||
}
|
||||
|
||||
matnames.push_back(dir + (*it).material.diffuse_texname);
|
||||
}
|
||||
_mesh = Mesh::create(shapes.positions, shapes.normals, shapes.texcoords, indices);
|
||||
|
||||
_mesh->retain();
|
||||
if (_mesh == nullptr)
|
||||
return false;
|
||||
|
||||
if (matnames.size())
|
||||
{
|
||||
setTexture(matnames[0]);
|
||||
}
|
||||
genGLProgramState();
|
||||
|
||||
//add to cache
|
||||
Sprite3DDataCache::getInstance()->addSprite3D(fullPath, _mesh, matnames.size() > 0 ? matnames[0] : "");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Sprite3D::Sprite3D()
|
||||
: _mesh(nullptr)
|
||||
, _texture(nullptr)
|
||||
, _blend(BlendFunc::ALPHA_NON_PREMULTIPLIED)
|
||||
{
|
||||
}
|
||||
|
||||
Sprite3D::~Sprite3D()
|
||||
{
|
||||
CC_SAFE_RELEASE_NULL(_texture);
|
||||
CC_SAFE_RELEASE_NULL(_mesh);
|
||||
}
|
||||
|
||||
bool Sprite3D::initWithFile(const std::string &path)
|
||||
{
|
||||
CC_SAFE_RELEASE_NULL(_mesh);
|
||||
|
||||
CC_SAFE_RELEASE_NULL(_texture);
|
||||
|
||||
//find from the cache
|
||||
Mesh* mesh = Sprite3DDataCache::getInstance()->getSprite3DMesh(path);
|
||||
if (mesh)
|
||||
{
|
||||
_mesh = mesh;
|
||||
_mesh->retain();
|
||||
|
||||
auto tex = Sprite3DDataCache::getInstance()->getSprite3DTexture(path);
|
||||
setTexture(tex);
|
||||
|
||||
genGLProgramState();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//load from file
|
||||
std::string ext = path.substr(path.length() - 4, 4);
|
||||
if (ext != ".obj" || !loadFromObj(path))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void Sprite3D::genGLProgramState()
|
||||
{
|
||||
auto programstate = GLProgramState::getOrCreateWithGLProgram(getDefaultGLProgram(_mesh->hasVertexAttrib(GLProgram::VERTEX_ATTRIB_TEX_COORD)));
|
||||
long offset = 0;
|
||||
auto attributeCount = _mesh->getMeshVertexAttribCount();
|
||||
for (auto k = 0; k < attributeCount; k++) {
|
||||
auto meshattribute = _mesh->getMeshVertexAttribute(k);
|
||||
programstate->setVertexAttribPointer(s_attributeNames[meshattribute.vertexAttrib],
|
||||
meshattribute.size,
|
||||
meshattribute.type,
|
||||
GL_FALSE,
|
||||
_mesh->getVertexSizeInBytes(),
|
||||
(GLvoid*)offset);
|
||||
offset += meshattribute.attribSizeBytes;
|
||||
}
|
||||
|
||||
setGLProgramState(programstate);
|
||||
}
|
||||
|
||||
GLProgram* Sprite3D::getDefaultGLProgram(bool textured)
|
||||
{
|
||||
if(textured)
|
||||
{
|
||||
return GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_3D_POSITION_TEXTURE);
|
||||
}
|
||||
else
|
||||
{
|
||||
return GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_3D_POSITION);
|
||||
}
|
||||
}
|
||||
|
||||
void Sprite3D::setTexture(const std::string& texFile)
|
||||
{
|
||||
auto tex = Director::getInstance()->getTextureCache()->addImage(texFile);
|
||||
if( tex && _texture != tex ) {
|
||||
CC_SAFE_RETAIN(tex);
|
||||
CC_SAFE_RELEASE_NULL(_texture);
|
||||
_texture = tex;
|
||||
}
|
||||
}
|
||||
|
||||
void Sprite3D::setTexture(Texture2D* texture)
|
||||
{
|
||||
if(_texture != texture) {
|
||||
CC_SAFE_RETAIN(texture);
|
||||
CC_SAFE_RELEASE_NULL(_texture);
|
||||
_texture = texture;
|
||||
}
|
||||
}
|
||||
|
||||
void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, bool transformUpdated)
|
||||
{
|
||||
GLProgramState* programstate = getGLProgramState();
|
||||
Color4F color(getDisplayedColor());
|
||||
color.a = getDisplayedOpacity() / 255.0f;
|
||||
|
||||
GLuint textureID = _texture ? _texture->getName() : 0;
|
||||
_meshCommand.init(_globalZOrder,
|
||||
textureID,
|
||||
programstate,
|
||||
_blend,
|
||||
_mesh->getVertexBuffer(),
|
||||
_mesh->getIndexBuffer(),
|
||||
(GLenum)_mesh->getPrimitiveType(),
|
||||
(GLenum)_mesh->getIndexFormat(),
|
||||
_mesh->getIndexCount(),
|
||||
transform);
|
||||
|
||||
_meshCommand.setCullFaceEnabled(true);
|
||||
_meshCommand.setDepthTestEnabled(true);
|
||||
//support tint and fade
|
||||
_meshCommand.setDisplayColor(Vec4(color.r, color.g, color.b, color.a));
|
||||
Director::getInstance()->getRenderer()->addCommand(&_meshCommand);
|
||||
}
|
||||
|
||||
void Sprite3D::setBlendFunc(const BlendFunc &blendFunc)
|
||||
{
|
||||
if(_blend.src != blendFunc.src || _blend.dst != blendFunc.dst)
|
||||
{
|
||||
_blend = blendFunc;
|
||||
}
|
||||
}
|
||||
|
||||
const BlendFunc& Sprite3D::getBlendFunc() const
|
||||
{
|
||||
return _blend;
|
||||
}
|
||||
|
||||
NS_CC_END
|
|
@ -0,0 +1,85 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 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 __CCSPRITE3D_H__
|
||||
#define __CCSPRITE3D_H__
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "base/CCVector.h"
|
||||
#include "base/ccTypes.h"
|
||||
#include "base/CCProtocols.h"
|
||||
#include "2d/CCNode.h"
|
||||
#include "renderer/CCMeshCommand.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class GLProgramState;
|
||||
class Mesh;
|
||||
class Texture2D;
|
||||
|
||||
/** Sprite3D: TODO add description */
|
||||
class Sprite3D : public Node, public BlendProtocol
|
||||
{
|
||||
public:
|
||||
/// creates a Sprite3D
|
||||
static Sprite3D* create(const std::string &modelPath);
|
||||
|
||||
// creates a Sprite3D. It only supports one texture, and overrides the internal texture with 'texturePath'
|
||||
static Sprite3D* create(const std::string &modelPath, const std::string &texturePath);
|
||||
|
||||
//set texture
|
||||
void setTexture(const std::string& texFile);
|
||||
void setTexture(Texture2D* texture);
|
||||
|
||||
Mesh* getMesh() const { return _mesh; }
|
||||
|
||||
// overrides
|
||||
virtual void setBlendFunc(const BlendFunc &blendFunc) override;
|
||||
virtual const BlendFunc &getBlendFunc() const override;
|
||||
|
||||
protected:
|
||||
Sprite3D();
|
||||
virtual ~Sprite3D();
|
||||
bool initWithFile(const std::string &path);
|
||||
|
||||
//.mtl file should at the same directory with the same name if exist
|
||||
bool loadFromObj(const std::string& path);
|
||||
|
||||
virtual void draw(Renderer *renderer, const Mat4 &transform, bool transformUpdated) override;
|
||||
|
||||
virtual GLProgram* getDefaultGLProgram(bool textured = true);
|
||||
|
||||
void genGLProgramState();
|
||||
|
||||
Mesh *_mesh;
|
||||
MeshCommand _meshCommand;
|
||||
Texture2D* _texture;
|
||||
BlendFunc _blend;
|
||||
};
|
||||
|
||||
extern std::string s_attributeNames[];
|
||||
|
||||
NS_CC_END
|
||||
#endif // __SPRITE3D_H_
|
|
@ -0,0 +1,145 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 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 "3d/CCSprite3DDataCache.h"
|
||||
|
||||
#include "3d/CCMesh.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "renderer/CCTextureCache.h"
|
||||
#include "base/CCEventCustom.h"
|
||||
#include "base/CCEventListenerCustom.h"
|
||||
#include "base/CCEventDispatcher.h"
|
||||
#include "base/CCEventType.h"
|
||||
#include "base/CCDirector.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
Sprite3DDataCache* Sprite3DDataCache::_cacheInstance = nullptr;
|
||||
|
||||
Sprite3DDataCache::Sprite3DDataCache()
|
||||
{
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
// listen the event when app go to foreground
|
||||
_backToForegroundlistener = EventListenerCustom::create(EVENT_COME_TO_FOREGROUND, CC_CALLBACK_1(Sprite3DDataCache::listenBackToForeground, this));
|
||||
Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundlistener, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
Sprite3DDataCache::~Sprite3DDataCache()
|
||||
{
|
||||
removeAllSprite3DData();
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
Director::getInstance()->getEventDispatcher()->removeEventListener(_backToForegroundlistener);
|
||||
#endif
|
||||
}
|
||||
|
||||
Sprite3DDataCache* Sprite3DDataCache::getInstance()
|
||||
{
|
||||
if (! _cacheInstance)
|
||||
{
|
||||
_cacheInstance = new Sprite3DDataCache();
|
||||
}
|
||||
|
||||
return _cacheInstance;
|
||||
}
|
||||
|
||||
void Sprite3DDataCache::purgeMeshCache()
|
||||
{
|
||||
if (_cacheInstance)
|
||||
{
|
||||
CC_SAFE_DELETE(_cacheInstance);
|
||||
}
|
||||
}
|
||||
|
||||
bool Sprite3DDataCache::addSprite3D(const std::string& fileName, Mesh* mesh, const std::string& texture)
|
||||
{
|
||||
const std::string fullPath = FileUtils::getInstance()->fullPathForFilename(fileName);
|
||||
auto itr = _sprite3DDatas.find(fullPath);
|
||||
if (itr == _sprite3DDatas.end())
|
||||
{
|
||||
Sprite3DData data;
|
||||
data.mesh = mesh;
|
||||
CC_SAFE_RETAIN(mesh);
|
||||
data.texture = texture;
|
||||
_sprite3DDatas[fullPath] = data;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Mesh* Sprite3DDataCache::getSprite3DMesh(const std::string& fileName)
|
||||
{
|
||||
const std::string fullPath = FileUtils::getInstance()->fullPathForFilename(fileName);
|
||||
auto itr = _sprite3DDatas.find(fullPath);
|
||||
if (itr != _sprite3DDatas.end())
|
||||
return itr->second.mesh;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Texture2D* Sprite3DDataCache::getSprite3DTexture(const std::string& fileName)
|
||||
{
|
||||
const std::string fullPath = FileUtils::getInstance()->fullPathForFilename(fileName);
|
||||
auto itr = _sprite3DDatas.find(fullPath);
|
||||
if (itr != _sprite3DDatas.end())
|
||||
{
|
||||
auto cache = Director::getInstance()->getTextureCache();
|
||||
return cache->addImage(itr->second.texture);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Sprite3DDataCache::removeAllSprite3DData()
|
||||
{
|
||||
for (auto itr = _sprite3DDatas.begin(); itr != _sprite3DDatas.end(); itr++) {
|
||||
CC_SAFE_RELEASE_NULL(itr->second.mesh);
|
||||
}
|
||||
_sprite3DDatas.clear();
|
||||
}
|
||||
void Sprite3DDataCache::removeUnusedSprite3DData()
|
||||
{
|
||||
for( auto it=_sprite3DDatas.cbegin(); it!=_sprite3DDatas.cend(); /* nothing */) {
|
||||
auto value = it->second;
|
||||
if( value.mesh->getReferenceCount() == 1 ) {
|
||||
CCLOG("cocos2d: GLProgramStateCache: removing unused GLProgramState");
|
||||
|
||||
value.mesh->release();
|
||||
_sprite3DDatas.erase(it++);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
void Sprite3DDataCache::listenBackToForeground(EventCustom* event)
|
||||
{
|
||||
for (auto iter = _sprite3DDatas.begin(); iter != _sprite3DDatas.end(); ++iter)
|
||||
{
|
||||
auto mesh = iter->second.mesh;
|
||||
mesh->restore();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_CC_END
|
|
@ -0,0 +1,83 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 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 __CCSPRIT3DDATA_CACHE_H__
|
||||
#define __CCSPRIT3DDATA_CACHE_H__
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include "base/ccTypes.h"
|
||||
#include "base/CCMap.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class Sprite3D;
|
||||
class Mesh;
|
||||
class EventListenerCustom;
|
||||
class EventCustom;
|
||||
class Texture2D;
|
||||
|
||||
class Sprite3DDataCache
|
||||
{
|
||||
public:
|
||||
struct Sprite3DData
|
||||
{
|
||||
Mesh* mesh;
|
||||
std::string texture;
|
||||
};
|
||||
|
||||
static Sprite3DDataCache* getInstance();
|
||||
static void purgeMeshCache();
|
||||
|
||||
bool addSprite3D(const std::string& fileName, Mesh* mesh, const std::string& texture);
|
||||
|
||||
Mesh* getSprite3DMesh(const std::string& fileName);
|
||||
|
||||
Texture2D* getSprite3DTexture(const std::string& fileName);
|
||||
|
||||
void removeAllSprite3DData();
|
||||
void removeUnusedSprite3DData();
|
||||
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
void listenBackToForeground(EventCustom* event);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
Sprite3DDataCache();
|
||||
|
||||
~Sprite3DDataCache();
|
||||
|
||||
static Sprite3DDataCache* _cacheInstance;
|
||||
|
||||
std::unordered_map<std::string, Sprite3DData> _sprite3DDatas; //sprites
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
EventListenerCustom* _backToForegroundlistener;
|
||||
#endif
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __CCSPRIT3DDATA_CACHE_H__
|
|
@ -0,0 +1,7 @@
|
|||
set(COCOS_3D_SRC
|
||||
3d/CCMesh.cpp
|
||||
3d/CCObjLoader.cpp
|
||||
3d/CCSprite3D.cpp
|
||||
3d/CCSprite3DDataCache.cpp
|
||||
)
|
||||
|
|
@ -71,6 +71,10 @@ cocos2d.cpp \
|
|||
2d/CCTransitionPageTurn.cpp \
|
||||
2d/CCTransitionProgress.cpp \
|
||||
2d/CCTweenFunction.cpp \
|
||||
3d/CCMesh.cpp \
|
||||
3d/CCSprite3DDataCache.cpp \
|
||||
3d/CCObjLoader.cpp \
|
||||
3d/CCSprite3D.cpp \
|
||||
platform/CCGLViewProtocol.cpp \
|
||||
platform/CCFileUtils.cpp \
|
||||
platform/CCSAXParser.cpp \
|
||||
|
@ -136,6 +140,7 @@ renderer/CCGLProgramState.cpp \
|
|||
renderer/CCGLProgramStateCache.cpp \
|
||||
renderer/CCGroupCommand.cpp \
|
||||
renderer/CCQuadCommand.cpp \
|
||||
renderer/CCMeshCommand.cpp \
|
||||
renderer/CCRenderCommand.cpp \
|
||||
renderer/CCRenderer.cpp \
|
||||
renderer/CCTexture2D.cpp \
|
||||
|
|
|
@ -8,6 +8,7 @@ set(COCOS_SRC
|
|||
)
|
||||
|
||||
include(2d/CMakeLists.txt)
|
||||
include(3d/CMakeLists.txt)
|
||||
include(platform/CMakeLists.txt)
|
||||
include(physics/CMakeLists.txt)
|
||||
include(math/CMakeLists.txt)
|
||||
|
@ -21,6 +22,7 @@ include(storage/CMakeLists.txt)
|
|||
add_library(cocos2d STATIC
|
||||
${COCOS_SRC}
|
||||
${COCOS_2D_SRC}
|
||||
${COCOS_3D_SRC}
|
||||
${COCOS_PLATFORM_SRC}
|
||||
${COCOS_BASE_SRC}
|
||||
${COCOS_RENDERER_SRC}
|
||||
|
|
|
@ -257,6 +257,10 @@ THE SOFTWARE.
|
|||
#include "2d/CCComponent.h"
|
||||
#include "2d/CCComponentContainer.h"
|
||||
|
||||
//3d
|
||||
#include "3d/CCSprite3D.h"
|
||||
#include "3d/CCMesh.h"
|
||||
|
||||
// Audio
|
||||
#include "audio/include/SimpleAudioEngine.h"
|
||||
|
||||
|
|
|
@ -771,7 +771,6 @@ CC_DEPRECATED_ATTRIBUTE typedef GLView CCEGLView;
|
|||
CC_DEPRECATED_ATTRIBUTE typedef Component CCComponent;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef AffineTransform CCAffineTransform;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef Vec2 CCPoint;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef Vec2 Point;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef Size CCSize;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef Rect CCRect;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef Color3B ccColor3B;
|
||||
|
|
|
@ -743,7 +743,7 @@ public:
|
|||
*/
|
||||
inline const Vec2 operator*(float x, const Vec2& v);
|
||||
|
||||
typedef Vec2 Point2;
|
||||
typedef Vec2 Point;
|
||||
|
||||
NS_CC_MATH_END
|
||||
|
||||
|
|
|
@ -467,7 +467,7 @@ public:
|
|||
*/
|
||||
inline const Vec3 operator*(float x, const Vec3& v);
|
||||
|
||||
typedef Vec3 Point3;
|
||||
//typedef Vec3 Point3;
|
||||
|
||||
NS_CC_MATH_END
|
||||
|
||||
|
|
|
@ -526,18 +526,20 @@ void PhysicsWorld::updateBodies()
|
|||
return;
|
||||
}
|
||||
|
||||
for (auto& body : _delayAddBodies)
|
||||
// issue #4944, contact callback will be invoked when add/remove body, _delayAddBodies maybe changed, so we need make a copy.
|
||||
auto addCopy = _delayAddBodies;
|
||||
_delayAddBodies.clear();
|
||||
for (auto& body : addCopy)
|
||||
{
|
||||
doAddBody(body);
|
||||
}
|
||||
|
||||
for (auto& body : _delayRemoveBodies)
|
||||
auto removeCopy = _delayRemoveBodies;
|
||||
_delayRemoveBodies.clear();
|
||||
for (auto& body : removeCopy)
|
||||
{
|
||||
doRemoveBody(body);
|
||||
}
|
||||
|
||||
_delayAddBodies.clear();
|
||||
_delayRemoveBodies.clear();
|
||||
}
|
||||
|
||||
void PhysicsWorld::removeBody(int tag)
|
||||
|
@ -668,12 +670,16 @@ void PhysicsWorld::updateJoints()
|
|||
return;
|
||||
}
|
||||
|
||||
for (auto joint : _delayAddJoints)
|
||||
auto addCopy = _delayAddJoints;
|
||||
_delayAddJoints.clear();
|
||||
for (auto joint : addCopy)
|
||||
{
|
||||
doAddJoint(joint);
|
||||
}
|
||||
|
||||
for (auto joint : _delayRemoveJoints)
|
||||
auto removeCopy = _delayRemoveJoints;
|
||||
_delayRemoveJoints.clear();
|
||||
for (auto joint : removeCopy)
|
||||
{
|
||||
doRemoveJoint(joint);
|
||||
|
||||
|
@ -682,9 +688,6 @@ void PhysicsWorld::updateJoints()
|
|||
delete joint;
|
||||
}
|
||||
}
|
||||
|
||||
_delayAddJoints.clear();
|
||||
_delayRemoveJoints.clear();
|
||||
}
|
||||
|
||||
void PhysicsWorld::removeShape(PhysicsShape* shape)
|
||||
|
@ -878,7 +881,7 @@ void PhysicsWorld::setGravity(const Vect& gravity)
|
|||
|
||||
void PhysicsWorld::update(float delta)
|
||||
{
|
||||
if (_delayDirty)
|
||||
while (_delayDirty)
|
||||
{
|
||||
// the updateJoints must run before the updateBodies.
|
||||
updateJoints();
|
||||
|
|
|
@ -30,7 +30,7 @@ THE SOFTWARE.
|
|||
#include "base/ccMacros.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include "base/CCTouch.h"
|
||||
#include "2d/CCIMEDispatcher.h"
|
||||
#include "base/CCIMEDispatcher.h"
|
||||
#include "CCApplication.h"
|
||||
#include "CCWinRTUtils.h"
|
||||
|
||||
|
|
|
@ -39,9 +39,10 @@ using namespace PhoneDirect3DXamlAppComponent;
|
|||
|
||||
USING_NS_CC;
|
||||
|
||||
Cocos2dRenderer::Cocos2dRenderer(): mInitialized(false), m_loadingComplete(false), m_delegate(nullptr), m_messageBoxDelegate(nullptr)
|
||||
Cocos2dRenderer::Cocos2dRenderer(Windows::Graphics::Display::DisplayOrientations orientation): mInitialized(false), m_loadingComplete(false), m_delegate(nullptr), m_messageBoxDelegate(nullptr)
|
||||
{
|
||||
mApp = new AppDelegate();
|
||||
m_orientation = orientation;
|
||||
}
|
||||
|
||||
// Creates and restores Cocos2d-x after DirectX and Angle contexts are created or updated
|
||||
|
@ -53,7 +54,7 @@ void Cocos2dRenderer::CreateGLResources()
|
|||
{
|
||||
mInitialized = true;
|
||||
GLView* glview = GLView::create("Test Cpp");
|
||||
glview->Create(m_eglDisplay, m_eglContext, m_eglSurface, m_renderTargetSize.Width, m_renderTargetSize.Height);
|
||||
glview->Create(m_eglDisplay, m_eglContext, m_eglSurface, m_renderTargetSize.Width, m_renderTargetSize.Height,m_orientation);
|
||||
director->setOpenGLView(glview);
|
||||
CCApplication::getInstance()->run();
|
||||
glview->SetXamlEventDelegate(m_delegate);
|
||||
|
|
|
@ -32,7 +32,7 @@ class AppDelegate;
|
|||
ref class Cocos2dRenderer sealed : public DirectXBase
|
||||
{
|
||||
public:
|
||||
Cocos2dRenderer();
|
||||
Cocos2dRenderer(Windows::Graphics::Display::DisplayOrientations orientation);
|
||||
|
||||
// Direct3DBase methods.
|
||||
virtual void OnOrientationChanged(Windows::Graphics::Display::DisplayOrientations orientation) override;
|
||||
|
@ -64,4 +64,5 @@ private:
|
|||
|
||||
// The AppDelegate for the Cocos2D app
|
||||
AppDelegate* mApp;
|
||||
Windows::Graphics::Display::DisplayOrientations m_orientation;
|
||||
};
|
||||
|
|
|
@ -40,10 +40,10 @@ using namespace PhoneDirect3DXamlAppComponent;
|
|||
namespace PhoneDirect3DXamlAppComponent
|
||||
{
|
||||
|
||||
Direct3DInterop::Direct3DInterop()
|
||||
: mCurrentOrientation(DisplayOrientations::Portrait), m_delegate(nullptr)
|
||||
Direct3DInterop::Direct3DInterop(Windows::Graphics::Display::DisplayOrientations orientation)
|
||||
: mCurrentOrientation(orientation), m_delegate(nullptr)
|
||||
{
|
||||
m_renderer = ref new Cocos2dRenderer();
|
||||
m_renderer = ref new Cocos2dRenderer(mCurrentOrientation);
|
||||
}
|
||||
|
||||
IDrawingSurfaceBackgroundContentProvider^ Direct3DInterop::CreateContentProvider()
|
||||
|
|
|
@ -43,7 +43,7 @@ public delegate void RequestAdditionalFrameHandler();
|
|||
public ref class Direct3DInterop sealed : public Windows::Phone::Input::Interop::IDrawingSurfaceManipulationHandler
|
||||
{
|
||||
public:
|
||||
Direct3DInterop();
|
||||
Direct3DInterop(Windows::Graphics::Display::DisplayOrientations orientation);
|
||||
|
||||
Windows::Phone::Graphics::Interop::IDrawingSurfaceBackgroundContentProvider^ CreateContentProvider();
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ using Microsoft.Phone.Shell;
|
|||
using Windows.UI.Input;
|
||||
using System.Windows.Threading;
|
||||
using Microsoft.Phone.Info;
|
||||
using Windows.Graphics.Display;
|
||||
|
||||
namespace PhoneDirect3DXamlAppInterop
|
||||
{
|
||||
|
@ -53,7 +54,30 @@ namespace PhoneDirect3DXamlAppInterop
|
|||
{
|
||||
if (m_d3dInterop == null)
|
||||
{
|
||||
m_d3dInterop = new Direct3DInterop();
|
||||
PageOrientation pageOrientation = (PageOrientation)GetValue(OrientationProperty);
|
||||
DisplayOrientations displayOrientation;
|
||||
|
||||
switch(pageOrientation)
|
||||
{
|
||||
case PageOrientation.Portrait:
|
||||
case PageOrientation.PortraitUp:
|
||||
displayOrientation = DisplayOrientations.Portrait;
|
||||
break;
|
||||
case PageOrientation.PortraitDown:
|
||||
displayOrientation = DisplayOrientations.PortraitFlipped;
|
||||
break;
|
||||
case PageOrientation.Landscape:
|
||||
case PageOrientation.LandscapeLeft:
|
||||
displayOrientation = DisplayOrientations.Landscape;
|
||||
break;
|
||||
case PageOrientation.LandscapeRight:
|
||||
displayOrientation = DisplayOrientations.LandscapeFlipped;
|
||||
break;
|
||||
default:
|
||||
displayOrientation = DisplayOrientations.Landscape;
|
||||
break;
|
||||
}
|
||||
m_d3dInterop = new Direct3DInterop(displayOrientation);
|
||||
|
||||
// Set WindowBounds to size of DrawingSurface
|
||||
m_d3dInterop.WindowBounds = new Windows.Foundation.Size(
|
||||
|
|
|
@ -89,7 +89,6 @@ GLView::GLView()
|
|||
{
|
||||
s_pEglView = this;
|
||||
_viewName = "cocos2dx";
|
||||
UpdateOrientationMatrix();
|
||||
}
|
||||
|
||||
GLView::~GLView()
|
||||
|
@ -114,8 +113,9 @@ bool GLView::initWithFullScreen(const std::string& viewName)
|
|||
}
|
||||
|
||||
|
||||
bool GLView::Create(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface, float width, float height)
|
||||
bool GLView::Create(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface, float width, float height, DisplayOrientations orientation)
|
||||
{
|
||||
m_orientation = orientation;
|
||||
m_eglDisplay = eglDisplay;
|
||||
m_eglContext = eglContext;
|
||||
m_eglSurface = eglSurface;
|
||||
|
|
|
@ -71,7 +71,8 @@ public:
|
|||
void HideKeyboard(Windows::Foundation::Rect r);
|
||||
|
||||
// WP8 XAML app
|
||||
virtual bool Create(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface, float width, float height);
|
||||
virtual bool Create(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface, float width, float height
|
||||
,Windows::Graphics::Display::DisplayOrientations orientation);
|
||||
virtual void UpdateDevice(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface);
|
||||
|
||||
void OnPointerPressed(Windows::UI::Core::PointerEventArgs^ args);
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
#include <wrl/client.h>
|
||||
// XXX: For some reason, this file must not be compiled
|
||||
// XXX: Ask MS why
|
||||
#if 0
|
||||
|
||||
#include <wrl/client.h>
|
||||
#include <d3d11_1.h>
|
||||
#include "DirectXBase.h"
|
||||
|
||||
|
@ -275,4 +279,6 @@ void DirectXBase::SetDpi(float dpi)
|
|||
// will not change, and the window resize code will only be executed once.
|
||||
UpdateForWindowSizeChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif //0
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
#pragma once
|
||||
// XXX: For some reason, this file must not be compiled
|
||||
// XXX: Ask MS why
|
||||
#if 0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DirectXHelper.h"
|
||||
#include <wrl/client.h>
|
||||
|
@ -37,4 +41,6 @@ protected private:
|
|||
Platform::Agile<Windows::UI::Core::CoreWindow> m_window;
|
||||
float m_dpi;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
#endif // 0
|
|
@ -0,0 +1 @@
|
|||
#include "pch.h"
|
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#include "cocos2d.h"
|
|
@ -2777,6 +2777,719 @@ const unsigned char s_7B67DD242152D35ACC079265FAD9D03DC98182DE[] = {
|
|||
111, 110, 0, 171, 171, 171,
|
||||
};
|
||||
|
||||
const unsigned char s_7CE5EE84ACB6110F7FA29152ECE3344CB6D6620D[] = {
|
||||
|
||||
166, 147, 0, 0, 142, 9, 2, 1,
|
||||
0, 128, 0, 0, 82, 139, 0, 0,
|
||||
10, 0, 0, 0, 97, 95, 112, 111,
|
||||
115, 105, 116, 105, 111, 110, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 255, 255, 255, 255, 80, 139,
|
||||
0, 0, 10, 0, 0, 0, 97, 95,
|
||||
116, 101, 120, 67, 111, 111, 114, 100,
|
||||
1, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 255, 255, 255, 255,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
255, 255, 255, 255, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 255, 255, 255, 255,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
255, 255, 255, 255, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 255, 255, 255, 255,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
255, 255, 255, 255, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 255, 255, 255, 255,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
255, 255, 255, 255, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 255, 255, 255, 255,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
255, 255, 255, 255, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 255, 255, 255, 255,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
255, 255, 255, 255, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 255, 255, 255, 255,
|
||||
1, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 1, 0, 0, 0,
|
||||
0, 3, 0, 0, 0, 92, 139, 0,
|
||||
0, 242, 141, 0, 0, 12, 0, 0,
|
||||
0, 67, 67, 95, 77, 86, 80, 77,
|
||||
97, 116, 114, 105, 120, 0, 0, 0,
|
||||
0, 255, 255, 255, 255, 0, 0, 0,
|
||||
0, 4, 0, 0, 0, 94, 139, 0,
|
||||
0, 0, 0, 0, 0, 11, 0, 0,
|
||||
0, 67, 67, 95, 84, 101, 120, 116,
|
||||
117, 114, 101, 48, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 255, 255, 255, 255,
|
||||
1, 0, 0, 0, 82, 139, 0, 0,
|
||||
241, 141, 0, 0, 7, 0, 0, 0,
|
||||
117, 95, 99, 111, 108, 111, 114, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 255,
|
||||
255, 255, 255, 1, 0, 0, 0, 3,
|
||||
0, 0, 0, 12, 0, 0, 0, 67,
|
||||
67, 95, 77, 86, 80, 77, 97, 116,
|
||||
114, 105, 120, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 11, 0, 0, 0, 67,
|
||||
67, 95, 84, 101, 120, 116, 117, 114,
|
||||
101, 48, 0, 0, 0, 0, 1, 0,
|
||||
0, 0, 7, 0, 0, 0, 117, 95,
|
||||
99, 111, 108, 111, 114, 0, 0, 0,
|
||||
0, 2, 0, 0, 0, 96, 4, 0,
|
||||
0, 192, 4, 0, 0, 0, 0, 0,
|
||||
0, 20, 134, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 68, 88, 66, 67, 157, 116, 105,
|
||||
89, 118, 135, 249, 239, 42, 226, 184,
|
||||
78, 220, 105, 236, 28, 1, 0, 0,
|
||||
0, 96, 4, 0, 0, 6, 0, 0,
|
||||
0, 56, 0, 0, 0, 228, 0, 0,
|
||||
0, 252, 1, 0, 0, 120, 2, 0,
|
||||
0, 176, 3, 0, 0, 228, 3, 0,
|
||||
0, 65, 111, 110, 57, 164, 0, 0,
|
||||
0, 164, 0, 0, 0, 0, 2, 255,
|
||||
255, 112, 0, 0, 0, 52, 0, 0,
|
||||
0, 1, 0, 40, 0, 0, 0, 52,
|
||||
0, 0, 0, 52, 0, 1, 0, 36,
|
||||
0, 0, 0, 52, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 1, 0, 0,
|
||||
0, 0, 0, 0, 0, 1, 2, 255,
|
||||
255, 31, 0, 0, 2, 0, 0, 0,
|
||||
128, 0, 0, 3, 176, 31, 0, 0,
|
||||
2, 0, 0, 0, 144, 0, 8, 15,
|
||||
160, 66, 0, 0, 3, 0, 0, 15,
|
||||
128, 0, 0, 228, 176, 0, 8, 228,
|
||||
160, 5, 0, 0, 3, 0, 0, 15,
|
||||
128, 0, 0, 228, 128, 0, 0, 228,
|
||||
160, 1, 0, 0, 2, 0, 8, 15,
|
||||
128, 0, 0, 228, 128, 1, 0, 0,
|
||||
2, 1, 8, 15, 128, 0, 0, 228,
|
||||
128, 1, 0, 0, 2, 2, 8, 15,
|
||||
128, 0, 0, 228, 128, 1, 0, 0,
|
||||
2, 3, 8, 15, 128, 0, 0, 228,
|
||||
128, 255, 255, 0, 0, 83, 72, 68,
|
||||
82, 16, 1, 0, 0, 64, 0, 0,
|
||||
0, 68, 0, 0, 0, 89, 0, 0,
|
||||
4, 70, 142, 32, 0, 0, 0, 0,
|
||||
0, 1, 0, 0, 0, 90, 0, 0,
|
||||
3, 0, 96, 16, 0, 0, 0, 0,
|
||||
0, 88, 24, 0, 4, 0, 112, 16,
|
||||
0, 0, 0, 0, 0, 85, 85, 0,
|
||||
0, 98, 16, 0, 3, 50, 16, 16,
|
||||
0, 0, 0, 0, 0, 101, 0, 0,
|
||||
3, 242, 32, 16, 0, 0, 0, 0,
|
||||
0, 101, 0, 0, 3, 242, 32, 16,
|
||||
0, 1, 0, 0, 0, 101, 0, 0,
|
||||
3, 242, 32, 16, 0, 2, 0, 0,
|
||||
0, 101, 0, 0, 3, 242, 32, 16,
|
||||
0, 3, 0, 0, 0, 104, 0, 0,
|
||||
2, 1, 0, 0, 0, 69, 0, 0,
|
||||
9, 242, 0, 16, 0, 0, 0, 0,
|
||||
0, 70, 16, 16, 0, 0, 0, 0,
|
||||
0, 70, 126, 16, 0, 0, 0, 0,
|
||||
0, 0, 96, 16, 0, 0, 0, 0,
|
||||
0, 56, 0, 0, 8, 242, 0, 16,
|
||||
0, 0, 0, 0, 0, 70, 14, 16,
|
||||
0, 0, 0, 0, 0, 70, 142, 32,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 54, 0, 0, 5, 242, 32, 16,
|
||||
0, 0, 0, 0, 0, 70, 14, 16,
|
||||
0, 0, 0, 0, 0, 54, 0, 0,
|
||||
5, 242, 32, 16, 0, 1, 0, 0,
|
||||
0, 70, 14, 16, 0, 0, 0, 0,
|
||||
0, 54, 0, 0, 5, 242, 32, 16,
|
||||
0, 2, 0, 0, 0, 70, 14, 16,
|
||||
0, 0, 0, 0, 0, 54, 0, 0,
|
||||
5, 242, 32, 16, 0, 3, 0, 0,
|
||||
0, 70, 14, 16, 0, 0, 0, 0,
|
||||
0, 62, 0, 0, 1, 83, 84, 65,
|
||||
84, 116, 0, 0, 0, 7, 0, 0,
|
||||
0, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 5, 0, 0, 0, 1, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 1, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 4, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 82, 68, 69, 70, 48, 1, 0,
|
||||
0, 1, 0, 0, 0, 176, 0, 0,
|
||||
0, 3, 0, 0, 0, 28, 0, 0,
|
||||
0, 0, 4, 255, 255, 0, 65, 0,
|
||||
0, 252, 0, 0, 0, 124, 0, 0,
|
||||
0, 3, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 1, 0, 0,
|
||||
0, 1, 0, 0, 0, 145, 0, 0,
|
||||
0, 2, 0, 0, 0, 5, 0, 0,
|
||||
0, 4, 0, 0, 0, 255, 255, 255,
|
||||
255, 0, 0, 0, 0, 1, 0, 0,
|
||||
0, 13, 0, 0, 0, 166, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 1, 0, 0,
|
||||
0, 0, 0, 0, 0, 115, 97, 109,
|
||||
112, 108, 101, 114, 95, 95, 67, 67,
|
||||
95, 84, 101, 120, 116, 117, 114, 101,
|
||||
48, 0, 116, 101, 120, 116, 117, 114,
|
||||
101, 95, 95, 67, 67, 95, 84, 101,
|
||||
120, 116, 117, 114, 101, 48, 0, 36,
|
||||
71, 108, 111, 98, 97, 108, 115, 0,
|
||||
171, 166, 0, 0, 0, 1, 0, 0,
|
||||
0, 200, 0, 0, 0, 16, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 224, 0, 0, 0, 0, 0, 0,
|
||||
0, 16, 0, 0, 0, 2, 0, 0,
|
||||
0, 236, 0, 0, 0, 0, 0, 0,
|
||||
0, 95, 117, 95, 99, 111, 108, 111,
|
||||
114, 0, 171, 171, 171, 1, 0, 3,
|
||||
0, 1, 0, 4, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 77, 105, 99,
|
||||
114, 111, 115, 111, 102, 116, 32, 40,
|
||||
82, 41, 32, 72, 76, 83, 76, 32,
|
||||
83, 104, 97, 100, 101, 114, 32, 67,
|
||||
111, 109, 112, 105, 108, 101, 114, 32,
|
||||
54, 46, 51, 46, 57, 54, 48, 48,
|
||||
46, 49, 54, 51, 56, 52, 0, 171,
|
||||
171, 73, 83, 71, 78, 44, 0, 0,
|
||||
0, 1, 0, 0, 0, 8, 0, 0,
|
||||
0, 32, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 3, 0, 0,
|
||||
0, 0, 0, 0, 0, 3, 3, 0,
|
||||
0, 84, 69, 88, 67, 79, 79, 82,
|
||||
68, 0, 171, 171, 171, 79, 83, 71,
|
||||
78, 116, 0, 0, 0, 4, 0, 0,
|
||||
0, 8, 0, 0, 0, 104, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 3, 0, 0, 0, 0, 0, 0,
|
||||
0, 15, 0, 0, 0, 104, 0, 0,
|
||||
0, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 3, 0, 0, 0, 1, 0, 0,
|
||||
0, 15, 0, 0, 0, 104, 0, 0,
|
||||
0, 2, 0, 0, 0, 0, 0, 0,
|
||||
0, 3, 0, 0, 0, 2, 0, 0,
|
||||
0, 15, 0, 0, 0, 104, 0, 0,
|
||||
0, 3, 0, 0, 0, 0, 0, 0,
|
||||
0, 3, 0, 0, 0, 3, 0, 0,
|
||||
0, 15, 0, 0, 0, 83, 86, 95,
|
||||
84, 97, 114, 103, 101, 116, 0, 171,
|
||||
171, 68, 88, 66, 67, 183, 109, 16,
|
||||
202, 49, 89, 17, 26, 134, 90, 213,
|
||||
163, 143, 192, 250, 93, 1, 0, 0,
|
||||
0, 192, 4, 0, 0, 6, 0, 0,
|
||||
0, 56, 0, 0, 0, 76, 1, 0,
|
||||
0, 204, 2, 0, 0, 72, 3, 0,
|
||||
0, 28, 4, 0, 0, 104, 4, 0,
|
||||
0, 65, 111, 110, 57, 12, 1, 0,
|
||||
0, 12, 1, 0, 0, 0, 2, 254,
|
||||
255, 216, 0, 0, 0, 52, 0, 0,
|
||||
0, 1, 0, 36, 0, 0, 0, 48,
|
||||
0, 0, 0, 48, 0, 0, 0, 36,
|
||||
0, 1, 0, 48, 0, 0, 0, 0,
|
||||
0, 4, 0, 1, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 1, 2, 254,
|
||||
255, 81, 0, 0, 5, 5, 0, 15,
|
||||
160, 0, 0, 0, 63, 0, 0, 128,
|
||||
63, 0, 0, 128, 191, 0, 0, 0,
|
||||
0, 31, 0, 0, 2, 5, 0, 0,
|
||||
128, 0, 0, 15, 144, 31, 0, 0,
|
||||
2, 5, 0, 1, 128, 1, 0, 15,
|
||||
144, 9, 0, 0, 3, 0, 0, 1,
|
||||
128, 3, 0, 228, 160, 0, 0, 228,
|
||||
144, 9, 0, 0, 3, 0, 0, 2,
|
||||
128, 4, 0, 228, 160, 0, 0, 228,
|
||||
144, 2, 0, 0, 3, 0, 0, 1,
|
||||
128, 0, 0, 85, 128, 0, 0, 0,
|
||||
128, 5, 0, 0, 3, 0, 0, 4,
|
||||
192, 0, 0, 0, 128, 5, 0, 0,
|
||||
160, 9, 0, 0, 3, 0, 0, 1,
|
||||
128, 2, 0, 228, 160, 0, 0, 228,
|
||||
144, 1, 0, 0, 2, 1, 0, 2,
|
||||
128, 0, 0, 0, 129, 9, 0, 0,
|
||||
3, 1, 0, 1, 128, 1, 0, 228,
|
||||
160, 0, 0, 228, 144, 4, 0, 0,
|
||||
4, 0, 0, 3, 192, 0, 0, 85,
|
||||
128, 0, 0, 228, 160, 1, 0, 228,
|
||||
128, 1, 0, 0, 2, 0, 0, 8,
|
||||
192, 0, 0, 85, 128, 4, 0, 0,
|
||||
4, 0, 0, 3, 224, 1, 0, 228,
|
||||
144, 5, 0, 233, 160, 5, 0, 231,
|
||||
160, 255, 255, 0, 0, 83, 72, 68,
|
||||
82, 120, 1, 0, 0, 64, 0, 1,
|
||||
0, 94, 0, 0, 0, 89, 0, 0,
|
||||
4, 70, 142, 32, 0, 0, 0, 0,
|
||||
0, 4, 0, 0, 0, 95, 0, 0,
|
||||
3, 242, 16, 16, 0, 0, 0, 0,
|
||||
0, 95, 0, 0, 3, 50, 16, 16,
|
||||
0, 1, 0, 0, 0, 101, 0, 0,
|
||||
3, 50, 32, 16, 0, 0, 0, 0,
|
||||
0, 103, 0, 0, 4, 242, 32, 16,
|
||||
0, 1, 0, 0, 0, 1, 0, 0,
|
||||
0, 104, 0, 0, 2, 1, 0, 0,
|
||||
0, 50, 0, 0, 15, 50, 32, 16,
|
||||
0, 0, 0, 0, 0, 70, 16, 16,
|
||||
0, 1, 0, 0, 0, 2, 64, 0,
|
||||
0, 0, 0, 128, 63, 0, 0, 128,
|
||||
191, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 2, 64, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 128, 63, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 17, 0, 0,
|
||||
8, 18, 0, 16, 0, 0, 0, 0,
|
||||
0, 70, 142, 32, 0, 0, 0, 0,
|
||||
0, 1, 0, 0, 0, 70, 30, 16,
|
||||
0, 0, 0, 0, 0, 54, 0, 0,
|
||||
6, 34, 32, 16, 0, 1, 0, 0,
|
||||
0, 10, 0, 16, 128, 65, 0, 0,
|
||||
0, 0, 0, 0, 0, 17, 0, 0,
|
||||
8, 18, 0, 16, 0, 0, 0, 0,
|
||||
0, 70, 142, 32, 0, 0, 0, 0,
|
||||
0, 2, 0, 0, 0, 70, 30, 16,
|
||||
0, 0, 0, 0, 0, 17, 0, 0,
|
||||
8, 34, 0, 16, 0, 0, 0, 0,
|
||||
0, 70, 142, 32, 0, 0, 0, 0,
|
||||
0, 3, 0, 0, 0, 70, 30, 16,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
7, 18, 0, 16, 0, 0, 0, 0,
|
||||
0, 26, 0, 16, 0, 0, 0, 0,
|
||||
0, 10, 0, 16, 0, 0, 0, 0,
|
||||
0, 54, 0, 0, 5, 130, 32, 16,
|
||||
0, 1, 0, 0, 0, 26, 0, 16,
|
||||
0, 0, 0, 0, 0, 56, 0, 0,
|
||||
7, 66, 32, 16, 0, 1, 0, 0,
|
||||
0, 10, 0, 16, 0, 0, 0, 0,
|
||||
0, 1, 64, 0, 0, 0, 0, 0,
|
||||
63, 17, 0, 0, 8, 18, 32, 16,
|
||||
0, 1, 0, 0, 0, 70, 142, 32,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 70, 30, 16, 0, 0, 0, 0,
|
||||
0, 62, 0, 0, 1, 83, 84, 65,
|
||||
84, 116, 0, 0, 0, 10, 0, 0,
|
||||
0, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 4, 0, 0, 0, 8, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 82, 68, 69, 70, 204, 0, 0,
|
||||
0, 1, 0, 0, 0, 72, 0, 0,
|
||||
0, 1, 0, 0, 0, 28, 0, 0,
|
||||
0, 0, 4, 254, 255, 0, 65, 0,
|
||||
0, 152, 0, 0, 0, 60, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 1, 0, 0,
|
||||
0, 0, 0, 0, 0, 36, 71, 108,
|
||||
111, 98, 97, 108, 115, 0, 171, 171,
|
||||
171, 60, 0, 0, 0, 1, 0, 0,
|
||||
0, 96, 0, 0, 0, 64, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 120, 0, 0, 0, 0, 0, 0,
|
||||
0, 64, 0, 0, 0, 2, 0, 0,
|
||||
0, 136, 0, 0, 0, 0, 0, 0,
|
||||
0, 95, 67, 67, 95, 77, 86, 80,
|
||||
77, 97, 116, 114, 105, 120, 0, 171,
|
||||
171, 3, 0, 3, 0, 4, 0, 4,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 77, 105, 99, 114, 111, 115, 111,
|
||||
102, 116, 32, 40, 82, 41, 32, 72,
|
||||
76, 83, 76, 32, 83, 104, 97, 100,
|
||||
101, 114, 32, 67, 111, 109, 112, 105,
|
||||
108, 101, 114, 32, 54, 46, 51, 46,
|
||||
57, 54, 48, 48, 46, 49, 54, 51,
|
||||
56, 52, 0, 171, 171, 73, 83, 71,
|
||||
78, 68, 0, 0, 0, 2, 0, 0,
|
||||
0, 8, 0, 0, 0, 56, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 3, 0, 0, 0, 0, 0, 0,
|
||||
0, 15, 15, 0, 0, 56, 0, 0,
|
||||
0, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 3, 0, 0, 0, 1, 0, 0,
|
||||
0, 3, 3, 0, 0, 84, 69, 88,
|
||||
67, 79, 79, 82, 68, 0, 171, 171,
|
||||
171, 79, 83, 71, 78, 80, 0, 0,
|
||||
0, 2, 0, 0, 0, 8, 0, 0,
|
||||
0, 56, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 3, 0, 0,
|
||||
0, 0, 0, 0, 0, 3, 12, 0,
|
||||
0, 65, 0, 0, 0, 0, 0, 0,
|
||||
0, 1, 0, 0, 0, 3, 0, 0,
|
||||
0, 1, 0, 0, 0, 15, 0, 0,
|
||||
0, 84, 69, 88, 67, 79, 79, 82,
|
||||
68, 0, 83, 86, 95, 80, 111, 115,
|
||||
105, 116, 105, 111, 110, 0, 171, 171,
|
||||
171,
|
||||
};
|
||||
|
||||
const unsigned char s_7E1EEF397305D0BC2DCDBA4F2DAFBCBA1534E45C[] = {
|
||||
|
||||
166, 147, 0, 0, 142, 9, 2, 1,
|
||||
0, 128, 0, 0, 82, 139, 0, 0,
|
||||
10, 0, 0, 0, 97, 95, 112, 111,
|
||||
115, 105, 116, 105, 111, 110, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 255, 255, 255, 255, 80, 139,
|
||||
0, 0, 10, 0, 0, 0, 97, 95,
|
||||
116, 101, 120, 67, 111, 111, 114, 100,
|
||||
1, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 255, 255, 255, 255,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
255, 255, 255, 255, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 255, 255, 255, 255,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
255, 255, 255, 255, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 255, 255, 255, 255,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
255, 255, 255, 255, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 255, 255, 255, 255,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
255, 255, 255, 255, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 255, 255, 255, 255,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
255, 255, 255, 255, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 255, 255, 255, 255,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
255, 255, 255, 255, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 255, 255, 255, 255,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 2, 0, 0, 0, 92, 139, 0,
|
||||
0, 242, 141, 0, 0, 12, 0, 0,
|
||||
0, 67, 67, 95, 77, 86, 80, 77,
|
||||
97, 116, 114, 105, 120, 0, 0, 0,
|
||||
0, 255, 255, 255, 255, 0, 0, 0,
|
||||
0, 4, 0, 0, 0, 82, 139, 0,
|
||||
0, 241, 141, 0, 0, 7, 0, 0,
|
||||
0, 117, 95, 99, 111, 108, 111, 114,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
255, 255, 255, 255, 1, 0, 0, 0,
|
||||
2, 0, 0, 0, 12, 0, 0, 0,
|
||||
67, 67, 95, 77, 86, 80, 77, 97,
|
||||
116, 114, 105, 120, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 7, 0, 0, 0,
|
||||
117, 95, 99, 111, 108, 111, 114, 0,
|
||||
0, 0, 0, 1, 0, 0, 0, 52,
|
||||
3, 0, 0, 40, 4, 0, 0, 0,
|
||||
0, 0, 0, 20, 134, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 68, 88, 66, 67, 153,
|
||||
8, 62, 201, 202, 170, 111, 182, 149,
|
||||
120, 120, 178, 230, 43, 232, 244, 1,
|
||||
0, 0, 0, 52, 3, 0, 0, 6,
|
||||
0, 0, 0, 56, 0, 0, 0, 168,
|
||||
0, 0, 0, 92, 1, 0, 0, 216,
|
||||
1, 0, 0, 168, 2, 0, 0, 184,
|
||||
2, 0, 0, 65, 111, 110, 57, 104,
|
||||
0, 0, 0, 104, 0, 0, 0, 0,
|
||||
2, 255, 255, 56, 0, 0, 0, 48,
|
||||
0, 0, 0, 1, 0, 36, 0, 0,
|
||||
0, 48, 0, 0, 0, 48, 0, 0,
|
||||
0, 36, 0, 0, 0, 48, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, 0, 0,
|
||||
0, 0, 0, 1, 2, 255, 255, 1,
|
||||
0, 0, 2, 0, 8, 15, 128, 0,
|
||||
0, 228, 160, 1, 0, 0, 2, 1,
|
||||
8, 15, 128, 0, 0, 228, 160, 1,
|
||||
0, 0, 2, 2, 8, 15, 128, 0,
|
||||
0, 228, 160, 1, 0, 0, 2, 3,
|
||||
8, 15, 128, 0, 0, 228, 160, 255,
|
||||
255, 0, 0, 83, 72, 68, 82, 172,
|
||||
0, 0, 0, 64, 0, 0, 0, 43,
|
||||
0, 0, 0, 89, 0, 0, 4, 70,
|
||||
142, 32, 0, 0, 0, 0, 0, 1,
|
||||
0, 0, 0, 101, 0, 0, 3, 242,
|
||||
32, 16, 0, 0, 0, 0, 0, 101,
|
||||
0, 0, 3, 242, 32, 16, 0, 1,
|
||||
0, 0, 0, 101, 0, 0, 3, 242,
|
||||
32, 16, 0, 2, 0, 0, 0, 101,
|
||||
0, 0, 3, 242, 32, 16, 0, 3,
|
||||
0, 0, 0, 54, 0, 0, 6, 242,
|
||||
32, 16, 0, 0, 0, 0, 0, 70,
|
||||
142, 32, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 54, 0, 0, 6, 242,
|
||||
32, 16, 0, 1, 0, 0, 0, 70,
|
||||
142, 32, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 54, 0, 0, 6, 242,
|
||||
32, 16, 0, 2, 0, 0, 0, 70,
|
||||
142, 32, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 54, 0, 0, 6, 242,
|
||||
32, 16, 0, 3, 0, 0, 0, 70,
|
||||
142, 32, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 62, 0, 0, 1, 83,
|
||||
84, 65, 84, 116, 0, 0, 0, 5,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 4, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 4, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 82, 68, 69, 70, 200,
|
||||
0, 0, 0, 1, 0, 0, 0, 72,
|
||||
0, 0, 0, 1, 0, 0, 0, 28,
|
||||
0, 0, 0, 0, 4, 255, 255, 0,
|
||||
65, 0, 0, 148, 0, 0, 0, 60,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 1,
|
||||
0, 0, 0, 0, 0, 0, 0, 36,
|
||||
71, 108, 111, 98, 97, 108, 115, 0,
|
||||
171, 171, 171, 60, 0, 0, 0, 1,
|
||||
0, 0, 0, 96, 0, 0, 0, 16,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 120, 0, 0, 0, 0,
|
||||
0, 0, 0, 16, 0, 0, 0, 2,
|
||||
0, 0, 0, 132, 0, 0, 0, 0,
|
||||
0, 0, 0, 95, 117, 95, 99, 111,
|
||||
108, 111, 114, 0, 171, 171, 171, 1,
|
||||
0, 3, 0, 1, 0, 4, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 77,
|
||||
105, 99, 114, 111, 115, 111, 102, 116,
|
||||
32, 40, 82, 41, 32, 72, 76, 83,
|
||||
76, 32, 83, 104, 97, 100, 101, 114,
|
||||
32, 67, 111, 109, 112, 105, 108, 101,
|
||||
114, 32, 54, 46, 51, 46, 57, 54,
|
||||
48, 48, 46, 49, 54, 51, 56, 52,
|
||||
0, 171, 171, 73, 83, 71, 78, 8,
|
||||
0, 0, 0, 0, 0, 0, 0, 8,
|
||||
0, 0, 0, 79, 83, 71, 78, 116,
|
||||
0, 0, 0, 4, 0, 0, 0, 8,
|
||||
0, 0, 0, 104, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 3,
|
||||
0, 0, 0, 0, 0, 0, 0, 15,
|
||||
0, 0, 0, 104, 0, 0, 0, 1,
|
||||
0, 0, 0, 0, 0, 0, 0, 3,
|
||||
0, 0, 0, 1, 0, 0, 0, 15,
|
||||
0, 0, 0, 104, 0, 0, 0, 2,
|
||||
0, 0, 0, 0, 0, 0, 0, 3,
|
||||
0, 0, 0, 2, 0, 0, 0, 15,
|
||||
0, 0, 0, 104, 0, 0, 0, 3,
|
||||
0, 0, 0, 0, 0, 0, 0, 3,
|
||||
0, 0, 0, 3, 0, 0, 0, 15,
|
||||
0, 0, 0, 83, 86, 95, 84, 97,
|
||||
114, 103, 101, 116, 0, 171, 171, 68,
|
||||
88, 66, 67, 127, 38, 114, 44, 227,
|
||||
180, 68, 44, 235, 149, 12, 244, 164,
|
||||
251, 61, 185, 1, 0, 0, 0, 40,
|
||||
4, 0, 0, 6, 0, 0, 0, 56,
|
||||
0, 0, 0, 44, 1, 0, 0, 88,
|
||||
2, 0, 0, 212, 2, 0, 0, 168,
|
||||
3, 0, 0, 244, 3, 0, 0, 65,
|
||||
111, 110, 57, 236, 0, 0, 0, 236,
|
||||
0, 0, 0, 0, 2, 254, 255, 184,
|
||||
0, 0, 0, 52, 0, 0, 0, 1,
|
||||
0, 36, 0, 0, 0, 48, 0, 0,
|
||||
0, 48, 0, 0, 0, 36, 0, 1,
|
||||
0, 48, 0, 0, 0, 0, 0, 4,
|
||||
0, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 1, 2, 254, 255, 81,
|
||||
0, 0, 5, 5, 0, 15, 160, 0,
|
||||
0, 0, 63, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 31,
|
||||
0, 0, 2, 5, 0, 0, 128, 0,
|
||||
0, 15, 144, 9, 0, 0, 3, 0,
|
||||
0, 1, 128, 3, 0, 228, 160, 0,
|
||||
0, 228, 144, 9, 0, 0, 3, 0,
|
||||
0, 2, 128, 4, 0, 228, 160, 0,
|
||||
0, 228, 144, 2, 0, 0, 3, 0,
|
||||
0, 1, 128, 0, 0, 85, 128, 0,
|
||||
0, 0, 128, 5, 0, 0, 3, 0,
|
||||
0, 4, 192, 0, 0, 0, 128, 5,
|
||||
0, 0, 160, 9, 0, 0, 3, 0,
|
||||
0, 1, 128, 2, 0, 228, 160, 0,
|
||||
0, 228, 144, 1, 0, 0, 2, 1,
|
||||
0, 2, 128, 0, 0, 0, 129, 9,
|
||||
0, 0, 3, 1, 0, 1, 128, 1,
|
||||
0, 228, 160, 0, 0, 228, 144, 4,
|
||||
0, 0, 4, 0, 0, 3, 192, 0,
|
||||
0, 85, 128, 0, 0, 228, 160, 1,
|
||||
0, 228, 128, 1, 0, 0, 2, 0,
|
||||
0, 8, 192, 0, 0, 85, 128, 255,
|
||||
255, 0, 0, 83, 72, 68, 82, 36,
|
||||
1, 0, 0, 64, 0, 1, 0, 73,
|
||||
0, 0, 0, 89, 0, 0, 4, 70,
|
||||
142, 32, 0, 0, 0, 0, 0, 4,
|
||||
0, 0, 0, 95, 0, 0, 3, 242,
|
||||
16, 16, 0, 0, 0, 0, 0, 103,
|
||||
0, 0, 4, 242, 32, 16, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, 0, 104,
|
||||
0, 0, 2, 1, 0, 0, 0, 17,
|
||||
0, 0, 8, 18, 0, 16, 0, 0,
|
||||
0, 0, 0, 70, 142, 32, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, 0, 70,
|
||||
30, 16, 0, 0, 0, 0, 0, 54,
|
||||
0, 0, 6, 34, 32, 16, 0, 0,
|
||||
0, 0, 0, 10, 0, 16, 128, 65,
|
||||
0, 0, 0, 0, 0, 0, 0, 17,
|
||||
0, 0, 8, 18, 0, 16, 0, 0,
|
||||
0, 0, 0, 70, 142, 32, 0, 0,
|
||||
0, 0, 0, 2, 0, 0, 0, 70,
|
||||
30, 16, 0, 0, 0, 0, 0, 17,
|
||||
0, 0, 8, 34, 0, 16, 0, 0,
|
||||
0, 0, 0, 70, 142, 32, 0, 0,
|
||||
0, 0, 0, 3, 0, 0, 0, 70,
|
||||
30, 16, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 7, 18, 0, 16, 0, 0,
|
||||
0, 0, 0, 26, 0, 16, 0, 0,
|
||||
0, 0, 0, 10, 0, 16, 0, 0,
|
||||
0, 0, 0, 54, 0, 0, 5, 130,
|
||||
32, 16, 0, 0, 0, 0, 0, 26,
|
||||
0, 16, 0, 0, 0, 0, 0, 56,
|
||||
0, 0, 7, 66, 32, 16, 0, 0,
|
||||
0, 0, 0, 10, 0, 16, 0, 0,
|
||||
0, 0, 0, 1, 64, 0, 0, 0,
|
||||
0, 0, 63, 17, 0, 0, 8, 18,
|
||||
32, 16, 0, 0, 0, 0, 0, 70,
|
||||
142, 32, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 70, 30, 16, 0, 0,
|
||||
0, 0, 0, 62, 0, 0, 1, 83,
|
||||
84, 65, 84, 116, 0, 0, 0, 9,
|
||||
0, 0, 0, 1, 0, 0, 0, 0,
|
||||
0, 0, 0, 2, 0, 0, 0, 7,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 82, 68, 69, 70, 204,
|
||||
0, 0, 0, 1, 0, 0, 0, 72,
|
||||
0, 0, 0, 1, 0, 0, 0, 28,
|
||||
0, 0, 0, 0, 4, 254, 255, 0,
|
||||
65, 0, 0, 152, 0, 0, 0, 60,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 1,
|
||||
0, 0, 0, 0, 0, 0, 0, 36,
|
||||
71, 108, 111, 98, 97, 108, 115, 0,
|
||||
171, 171, 171, 60, 0, 0, 0, 1,
|
||||
0, 0, 0, 96, 0, 0, 0, 64,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 120, 0, 0, 0, 0,
|
||||
0, 0, 0, 64, 0, 0, 0, 2,
|
||||
0, 0, 0, 136, 0, 0, 0, 0,
|
||||
0, 0, 0, 95, 67, 67, 95, 77,
|
||||
86, 80, 77, 97, 116, 114, 105, 120,
|
||||
0, 171, 171, 3, 0, 3, 0, 4,
|
||||
0, 4, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 77, 105, 99, 114, 111,
|
||||
115, 111, 102, 116, 32, 40, 82, 41,
|
||||
32, 72, 76, 83, 76, 32, 83, 104,
|
||||
97, 100, 101, 114, 32, 67, 111, 109,
|
||||
112, 105, 108, 101, 114, 32, 54, 46,
|
||||
51, 46, 57, 54, 48, 48, 46, 49,
|
||||
54, 51, 56, 52, 0, 171, 171, 73,
|
||||
83, 71, 78, 68, 0, 0, 0, 2,
|
||||
0, 0, 0, 8, 0, 0, 0, 56,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 3, 0, 0, 0, 0,
|
||||
0, 0, 0, 15, 15, 0, 0, 56,
|
||||
0, 0, 0, 1, 0, 0, 0, 0,
|
||||
0, 0, 0, 3, 0, 0, 0, 1,
|
||||
0, 0, 0, 3, 0, 0, 0, 84,
|
||||
69, 88, 67, 79, 79, 82, 68, 0,
|
||||
171, 171, 171, 79, 83, 71, 78, 44,
|
||||
0, 0, 0, 1, 0, 0, 0, 8,
|
||||
0, 0, 0, 32, 0, 0, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, 0, 3,
|
||||
0, 0, 0, 0, 0, 0, 0, 15,
|
||||
0, 0, 0, 83, 86, 95, 80, 111,
|
||||
115, 105, 116, 105, 111, 110, 0,
|
||||
};
|
||||
|
||||
const unsigned char s_847DBFDDA6EC09C57E4ED43012AE2FB5CAC7D8D5[] = {
|
||||
|
||||
166, 147, 0, 0, 142, 9, 2, 1,
|
||||
|
@ -5929,7 +6642,7 @@ const unsigned char s_F6BA4519AF2653A53D57FB5D5508F0D8617105D6[] = {
|
|||
105, 111, 110, 0, 171, 171, 171,
|
||||
};
|
||||
|
||||
const int s_numPrograms = 15;
|
||||
const int s_programLengths[] = {2990,2528,4102,3022,2996,3358,2982,3300,3350,3025,3556,2502,2675,3746,2775};
|
||||
const unsigned char* s_programs[] = {s_133478C5A874C1E6F59B418CE6C7C39F1AE0F873,s_13E33F532157A58EC77EDE3B3112560A89D272B2,s_1A69A7CC77C7C8FC62799B0513816EA41FBF3BFE,s_53938AB67AD93ABA0DDB87F3C9889304284E011E,s_67837675F2BB48C0E926316F505FC1538228E0FA,s_78250E25D1929D4A842050738140787BE42541C6,s_7B67DD242152D35ACC079265FAD9D03DC98182DE,s_847DBFDDA6EC09C57E4ED43012AE2FB5CAC7D8D5,s_92BE325B516F887D2C928EDE20ADF428DB01C038,s_A2377A827972A5466DA8637681045D32DA8A817D,s_B5E27B4F3CF7236633255B28CBA530D6EE5CED86,s_E2C7CE1244DE9C76688EFA9463B2A130B6A08893,s_E2D56227712263272BD5218FEA117CD06180F81B,s_F46558C274182079784898CF4968CF431593D5E2,s_F6BA4519AF2653A53D57FB5D5508F0D8617105D6};
|
||||
const char* s_programKeys[] = {"133478C5A874C1E6F59B418CE6C7C39F1AE0F873","13E33F532157A58EC77EDE3B3112560A89D272B2","1A69A7CC77C7C8FC62799B0513816EA41FBF3BFE","53938AB67AD93ABA0DDB87F3C9889304284E011E","67837675F2BB48C0E926316F505FC1538228E0FA","78250E25D1929D4A842050738140787BE42541C6","7B67DD242152D35ACC079265FAD9D03DC98182DE","847DBFDDA6EC09C57E4ED43012AE2FB5CAC7D8D5","92BE325B516F887D2C928EDE20ADF428DB01C038","A2377A827972A5466DA8637681045D32DA8A817D","B5E27B4F3CF7236633255B28CBA530D6EE5CED86","E2C7CE1244DE9C76688EFA9463B2A130B6A08893","E2D56227712263272BD5218FEA117CD06180F81B","F46558C274182079784898CF4968CF431593D5E2","F6BA4519AF2653A53D57FB5D5508F0D8617105D6"};
|
||||
const int s_numPrograms = 17;
|
||||
const int s_programLengths[] = {2990,2528,4102,3022,2996,3358,2982,3073,2559,3300,3350,3025,3556,2502,2675,3746,2775};
|
||||
const unsigned char* s_programs[] = {s_133478C5A874C1E6F59B418CE6C7C39F1AE0F873,s_13E33F532157A58EC77EDE3B3112560A89D272B2,s_1A69A7CC77C7C8FC62799B0513816EA41FBF3BFE,s_53938AB67AD93ABA0DDB87F3C9889304284E011E,s_67837675F2BB48C0E926316F505FC1538228E0FA,s_78250E25D1929D4A842050738140787BE42541C6,s_7B67DD242152D35ACC079265FAD9D03DC98182DE,s_7CE5EE84ACB6110F7FA29152ECE3344CB6D6620D,s_7E1EEF397305D0BC2DCDBA4F2DAFBCBA1534E45C,s_847DBFDDA6EC09C57E4ED43012AE2FB5CAC7D8D5,s_92BE325B516F887D2C928EDE20ADF428DB01C038,s_A2377A827972A5466DA8637681045D32DA8A817D,s_B5E27B4F3CF7236633255B28CBA530D6EE5CED86,s_E2C7CE1244DE9C76688EFA9463B2A130B6A08893,s_E2D56227712263272BD5218FEA117CD06180F81B,s_F46558C274182079784898CF4968CF431593D5E2,s_F6BA4519AF2653A53D57FB5D5508F0D8617105D6};
|
||||
const char* s_programKeys[] = {"133478C5A874C1E6F59B418CE6C7C39F1AE0F873","13E33F532157A58EC77EDE3B3112560A89D272B2","1A69A7CC77C7C8FC62799B0513816EA41FBF3BFE","53938AB67AD93ABA0DDB87F3C9889304284E011E","67837675F2BB48C0E926316F505FC1538228E0FA","78250E25D1929D4A842050738140787BE42541C6","7B67DD242152D35ACC079265FAD9D03DC98182DE","7CE5EE84ACB6110F7FA29152ECE3344CB6D6620D","7E1EEF397305D0BC2DCDBA4F2DAFBCBA1534E45C","847DBFDDA6EC09C57E4ED43012AE2FB5CAC7D8D5","92BE325B516F887D2C928EDE20ADF428DB01C038","A2377A827972A5466DA8637681045D32DA8A817D","B5E27B4F3CF7236633255B28CBA530D6EE5CED86","E2C7CE1244DE9C76688EFA9463B2A130B6A08893","E2D56227712263272BD5218FEA117CD06180F81B","F46558C274182079784898CF4968CF431593D5E2","F6BA4519AF2653A53D57FB5D5508F0D8617105D6"};
|
||||
|
|
|
@ -71,6 +71,9 @@ const char* GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_GLOW = "ShaderLabelDFGlow
|
|||
const char* GLProgram::SHADER_NAME_LABEL_NORMAL = "ShaderLabelNormal";
|
||||
const char* GLProgram::SHADER_NAME_LABEL_OUTLINE = "ShaderLabelOutline";
|
||||
|
||||
const char* GLProgram::SHADER_3D_POSITION = "Shader3DPosition";
|
||||
const char* GLProgram::SHADER_3D_POSITION_TEXTURE = "Shader3DPositionTexture";
|
||||
|
||||
|
||||
// uniform names
|
||||
const char* GLProgram::UNIFORM_NAME_P_MATRIX = "CC_PMatrix";
|
||||
|
@ -501,6 +504,10 @@ bool GLProgram::link()
|
|||
if(!_hasShaderCompiler)
|
||||
{
|
||||
// precompiled shader program is already linked
|
||||
|
||||
//bindPredefinedVertexAttribs();
|
||||
parseVertexAttribs();
|
||||
parseUniforms();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -127,6 +127,9 @@ public:
|
|||
static const char* SHADER_NAME_LABEL_DISTANCEFIELD_NORMAL;
|
||||
static const char* SHADER_NAME_LABEL_DISTANCEFIELD_GLOW;
|
||||
|
||||
//3D
|
||||
static const char* SHADER_3D_POSITION;
|
||||
static const char* SHADER_3D_POSITION_TEXTURE;
|
||||
|
||||
// uniform names
|
||||
static const char* UNIFORM_NAME_P_MATRIX;
|
||||
|
|
|
@ -49,6 +49,8 @@ enum {
|
|||
kShaderType_LabelDistanceFieldGlow,
|
||||
kShaderType_LabelNormal,
|
||||
kShaderType_LabelOutline,
|
||||
kShaderType_3DPosition,
|
||||
kShaderType_3DPositionTex,
|
||||
kShaderType_MAX,
|
||||
};
|
||||
|
||||
|
@ -189,6 +191,15 @@ void GLProgramCache::loadDefaultGLPrograms()
|
|||
p = new GLProgram();
|
||||
loadDefaultGLProgram(p, kShaderType_LabelOutline);
|
||||
_programs.insert( std::make_pair(GLProgram::SHADER_NAME_LABEL_OUTLINE, p) );
|
||||
|
||||
p = new GLProgram();
|
||||
loadDefaultGLProgram(p, kShaderType_3DPosition);
|
||||
_programs.insert( std::make_pair(GLProgram::SHADER_3D_POSITION, p) );
|
||||
|
||||
p = new GLProgram();
|
||||
loadDefaultGLProgram(p, kShaderType_3DPositionTex);
|
||||
_programs.insert( std::make_pair(GLProgram::SHADER_3D_POSITION_TEXTURE, p) );
|
||||
|
||||
}
|
||||
|
||||
void GLProgramCache::reloadDefaultGLPrograms()
|
||||
|
@ -277,6 +288,15 @@ void GLProgramCache::reloadDefaultGLPrograms()
|
|||
p = getGLProgram(GLProgram::SHADER_NAME_LABEL_OUTLINE);
|
||||
p->reset();
|
||||
loadDefaultGLProgram(p, kShaderType_LabelOutline);
|
||||
|
||||
p = getGLProgram(GLProgram::SHADER_3D_POSITION);
|
||||
p->reset();
|
||||
loadDefaultGLProgram(p, kShaderType_3DPosition);
|
||||
|
||||
p = getGLProgram(GLProgram::SHADER_3D_POSITION_TEXTURE);
|
||||
p->reset();
|
||||
loadDefaultGLProgram(p, kShaderType_3DPositionTex);
|
||||
|
||||
}
|
||||
|
||||
void GLProgramCache::loadDefaultGLProgram(GLProgram *p, int type)
|
||||
|
@ -330,6 +350,12 @@ void GLProgramCache::loadDefaultGLProgram(GLProgram *p, int type)
|
|||
case kShaderType_LabelOutline:
|
||||
p->initWithByteArrays(ccLabel_vert, ccLabelOutline_frag);
|
||||
break;
|
||||
case kShaderType_3DPosition:
|
||||
p->initWithByteArrays(cc3D_PositionTex_vert, cc3D_Color_frag);
|
||||
break;
|
||||
case kShaderType_3DPositionTex:
|
||||
p->initWithByteArrays(cc3D_PositionTex_vert, cc3D_ColorTex_frag);
|
||||
break;
|
||||
default:
|
||||
CCLOG("cocos2d: %s:%d, error shader type", __FUNCTION__, __LINE__);
|
||||
return;
|
||||
|
|
|
@ -0,0 +1,164 @@
|
|||
/****************************************************************************
|
||||
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 "base/ccMacros.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include "renderer/CCMeshCommand.h"
|
||||
#include "renderer/ccGLStateCache.h"
|
||||
#include "renderer/CCGLProgramState.h"
|
||||
#include "renderer/CCRenderer.h"
|
||||
#include "renderer/CCTextureAtlas.h"
|
||||
#include "renderer/CCTexture2D.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
MeshCommand::MeshCommand()
|
||||
: _textureID(0)
|
||||
, _blendType(BlendFunc::DISABLE)
|
||||
, _glProgramState(nullptr)
|
||||
, _cullFaceEnabled(false)
|
||||
, _cullFace(GL_BACK)
|
||||
, _depthTestEnabled(false)
|
||||
, _depthWriteEnabled(false)
|
||||
, _displayColor(1.0f, 1.0f, 1.0f, 1.0f)
|
||||
{
|
||||
_type = RenderCommand::Type::MESH_COMMAND;
|
||||
}
|
||||
|
||||
void MeshCommand::init(float globalOrder,
|
||||
GLuint textureID,
|
||||
GLProgramState* glProgramState,
|
||||
BlendFunc blendType,
|
||||
GLuint vertexBuffer,
|
||||
GLuint indexBuffer,
|
||||
GLenum primitive,
|
||||
GLenum indexFormat,
|
||||
ssize_t indexCount,
|
||||
const Mat4 &mv)
|
||||
{
|
||||
CCASSERT(glProgramState, "GLProgramState cannot be nill");
|
||||
|
||||
_globalOrder = globalOrder;
|
||||
_textureID = textureID;
|
||||
_blendType = blendType;
|
||||
_glProgramState = glProgramState;
|
||||
|
||||
_vertexBuffer = vertexBuffer;
|
||||
_indexBuffer = indexBuffer;
|
||||
_primitive = primitive;
|
||||
_indexFormat = indexFormat;
|
||||
_indexCount = indexCount;
|
||||
_mv = mv;
|
||||
}
|
||||
|
||||
void MeshCommand::setCullFaceEnabled(bool enable)
|
||||
{
|
||||
_cullFaceEnabled = enable;
|
||||
}
|
||||
|
||||
void MeshCommand::setCullFace(GLenum cullFace)
|
||||
{
|
||||
_cullFace = cullFace;
|
||||
}
|
||||
|
||||
void MeshCommand::setDepthTestEnabled(bool enable)
|
||||
{
|
||||
_depthTestEnabled = enable;
|
||||
}
|
||||
|
||||
void MeshCommand::setDepthWriteEnabled(bool enable)
|
||||
{
|
||||
_depthWriteEnabled = enable;
|
||||
}
|
||||
|
||||
void MeshCommand::setDisplayColor(const Vec4& color)
|
||||
{
|
||||
_displayColor = color;
|
||||
}
|
||||
|
||||
MeshCommand::~MeshCommand()
|
||||
{
|
||||
}
|
||||
|
||||
void MeshCommand::applyRenderState()
|
||||
{
|
||||
if (_cullFaceEnabled)
|
||||
{
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(_cullFace);
|
||||
}
|
||||
if (_depthTestEnabled)
|
||||
{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
if (_depthWriteEnabled)
|
||||
{
|
||||
glDepthMask(GL_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void MeshCommand::restoreRenderState()
|
||||
{
|
||||
if (_cullFaceEnabled)
|
||||
{
|
||||
glDisable(GL_CULL_FACE);
|
||||
}
|
||||
if (_depthTestEnabled)
|
||||
{
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
}
|
||||
if (_depthWriteEnabled)
|
||||
{
|
||||
glDepthMask(GL_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void MeshCommand::execute()
|
||||
{
|
||||
// set render state
|
||||
applyRenderState();
|
||||
|
||||
// Set material
|
||||
GL::bindTexture2D(_textureID);
|
||||
GL::blendFunc(_blendType.src, _blendType.dst);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
|
||||
_glProgramState->setUniformVec4("u_color", _displayColor);
|
||||
_glProgramState->apply(_mv);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
|
||||
|
||||
// Draw
|
||||
glDrawElements(_primitive, (GLsizei)_indexCount, _indexFormat, 0);
|
||||
|
||||
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, _indexCount);
|
||||
|
||||
//restore render state
|
||||
restoreRenderState();
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
NS_CC_END
|
|
@ -0,0 +1,91 @@
|
|||
/****************************************************************************
|
||||
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 _CC_MESHCOMMAND_H_
|
||||
#define _CC_MESHCOMMAND_H_
|
||||
|
||||
#include "CCRenderCommand.h"
|
||||
#include "renderer/CCGLProgram.h"
|
||||
#include "math/CCMath.h"
|
||||
#include "CCRenderCommandPool.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class GLProgramState;
|
||||
|
||||
//it is a common mesh
|
||||
class MeshCommand : public RenderCommand
|
||||
{
|
||||
public:
|
||||
|
||||
MeshCommand();
|
||||
~MeshCommand();
|
||||
|
||||
void init(float globalOrder, GLuint textureID, GLProgramState* glProgramState, BlendFunc blendType, GLuint vertexBuffer, GLuint indexBuffer, GLenum primitive, GLenum indexType, ssize_t indexCount, const Mat4 &mv);
|
||||
|
||||
void setCullFaceEnabled(bool enable);
|
||||
|
||||
void setCullFace(GLenum cullFace);
|
||||
|
||||
void setDepthTestEnabled(bool enable);
|
||||
|
||||
void setDepthWriteEnabled(bool enable);
|
||||
|
||||
void setDisplayColor(const Vec4& color);
|
||||
|
||||
void execute();
|
||||
|
||||
protected:
|
||||
// apply renderstate
|
||||
void applyRenderState();
|
||||
|
||||
//restore to all false
|
||||
void restoreRenderState();
|
||||
|
||||
GLuint _textureID;
|
||||
GLProgramState* _glProgramState;
|
||||
BlendFunc _blendType;
|
||||
|
||||
GLuint _textrueID;
|
||||
|
||||
Vec4 _displayColor; // in order to support tint and fade in fade out
|
||||
|
||||
GLuint _vertexBuffer;
|
||||
GLuint _indexBuffer;
|
||||
GLenum _primitive;
|
||||
GLenum _indexFormat;
|
||||
ssize_t _indexCount;
|
||||
|
||||
// States, default value all false
|
||||
bool _cullFaceEnabled;
|
||||
GLenum _cullFace;
|
||||
bool _depthTestEnabled;
|
||||
bool _depthWriteEnabled;
|
||||
|
||||
// ModelView transform
|
||||
Mat4 _mv;
|
||||
};
|
||||
NS_CC_END
|
||||
|
||||
#endif //_CC_MESHCOMMAND_H_
|
|
@ -48,6 +48,7 @@ public:
|
|||
CUSTOM_COMMAND,
|
||||
BATCH_COMMAND,
|
||||
GROUP_COMMAND,
|
||||
MESH_COMMAND,
|
||||
};
|
||||
|
||||
/** Get Render Command Id */
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "renderer/CCGroupCommand.h"
|
||||
#include "renderer/CCGLProgramCache.h"
|
||||
#include "renderer/ccGLStateCache.h"
|
||||
#include "renderer/CCMeshCommand.h"
|
||||
#include "base/CCConfiguration.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include "base/CCEventDispatcher.h"
|
||||
|
@ -318,6 +319,12 @@ void Renderer::visitRenderQueue(const RenderQueue& queue)
|
|||
auto cmd = static_cast<BatchCommand*>(command);
|
||||
cmd->execute();
|
||||
}
|
||||
else if (RenderCommand::Type::MESH_COMMAND == commandType)
|
||||
{
|
||||
flush();
|
||||
auto cmd = static_cast<MeshCommand*>(command);
|
||||
cmd->execute();
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOGERROR("Unknown commands in renderQueue");
|
||||
|
|
|
@ -268,7 +268,11 @@ void TextureCache::addImageAsyncCallBack(float dt)
|
|||
texture = it->second;
|
||||
}
|
||||
|
||||
asyncStruct->callback(texture);
|
||||
if (asyncStruct->callback)
|
||||
{
|
||||
asyncStruct->callback(texture);
|
||||
}
|
||||
|
||||
if(image)
|
||||
{
|
||||
image->release();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
set(COCOS_RENDERER_SRC
|
||||
renderer/CCBatchCommand.cpp
|
||||
renderer/CCCustomCommand.cpp
|
||||
renderer/CCMeshCommand.cpp
|
||||
renderer/CCGLProgramCache.cpp
|
||||
renderer/CCGLProgram.cpp
|
||||
renderer/CCGLProgramStateCache.cpp
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
const char* cc3D_Color_frag = STRINGIFY(
|
||||
|
||||
\n#ifdef GL_ES\n
|
||||
varying lowp vec4 DestinationColor;
|
||||
\n#else\n
|
||||
varying vec4 DestinationColor;
|
||||
\n#endif\n
|
||||
uniform vec4 u_color;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_FragColor = u_color;
|
||||
}
|
||||
);
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
const char* cc3D_ColorTex_frag = STRINGIFY(
|
||||
|
||||
\n#ifdef GL_ES\n
|
||||
varying mediump vec2 TextureCoordOut;
|
||||
\n#else\n
|
||||
varying vec2 TextureCoordOut;
|
||||
\n#endif\n
|
||||
uniform vec4 u_color;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_FragColor = texture2D(CC_Texture0, TextureCoordOut) * u_color;
|
||||
}
|
||||
);
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
const char* cc3D_PositionTex_vert = STRINGIFY(
|
||||
|
||||
attribute vec4 a_position;
|
||||
attribute vec2 a_texCoord;
|
||||
|
||||
varying vec2 TextureCoordOut;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = CC_MVPMatrix * a_position;
|
||||
TextureCoordOut = a_texCoord;
|
||||
TextureCoordOut.y = 1.0 - TextureCoordOut.y;
|
||||
}
|
||||
);
|
|
@ -70,4 +70,9 @@ NS_CC_BEGIN
|
|||
#include "ccShader_Label_normal.frag"
|
||||
#include "ccShader_Label_outline.frag"
|
||||
|
||||
//
|
||||
#include "ccShader_3D_PositionTex.vert"
|
||||
#include "ccShader_3D_Color.frag"
|
||||
#include "ccShader_3D_ColorTex.frag"
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -69,6 +69,9 @@ extern CC_DLL const GLchar * ccLabelOutline_frag;
|
|||
|
||||
extern CC_DLL const GLchar * ccLabel_vert;
|
||||
|
||||
extern CC_DLL const GLchar * cc3D_PositionTex_vert;
|
||||
extern CC_DLL const GLchar * cc3D_ColorTex_frag;
|
||||
extern CC_DLL const GLchar * cc3D_Color_frag;
|
||||
// end of shaders group
|
||||
/// @}
|
||||
|
||||
|
|
|
@ -250,11 +250,6 @@
|
|||
-- @param self
|
||||
-- @param #color3b_table color3b
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlButton] getColor
|
||||
-- @param self
|
||||
-- @return color3b_table#color3b_table ret (return value: color3b_table)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlButton] onTouchCancelled
|
||||
-- @param self
|
||||
|
@ -267,9 +262,14 @@
|
|||
-- @param #unsigned char char
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlButton] getOpacity
|
||||
-- @function [parent=#ControlButton] updateDisplayedOpacity
|
||||
-- @param self
|
||||
-- @return unsigned char#unsigned char ret (return value: unsigned char)
|
||||
-- @param #unsigned char char
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlButton] updateDisplayedColor
|
||||
-- @param self
|
||||
-- @param #color3b_table color3b
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#ControlButton] onTouchBegan
|
||||
|
|
|
@ -41,6 +41,11 @@
|
|||
-- @param #string str
|
||||
-- @return array_table#array_table ret (return value: array_table)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#FileUtils] getSearchPaths
|
||||
-- @param self
|
||||
-- @return array_table#array_table ret (return value: array_table)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#FileUtils] writeToFile
|
||||
-- @param self
|
||||
|
@ -54,6 +59,16 @@
|
|||
-- @param #string str
|
||||
-- @return map_table#map_table ret (return value: map_table)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#FileUtils] setSearchPaths
|
||||
-- @param self
|
||||
-- @param #array_table array
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#FileUtils] setSearchResolutionsOrder
|
||||
-- @param self
|
||||
-- @param #array_table array
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#FileUtils] addSearchResolutionsOrder
|
||||
-- @param self
|
||||
|
@ -86,6 +101,11 @@
|
|||
-- @param self
|
||||
-- @param #bool bool
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#FileUtils] getSearchResolutionsOrder
|
||||
-- @param self
|
||||
-- @return array_table#array_table ret (return value: array_table)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#FileUtils] getWritablePath
|
||||
-- @param self
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module GLProgramCache
|
||||
-- @extend Ref
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramCache] addGLProgram
|
||||
-- @param self
|
||||
-- @param #cc.GLProgram glprogram
|
||||
-- @param #string str
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramCache] getGLProgram
|
||||
-- @param self
|
||||
-- @param #string str
|
||||
-- @return GLProgram#GLProgram ret (return value: cc.GLProgram)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramCache] reloadDefaultGLPrograms
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramCache] loadDefaultGLPrograms
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramCache] destroyInstance
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramCache] getInstance
|
||||
-- @param self
|
||||
-- @return GLProgramCache#GLProgramCache ret (return value: cc.GLProgramCache)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramCache] GLProgramCache
|
||||
-- @param self
|
||||
|
||||
return nil
|
|
@ -0,0 +1,100 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module GLProgramState
|
||||
-- @extend Ref
|
||||
|
||||
--------------------------------
|
||||
-- overload function: setUniformTexture(string, unsigned int)
|
||||
--
|
||||
-- overload function: setUniformTexture(string, cc.Texture2D)
|
||||
--
|
||||
-- @function [parent=#GLProgramState] setUniformTexture
|
||||
-- @param self
|
||||
-- @param #string str
|
||||
-- @param #cc.Texture2D texture2d
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramState] setUniformMat4
|
||||
-- @param self
|
||||
-- @param #string str
|
||||
-- @param #cc.Mat4 mat4
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramState] getUniformCount
|
||||
-- @param self
|
||||
-- @return long#long ret (return value: long)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramState] setUniformFloat
|
||||
-- @param self
|
||||
-- @param #string str
|
||||
-- @param #float float
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramState] setUniformVec3
|
||||
-- @param self
|
||||
-- @param #string str
|
||||
-- @param #cc.Vec3 vec3
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramState] setGLProgram
|
||||
-- @param self
|
||||
-- @param #cc.GLProgram glprogram
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramState] setUniformVec4
|
||||
-- @param self
|
||||
-- @param #string str
|
||||
-- @param #cc.Vec4 vec4
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramState] getVertexAttribCount
|
||||
-- @param self
|
||||
-- @return long#long ret (return value: long)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramState] setUniformInt
|
||||
-- @param self
|
||||
-- @param #string str
|
||||
-- @param #int int
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramState] setUniformVec2
|
||||
-- @param self
|
||||
-- @param #string str
|
||||
-- @param #cc.Vec2 vec2
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramState] getVertexAttribsFlags
|
||||
-- @param self
|
||||
-- @return unsigned int#unsigned int ret (return value: unsigned int)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramState] apply
|
||||
-- @param self
|
||||
-- @param #cc.Mat4 mat4
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramState] getGLProgram
|
||||
-- @param self
|
||||
-- @return GLProgram#GLProgram ret (return value: cc.GLProgram)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramState] create
|
||||
-- @param self
|
||||
-- @param #cc.GLProgram glprogram
|
||||
-- @return GLProgramState#GLProgramState ret (return value: cc.GLProgramState)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramState] getOrCreateWithGLProgramName
|
||||
-- @param self
|
||||
-- @param #string str
|
||||
-- @return GLProgramState#GLProgramState ret (return value: cc.GLProgramState)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#GLProgramState] getOrCreateWithGLProgram
|
||||
-- @param self
|
||||
-- @param #cc.GLProgram glprogram
|
||||
-- @return GLProgramState#GLProgramState ret (return value: cc.GLProgramState)
|
||||
|
||||
return nil
|
|
@ -0,0 +1,66 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module Mesh
|
||||
-- @extend Ref
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Mesh] restore
|
||||
-- @param self
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Mesh] getMeshVertexAttribCount
|
||||
-- @param self
|
||||
-- @return long#long ret (return value: long)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Mesh] getIndexFormat
|
||||
-- @param self
|
||||
-- @return Mesh::IndexFormat#Mesh::IndexFormat ret (return value: cc.Mesh::IndexFormat)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Mesh] getVertexSizeInBytes
|
||||
-- @param self
|
||||
-- @return int#int ret (return value: int)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Mesh] getPrimitiveType
|
||||
-- @param self
|
||||
-- @return Mesh::PrimitiveType#Mesh::PrimitiveType ret (return value: cc.Mesh::PrimitiveType)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Mesh] getIndexCount
|
||||
-- @param self
|
||||
-- @return long#long ret (return value: long)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Mesh] getVertexBuffer
|
||||
-- @param self
|
||||
-- @return unsigned int#unsigned int ret (return value: unsigned int)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Mesh] getMeshVertexAttribute
|
||||
-- @param self
|
||||
-- @param #int int
|
||||
-- @return MeshVertexAttrib#MeshVertexAttrib ret (return value: cc.MeshVertexAttrib)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Mesh] getIndexBuffer
|
||||
-- @param self
|
||||
-- @return unsigned int#unsigned int ret (return value: unsigned int)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Mesh] hasVertexAttrib
|
||||
-- @param self
|
||||
-- @param #int int
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Mesh] create
|
||||
-- @param self
|
||||
-- @param #array_table array
|
||||
-- @param #array_table array
|
||||
-- @param #array_table array
|
||||
-- @param #array_table vector<short, std::allocator<short> >
|
||||
-- @return Mesh#Mesh ret (return value: cc.Mesh)
|
||||
|
||||
return nil
|
|
@ -0,0 +1,41 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module Sprite3D
|
||||
-- @extend Node,BlendProtocol
|
||||
|
||||
--------------------------------
|
||||
-- overload function: setTexture(cc.Texture2D)
|
||||
--
|
||||
-- overload function: setTexture(string)
|
||||
--
|
||||
-- @function [parent=#Sprite3D] setTexture
|
||||
-- @param self
|
||||
-- @param #string str
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Sprite3D] getMesh
|
||||
-- @param self
|
||||
-- @return Mesh#Mesh ret (return value: cc.Mesh)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Sprite3D] getBlendFunc
|
||||
-- @param self
|
||||
-- @return BlendFunc#BlendFunc ret (return value: cc.BlendFunc)
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#Sprite3D] setBlendFunc
|
||||
-- @param self
|
||||
-- @param #cc.BlendFunc blendfunc
|
||||
|
||||
--------------------------------
|
||||
-- overload function: create(string, string)
|
||||
--
|
||||
-- overload function: create(string)
|
||||
--
|
||||
-- @function [parent=#Sprite3D] create
|
||||
-- @param self
|
||||
-- @param #string str
|
||||
-- @param #string str
|
||||
-- @return Sprite3D#Sprite3D ret (retunr value: cc.Sprite3D)
|
||||
|
||||
return nil
|
|
@ -51,6 +51,11 @@
|
|||
-- @field [parent=#cc] Node#Node Node preloaded module
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- the cc GLProgramState
|
||||
-- @field [parent=#cc] GLProgramState#GLProgramState GLProgramState preloaded module
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- the cc AtlasNode
|
||||
-- @field [parent=#cc] AtlasNode#AtlasNode AtlasNode preloaded module
|
||||
|
@ -1126,6 +1131,11 @@
|
|||
-- @field [parent=#cc] TiledGrid3D#TiledGrid3D TiledGrid3D preloaded module
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- the cc GLProgramCache
|
||||
-- @field [parent=#cc] GLProgramCache#GLProgramCache GLProgramCache preloaded module
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- the cc TextureCache
|
||||
-- @field [parent=#cc] TextureCache#TextureCache TextureCache preloaded module
|
||||
|
@ -1201,6 +1211,16 @@
|
|||
-- @field [parent=#cc] Component#Component Component preloaded module
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- the cc Sprite3D
|
||||
-- @field [parent=#cc] Sprite3D#Sprite3D Sprite3D preloaded module
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- the cc Mesh
|
||||
-- @field [parent=#cc] Mesh#Mesh Mesh preloaded module
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- the cc SimpleAudioEngine
|
||||
-- @field [parent=#cc] SimpleAudioEngine#SimpleAudioEngine SimpleAudioEngine preloaded module
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1543,6 +1543,53 @@ int register_all_cocos2dx(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -340,6 +340,48 @@ bool luaval_to_vec3(lua_State* L,int lo,cocos2d::Vec3* outValue)
|
|||
return ok;
|
||||
}
|
||||
|
||||
bool luaval_to_vec4(lua_State* L,int lo,cocos2d::Vec4* outValue)
|
||||
{
|
||||
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);
|
||||
#endif
|
||||
ok = false;
|
||||
}
|
||||
|
||||
|
||||
if (ok)
|
||||
{
|
||||
lua_pushstring(L, "x");
|
||||
lua_gettable(L, lo);
|
||||
outValue->x = lua_isnil(L, -1) ? 0 : lua_tonumber(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
lua_pushstring(L, "y");
|
||||
lua_gettable(L, lo);
|
||||
outValue->y = lua_isnil(L, -1) ? 0 : lua_tonumber(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
lua_pushstring(L, "z");
|
||||
lua_gettable(L, lo);
|
||||
outValue->y = lua_isnil(L, -1) ? 0 : lua_tonumber(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
lua_pushstring(L, "w");
|
||||
lua_gettable(L, lo);
|
||||
outValue->y = lua_isnil(L, -1) ? 0 : lua_tonumber(L, -1);
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool luaval_to_blendfunc(lua_State* L, int lo, cocos2d::BlendFunc* outValue)
|
||||
{
|
||||
if (nullptr == L || nullptr == outValue)
|
||||
|
@ -1697,6 +1739,129 @@ bool luaval_to_std_vector_int(lua_State* L, int lo, std::vector<int>* ret)
|
|||
return ok;
|
||||
}
|
||||
|
||||
bool luaval_to_mesh_vertex_attrib(lua_State* L, int lo, cocos2d::MeshVertexAttrib* ret)
|
||||
{
|
||||
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);
|
||||
#endif
|
||||
ok = false;
|
||||
}
|
||||
|
||||
|
||||
if (ok)
|
||||
{
|
||||
lua_pushstring(L, "size"); /* L: paramStack key */
|
||||
lua_gettable(L,lo); /* L: paramStack paramStack[lo][key] */
|
||||
ret->size = (GLint)lua_tonumber(L, -1);
|
||||
lua_pop(L,1);
|
||||
|
||||
lua_pushstring(L, "type"); /* L: paramStack key */
|
||||
lua_gettable(L,lo); /* L: paramStack paramStack[lo][key] */
|
||||
ret->type = (GLenum)lua_tonumber(L, -1);
|
||||
lua_pop(L,1);
|
||||
|
||||
lua_pushstring(L, "vertexAttrib"); /* L: paramStack key */
|
||||
lua_gettable(L,lo); /* L: paramStack paramStack[lo][key] */
|
||||
ret->type = (GLenum)lua_tonumber(L, -1);
|
||||
lua_pop(L,1);
|
||||
|
||||
lua_pushstring(L, "vertexAttrib"); /* L: paramStack key */
|
||||
lua_gettable(L,lo); /* L: paramStack paramStack[lo][key] */
|
||||
ret->type = (GLenum)lua_tonumber(L, -1);
|
||||
lua_pop(L,1);
|
||||
}
|
||||
|
||||
return ok;
|
||||
|
||||
}
|
||||
|
||||
bool luaval_to_std_vector_float(lua_State* L, int lo, std::vector<float>* ret)
|
||||
{
|
||||
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);
|
||||
#endif
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (ok)
|
||||
{
|
||||
size_t len = lua_objlen(L, lo);
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
lua_pushnumber(L, i + 1);
|
||||
lua_gettable(L,lo);
|
||||
if(lua_isnumber(L, -1))
|
||||
{
|
||||
ret->push_back((float)tolua_tonumber(L, -1, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
CCASSERT(false, "float type is needed");
|
||||
}
|
||||
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
bool luaval_to_std_vector_ushort(lua_State* L, int lo, std::vector<unsigned short>* ret)
|
||||
{
|
||||
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);
|
||||
#endif
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (ok)
|
||||
{
|
||||
size_t len = lua_objlen(L, lo);
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
lua_pushnumber(L, i + 1);
|
||||
lua_gettable(L,lo);
|
||||
if(lua_isnumber(L, -1))
|
||||
{
|
||||
ret->push_back((unsigned short)tolua_tonumber(L, -1, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
CCASSERT(false, "unsigned short 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)
|
||||
|
@ -1741,6 +1906,26 @@ void vec3_to_luaval(lua_State* L,const cocos2d::Vec3& vec3)
|
|||
lua_rawset(L, -3);
|
||||
}
|
||||
|
||||
void vec4_to_luaval(lua_State* L,const cocos2d::Vec4& vec3)
|
||||
{
|
||||
if (NULL == L)
|
||||
return;
|
||||
|
||||
lua_newtable(L); /* L: table */
|
||||
lua_pushstring(L, "x"); /* L: table key */
|
||||
lua_pushnumber(L, (lua_Number) vec3.x); /* L: table key value*/
|
||||
lua_rawset(L, -3); /* table[key] = value, L: table */
|
||||
lua_pushstring(L, "y"); /* L: table key */
|
||||
lua_pushnumber(L, (lua_Number) vec3.y); /* L: table key value*/
|
||||
lua_rawset(L, -3);
|
||||
lua_pushstring(L, "z"); /* L: table key */
|
||||
lua_pushnumber(L, (lua_Number) vec3.z); /* L: table key value*/
|
||||
lua_rawset(L, -3);
|
||||
lua_pushstring(L, "w"); /* L: table key */
|
||||
lua_pushnumber(L, (lua_Number) vec3.z); /* L: table key value*/
|
||||
lua_rawset(L, -3);
|
||||
}
|
||||
|
||||
void physics_material_to_luaval(lua_State* L,const PhysicsMaterial& pm)
|
||||
{
|
||||
if (nullptr == L)
|
||||
|
@ -2476,3 +2661,97 @@ void ttfconfig_to_luaval(lua_State* L, const cocos2d::TTFConfig& config)
|
|||
lua_pushnumber(L, (lua_Number)config.outlineSize);
|
||||
lua_rawset(L, -3);
|
||||
}
|
||||
|
||||
void mesh_vertex_attrib_to_luaval(lua_State* L, const cocos2d::MeshVertexAttrib& inValue)
|
||||
{
|
||||
if (nullptr == L)
|
||||
return;
|
||||
|
||||
lua_newtable(L);
|
||||
|
||||
lua_pushstring(L, "size");
|
||||
lua_pushnumber(L, (lua_Number)inValue.size);
|
||||
lua_rawset(L, -3);
|
||||
|
||||
lua_pushstring(L, "type");
|
||||
lua_pushnumber(L, (lua_Number)inValue.type);
|
||||
lua_rawset(L, -3);
|
||||
|
||||
lua_pushstring(L, "vertexAttrib");
|
||||
lua_pushnumber(L, (lua_Number)inValue.vertexAttrib);
|
||||
lua_rawset(L, -3);
|
||||
|
||||
lua_pushstring(L, "attribSizeBytes");
|
||||
lua_pushnumber(L, (lua_Number)inValue.attribSizeBytes);
|
||||
lua_rawset(L, -3);
|
||||
}
|
||||
|
||||
|
||||
void ccvector_std_string_to_luaval(lua_State* L, const std::vector<std::string>& inValue)
|
||||
{
|
||||
if (nullptr == L)
|
||||
return;
|
||||
|
||||
lua_newtable(L);
|
||||
|
||||
int index = 1;
|
||||
|
||||
for (const std::string value : inValue)
|
||||
{
|
||||
lua_pushnumber(L, (lua_Number)index);
|
||||
lua_pushstring(L, value.c_str());
|
||||
lua_rawset(L, -3);
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
void ccvector_int_to_luaval(lua_State* L, const std::vector<int>& inValue)
|
||||
{
|
||||
if (nullptr == L)
|
||||
return;
|
||||
|
||||
lua_newtable(L);
|
||||
|
||||
int index = 1;
|
||||
for (const int value : inValue)
|
||||
{
|
||||
lua_pushnumber(L, (lua_Number)index);
|
||||
lua_pushnumber(L, (lua_Number)value);
|
||||
lua_rawset(L, -3);
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
void ccvector_float_to_luaval(lua_State* L, const std::vector<float>& inValue)
|
||||
{
|
||||
if (nullptr == L)
|
||||
return;
|
||||
|
||||
lua_newtable(L);
|
||||
|
||||
int index = 1;
|
||||
for (const float value : inValue)
|
||||
{
|
||||
lua_pushnumber(L, (lua_Number)index);
|
||||
lua_pushnumber(L, (lua_Number)value);
|
||||
lua_rawset(L, -3);
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
void ccvector_ushort_to_luaval(lua_State* L, const std::vector<unsigned short>& inValue)
|
||||
{
|
||||
if (nullptr == L)
|
||||
return;
|
||||
|
||||
lua_newtable(L);
|
||||
|
||||
int index = 1;
|
||||
for (const unsigned short value : inValue)
|
||||
{
|
||||
lua_pushnumber(L, (lua_Number)index);
|
||||
lua_pushnumber(L, (lua_Number)value);
|
||||
lua_rawset(L, -3);
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ extern bool luavals_variadic_to_array(lua_State* L,int argc, __Array** ret);
|
|||
extern bool luavals_variadic_to_ccvaluevector(lua_State* L, int argc, cocos2d::ValueVector* ret);
|
||||
extern bool luaval_to_vec2(lua_State* L,int lo,cocos2d::Vec2* outValue);
|
||||
extern bool luaval_to_vec3(lua_State* L,int lo,cocos2d::Vec3* outValue);
|
||||
extern bool luaval_to_vec4(lua_State* L,int lo,cocos2d::Vec4* outValue);
|
||||
extern bool luaval_to_blendfunc(lua_State* L, int lo, cocos2d::BlendFunc* outValue);
|
||||
extern bool luaval_to_ttfconfig(lua_State* L, int lo, cocos2d::TTFConfig* outValue);
|
||||
|
||||
|
@ -228,10 +229,14 @@ bool luaval_to_object(lua_State* L, int lo, const char* type, T** ret)
|
|||
return true;
|
||||
}
|
||||
|
||||
extern bool luaval_to_mesh_vertex_attrib(lua_State* L, int lo, cocos2d::MeshVertexAttrib* ret);
|
||||
extern bool luaval_to_std_vector_float(lua_State* L, int lo, std::vector<float>* ret);
|
||||
extern bool luaval_to_std_vector_ushort(lua_State* L, int lo, std::vector<unsigned short>* ret);
|
||||
|
||||
// from native
|
||||
extern void vec2_to_luaval(lua_State* L,const cocos2d::Vec2& vec2);
|
||||
extern void vec3_to_luaval(lua_State* L,const cocos2d::Vec3& vec3);
|
||||
extern void vec4_to_luaval(lua_State* L,const cocos2d::Vec4& vec3);
|
||||
extern void vec2_array_to_luaval(lua_State* L,const cocos2d::Vec2* points, int count);
|
||||
extern void size_to_luaval(lua_State* L,const Size& sz);
|
||||
extern void rect_to_luaval(lua_State* L,const Rect& rt);
|
||||
|
@ -372,4 +377,10 @@ void object_to_luaval(lua_State* L,const char* type, T* ret)
|
|||
}
|
||||
}
|
||||
|
||||
void mesh_vertex_attrib_to_luaval(lua_State* L, const cocos2d::MeshVertexAttrib& inValue);
|
||||
void ccvector_std_string_to_luaval(lua_State* L, const std::vector<std::string>& inValue);
|
||||
void ccvector_int_to_luaval(lua_State* L, const std::vector<int>& inValue);
|
||||
void ccvector_float_to_luaval(lua_State* L, const std::vector<float>& inValue);
|
||||
void ccvector_ushort_to_luaval(lua_State* L, const std::vector<unsigned short>& inValue);
|
||||
|
||||
#endif //__COCOS2DX_SCRIPTING_LUA_COCOS2DXSUPPORT_LUABAISCCONVERSIONS_H__
|
||||
|
|
|
@ -1447,7 +1447,7 @@ static int tolua_Cocos2d_glDrawElements00(lua_State* tolua_S)
|
|||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
|
||||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
|
||||
!tolua_isnumber(tolua_S,4,0,&tolua_err) ||
|
||||
!tolua_istable(tolua_S,5,0,&tolua_err) ||
|
||||
!tolua_istable(tolua_S,5,1,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,6, &tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
|
@ -1460,45 +1460,70 @@ static int tolua_Cocos2d_glDrawElements00(lua_State* tolua_S)
|
|||
unsigned int arg3 = (unsigned int)tolua_tonumber(tolua_S, 4, 0);
|
||||
if (GL_UNSIGNED_BYTE == arg2)
|
||||
{
|
||||
unsigned char* unit8Array = new unsigned char[arg3];
|
||||
if (NULL == unit8Array)
|
||||
if (arg3 > 0)
|
||||
{
|
||||
return 0;
|
||||
unsigned char* unit8Array = new unsigned char[arg3];
|
||||
if (NULL == unit8Array)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
for (unsigned int i = 1; i <= arg3; i++)
|
||||
{
|
||||
unit8Array[i-1] = (unsigned char)tolua_tofieldnumber(tolua_S, 5, i, 0);
|
||||
}
|
||||
glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , (GLvoid*)unit8Array);
|
||||
CC_SAFE_DELETE_ARRAY(unit8Array);
|
||||
|
||||
}
|
||||
for (unsigned int i = 1; i <= arg3; i++)
|
||||
else
|
||||
{
|
||||
unit8Array[i-1] = (unsigned char)tolua_tofieldnumber(tolua_S, 5, i, 0);
|
||||
glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , nullptr);
|
||||
}
|
||||
glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , (GLvoid*)unit8Array);
|
||||
CC_SAFE_DELETE_ARRAY(unit8Array);
|
||||
}
|
||||
else if(GL_UNSIGNED_SHORT == arg2)
|
||||
{
|
||||
unsigned short* shortArray = new unsigned short[arg3];
|
||||
if (NULL == shortArray)
|
||||
if (arg3 > 0)
|
||||
{
|
||||
return 0;
|
||||
unsigned short* shortArray = new unsigned short[arg3];
|
||||
if (NULL == shortArray)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
for (unsigned int i = 1; i <= arg3; i++)
|
||||
{
|
||||
shortArray[i-1] = (unsigned short)tolua_tofieldnumber(tolua_S, 5, i, 0);
|
||||
}
|
||||
|
||||
glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , (GLvoid*)shortArray);
|
||||
|
||||
CC_SAFE_DELETE_ARRAY(shortArray);
|
||||
}
|
||||
for (unsigned int i = 1; i <= arg3; i++)
|
||||
else
|
||||
{
|
||||
shortArray[i-1] = (unsigned short)tolua_tofieldnumber(tolua_S, 5, i, 0);
|
||||
glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , nullptr);
|
||||
}
|
||||
glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , (GLvoid*)shortArray);
|
||||
CC_SAFE_DELETE_ARRAY(shortArray);
|
||||
}
|
||||
else if(GL_UNSIGNED_INT == arg2)
|
||||
{
|
||||
unsigned int* intArray = new unsigned int[arg3];
|
||||
if (NULL == intArray)
|
||||
if (arg3 > 0)
|
||||
{
|
||||
return 0;
|
||||
unsigned int* intArray = new unsigned int[arg3];
|
||||
if (NULL == intArray)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
for (unsigned int i = 1; i <= arg3; i++)
|
||||
{
|
||||
intArray[i-1] = (unsigned int)tolua_tofieldnumber(tolua_S, 5, i, 0);
|
||||
}
|
||||
glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , (GLvoid*)intArray);
|
||||
CC_SAFE_DELETE_ARRAY(intArray);
|
||||
}
|
||||
for (unsigned int i = 1; i <= arg3; i++)
|
||||
else
|
||||
{
|
||||
intArray[i-1] = (unsigned int)tolua_tofieldnumber(tolua_S, 5, i, 0);
|
||||
glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , nullptr);
|
||||
|
||||
}
|
||||
glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , (GLvoid*)intArray);
|
||||
CC_SAFE_DELETE_ARRAY(intArray);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -5296,6 +5296,80 @@ static void extendConsole(lua_State* tolua_S)
|
|||
lua_pop(tolua_S, 1);
|
||||
}
|
||||
|
||||
static int lua_cocos2dx_GLProgramState_setVertexAttribPointer(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::GLProgramState* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_setVertexAttribPointer'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 6)
|
||||
{
|
||||
std::string arg0;
|
||||
int arg1;
|
||||
unsigned int arg2;
|
||||
bool arg3;
|
||||
int arg4;
|
||||
int arg5;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1);
|
||||
|
||||
ok &= luaval_to_uint32(tolua_S, 4,&arg2);
|
||||
|
||||
ok &= luaval_to_boolean(tolua_S, 5, &arg3);
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 6,(int *)&arg4);
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 7, (int *)&arg5);
|
||||
|
||||
if(!ok)
|
||||
return 0;
|
||||
cobj->setVertexAttribPointer(arg0, arg1, arg2, arg3, arg4, (void*)arg5);
|
||||
return 0;
|
||||
}
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setVertexAttribPointer",argc, 6);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_setVertexAttribPointer'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void extendGLProgramState(lua_State* tolua_S)
|
||||
{
|
||||
lua_pushstring(tolua_S, "cc.GLProgramState");
|
||||
lua_rawget(tolua_S, LUA_REGISTRYINDEX);
|
||||
if (lua_istable(tolua_S,-1))
|
||||
{
|
||||
tolua_function(tolua_S,"setVertexAttribPointer", lua_cocos2dx_GLProgramState_setVertexAttribPointer);
|
||||
}
|
||||
lua_pop(tolua_S, 1);
|
||||
}
|
||||
|
||||
int register_all_cocos2dx_manual(lua_State* tolua_S)
|
||||
{
|
||||
if (NULL == tolua_S)
|
||||
|
@ -5344,5 +5418,7 @@ int register_all_cocos2dx_manual(lua_State* tolua_S)
|
|||
extendLabel(tolua_S);
|
||||
extendTMXTiledMap(tolua_S);
|
||||
extendConsole(tolua_S);
|
||||
extendGLProgramState(tolua_S);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#ifndef __TestCpp__GUIDefine__
|
||||
#define __TestCpp__GUIDefine__
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include <string>
|
||||
#include "cocostudio/ObjectFactory.h"
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CocosGUI.h"
|
||||
#include "ui/UIHelper.h"
|
||||
#include "ui/UIWidget.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
|
|
@ -25,9 +25,14 @@ THE SOFTWARE.
|
|||
#ifndef __UIHELPER_H__
|
||||
#define __UIHELPER_H__
|
||||
|
||||
#include <string>
|
||||
#include "base/CCPlatformMacros.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace ui {
|
||||
|
||||
class Widget;
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
/**
|
||||
* create a imageview
|
||||
*
|
||||
* @param fileName file name of texture.
|
||||
* @param imageFileName file name of texture.
|
||||
*
|
||||
* @param texType @see UI_TEX_TYPE_LOCAL
|
||||
*/
|
||||
|
@ -84,7 +84,7 @@ public:
|
|||
/**
|
||||
* Sets if imageview is using scale9 renderer.
|
||||
*
|
||||
* @param true that using scale9 renderer, false otherwise.
|
||||
* @param able true that using scale9 renderer, false otherwise.
|
||||
*/
|
||||
void setScale9Enabled(bool able);
|
||||
|
||||
|
|
|
@ -705,7 +705,7 @@ bool Layout::isClippingEnabled()
|
|||
|
||||
void Layout::visit(Renderer *renderer, const Mat4 &parentTransform, bool parentTransformUpdated)
|
||||
{
|
||||
if (!_enabled)
|
||||
if (!_visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ protected:
|
|||
virtual Vector<Node*>& getChildren() override{return ScrollView::getChildren();};
|
||||
virtual const Vector<Node*>& getChildren() const override{return ScrollView::getChildren();};
|
||||
virtual ssize_t getChildrenCount() const override {return ScrollView::getChildrenCount();};
|
||||
virtual Node * getChildByTag(int tag) override {return ScrollView::getChildByTag(tag);};
|
||||
virtual Node * getChildByTag(int tag) const override {return ScrollView::getChildByTag(tag);};
|
||||
virtual Widget* getChildByName(const std::string& name) override {return ScrollView::getChildByName(name);};
|
||||
void updateInnerContainerSize();
|
||||
void remedyLayoutParameter(Widget* item);
|
||||
|
|
|
@ -183,7 +183,7 @@ protected:
|
|||
virtual Vector<Node*>& getChildren() override{return Widget::getChildren();};
|
||||
virtual const Vector<Node*>& getChildren() const override{return Widget::getChildren();};
|
||||
virtual ssize_t getChildrenCount() const override {return Widget::getChildrenCount();};
|
||||
virtual Node * getChildByTag(int tag) override {return Widget::getChildByTag(tag);};
|
||||
virtual Node * getChildByTag(int tag) const override {return Widget::getChildByTag(tag);};
|
||||
virtual Widget* getChildByName(const std::string& name) override {return Widget::getChildByName(name);};
|
||||
|
||||
Layout* createPage();
|
||||
|
|
|
@ -301,7 +301,7 @@ ssize_t ScrollView::getChildrenCount() const
|
|||
return _innerContainer->getChildrenCount();
|
||||
}
|
||||
|
||||
Node* ScrollView::getChildByTag(int tag)
|
||||
Node* ScrollView::getChildByTag(int tag) const
|
||||
{
|
||||
return _innerContainer->getChildByTag(tag);
|
||||
}
|
||||
|
|
|
@ -296,7 +296,7 @@ public:
|
|||
|
||||
virtual ssize_t getChildrenCount() const override;
|
||||
|
||||
virtual Node * getChildByTag(int tag) override;
|
||||
virtual Node * getChildByTag(int tag) const override;
|
||||
|
||||
virtual Widget* getChildByName(const std::string& name) override;
|
||||
|
||||
|
|
|
@ -147,6 +147,7 @@ void Text::setFontName(const std::string& name)
|
|||
{
|
||||
TTFConfig config = _labelRenderer->getTTFConfig();
|
||||
config.fontFilePath = name;
|
||||
config.fontSize = _fontSize;
|
||||
_labelRenderer->setTTFConfig(config);
|
||||
_type = Type::TTF;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
/**
|
||||
* Gets the string value of label.
|
||||
*
|
||||
* @return text string value.
|
||||
* @return string value.
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE const std::string& getStringValue(){ return this->getString();}
|
||||
const std::string& getString()const;
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
/**
|
||||
* Sets the font size of label.
|
||||
*
|
||||
* @param font size.
|
||||
* @param size font size.
|
||||
*/
|
||||
void setFontSize(int size);
|
||||
|
||||
|
@ -113,7 +113,7 @@ public:
|
|||
* Usage: Text *text = Text::create("Hello", "Arial", 20); //create a system font UIText
|
||||
* text->setFontName("Marfelt"); // it will change the font to system font no matter the previous font type is TTF or system font
|
||||
* text->setFontName("xxxx/xxx.ttf"); //it will change the font to TTF font no matter the previous font type is TTF or system font
|
||||
* @param font name.
|
||||
* @param name font name.
|
||||
*/
|
||||
void setFontName(const std::string& name);
|
||||
|
||||
|
@ -124,7 +124,7 @@ public:
|
|||
/**
|
||||
* Sets the touch scale enabled of label.
|
||||
*
|
||||
* @param touch scale enabled of label.
|
||||
* @param enabled touch scale enabled of label.
|
||||
*/
|
||||
void setTouchScaleChangeEnabled(bool enabled);
|
||||
|
||||
|
|
|
@ -1,61 +1,31 @@
|
|||
# cocos2d-x v3.0 Release Notes #
|
||||
# cocos2d-x v3.1 Release Notes #
|
||||
|
||||
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
|
||||
|
||||
- [cocos2d-x v3.0 Release Notes](#user-content-cocos2d-x-v30-release-notes)
|
||||
- [Misc Information](#user-content-misc-information)
|
||||
- [Requirements](#user-content-requirements)
|
||||
- [Runtime Requirements](#user-content-runtime-requirements)
|
||||
- [Compiler Requirements](#user-content-compiler-requirements)
|
||||
- [How to run tests](#user-content-how-to-run-tests)
|
||||
- [Mac OSX & iOS](#user-content-mac-osx--ios)
|
||||
- [Android](#user-content-android)
|
||||
- [Windows](#user-content-windows)
|
||||
- [Linux](#user-content-linux)
|
||||
- [How to start a new game](#user-content-how-to-start-a-new-game)
|
||||
- [Highlights of v3.0](#user-content-highlights-of-v30)
|
||||
- [Highlights of v3.1](#user-content-highlights-of-v31)
|
||||
- [Features in detail](#user-content-features-in-detail)
|
||||
- [C++11 features](#user-content-c11-features)
|
||||
- [std::function](#user-content-stdfunction)
|
||||
- [Strongly typed enums](#user-content-strongly-typed-enums)
|
||||
- [override](#user-content-override)
|
||||
- [Removed Objective-C patterns](#user-content-removed-objective-c-patterns)
|
||||
- [No more 'CC' prefix for C++ classes and free functions](#user-content-no-more-cc-prefix-for-c-classes-and-free-functions)
|
||||
- [clone() instead of copy()](#user-content-clone-instead-of-copy)
|
||||
- [Singletons use getInstance() and destroyInstance()](#user-content-singletons-use-getinstance-and-destroyinstance)
|
||||
- [Object is replaced with Ref](#user-content-object-is-replaced-with-ref)
|
||||
- [getters](#user-content-getters)
|
||||
- [POD types](#user-content-pod-types)
|
||||
- [New Renderer](#user-content-new-renderer)
|
||||
- [Renderer features](#user-content-renderer-features)
|
||||
- [Auto-batching](#user-content-auto-batching)
|
||||
- [Auto-culling](#user-content-auto-culling)
|
||||
- [Global Z order](#user-content-global-z-order)
|
||||
- [Sprite vs. SpriteBatchNode](#user-content-sprite-vs-spritebatchnode)
|
||||
- [Improved LabelTTF / LabelBMFont / LabelAtlas](#user-content-improved-labelttf--labelbmfont--labelatlas)
|
||||
- [New EventDispatcher](#user-content-new-eventdispatcher)
|
||||
- [Physics Integration](#user-content-physics-integration)
|
||||
- [Sprite3D](#user-content-sprite3d)
|
||||
- [Improved Shader Subsystem](#user-content-improved-shader-subsystem)
|
||||
- [New math library](#user-content-new-math-library)
|
||||
- [New UIVideoPlayer](#user-content-new-uivideoplayer)
|
||||
- [UI navigation](#user-content-ui-navigation)
|
||||
- [Improved folder structure](#user-content-improved-folder-structure)
|
||||
- [Particle System fixes](#user-content-particle-system-fixes)
|
||||
- [Misc API Changes](#user-content-misc-api-changes)
|
||||
- [ccTypes.h](#user-content-cctypesh)
|
||||
- [deprecated functions and global variables](#user-content-deprecated-functions-and--global-variables)
|
||||
- [Changes in the Lua bindings](#user-content-changes-in-the-lua-bindings)
|
||||
- [Use bindings-generator tool for lua binding](#user-content-use-bindings-generator-tool-for-lua-binding)
|
||||
- [Bind the classes with namespace to lua](#user-content-bind-the-classes-with-namespace-to-lua)
|
||||
- [Use ScriptHandlerMgr to manage the register and unregister of Lua function](#user-content-use-scripthandlermgr-to-manage-the-register-and-unregister-of-lua-function)
|
||||
- [Misc API changes](#user-content-misc-api-changes-1)
|
||||
- [Use cc、ccs、ccui gl and sp as module name](#user-content-use-ccccsccui-gl-and-sp-as-module-name)
|
||||
- [Modified functions](#user-content-modified-functions)
|
||||
- [Add some modules](#user-content-add-some-modules)
|
||||
- [Add more lua bindings](#user-content-add-more-lua-bindings)
|
||||
- [Replace some lua-bindings of Class or Struct with lua table](#user-content-replace-some-lua-bindings-of-class-or-struct-with-lua-table)
|
||||
- [Support lua script codes call Object-C codes and Java codes](#user-content-support-lua-script-codes-call-object-c-codes-and-java-codes)
|
||||
- [Add some lua files to store the constants of different modules](#user-content-add-some-lua-files-to-store-the-constants-of-different-modules)
|
||||
|
||||
# Misc Information
|
||||
|
||||
* Download: http://cdn.cocos2d-x.org/cocos2d-x-3.0beta.zip
|
||||
* Full Changelog: https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.0beta/CHANGELOG
|
||||
* API Reference: http://www.cocos2d-x.org/reference/native-cpp/V3.0beta/index.html
|
||||
* Download: http://cdn.cocos2d-x.org/cocos2d-x-3.1rc0.zip
|
||||
* Full Changelog: https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.1rc0/CHANGELOG
|
||||
* ~~API Reference: http://www.cocos2d-x.org/reference/native-cpp/V3.0/index.html~~
|
||||
* v3.0 Release Notes can be found here: [v3.0 Release Notes](https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.0/docs/RELEASE_NOTES.md)
|
||||
|
||||
# Requirements
|
||||
|
||||
|
@ -65,15 +35,17 @@
|
|||
* iOS 5.0 or newer
|
||||
* OS X 10.7 or newer
|
||||
* Windows 7 or newer
|
||||
* Windows Phone 8 or newer (initail version)
|
||||
* Linux Ubuntu 12.04 (or newer)
|
||||
* Windows Phone 8 or newer
|
||||
* Linux Ubuntu 12.04 or newer
|
||||
* ~~Browsers via Emscripten~~ N/A for the moment
|
||||
|
||||
## Compiler Requirements
|
||||
|
||||
* Xcode 4.6 (for iOS or Mac)
|
||||
* gcc 4.7 for Linux or Android. For Android ndk-r9 or newer is required.
|
||||
* Visual Studio 2012 (for Windows)
|
||||
* Xcode 4.6 or newer for iOS or Mac
|
||||
* gcc 4.7 or newer for Linux
|
||||
* gcc 4.7 and ndk-r9 or newer for Android
|
||||
* Visual Studio 2012 or newer for Windows (win32)
|
||||
* Visual Studio 2012 or newer for Windows Phone 8
|
||||
|
||||
## How to run tests
|
||||
|
||||
|
@ -137,630 +109,260 @@ Run
|
|||
|
||||
## How to start a new game
|
||||
|
||||
Please refer to [ReadMe](../README.md). And there is a [document](https://github.com/chukong/cocos-docs/blob/master/manual/framework/native/getting-started/v3.0/how-to-start-a-new-game/en.md) for it.
|
||||
|
||||
Please refer to this document: [ReadMe](../README.md)
|
||||
|
||||
# Highlights of v3.0
|
||||
# Highlights of v3.1
|
||||
|
||||
* `Sprite3D`, a new node to render 3D models
|
||||
* Improved Shader subsystem
|
||||
* New, unified, math library
|
||||
* `ui::VideoPlayer`, a new node to play videos
|
||||
|
||||
* Replaced Objective-C patterns with C++ (C++11) patterns and best practices
|
||||
* Improved Labels
|
||||
* Improved renderer (much faster than in v2.2!!)
|
||||
* New Event Dispatcher
|
||||
* Physics integration
|
||||
* New UI objects
|
||||
* [JavaScript remote debugger](https://github.com/cocos2d/cocos-docs/blob/master/manual/framework/native/scripting/javascript/js-remote-debugger/en.md)
|
||||
* Remote Console support
|
||||
* Use [cocos console](https://github.com/cocos2d/cocos2d-console) to create and run project
|
||||
* Refactor Image - release memory in time and uniform the api of supported file format
|
||||
* Automatically generated Lua bindings, add LuaJavaBridge and LuaObjcBridge
|
||||
* Templated containers
|
||||
* `CCDictionary` is replaced by `cocos2d::Map<>`, [usage](https://github.com/cocos2d/cocos-docs/blob/master/manual/framework/native/data-structure/v3/map/en.md)
|
||||
* `CCArray` is replaced by `cocos2d::Vector<>`, [usage](https://github.com/cocos2d/cocos-docs/blob/master/manual/framework/native/data-structure/v3/vector/en.md)
|
||||
* `CCBool`, `CCFLoat`, `CCDouble` are replaced with `cocos2d::Value`, [usage](https://github.com/cocos2d/cocos-docs/blob/master/manual/framework/native/data-structure/v3/value/en.md)
|
||||
|
||||
# Features in detail
|
||||
|
||||
## C++11 features
|
||||
## Sprite3D
|
||||
|
||||
_Feature added in v3.0-pre-alpha0_
|
||||
cocos2d-x v3.0 replaced `Node`'s 2x3 transform matrix with a 4x4 one. This feature allows you to transform any node in a 3d space.
|
||||
|
||||
A subset of C++11 features are being used in cocos2d-x:
|
||||
`Sprite3D` allows users to render a 3d model inside cocos2d. And since cocos2d-x already has 4x4 transform matrix, it is possible to move scale and rotate the `Sprite3D` in the x, y, and z axis.
|
||||
|
||||
* `std::function`, including lambda objects for callbacks
|
||||
* strongly typed enums, for most of the cocos2d-x enums and constants
|
||||
* `std::thread` for threading
|
||||
* `override` and `final` context keywords, for overriden and final methods
|
||||
The API is like `Sprite`:
|
||||
|
||||
```c++
|
||||
// v3.1 only supports the Wavefront file format
|
||||
auto sprite3d = Sprite3D::create("mymodel.obj");
|
||||
|
||||
### std::function
|
||||
// if the material is not specified in .obj, you can override it with:
|
||||
auto sprite3d = Sprite3D::create("mymodel.obj", "texture.png");
|
||||
|
||||
* `CallFunc` can be created with an `std::function<void()>`
|
||||
* `CallFuncN` can be created with an `std::function<void(Node*)>`
|
||||
* `CallFuncND` and `CallFuncO` were removed since it can be created with simulated with `CallFuncN` and `CallFunc`. See ActionsTest.cpp for more examples
|
||||
* `MenuItem` supports `std::function<void(Node*)>` as callbacks
|
||||
|
||||
`CallFunc` example:
|
||||
|
||||
```cpp
|
||||
// in v2.1
|
||||
CCCallFunc *action1 = CCCallFunc::create( this, callfunc_selector( MyClass::callback_0 ) );
|
||||
|
||||
// in v3.0 (short version)
|
||||
auto action1 = CallFunc::create( CC_CALLBACK_0(MyClass::callback_0,this));
|
||||
auto action2 = CallFunc::create( CC_CALLBACK_0(MyClass::callback_1,this, additional_parameters));
|
||||
|
||||
// in v3.0 (long version)
|
||||
auto action1 = CallFunc::create( std::bind( &MyClass::callback_0, this));
|
||||
auto action2 = CallFunc::create( std::bind( &MyClass::callback_1, this, additional_parameters));
|
||||
|
||||
// in v3.0 you can also use lambdas or any other "Function" object
|
||||
auto action1 = CallFunc::create(
|
||||
[&](){
|
||||
auto s = Director::sharedDirector()->getWinSize();
|
||||
auto label = LabelTTF::create("called:lambda callback", "Marker Felt", 16);
|
||||
label->setPosition(ccp( s.width/4*1,s.height/2-40));
|
||||
this->addChild(label);
|
||||
} );
|
||||
// Since Sprite3D is a regular node, you can add it into the scene like any other node
|
||||
scene->addChild(sprite3d);
|
||||
sprite3d->setRotation3D(Vec3(x,y,z));
|
||||
```
|
||||
|
||||
`MenuItem` example:
|
||||
## Improved Shader Subsystem
|
||||
|
||||
```cpp
|
||||
// in v2.1
|
||||
CCMenuItemLabel *item = CCMenuItemLabel::create(label, this, menu_selector(MyClass::callback));
|
||||
In order to support `Sprite3D`, we refactored our shader subsystem. The result is that we have an easier to use, yet more powerful shader system that can be used both for 2D and 3D.
|
||||
|
||||
// in v3.0 (short version)
|
||||
auto item = MenuItemLabel::create(label, CC_CALLBACK_1(MyClass::callback, this));
|
||||
|
||||
// in v3.0 (long version)
|
||||
auto item = MenuItemLabel::create(label, std::bind(&MyClass::callback, this, std::placeholders::_1));
|
||||
In v3.0, the class `GLProgram` was used both for holdin the _OpenGL program_ (shader), and also the shader state (uniforms and attributes).
|
||||
|
||||
// in v3.0 you can use lambdas or any other "Function" object
|
||||
auto item = MenuItemLabel::create(label,
|
||||
[&](Object *sender) {
|
||||
// do something. Item "sender" clicked
|
||||
});
|
||||
That design had one big constraint: In order to add or remove an attribute or uniform, you had to subclass `GLProgram`.
|
||||
|
||||
In v3.1, we decoupled the shader state from the shader. We added the `GLProgramState` class which holds the attributes and uniforms.
|
||||
|
||||
The API is the following:
|
||||
|
||||
```c++
|
||||
auto glprogram = GLProgram::create(...);
|
||||
|
||||
// it will automatically parse all the attributes and uniforms
|
||||
// used by glprogram, and it will populate the glprogramstate dictionary
|
||||
// with them
|
||||
auto glprogramstate = GLProgramState::create( glprogram );
|
||||
|
||||
// How to set a uniform for Vec2 (Int, Texture, Vec3, Vec4, Mat4, are all supported)
|
||||
glprogramstate->setUniformVec2("u_my_uniform", Vec2(x,y));
|
||||
// or how to set it using a callback
|
||||
glprogramstate->setUniformCallback("u_my_uniform", [](Uniform*uniform){
|
||||
// do something
|
||||
});
|
||||
|
||||
// How to set an attribute
|
||||
glprogramstate->setVertexAttribPointer("a_my_attrib", 4, GL_FLOAT, GL_FALSE, 0, vertex);
|
||||
// or how to set it using a callback
|
||||
glprogramstate->setVertexAttribCallback("a_my_attrib", [](VertexAttrib*attrib){
|
||||
// do something
|
||||
});
|
||||
```
|
||||
|
||||
### Strongly typed enums
|
||||
By using this API it is possible to change the effect on a `Sprite3D` (or even an `Sprite`) without subclassing any cocos2d class!
|
||||
|
||||
_Feature added in v3.0-pre-alpha0_
|
||||
Possible examples:
|
||||
|
||||
Constants and enums that started with `k`, and that usually were defined as `int` or as simple `enum` where replaced with strongly typed enums ( `enum class` ) to prevent collisions and type errors.
|
||||
The new format is:
|
||||
- Outline / Shadow / Glow effects
|
||||
- Multi-texturing effects
|
||||
- Sepia, Grey or other color effects
|
||||
- and more
|
||||
|
||||
For a complete example, please see the [Shader - Sprite](https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.1rc0/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp) and [Shader - Basic](https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.1rc0/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp) examples.
|
||||
|
||||
| v2.1 | v3.0 |
|
||||
| kTypeValue | Type::VALUE |
|
||||
|
||||
Examples:
|
||||
|
||||
| v2.1 | v3.0 |
|
||||
| kCCTexture2DPixelFormat_RGBA8888 | Texture2D::PixelFormat::RGBA8888 |
|
||||
| kCCDirectorProjectionCustom | Director::Projection::CUSTOM |
|
||||
| ccGREEN | Color3B::GREEN |
|
||||
| CCPointZero | Point::ZERO |
|
||||
| CCSizeZero | Size::ZERO |
|
||||
## New math library
|
||||
|
||||
The old values can still be used, but are deprecated.
|
||||
cocos2d-x v1.0 only supported 2D features. So it made sense to use a 2x3 Transform matrix for the operations.
|
||||
|
||||
### override
|
||||
In cocos2d-x v2.0 we added OpenGL ES 2.0 support (no more built-in OpenGL matrix operations) so it made sense to use [Kazmath](https://github.com/Kazade/kazmath), a math library that replaced the OpenGL ES 1.0 functionality. Kazmath was used internally, and most of the users never used the Kazmath API at all.
|
||||
|
||||
To catch possible errors while overriding methods, subclasses with override methods have the `override` context keyword.
|
||||
Example:
|
||||
```cpp
|
||||
class Sprite : public Node {
|
||||
bool isFlipY(void) const;
|
||||
void setFlipY(bool bFlipY);
|
||||
In cocos2d-x v3.0 we refactored the renderer and we exposed a bit more the Kazmath API to the users.
|
||||
|
||||
// Overrides
|
||||
virtual void setTexture(Texture2D *texture) override;
|
||||
virtual Texture2D* getTexture() const override;
|
||||
inline void setBlendFunc(const BlendFunc &blendFunc) override;
|
||||
inline const BlendFunc& getBlendFunc() const override;
|
||||
And in v3.1, with `Sprite3D` we needed to expose even more the the Kazmath API. And it no longer made sense to have multiple math libraries inside cocos2d-x.
|
||||
|
||||
The problems were:
|
||||
|
||||
* Part of the code was using the old 2D math library
|
||||
* Part of the code was using Kazmath
|
||||
* Part of the code was using ad-hoc math code
|
||||
|
||||
The goal was to use only one math library for cocos2d-x, with the following requirements:
|
||||
* Easy to use, easy to mantain
|
||||
* Proven
|
||||
* In C++ if possible
|
||||
|
||||
So we took the [GamePlay3D](http://gameplay3d.org/) math library, we did some minor changes, and the cocos2d-x math code with it.
|
||||
|
||||
How to use it:
|
||||
|
||||
```c++
|
||||
// vector2
|
||||
Vec2 vec2(10,20);
|
||||
Vec2 other2(30,40);
|
||||
auto ret = vec2.cross(other2);
|
||||
auto ret2 = vec2 + other2;
|
||||
auto ret3 = vec3 * scalar;
|
||||
|
||||
node->setPosition(vec2);
|
||||
|
||||
// vector3
|
||||
Vec3 vec3(30,40,50);
|
||||
node->setPosition3D(vec3);
|
||||
|
||||
// vector4
|
||||
Vec4 vec4 = Vec4::ZERO;
|
||||
|
||||
// Matrix 4x4
|
||||
auto identity = Mat4::IDENTITY;
|
||||
node->setNodeToParentTransform(identity);
|
||||
```
|
||||
|
||||
The good news is that the old API still works since we `typedef` the old classes and structs to the new math classes.
|
||||
|
||||
|
||||
## New UIVideoPlayer
|
||||
|
||||
v3.1 has a new `Node` to play videos. The API is:
|
||||
|
||||
|
||||
```c++
|
||||
// VideoPlayer is under the "experimental" namespace since
|
||||
// it only works for iOS and Android, and we might change its
|
||||
// API in the future
|
||||
auto videoPlayer = cocos2d::experimental::ui::VideoPlayer::create();
|
||||
videoPlayer->setContentSize(Size(x,y));
|
||||
videoPlayer->setURL("http://example.com/video.mp4");
|
||||
//you could also play a local video file as follows:
|
||||
//videoPlayer->setFileName("filepath/video.mp4");
|
||||
videoPlayer->play();
|
||||
```
|
||||
|
||||
|
||||
## UI navigation
|
||||
|
||||
3.1 supports focus navigation of UI widget which is very useful for OTT manufacturer.
|
||||
|
||||
###Usage
|
||||
Suppose that your screen has 3 widgets layout horizontally. We could define it like this:
|
||||
|
||||
```c++
|
||||
HBox(widget1, widget2, widget3)
|
||||
```
|
||||
|
||||
If you want the `widget1` to get focused, you could call
|
||||
|
||||
```c++
|
||||
widget1->setfocused(true)
|
||||
```
|
||||
|
||||
If you want to move the focus to the next widget, you could just call
|
||||
|
||||
```c++
|
||||
widget1->findNextFocusedWidget(Widget::FocusDirection::RIGHT, _firstFocusedWidget);
|
||||
```
|
||||
|
||||
When the focus goes to `widget3`, if you call
|
||||
|
||||
```c++
|
||||
widget3->findNextFocusedWidget(Widget::FocusDirection::RIGHT, _firstFocusedWidget);
|
||||
```
|
||||
, the focus will stay there only when you call `HBox->setLoopFocus()` then the focus will move to `widget1` again.
|
||||
|
||||
**Note:**
|
||||
|
||||
The HBox and VBox could be nested in any ways and all the widgets should be added into the HBox/VBox if you want them to be focused later.
|
||||
|
||||
When a focus moves from one widget to another, it will trigger a *focus event*. You could add the following code to handle these event:
|
||||
|
||||
```c++
|
||||
auto eventListener = EventListenerFocus::create();
|
||||
eventListener->onFocusChanged = CC_CALLBACK_2(UIFocusTestBase::onFocusChanged, this);
|
||||
eventDispatcher->addEventListenerWithFixedPriority(_eventListener, 1);
|
||||
```
|
||||
|
||||
The onFocusChanged callback, when the widget lose focus, we change its color to white, when the widget get focus, we change its color to red. You could add more complex animations to them when focus change happens.
|
||||
|
||||
```c++
|
||||
void UIFocusTestBase::onFocusChanged(cocos2d::ui::Widget *widgetLostFocus, cocos2d::ui::Widget *widgetGetFocus)
|
||||
{
|
||||
Layout *getLayout = dynamic_cast<Layout*>(widgetGetFocus);
|
||||
if (!getLayout && widgetGetFocus && widgetGetFocus->isFocusEnabled()) {
|
||||
widgetGetFocus->setColor(Color3B::RED);
|
||||
}
|
||||
Layout *loseLayout = dynamic_cast<Layout*>(widgetLostFocus);
|
||||
if (!loseLayout && widgetLostFocus && widgetLostFocus->isFocusEnabled()) {
|
||||
widgetLostFocus->setColor(Color3B::WHITE);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Removed Objective-C patterns
|
||||
|
||||
_Feature added in v3.0-pre-alpha0_
|
||||
|
||||
### No more 'CC' prefix for C++ classes and free functions
|
||||
|
||||
*Changes in classes*
|
||||
|
||||
Since cocos2d-x already uses the `cocos2d` namespace, there is not need to add the prefix `CC` to all its classes.
|
||||
|
||||
Examples:
|
||||
|
||||
| v2.1 | v3.0 |
|
||||
| CCSprite | Sprite |
|
||||
| CCNode | Node |
|
||||
| CCDirector | Director |
|
||||
| etc... |
|
||||
|
||||
v2.1 class names are still available, but they were tagged as deprecated.
|
||||
|
||||
*Changes in free functions*
|
||||
|
||||
For the *drawing primitives*:
|
||||
* They were added in the `DrawPrimitives` namespace
|
||||
* The `cc` prefix was removed
|
||||
|
||||
For the *gl proxy functions*:
|
||||
* They were added in the `GL` namespace
|
||||
* The `ccGL` prefix was removed
|
||||
|
||||
Examples:
|
||||
|
||||
| v2.1 | v3.0 |
|
||||
| ccDrawPoint() | DrawPrimitives::drawPoint() |
|
||||
| ccDrawCircle() | DrawPrimitives::drawCircle() |
|
||||
| ccGLBlendFunc() | GL::blendFunc() |
|
||||
| ccGLBindTexture2D() | GL::bindTexture2D() |
|
||||
| etc... |
|
||||
|
||||
v2.1 free functions are still available, but they were tagged as deprecated.
|
||||
For more usage information, please refer to [this file](https://github.com/cocos2d/cocos2d-x/blob/v3/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp) for more information.
|
||||
|
||||
|
||||
### clone() instead of copy()
|
||||
###Limitations
|
||||
Only Layout type `HORIZONTAL` and `VERTICAL` is supported which means we could not treat Scrollview and PageView as a base layout.
|
||||
|
||||
`clone()` returns an autoreleased version of the copy.
|
||||
The following layouts:
|
||||
|
||||
`copy()` is no longer supported. If you use it, it will compile, but the code will crash.
|
||||
|
||||
Example:
|
||||
```cpp
|
||||
// v2.1
|
||||
CCMoveBy *action = (CCMoveBy*) move->copy();
|
||||
action->autorelease();
|
||||
|
||||
// v3.0
|
||||
// No need to do autorelease, no need to do casting.
|
||||
auto action = move->clone();
|
||||
```c++
|
||||
HBox(VBox, ScrollView(HBox(VBox, VBox, VBox)))
|
||||
VBox(HBox, PageView(VBox(HBox,HBox))))
|
||||
```
|
||||
are not supported yet, we will implement it in cocos2d-x v3.2.
|
||||
|
||||
If you want to achieve the focus movement in scrollview, you could use a normal VBox or HBox to layout elements and call `setFocusEnabled(true/false)` manually to skip the unwanted widgets.
|
||||
|
||||
## Improved folder structure
|
||||
|
||||
### Singletons use getInstance() and destroyInstance()
|
||||
In v3.0 we started a folder re-organization for cocos2d-x. Unfortunately we didn't have the time to finish it on time.
|
||||
|
||||
All singletons use `getInstance()` and `destroyInstance()` (if applicable) to get and destroy the instance.
|
||||
In v3.1 we finished the folder re-organization, and it looks like this:
|
||||
|
||||
Examples:
|
||||
cocos/: includes cocos2d.cpp and other build files
|
||||
cocos/2d/: includes base nodes, 2d nodes and related objects like Node, Scene, Sprite, etc.
|
||||
cocos/3d/: includes 3d nodes and related objects like Sprite3D
|
||||
cocos/audio/: sound and music related objects
|
||||
cocos/math/: math related objects
|
||||
cocos/platform/: platform specific objects
|
||||
cocos/renderer/: GPU related objects like Renderer, Texture2D, Render Commands, etc.
|
||||
cocos/physcis/: physics related objects
|
||||
cocos/network/: network retlated objects
|
||||
cocos/editor-support/: 3rd party editors file format
|
||||
|
||||
| v2.1 | v3.0 |
|
||||
| CCDirector->sharedDirector() | Director->getInstance() |
|
||||
| CCDirector->endDirector() | Director->destroyInstance() |
|
||||
| etc... |
|
||||
## Particle System fixes
|
||||
|
||||
cocos2d-x v3.0 and earlier versions had a bug in `ParticleSystem` where the the Y-flipped parameter was not calculated correctly.
|
||||
|
||||
v2.1 methods are still available, but they were tagged as deprecated.
|
||||
We fixed that bug in v3.1. The problem is that fixing this bug breaks backward compatiblility in particles that were relying on the broken behavior.
|
||||
|
||||
### Object is replaced with Ref
|
||||
In order to try to make the transition easier to v3.1, we created a tool that fixes the broken particle system files. How to use it:
|
||||
|
||||
Because the name `Object` is confused, so rename it to `Ref`, and remove functions that are not related with reference count. All classes that inherit from `Object` now inherit from `Ref`.
|
||||
|
||||
### getters
|
||||
|
||||
Getters now use the `get` prefix.
|
||||
|
||||
Examples:
|
||||
|
||||
| v2.1 | v3.0* |
|
||||
| node->boundingBox() | node->getBoundingBox() |
|
||||
| sprite->nodeToParentTransform() | sprite->getNodeToParentTransform() |
|
||||
| etc... |
|
||||
|
||||
And getters were also tagged as `const` in their declaration. Example:
|
||||
|
||||
```cpp
|
||||
// v2.1
|
||||
virtual float getScale();
|
||||
|
||||
// v3.0
|
||||
virtual float getScale() const;
|
||||
```
|
||||
|
||||
v2.1 methods are still available, but they were tagged as deprecated.
|
||||
|
||||
### POD types
|
||||
|
||||
Methods that were receiving POD types as arguments (eg: `TexParams`, `Point`, `Size`, etc.) are being passed as `const` reference.
|
||||
|
||||
Example:
|
||||
```cpp
|
||||
// v2.1
|
||||
void setTexParameters(ccTexParams* texParams);
|
||||
|
||||
// v3.0
|
||||
void setTexParameters(const ccTexParams& texParams);
|
||||
```
|
||||
|
||||
|
||||
## New Renderer
|
||||
|
||||
_Feature added in v3.0-beta and improved in v3.0-beta2_
|
||||
|
||||
The way currently cocos2d-x v2.2 does rendering is OK but it is difficult to optimize, difficult to add new functionality and difficult to port to new platforms.
|
||||
So cocos2d-x v3.0 has a new renderer that is more performing, elegant, scalable, flexible but still simple to use and to understand. Also existing cocos2d-x users will find the new API familiar and they will feel immediately comfortable with, without having to bother about what’s changed or what's new under the hood.
|
||||
|
||||
Features of the new renderer:
|
||||
|
||||
- It has been decoupled from the Scene Graph. The `draw()` method, instead of "drawing" it sends a `RenderCommand` to the `Renderer`, and `Renderer` is responsible for drawing the queued `RenderCommand` commands.
|
||||
- `QuadCommands` (used by `Sprite` and `ParticleSystem` objects) will be automatically batched.
|
||||
- `CustomCommand` objects allow the user to use custom OpenGL code, using a API similar to v2.2
|
||||
- `GroupCommand` objects allow to have "stacks" in the Renderer with different OpenGL values.
|
||||
- Auto-culling for `Sprite` objects (although, technically, Auto-culling is not performed in `Renderer` code, but in the `Sprite` code)
|
||||
- Global Z ordering (local Z ordering is still supported)
|
||||
|
||||
For detailed information, please read the following doc: [Renderer Specification document](https://docs.google.com/document/d/17zjC55vbP_PYTftTZEuvqXuMb9PbYNxRFu0EGTULPK8/edit)
|
||||
|
||||
### Renderer features
|
||||
|
||||
#### Auto-batching
|
||||
|
||||
Auto-batching means that the `Renderer` will package "multiple draw calls" in just one "big draw call" (AKA batch). In order to group "draw calls" certain conditions are needed:
|
||||
|
||||
- It only works with `QuadCommand` commands (used by Sprite and ParticleSystem objects)
|
||||
- The `QuadCommands` must share the same Material ID: same Texture ID, same GLProgram and same blending function
|
||||
- The `QuadCommands` must consecutive
|
||||
|
||||
If those conditions are met, the `Renderer` will create create a batch (one draw call) with all those `QuadCommand` objects.
|
||||
|
||||
In case you are unfamiliar with the OpenGL best practices, batching is very important to have decent speed in your games. The less batches (draw calls) the more performance your game is going to be.
|
||||
|
||||
#### Auto-culling
|
||||
|
||||
For the moment auto-culling is only implemented on `Sprite` objects.
|
||||
|
||||
When the method `Sprite::draw()` is called, it will check if the `Sprite` is outside the screen. If so, it won't send the `QuadCommand` command to the `Renderer`, and thus, it will gain some performance.
|
||||
|
||||
|
||||
#### Global Z order
|
||||
|
||||
A new method called `setGlobalZOrder()` / `getGlobalZOrder()` was added to `Node`, and the old methods `setZOrder()` / `getZOrder()` were renamed to `setLocalZOrder()` / `getLocalZOrder()`.
|
||||
|
||||
`globalZOrder` receives a `float` (and not an `int`) as argument. And this value is used to sort the `RenderCommand` objects in the `Renderer`. Lower values have higher priority over higher values. That means that a Node with a `globalZOrder` of `-10` is going to be drawn BEFORE a Node with `globalZOrder` of `10`.
|
||||
|
||||
Nodes that have a `globalZOrder` of `0` (default value) will be drawn according to the Scene Graph order.
|
||||
|
||||
If the `globalZOrder` is not changed, cocos2d-x v3.0 will behave exactly as cocos2d-x v2.2.
|
||||
|
||||
__`globalZOrder()` vs. `localZOrder()`__:
|
||||
|
||||
* `globalZOrder` is used to sort the "draw commands" in the `Renderer`
|
||||
* `localZOrder` is used to sort the `Node` objects in its parent's children Array
|
||||
|
||||
__Exceptions__:
|
||||
|
||||
TODO
|
||||
|
||||
### Sprite vs. SpriteBatchNode
|
||||
|
||||
In v2.2 the recommended way to have good performance was to parent `Sprite` objects to a `SpriteBatchNode` object.
|
||||
Although the performance was (is still) very good by using `SpriteBatchNode` objects, they had (still have) some limitations like:
|
||||
|
||||
- `Sprite` objects can only have `Sprite` objects as children (if not, cocos2d-x will raise an Assert)
|
||||
- You cannot add a `ParticleSystem` as a child of `Sprite`, when the `Sprite` is parented to a `SpriteBatchNode`
|
||||
- As a consequence of that, you cannot use `ParallaxNode` with `Sprites` parented to `SpriteBatchNode`
|
||||
- All `Sprite` objects must share the same TextureId (if not, cocos2d-x will raise an Assert)
|
||||
- `Sprite` objects use the `SpriteBatchNode`'s blending function and shader.
|
||||
|
||||
|
||||
And although v3.0 still supports `SpriteBatchNode` (with the same features and limitations), we no longer encourage its usage. Instead, we recommend to use `Sprite` objects without parenting them to a `SpriteBatchNode`.
|
||||
|
||||
But in order to have a very good performance in v3.0, you have to make sure that your `Sprite` objects:
|
||||
|
||||
- Share the same TextureId (place them in a spritesheet, like if you were using a `SpriteBatchNode`)
|
||||
- Make sure all of them use the same shader and blending function (like if you were using a `SpriteBatchNode`)
|
||||
|
||||
If you do so, the `Sprites` will perform almost as fast as to using `SpriteBatchNode`... (about 10% slower on old devices. On newer devices the difference is almost imperceptible)
|
||||
|
||||
The big differences between v2.2 and v3.0 are:
|
||||
|
||||
- `Sprite` objects can have different Texture IDs.
|
||||
- `Sprite` objects can have any kind of `Node` as children, including `ParticleSystem`.
|
||||
- `Sprite` objects can have different blending functions and use different shaders.
|
||||
|
||||
But if you do that, the `Renderer` might not be able to batch all its children (less performant). But the game will keep running, without raising any Assert.
|
||||
|
||||
__To summarize__:
|
||||
|
||||
- Keep putting all your sprites in a big spritesheet
|
||||
- Use the same Blending Function (just use the default one)
|
||||
- Use the same Shader (just use the default one)
|
||||
- And don't parent your sprites to a `SpriteBatchNode`
|
||||
|
||||
Only use `SpriteBatchNode` as the last resort, when you really need an extra (although minor) boost in performance (and you are OK with its limitations).
|
||||
|
||||
|
||||
## Improved LabelTTF / LabelBMFont / LabelAtlas
|
||||
|
||||
_Feature added in v3.0-alpha0_
|
||||
|
||||
`LabelTTF`, `LabelBMFont` and `LabelAtlas` will be replaced by new `Label`. The benefits of new `Label` are:
|
||||
|
||||
* uniform api to create `LabelTTF`, `LabelBMFont` and `LabelAtlas`
|
||||
* use `freetype` to generate texture for labels, which make sure that labels have the same effect on different platforms
|
||||
* will cache textures to improve performance
|
||||
|
||||
## New EventDispatcher
|
||||
|
||||
_Feature added in v3.0-alpha0_
|
||||
|
||||
All events such as touch event, keyboard event, acceleration event and custom event are dispatched by `EventDispatcher`.
|
||||
`TouchDispatcher`, `KeypadDispatcher`, `KeyboardDispatcher`, `AccelerometerDispatcher` were removed.
|
||||
|
||||
Features of `EventDispatcher` are:
|
||||
|
||||
* dispatch events based on rendering sequence
|
||||
* all events are dispatched by `EventDispatcher`
|
||||
* can use `EventDispatcher` to dispatch custom events
|
||||
* can register a lambda as call back function
|
||||
|
||||
Detail information of `EventDispatcher` can refer to [this document](https://github.com/cocos2d/cocos-docs/blob/master/manual/framework/native/input/event-dispatcher/en.md).
|
||||
|
||||
## Physics Integration
|
||||
|
||||
_Feature added in v3.0-pre-alpha0_
|
||||
|
||||
In v3.0, we integrate physics engine into cocos2d-x based on [Chipmunk2D](https://chipmunk-physics.net/). By using this feature, you can create physics based games without understanding physics engine.
|
||||
|
||||
More detail information of this feature, please refer to [this document](https://github.com/cocos2d/cocos-docs/blob/master/manual/framework/native/physics/physics-integration/en.md)
|
||||
# Will convert broken .plist files into fixed ones.
|
||||
# Will generate a backup file of the converted files
|
||||
$ cocos/tools/particle/convert_YCoordFlipped.py *.plist
|
||||
|
||||
|
||||
# Misc API Changes
|
||||
|
||||
## `ccTypes.h`
|
||||
|
||||
Remove *cc* prefix for structure names in ccTypes.h, move global functions into static member functions, and move global constants into const static member variables.
|
||||
|
||||
| v2.1 struct names | v3.0 struct names |
|
||||
| ccColor3B | Color3B |
|
||||
| ccColor4B | Color4B |
|
||||
| ccColor4F | Color4F |
|
||||
| ccVertex2F | Vertex2F |
|
||||
| ccVertex3F | Vertex3F |
|
||||
| ccTex2F | Tex2F |
|
||||
| ccPointSprite | PointSprite |
|
||||
| ccQuad2 | Quad2 |
|
||||
| ccQuad3 | Quad3 |
|
||||
| ccV2F_C4B_T2F | V2F_C4B_T2F |
|
||||
| ccV2F_C4F_T2F | V2F_C4F_T2F |
|
||||
| ccV3F_C4B_T2F | V3F_C4B_T2F |
|
||||
| ccV2F_C4B_T2F_Triangle | V2F_C4B_T2F_Triangle |
|
||||
| ccV2F_C4B_T2F_Quad | V2F_C4B_T2F_Quad |
|
||||
| ccV3F_C4B_T2F_Quad | V3F_C4B_T2F_Quad |
|
||||
| ccV2F_C4F_T2F_Quad | V2F_C4F_T2F_Quad |
|
||||
| ccBlendFunc | BlendFunc |
|
||||
| ccT2F_Quad | T2F_Quad |
|
||||
| ccAnimationFrameData | AnimationFrameData |
|
||||
|
||||
Global functions changed example
|
||||
```c++
|
||||
// in v2.1
|
||||
ccColor3B color3B = ccc3(0, 0, 0);
|
||||
ccc3BEqual(color3B, ccc3(1, 1, 1));
|
||||
ccColor4B color4B = ccc4(0, 0, 0, 0);
|
||||
ccColor4F color4F = ccc4f(0, 0, 0, 0);
|
||||
color4F = ccc4FFromccc3B(color3B);
|
||||
color4F = ccc4FFromccc4B(color4B);
|
||||
ccc4FEqual(color4F, ccc4F(1, 1, 1, 1));
|
||||
color4B = ccc4BFromccc4F(color4F);
|
||||
|
||||
color3B = ccWHITE;
|
||||
|
||||
// in v3.0
|
||||
Color3B color3B = Color3B(0, 0, 0);
|
||||
color3B.equals(Color3B(1, 1, 1));
|
||||
Color4B color4B = Color4B(0, 0, 0, 0);
|
||||
Color4F color4F = Color4F(0, 0, 0, 0);
|
||||
color4F = Color4F(color3B);
|
||||
color4F = Color4F(color4B);
|
||||
color4F.equals(Color4F(1, 1, 1, 1));
|
||||
color4B = Color4B(color4F);
|
||||
|
||||
color3B = Color3B::WHITE;
|
||||
```
|
||||
|
||||
## deprecated functions and global variables
|
||||
|
||||
| v2.1 names | v3.0 names |
|
||||
| ccp | Point |
|
||||
| ccpNeg | Point::- |
|
||||
| ccpAdd | Point::+ |
|
||||
| ccpSub | Point::- |
|
||||
| ccpMult | Point::* |
|
||||
| ccpMidpoint | Point::getMidpoint |
|
||||
| ccpDot | Point::dot |
|
||||
| ccpCrosss | Point::cross |
|
||||
| ccpPerp | Point::getPerp |
|
||||
| ccpRPerp | Point::getRPerp |
|
||||
| ccpProject | Point::project |
|
||||
| ccpRotate | Point::rotate |
|
||||
| ccpUnrotate | Point::unrotate |
|
||||
| ccpLengthSQ | Point::getLengthSq() |
|
||||
| ccpDistanceSQ | Point::getDistanceSq |
|
||||
| ccpLength | Point::getLength |
|
||||
| ccpDistance | Point::getDistance |
|
||||
| ccpNormalize | Point::normalize |
|
||||
| ccpForAngle | Point::forAngle |
|
||||
| ccpToAngle | Point::getAngle |
|
||||
| ccpClamp | Point::getClampPoint |
|
||||
| ccpFromSize | Point::Point |
|
||||
| ccpCompOp | Point::compOp |
|
||||
| ccpLerp | Point::lerp |
|
||||
| ccpFuzzyEqual | Point::fuzzyEqual |
|
||||
| ccpCompMult | Point::Point |
|
||||
| ccpAngleSigned | Point::getAngle |
|
||||
| ccpAngle | Point::getAngle |
|
||||
| ccpRotateByAngle | Point::rotateByAngle |
|
||||
| ccpLineInersect | Point::isLineIntersect |
|
||||
| ccpSegmentIntersect | Point::isSegmentIntersect |
|
||||
| ccpIntersectPoint | Point::getIntersectPoint |
|
||||
| CCPointMake | Point::Point |
|
||||
| CCSizeMake | Size::Size |
|
||||
| CCRectMake | Rect::Rect |
|
||||
| PointZero | Point::ZERO |
|
||||
| SizeZero | Size::ZERO |
|
||||
| RectZero | Rect::ZERO |
|
||||
| TiledGrid3DAction::tile | TiledGrid3DAction::getTile |
|
||||
| TiledGrid3DAction::originalTile | TiledGrid3DAction::getOriginalTile |
|
||||
| TiledGrid3D::tile | TiledGrid3D::getTile |
|
||||
| TiledGrid3D::originalTile | TiledGrid3D::getOriginalTile |
|
||||
| Grid3DAction::vertex | Grid3DAction::getVertex |
|
||||
| Grid3DAction::originalVertex | Grid3DAction::getOriginalVertex |
|
||||
| Grid3D::vertex | Grid3D::getVertex |
|
||||
| Grid3D::originalVertex | Grid3D::getOriginalVertex |
|
||||
| Configuration::sharedConfiguration | Configuration::getInstance |
|
||||
| Configuration::purgeConfiguration | Configuration::destroyInstance() |
|
||||
| Director::sharedDirector() | Director::getInstance() |
|
||||
| FileUtils::sharedFileUtils | FileUtils::getInstance |
|
||||
| FileUtils::purgeFileUtils | FileUtils::destroyInstance |
|
||||
| GLView::sharedOpenGLView | GLView::getInstance |
|
||||
| ShaderCache::sharedShaderCache | GLProgramCache::getInstance |
|
||||
| ShaderCache::purgeSharedShaderCache | ShaderCache::destroyInstance |
|
||||
| AnimationCache::sharedAnimationCache | AnimationCache::getInstance |
|
||||
| AnimationCache::purgeSharedAnimationCache | AnimationCache::destroyInstance |
|
||||
| SpriteFrameCache::sharedSpriteFrameCache | SpriteFrameCache::getInstance |
|
||||
| SpriteFrameCache:: purgeSharedSpriteFrameCache | SpriteFrameCache::destroyInstance |
|
||||
| NotificationCenter::sharedNotificationCenter | NotificationCenter::getInstance |
|
||||
| NotificationCenter:: purgeNotificationCenter | NotificationCenter::destroyInstance |
|
||||
| Profiler::sharedProfiler | Profiler::getInstance |
|
||||
| UserDefault::sharedUserDefault | UserDefault::getInstance |
|
||||
| UserDefault::purgeSharedUserDefault | UserDefault::destroyInstance |
|
||||
| Application::sharedApplication | Application::getInstance |
|
||||
| ccc3() | Color3B() |
|
||||
| ccc3BEqual() | Color3B::equals() |
|
||||
| ccc4() | Color4B() |
|
||||
| ccc4FFromccc3B() | Color4F() |
|
||||
| ccc4f() | Color4F() |
|
||||
| ccc4FFromccc4B() | Color4F() |
|
||||
| ccc4BFromccc4F() | Color4B() |
|
||||
| ccc4FEqual() | Color4F::equals() |
|
||||
| ccWHITE | Color3B::WHITE |
|
||||
| ccYELLOW | Color3B::YELLOW |
|
||||
| ccBLUE | Color3B::BLUE |
|
||||
| ccGREEN | Color3B::GREEN |
|
||||
| ccRED | Color3B::RED |
|
||||
| ccMAGENTA | Color3B::MAGENTA |
|
||||
| ccBLACK | Color3B::BLACK |
|
||||
| ccORANGE | Color3B::ORANGE |
|
||||
| ccGRAY | Color3B::GRAY |
|
||||
| kBlendFuncDisable | BlendFunc::BLEND_FUNC_DISABLE |
|
||||
|
||||
# Changes in the Lua bindings
|
||||
|
||||
## Use bindings-generator tool for lua binding
|
||||
|
||||
Only have to write an ini file for a module, don't have to write a lot of .pkg files
|
||||
|
||||
### Bind the classes with namespace to lua
|
||||
|
||||
In previous, the lua binding can not bind classes that have the same class name but different namespaces. In order to resolve this issue, now the metatable name of a class is changed. For example, `CCNode` will be changed to `cc.Node`. This modification will affect some APIs as follows:
|
||||
|
||||
| v2.x | v3.0 |
|
||||
| tolua_usertype(tolua_S,"CCNode") | tolua_usertype(tolua_S,"cc.Node") |
|
||||
| tolua_isusertable(tolua_S,1,"CCNode",0,&tolua_err | tolua_isusertable(tolua_S,1,"cc.Node",0,&tolua_err |
|
||||
| tolua_isusertype(tolua_S,1,"CCNode",0,&tolua_err) | tolua_isusertype(tolua_S,1,"cc.Node",0,&tolua_err) |
|
||||
| toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"CCNode") | toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"cc.Node") |
|
||||
| tolua_pushusertype(tolua_S,(void*)tolua_ret,"CCFileUtils") | tolua_pushusertype(tolua_S,(void*)tolua_ret,"cc.FileUtils") |
|
||||
| tolua.cast(pChildren[i + 1], "CCNode") | tolua.cast(pChildren[i + 1], "cc.Node") |
|
||||
|
||||
### Use ScriptHandlerMgr to manage the register and unregister of Lua function
|
||||
|
||||
When we want to add register and unregister functions of Lua function for class, we need to change the declarative and defined files and then bind to Lua.
|
||||
In v3.0, we use the `ScriptHandlerMgr`. As an example, lets see the `MenuItem` class:
|
||||
In the 2.x version, we needed to add a declaration in the MenuItem header file:
|
||||
```c++
|
||||
virtual void registerScriptTapHandler(int nHandler);
|
||||
virtual void unregisterScriptTapHandler(void);
|
||||
```
|
||||
then implement them in the .cpp file. In the Lua script ,we use it as follow:
|
||||
```lua
|
||||
menuItem:registerScriptTapHandler(luafunction)
|
||||
```
|
||||
|
||||
In v3.0 version, we only need to add the `HandlerType` enum in the `ScriptHandlerMgr`, and the implementation in luascript as follow:
|
||||
```lua
|
||||
ScriptHandlerMgr:getInstance():registerScriptHandler(menuItem, luafunction,cc.HANDLERTYPE_MENU_CLICKED)
|
||||
```
|
||||
|
||||
## Misc API changes
|
||||
|
||||
### Use `cc`、`ccs`、`ccui` `gl` and `sp` as module name
|
||||
|
||||
Now classes are bound into different modules instead of using global module. This will avoid conflicts with other codes.
|
||||
|
||||
* classes in `cocos2d`、`cocos2d::extension`、`CocosDenshion` and `cocosbuilder` were bound to `cc` module
|
||||
* classes in `cocos2d::ui` were bound to `ccui` module
|
||||
* classes in `spine` were bound to `sp` module
|
||||
* classes in `cocostudio` were bound to `ccs` module
|
||||
* global variables are bound to corresponding modules
|
||||
* all funcionts and constants about `openGl` were bound to `gl` module
|
||||
|
||||
Examples:
|
||||
|
||||
| v2.1 | v3.0 |
|
||||
| CCDirector | cc.Director |
|
||||
| CCArmature | ccs.Armature |
|
||||
| kCCTextAlignmentLeft | cc.kCCTextAlignmentLeft |
|
||||
|
||||
### Modified functions
|
||||
|
||||
Some global function names are renamed:
|
||||
|
||||
Examples:
|
||||
|
||||
| v2.1 | v3.0 |
|
||||
| CCPoint/ccp | cc.p |
|
||||
| CCRect | cc.rect |
|
||||
| CCColor3B | cc.c3b |
|
||||
| CCColor4B | cc.c4b |
|
||||
| CCColor4F | cc.c4f |
|
||||
|
||||
### Add some modules
|
||||
|
||||
In the version 3.0, more modules were bound to lua, specific as follows:
|
||||
|
||||
* physics
|
||||
* spine
|
||||
* XMLHttpRequest
|
||||
* OpenGL
|
||||
|
||||
The `XMLHttpRequest` and `physics` are in the `cc` module, the `spine` is in the `sp` module, and the `OpenGL` is in the `gl` module. Related test cases located in:
|
||||
|
||||
* physics ---> TestLua/PhysicsTest
|
||||
* spine ---> TestLua/SpineTest
|
||||
* XMLHttpRequest ---> TestLua/XMLHttpRequestTest
|
||||
* openGL ---> TestLua/OpenGLTest
|
||||
|
||||
### Add more lua bindings
|
||||
Such as: New Label、New EventDispatcher and AssetsManager,etc.Related test cases located in:
|
||||
|
||||
* New Label ---> TestLua/LabelTestNew
|
||||
* New EventDispatcher --->TestLua/NewEventDispatcherTest
|
||||
* AssetsManager ---> TestLua/AssetsManagerTest
|
||||
|
||||
### Replace some lua-bindings of Class or Struct with lua table
|
||||
In the version 3.0, all the lua-binding of Struct type were replaced with the lua table
|
||||
|
||||
Examples:
|
||||
|
||||
| v2.1 | v3.0 |
|
||||
| CCPoint | lua table |
|
||||
| CCRect | lua table |
|
||||
| CCColor3B | lua table |
|
||||
| CCColor4B | lua table |
|
||||
| CCColor4F | lua table |
|
||||
| CCAffineTransform | lua table |
|
||||
| CCArray | lua table |
|
||||
| CCDictionary | lua table |
|
||||
| CCPointArray | lua table |
|
||||
|
||||
### Support lua script codes call Object-C codes and Java codes
|
||||
`LuaObjcBridge` and `LuaJavaBridge` bound to lua supported lua script codes calls Object-C codes and java codes.
|
||||
|
||||
### Add some lua files to store the constants of different modules
|
||||
|
||||
* Cocos2DConstants.lua store the constants of `cc` module
|
||||
* StudioConstants.lua store the constants of `ccs` module
|
||||
* GuiConstants.lua store the constants of `ccui` module
|
||||
* OpenglConstants.lua store the constants of `gl` module
|
||||
TODO: The old Math API
|
||||
|
|
|
@ -656,30 +656,32 @@ void ControlButton::onTouchEnded(Touch *pTouch, Event *pEvent)
|
|||
|
||||
void ControlButton::setOpacity(GLubyte opacity)
|
||||
{
|
||||
// XXX fixed me if not correct
|
||||
Control::setOpacity(opacity);
|
||||
// _opacity = opacity;
|
||||
//
|
||||
// Ref* child;
|
||||
// Array* children=getChildren();
|
||||
// CCARRAY_FOREACH(children, child)
|
||||
// {
|
||||
// RGBAProtocol* pNode = dynamic_cast<RGBAProtocol*>(child);
|
||||
// if (pNode)
|
||||
// {
|
||||
// pNode->setOpacity(opacity);
|
||||
// }
|
||||
// }
|
||||
|
||||
for (auto iter = _backgroundSpriteDispatchTable.begin(); iter != _backgroundSpriteDispatchTable.end(); ++iter)
|
||||
{
|
||||
iter->second->setOpacity(opacity);
|
||||
}
|
||||
|
||||
for (auto iter = _titleLabelDispatchTable.begin(); iter != _titleLabelDispatchTable.end(); ++iter)
|
||||
{
|
||||
iter->second->setOpacity(opacity);
|
||||
}
|
||||
}
|
||||
|
||||
GLubyte ControlButton::getOpacity() const
|
||||
void ControlButton::updateDisplayedOpacity(GLubyte parentOpacity)
|
||||
{
|
||||
return _realOpacity;
|
||||
Control::updateDisplayedOpacity(parentOpacity);
|
||||
|
||||
for (auto iter = _backgroundSpriteDispatchTable.begin(); iter != _backgroundSpriteDispatchTable.end(); ++iter)
|
||||
{
|
||||
iter->second->updateDisplayedOpacity(parentOpacity);
|
||||
}
|
||||
|
||||
for (auto iter = _titleLabelDispatchTable.begin(); iter != _titleLabelDispatchTable.end(); ++iter)
|
||||
{
|
||||
iter->second->updateDisplayedOpacity(parentOpacity);
|
||||
}
|
||||
}
|
||||
|
||||
void ControlButton::setColor(const Color3B & color)
|
||||
|
@ -690,11 +692,26 @@ void ControlButton::setColor(const Color3B & color)
|
|||
{
|
||||
iter->second->setColor(color);
|
||||
}
|
||||
|
||||
for (auto iter = _titleLabelDispatchTable.begin(); iter != _titleLabelDispatchTable.end(); ++iter)
|
||||
{
|
||||
iter->second->setColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
const Color3B& ControlButton::getColor() const
|
||||
void ControlButton::updateDisplayedColor(const Color3B& parentColor)
|
||||
{
|
||||
return _realColor;
|
||||
Control::updateDisplayedColor(parentColor);
|
||||
|
||||
for (auto iter = _backgroundSpriteDispatchTable.begin(); iter != _backgroundSpriteDispatchTable.end(); ++iter)
|
||||
{
|
||||
iter->second->updateDisplayedColor(parentColor);
|
||||
}
|
||||
|
||||
for (auto iter = _titleLabelDispatchTable.begin(); iter != _titleLabelDispatchTable.end(); ++iter)
|
||||
{
|
||||
iter->second->updateDisplayedColor(parentColor);
|
||||
}
|
||||
}
|
||||
|
||||
void ControlButton::onTouchCancelled(Touch *pTouch, Event *pEvent)
|
||||
|
|
|
@ -181,11 +181,11 @@ public:
|
|||
virtual void onTouchMoved(Touch *touch, Event *event) override;
|
||||
virtual void onTouchEnded(Touch *touch, Event *event) override;
|
||||
virtual void onTouchCancelled(Touch *touch, Event *event) override;
|
||||
virtual GLubyte getOpacity(void) const override;
|
||||
virtual void setOpacity(GLubyte var) override;
|
||||
virtual const Color3B& getColor(void) const override;
|
||||
virtual void setColor(const Color3B&) override;
|
||||
|
||||
virtual void setOpacity(GLubyte var) override;
|
||||
virtual void updateDisplayedOpacity(GLubyte parentOpacity) override;
|
||||
virtual void setColor(const Color3B&) override;
|
||||
virtual void updateDisplayedColor(const Color3B& parentColor) override;
|
||||
|
||||
const std::string& getCurrentTitle() const { return _currentTitle; };
|
||||
std::string getCurrentTitle() { return _currentTitle; };
|
||||
|
|
|
@ -185,6 +185,15 @@
|
|||
"cocos/2d/cocos2d_wp8.vcxproj.filters",
|
||||
"cocos/2d/cocos2d_wp8_headers.props",
|
||||
"cocos/2d/cocos2dx.props",
|
||||
"cocos/3d/CCMesh.cpp",
|
||||
"cocos/3d/CCMesh.h",
|
||||
"cocos/3d/CCObjLoader.cpp",
|
||||
"cocos/3d/CCObjLoader.h",
|
||||
"cocos/3d/CCSprite3D.cpp",
|
||||
"cocos/3d/CCSprite3D.h",
|
||||
"cocos/3d/CCSprite3DDataCache.cpp",
|
||||
"cocos/3d/CCSprite3DDataCache.h",
|
||||
"cocos/3d/CMakeLists.txt",
|
||||
"cocos/Android.mk",
|
||||
"cocos/CMakeLists.txt",
|
||||
"cocos/audio/CMakeLists.txt",
|
||||
|
@ -839,6 +848,8 @@
|
|||
"cocos/platform/wp8/Direct3DBase.h",
|
||||
"cocos/platform/wp8/DirectXBase.cpp",
|
||||
"cocos/platform/wp8/DirectXBase.h",
|
||||
"cocos/platform/wp8/pch.cpp",
|
||||
"cocos/platform/wp8/pch.h",
|
||||
"cocos/platform/wp8/shaders/precompiledshaders.h",
|
||||
"cocos/renderer/CCBatchCommand.cpp",
|
||||
"cocos/renderer/CCBatchCommand.h",
|
||||
|
@ -854,6 +865,8 @@
|
|||
"cocos/renderer/CCGLProgramStateCache.h",
|
||||
"cocos/renderer/CCGroupCommand.cpp",
|
||||
"cocos/renderer/CCGroupCommand.h",
|
||||
"cocos/renderer/CCMeshCommand.cpp",
|
||||
"cocos/renderer/CCMeshCommand.h",
|
||||
"cocos/renderer/CCQuadCommand.cpp",
|
||||
"cocos/renderer/CCQuadCommand.h",
|
||||
"cocos/renderer/CCRenderCommand.cpp",
|
||||
|
@ -870,6 +883,9 @@
|
|||
"cocos/renderer/CMakeLists.txt",
|
||||
"cocos/renderer/ccGLStateCache.cpp",
|
||||
"cocos/renderer/ccGLStateCache.h",
|
||||
"cocos/renderer/ccShader_3D_Color.frag",
|
||||
"cocos/renderer/ccShader_3D_ColorTex.frag",
|
||||
"cocos/renderer/ccShader_3D_PositionTex.vert",
|
||||
"cocos/renderer/ccShader_Label.vert",
|
||||
"cocos/renderer/ccShader_Label_df.frag",
|
||||
"cocos/renderer/ccShader_Label_df_glow.frag",
|
||||
|
@ -3614,6 +3630,8 @@
|
|||
"cocos/scripting/lua-bindings/auto/api/Follow.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/FrameData.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/GLProgram.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/GLProgramCache.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/GLProgramState.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/GLView.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/GLViewProtocol.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/GUIReader.lua",
|
||||
|
@ -3651,6 +3669,7 @@
|
|||
"cocos/scripting/lua-bindings/auto/api/MenuItemLabel.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/MenuItemSprite.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/MenuItemToggle.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/Mesh.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/MotionStreak.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/MoveBy.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/MoveTo.lua",
|
||||
|
@ -3748,6 +3767,7 @@
|
|||
"cocos/scripting/lua-bindings/auto/api/SplitCols.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/SplitRows.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/Sprite.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/Sprite3D.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/SpriteBatchNode.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/SpriteDisplayData.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/SpriteFrame.lua",
|
||||
|
|
|
@ -52,9 +52,9 @@ include_directories(
|
|||
${COCOS2D_ROOT}
|
||||
${COCOS2D_ROOT}/cocos
|
||||
${COCOS2D_ROOT}/cocos/audio/include
|
||||
${COCOS2D_ROOT}/cocos/2d/platform
|
||||
${COCOS2D_ROOT}/cocos/2d/platform/desktop
|
||||
${COCOS2D_ROOT}/cocos/2d/platform/linux
|
||||
${COCOS2D_ROOT}/cocos/platform
|
||||
${COCOS2D_ROOT}/cocos/platform/desktop
|
||||
${COCOS2D_ROOT}/cocos/platform/linux
|
||||
${COCOS2D_ROOT}/cocos/editor-support
|
||||
${COCOS2D_ROOT}/extensions
|
||||
${COCOS2D_ROOT}/external
|
||||
|
|
|
@ -89,7 +89,7 @@ def do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,and
|
|||
raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!")
|
||||
elif android_platform is not None:
|
||||
sdk_tool_path = os.path.join(sdk_root, "tools/android")
|
||||
cocoslib_path = os.path.join(cocos_root, "cocos/2d/platform/android/java")
|
||||
cocoslib_path = os.path.join(cocos_root, "cocos/platform/android/java")
|
||||
command = '%s update lib-project -t %s -p %s' % (sdk_tool_path,android_platform,cocoslib_path)
|
||||
if os.system(command) != 0:
|
||||
raise Exception("update cocos lib-project [ " + cocoslib_path + " ] fails!")
|
||||
|
|
|
@ -58,9 +58,9 @@ include_directories(
|
|||
${COCOS2D_ROOT}
|
||||
${COCOS2D_ROOT}/cocos
|
||||
${COCOS2D_ROOT}/cocos/audio/include
|
||||
${COCOS2D_ROOT}/cocos/2d/platform
|
||||
${COCOS2D_ROOT}/cocos/2d/platform/desktop
|
||||
${COCOS2D_ROOT}/cocos/2d/platform/linux
|
||||
${COCOS2D_ROOT}/cocos/platform
|
||||
${COCOS2D_ROOT}/cocos/platform/desktop
|
||||
${COCOS2D_ROOT}/cocos/platform/linux
|
||||
${COCOS2D_ROOT}/cocos/editor-support
|
||||
${COCOS2D_ROOT}/extensions
|
||||
${COCOS2D_ROOT}/external
|
||||
|
|
|
@ -5,13 +5,41 @@
|
|||
"runtime/config.json",
|
||||
"runtime/version.json"
|
||||
],
|
||||
"append_from_template": {
|
||||
"from": "frameworks/runtime-src/proj.android",
|
||||
"to": "frameworks/runtime-src/proj.android",
|
||||
"exclude": [
|
||||
"bin",
|
||||
"assets"
|
||||
]
|
||||
},
|
||||
"project_replace_project_name": {
|
||||
"src_project_name": "HelloLua",
|
||||
"files": [
|
||||
"config.json",
|
||||
".project"]
|
||||
".project",
|
||||
"frameworks/runtime-src/proj.android/.project",
|
||||
"frameworks/runtime-src/proj.android/AndroidManifest.xml",
|
||||
"frameworks/runtime-src/proj.android/build.xml",
|
||||
"frameworks/runtime-src/proj.android/res/values/strings.xml"
|
||||
]
|
||||
},
|
||||
"append_dir": [
|
||||
{
|
||||
"from": "cocos/platform/android/java",
|
||||
"to": "frameworks/cocos2d-x/cocos/platform/android/java"
|
||||
},
|
||||
{
|
||||
"from": "cocos/scripting/lua-bindings/script",
|
||||
"to": "frameworks/cocos2d-x/cocos/scripting/lua-bindings/script"
|
||||
},
|
||||
{
|
||||
"from": "external/lua/luasocket",
|
||||
"to": "frameworks/cocos2d-x/external/lua/luasocket",
|
||||
"include": [
|
||||
"*.lua"
|
||||
]
|
||||
},
|
||||
{
|
||||
"from": "cocos/scripting/lua-bindings/script",
|
||||
"to": "runtime/mac/PrebuiltRuntimeLua.app/Contents/Resources",
|
||||
|
@ -104,9 +132,7 @@
|
|||
"from": "frameworks/runtime-src",
|
||||
"to": "frameworks/runtime-src",
|
||||
"exclude": [
|
||||
"proj.android/bin",
|
||||
"proj.android/assets",
|
||||
"proj.android/libs",
|
||||
"proj.android",
|
||||
"proj.ios_mac/HelloLua.xcodeproj/project.xcworkspace",
|
||||
"proj.ios_mac/HelloLua.xcodeproj/xcuserdata",
|
||||
"proj.win32/Debug.win32",
|
||||
|
@ -139,10 +165,6 @@
|
|||
"frameworks/runtime-src/proj.win32/PROJECT_NAME.sln",
|
||||
"frameworks/runtime-src/proj.win32/main.cpp",
|
||||
"frameworks/runtime-src/proj.win32/Runtime_win32.cpp",
|
||||
"frameworks/runtime-src/proj.android/.project",
|
||||
"frameworks/runtime-src/proj.android/AndroidManifest.xml",
|
||||
"frameworks/runtime-src/proj.android/build.xml",
|
||||
"frameworks/runtime-src/proj.android/res/values/strings.xml",
|
||||
"frameworks/runtime-src/proj.ios_mac/ios/main.m",
|
||||
"frameworks/runtime-src/proj.ios_mac/ios/Prefix.pch",
|
||||
"frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm",
|
||||
|
|
|
@ -90,10 +90,16 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App.xaml.cs" />
|
||||
<Compile Include="EditBox.xaml.cs" />
|
||||
<Compile Include="..\..\..\..\cocos\platform\wp8-xaml\xaml\App.xaml.cs">
|
||||
<Link>App.xaml.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\..\cocos\platform\wp8-xaml\xaml\EditBox.xaml.cs">
|
||||
<Link>EditBox.xaml.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\..\cocos\platform\wp8-xaml\xaml\MainPage.xaml.cs">
|
||||
<Link>MainPage.xaml.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="LocalizedStrings.cs" />
|
||||
<Compile Include="MainPage.xaml.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Resources\AppResources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
|
@ -148,15 +154,18 @@
|
|||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="App.xaml">
|
||||
<Page Include="..\..\..\..\cocos\platform\wp8-xaml\xaml\App.xaml">
|
||||
<Link>App.xaml</Link>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="EditBox.xaml">
|
||||
<Page Include="..\..\..\..\cocos\platform\wp8-xaml\xaml\EditBox.xaml">
|
||||
<Link>EditBox.xaml</Link>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="MainPage.xaml">
|
||||
<Page Include="..\..\..\..\cocos\platform\wp8-xaml\xaml\MainPage.xaml">
|
||||
<Link>MainPage.xaml</Link>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
|
|
|
@ -166,6 +166,7 @@ Classes/ShaderTest/ShaderTest.cpp \
|
|||
Classes/ShaderTest/ShaderTest2.cpp \
|
||||
Classes/SpineTest/SpineTest.cpp \
|
||||
Classes/SpriteTest/SpriteTest.cpp \
|
||||
Classes/Sprite3DTest/Sprite3DTest.cpp \
|
||||
Classes/TextInputTest/TextInputTest.cpp \
|
||||
Classes/Texture2dTest/Texture2dTest.cpp \
|
||||
Classes/TextureCacheTest/TextureCacheTest.cpp \
|
||||
|
|
|
@ -159,6 +159,7 @@ set(SAMPLE_SRC
|
|||
Classes/ShaderTest/ShaderTest.cpp
|
||||
Classes/ShaderTest/ShaderTest2.cpp
|
||||
Classes/SpriteTest/SpriteTest.cpp
|
||||
Classes/Sprite3DTest/Sprite3DTest.cpp
|
||||
Classes/TextInputTest/TextInputTest.cpp
|
||||
Classes/Texture2dTest/Texture2dTest.cpp
|
||||
Classes/TexturePackerEncryptionTest/TextureAtlasEncryptionTest.cpp
|
||||
|
|
|
@ -13,12 +13,11 @@ else if (_pos > _max) \
|
|||
// AccelerometerTest
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
AccelerometerTest::AccelerometerTest(void)
|
||||
: _lastTime(0.0)
|
||||
AccelerometerTest::AccelerometerTest()
|
||||
{
|
||||
}
|
||||
|
||||
AccelerometerTest::~AccelerometerTest(void)
|
||||
AccelerometerTest::~AccelerometerTest()
|
||||
{
|
||||
_ball->release();
|
||||
Device::setAccelerometerEnabled(false);
|
||||
|
@ -50,34 +49,21 @@ void AccelerometerTest::onEnter()
|
|||
|
||||
void AccelerometerTest::onAcceleration(Acceleration* acc, Event* event)
|
||||
{
|
||||
// double fNow = pAccelerationValue->timestamp;
|
||||
//
|
||||
// if (_lastTime > 0.0)
|
||||
// {
|
||||
// auto ptNow = convertToUI
|
||||
// }
|
||||
//
|
||||
// _lastTime = fNow;
|
||||
|
||||
auto pDir = Director::getInstance();
|
||||
|
||||
/*FIXME: Testing on the Nexus S sometimes _ball is NULL */
|
||||
if ( _ball == NULL ) {
|
||||
if ( _ball == nullptr ) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto ballSize = _ball->getContentSize();
|
||||
|
||||
auto ptNow = _ball->getPosition();
|
||||
auto ptTemp = pDir->convertToUI(ptNow);
|
||||
auto pos = _ball->getPosition();
|
||||
|
||||
ptTemp.x += acc->x * 9.81f;
|
||||
ptTemp.y -= acc->y * 9.81f;
|
||||
pos.x += acc->x * 9.81f;
|
||||
pos.y += acc->y * 9.81f;
|
||||
|
||||
auto ptNext = pDir->convertToGL(ptTemp);
|
||||
FIX_POS(ptNext.x, (VisibleRect::left().x+ballSize.width / 2.0), (VisibleRect::right().x - ballSize.width / 2.0));
|
||||
FIX_POS(ptNext.y, (VisibleRect::bottom().y+ballSize.height / 2.0), (VisibleRect::top().y - ballSize.height / 2.0));
|
||||
_ball->setPosition(ptNext);
|
||||
FIX_POS(pos.x, (VisibleRect::left().x+ballSize.width / 2.0), (VisibleRect::right().x - ballSize.width / 2.0));
|
||||
FIX_POS(pos.y, (VisibleRect::bottom().y+ballSize.height / 2.0), (VisibleRect::top().y - ballSize.height / 2.0));
|
||||
_ball->setPosition(pos);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
|
|
@ -9,11 +9,10 @@ class AccelerometerTest: public Layer
|
|||
{
|
||||
protected:
|
||||
Sprite* _ball;
|
||||
double _lastTime;
|
||||
|
||||
public:
|
||||
AccelerometerTest(void);
|
||||
~AccelerometerTest(void);
|
||||
AccelerometerTest();
|
||||
~AccelerometerTest();
|
||||
|
||||
void onAcceleration(Acceleration* acc, Event* event);
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue