mirror of https://github.com/axmolengine/axmol.git
merge cocos resolve conflict
This commit is contained in:
commit
8c8058a9be
|
@ -118,47 +118,13 @@ tests/*/publish/
|
|||
project.properties
|
||||
|
||||
# Ignore prebuilt libraries folder
|
||||
/external/xxhash/
|
||||
/external/curl/
|
||||
/external/edtaa3func/
|
||||
/external/freetype2/
|
||||
/external/glfw3/
|
||||
/external/jpeg/
|
||||
/external/json/
|
||||
/external/linux-specific/
|
||||
/external/lua/
|
||||
/external/png/
|
||||
/external/sqlite3/
|
||||
/external/tiff/
|
||||
/external/tinyxml2/
|
||||
/external/unzip/
|
||||
/external/webp/
|
||||
/external/websockets/
|
||||
/external/win32-specific/
|
||||
/external/winrt-specific/
|
||||
/external/winrt_8.1-specific/
|
||||
/external/wp8-specific/
|
||||
/external/wp_8.1-specific/
|
||||
/external/version.json
|
||||
/external/*
|
||||
!/external/config.json
|
||||
/templates/lua-template-runtime/runtime
|
||||
/v*-deps-*.zip
|
||||
/v*-lua-runtime-*.zip
|
||||
/tools/fbx-conv/
|
||||
external/chipmunk
|
||||
tests/cpp-tests/Resources/audio
|
||||
/external/Box2D/
|
||||
/external/ConvertUTF/
|
||||
/external/audio/
|
||||
/external/xxtea/
|
||||
/external/protobuf-lite/
|
||||
/external/flatbuffers/
|
||||
/external/android/
|
||||
/external/ios/
|
||||
/external/linux/
|
||||
/external/mac/
|
||||
/external/win32/
|
||||
/external/winrt_8.1/
|
||||
/external/wp_8.1/
|
||||
/tests/js-tests/
|
||||
/tests/lua-empty-test/src/cocos/
|
||||
/tests/lua-game-controller-test/src/cocos/
|
||||
|
|
7
AUTHORS
7
AUTHORS
|
@ -540,6 +540,7 @@ Developers:
|
|||
|
||||
hawkwood (Justin Hawkwood)
|
||||
Fixing a bug that EditBox doesn't show any text if it's initialized with text.
|
||||
Fixed a memory leak in new Audio.
|
||||
|
||||
wtyqm (zhang peng)
|
||||
Fixing a bug that ccbRootPath wasn't passed to sub ccb nodes.
|
||||
|
@ -1089,6 +1090,12 @@ Developers:
|
|||
|
||||
loadrunner
|
||||
Added romanian languange support
|
||||
|
||||
Almax27
|
||||
RenderQueue command buffer optimize.
|
||||
|
||||
IgorMats
|
||||
Added MotionStreak::getStroke/setStroke
|
||||
|
||||
Retired Core Developers:
|
||||
WenSheng Yang
|
||||
|
|
35
CHANGELOG
35
CHANGELOG
|
@ -1,5 +1,38 @@
|
|||
cocos2d-x-3.6beta Apr.14 2015
|
||||
cocos2d-x-3.6beta0 Apr.14 2015
|
||||
[NEW] MotionStreak: add `MotionStreak::getStroke()` and `MotionStreak::setStroke()`
|
||||
[NEW] UI:Text: add `Text::disableEffect(LabelEffect)` to disable a specific effect
|
||||
|
||||
[FIX] Label: position is wrong if it is visited by a new camera
|
||||
[FIX] Physics: rigid body's rotation is wrong if it is attatched to a node which rotation is not 0
|
||||
[FIX] Renderer: RenderQueue command buffer optimizing
|
||||
[FIX] UI:Text: content size is wrong after setting outline effect
|
||||
|
||||
cocos2d-x-3.6alpha0 Apr.8 2015
|
||||
[NEW] 3D: added texturecube support
|
||||
[NEW] 3D: added skybox support
|
||||
[NEW] 3D: added node animation support
|
||||
[NEW] 3D: added terrian support
|
||||
[NEW] 3rd: updated libcurl to v7.4 on all supported platforms except WP8/WP8.1 universal
|
||||
[NEW] 3rd: updated chipmunk to v6.2.2
|
||||
[NEW] 3rd: updated openssl to v1.0.11
|
||||
[NEW] 3rd: updated freetype to v2.5.5
|
||||
[NEW] 3rd: updated png to v1.6.16 on all supported platforms except WP8/WP8.1 universal because it is not needed on these two platforms
|
||||
[NEW] Animate3D: added `Animate3D::setHighQuality()` to set animation quality
|
||||
[NEW] Label: added disableEffect()
|
||||
[NEW] Lua-binding: used luajit arm64 version on iOS 64-bit devices
|
||||
[NEW] Sprite3D: getAABBRecursively return own aabb combining childeren's
|
||||
[NEW] Vec3: added `Vec3::add(float, float, float)` and `Vec3::setZero()`
|
||||
|
||||
[FIX] Audio: memory leak
|
||||
[FIX] Audio: crashed on iOS 5.1.1
|
||||
[FIX] C++: lag issue if `Director::setContentScaleFactor` is called frequently
|
||||
[FIX] C++: CDT builder is enabled by default in cpp template on Android
|
||||
[FIX] Label: shadow color is incorrect
|
||||
[FIX] MenuItem: crash if `MenuItem::onExit` is called multiple times
|
||||
[FIX] Particle3D: particles' rotation affect particle system's rotation
|
||||
[FIX] Sprite3D: memory leak
|
||||
[FIX] Vec3: use inline function to improve performance
|
||||
[FIX] WebView: loadHTMLString() can not work if it is invoked in the same frame of creating a webview on iOS
|
||||
|
||||
cocos2d-x-3.5 Mar.23 2015
|
||||
[NEW] EditBox: support Color4B
|
||||
|
|
|
@ -29,16 +29,16 @@ cmake_minimum_required(VERSION 2.8)
|
|||
# also from cmake's Modules dir, to not clash with per-project files.
|
||||
cmake_policy(SET CMP0017 NEW)
|
||||
|
||||
# Use new behaviour with cmake >= 3.0:
|
||||
# Use new behaviour with cmake >= 3.1:
|
||||
# Only interpret if() arguments as variables or keywords when unquoted.
|
||||
if(CMAKE_VERSION VERSION_GREATER 3)
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.1)
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
endif()
|
||||
|
||||
project (Cocos2d-X)
|
||||
|
||||
# The version number
|
||||
set(COCOS2D_X_VERSION 3.5)
|
||||
set(COCOS2D_X_VERSION 3.6beta0)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules/")
|
||||
include(CocosBuildHelpers)
|
||||
|
|
|
@ -157,7 +157,7 @@ Select the test you want from Xcode Scheme chooser.
|
|||
|
||||
```
|
||||
$ cd cocos2d-x/build
|
||||
$ open cocos_tests.xcodeproj
|
||||
$ open cocos2d_tests.xcodeproj
|
||||
```
|
||||
|
||||
* For Linux
|
||||
|
|
|
@ -1282,6 +1282,8 @@
|
|||
38B8E2E219E671D2002D7CE7 /* UILayoutComponent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38B8E2DF19E671D2002D7CE7 /* UILayoutComponent.cpp */; };
|
||||
38B8E2E319E671D2002D7CE7 /* UILayoutComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 38B8E2E019E671D2002D7CE7 /* UILayoutComponent.h */; };
|
||||
38B8E2E419E671D2002D7CE7 /* UILayoutComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 38B8E2E019E671D2002D7CE7 /* UILayoutComponent.h */; };
|
||||
38D9629D1ACA9721007C6FAF /* CocoStudio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38D9629C1ACA9721007C6FAF /* CocoStudio.cpp */; };
|
||||
38D9629E1ACA9721007C6FAF /* CocoStudio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38D9629C1ACA9721007C6FAF /* CocoStudio.cpp */; };
|
||||
38F5263E1A48363B000DB7F7 /* ArmatureNodeReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38F5263B1A48363B000DB7F7 /* ArmatureNodeReader.cpp */; };
|
||||
38F5263F1A48363B000DB7F7 /* ArmatureNodeReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38F5263B1A48363B000DB7F7 /* ArmatureNodeReader.cpp */; };
|
||||
38F526401A48363B000DB7F7 /* ArmatureNodeReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 38F5263C1A48363B000DB7F7 /* ArmatureNodeReader.h */; };
|
||||
|
@ -1797,7 +1799,6 @@
|
|||
B21770421977ECF8009EE11B /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B21770411977ECF8009EE11B /* ApplicationServices.framework */; };
|
||||
B21770451977ED14009EE11B /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B21770431977ED07009EE11B /* Cocoa.framework */; };
|
||||
B21770471977ED34009EE11B /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B21770461977ED34009EE11B /* QuartzCore.framework */; };
|
||||
B21770491977ED4C009EE11B /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B21770481977ED4C009EE11B /* libz.dylib */; };
|
||||
B217704E1977ED9F009EE11B /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B217704C1977ED8B009EE11B /* libsqlite3.dylib */; };
|
||||
B230ED7119B417AE00364AA8 /* CCTrianglesCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B230ED6F19B417AE00364AA8 /* CCTrianglesCommand.cpp */; };
|
||||
B230ED7219B417AE00364AA8 /* CCTrianglesCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B230ED6F19B417AE00364AA8 /* CCTrianglesCommand.cpp */; };
|
||||
|
@ -1952,6 +1953,10 @@
|
|||
B29A7E3F19EE1B7700872B35 /* AnimationState.h in Headers */ = {isa = PBXBuildFile; fileRef = B29A7DC619EE1B7700872B35 /* AnimationState.h */; };
|
||||
B29A7E4019EE1B7700872B35 /* AnimationState.h in Headers */ = {isa = PBXBuildFile; fileRef = B29A7DC619EE1B7700872B35 /* AnimationState.h */; };
|
||||
B2CC507C19776DD10041958E /* CCPhysicsJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A170721807CE7A005B8026 /* CCPhysicsJoint.cpp */; };
|
||||
B603F1A81AC8EA0900A9579C /* CCTerrain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B603F1A61AC8EA0900A9579C /* CCTerrain.cpp */; };
|
||||
B603F1A91AC8EA0900A9579C /* CCTerrain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B603F1A61AC8EA0900A9579C /* CCTerrain.cpp */; };
|
||||
B603F1AA1AC8EA0900A9579C /* CCTerrain.h in Headers */ = {isa = PBXBuildFile; fileRef = B603F1A71AC8EA0900A9579C /* CCTerrain.h */; };
|
||||
B603F1AB1AC8EA0900A9579C /* CCTerrain.h in Headers */ = {isa = PBXBuildFile; fileRef = B603F1A71AC8EA0900A9579C /* CCTerrain.h */; };
|
||||
B60C5BD419AC68B10056FBDE /* CCBillBoard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B60C5BD219AC68B10056FBDE /* CCBillBoard.cpp */; };
|
||||
B60C5BD519AC68B10056FBDE /* CCBillBoard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B60C5BD219AC68B10056FBDE /* CCBillBoard.cpp */; };
|
||||
B60C5BD619AC68B10056FBDE /* CCBillBoard.h in Headers */ = {isa = PBXBuildFile; fileRef = B60C5BD319AC68B10056FBDE /* CCBillBoard.h */; };
|
||||
|
@ -2981,6 +2986,7 @@
|
|||
1AD71EEF180E27CF00808F54 /* CCPhysicsSprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPhysicsSprite.h; sourceTree = "<group>"; };
|
||||
29031E0619BFE8D400EFA1DF /* libchipmunk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libchipmunk.a; path = prebuilt/mac/libchipmunk.a; sourceTree = "<group>"; };
|
||||
29031E0819BFE8DE00EFA1DF /* libchipmunk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libchipmunk.a; path = prebuilt/ios/libchipmunk.a; sourceTree = "<group>"; };
|
||||
2905E9CC1ACD3D8C00092DD2 /* libz.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libz.a; path = ../external/zlib/prebuilt/mac/libz.a; sourceTree = "<group>"; };
|
||||
2905F9E918CF08D000240AA3 /* CocosGUI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CocosGUI.cpp; sourceTree = "<group>"; };
|
||||
2905F9EA18CF08D000240AA3 /* CocosGUI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocosGUI.h; sourceTree = "<group>"; };
|
||||
2905F9EB18CF08D000240AA3 /* GUIDefine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDefine.h; sourceTree = "<group>"; };
|
||||
|
@ -3109,6 +3115,7 @@
|
|||
38B8E2D419E66581002D7CE7 /* CSLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSLoader.h; sourceTree = "<group>"; };
|
||||
38B8E2DF19E671D2002D7CE7 /* UILayoutComponent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UILayoutComponent.cpp; sourceTree = "<group>"; };
|
||||
38B8E2E019E671D2002D7CE7 /* UILayoutComponent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILayoutComponent.h; sourceTree = "<group>"; };
|
||||
38D9629C1ACA9721007C6FAF /* CocoStudio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CocoStudio.cpp; sourceTree = "<group>"; };
|
||||
38F5263B1A48363B000DB7F7 /* ArmatureNodeReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArmatureNodeReader.cpp; sourceTree = "<group>"; };
|
||||
38F5263C1A48363B000DB7F7 /* ArmatureNodeReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArmatureNodeReader.h; sourceTree = "<group>"; };
|
||||
38F5263D1A48363B000DB7F7 /* CSArmatureNode_generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSArmatureNode_generated.h; sourceTree = "<group>"; };
|
||||
|
@ -3672,6 +3679,10 @@
|
|||
B29A7DC619EE1B7700872B35 /* AnimationState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimationState.h; sourceTree = "<group>"; };
|
||||
B3AF019E1842FBA400A98B85 /* b2MotorJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2MotorJoint.cpp; sourceTree = "<group>"; };
|
||||
B3AF019F1842FBA400A98B85 /* b2MotorJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2MotorJoint.h; sourceTree = "<group>"; };
|
||||
B603F1A61AC8EA0900A9579C /* CCTerrain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTerrain.cpp; sourceTree = "<group>"; };
|
||||
B603F1A71AC8EA0900A9579C /* CCTerrain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTerrain.h; sourceTree = "<group>"; };
|
||||
B603F1B11AC8F1FD00A9579C /* ccShader_3D_Terrain.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_Terrain.frag; sourceTree = "<group>"; };
|
||||
B603F1B21AC8F1FD00A9579C /* ccShader_3D_Terrain.vert */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_Terrain.vert; sourceTree = "<group>"; };
|
||||
B60C5BD219AC68B10056FBDE /* CCBillBoard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBillBoard.cpp; sourceTree = "<group>"; };
|
||||
B60C5BD319AC68B10056FBDE /* CCBillBoard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBillBoard.h; sourceTree = "<group>"; };
|
||||
B63990CA1A490AFE00B07923 /* CCAsyncTaskPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCAsyncTaskPool.cpp; path = ../base/CCAsyncTaskPool.cpp; sourceTree = "<group>"; };
|
||||
|
@ -4020,7 +4031,6 @@
|
|||
292F1A6B1A5250F700E479F8 /* libssl.a in Frameworks */,
|
||||
292F1A631A52447100E479F8 /* libcrypto.a in Frameworks */,
|
||||
B217704E1977ED9F009EE11B /* libsqlite3.dylib in Frameworks */,
|
||||
B21770491977ED4C009EE11B /* libz.dylib in Frameworks */,
|
||||
B21770471977ED34009EE11B /* QuartzCore.framework in Frameworks */,
|
||||
B21770451977ED14009EE11B /* Cocoa.framework in Frameworks */,
|
||||
B21770421977ECF8009EE11B /* ApplicationServices.framework in Frameworks */,
|
||||
|
@ -4118,6 +4128,7 @@
|
|||
1551A341158F2AB200E66CFE /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2905E9CC1ACD3D8C00092DD2 /* libz.a */,
|
||||
292F1A661A524F2700E479F8 /* libssl.dylib */,
|
||||
B217704C1977ED8B009EE11B /* libsqlite3.dylib */,
|
||||
B217704A1977ED55009EE11B /* libcurl.dylib */,
|
||||
|
@ -4868,6 +4879,7 @@
|
|||
1A8C5984180E930E00EF57C3 /* CCUtilMath.cpp */,
|
||||
1A8C5985180E930E00EF57C3 /* CCUtilMath.h */,
|
||||
1A8C5986180E930E00EF57C3 /* CocoStudio.h */,
|
||||
38D9629C1ACA9721007C6FAF /* CocoStudio.cpp */,
|
||||
1A8C5989180E930E00EF57C3 /* DictionaryHelper.cpp */,
|
||||
1A8C598A180E930E00EF57C3 /* DictionaryHelper.h */,
|
||||
);
|
||||
|
@ -5873,6 +5885,8 @@
|
|||
5034CA5D191D591900CE6051 /* shaders */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B603F1B11AC8F1FD00A9579C /* ccShader_3D_Terrain.frag */,
|
||||
B603F1B21AC8F1FD00A9579C /* ccShader_3D_Terrain.vert */,
|
||||
B6D38B941AC3B45600043997 /* ccShader_3D_Particle.frag */,
|
||||
B6D38B951AC3B45600043997 /* ccShader_3D_Particle.vert */,
|
||||
B6D38B961AC3B45600043997 /* ccShader_3D_Skybox.frag */,
|
||||
|
@ -6173,6 +6187,8 @@
|
|||
B29594B81926D61F003EEF37 /* 3d */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B603F1A61AC8EA0900A9579C /* CCTerrain.cpp */,
|
||||
B603F1A71AC8EA0900A9579C /* CCTerrain.h */,
|
||||
B6D38B861AC3AFAC00043997 /* CCSkybox.cpp */,
|
||||
B6D38B871AC3AFAC00043997 /* CCSkybox.h */,
|
||||
B6D38B881AC3AFAC00043997 /* CCTextureCube.cpp */,
|
||||
|
@ -6668,6 +6684,7 @@
|
|||
B665E29C1AA80A6500DDB1C5 /* CCPUEmitterTranslator.h in Headers */,
|
||||
15AE1BD719AAE01E00C27E9E /* CCControlSlider.h in Headers */,
|
||||
15AE1BE519AAE01E00C27E9E /* CCTableView.h in Headers */,
|
||||
B603F1AA1AC8EA0900A9579C /* CCTerrain.h in Headers */,
|
||||
15AE1BD319AAE01E00C27E9E /* CCControlPotentiometer.h in Headers */,
|
||||
15AE1B6E19AADA9900C27E9E /* UIHelper.h in Headers */,
|
||||
B230ED7319B417AE00364AA8 /* CCTrianglesCommand.h in Headers */,
|
||||
|
@ -7594,6 +7611,7 @@
|
|||
1A570213180BCBF40088DEC7 /* CCProgressTimer.h in Headers */,
|
||||
38F526431A48363B000DB7F7 /* CSArmatureNode_generated.h in Headers */,
|
||||
1A570217180BCBF40088DEC7 /* CCRenderTexture.h in Headers */,
|
||||
B603F1AB1AC8EA0900A9579C /* CCTerrain.h in Headers */,
|
||||
15AE1ABB19AAD40300C27E9E /* b2EdgeAndPolygonContact.h in Headers */,
|
||||
15AE198719AAD36400C27E9E /* WidgetReaderProtocol.h in Headers */,
|
||||
B665E3ED1AA80A6600DDB1C5 /* CCPUSlaveBehaviour.h in Headers */,
|
||||
|
@ -8088,6 +8106,7 @@
|
|||
50ABBEC51925AB6F00A911A9 /* etc1.cpp in Sources */,
|
||||
50643BDE19BFCCA400EF68ED /* LocalStorage-android.cpp in Sources */,
|
||||
15AE1B5B19AADA9900C27E9E /* UITextAtlas.cpp in Sources */,
|
||||
B603F1A81AC8EA0900A9579C /* CCTerrain.cpp in Sources */,
|
||||
1A570065180BC5A10088DEC7 /* CCActionCamera.cpp in Sources */,
|
||||
50ABBEAB1925AB6F00A911A9 /* ccTypes.cpp in Sources */,
|
||||
B665E3AE1AA80A6500DDB1C5 /* CCPURender.cpp in Sources */,
|
||||
|
@ -8602,6 +8621,7 @@
|
|||
B665E2561AA80A6500DDB1C5 /* CCPUDoAffectorEventHandlerTranslator.cpp in Sources */,
|
||||
15AE18A419AAD33D00C27E9E /* CCScale9SpriteLoader.cpp in Sources */,
|
||||
182C5CD61A98F30500C30D34 /* Sprite3DReader.cpp in Sources */,
|
||||
38D9629D1ACA9721007C6FAF /* CocoStudio.cpp in Sources */,
|
||||
B665E3D61AA80A6600DDB1C5 /* CCPUScriptParser.cpp in Sources */,
|
||||
15AE1B5719AADA9900C27E9E /* UISlider.cpp in Sources */,
|
||||
B665E2F61AA80A6500DDB1C5 /* CCPUListener.cpp in Sources */,
|
||||
|
@ -8946,6 +8966,7 @@
|
|||
15AE1BE819AAE01E00C27E9E /* CCControl.cpp in Sources */,
|
||||
1A570226180BCC1A0088DEC7 /* CCParticleExamples.cpp in Sources */,
|
||||
15AE194919AAD35100C27E9E /* CCComController.cpp in Sources */,
|
||||
B603F1A91AC8EA0900A9579C /* CCTerrain.cpp in Sources */,
|
||||
B665E3CF1AA80A6600DDB1C5 /* CCPUScriptCompiler.cpp in Sources */,
|
||||
1A57022A180BCC1A0088DEC7 /* CCParticleSystem.cpp in Sources */,
|
||||
15AE182919AAD2F700C27E9E /* CCMeshSkin.cpp in Sources */,
|
||||
|
@ -9044,6 +9065,7 @@
|
|||
B665E3AF1AA80A6500DDB1C5 /* CCPURender.cpp in Sources */,
|
||||
382383FB1A258FA7002C4610 /* idl_gen_go.cpp in Sources */,
|
||||
B665E2EF1AA80A6500DDB1C5 /* CCPULineEmitter.cpp in Sources */,
|
||||
38D9629E1ACA9721007C6FAF /* CocoStudio.cpp in Sources */,
|
||||
50ABBDBA1925AB4100A911A9 /* CCTextureAtlas.cpp in Sources */,
|
||||
1A5702FB180BCE750088DEC7 /* CCTMXXMLParser.cpp in Sources */,
|
||||
B665E40B1AA80A6600DDB1C5 /* CCPUSphereSurfaceEmitterTranslator.cpp in Sources */,
|
||||
|
@ -9331,10 +9353,11 @@
|
|||
"\"$(SRCROOT)/../external/websockets/prebuilt/mac\"",
|
||||
"\"$(SRCROOT)/../external/chipmunk/prebuilt/mac\"",
|
||||
"\"$(SRCROOT)/../external/curl/prebuilt/mac\"",
|
||||
"\"$(SRCROOT)/../external/zlib/prebuilt/mac\"",
|
||||
);
|
||||
MACH_O_TYPE = staticlib;
|
||||
OTHER_LDFLAGS = "";
|
||||
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/glfw3/include/mac $(SRCROOT)/../external/websockets/include/mac $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../external/curl/include/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/glfw3/include/mac $(SRCROOT)/../external/websockets/include/mac $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../external/curl/include/mac $(SRCROOT)/../external/freetype2/include/mac/freetype2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -9367,10 +9390,11 @@
|
|||
"\"$(SRCROOT)/../external/websockets/prebuilt/mac\"",
|
||||
"\"$(SRCROOT)/../external/chipmunk/prebuilt/mac\"",
|
||||
"\"$(SRCROOT)/../external/curl/prebuilt/mac\"",
|
||||
"\"$(SRCROOT)/../external/zlib/prebuilt/mac\"",
|
||||
);
|
||||
MACH_O_TYPE = staticlib;
|
||||
OTHER_LDFLAGS = "";
|
||||
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/glfw3/include/mac $(SRCROOT)/../external/websockets/include/mac $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../external/curl/include/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/glfw3/include/mac $(SRCROOT)/../external/websockets/include/mac $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../external/curl/include/mac $(SRCROOT)/../external/freetype2/include/mac/freetype2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -9400,7 +9424,7 @@
|
|||
);
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(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 $(SRCROOT)/../external/websockets/include/ios $(SRCROOT)/../external/chipmunk/include/chipmunk";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(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 $(SRCROOT)/../external/websockets/include/ios $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../external/freetype2/include/ios/freetype2";
|
||||
VALID_ARCHS = "arm64 armv7";
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -9432,7 +9456,7 @@
|
|||
);
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(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 $(SRCROOT)/../external/websockets/include/ios $(SRCROOT)/../external/chipmunk/include/chipmunk";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(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 $(SRCROOT)/../external/websockets/include/ios $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../external/freetype2/include/ios/freetype2";
|
||||
VALID_ARCHS = "arm64 armv7";
|
||||
};
|
||||
name = Release;
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
/* End PBXAggregateTarget section */
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1502702D1AD3BDBC0089CD03 /* TerrainTest in Resources */ = {isa = PBXBuildFile; fileRef = B603F1B31AC8FBFB00A9579C /* TerrainTest */; };
|
||||
1502702E1AD3BDC90089CD03 /* TerrainTest in Resources */ = {isa = PBXBuildFile; fileRef = B603F1B31AC8FBFB00A9579C /* TerrainTest */; };
|
||||
150F918819DA409E00B89F57 /* lua_test_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150F918619DA409E00B89F57 /* lua_test_bindings.cpp */; };
|
||||
150F918919DA409F00B89F57 /* lua_test_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150F918619DA409E00B89F57 /* lua_test_bindings.cpp */; };
|
||||
15427B79198B879900DC375D /* libluacocos2d iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15EFA665198B33EE000C57D3 /* libluacocos2d iOS.a */; };
|
||||
|
@ -814,6 +816,10 @@
|
|||
A5030C3619D059DA000E78E7 /* OpenURLTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5030C3319D059DA000E78E7 /* OpenURLTest.cpp */; };
|
||||
B2507B6B192589AF00FA4972 /* Shaders3D in Resources */ = {isa = PBXBuildFile; fileRef = B2507B6A192589AF00FA4972 /* Shaders3D */; };
|
||||
B2507B6C192589AF00FA4972 /* Shaders3D in Resources */ = {isa = PBXBuildFile; fileRef = B2507B6A192589AF00FA4972 /* Shaders3D */; };
|
||||
B603F1AF1AC8EA4E00A9579C /* TerrainTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B603F1AD1AC8EA4E00A9579C /* TerrainTest.cpp */; };
|
||||
B603F1B01AC8EA4E00A9579C /* TerrainTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B603F1AD1AC8EA4E00A9579C /* TerrainTest.cpp */; };
|
||||
B603F1B41AC8FBFB00A9579C /* TerrainTest in Resources */ = {isa = PBXBuildFile; fileRef = B603F1B31AC8FBFB00A9579C /* TerrainTest */; };
|
||||
B603F1B51AC8FBFB00A9579C /* TerrainTest in Resources */ = {isa = PBXBuildFile; fileRef = B603F1B31AC8FBFB00A9579C /* TerrainTest */; };
|
||||
B609E67319C18DAD003D0074 /* BillBoardTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B609E67119C18DAD003D0074 /* BillBoardTest.cpp */; };
|
||||
B609E67419C18DAD003D0074 /* BillBoardTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B609E67119C18DAD003D0074 /* BillBoardTest.cpp */; };
|
||||
B6337DF71ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6337DF51ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp */; };
|
||||
|
@ -1752,6 +1758,9 @@
|
|||
A5030C3319D059DA000E78E7 /* OpenURLTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OpenURLTest.cpp; path = OpenURLTest/OpenURLTest.cpp; sourceTree = "<group>"; };
|
||||
A5030C3419D059DA000E78E7 /* OpenURLTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OpenURLTest.h; path = OpenURLTest/OpenURLTest.h; sourceTree = "<group>"; };
|
||||
B2507B6A192589AF00FA4972 /* Shaders3D */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Shaders3D; path = "../tests/cpp-tests/Resources/Shaders3D"; sourceTree = "<group>"; };
|
||||
B603F1AD1AC8EA4E00A9579C /* TerrainTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TerrainTest.cpp; path = TerrainTest/TerrainTest.cpp; sourceTree = "<group>"; };
|
||||
B603F1AE1AC8EA4E00A9579C /* TerrainTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TerrainTest.h; path = TerrainTest/TerrainTest.h; sourceTree = "<group>"; };
|
||||
B603F1B31AC8FBFB00A9579C /* TerrainTest */ = {isa = PBXFileReference; lastKnownFileType = folder; name = TerrainTest; path = "../tests/cpp-tests/Resources/TerrainTest"; sourceTree = "<group>"; };
|
||||
B609E67119C18DAD003D0074 /* BillBoardTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BillBoardTest.cpp; path = BillBoardTest/BillBoardTest.cpp; sourceTree = "<group>"; };
|
||||
B609E67219C18DAD003D0074 /* BillBoardTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BillBoardTest.h; path = BillBoardTest/BillBoardTest.h; sourceTree = "<group>"; };
|
||||
B6337DF51ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceParticle3DTest.cpp; sourceTree = "<group>"; };
|
||||
|
@ -2179,6 +2188,7 @@
|
|||
1AC3592418CECF0A00F37B72 /* Classes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B603F1AC1AC8EA2E00A9579C /* TerrainTest */,
|
||||
182C5CB71A95B28A00C30D34 /* CocosStudio3DTest */,
|
||||
B639932B1A490E9900B07923 /* Particle3DTest */,
|
||||
D0FD03611A3B543700825BB5 /* AllocatorTest */,
|
||||
|
@ -3216,6 +3226,7 @@
|
|||
1AC35CA818CED83500F37B72 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B603F1B31AC8FBFB00A9579C /* TerrainTest */,
|
||||
B63993301A49359F00B07923 /* Particle3D */,
|
||||
15B3709219EE5D1000ABE682 /* Manifests */,
|
||||
3E2BDB0019C5E5D40055CDCD /* background.wav */,
|
||||
|
@ -3951,6 +3962,15 @@
|
|||
name = OpenURLTest;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B603F1AC1AC8EA2E00A9579C /* TerrainTest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B603F1AD1AC8EA4E00A9579C /* TerrainTest.cpp */,
|
||||
B603F1AE1AC8EA4E00A9579C /* TerrainTest.h */,
|
||||
);
|
||||
name = TerrainTest;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B609E67019C18D90003D0074 /* BillBoardTest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -4358,6 +4378,7 @@
|
|||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1502702E1AD3BDC90089CD03 /* TerrainTest in Resources */,
|
||||
157B08EC1A90864100B7BEA4 /* Particle3D in Resources */,
|
||||
15B13E5219F0FD4D008A1ADC /* Manifests in Resources */,
|
||||
156EAE071977D0BD00F53709 /* ActionTimeline in Resources */,
|
||||
|
@ -4403,6 +4424,7 @@
|
|||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1502702D1AD3BDBC0089CD03 /* TerrainTest in Resources */,
|
||||
157B08ED1A90865600B7BEA4 /* Particle3D in Resources */,
|
||||
15B3709A19EE5EED00ABE682 /* Manifests in Resources */,
|
||||
15AECE0F195C1FDD00907DB0 /* cocosvideo.mp4 in Resources */,
|
||||
|
@ -4493,6 +4515,7 @@
|
|||
3E92EA851921A7720094CD21 /* Sprite3DTest in Resources */,
|
||||
1AC35CA318CECF1E00F37B72 /* InfoPlist.strings in Resources */,
|
||||
1AC35CA418CECF1E00F37B72 /* MainMenu.xib in Resources */,
|
||||
B603F1B41AC8FBFB00A9579C /* TerrainTest in Resources */,
|
||||
1AC35CD418CED84500F37B72 /* ccb in Resources */,
|
||||
C08689C118D370C90093E810 /* background.caf in Resources */,
|
||||
1AC35CE418CED84500F37B72 /* effect1.wav in Resources */,
|
||||
|
@ -4538,6 +4561,7 @@
|
|||
1AC35C9618CECF1400F37B72 /* Icon-76.png in Resources */,
|
||||
1AC35C8A18CECF1400F37B72 /* Default@2x.png in Resources */,
|
||||
1AC35CE318CED84500F37B72 /* effect1.raw in Resources */,
|
||||
B603F1B51AC8FBFB00A9579C /* TerrainTest in Resources */,
|
||||
1A221C9D191771E400FD2BE4 /* ccs-res in Resources */,
|
||||
1AC35C9018CECF1400F37B72 /* Icon-29.png in Resources */,
|
||||
1AC35D0918CED84500F37B72 /* TileMaps in Resources */,
|
||||
|
@ -4817,6 +4841,7 @@
|
|||
1AC35C2118CECF0C00F37B72 /* ParallaxTest.cpp in Sources */,
|
||||
1AC35C6B18CECF0C00F37B72 /* ZwoptexTest.cpp in Sources */,
|
||||
1AC35B7718CECF0C00F37B72 /* ComponentsTestScene.cpp in Sources */,
|
||||
B603F1AF1AC8EA4E00A9579C /* TerrainTest.cpp in Sources */,
|
||||
29080DC7191B595E0066F8DF /* UISceneManager.cpp in Sources */,
|
||||
1AC35C2F18CECF0C00F37B72 /* PerformanceParticleTest.cpp in Sources */,
|
||||
1AC35B4918CECF0C00F37B72 /* Bug-914.cpp in Sources */,
|
||||
|
@ -5174,6 +5199,7 @@
|
|||
298D7F6F19AC31F300FF096D /* UIWebViewTest.cpp in Sources */,
|
||||
29080DA6191B595E0066F8DF /* UIButtonTest_Editor.cpp in Sources */,
|
||||
1AC35B5018CECF0C00F37B72 /* ClickAndMoveTest.cpp in Sources */,
|
||||
B603F1B01AC8EA4E00A9579C /* TerrainTest.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -5383,6 +5409,12 @@
|
|||
"$(inherited)",
|
||||
"$(DEVELOPER_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator*][arch=x86_64]" = (
|
||||
"-pagezero_size",
|
||||
10000,
|
||||
"-image_base",
|
||||
100000000,
|
||||
);
|
||||
PRODUCT_NAME = "lua-game-controller-test iOS";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
|
@ -5409,6 +5441,12 @@
|
|||
"$(inherited)",
|
||||
"$(DEVELOPER_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator*][arch=x86_64]" = (
|
||||
"-pagezero_size",
|
||||
10000,
|
||||
"-image_base",
|
||||
100000000,
|
||||
);
|
||||
PRODUCT_NAME = "lua-game-controller-test iOS";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
|
@ -5535,6 +5573,12 @@
|
|||
"$(inherited)",
|
||||
"$(SRCROOT)/../external/curl/prebuilt/ios",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator*][arch=x86_64]" = (
|
||||
"-pagezero_size",
|
||||
10000,
|
||||
"-image_base",
|
||||
100000000,
|
||||
);
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../cocos/scripting/lua-bindings/manual $(SRCROOT)/../cocos/scripting/lua-bindings/auto";
|
||||
|
@ -5556,6 +5600,12 @@
|
|||
"$(inherited)",
|
||||
"$(SRCROOT)/../external/curl/prebuilt/ios",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator*][arch=x86_64]" = (
|
||||
"-pagezero_size",
|
||||
10000,
|
||||
"-image_base",
|
||||
100000000,
|
||||
);
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../cocos/scripting/lua-bindings/manual $(SRCROOT)/../cocos/scripting/lua-bindings/auto";
|
||||
|
@ -5617,6 +5667,12 @@
|
|||
"$(SRCROOT)/../external/curl/prebuilt/ios",
|
||||
"/Users/cocos2d/MyWork/cocos2d-x-develop/external/curl/prebuilt/ios",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator*][arch=x86_64]" = (
|
||||
"-pagezero_size",
|
||||
10000,
|
||||
"-image_base",
|
||||
100000000,
|
||||
);
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../cocos/scripting/lua-bindings/manual $(SRCROOT)/../cocos/scripting/lua-bindings/auto";
|
||||
|
@ -5638,6 +5694,12 @@
|
|||
"$(SRCROOT)/../external/curl/prebuilt/ios",
|
||||
"/Users/cocos2d/MyWork/cocos2d-x-develop/external/curl/prebuilt/ios",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator*][arch=x86_64]" = (
|
||||
"-pagezero_size",
|
||||
10000,
|
||||
"-image_base",
|
||||
100000000,
|
||||
);
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../cocos/scripting/lua-bindings/manual $(SRCROOT)/../cocos/scripting/lua-bindings/auto";
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
<ClCompile>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(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\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(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\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8\freetype;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>WP8_SHADER_COMPILER;CC_USE_PHYSICS=0;CC_STATIC;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
|
@ -140,7 +140,7 @@
|
|||
<ClCompile>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(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\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(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\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8\freetype;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>WP8_SHADER_COMPILER;CC_USE_PHYSICS=0;CC_STATIC;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
|
@ -156,7 +156,7 @@
|
|||
<ClCompile>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(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\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(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\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8\freetype;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>WP8_SHADER_COMPILER;CC_USE_PHYSICS=0;CC_STATIC;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
|
@ -172,7 +172,7 @@
|
|||
<ClCompile>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(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\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(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\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8\freetype;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>WP8_SHADER_COMPILER;CC_USE_PHYSICS=0;CC_STATIC;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
|
@ -188,7 +188,7 @@
|
|||
<ClCompile>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(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\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(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\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8\freetype;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>WP8_SHADER_COMPILER;CC_USE_PHYSICS=0;CC_STATIC;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
|
@ -204,7 +204,7 @@
|
|||
<ClCompile>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(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\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(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\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8\freetype;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>WP8_SHADER_COMPILER;CC_USE_PHYSICS=0;CC_STATIC;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
|
|
|
@ -58,7 +58,7 @@ set(_OpenalSoft_inc_paths AL)
|
|||
set(_OpenalSoft_libs OpenAL32)
|
||||
|
||||
set(_zlib_inc zlib.h)
|
||||
set(_zlib_libs libzlib)
|
||||
set(_zlib_libs z libzlib libz)
|
||||
|
||||
set(_fmod_prefix FMODEX)
|
||||
set(_fmod_inc fmod.h)
|
||||
|
@ -77,7 +77,7 @@ set(all_prebuilt_libs
|
|||
|
||||
|
||||
if(MACOSX)
|
||||
list(APPEND all_prebuilt_libs glfw3)
|
||||
list(APPEND all_prebuilt_libs glfw3 zlib)
|
||||
endif()
|
||||
|
||||
# We use MSVC instead of WINDOWS because it can be mingw that can't use our prebuilt libs
|
||||
|
|
|
@ -109,7 +109,7 @@ public:
|
|||
* @param time A value between 0 and 1.
|
||||
*/
|
||||
virtual void update(float time);
|
||||
/** Return certain target..
|
||||
/** Return certain target.
|
||||
*
|
||||
* @return A certain target.
|
||||
*/
|
||||
|
|
|
@ -60,9 +60,9 @@ ActionCamera * ActionCamera::reverse() const
|
|||
|
||||
void ActionCamera::restore()
|
||||
{
|
||||
_center = Vec3(0, 0, 0);
|
||||
_eye = Vec3(0, 0, FLT_EPSILON);
|
||||
_up = Vec3(0, 1, 0);
|
||||
_center.setZero();
|
||||
_eye.set(0.0f, 0.0f, FLT_EPSILON);
|
||||
_up.set(0.0f, 1.0f, 0.0f);
|
||||
}
|
||||
|
||||
void ActionCamera::setEye(const Vec3& eye)
|
||||
|
@ -73,7 +73,7 @@ void ActionCamera::setEye(const Vec3& eye)
|
|||
|
||||
void ActionCamera::setEye(float x, float y, float z)
|
||||
{
|
||||
_eye = Vec3(x, y, z);
|
||||
_eye.set(x, y, z);
|
||||
updateTransform();
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ class CC_DLL ActionCamera : public ActionInterval //<NSCopying>
|
|||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
* @lua new
|
||||
*/
|
||||
ActionCamera();
|
||||
/**
|
||||
|
@ -124,9 +125,9 @@ public:
|
|||
* @param t Duration in seconds.
|
||||
* @param radius The start radius.
|
||||
* @param deltaRadius The delta radius.
|
||||
* @param angelZ The start Angel in Z.
|
||||
* @param angleZ The start Angel in Z.
|
||||
* @param deltaAngleZ The delta angle in Z.
|
||||
* @param angelX The start Angel in X.
|
||||
* @param angleX The start Angel in X.
|
||||
* @param deltaAngleX The delta angle in X.
|
||||
* @return An OrbitCamera.
|
||||
*/
|
||||
|
|
|
@ -168,7 +168,7 @@ public:
|
|||
|
||||
/** Creates an action with a Cardinal Spline array of points and tension.
|
||||
* @param duration In seconds.
|
||||
* @param point An PointArray.
|
||||
* @param points An PointArray.
|
||||
* @param tension Goodness of fit.
|
||||
* @code
|
||||
* When this function bound to js or lua,the input params are changed.
|
||||
|
@ -192,7 +192,7 @@ public:
|
|||
* Initializes the action with a duration and an array of points.
|
||||
*
|
||||
* @param duration In seconds.
|
||||
* @param point An PointArray.
|
||||
* @param points An PointArray.
|
||||
* @param tension Goodness of fit.
|
||||
*/
|
||||
bool initWithDuration(float duration, PointArray* points, float tension);
|
||||
|
|
|
@ -215,7 +215,7 @@ class CC_DLL AccelDeccelAmplitude : public ActionInterval
|
|||
public:
|
||||
/**
|
||||
@brief Create the action with an inner action that has the amplitude property, and a duration time.
|
||||
@@param action A pointer of the inner action.
|
||||
@param action A pointer of the inner action.
|
||||
@param duration Specify the duration of the AccelDeccelAmplitude action.
|
||||
@return Return a pointer of AccelDeccelAmplitude action. When the creation failed, return nil.
|
||||
*/
|
||||
|
|
|
@ -215,7 +215,7 @@ public:
|
|||
|
||||
/**
|
||||
@brief Set the center position of lens effect.
|
||||
@param The center position will be set.
|
||||
@param position The center position will be set.
|
||||
*/
|
||||
void setPosition(const Vec2& position);
|
||||
|
||||
|
@ -350,7 +350,7 @@ class CC_DLL Shaky3D : public Grid3DAction
|
|||
public:
|
||||
/**
|
||||
@brief Create the action with a range, shake Z vertices, a grid and duration.
|
||||
@param duration Specify the duration of the Shaky3D action. It's a value in seconds.
|
||||
@param initWithDuration Specify the duration of the Shaky3D action. It's a value in seconds.
|
||||
@param gridSize Specify the size of the grid.
|
||||
@param range Specify the range of the shaky effect.
|
||||
@param shakeZ Specify whether shake on the z axis.
|
||||
|
|
|
@ -354,7 +354,7 @@ public:
|
|||
|
||||
/** Set the selector target.
|
||||
*
|
||||
* @param The selector target.
|
||||
* @param sel The selector target.
|
||||
*/
|
||||
inline void setTargetCallback(Ref* sel)
|
||||
{
|
||||
|
|
|
@ -404,7 +404,7 @@ public:
|
|||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void stop(void) override;
|
||||
/**
|
||||
* @param dt In seconds.
|
||||
* @param time In seconds.
|
||||
*/
|
||||
virtual void update(float time) override;
|
||||
|
||||
|
@ -464,7 +464,7 @@ public:
|
|||
virtual RotateTo* reverse() const override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
/**
|
||||
* @param dt In seconds.
|
||||
* @param time In seconds.
|
||||
*/
|
||||
virtual void update(float time) override;
|
||||
|
||||
|
@ -1429,7 +1429,7 @@ public:
|
|||
|
||||
/** Sets the Animation object to be animated
|
||||
*
|
||||
* @param A certain animation.
|
||||
* @param animation certain animation.
|
||||
*/
|
||||
void setAnimation( Animation* animation );
|
||||
/** returns the Animation object that is being animated
|
||||
|
|
|
@ -45,10 +45,10 @@ class SpriteFrame;
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** AnimationFrame
|
||||
/** @class AnimationFrame
|
||||
*
|
||||
* A frame of the animation. It contains information like:
|
||||
* - sprite frame name.
|
||||
* - sprite frame name.
|
||||
* - # of delay units.
|
||||
* - offset
|
||||
|
||||
|
@ -222,7 +222,7 @@ public:
|
|||
|
||||
/** Sets the delay in seconds of the "delay unit".
|
||||
*
|
||||
* @param setDelayPerUnit The delay in seconds of the "delay unit".
|
||||
* @param delayPerUnit The delay in seconds of the "delay unit".
|
||||
*/
|
||||
void setDelayPerUnit(float delayPerUnit) { _delayPerUnit = delayPerUnit; };
|
||||
|
||||
|
|
|
@ -83,7 +83,6 @@ public:
|
|||
*
|
||||
* @param zoomX The zoom factor along the X-axis of the orthographic projection (the width of the ortho projection).
|
||||
* @param zoomY The zoom factor along the Y-axis of the orthographic projection (the height of the ortho projection).
|
||||
* @param aspectRatio The aspect ratio of the orthographic projection.
|
||||
* @param nearPlane The near plane distance.
|
||||
* @param farPlane The far plane distance.
|
||||
*/
|
||||
|
|
|
@ -80,6 +80,7 @@ public:
|
|||
* @return If you have custom stencil-based node with stencil drawing mechanics other then children-based,
|
||||
* then this method should return true every time you wish stencil to be visited.
|
||||
* By default returns true if has any children attached.
|
||||
* @js NA
|
||||
*/
|
||||
virtual bool hasContent() const;
|
||||
|
||||
|
@ -114,22 +115,18 @@ public:
|
|||
|
||||
// Overrides
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnterTransitionDidFinish() override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onExitTransitionDidStart() override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onExit() override;
|
||||
|
|
|
@ -42,6 +42,7 @@ NS_CC_BEGIN
|
|||
/**
|
||||
@brief Clipping Rectangle Node.
|
||||
@details A node that clipped with specified rectangle.
|
||||
@js NA
|
||||
*/
|
||||
class CC_DLL ClippingRectangleNode : public Node
|
||||
{
|
||||
|
@ -67,7 +68,7 @@ public:
|
|||
}
|
||||
/**
|
||||
@brief Set the clipping rectangle.
|
||||
@param Specify the clipping rectangle.
|
||||
@param clippingRegion Specify the clipping rectangle.
|
||||
*/
|
||||
void setClippingRegion(const Rect& clippingRegion);
|
||||
|
||||
|
@ -81,7 +82,7 @@ public:
|
|||
|
||||
/**
|
||||
@brief Enable/Disable the clipping.
|
||||
@param Pass true to enable clipping. Pass false to disable clipping.
|
||||
@param enabled Pass true to enable clipping. Pass false to disable clipping.
|
||||
*/
|
||||
void setClippingEnabled(bool enabled) {
|
||||
_clippingEnabled = enabled;
|
||||
|
|
|
@ -49,7 +49,10 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
virtual ~ComponentContainer(void);
|
||||
virtual Component* get(const std::string& name) const;
|
||||
/**
|
||||
* @js getComponent
|
||||
*/
|
||||
virtual Component* get(const std::string& name) const;
|
||||
virtual bool add(Component *com);
|
||||
virtual bool remove(const std::string& name);
|
||||
virtual bool remove(Component *com);
|
||||
|
|
|
@ -83,7 +83,8 @@ static inline Vec2 v2fforangle(float _a_)
|
|||
|
||||
static inline Vec2 v2fnormalize(const Vec2 &p)
|
||||
{
|
||||
Vec2 r = Vec2(p.x, p.y).getNormalized();
|
||||
Vec2 r(p.x, p.y);
|
||||
r.normalize();
|
||||
return v2f(r.x, r.y);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ public:
|
|||
* @param point A Vec2 used to point.
|
||||
* @param pointSize The point size.
|
||||
* @param color The point color.
|
||||
* @js NA
|
||||
*/
|
||||
void drawPoint(const Vec2& point, const float pointSize, const Color4F &color);
|
||||
|
||||
|
@ -71,6 +72,7 @@ public:
|
|||
* @param position A Vec2 pointer.
|
||||
* @param numberOfPoints The number of points.
|
||||
* @param color The point color.
|
||||
* @js NA
|
||||
*/
|
||||
void drawPoints(const Vec2 *position, unsigned int numberOfPoints, const Color4F &color);
|
||||
|
||||
|
@ -80,6 +82,7 @@ public:
|
|||
* @param numberOfPoints The number of points.
|
||||
* @param pointSize The point size.
|
||||
* @param color The point color.
|
||||
* @js NA
|
||||
*/
|
||||
void drawPoints(const Vec2 *position, unsigned int numberOfPoints, const float pointSize, const Color4F &color);
|
||||
|
||||
|
@ -88,6 +91,7 @@ public:
|
|||
* @param origin The line origin.
|
||||
* @param destination The line destination.
|
||||
* @param color The line color.
|
||||
* @js NA
|
||||
*/
|
||||
void drawLine(const Vec2 &origin, const Vec2 &destination, const Color4F &color);
|
||||
|
||||
|
@ -196,6 +200,7 @@ public:
|
|||
* @param origin The rectangle origin.
|
||||
* @param destination The rectangle destination.
|
||||
* @param color The rectangle color.
|
||||
* @js NA
|
||||
*/
|
||||
void drawSolidRect(const Vec2 &origin, const Vec2 &destination, const Color4F &color);
|
||||
|
||||
|
@ -204,6 +209,7 @@ public:
|
|||
* @param poli A solid polygon given a pointer to CGPoint coordinates.
|
||||
* @param numberOfPoints The number of vertices measured in points.
|
||||
* @param color The solid polygon color.
|
||||
* @js NA
|
||||
*/
|
||||
void drawSolidPoly(const Vec2 *poli, unsigned int numberOfPoints, const Color4F &color);
|
||||
|
||||
|
@ -215,6 +221,7 @@ public:
|
|||
* @param scaleX The scale value in x.
|
||||
* @param scaleY The scale value in y.
|
||||
* @param color The solid circle color.
|
||||
* @js NA
|
||||
*/
|
||||
void drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments, float scaleX, float scaleY, const Color4F &color);
|
||||
|
||||
|
@ -224,6 +231,7 @@ public:
|
|||
* @param angle The circle angel.
|
||||
* @param segments The number of segments.
|
||||
* @param color The solid circle color.
|
||||
* @js NA
|
||||
*/
|
||||
void drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments, const Color4F& color);
|
||||
|
||||
|
@ -247,6 +255,7 @@ public:
|
|||
* @param fillColor The color will fill in polygon.
|
||||
* @param borderWidth The border of line width.
|
||||
* @param borderColor The border of line color.
|
||||
* @js NA
|
||||
*/
|
||||
void drawPolygon(const Vec2 *verts, int count, const Color4F &fillColor, float borderWidth, const Color4F &borderColor);
|
||||
|
||||
|
@ -256,6 +265,7 @@ public:
|
|||
* @param p2 The triangle vertex point.
|
||||
* @param p3 The triangle vertex point.
|
||||
* @param color The triangle color.
|
||||
* @js NA
|
||||
*/
|
||||
void drawTriangle(const Vec2 &p1, const Vec2 &p2, const Vec2 &p3, const Color4F &color);
|
||||
|
||||
|
@ -266,13 +276,13 @@ public:
|
|||
* @param to The destination of the bezier path.
|
||||
* @param segments The The number of segments.
|
||||
* @param color The quadratic bezier color.
|
||||
* @js NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE void drawQuadraticBezier(const Vec2& from, const Vec2& control, const Vec2& to, unsigned int segments, const Color4F &color);
|
||||
|
||||
/** Clear the geometry in the node's buffer. */
|
||||
void clear();
|
||||
/** Get the color mixed mode.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
const BlendFunc& getBlendFunc() const;
|
||||
|
@ -285,8 +295,17 @@ public:
|
|||
*/
|
||||
void setBlendFunc(const BlendFunc &blendFunc);
|
||||
|
||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
||||
void onDrawGLLine(const Mat4 &transform, uint32_t flags);
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
void onDrawGLLine(const Mat4 &transform, uint32_t flags);
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
void onDrawGLPoint(const Mat4 &transform, uint32_t flags);
|
||||
|
||||
// Overrides
|
||||
|
|
|
@ -76,12 +76,21 @@ NS_CC_BEGIN
|
|||
|
||||
class PointArray;
|
||||
|
||||
/**
|
||||
* @js cc.DrawingPrimitiveCanvas/cc.DrawingPrimitiveWebGL
|
||||
*/
|
||||
namespace DrawPrimitives
|
||||
{
|
||||
/** Initializes the drawing primitives. */
|
||||
/**
|
||||
* Initializes the drawing primitives.
|
||||
* @js NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE void CC_DLL init();
|
||||
|
||||
/** Frees allocated resources by the drawing primitives. */
|
||||
/**
|
||||
* Frees allocated resources by the drawing primitives.
|
||||
* @js NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE void CC_DLL free();
|
||||
|
||||
/** Draws a point given x and y coordinate measured in points
|
||||
|
@ -169,6 +178,7 @@ namespace DrawPrimitives
|
|||
* @param segments The number of segments.
|
||||
* @param scaleX The scale value in x.
|
||||
* @param scaleY The scale value in y.
|
||||
* @js NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE void CC_DLL drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments, float scaleX, float scaleY);
|
||||
|
||||
|
@ -177,6 +187,7 @@ namespace DrawPrimitives
|
|||
* @param radius The circle rotate of radius.
|
||||
* @param angle The circle angel.
|
||||
* @param segments The number of segments.
|
||||
* @js NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE void CC_DLL drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments);
|
||||
|
||||
|
@ -229,6 +240,7 @@ namespace DrawPrimitives
|
|||
* @param b The blue color with a unsigned bytes.
|
||||
* @param a Alpha with a unsigned bytes.
|
||||
* @since v2.0
|
||||
* @js setDrawColor
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE void CC_DLL setDrawColor4B(GLubyte r, GLubyte g, GLubyte b, GLubyte a);
|
||||
|
||||
|
@ -239,6 +251,7 @@ namespace DrawPrimitives
|
|||
* @param b The blue color with an floats.
|
||||
* @param a Alpha with an floats.
|
||||
* @since v2.0
|
||||
* @js setDrawColor
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE void CC_DLL setDrawColor4F(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@ namespace experimental{
|
|||
* http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:tiled_maps
|
||||
|
||||
* @since v3.2
|
||||
* @js NA
|
||||
*/
|
||||
|
||||
class CC_DLL TMXLayer : public Node
|
||||
|
|
|
@ -94,6 +94,7 @@ class TMXLayer;
|
|||
* object->getProperty(name_of_the_property);
|
||||
|
||||
* @since v3.2
|
||||
* @js NA
|
||||
*/
|
||||
class CC_DLL TMXTiledMap : public Node
|
||||
{
|
||||
|
|
|
@ -27,6 +27,9 @@ THE SOFTWARE.
|
|||
|
||||
#include "platform/CCGL.h"
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
class GLBufferedNode
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -34,7 +34,7 @@ NS_CC_BEGIN
|
|||
class Texture2D;
|
||||
|
||||
/**
|
||||
* @addtogroup effects
|
||||
* @addtogroup _2d
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class GLProgram;
|
|||
class Node;
|
||||
|
||||
/**
|
||||
* @addtogroup effects
|
||||
* @addtogroup _2d
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -103,6 +103,7 @@ public:
|
|||
|
||||
/**@{
|
||||
Interface for custom action when before or after draw.
|
||||
@js NA
|
||||
*/
|
||||
virtual void beforeBlit() {}
|
||||
virtual void afterBlit() {}
|
||||
|
@ -158,7 +159,6 @@ public:
|
|||
*/
|
||||
Vec3 getVertex(const Vec2& pos) const;
|
||||
/** @deprecated Use getVertex() instead
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE Vec3 vertex(const Vec2& pos) const { return getVertex(pos); }
|
||||
|
@ -168,13 +168,11 @@ public:
|
|||
*/
|
||||
Vec3 getOriginalVertex(const Vec2& pos) const;
|
||||
/** @deprecated Use getOriginalVertex() instead
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE Vec3 originalVertex(const Vec2& pos) const { return getOriginalVertex(pos); }
|
||||
|
||||
/** Sets a new vertex at a given position.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
void setVertex(const Vec2& pos, const Vec3& vertex);
|
||||
|
@ -190,6 +188,7 @@ public:
|
|||
|
||||
/**@{
|
||||
Getter and Setter for depth test state when blit.
|
||||
@js NA
|
||||
*/
|
||||
void setNeedDepthTestForBlit( bool neededDepthTest) { _needDepthTestForBlit = neededDepthTest; }
|
||||
bool getNeedDepthTestForBlit() const { return _needDepthTestForBlit; }
|
||||
|
@ -233,7 +232,6 @@ public:
|
|||
*/
|
||||
Quad3 getTile(const Vec2& pos) const;
|
||||
/** returns the tile at the given position
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE Quad3 tile(const Vec2& pos) const { return getTile(pos); }
|
||||
|
@ -243,13 +241,11 @@ public:
|
|||
*/
|
||||
Quad3 getOriginalTile(const Vec2& pos) const;
|
||||
/** returns the original tile (untransformed) at the given position
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE Quad3 originalTile(const Vec2& pos) const { return getOriginalTile(pos); }
|
||||
|
||||
/** Sets a new tile.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
void setTile(const Vec2& pos, const Quad3& coords);
|
||||
|
|
|
@ -752,28 +752,28 @@ void Label::enableOutline(const Color4B& outlineColor,int outlineSize /* = -1 */
|
|||
{
|
||||
CCASSERT(_currentLabelType == LabelType::STRING_TEXTURE || _currentLabelType == LabelType::TTF, "Only supported system font and TTF!");
|
||||
|
||||
_effectColor = outlineColor;
|
||||
_effectColorF.r = _effectColor.r / 255.0f;
|
||||
_effectColorF.g = _effectColor.g / 255.0f;
|
||||
_effectColorF.b = _effectColor.b / 255.0f;
|
||||
_effectColorF.a = _effectColor.a / 255.0f;
|
||||
|
||||
if (outlineSize > 0)
|
||||
if (outlineSize > 0 || _currLabelEffect == LabelEffect::OUTLINE)
|
||||
{
|
||||
_outlineSize = outlineSize;
|
||||
if (_currentLabelType == LabelType::TTF)
|
||||
{
|
||||
if (_fontConfig.outlineSize != outlineSize)
|
||||
{
|
||||
auto config = _fontConfig;
|
||||
config.outlineSize = outlineSize;
|
||||
setTTFConfig(config);
|
||||
updateShaderProgram();
|
||||
_effectColorF.r = outlineColor.r / 255.0f;
|
||||
_effectColorF.g = outlineColor.g / 255.0f;
|
||||
_effectColorF.b = outlineColor.b / 255.0f;
|
||||
_effectColorF.a = outlineColor.a / 255.0f;
|
||||
|
||||
if (outlineSize > 0 && _fontConfig.outlineSize != outlineSize)
|
||||
{
|
||||
_fontConfig.outlineSize = outlineSize;
|
||||
setTTFConfig(_fontConfig);
|
||||
}
|
||||
}
|
||||
|
||||
_currLabelEffect = LabelEffect::OUTLINE;
|
||||
_contentDirty = true;
|
||||
else if (_effectColor != outlineColor || _outlineSize != outlineSize)
|
||||
{
|
||||
_effectColor = outlineColor;
|
||||
_outlineSize = outlineSize;
|
||||
_currLabelEffect = LabelEffect::OUTLINE;
|
||||
_contentDirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -782,11 +782,6 @@ void Label::enableShadow(const Color4B& shadowColor /* = Color4B::BLACK */,const
|
|||
_shadowEnabled = true;
|
||||
_shadowDirty = true;
|
||||
|
||||
_shadowColor.r = shadowColor.r;
|
||||
_shadowColor.g = shadowColor.g;
|
||||
_shadowColor.b = shadowColor.b;
|
||||
_shadowOpacity = shadowColor.a / 255.0f;
|
||||
|
||||
auto contentScaleFactor = CC_CONTENT_SCALE_FACTOR();
|
||||
_shadowOffset.width = offset.width * contentScaleFactor;
|
||||
_shadowOffset.height = offset.height * contentScaleFactor;
|
||||
|
@ -795,27 +790,75 @@ void Label::enableShadow(const Color4B& shadowColor /* = Color4B::BLACK */,const
|
|||
|
||||
if (_textSprite && _shadowNode)
|
||||
{
|
||||
_shadowNode->setColor(_shadowColor);
|
||||
_shadowNode->setOpacity(_shadowOpacity * _displayedOpacity);
|
||||
_shadowNode->setPosition(_shadowOffset.width, _shadowOffset.height);
|
||||
if (shadowColor != _shadowColor4F)
|
||||
{
|
||||
Node::removeChild(_shadowNode, true);
|
||||
_shadowNode = nullptr;
|
||||
createShadowSpriteForSystemFont();
|
||||
}
|
||||
else
|
||||
{
|
||||
_shadowNode->setPosition(_shadowOffset.width, _shadowOffset.height);
|
||||
}
|
||||
}
|
||||
|
||||
_shadowColor3B.r = shadowColor.r;
|
||||
_shadowColor3B.g = shadowColor.g;
|
||||
_shadowColor3B.b = shadowColor.b;
|
||||
_shadowOpacity = shadowColor.a;
|
||||
|
||||
_shadowColor4F.r = shadowColor.r / 255.0f;
|
||||
_shadowColor4F.g = shadowColor.g / 255.0f;
|
||||
_shadowColor4F.b = shadowColor.b / 255.0f;
|
||||
_shadowColor4F.a = shadowColor.a / 255.0f;
|
||||
}
|
||||
|
||||
void Label::disableEffect()
|
||||
{
|
||||
if (_currLabelEffect == LabelEffect::OUTLINE)
|
||||
disableEffect(LabelEffect::GLOW);
|
||||
disableEffect(LabelEffect::OUTLINE);
|
||||
disableEffect(LabelEffect::SHADOW);
|
||||
}
|
||||
|
||||
void Label::disableEffect(LabelEffect effect)
|
||||
{
|
||||
switch (effect)
|
||||
{
|
||||
_fontConfig.outlineSize = 0;
|
||||
setTTFConfig(_fontConfig);
|
||||
}
|
||||
_currLabelEffect = LabelEffect::NORMAL;
|
||||
updateShaderProgram();
|
||||
_contentDirty = true;
|
||||
_shadowEnabled = false;
|
||||
if (_shadowNode)
|
||||
{
|
||||
Node::removeChild(_shadowNode,true);
|
||||
_shadowNode = nullptr;
|
||||
case cocos2d::LabelEffect::NORMAL:
|
||||
break;
|
||||
case cocos2d::LabelEffect::OUTLINE:
|
||||
if (_currLabelEffect == LabelEffect::OUTLINE)
|
||||
{
|
||||
if (_currentLabelType == LabelType::TTF)
|
||||
{
|
||||
_fontConfig.outlineSize = 0;
|
||||
setTTFConfig(_fontConfig);
|
||||
}
|
||||
|
||||
_currLabelEffect = LabelEffect::NORMAL;
|
||||
_contentDirty = true;
|
||||
}
|
||||
break;
|
||||
case cocos2d::LabelEffect::SHADOW:
|
||||
if (_shadowEnabled)
|
||||
{
|
||||
_shadowEnabled = false;
|
||||
if (_shadowNode)
|
||||
{
|
||||
Node::removeChild(_shadowNode, true);
|
||||
_shadowNode = nullptr;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case cocos2d::LabelEffect::GLOW:
|
||||
if (_currLabelEffect == LabelEffect::GLOW)
|
||||
{
|
||||
_currLabelEffect = LabelEffect::NORMAL;
|
||||
updateShaderProgram();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -827,10 +870,8 @@ void Label::setFontScale(float fontScale)
|
|||
|
||||
void Label::onDraw(const Mat4& transform, bool transformUpdated)
|
||||
{
|
||||
CC_PROFILER_START("Label - draw");
|
||||
|
||||
// Optimization: Fast Dispatch
|
||||
if( _batchNodes.size() == 1 && _textureAtlas->getTotalQuads() == 0 )
|
||||
if( _textureAtlas == NULL || (_batchNodes.size() == 1 && _textureAtlas->getTotalQuads() == 0) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -839,21 +880,57 @@ void Label::onDraw(const Mat4& transform, bool transformUpdated)
|
|||
glprogram->use();
|
||||
GL::blendFunc( _blendFunc.src, _blendFunc.dst );
|
||||
|
||||
if (_shadowEnabled)
|
||||
{
|
||||
if (_currentLabelType == LabelType::TTF)
|
||||
{
|
||||
glprogram->setUniformLocationWith4f(_uniformTextColor,
|
||||
_shadowColor4F.r, _shadowColor4F.g, _shadowColor4F.b, _shadowColor4F.a);
|
||||
glprogram->setUniformLocationWith4f(_uniformEffectColor,
|
||||
_shadowColor4F.r, _shadowColor4F.g, _shadowColor4F.b, _shadowColor4F.a);
|
||||
|
||||
getGLProgram()->setUniformsForBuiltins(_shadowTransform);
|
||||
for (const auto &child : _children)
|
||||
{
|
||||
child->updateTransform();
|
||||
}
|
||||
for (const auto& batchNode : _batchNodes)
|
||||
{
|
||||
batchNode->getTextureAtlas()->drawQuads();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Color3B oldColor = _realColor;
|
||||
GLubyte oldOPacity = _displayedOpacity;
|
||||
_displayedOpacity = _shadowOpacity;
|
||||
setColor(_shadowColor3B);
|
||||
|
||||
getGLProgram()->setUniformsForBuiltins(_shadowTransform);
|
||||
for (const auto &child : _children)
|
||||
{
|
||||
child->updateTransform();
|
||||
}
|
||||
for (const auto& batchNode : _batchNodes)
|
||||
{
|
||||
batchNode->getTextureAtlas()->drawQuads();
|
||||
}
|
||||
|
||||
_displayedOpacity = oldOPacity;
|
||||
setColor(oldColor);
|
||||
}
|
||||
}
|
||||
|
||||
if (_currentLabelType == LabelType::TTF)
|
||||
{
|
||||
glprogram->setUniformLocationWith4f(_uniformTextColor,
|
||||
_textColorF.r,_textColorF.g,_textColorF.b,_textColorF.a);
|
||||
}
|
||||
|
||||
if (_currLabelEffect == LabelEffect::OUTLINE || _currLabelEffect == LabelEffect::GLOW)
|
||||
{
|
||||
glprogram->setUniformLocationWith4f(_uniformEffectColor,
|
||||
_effectColorF.r,_effectColorF.g,_effectColorF.b,_effectColorF.a);
|
||||
}
|
||||
|
||||
if(_shadowEnabled && _shadowBlurRadius <= 0)
|
||||
{
|
||||
drawShadowWithoutBlur();
|
||||
if (_currLabelEffect == LabelEffect::OUTLINE || _currLabelEffect == LabelEffect::GLOW)
|
||||
{
|
||||
glprogram->setUniformLocationWith4f(_uniformEffectColor,
|
||||
_effectColorF.r, _effectColorF.g, _effectColorF.b, _effectColorF.a);
|
||||
}
|
||||
}
|
||||
|
||||
glprogram->setUniformsForBuiltins(transform);
|
||||
|
@ -868,29 +945,6 @@ void Label::onDraw(const Mat4& transform, bool transformUpdated)
|
|||
{
|
||||
batchNode->getTextureAtlas()->drawQuads();
|
||||
}
|
||||
|
||||
CC_PROFILER_STOP("Label - draw");
|
||||
}
|
||||
|
||||
void Label::drawShadowWithoutBlur()
|
||||
{
|
||||
Color3B oldColor = _realColor;
|
||||
GLubyte oldOPacity = _displayedOpacity;
|
||||
_displayedOpacity = _shadowOpacity * _displayedOpacity;
|
||||
setColor(_shadowColor);
|
||||
|
||||
getGLProgram()->setUniformsForBuiltins(_shadowTransform);
|
||||
for(const auto &child: _children)
|
||||
{
|
||||
child->updateTransform();
|
||||
}
|
||||
for (const auto& batchNode:_batchNodes)
|
||||
{
|
||||
batchNode->getTextureAtlas()->drawQuads();
|
||||
}
|
||||
|
||||
_displayedOpacity = oldOPacity;
|
||||
setColor(oldColor);
|
||||
}
|
||||
|
||||
void Label::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||
|
@ -910,26 +964,53 @@ void Label::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|||
}
|
||||
}
|
||||
|
||||
void Label::setCameraMask(unsigned short mask, bool applyChildren)
|
||||
{
|
||||
SpriteBatchNode::setCameraMask(mask, applyChildren);
|
||||
|
||||
if (_textSprite)
|
||||
{
|
||||
_textSprite->setCameraMask(mask, applyChildren);
|
||||
}
|
||||
if (_shadowNode)
|
||||
{
|
||||
_shadowNode->setCameraMask(mask, applyChildren);
|
||||
}
|
||||
}
|
||||
|
||||
void Label::createSpriteWithFontDefinition()
|
||||
void Label::createSpriteForSystemFont()
|
||||
{
|
||||
_currentLabelType = LabelType::STRING_TEXTURE;
|
||||
|
||||
if (!_compatibleMode)
|
||||
{
|
||||
_fontDefinition._fontName = _systemFont;
|
||||
_fontDefinition._fontSize = _systemFontSize;
|
||||
|
||||
_fontDefinition._alignment = _hAlignment;
|
||||
_fontDefinition._vertAlignment = _vAlignment;
|
||||
|
||||
_fontDefinition._dimensions.width = _labelWidth;
|
||||
_fontDefinition._dimensions.height = _labelHeight;
|
||||
|
||||
_fontDefinition._fontFillColor.r = _textColor.r;
|
||||
_fontDefinition._fontFillColor.g = _textColor.g;
|
||||
_fontDefinition._fontFillColor.b = _textColor.b;
|
||||
_fontDefinition._fontAlpha = _textColor.a;
|
||||
|
||||
_fontDefinition._shadow._shadowEnabled = false;
|
||||
|
||||
if (_currLabelEffect == LabelEffect::OUTLINE && _outlineSize > 0)
|
||||
{
|
||||
_fontDefinition._stroke._strokeEnabled = true;
|
||||
_fontDefinition._stroke._strokeSize = _outlineSize;
|
||||
_fontDefinition._stroke._strokeColor.r = _effectColor.r;
|
||||
_fontDefinition._stroke._strokeColor.g = _effectColor.g;
|
||||
_fontDefinition._stroke._strokeColor.b = _effectColor.b;
|
||||
_fontDefinition._stroke._strokeAlpha = _effectColor.a;
|
||||
}
|
||||
else
|
||||
{
|
||||
_fontDefinition._stroke._strokeEnabled = false;
|
||||
}
|
||||
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) && (CC_TARGET_PLATFORM != CC_PLATFORM_IOS)
|
||||
if (_fontDefinition._stroke._strokeEnabled)
|
||||
{
|
||||
CCLOGERROR("Currently only supported on iOS and Android!");
|
||||
}
|
||||
_fontDefinition._stroke._strokeEnabled = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
auto texture = new (std::nothrow) Texture2D;
|
||||
texture->initWithString(_originalUTF8String.c_str(),_fontDefinition);
|
||||
texture->initWithString(_originalUTF8String.c_str(), _fontDefinition);
|
||||
|
||||
_textSprite = Sprite::createWithTexture(texture);
|
||||
//set camera mask using label's camera mask, because _textSprite may be null when setting camera mask to label
|
||||
|
@ -942,12 +1023,66 @@ void Label::createSpriteWithFontDefinition()
|
|||
_textSprite->setBlendFunc(_blendFunc);
|
||||
}
|
||||
|
||||
Node::addChild(_textSprite,0,Node::INVALID_TAG);
|
||||
Node::addChild(_textSprite, 0, Node::INVALID_TAG);
|
||||
|
||||
_textSprite->updateDisplayedColor(_displayedColor);
|
||||
_textSprite->updateDisplayedOpacity(_displayedOpacity);
|
||||
}
|
||||
|
||||
void Label::createShadowSpriteForSystemFont()
|
||||
{
|
||||
if (!_fontDefinition._stroke._strokeEnabled && _fontDefinition._fontFillColor == _shadowColor4F
|
||||
&& (_fontDefinition._fontAlpha == _shadowColor4F.a * 255))
|
||||
{
|
||||
_shadowNode = Sprite::createWithTexture(_textSprite->getTexture());
|
||||
}
|
||||
else
|
||||
{
|
||||
auto shadowFontDefinition = _fontDefinition;
|
||||
shadowFontDefinition._fontFillColor.r = _shadowColor4F.r * 255;
|
||||
shadowFontDefinition._fontFillColor.g = _shadowColor4F.g * 255;
|
||||
shadowFontDefinition._fontFillColor.b = _shadowColor4F.b * 255;
|
||||
shadowFontDefinition._fontAlpha = _shadowColor4F.a * 255;
|
||||
|
||||
shadowFontDefinition._stroke._strokeColor = shadowFontDefinition._fontFillColor;
|
||||
shadowFontDefinition._stroke._strokeAlpha = shadowFontDefinition._fontAlpha;
|
||||
|
||||
auto texture = new (std::nothrow) Texture2D;
|
||||
texture->initWithString(_originalUTF8String.c_str(), shadowFontDefinition);
|
||||
_shadowNode = Sprite::createWithTexture(texture);
|
||||
texture->release();
|
||||
}
|
||||
|
||||
if (_shadowNode)
|
||||
{
|
||||
if (_blendFuncDirty)
|
||||
{
|
||||
_shadowNode->setBlendFunc(_blendFunc);
|
||||
}
|
||||
_shadowNode->setCameraMask(getCameraMask());
|
||||
_shadowNode->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT);
|
||||
_shadowNode->setPosition(_shadowOffset.width, _shadowOffset.height);
|
||||
Node::addChild(_shadowNode, 0, Node::INVALID_TAG);
|
||||
|
||||
_shadowNode->updateDisplayedColor(_displayedColor);
|
||||
_shadowNode->updateDisplayedOpacity(_displayedOpacity);
|
||||
}
|
||||
}
|
||||
|
||||
void Label::setCameraMask(unsigned short mask, bool applyChildren)
|
||||
{
|
||||
SpriteBatchNode::setCameraMask(mask, applyChildren);
|
||||
|
||||
if (_textSprite)
|
||||
{
|
||||
_textSprite->setCameraMask(mask, applyChildren);
|
||||
}
|
||||
if (_shadowNode)
|
||||
{
|
||||
_shadowNode->setCameraMask(mask, applyChildren);
|
||||
}
|
||||
}
|
||||
|
||||
void Label::setFontDefinition(const FontDefinition& textDefinition)
|
||||
{
|
||||
_fontDefinition = textDefinition;
|
||||
|
@ -968,140 +1103,62 @@ void Label::setFontDefinition(const FontDefinition& textDefinition)
|
|||
|
||||
void Label::updateContent()
|
||||
{
|
||||
std::u16string utf16String;
|
||||
if (StringUtils::UTF8ToUTF16(_originalUTF8String, utf16String))
|
||||
if (_systemFontDirty)
|
||||
{
|
||||
_currentUTF16String = utf16String;
|
||||
}
|
||||
if (_fontAtlas)
|
||||
{
|
||||
_batchNodes.clear();
|
||||
_batchNodes.push_back(this);
|
||||
|
||||
computeStringNumLines();
|
||||
if (_fontAtlas)
|
||||
{
|
||||
computeHorizontalKernings(_currentUTF16String);
|
||||
FontAtlasCache::releaseFontAtlas(_fontAtlas);
|
||||
_fontAtlas = nullptr;
|
||||
}
|
||||
|
||||
_systemFontDirty = false;
|
||||
}
|
||||
|
||||
if (_textSprite)
|
||||
{
|
||||
Node::removeChild(_textSprite,true);
|
||||
Node::removeChild(_textSprite, true);
|
||||
_textSprite = nullptr;
|
||||
if (_shadowNode)
|
||||
{
|
||||
Node::removeChild(_shadowNode,true);
|
||||
Node::removeChild(_shadowNode, true);
|
||||
_shadowNode = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (_fontAtlas)
|
||||
{
|
||||
std::u16string utf16String;
|
||||
if (StringUtils::UTF8ToUTF16(_originalUTF8String, utf16String))
|
||||
{
|
||||
_currentUTF16String = utf16String;
|
||||
}
|
||||
|
||||
computeStringNumLines();
|
||||
computeHorizontalKernings(_currentUTF16String);
|
||||
alignText();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_compatibleMode)
|
||||
createSpriteForSystemFont();
|
||||
if (_shadowEnabled)
|
||||
{
|
||||
_fontDefinition._fontName = _systemFont;
|
||||
_fontDefinition._fontSize = _systemFontSize;
|
||||
|
||||
_fontDefinition._alignment = _hAlignment;
|
||||
_fontDefinition._vertAlignment = _vAlignment;
|
||||
|
||||
_fontDefinition._dimensions.width = _labelWidth;
|
||||
_fontDefinition._dimensions.height = _labelHeight;
|
||||
|
||||
_fontDefinition._fontFillColor.r = _textColor.r;
|
||||
_fontDefinition._fontFillColor.g = _textColor.g;
|
||||
_fontDefinition._fontFillColor.b = _textColor.b;
|
||||
_fontDefinition._fontAlpha = _textColor.a;
|
||||
|
||||
_fontDefinition._shadow._shadowEnabled = false;
|
||||
|
||||
if (_currLabelEffect == LabelEffect::OUTLINE && _outlineSize > 0)
|
||||
{
|
||||
_fontDefinition._stroke._strokeEnabled = true;
|
||||
_fontDefinition._stroke._strokeSize = _outlineSize;
|
||||
_fontDefinition._stroke._strokeColor.r = _effectColor.r;
|
||||
_fontDefinition._stroke._strokeColor.g = _effectColor.g;
|
||||
_fontDefinition._stroke._strokeColor.b = _effectColor.b;
|
||||
_fontDefinition._stroke._strokeAlpha = _effectColor.a;
|
||||
}
|
||||
else
|
||||
{
|
||||
_fontDefinition._stroke._strokeEnabled = false;
|
||||
}
|
||||
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) && (CC_TARGET_PLATFORM != CC_PLATFORM_IOS)
|
||||
if (_fontDefinition._stroke._strokeEnabled)
|
||||
{
|
||||
CCLOGERROR("Currently only supported on iOS and Android!");
|
||||
}
|
||||
_fontDefinition._stroke._strokeEnabled = false;
|
||||
#endif
|
||||
createShadowSpriteForSystemFont();
|
||||
}
|
||||
|
||||
createSpriteWithFontDefinition();
|
||||
}
|
||||
_contentDirty = false;
|
||||
}
|
||||
|
||||
void Label::updateFont()
|
||||
{
|
||||
if (_fontAtlas)
|
||||
{
|
||||
_batchNodes.clear();
|
||||
_batchNodes.push_back(this);
|
||||
|
||||
FontAtlasCache::releaseFontAtlas(_fontAtlas);
|
||||
_fontAtlas = nullptr;
|
||||
}
|
||||
|
||||
_contentDirty = true;
|
||||
_systemFontDirty = false;
|
||||
}
|
||||
|
||||
void Label::drawTextSprite(Renderer *renderer, uint32_t parentFlags)
|
||||
{
|
||||
if (_fontDefinition._fontFillColor.r != _textColor.r || _fontDefinition._fontFillColor.g != _textColor.g
|
||||
|| _fontDefinition._fontFillColor.b != _textColor.b)
|
||||
{
|
||||
updateContent();
|
||||
}
|
||||
|
||||
if (_shadowEnabled && _shadowNode == nullptr)
|
||||
{
|
||||
_shadowNode = Sprite::createWithTexture(_textSprite->getTexture());
|
||||
if (_shadowNode)
|
||||
{
|
||||
if (_blendFuncDirty)
|
||||
{
|
||||
_shadowNode->setBlendFunc(_blendFunc);
|
||||
}
|
||||
//set camera mask using label's mask. Because _shadowNode may be null when setting the label's camera mask
|
||||
_shadowNode->setCameraMask(getCameraMask());
|
||||
_shadowNode->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT);
|
||||
_shadowNode->setColor(_shadowColor);
|
||||
_shadowNode->setOpacity(_shadowOpacity * _displayedOpacity);
|
||||
_shadowNode->setPosition(_shadowOffset.width, _shadowOffset.height);
|
||||
Node::addChild(_shadowNode,0,Node::INVALID_TAG);
|
||||
}
|
||||
}
|
||||
if (_shadowNode)
|
||||
{
|
||||
_shadowNode->visit(renderer, _modelViewTransform, parentFlags);
|
||||
}
|
||||
_textSprite->visit(renderer, _modelViewTransform, parentFlags);
|
||||
}
|
||||
|
||||
void Label::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags)
|
||||
{
|
||||
if (! _visible || _originalUTF8String.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_systemFontDirty)
|
||||
{
|
||||
updateFont();
|
||||
}
|
||||
if (_contentDirty)
|
||||
|
||||
if (_systemFontDirty || _contentDirty)
|
||||
{
|
||||
updateContent();
|
||||
}
|
||||
|
@ -1123,7 +1180,7 @@ void Label::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t pare
|
|||
_shadowDirty = false;
|
||||
}
|
||||
|
||||
if (!isVisitableByVisitingCamera())
|
||||
if (!_textSprite && !isVisitableByVisitingCamera())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1131,23 +1188,23 @@ void Label::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t pare
|
|||
// IMPORTANT:
|
||||
// To ease the migration to v3.0, we still support the Mat4 stack,
|
||||
// but it is deprecated and your code should not rely on it
|
||||
Director* director = Director::getInstance();
|
||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
||||
_director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||
_director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);
|
||||
|
||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);
|
||||
|
||||
|
||||
if (_textSprite)
|
||||
{
|
||||
drawTextSprite(renderer, flags);
|
||||
if (_shadowNode)
|
||||
{
|
||||
_shadowNode->visit(renderer, _modelViewTransform, flags);
|
||||
}
|
||||
_textSprite->visit(renderer, _modelViewTransform, flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
draw(renderer, _modelViewTransform, flags);
|
||||
}
|
||||
|
||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||
_director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||
|
||||
// FIX ME: Why need to set _orderOfArrival to 0??
|
||||
// Please refer to https://github.com/cocos2d/cocos2d-x/pull/6920
|
||||
|
@ -1343,6 +1400,15 @@ void Label::setTextColor(const Color4B &color)
|
|||
_textColorF.g = _textColor.g / 255.0f;
|
||||
_textColorF.b = _textColor.b / 255.0f;
|
||||
_textColorF.a = _textColor.a / 255.0f;
|
||||
|
||||
if (_currentLabelType == LabelType::STRING_TEXTURE)
|
||||
{
|
||||
if (_fontDefinition._fontFillColor.r != _textColor.r || _fontDefinition._fontFillColor.g != _textColor.g
|
||||
|| _fontDefinition._fontFillColor.b != _textColor.b || _fontDefinition._fontAlpha != _textColor.a)
|
||||
{
|
||||
_contentDirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Label::updateColor()
|
||||
|
@ -1390,11 +1456,7 @@ std::string Label::getDescription() const
|
|||
|
||||
const Size& Label::getContentSize() const
|
||||
{
|
||||
if (_systemFontDirty)
|
||||
{
|
||||
const_cast<Label*>(this)->updateFont();
|
||||
}
|
||||
if (_contentDirty)
|
||||
if (_systemFontDirty || _contentDirty)
|
||||
{
|
||||
const_cast<Label*>(this)->updateContent();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
Copyright (c) 2013-2015 Chukong Technologies Inc.
|
||||
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
@ -29,6 +29,7 @@
|
|||
#include "2d/CCSpriteBatchNode.h"
|
||||
#include "renderer/CCCustomCommand.h"
|
||||
#include "2d/CCFontAtlas.h"
|
||||
#include "base/ccTypes.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -50,16 +51,6 @@ enum class GlyphCollection {
|
|||
CUSTOM
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Possible LabelEffect used by Label.
|
||||
*
|
||||
*/
|
||||
enum class LabelEffect {
|
||||
NORMAL,
|
||||
OUTLINE,
|
||||
SHADOW,
|
||||
GLOW
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct TTFConfig
|
||||
|
@ -70,9 +61,9 @@ typedef struct _ttfConfig
|
|||
std::string fontFilePath;
|
||||
int fontSize;
|
||||
|
||||
GlyphCollection glyphs;
|
||||
GlyphCollection glyphs;
|
||||
const char *customGlyphs;
|
||||
|
||||
|
||||
bool distanceFieldEnabled;
|
||||
int outlineSize;
|
||||
|
||||
|
@ -94,7 +85,7 @@ typedef struct _ttfConfig
|
|||
|
||||
/**
|
||||
* @brief Label is a subclass of SpriteBatchNode that knows how to render text labels.
|
||||
*
|
||||
*
|
||||
* Label can be created with:
|
||||
* - A true type font file.
|
||||
* - A bitmap font file.
|
||||
|
@ -106,6 +97,7 @@ typedef struct _ttfConfig
|
|||
* - http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
|
||||
* - http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
|
||||
* - http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
||||
* @js NA
|
||||
*/
|
||||
class CC_DLL Label : public SpriteBatchNode, public LabelProtocol
|
||||
{
|
||||
|
@ -122,13 +114,13 @@ public:
|
|||
*/
|
||||
static Label* create();
|
||||
|
||||
/**
|
||||
/**
|
||||
* Allocates and initializes a Label, base on platform-dependent API.
|
||||
*
|
||||
* @param text The initial text.
|
||||
* @param font A font file or a font family name.
|
||||
* @param fontSize The font size. This value must be > 0.
|
||||
* @param dimensions
|
||||
* @param dimensions
|
||||
* @param hAlignment The text horizontal alignment.
|
||||
* @param vAlignment The text vertical alignment.
|
||||
*
|
||||
|
@ -146,7 +138,7 @@ public:
|
|||
* @param text The initial text.
|
||||
* @param fontFilePath A font file.
|
||||
* @param fontSize The font size. This value must be > 0.
|
||||
* @param dimensions
|
||||
* @param dimensions
|
||||
* @param hAlignment The text horizontal alignment.
|
||||
* @param vAlignment The text vertical alignment.
|
||||
*
|
||||
|
@ -168,7 +160,7 @@ public:
|
|||
* @see TTFConfig setTTFConfig setMaxLineWidth
|
||||
*/
|
||||
static Label* createWithTTF(const TTFConfig& ttfConfig, const std::string& text, TextHAlignment hAlignment = TextHAlignment::LEFT, int maxLineWidth = 0);
|
||||
|
||||
|
||||
/**
|
||||
* Allocates and initializes a Label, with a bitmap font file.
|
||||
*
|
||||
|
@ -176,7 +168,7 @@ public:
|
|||
* @param text The initial text.
|
||||
* @param hAlignment Text horizontal alignment.
|
||||
* @param maxLineWidth The max line width.
|
||||
* @param imageOffset
|
||||
* @param imageOffset
|
||||
*
|
||||
* @return An automatically released Label object.
|
||||
* @see setBMFontFilePath setMaxLineWidth
|
||||
|
@ -184,7 +176,7 @@ public:
|
|||
static Label* createWithBMFont(const std::string& bmfontPath, const std::string& text,
|
||||
const TextHAlignment& hAlignment = TextHAlignment::LEFT, int maxLineWidth = 0,
|
||||
const Vec2& imageOffset = Vec2::ZERO);
|
||||
|
||||
|
||||
/**
|
||||
* Allocates and initializes a Label, with char map configuration.
|
||||
*
|
||||
|
@ -257,7 +249,7 @@ public:
|
|||
virtual bool setCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap);
|
||||
|
||||
/**
|
||||
* Sets a new char map configuration to Label.
|
||||
* Sets a new char map configuration to Label.
|
||||
*
|
||||
* @see `createWithCharMap(const std::string&)`
|
||||
*/
|
||||
|
@ -298,12 +290,12 @@ public:
|
|||
|
||||
int getStringLength() const;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Sets the text color of Label.
|
||||
*
|
||||
* The text color is different from the color of Node.
|
||||
*
|
||||
* @warning Limiting use to only when the Label created with true type font or system font.
|
||||
*
|
||||
* @warning Limiting use to only when the Label created with true type font or system font.
|
||||
*/
|
||||
virtual void setTextColor(const Color4B &color);
|
||||
|
||||
|
@ -334,6 +326,13 @@ public:
|
|||
*/
|
||||
virtual void disableEffect();
|
||||
|
||||
/**
|
||||
* Disable effect to Label.
|
||||
*
|
||||
* @see `LabelEffect`
|
||||
*/
|
||||
virtual void disableEffect(LabelEffect effect);
|
||||
|
||||
/** Sets the Label's text horizontal alignment.*/
|
||||
void setAlignment(TextHAlignment hAlignment) { setAlignment(hAlignment,_vAlignment);}
|
||||
|
||||
|
@ -357,19 +356,19 @@ public:
|
|||
|
||||
/**
|
||||
* Specify what happens when a line is too long for Label.
|
||||
*
|
||||
*
|
||||
* @param breakWithoutSpace Lines are automatically broken between words if this value is false.
|
||||
*/
|
||||
void setLineBreakWithoutSpace(bool breakWithoutSpace);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Makes the Label at most this line untransformed width.
|
||||
* The Label's max line width be used for force line breaks if the value not equal zero.
|
||||
*/
|
||||
void setMaxLineWidth(float maxLineWidth);
|
||||
float getMaxLineWidth() { return _maxLineWidth; }
|
||||
|
||||
/**
|
||||
/**
|
||||
* Makes the Label exactly this untransformed width.
|
||||
*
|
||||
* The Label's width be used for text align if the value not equal zero.
|
||||
|
@ -410,14 +409,14 @@ public:
|
|||
*/
|
||||
void setLineHeight(float height);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns the line height of this Label.
|
||||
* @warning Not support system font.
|
||||
* @since v3.2.0
|
||||
*/
|
||||
float getLineHeight() const;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Sets the additional kerning of the Label.
|
||||
*
|
||||
* @warning Not support system font.
|
||||
|
@ -425,7 +424,7 @@ public:
|
|||
*/
|
||||
void setAdditionalKerning(float space);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns the additional kerning of the Label.
|
||||
*
|
||||
* @warning Not support system font.
|
||||
|
@ -434,7 +433,7 @@ public:
|
|||
float getAdditionalKerning() const;
|
||||
|
||||
FontAtlas* getFontAtlas() { return _fontAtlas; }
|
||||
|
||||
|
||||
virtual void setBlendFunc(const BlendFunc &blendFunc) override;
|
||||
|
||||
virtual bool isOpacityModifyRGB() const override;
|
||||
|
@ -514,9 +513,9 @@ protected:
|
|||
bool recordPlaceholderInfo(int spriteIndex);
|
||||
|
||||
void setFontScale(float fontScale);
|
||||
|
||||
|
||||
virtual void alignText();
|
||||
|
||||
|
||||
bool computeHorizontalKernings(const std::u16string& stringToRender);
|
||||
|
||||
void computeStringNumLines();
|
||||
|
@ -527,13 +526,10 @@ protected:
|
|||
|
||||
virtual void updateShaderProgram();
|
||||
|
||||
void drawShadowWithoutBlur();
|
||||
void createSpriteForSystemFont();
|
||||
|
||||
void drawTextSprite(Renderer *renderer, uint32_t parentFlags);
|
||||
void createShadowSpriteForSystemFont();
|
||||
|
||||
void createSpriteWithFontDefinition();
|
||||
|
||||
void updateFont();
|
||||
void reset();
|
||||
|
||||
std::string _bmFontPath;
|
||||
|
@ -589,15 +585,16 @@ protected:
|
|||
|
||||
GLuint _uniformEffectColor;
|
||||
GLuint _uniformTextColor;
|
||||
CustomCommand _customCommand;
|
||||
CustomCommand _customCommand;
|
||||
|
||||
bool _shadowDirty;
|
||||
bool _shadowEnabled;
|
||||
Size _shadowOffset;
|
||||
int _shadowBlurRadius;
|
||||
Mat4 _shadowTransform;
|
||||
Color3B _shadowColor;
|
||||
float _shadowOpacity;
|
||||
Color4F _shadowColor4F;
|
||||
Color3B _shadowColor3B;
|
||||
GLubyte _shadowOpacity;
|
||||
Sprite* _shadowNode;
|
||||
|
||||
int _outlineSize;
|
||||
|
|
|
@ -86,6 +86,9 @@ public:
|
|||
virtual const std::string& getString(void) const override;
|
||||
|
||||
virtual void updateAtlasValues() override;
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
virtual std::string getDescription() const override;
|
||||
|
||||
#if CC_LABELATLAS_DEBUG_DRAW
|
||||
|
|
|
@ -84,17 +84,23 @@ public:
|
|||
static Menu* create(MenuItem* item, ...) CC_REQUIRES_NULL_TERMINATION;
|
||||
#endif
|
||||
|
||||
/** Creates a Menu with a Array of MenuItem objects. */
|
||||
/**
|
||||
* Creates a Menu with a Array of MenuItem objects.
|
||||
* @js NA
|
||||
*/
|
||||
static Menu* createWithArray(const Vector<MenuItem*>& arrayOfItems);
|
||||
|
||||
/**
|
||||
* Creates a Menu with it's item, then use addChild() to add
|
||||
* other items. It is used for script, it can't init with undetermined
|
||||
* number of variables.
|
||||
* @js NA
|
||||
*/
|
||||
static Menu* createWithItem(MenuItem* item);
|
||||
|
||||
/** Creates a Menu with MenuItem objects. */
|
||||
/** Creates a Menu with MenuItem objects.
|
||||
* @js NA
|
||||
*/
|
||||
static Menu* createWithItems(MenuItem *firstItem, va_list args);
|
||||
|
||||
/** Align items vertically. */
|
||||
|
@ -119,7 +125,9 @@ public:
|
|||
/** Align items in rows of columns. */
|
||||
void alignItemsInColumns(int columns, va_list args);
|
||||
|
||||
/** Align items in array of columns. */
|
||||
/** Align items in array of columns.
|
||||
* @js NA
|
||||
*/
|
||||
void alignItemsInColumnsWithArray(const ValueVector& rows);
|
||||
|
||||
/** Align items in columns of rows. */
|
||||
|
@ -128,7 +136,9 @@ public:
|
|||
/** Align items in columns of rows. */
|
||||
void alignItemsInRows(int rows, va_list args);
|
||||
|
||||
/** Align items in array of rows. */
|
||||
/** Align items in array of rows.
|
||||
* @js NA
|
||||
*/
|
||||
void alignItemsInRowsWithArray(const ValueVector& columns);
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
Copyright (c) 2013-2015 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -33,13 +33,6 @@ THE SOFTWARE.
|
|||
#include "deprecated/CCString.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#elif _MSC_VER >= 1400 //vs 2005 or higher
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable: 4996)
|
||||
#endif
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
static int _globalFontSize = kItemSize;
|
||||
|
@ -65,7 +58,7 @@ MenuItem* MenuItem::create()
|
|||
MenuItem* MenuItem::create(Ref *target, SEL_MenuHandler selector)
|
||||
{
|
||||
MenuItem *ret = new (std::nothrow) MenuItem();
|
||||
ret->initWithTarget(target, selector);
|
||||
ret->initWithCallback(std::bind(selector, target, std::placeholders::_1));
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
|
@ -81,8 +74,6 @@ MenuItem* MenuItem::create( const ccMenuCallback& callback)
|
|||
// FIXME: deprecated
|
||||
bool MenuItem::initWithTarget(cocos2d::Ref *target, SEL_MenuHandler selector )
|
||||
{
|
||||
_target = target;
|
||||
CC_SAFE_RETAIN(_target);
|
||||
return initWithCallback( std::bind(selector,target, std::placeholders::_1) );
|
||||
}
|
||||
|
||||
|
@ -102,7 +93,6 @@ MenuItem::~MenuItem()
|
|||
void MenuItem::onExit()
|
||||
{
|
||||
Node::onExit();
|
||||
CC_SAFE_RELEASE(_target);
|
||||
}
|
||||
|
||||
void MenuItem::selected()
|
||||
|
@ -159,8 +149,6 @@ bool MenuItem::isSelected() const
|
|||
// FIXME: deprecated
|
||||
void MenuItem::setTarget(Ref *target, SEL_MenuHandler selector)
|
||||
{
|
||||
_target = target;
|
||||
CC_SAFE_RETAIN(_target);
|
||||
setCallback( std::bind( selector, target, std::placeholders::_1) );
|
||||
}
|
||||
|
||||
|
@ -199,7 +187,7 @@ void MenuItemLabel::setLabel(Node* var)
|
|||
MenuItemLabel * MenuItemLabel::create(Node*label, Ref* target, SEL_MenuHandler selector)
|
||||
{
|
||||
MenuItemLabel *ret = new (std::nothrow) MenuItemLabel();
|
||||
ret->initWithLabel(label, target, selector);
|
||||
ret->initWithLabel(label, std::bind(selector, target, std::placeholders::_1));
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
|
@ -223,8 +211,6 @@ MenuItemLabel* MenuItemLabel::create(Node *label)
|
|||
// FIXME:: deprecated
|
||||
bool MenuItemLabel::initWithLabel(Node* label, Ref* target, SEL_MenuHandler selector)
|
||||
{
|
||||
_target = target;
|
||||
CC_SAFE_RETAIN(_target);
|
||||
return initWithLabel(label, std::bind(selector,target, std::placeholders::_1) );
|
||||
}
|
||||
|
||||
|
@ -329,7 +315,7 @@ MenuItemAtlasFont * MenuItemAtlasFont::create(const std::string& value, const st
|
|||
MenuItemAtlasFont * MenuItemAtlasFont::create(const std::string& value, const std::string& charMapFile, int itemWidth, int itemHeight, char startCharMap, Ref* target, SEL_MenuHandler selector)
|
||||
{
|
||||
MenuItemAtlasFont *ret = new (std::nothrow) MenuItemAtlasFont();
|
||||
ret->initWithString(value, charMapFile, itemWidth, itemHeight, startCharMap, target, selector);
|
||||
ret->initWithString(value, charMapFile, itemWidth, itemHeight, startCharMap, std::bind(selector, target, std::placeholders::_1));
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
|
@ -345,8 +331,6 @@ MenuItemAtlasFont * MenuItemAtlasFont::create(const std::string& value, const st
|
|||
// FIXME:: deprecated
|
||||
bool MenuItemAtlasFont::initWithString(const std::string& value, const std::string& charMapFile, int itemWidth, int itemHeight, char startCharMap, Ref* target, SEL_MenuHandler selector)
|
||||
{
|
||||
_target = target;
|
||||
CC_SAFE_RETAIN(_target);
|
||||
return initWithString(value, charMapFile, itemWidth, itemHeight, startCharMap, std::bind(selector,target, std::placeholders::_1) );
|
||||
}
|
||||
|
||||
|
@ -395,7 +379,7 @@ const std::string& MenuItemFont::getFontName()
|
|||
MenuItemFont * MenuItemFont::create(const std::string& value, Ref* target, SEL_MenuHandler selector)
|
||||
{
|
||||
MenuItemFont *ret = new (std::nothrow) MenuItemFont();
|
||||
ret->initWithString(value, target, selector);
|
||||
ret->initWithString(value, std::bind(selector, target, std::placeholders::_1));
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
|
@ -431,8 +415,6 @@ bool MenuItemFont::initWithString(const std::string& value, Ref* target, SEL_Men
|
|||
{
|
||||
CCASSERT( !value.empty(), "Value length must be greater than 0");
|
||||
|
||||
_target = target;
|
||||
CC_SAFE_RETAIN(target);
|
||||
return initWithString(value, std::bind(selector,target, std::placeholders::_1) );
|
||||
}
|
||||
|
||||
|
@ -552,7 +534,7 @@ MenuItemSprite * MenuItemSprite::create(Node* normalSprite, Node* selectedSprite
|
|||
// FIXME: deprecated
|
||||
MenuItemSprite * MenuItemSprite::create(Node* normalSprite, Node* selectedSprite, Ref* target, SEL_MenuHandler selector)
|
||||
{
|
||||
return MenuItemSprite::create(normalSprite, selectedSprite, nullptr, target, selector);
|
||||
return MenuItemSprite::create(normalSprite, selectedSprite, nullptr, std::bind(selector, target, std::placeholders::_1));
|
||||
}
|
||||
|
||||
MenuItemSprite * MenuItemSprite::create(Node* normalSprite, Node* selectedSprite, const ccMenuCallback& callback)
|
||||
|
@ -564,7 +546,7 @@ MenuItemSprite * MenuItemSprite::create(Node* normalSprite, Node* selectedSprite
|
|||
MenuItemSprite * MenuItemSprite::create(Node *normalSprite, Node *selectedSprite, Node *disabledSprite, Ref *target, SEL_MenuHandler selector)
|
||||
{
|
||||
MenuItemSprite *ret = new (std::nothrow) MenuItemSprite();
|
||||
ret->initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, target, selector);
|
||||
ret->initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, std::bind(selector, target, std::placeholders::_1));
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
|
@ -580,8 +562,6 @@ MenuItemSprite * MenuItemSprite::create(Node *normalSprite, Node *selectedSprite
|
|||
// FIXME: deprecated
|
||||
bool MenuItemSprite::initWithNormalSprite(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, Ref* target, SEL_MenuHandler selector)
|
||||
{
|
||||
_target = target;
|
||||
CC_SAFE_RETAIN(_target);
|
||||
return initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, std::bind(selector,target, std::placeholders::_1) );
|
||||
}
|
||||
|
||||
|
@ -712,7 +692,7 @@ MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std:
|
|||
// FIXME: deprecated
|
||||
MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std::string& selectedImage, Ref* target, SEL_MenuHandler selector)
|
||||
{
|
||||
return MenuItemImage::create(normalImage, selectedImage, "", target, selector);
|
||||
return MenuItemImage::create(normalImage, selectedImage, "", std::bind(selector, target, std::placeholders::_1));
|
||||
}
|
||||
|
||||
MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std::string& selectedImage, const ccMenuCallback& callback)
|
||||
|
@ -724,7 +704,7 @@ MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std:
|
|||
MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std::string& selectedImage, const std::string& disabledImage, Ref* target, SEL_MenuHandler selector)
|
||||
{
|
||||
MenuItemImage *ret = new (std::nothrow) MenuItemImage();
|
||||
if (ret && ret->initWithNormalImage(normalImage, selectedImage, disabledImage, target, selector))
|
||||
if (ret && ret->initWithNormalImage(normalImage, selectedImage, disabledImage, std::bind(selector, target, std::placeholders::_1)))
|
||||
{
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
|
@ -760,8 +740,6 @@ MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std:
|
|||
// FIXME:: deprecated
|
||||
bool MenuItemImage::initWithNormalImage(const std::string& normalImage, const std::string& selectedImage, const std::string& disabledImage, Ref* target, SEL_MenuHandler selector)
|
||||
{
|
||||
_target = target;
|
||||
CC_SAFE_RETAIN(_target);
|
||||
return initWithNormalImage(normalImage, selectedImage, disabledImage, std::bind(selector,target, std::placeholders::_1) );
|
||||
}
|
||||
bool MenuItemImage::initWithNormalImage(const std::string& normalImage, const std::string& selectedImage, const std::string& disabledImage, const ccMenuCallback& callback)
|
||||
|
@ -813,7 +791,7 @@ void MenuItemImage::setDisabledSpriteFrame(SpriteFrame * frame)
|
|||
MenuItemToggle * MenuItemToggle::createWithTarget(Ref* target, SEL_MenuHandler selector, const Vector<MenuItem*>& menuItems)
|
||||
{
|
||||
MenuItemToggle *ret = new (std::nothrow) MenuItemToggle();
|
||||
ret->MenuItem::initWithTarget(target, selector);
|
||||
ret->MenuItem::initWithCallback(std::bind(selector, target, std::placeholders::_1));
|
||||
ret->_subItems = menuItems;
|
||||
ret->_selectedIndex = UINT_MAX;
|
||||
ret->setSelectedIndex(0);
|
||||
|
@ -836,7 +814,7 @@ MenuItemToggle * MenuItemToggle::createWithTarget(Ref* target, SEL_MenuHandler s
|
|||
va_list args;
|
||||
va_start(args, item);
|
||||
MenuItemToggle *ret = new (std::nothrow) MenuItemToggle();
|
||||
ret->initWithTarget(target, selector, item, args);
|
||||
ret->initWithCallback(std::bind(selector, target, std::placeholders::_1), item, args);
|
||||
ret->autorelease();
|
||||
va_end(args);
|
||||
return ret;
|
||||
|
@ -877,8 +855,6 @@ MenuItemToggle * MenuItemToggle::create()
|
|||
// FIXME:: deprecated
|
||||
bool MenuItemToggle::initWithTarget(Ref* target, SEL_MenuHandler selector, MenuItem* item, va_list args)
|
||||
{
|
||||
_target = target;
|
||||
CC_SAFE_RETAIN(_target);
|
||||
return initWithCallback(std::bind( selector, target, std::placeholders::_1), item, args);
|
||||
}
|
||||
|
||||
|
@ -995,9 +971,3 @@ MenuItem* MenuItemToggle::getSelectedItem()
|
|||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
|
||||
#pragma GCC diagnostic warning "-Wdeprecated-declarations"
|
||||
#elif _MSC_VER >= 1400 //vs 2005 or higher
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
|
|
|
@ -79,6 +79,9 @@ public:
|
|||
/** Returns whether or not the item is selected. */
|
||||
virtual bool isSelected() const;
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
virtual void onExit() override;
|
||||
|
||||
/** Set the callback to the menu item.
|
||||
|
@ -90,12 +93,13 @@ public:
|
|||
void setCallback(const ccMenuCallback& callback);
|
||||
|
||||
/** Set the target/selector of the menu item.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE void setTarget(Ref *rec, SEL_MenuHandler selector);
|
||||
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
virtual std::string getDescription() const override;
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
|
@ -106,7 +110,6 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
: _selected(false)
|
||||
, _enabled(false)
|
||||
, _callback(nullptr)
|
||||
, _target(nullptr)
|
||||
{}
|
||||
/**
|
||||
* @js NA
|
||||
|
@ -115,7 +118,6 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
virtual ~MenuItem();
|
||||
|
||||
/** Initializes a MenuItem with a target/selector.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
bool initWithCallback(const ccMenuCallback& callback);
|
||||
|
@ -130,8 +132,6 @@ protected:
|
|||
bool _enabled;
|
||||
// callback
|
||||
ccMenuCallback _callback;
|
||||
// If using the old API, the _target needs to be retained / released
|
||||
Ref *_target;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItem);
|
||||
|
@ -275,11 +275,13 @@ public:
|
|||
* c++ can not overload static and non-static member functions with the same parameter types.
|
||||
* so change the name to setFontSizeObj.
|
||||
* @js setFontSize
|
||||
* @js NA
|
||||
*/
|
||||
void setFontSizeObj(int size);
|
||||
|
||||
/** get font size .
|
||||
* @js getFontSize
|
||||
* @js NA
|
||||
*/
|
||||
int getFontSizeObj() const;
|
||||
CC_DEPRECATED_ATTRIBUTE int fontSizeObj() const { return getFontSizeObj(); };
|
||||
|
@ -289,15 +291,19 @@ public:
|
|||
* c++ can not overload static and non-static member functions with the same parameter types.
|
||||
* so change the name to setFontNameObj.
|
||||
* @js setFontName
|
||||
* @js NA
|
||||
*/
|
||||
void setFontNameObj(const std::string& name);
|
||||
|
||||
/** Returns the name of the Font.
|
||||
* @js getFontNameObj
|
||||
* @js NA
|
||||
*/
|
||||
const std::string& getFontNameObj() const;
|
||||
|
||||
/** Deprecated Use getFontNameObj() instead. */
|
||||
/** Deprecated Use getFontNameObj() instead.
|
||||
* @js NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE const std::string& fontNameObj() const { return getFontNameObj(); }
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
|
|
|
@ -86,6 +86,16 @@ public:
|
|||
* @param bFastMode True if enabled fast mode.
|
||||
*/
|
||||
inline void setFastMode(bool bFastMode) { _fastMode = bFastMode; }
|
||||
/** Get stroke.
|
||||
*
|
||||
* @return float stroke.
|
||||
*/
|
||||
inline float getStroke() const { return _stroke; }
|
||||
/** Set stroke.
|
||||
*
|
||||
* @param stroke The width of stroke.
|
||||
*/
|
||||
inline void setStroke(float stroke) { _stroke = stroke; }
|
||||
|
||||
/** Is the starting position initialized or not.
|
||||
*
|
||||
|
|
|
@ -127,6 +127,9 @@ Node::Node(void)
|
|||
, _physicsRotation(0.0f)
|
||||
, _physicsTransformDirty(true)
|
||||
, _updateTransformFromPhysics(true)
|
||||
, _physicsWorld(nullptr)
|
||||
, _physicsBodyAssociatedWith(0)
|
||||
, _physicsRotationOffset(0.0f)
|
||||
#endif
|
||||
, _displayedOpacity(255)
|
||||
, _realOpacity(255)
|
||||
|
@ -334,8 +337,9 @@ void Node::setRotation(float rotation)
|
|||
_rotationZ_X = _rotationZ_Y = rotation;
|
||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||
#if CC_USE_PHYSICS
|
||||
if (_physicsBody && _physicsBody->getWorld()) {
|
||||
_physicsBody->getWorld()->_updateBodyTransform = true;
|
||||
if (_physicsWorld && _physicsBodyAssociatedWith > 0)
|
||||
{
|
||||
_physicsWorld->_updateBodyTransform = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -475,8 +479,9 @@ void Node::setScale(float scale)
|
|||
_scaleX = _scaleY = _scaleZ = scale;
|
||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||
#if CC_USE_PHYSICS
|
||||
if (_physicsBody && _physicsBody->getWorld()) {
|
||||
_physicsBody->getWorld()->_updateBodyTransform = true;
|
||||
if (_physicsWorld && _physicsBodyAssociatedWith > 0)
|
||||
{
|
||||
_physicsWorld->_updateBodyTransform = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -497,8 +502,9 @@ void Node::setScale(float scaleX,float scaleY)
|
|||
_scaleY = scaleY;
|
||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||
#if CC_USE_PHYSICS
|
||||
if (_physicsBody && _physicsBody->getWorld()) {
|
||||
_physicsBody->getWorld()->_updateBodyTransform = true;
|
||||
if (_physicsWorld && _physicsBodyAssociatedWith > 0)
|
||||
{
|
||||
_physicsWorld->_updateBodyTransform = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -512,8 +518,9 @@ void Node::setScaleX(float scaleX)
|
|||
_scaleX = scaleX;
|
||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||
#if CC_USE_PHYSICS
|
||||
if (_physicsBody && _physicsBody->getWorld()) {
|
||||
_physicsBody->getWorld()->_updateBodyTransform = true;
|
||||
if (_physicsWorld && _physicsBodyAssociatedWith > 0)
|
||||
{
|
||||
_physicsWorld->_updateBodyTransform = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -556,8 +563,9 @@ void Node::setScaleY(float scaleY)
|
|||
_scaleY = scaleY;
|
||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||
#if CC_USE_PHYSICS
|
||||
if (_physicsBody && _physicsBody->getWorld()) {
|
||||
_physicsBody->getWorld()->_updateBodyTransform = true;
|
||||
if (_physicsWorld && _physicsBodyAssociatedWith > 0)
|
||||
{
|
||||
_physicsWorld->_updateBodyTransform = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -592,8 +600,9 @@ void Node::setPosition(float x, float y)
|
|||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||
_usingNormalizedPosition = false;
|
||||
#if CC_USE_PHYSICS
|
||||
if (_physicsBody && _physicsBody->getWorld()) {
|
||||
_physicsBody->getWorld()->_updateBodyTransform = true;
|
||||
if (_physicsWorld && _physicsBodyAssociatedWith > 0)
|
||||
{
|
||||
_physicsWorld->_updateBodyTransform = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -661,8 +670,9 @@ void Node::setNormalizedPosition(const Vec2& position)
|
|||
_normalizedPositionDirty = true;
|
||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||
#if CC_USE_PHYSICS
|
||||
if (_physicsBody && _physicsBody->getWorld()) {
|
||||
_physicsBody->getWorld()->_updateBodyTransform = true;
|
||||
if (_physicsWorld && _physicsBodyAssociatedWith > 0)
|
||||
{
|
||||
_physicsWorld->_updateBodyTransform = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1050,8 +1060,17 @@ void Node::addChildHelper(Node* child, int localZOrder, int tag, const std::stri
|
|||
child->setOrderOfArrival(s_globalOrderOfArrival++);
|
||||
|
||||
#if CC_USE_PHYSICS
|
||||
_physicsBodyAssociatedWith += child->_physicsBodyAssociatedWith;
|
||||
auto parentNode = this;
|
||||
while (parentNode->_parent)
|
||||
{
|
||||
parentNode = parentNode->_parent;
|
||||
parentNode->_physicsBodyAssociatedWith += child->_physicsBodyAssociatedWith;
|
||||
}
|
||||
|
||||
auto scene = dynamic_cast<Scene*>(parentNode);
|
||||
|
||||
// Recursive add children with which have physics body.
|
||||
auto scene = this->getScene();
|
||||
if (scene && scene->getPhysicsWorld())
|
||||
{
|
||||
scene->addChildToPhysicsWorld(child);
|
||||
|
@ -2029,6 +2048,14 @@ void Node::setPhysicsBody(PhysicsBody* body)
|
|||
_physicsBody->_node = nullptr;
|
||||
_physicsBody->release();
|
||||
_physicsBody = nullptr;
|
||||
|
||||
_physicsBodyAssociatedWith--;
|
||||
auto parentNode = this;
|
||||
while (parentNode->_parent)
|
||||
{
|
||||
parentNode = parentNode->_parent;
|
||||
parentNode->_physicsBodyAssociatedWith--;
|
||||
}
|
||||
}
|
||||
|
||||
if (body)
|
||||
|
@ -2052,8 +2079,17 @@ void Node::setPhysicsBody(PhysicsBody* body)
|
|||
_physicsBody = body;
|
||||
_physicsScaleStartX = _scaleX;
|
||||
_physicsScaleStartY = _scaleY;
|
||||
_physicsRotationOffset = _rotationZ_X;
|
||||
|
||||
auto scene = getScene();
|
||||
_physicsBodyAssociatedWith++;
|
||||
auto parentNode = this;
|
||||
while (parentNode->_parent)
|
||||
{
|
||||
parentNode = parentNode->_parent;
|
||||
parentNode->_physicsBodyAssociatedWith++;
|
||||
}
|
||||
|
||||
auto scene = dynamic_cast<Scene*>(parentNode);
|
||||
if (scene && scene->getPhysicsWorld())
|
||||
{
|
||||
_physicsTransformDirty = true;
|
||||
|
@ -2082,7 +2118,7 @@ void Node::updatePhysicsBodyTransform(const Mat4& parentTransform, uint32_t pare
|
|||
parentTransform.transformPoint(vec3, &ret);
|
||||
_physicsBody->setPosition(Vec2(ret.x, ret.y));
|
||||
_physicsBody->setScale(scaleX / _physicsScaleStartX, scaleY / _physicsScaleStartY);
|
||||
_physicsBody->setRotation(_physicsRotation);
|
||||
_physicsBody->setRotation(_physicsRotation - _physicsRotationOffset);
|
||||
}
|
||||
|
||||
for (auto node : _children)
|
||||
|
@ -2095,6 +2131,7 @@ void Node::updateTransformFromPhysics(const Mat4& parentTransform, uint32_t pare
|
|||
{
|
||||
auto& newPosition = _physicsBody->getPosition();
|
||||
auto& recordedPosition = _physicsBody->_recordedPosition;
|
||||
auto updateBodyTransform = _physicsWorld->_updateBodyTransform;
|
||||
if (parentFlags || recordedPosition.x != newPosition.x || recordedPosition.y != newPosition.y)
|
||||
{
|
||||
recordedPosition = newPosition;
|
||||
|
@ -2104,7 +2141,8 @@ void Node::updateTransformFromPhysics(const Mat4& parentTransform, uint32_t pare
|
|||
setPosition(ret.x, ret.y);
|
||||
}
|
||||
_physicsRotation = _physicsBody->getRotation();
|
||||
setRotation(_physicsRotation - _parent->_physicsRotation);
|
||||
setRotation(_physicsRotation - _parent->_physicsRotation + _physicsRotationOffset);
|
||||
_physicsWorld->_updateBodyTransform = updateBodyTransform;
|
||||
}
|
||||
|
||||
#endif //CC_USE_PHYSICS
|
||||
|
|
|
@ -54,6 +54,7 @@ class GLProgram;
|
|||
class GLProgramState;
|
||||
#if CC_USE_PHYSICS
|
||||
class PhysicsBody;
|
||||
class PhysicsWorld;
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -731,7 +732,7 @@ public:
|
|||
* If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
|
||||
*
|
||||
* @param child A child node.
|
||||
* @param zOrder Z order for drawing priority. Please refer to `setLocalZOrder(int)`.
|
||||
* @param localZOrder Z order for drawing priority. Please refer to `setLocalZOrder(int)`.
|
||||
*/
|
||||
virtual void addChild(Node * child, int localZOrder);
|
||||
/**
|
||||
|
@ -739,9 +740,9 @@ public:
|
|||
*
|
||||
* If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
|
||||
*
|
||||
* @param child A child node.
|
||||
* @param zOrder Z order for drawing priority. Please refer to `setLocalZOrder(int)`.
|
||||
* @param tag An integer to identify the node easily. Please refer to `setTag(int)`.
|
||||
* @param child A child node.
|
||||
* @param localZOrder Z order for drawing priority. Please refer to `setLocalZOrder(int)`.
|
||||
* @param tag An integer to identify the node easily. Please refer to `setTag(int)`.
|
||||
*
|
||||
* Please use `addChild(Node* child, int localZOrder, const std::string &name)` instead.
|
||||
*/
|
||||
|
@ -752,7 +753,7 @@ public:
|
|||
* If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
|
||||
*
|
||||
* @param child A child node.
|
||||
* @param zOrder Z order for drawing priority. Please refer to `setLocalZOrder(int)`.
|
||||
* @param localZOrder Z order for drawing priority. Please refer to `setLocalZOrder(int)`.
|
||||
* @param name A string to identify the node easily. Please refer to `setName(int)`.
|
||||
*
|
||||
*/
|
||||
|
@ -1195,7 +1196,7 @@ public:
|
|||
* This node becomes the action's target. Refer to Action::getTarget().
|
||||
* @warning Actions don't retain their target.
|
||||
*
|
||||
* @param An Action pointer
|
||||
* @param action An Action pointer.
|
||||
*/
|
||||
virtual Action* runAction(Action* action);
|
||||
|
||||
|
@ -1631,7 +1632,7 @@ public:
|
|||
/**
|
||||
* Removes a component by its pointer.
|
||||
*
|
||||
* @param name A given component.
|
||||
* @param component A given component.
|
||||
* @return True if removed success.
|
||||
*/
|
||||
virtual bool removeComponent(Component *component);
|
||||
|
@ -1838,6 +1839,10 @@ protected:
|
|||
float _physicsRotation;
|
||||
bool _physicsTransformDirty;
|
||||
bool _updateTransformFromPhysics;
|
||||
|
||||
PhysicsWorld* _physicsWorld; /** The PhysicsWorld associated with the node.*/
|
||||
int _physicsBodyAssociatedWith; /** The count of PhysicsBody associated with the node and children.*/
|
||||
float _physicsRotationOffset; /** Record the rotation value when invoke Node::setPhysicsBody.*/
|
||||
#endif
|
||||
|
||||
// opacity controls
|
||||
|
@ -1862,7 +1867,7 @@ private:
|
|||
CC_DISALLOW_COPY_AND_ASSIGN(Node);
|
||||
|
||||
#if CC_USE_PHYSICS
|
||||
friend class Layer;
|
||||
friend class Scene;
|
||||
#endif //CC_USTPS
|
||||
};
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ public:
|
|||
http://particledesigner.71squared.com/
|
||||
@since v2.0
|
||||
*
|
||||
* @param Particle plist file name.
|
||||
* @param plistFile Particle plist file name.
|
||||
* @return An autoreleased ParticleSystem object.
|
||||
*/
|
||||
static ParticleSystem * create(const std::string& plistFile);
|
||||
|
@ -229,7 +229,7 @@ public:
|
|||
|
||||
/** Call the update mathod with no time..
|
||||
*/
|
||||
virtual void updateWithNoTime(void);
|
||||
virtual void updateWithNoTime();
|
||||
|
||||
/** Whether or not the particle system removed self on finish.
|
||||
*
|
||||
|
@ -453,7 +453,7 @@ public:
|
|||
inline const Vec2& getSourcePosition() const { return _sourcePosition; };
|
||||
/** Sets the source position of the emitter.
|
||||
*
|
||||
* @param The source position of the emitter.
|
||||
* @param pos The source position of the emitter.
|
||||
*/
|
||||
inline void setSourcePosition(const Vec2& pos) { _sourcePosition = pos; };
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
* If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
|
||||
*
|
||||
* @param child A child node
|
||||
* @param zOrder Z order for drawing priority. Please refer to `setLocalZOrder(int)`
|
||||
* @param localZOrder Z order for drawing priority. Please refer to `setLocalZOrder(int)`
|
||||
*/
|
||||
virtual void addProtectedChild(Node * child, int localZOrder);
|
||||
/**
|
||||
|
@ -78,7 +78,7 @@ public:
|
|||
* If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
|
||||
*
|
||||
* @param child A child node
|
||||
* @param zOrder Z order for drawing priority. Please refer to `setLocalZOrder(int)`
|
||||
* @param localZOrder Z order for drawing priority. Please refer to `setLocalZOrder(int)`
|
||||
* @param tag An integer to identify the node easily. Please refer to `setTag(int)`
|
||||
*/
|
||||
virtual void addProtectedChild(Node* child, int localZOrder, int tag);
|
||||
|
@ -141,6 +141,9 @@ public:
|
|||
|
||||
/// @} end of Children and Parent
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
virtual void visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override;
|
||||
|
||||
virtual void cleanup() override;
|
||||
|
|
|
@ -97,6 +97,7 @@ public:
|
|||
* @param g Green.
|
||||
* @param b Blue.
|
||||
* @param a Alpha.
|
||||
* @param depthValue The depth Value.
|
||||
*/
|
||||
virtual void beginWithClear(float r, float g, float b, float a, float depthValue);
|
||||
|
||||
|
@ -112,7 +113,9 @@ public:
|
|||
*/
|
||||
virtual void beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue);
|
||||
|
||||
/** End is key word of lua, use other name to export to lua. */
|
||||
/** End is key word of lua, use other name to export to lua.
|
||||
* @js NA
|
||||
*/
|
||||
inline void endToLua(){ end();};
|
||||
|
||||
/** Ends grabbing. */
|
||||
|
@ -129,13 +132,13 @@ public:
|
|||
|
||||
/** Clears the texture with a specified depth value.
|
||||
*
|
||||
* @param A specified depth value.
|
||||
* @param depthValue A specified depth value.
|
||||
*/
|
||||
virtual void clearDepth(float depthValue);
|
||||
|
||||
/** Clears the texture with a specified stencil value.
|
||||
*
|
||||
* @param A specified stencil value.
|
||||
* @param stencilValue A specified stencil value.
|
||||
*/
|
||||
virtual void clearStencil(int stencilValue);
|
||||
|
||||
|
@ -144,6 +147,7 @@ public:
|
|||
*
|
||||
* @param flipImage Whether or not to flip image.
|
||||
* @return An image.
|
||||
* @js NA
|
||||
*/
|
||||
Image* newImage(bool flipImage = true);
|
||||
|
||||
|
@ -256,7 +260,7 @@ public:
|
|||
|
||||
/** Sets the Sprite being used.
|
||||
*
|
||||
* @param A Sprite.
|
||||
* @param sprite A Sprite.
|
||||
*/
|
||||
inline void setSprite(Sprite* sprite) {
|
||||
CC_SAFE_RETAIN(sprite);
|
||||
|
@ -271,6 +275,7 @@ public:
|
|||
/** Flag: Use stack matrix computed from scene hierarchy or generate new modelView and projection matrix.
|
||||
*
|
||||
* @param keepMatrix Wether or not use stack matrix computed from scene hierarchy or generate new modelView and projection matrix.
|
||||
* @js NA
|
||||
*/
|
||||
void setKeepMatrix(bool keepMatrix);
|
||||
/**Used for grab part of screen to a texture.
|
||||
|
@ -284,8 +289,14 @@ public:
|
|||
/** FIXME: should be procted.
|
||||
* but due to a bug in PowerVR + Android,
|
||||
* the constructor is public again.
|
||||
* @js ctor
|
||||
*/
|
||||
RenderTexture();
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~RenderTexture();
|
||||
/** Initializes a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid.
|
||||
*
|
||||
|
|
|
@ -227,6 +227,8 @@ void Scene::addChildToPhysicsWorld(Node* child)
|
|||
std::function<void(Node*)> addToPhysicsWorldFunc = nullptr;
|
||||
addToPhysicsWorldFunc = [this, &addToPhysicsWorldFunc](Node* node) -> void
|
||||
{
|
||||
node->_physicsWorld = _physicsWorld;
|
||||
|
||||
if (node->getPhysicsBody())
|
||||
{
|
||||
_physicsWorld->addBody(node->getPhysicsBody());
|
||||
|
|
|
@ -367,20 +367,21 @@ void Sprite::setTextureRect(const Rect& rect, bool rotated, const Size& untrimme
|
|||
setVertexRect(rect);
|
||||
setTextureCoords(rect);
|
||||
|
||||
Vec2 relativeOffset = _unflippedOffsetPositionFromCenter;
|
||||
float relativeOffsetX = _unflippedOffsetPositionFromCenter.x;
|
||||
float relativeOffsetY = _unflippedOffsetPositionFromCenter.y;
|
||||
|
||||
// issue #732
|
||||
if (_flippedX)
|
||||
{
|
||||
relativeOffset.x = -relativeOffset.x;
|
||||
relativeOffsetX = -relativeOffsetX;
|
||||
}
|
||||
if (_flippedY)
|
||||
{
|
||||
relativeOffset.y = -relativeOffset.y;
|
||||
relativeOffsetY = -relativeOffsetY;
|
||||
}
|
||||
|
||||
_offsetPosition.x = relativeOffset.x + (_contentSize.width - _rect.size.width) / 2;
|
||||
_offsetPosition.y = relativeOffset.y + (_contentSize.height - _rect.size.height) / 2;
|
||||
_offsetPosition.x = relativeOffsetX + (_contentSize.width - _rect.size.width) / 2;
|
||||
_offsetPosition.y = relativeOffsetY + (_contentSize.height - _rect.size.height) / 2;
|
||||
|
||||
// rendering using batch node
|
||||
if (_batchNode)
|
||||
|
@ -393,16 +394,16 @@ void Sprite::setTextureRect(const Rect& rect, bool rotated, const Size& untrimme
|
|||
// self rendering
|
||||
|
||||
// Atlas: Vertex
|
||||
float x1 = 0 + _offsetPosition.x;
|
||||
float y1 = 0 + _offsetPosition.y;
|
||||
float x1 = 0.0f + _offsetPosition.x;
|
||||
float y1 = 0.0f + _offsetPosition.y;
|
||||
float x2 = x1 + _rect.size.width;
|
||||
float y2 = y1 + _rect.size.height;
|
||||
|
||||
// Don't update Z.
|
||||
_quad.bl.vertices = Vec3(x1, y1, 0);
|
||||
_quad.br.vertices = Vec3(x2, y1, 0);
|
||||
_quad.tl.vertices = Vec3(x1, y2, 0);
|
||||
_quad.tr.vertices = Vec3(x2, y2, 0);
|
||||
_quad.bl.vertices.set(x1, y1, 0.0f);
|
||||
_quad.br.vertices.set(x2, y1, 0.0f);
|
||||
_quad.tl.vertices.set(x1, y2, 0.0f);
|
||||
_quad.tr.vertices.set(x2, y2, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -507,7 +508,10 @@ void Sprite::updateTransform(void)
|
|||
// If it is not visible, or one of its ancestors is not visible, then do nothing:
|
||||
if( !_visible || ( _parent && _parent != _batchNode && static_cast<Sprite*>(_parent)->_shouldBeHidden) )
|
||||
{
|
||||
_quad.br.vertices = _quad.tl.vertices = _quad.tr.vertices = _quad.bl.vertices = Vec3(0,0,0);
|
||||
_quad.br.vertices.setZero();
|
||||
_quad.tl.vertices.setZero();
|
||||
_quad.tr.vertices.setZero();
|
||||
_quad.bl.vertices.setZero();
|
||||
_shouldBeHidden = true;
|
||||
}
|
||||
else
|
||||
|
@ -556,10 +560,10 @@ void Sprite::updateTransform(void)
|
|||
float dx = x1 * cr - y2 * sr2 + x;
|
||||
float dy = x1 * sr + y2 * cr2 + y;
|
||||
|
||||
_quad.bl.vertices = Vec3( RENDER_IN_SUBPIXEL(ax), RENDER_IN_SUBPIXEL(ay), _positionZ );
|
||||
_quad.br.vertices = Vec3( RENDER_IN_SUBPIXEL(bx), RENDER_IN_SUBPIXEL(by), _positionZ );
|
||||
_quad.tl.vertices = Vec3( RENDER_IN_SUBPIXEL(dx), RENDER_IN_SUBPIXEL(dy), _positionZ );
|
||||
_quad.tr.vertices = Vec3( RENDER_IN_SUBPIXEL(cx), RENDER_IN_SUBPIXEL(cy), _positionZ );
|
||||
_quad.bl.vertices.set(RENDER_IN_SUBPIXEL(ax), RENDER_IN_SUBPIXEL(ay), _positionZ);
|
||||
_quad.br.vertices.set(RENDER_IN_SUBPIXEL(bx), RENDER_IN_SUBPIXEL(by), _positionZ);
|
||||
_quad.tl.vertices.set(RENDER_IN_SUBPIXEL(dx), RENDER_IN_SUBPIXEL(dy), _positionZ);
|
||||
_quad.tr.vertices.set(RENDER_IN_SUBPIXEL(cx), RENDER_IN_SUBPIXEL(cy), _positionZ);
|
||||
}
|
||||
|
||||
// MARMALADE CHANGE: ADDED CHECK FOR nullptr, TO PERMIT SPRITES WITH NO BATCH NODE / TEXTURE ATLAS
|
||||
|
@ -1016,10 +1020,10 @@ void Sprite::setBatchNode(SpriteBatchNode *spriteBatchNode)
|
|||
float y1 = _offsetPosition.y;
|
||||
float x2 = x1 + _rect.size.width;
|
||||
float y2 = y1 + _rect.size.height;
|
||||
_quad.bl.vertices = Vec3( x1, y1, 0 );
|
||||
_quad.br.vertices = Vec3( x2, y1, 0 );
|
||||
_quad.tl.vertices = Vec3( x1, y2, 0 );
|
||||
_quad.tr.vertices = Vec3( x2, y2, 0 );
|
||||
_quad.bl.vertices.set( x1, y1, 0 );
|
||||
_quad.br.vertices.set(x2, y1, 0);
|
||||
_quad.tl.vertices.set(x1, y2, 0);
|
||||
_quad.tr.vertices.set(x2, y2, 0);
|
||||
|
||||
} else {
|
||||
|
||||
|
|
|
@ -244,7 +244,9 @@ public:
|
|||
* Returns the current displayed frame.
|
||||
*/
|
||||
virtual SpriteFrame* getSpriteFrame() const;
|
||||
/** @deprecated Use `getSpriteFrame()` instead. */
|
||||
/** @deprecated Use `getSpriteFrame()` instead.
|
||||
* @js NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE virtual SpriteFrame* getDisplayFrame() const { return getSpriteFrame(); }
|
||||
/** @deprecated Use `getSpriteFrame()` instead. */
|
||||
CC_DEPRECATED_ATTRIBUTE virtual SpriteFrame* displayFrame() const { return getSpriteFrame(); };
|
||||
|
@ -345,7 +347,9 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE bool isFlipX() { return isFlippedX(); };
|
||||
/** @deprecated Use setFlippedX() instead */
|
||||
/** @deprecated Use setFlippedX() instead
|
||||
* @js NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE void setFlipX(bool flippedX) { setFlippedX(flippedX); };
|
||||
|
||||
/**
|
||||
|
@ -368,9 +372,13 @@ public:
|
|||
|
||||
/// @} End of Sprite properties getter/setters
|
||||
|
||||
/** @deprecated Use isFlippedY() instead. */
|
||||
/** @deprecated Use isFlippedY() instead.
|
||||
* @js NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE bool isFlipY() { return isFlippedY(); };
|
||||
/** @deprecated Use setFlippedY() instead. */
|
||||
/** @deprecated Use setFlippedY() instead.
|
||||
* @js NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE void setFlipY(bool flippedY) { setFlippedY(flippedY); };
|
||||
|
||||
//
|
||||
|
@ -393,6 +401,9 @@ public:
|
|||
inline const BlendFunc& getBlendFunc() const override { return _blendFunc; }
|
||||
/// @}
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
virtual std::string getDescription() const override;
|
||||
|
||||
/// @{
|
||||
|
@ -429,7 +440,9 @@ public:
|
|||
/// @}
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Sprite();
|
||||
virtual ~Sprite();
|
||||
|
||||
|
@ -443,7 +456,7 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
*
|
||||
* @param texture A pointer to an existing Texture2D object.
|
||||
* You can use a Texture2D object for many sprites.
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
* @return True if the sprite is initialized properly, false otherwise.
|
||||
*/
|
||||
virtual bool initWithTexture(Texture2D *texture);
|
||||
|
||||
|
@ -455,7 +468,7 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
* @param texture A pointer to an exisiting Texture2D object.
|
||||
* You can use a Texture2D object for many sprites.
|
||||
* @param rect Only the contents inside rect of this texture will be applied for this sprite.
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
* @return True if the sprite is initialized properly, false otherwise.
|
||||
*/
|
||||
virtual bool initWithTexture(Texture2D *texture, const Rect& rect);
|
||||
|
||||
|
@ -468,15 +481,15 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
* @param texture A Texture2D object whose texture will be applied to this sprite.
|
||||
* @param rect A rectangle assigned the contents of texture.
|
||||
* @param rotated Whether or not the texture rectangle is rotated.
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
* @return True if the sprite is initialized properly, false otherwise.
|
||||
*/
|
||||
virtual bool initWithTexture(Texture2D *texture, const Rect& rect, bool rotated);
|
||||
|
||||
/**
|
||||
* Initializes a sprite with an SpriteFrame. The texture and rect in SpriteFrame will be applied on this sprite.
|
||||
*
|
||||
* @param pSpriteFrame A SpriteFrame object. It should includes a valid texture and a rect.
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
* @param spriteFrame A SpriteFrame object. It should includes a valid texture and a rect.
|
||||
* @return True if the sprite is initialized properly, false otherwise.
|
||||
*/
|
||||
virtual bool initWithSpriteFrame(SpriteFrame *spriteFrame);
|
||||
|
||||
|
@ -487,7 +500,7 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
* If the SpriteFrame doesn't exist it will raise an exception.
|
||||
*
|
||||
* @param spriteFrameName A key string that can fected a volid SpriteFrame from SpriteFrameCache.
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
* @return True if the sprite is initialized properly, false otherwise.
|
||||
*/
|
||||
virtual bool initWithSpriteFrameName(const std::string& spriteFrameName);
|
||||
|
||||
|
@ -499,8 +512,7 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
* After initialization, the rect used will be the size of the image. The offset will be (0,0).
|
||||
*
|
||||
* @param filename The path to an image file in local file system.
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
* @js init
|
||||
* @return True if the sprite is initialized properly, false otherwise.
|
||||
* @lua init
|
||||
*/
|
||||
virtual bool initWithFile(const std::string& filename);
|
||||
|
@ -514,8 +526,7 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
*
|
||||
* @param filename The path to an image file in local file system.
|
||||
* @param rect The rectangle assigned the content area from texture.
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
* @js init
|
||||
* @return True if the sprite is initialized properly, false otherwise.
|
||||
* @lua init
|
||||
*/
|
||||
virtual bool initWithFile(const std::string& filename, const Rect& rect);
|
||||
|
|
|
@ -183,11 +183,13 @@ public:
|
|||
*/
|
||||
virtual void setBlendFunc(const BlendFunc &blendFunc) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual const BlendFunc& getBlendFunc() const override;
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
virtual void visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override;
|
||||
|
||||
using Node::addChild;
|
||||
|
@ -195,10 +197,19 @@ public:
|
|||
virtual void addChild(Node * child, int zOrder, const std::string &name) override;
|
||||
virtual void reorderChild(Node *child, int zOrder) override;
|
||||
|
||||
virtual void removeChild(Node *child, bool cleanup) override;
|
||||
virtual void removeChild(Node *child, bool cleanup) override;
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
virtual void removeAllChildrenWithCleanup(bool cleanup) override;
|
||||
virtual void sortAllChildren() override;
|
||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
||||
virtual void sortAllChildren() override;
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
virtual std::string getDescription() const override;
|
||||
|
||||
/** Inserts a quad at a certain index into the texture atlas. The Sprite won't be added into the children array.
|
||||
|
|
|
@ -126,7 +126,7 @@ public:
|
|||
inline const Rect& getRect() const { return _rect; }
|
||||
/** Set rect of the frame.
|
||||
*
|
||||
* @param The rect of the sprite.
|
||||
* @param rect The rect of the sprite.
|
||||
*/
|
||||
void setRect(const Rect& rect);
|
||||
|
||||
|
|
|
@ -621,7 +621,7 @@ Vec2 TMXLayer::calculateLayerOffset(const Vec2& pos)
|
|||
case TMXOrientationStaggered:
|
||||
{
|
||||
float diffX = 0;
|
||||
if ((int)abs(pos.y) % 2 == 1)
|
||||
if ((int)std::abs(pos.y) % 2 == 1)
|
||||
{
|
||||
diffX = _mapTileSize.width/2;
|
||||
}
|
||||
|
|
|
@ -109,6 +109,9 @@ public:
|
|||
* @return Returns the tile (Sprite) at a given a tile coordinate.
|
||||
*/
|
||||
Sprite* getTileAt(const Vec2& tileCoordinate);
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE Sprite* tileAt(const Vec2& tileCoordinate) { return getTileAt(tileCoordinate); };
|
||||
|
||||
/** Returns the tile gid at a given tile coordinate. It also returns the tile flags.
|
||||
|
@ -118,7 +121,10 @@ public:
|
|||
* @param flags Tile flags.
|
||||
* @return Returns the tile gid at a given tile coordinate. It also returns the tile flags.
|
||||
*/
|
||||
uint32_t getTileGIDAt(const Vec2& tileCoordinate, TMXTileFlags* flags = nullptr);
|
||||
uint32_t getTileGIDAt(const Vec2& tileCoordinate, TMXTileFlags* flags = nullptr);
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE uint32_t tileGIDAt(const Vec2& tileCoordinate, TMXTileFlags* flags = nullptr){
|
||||
return getTileGIDAt(tileCoordinate, flags);
|
||||
};
|
||||
|
@ -155,7 +161,10 @@ public:
|
|||
* @param tileCoordinate The tile coordinate.
|
||||
* @return The position in points of a given tile coordinate.
|
||||
*/
|
||||
Vec2 getPositionAt(const Vec2& tileCoordinate);
|
||||
Vec2 getPositionAt(const Vec2& tileCoordinate);
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE Vec2 positionAt(const Vec2& tileCoordinate) { return getPositionAt(tileCoordinate); };
|
||||
|
||||
/** Return the value for the specific property name.
|
||||
|
@ -163,7 +172,10 @@ public:
|
|||
* @param propertyName The specific property name.
|
||||
* @return Return the value for the specific property name.
|
||||
*/
|
||||
Value getProperty(const std::string& propertyName) const;
|
||||
Value getProperty(const std::string& propertyName) const;
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE Value propertyNamed(const std::string& propertyName) const { return getProperty(propertyName); };
|
||||
|
||||
/** Creates the tiles. */
|
||||
|
@ -226,7 +238,8 @@ public:
|
|||
|
||||
/** Set tileset information for the layer.
|
||||
*
|
||||
* @param The tileset information for the layer.
|
||||
* @param info The tileset information for the layer.
|
||||
* @js NA
|
||||
*/
|
||||
inline void setTileSet(TMXTilesetInfo* info) {
|
||||
CC_SAFE_RETAIN(info);
|
||||
|
@ -275,6 +288,9 @@ public:
|
|||
virtual void addChild(Node * child, int zOrder, int tag) override;
|
||||
// super method
|
||||
void removeChild(Node* child, bool cleanup) override;
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
virtual std::string getDescription() const override;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
|
||||
/** Set the group name.
|
||||
*
|
||||
* @param groupname A string,it is used to set the group name.
|
||||
* @param groupName A string,it is used to set the group name.
|
||||
*/
|
||||
inline void setGroupName(const std::string& groupName){ _groupName = groupName; }
|
||||
|
||||
|
@ -71,6 +71,7 @@ public:
|
|||
*
|
||||
* @param propertyName The specific property name.
|
||||
* @return Return the value for the specific property name.
|
||||
* @js NA
|
||||
*/
|
||||
Value getProperty(const std::string& propertyName) const;
|
||||
|
||||
|
|
|
@ -125,6 +125,7 @@ public:
|
|||
* @param tmxString A TMX formatted XML string.
|
||||
* @param resourcePath The path to TMX resources.
|
||||
* @return An autorelease object.
|
||||
* @js NA
|
||||
*/
|
||||
static TMXTiledMap* createWithXML(const std::string& tmxString, const std::string& resourcePath);
|
||||
|
||||
|
@ -201,7 +202,7 @@ public:
|
|||
|
||||
/** Set the tiles's size property measured in pixels.
|
||||
*
|
||||
* @param The tiles's size property measured in pixels.
|
||||
* @param tileSize The tiles's size property measured in pixels.
|
||||
*/
|
||||
inline void setTileSize(const Size& tileSize) { _tileSize = tileSize; };
|
||||
|
||||
|
@ -246,7 +247,9 @@ public:
|
|||
_properties = properties;
|
||||
};
|
||||
|
||||
/** Get the description. */
|
||||
/** Get the description.
|
||||
* @js NA
|
||||
*/
|
||||
virtual std::string getDescription() const override;
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
|
|
|
@ -51,7 +51,7 @@ TMXLayerInfo::TMXLayerInfo()
|
|||
TMXLayerInfo::~TMXLayerInfo()
|
||||
{
|
||||
CCLOGINFO("deallocing TMXLayerInfo: %p", this);
|
||||
if( _ownTiles && _tiles )
|
||||
if (_ownTiles && _tiles)
|
||||
{
|
||||
free(_tiles);
|
||||
_tiles = nullptr;
|
||||
|
@ -62,6 +62,7 @@ ValueMap& TMXLayerInfo::getProperties()
|
|||
{
|
||||
return _properties;
|
||||
}
|
||||
|
||||
void TMXLayerInfo::setProperties(ValueMap var)
|
||||
{
|
||||
_properties = var;
|
||||
|
@ -100,7 +101,7 @@ Rect TMXTilesetInfo::getRectForGID(uint32_t gid)
|
|||
TMXMapInfo * TMXMapInfo::create(const std::string& tmxFile)
|
||||
{
|
||||
TMXMapInfo *ret = new (std::nothrow) TMXMapInfo();
|
||||
if(ret->initWithTMXFile(tmxFile))
|
||||
if (ret->initWithTMXFile(tmxFile))
|
||||
{
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
|
@ -112,7 +113,7 @@ TMXMapInfo * TMXMapInfo::create(const std::string& tmxFile)
|
|||
TMXMapInfo * TMXMapInfo::createWithXML(const std::string& tmxString, const std::string& resourcePath)
|
||||
{
|
||||
TMXMapInfo *ret = new (std::nothrow) TMXMapInfo();
|
||||
if(ret->initWithXML(tmxString, resourcePath))
|
||||
if (ret->initWithXML(tmxString, resourcePath))
|
||||
{
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
|
@ -123,12 +124,12 @@ TMXMapInfo * TMXMapInfo::createWithXML(const std::string& tmxString, const std::
|
|||
|
||||
void TMXMapInfo::internalInit(const std::string& tmxFileName, const std::string& resourcePath)
|
||||
{
|
||||
if (tmxFileName.size() > 0)
|
||||
if (!tmxFileName.empty())
|
||||
{
|
||||
_TMXFileName = FileUtils::getInstance()->fullPathForFilename(tmxFileName);
|
||||
}
|
||||
|
||||
if (resourcePath.size() > 0)
|
||||
if (!resourcePath.empty())
|
||||
{
|
||||
_resources = resourcePath;
|
||||
}
|
||||
|
@ -142,6 +143,7 @@ void TMXMapInfo::internalInit(const std::string& tmxFileName, const std::string&
|
|||
_parentElement = TMXPropertyNone;
|
||||
_currentFirstGID = -1;
|
||||
}
|
||||
|
||||
bool TMXMapInfo::initWithXML(const std::string& tmxString, const std::string& resourcePath)
|
||||
{
|
||||
internalInit("", resourcePath);
|
||||
|
@ -202,20 +204,19 @@ bool TMXMapInfo::parseXMLFile(const std::string& xmlFilename)
|
|||
return parser.parse(FileUtils::getInstance()->fullPathForFilename(xmlFilename).c_str());
|
||||
}
|
||||
|
||||
|
||||
// the XML parser calls here with all the elements
|
||||
void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
|
||||
{
|
||||
CC_UNUSED_PARAM(ctx);
|
||||
TMXMapInfo *tmxMapInfo = this;
|
||||
std::string elementName = (char*)name;
|
||||
std::string elementName = name;
|
||||
ValueMap attributeDict;
|
||||
if (atts && atts[0])
|
||||
{
|
||||
for(int i = 0; atts[i]; i += 2)
|
||||
for (int i = 0; atts[i]; i += 2)
|
||||
{
|
||||
std::string key = (char*)atts[i];
|
||||
std::string value = (char*)atts[i+1];
|
||||
std::string key = atts[i];
|
||||
std::string value = atts[i+1];
|
||||
attributeDict.insert(std::make_pair(key, Value(value)));
|
||||
}
|
||||
}
|
||||
|
@ -227,16 +228,21 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
|
|||
CCLOG("cocos2d: TMXFormat: Unsupported TMX version: %s", version.c_str());
|
||||
}
|
||||
std::string orientationStr = attributeDict["orientation"].asString();
|
||||
if (orientationStr == "orthogonal")
|
||||
if (orientationStr == "orthogonal") {
|
||||
tmxMapInfo->setOrientation(TMXOrientationOrtho);
|
||||
else if (orientationStr == "isometric")
|
||||
}
|
||||
else if (orientationStr == "isometric") {
|
||||
tmxMapInfo->setOrientation(TMXOrientationIso);
|
||||
else if(orientationStr == "hexagonal")
|
||||
}
|
||||
else if (orientationStr == "hexagonal") {
|
||||
tmxMapInfo->setOrientation(TMXOrientationHex);
|
||||
else if(orientationStr == "staggered")
|
||||
}
|
||||
else if (orientationStr == "staggered") {
|
||||
tmxMapInfo->setOrientation(TMXOrientationStaggered);
|
||||
else
|
||||
}
|
||||
else {
|
||||
CCLOG("cocos2d: TMXFomat: Unsupported orientation: %d", tmxMapInfo->getOrientation());
|
||||
}
|
||||
|
||||
Size s;
|
||||
s.width = attributeDict["width"].asFloat();
|
||||
|
@ -356,7 +362,6 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
|
|||
|
||||
// The parent element is now "layer"
|
||||
tmxMapInfo->setParentElement(TMXPropertyLayer);
|
||||
|
||||
}
|
||||
else if (elementName == "objectgroup")
|
||||
{
|
||||
|
@ -372,7 +377,6 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
|
|||
|
||||
// The parent element is now "objectgroup"
|
||||
tmxMapInfo->setParentElement(TMXPropertyObjectGroup);
|
||||
|
||||
}
|
||||
else if (elementName == "image")
|
||||
{
|
||||
|
@ -416,7 +420,7 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
|
|||
tmxMapInfo->setLayerAttribs(layerAttribs | TMXLayerAttribBase64);
|
||||
tmxMapInfo->setStoringCharacters(true);
|
||||
|
||||
if( compression == "gzip" )
|
||||
if (compression == "gzip")
|
||||
{
|
||||
layerAttribs = tmxMapInfo->getLayerAttribs();
|
||||
tmxMapInfo->setLayerAttribs(layerAttribs | TMXLayerAttribGzip);
|
||||
|
@ -428,7 +432,6 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
|
|||
}
|
||||
CCASSERT( compression == "" || compression == "gzip" || compression == "zlib", "TMX: unsupported compression method" );
|
||||
}
|
||||
|
||||
}
|
||||
else if (elementName == "object")
|
||||
{
|
||||
|
@ -438,11 +441,10 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
|
|||
// Create an instance of TMXObjectInfo to store the object and its properties
|
||||
ValueMap dict;
|
||||
// Parse everything automatically
|
||||
const char* array[] = {"name", "type", "width", "height", "gid"};
|
||||
const char* keys[] = {"name", "type", "width", "height", "gid"};
|
||||
|
||||
for(size_t i = 0; i < sizeof(array)/sizeof(array[0]); ++i )
|
||||
for (const auto& key : keys)
|
||||
{
|
||||
const char* key = array[i];
|
||||
Value value = attributeDict[key];
|
||||
dict[key] = value;
|
||||
}
|
||||
|
@ -468,9 +470,8 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
|
|||
// Add the object to the objectGroup
|
||||
objectGroup->getObjects().push_back(Value(dict));
|
||||
|
||||
// The parent element is now "object"
|
||||
tmxMapInfo->setParentElement(TMXPropertyObject);
|
||||
|
||||
// The parent element is now "object"
|
||||
tmxMapInfo->setParentElement(TMXPropertyObject);
|
||||
}
|
||||
else if (elementName == "property")
|
||||
{
|
||||
|
@ -536,23 +537,23 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
|
|||
// parse points string into a space-separated set of points
|
||||
stringstream pointsStream(value);
|
||||
string pointPair;
|
||||
while(std::getline(pointsStream, pointPair, ' '))
|
||||
while (std::getline(pointsStream, pointPair, ' '))
|
||||
{
|
||||
// parse each point combo into a comma-separated x,y point
|
||||
stringstream pointStream(pointPair);
|
||||
string xStr,yStr;
|
||||
string xStr, yStr;
|
||||
|
||||
ValueMap pointDict;
|
||||
|
||||
// set x
|
||||
if(std::getline(pointStream, xStr, ','))
|
||||
if (std::getline(pointStream, xStr, ','))
|
||||
{
|
||||
int x = atoi(xStr.c_str()) + (int)objectGroup->getPositionOffset().x;
|
||||
pointDict["x"] = Value(x);
|
||||
}
|
||||
|
||||
// set y
|
||||
if(std::getline(pointStream, yStr, ','))
|
||||
if (std::getline(pointStream, yStr, ','))
|
||||
{
|
||||
int y = atoi(yStr.c_str()) + (int)objectGroup->getPositionOffset().y;
|
||||
pointDict["y"] = Value(y);
|
||||
|
@ -581,23 +582,23 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
|
|||
// parse points string into a space-separated set of points
|
||||
stringstream pointsStream(value);
|
||||
string pointPair;
|
||||
while(std::getline(pointsStream, pointPair, ' '))
|
||||
while (std::getline(pointsStream, pointPair, ' '))
|
||||
{
|
||||
// parse each point combo into a comma-separated x,y point
|
||||
stringstream pointStream(pointPair);
|
||||
string xStr,yStr;
|
||||
string xStr, yStr;
|
||||
|
||||
ValueMap pointDict;
|
||||
|
||||
// set x
|
||||
if(std::getline(pointStream, xStr, ','))
|
||||
if (std::getline(pointStream, xStr, ','))
|
||||
{
|
||||
int x = atoi(xStr.c_str()) + (int)objectGroup->getPositionOffset().x;
|
||||
pointDict["x"] = Value(x);
|
||||
}
|
||||
|
||||
// set y
|
||||
if(std::getline(pointStream, yStr, ','))
|
||||
if (std::getline(pointStream, yStr, ','))
|
||||
{
|
||||
int y = atoi(yStr.c_str()) + (int)objectGroup->getPositionOffset().y;
|
||||
pointDict["y"] = Value(y);
|
||||
|
@ -616,11 +617,9 @@ void TMXMapInfo::endElement(void *ctx, const char *name)
|
|||
{
|
||||
CC_UNUSED_PARAM(ctx);
|
||||
TMXMapInfo *tmxMapInfo = this;
|
||||
std::string elementName = (char*)name;
|
||||
std::string elementName = name;
|
||||
|
||||
int len = 0;
|
||||
|
||||
if(elementName == "data")
|
||||
if (elementName == "data")
|
||||
{
|
||||
if (tmxMapInfo->getLayerAttribs() & TMXLayerAttribBase64)
|
||||
{
|
||||
|
@ -630,14 +629,14 @@ void TMXMapInfo::endElement(void *ctx, const char *name)
|
|||
|
||||
std::string currentString = tmxMapInfo->getCurrentString();
|
||||
unsigned char *buffer;
|
||||
len = base64Decode((unsigned char*)currentString.c_str(), (unsigned int)currentString.length(), &buffer);
|
||||
if( ! buffer )
|
||||
auto len = base64Decode((unsigned char*)currentString.c_str(), (unsigned int)currentString.length(), &buffer);
|
||||
if (!buffer)
|
||||
{
|
||||
CCLOG("cocos2d: TiledMap: decode data error");
|
||||
return;
|
||||
}
|
||||
|
||||
if( tmxMapInfo->getLayerAttribs() & (TMXLayerAttribGzip | TMXLayerAttribZlib) )
|
||||
if (tmxMapInfo->getLayerAttribs() & (TMXLayerAttribGzip | TMXLayerAttribZlib))
|
||||
{
|
||||
unsigned char *deflated = nullptr;
|
||||
Size s = layer->_layerSize;
|
||||
|
@ -650,7 +649,7 @@ void TMXMapInfo::endElement(void *ctx, const char *name)
|
|||
free(buffer);
|
||||
buffer = nullptr;
|
||||
|
||||
if( ! deflated )
|
||||
if (!deflated)
|
||||
{
|
||||
CCLOG("cocos2d: TiledMap: inflate data error");
|
||||
return;
|
||||
|
@ -669,7 +668,6 @@ void TMXMapInfo::endElement(void *ctx, const char *name)
|
|||
{
|
||||
_xmlTileIndex = 0;
|
||||
}
|
||||
|
||||
}
|
||||
else if (elementName == "map")
|
||||
{
|
||||
|
@ -701,7 +699,7 @@ void TMXMapInfo::textHandler(void *ctx, const char *ch, int len)
|
|||
{
|
||||
CC_UNUSED_PARAM(ctx);
|
||||
TMXMapInfo *tmxMapInfo = this;
|
||||
std::string text((char*)ch,0,len);
|
||||
std::string text(ch, 0, len);
|
||||
|
||||
if (tmxMapInfo->isStoringCharacters())
|
||||
{
|
||||
|
|
|
@ -29,14 +29,14 @@ THE SOFTWARE.
|
|||
#include "2d/CCLabel.h"
|
||||
#include "base/CCIMEDelegate.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class TextFieldTTF;
|
||||
|
||||
/**
|
||||
* @addtogroup ui
|
||||
* @{
|
||||
*/
|
||||
NS_CC_BEGIN
|
||||
|
||||
class TextFieldTTF;
|
||||
|
||||
|
||||
/**
|
||||
* A input protocol for TextField.
|
||||
|
@ -46,6 +46,7 @@ class CC_DLL TextFieldDelegate
|
|||
public:
|
||||
/**
|
||||
* Desctructor for TextFieldDelegate.
|
||||
* @js NA
|
||||
*/
|
||||
virtual ~TextFieldDelegate() {}
|
||||
|
||||
|
@ -91,6 +92,7 @@ public:
|
|||
|
||||
/**
|
||||
*@brief If the sender doesn't want to draw, return true.
|
||||
* @js NA
|
||||
*/
|
||||
virtual bool onVisit(TextFieldTTF * sender,Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||
{
|
||||
|
@ -106,19 +108,26 @@ class CC_DLL TextFieldTTF : public Label, public IMEDelegate
|
|||
{
|
||||
public:
|
||||
/**
|
||||
* Default constructor.
|
||||
* @js ctor
|
||||
*/
|
||||
TextFieldTTF();
|
||||
|
||||
/**
|
||||
* Default destructor.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TextFieldTTF();
|
||||
|
||||
/** Creates a TextFieldTTF from a fontname, alignment, dimension and font size. */
|
||||
/** Creates a TextFieldTTF from a fontname, alignment, dimension and font size.
|
||||
* @js NA
|
||||
*/
|
||||
static TextFieldTTF * textFieldWithPlaceHolder(const std::string& placeholder, const Size& dimensions, TextHAlignment alignment, const std::string& fontName, float fontSize);
|
||||
|
||||
/** Creates a TextFieldTTF from a fontname and font size. */
|
||||
/** Creates a TextFieldTTF from a fontname and font size.
|
||||
* @js NA
|
||||
*/
|
||||
static TextFieldTTF * textFieldWithPlaceHolder(const std::string& placeholder, const std::string& fontName, float fontSize);
|
||||
|
||||
/** Initializes the TextFieldTTF with a font name, alignment, dimension and font size. */
|
||||
|
@ -141,12 +150,10 @@ public:
|
|||
// properties
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
inline TextFieldDelegate* getDelegate() const { return _delegate; };
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
inline void setDelegate(TextFieldDelegate* delegate) { _delegate = delegate; };
|
||||
|
@ -165,7 +172,7 @@ public:
|
|||
|
||||
/**
|
||||
*@brief Change input placeholder color.
|
||||
*@param color A color value in @see `Color3B`.
|
||||
*@param color A color value in `Color3B`.
|
||||
*/
|
||||
virtual void setColorSpaceHolder(const Color3B& color);
|
||||
|
||||
|
@ -210,12 +217,14 @@ public:
|
|||
* Set enable secure text entry represention.
|
||||
* If you want to display password in TextField, this option is very helpful.
|
||||
*@param value Whether or not to display text with secure text entry.
|
||||
* @js NA
|
||||
*/
|
||||
virtual void setSecureTextEntry(bool value);
|
||||
|
||||
/**
|
||||
* Query whether the currently display mode is secure text entry or not.
|
||||
*@return Whether current text is displayed as secure text entry.
|
||||
* @js NA
|
||||
*/
|
||||
virtual bool isSecureTextEntry();
|
||||
|
||||
|
@ -248,9 +257,8 @@ private:
|
|||
LengthStack * _lens;
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
// end of ui group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __CC_TEXT_FIELD_H__
|
||||
|
|
|
@ -50,6 +50,7 @@ IMPORTANT:
|
|||
This class is deprecated. It is maintained for compatibility reasons only.
|
||||
You SHOULD not use this class.
|
||||
Instead, use the newer TMX file format: TMXTiledMap
|
||||
@js NA
|
||||
*/
|
||||
class CC_DLL TileMapAtlas : public AtlasNode
|
||||
{
|
||||
|
|
|
@ -102,6 +102,8 @@ public:
|
|||
*/
|
||||
void hideOutShowIn(void);
|
||||
|
||||
Scene* getInScene() const{ return _inScene; }
|
||||
float getDuration() const { return _duration; }
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
|
||||
/** Returns the action that will be performed with size.
|
||||
*
|
||||
* @param size A given size.
|
||||
* @param vector A given size.
|
||||
* @return The action that will be performed.
|
||||
*/
|
||||
ActionInterval* actionWithSize(const Size& vector);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<PropertyGroup />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos;$(EngineRoot)cocos\platform;$(EngineRoot)cocos\platform\desktop;$(EngineRoot)external\glfw3\include\win32;$(EngineRoot)external\win32-specific\gles\include\OGLES</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos;$(EngineRoot)cocos\platform;$(EngineRoot)cocos\platform\desktop;$(EngineRoot)external\glfw3\include\win32;$(EngineRoot)external\win32-specific\gles\include\OGLES;$(EngineRoot)external\freetype2\include\win32\freetype2;$(EngineRoot)external\freetype2\include\win32\</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_VARIADIC_MAX=10;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ProjectReference>
|
||||
|
|
|
@ -391,6 +391,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClCompile Include="..\3d\CCSkybox.cpp" />
|
||||
<ClCompile Include="..\3d\CCSprite3D.cpp" />
|
||||
<ClCompile Include="..\3d\CCSprite3DMaterial.cpp" />
|
||||
<ClCompile Include="..\3d\CCTerrain.cpp" />
|
||||
<ClCompile Include="..\3d\CCTextureCube.cpp" />
|
||||
<ClCompile Include="..\audio\AudioEngine.cpp" />
|
||||
<ClCompile Include="..\audio\win32\AudioCache.cpp" />
|
||||
|
@ -479,7 +480,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineCache.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCFrame.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCNodeReader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCTimeLine.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CSLoader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\CCActionFrame.cpp" />
|
||||
|
@ -514,6 +514,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClCompile Include="..\editor-support\cocostudio\CCTween.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\CCUtilMath.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\CocoLoader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\CocoStudio.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\DictionaryHelper.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\FlatBuffersSerialize.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\TriggerBase.cpp" />
|
||||
|
@ -917,6 +918,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClInclude Include="..\3d\CCSkybox.h" />
|
||||
<ClInclude Include="..\3d\CCSprite3D.h" />
|
||||
<ClInclude Include="..\3d\CCSprite3DMaterial.h" />
|
||||
<ClInclude Include="..\3d\CCTerrain.h" />
|
||||
<ClInclude Include="..\3d\CCTextureCube.h" />
|
||||
<ClInclude Include="..\3d\cocos3d.h" />
|
||||
<ClInclude Include="..\audio\include\AudioEngine.h" />
|
||||
|
@ -1033,7 +1035,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineCache.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCFrame.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCNodeReader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCTimeLine.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCTimelineMacro.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CSLoader.h" />
|
||||
|
|
|
@ -1240,7 +1240,6 @@
|
|||
<ClCompile Include="..\audio\win32\AudioPlayer.cpp">
|
||||
<Filter>audioengine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCNodeReader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CSLoader.cpp">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClCompile>
|
||||
|
@ -1333,6 +1332,9 @@
|
|||
<ClCompile Include="..\3d\CCAABB.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCTerrain.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCSkybox.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
|
@ -1795,6 +1797,9 @@
|
|||
<ClCompile Include="..\editor-support\cocostudio\CCObjectExtensionData.cpp">
|
||||
<Filter>cocostudio\json</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\editor-support\cocostudio\CocoStudio.cpp">
|
||||
<Filter>cocostudio\json</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
||||
|
@ -2938,7 +2943,6 @@
|
|||
<ClInclude Include="..\audio\win32\AudioPlayer.h">
|
||||
<Filter>audioengine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCNodeReader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CSLoader.h">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClInclude>
|
||||
|
@ -3046,6 +3050,9 @@
|
|||
<ClInclude Include="..\physics\CCPhysicsHelper.h">
|
||||
<Filter>physics</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\CCTerrain.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\CCSkybox.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -222,6 +222,7 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCSkybox.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCSprite3D.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCSprite3DMaterial.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCTerrain.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCTextureCube.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\cocos3d.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\audio\include\AudioEngine.h" />
|
||||
|
@ -340,7 +341,6 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimelineCache.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCFrame.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCNodeReader.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCTimeLine.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCTimelineMacro.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CSLoader.h" />
|
||||
|
@ -807,6 +807,7 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCSkybox.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCSprite3D.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCSprite3DMaterial.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCTerrain.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCTextureCube.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\audio\winrt\Audio.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
|
@ -912,7 +913,6 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimelineCache.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCFrame.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCNodeReader.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCTimeLine.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CSLoader.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CCActionFrame.cpp" />
|
||||
|
@ -947,6 +947,7 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CCTween.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CCUtilMath.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CocoLoader.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CocoStudio.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\DictionaryHelper.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\FlatBuffersSerialize.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\TriggerBase.cpp" />
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)targetver.h" />
|
||||
|
@ -703,9 +703,6 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCFrame.h">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCNodeReader.h">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCTimeLine.h">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClInclude>
|
||||
|
@ -1743,6 +1740,9 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCTextureCube.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCTerrain.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\cocos2d.cpp" />
|
||||
|
@ -2341,9 +2341,6 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCFrame.cpp">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCNodeReader.cpp">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCTimeLine.cpp">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClCompile>
|
||||
|
@ -3312,6 +3309,12 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCTextureCube.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCTerrain.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CocoStudio.cpp">
|
||||
<Filter>cocostudio\json</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="2d">
|
||||
|
|
|
@ -113,32 +113,32 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IgnoreImportLibrary>false</IgnoreImportLibrary>
|
||||
<TargetName>libcocos2d_v3.5_Windows_8.1</TargetName>
|
||||
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IgnoreImportLibrary>false</IgnoreImportLibrary>
|
||||
<TargetName>libcocos2d_v3.5_Windows_8.1</TargetName>
|
||||
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IgnoreImportLibrary>false</IgnoreImportLibrary>
|
||||
<TargetName>libcocos2d_v3.5_Windows_8.1</TargetName>
|
||||
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IgnoreImportLibrary>false</IgnoreImportLibrary>
|
||||
<TargetName>libcocos2d_v3.5_Windows_8.1</TargetName>
|
||||
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IgnoreImportLibrary>false</IgnoreImportLibrary>
|
||||
<TargetName>libcocos2d_v3.5_Windows_8.1</TargetName>
|
||||
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IgnoreImportLibrary>false</IgnoreImportLibrary>
|
||||
<TargetName>libcocos2d_v3.5_Windows_8.1</TargetName>
|
||||
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
|
|
|
@ -85,22 +85,22 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IgnoreImportLibrary>false</IgnoreImportLibrary>
|
||||
<TargetName>libcocos2d_v3.5_WindowsPhone_8.1</TargetName>
|
||||
<TargetName>libcocos2d_v3.6_WindowsPhone_8.1</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IgnoreImportLibrary>false</IgnoreImportLibrary>
|
||||
<TargetName>libcocos2d_v3.5_WindowsPhone_8.1</TargetName>
|
||||
<TargetName>libcocos2d_v3.6_WindowsPhone_8.1</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IgnoreImportLibrary>false</IgnoreImportLibrary>
|
||||
<TargetName>libcocos2d_v3.5_WindowsPhone_8.1</TargetName>
|
||||
<TargetName>libcocos2d_v3.6_WindowsPhone_8.1</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<IgnoreImportLibrary>false</IgnoreImportLibrary>
|
||||
<TargetName>libcocos2d_v3.5_WindowsPhone_8.1</TargetName>
|
||||
<TargetName>libcocos2d_v3.6_WindowsPhone_8.1</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
|
|
|
@ -72,18 +72,18 @@
|
|||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<TargetName>libcocos2d_v3.5_WindowsPhone_8.0</TargetName>
|
||||
<TargetName>libcocos2d_v3.6_WindowsPhone_8.0</TargetName>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<TargetName>libcocos2d_v3.5_WindowsPhone_8.0</TargetName>
|
||||
<TargetName>libcocos2d_v3.6_WindowsPhone_8.0</TargetName>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<TargetName>libcocos2d_v3.5_WindowsPhone_8.0</TargetName>
|
||||
<TargetName>libcocos2d_v3.6_WindowsPhone_8.0</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<TargetName>libcocos2d_v3.5_WindowsPhone_8.0</TargetName>
|
||||
<TargetName>libcocos2d_v3.6_WindowsPhone_8.0</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
|
@ -389,6 +389,7 @@
|
|||
<ClInclude Include="..\3d\CCSkybox.h" />
|
||||
<ClInclude Include="..\3d\CCSprite3D.h" />
|
||||
<ClInclude Include="..\3d\CCSprite3DMaterial.h" />
|
||||
<ClInclude Include="..\3d\CCTerrain.h" />
|
||||
<ClInclude Include="..\3d\CCTextureCube.h" />
|
||||
<ClInclude Include="..\3d\cocos3d.h" />
|
||||
<ClInclude Include="..\audio\include\Export.h" />
|
||||
|
@ -501,7 +502,6 @@
|
|||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineCache.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCFrame.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCNodeReader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCTimeLine.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCTimelineMacro.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CSLoader.h" />
|
||||
|
@ -538,6 +538,7 @@
|
|||
<ClInclude Include="..\editor-support\cocostudio\CCTween.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\CCUtilMath.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\CocoLoader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\CocoStudio.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\CSParseBinary_generated.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\CSParse3DBinary_generated.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\DictionaryHelper.h" />
|
||||
|
@ -995,6 +996,7 @@
|
|||
<ClCompile Include="..\3d\CCSkybox.cpp" />
|
||||
<ClCompile Include="..\3d\CCSprite3D.cpp" />
|
||||
<ClCompile Include="..\3d\CCSprite3DMaterial.cpp" />
|
||||
<ClCompile Include="..\3d\CCTerrain.cpp" />
|
||||
<ClCompile Include="..\3d\CCTextureCube.cpp" />
|
||||
<ClCompile Include="..\audio\wp8\Audio.cpp">
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
|
@ -1144,7 +1146,6 @@
|
|||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineCache.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCFrame.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCNodeReader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCTimeLine.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CSLoader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\CCActionFrame.cpp" />
|
||||
|
@ -1179,6 +1180,7 @@
|
|||
<ClCompile Include="..\editor-support\cocostudio\CCTween.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\CCUtilMath.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\CocoLoader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\CocoStudio.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\DictionaryHelper.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\FlatBuffersSerialize.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\TriggerBase.cpp" />
|
||||
|
|
|
@ -962,9 +962,6 @@
|
|||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCFrame.cpp">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCNodeReader.cpp">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCTimeLine.cpp">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClCompile>
|
||||
|
@ -1815,6 +1812,12 @@
|
|||
<ClCompile Include="..\3d\CCTextureCube.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\editor-support\cocostudio\CocoStudio.cpp">
|
||||
<Filter>cocostudio\json</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCTerrain.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="CCAction.h">
|
||||
|
@ -2627,9 +2630,6 @@
|
|||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCFrame.h">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCNodeReader.h">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCTimeLine.h">
|
||||
<Filter>cocostudio\TimelineAction</Filter>
|
||||
</ClInclude>
|
||||
|
@ -3528,6 +3528,12 @@
|
|||
<ClInclude Include="..\3d\CCTextureCube.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\editor-support\cocostudio\CocoStudio.h">
|
||||
<Filter>cocostudio\json</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\CCTerrain.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\math\Mat4.inl">
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<PropertyGroup />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\angle\include;$(EngineRoot)external\freetype2\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\curl\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\websockets\include\$(COCOS2D_PLATFORM);$(EngineRoot)cocos\platform\winrt;$(EngineRoot)cocos\platform;$(EngineRoot)cocos\editor-support;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\sqlite3\include;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos;$(EngineRoot)extensions;$(EngineRoot)external;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\unzip;$(EngineRoot)external\tinyxml2;$(EngineRoot);$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\xxhash;%(AdditionalIncludeDirectories);</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\angle\include;$(EngineRoot)external\freetype2\include\$(COCOS2D_PLATFORM)\freetype;$(EngineRoot)external\curl\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\websockets\include\$(COCOS2D_PLATFORM);$(EngineRoot)cocos\platform\winrt;$(EngineRoot)cocos\platform;$(EngineRoot)cocos\editor-support;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\sqlite3\include;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos;$(EngineRoot)extensions;$(EngineRoot)external;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\unzip;$(EngineRoot)external\tinyxml2;$(EngineRoot);$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\xxhash;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WINRT;_VARIADIC_MAX=10;NOMINMAX;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<PropertyGroup />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\angle\include;$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\zlib\include;$(EngineRoot)external\freetype2\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\curl\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\websockets\include\$(COCOS2D_PLATFORM);$(EngineRoot)cocos\platform\wp8;$(EngineRoot)cocos\platform\winrt;$(EngineRoot)cocos\platform;$(EngineRoot)cocos\editor-support;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\sqlite3\include;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos;$(EngineRoot)extensions;$(EngineRoot)external;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\unzip;$(EngineRoot)external\tinyxml2;$(EngineRoot);$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\xxhash;%(AdditionalIncludeDirectories);</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\angle\include;$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\zlib\include;$(EngineRoot)external\freetype2\include\$(COCOS2D_PLATFORM)\freetype;$(EngineRoot)external\curl\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\websockets\include\$(COCOS2D_PLATFORM);$(EngineRoot)cocos\platform\wp8;$(EngineRoot)cocos\platform\winrt;$(EngineRoot)cocos\platform;$(EngineRoot)cocos\editor-support;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\sqlite3\include;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos;$(EngineRoot)extensions;$(EngineRoot)external;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\unzip;$(EngineRoot)external\tinyxml2;$(EngineRoot);$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\xxhash;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WP8;_VARIADIC_MAX=10;NOMINMAX;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
|
|
@ -21,7 +21,8 @@ CCMeshVertexIndexData.cpp \
|
|||
CCSprite3DMaterial.cpp \
|
||||
CCObjLoader.cpp \
|
||||
CCSkeleton3D.cpp \
|
||||
CCSprite3D.cpp \
|
||||
CCSprite3D.cpp \
|
||||
CCTerrain.cpp \
|
||||
CCSkybox.cpp \
|
||||
CCTextureCube.cpp
|
||||
|
||||
|
|
|
@ -30,6 +30,11 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Axis Aligned Bounding Box (AABB), usually caculate some rough but fast collision detection.
|
||||
*/
|
||||
|
@ -39,11 +44,13 @@ class CC_DLL AABB
|
|||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
* @lua new
|
||||
*/
|
||||
AABB();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @lua new
|
||||
*/
|
||||
AABB(const Vec3& min, const Vec3& max);
|
||||
|
||||
|
@ -117,6 +124,9 @@ public:
|
|||
Vec3 _max;
|
||||
};
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,12 +26,13 @@
|
|||
#include "3d/CCSprite3D.h"
|
||||
#include "3d/CCSkeleton3D.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "base/CCConfiguration.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
std::unordered_map<Sprite3D*, Animate3D*> Animate3D::s_fadeInAnimates;
|
||||
std::unordered_map<Sprite3D*, Animate3D*> Animate3D::s_fadeOutAnimates;
|
||||
std::unordered_map<Sprite3D*, Animate3D*> Animate3D::s_runningAnimates;
|
||||
std::unordered_map<Node*, Animate3D*> Animate3D::s_fadeInAnimates;
|
||||
std::unordered_map<Node*, Animate3D*> Animate3D::s_fadeOutAnimates;
|
||||
std::unordered_map<Node*, Animate3D*> Animate3D::s_runningAnimates;
|
||||
float Animate3D::_transTime = 0.1f;
|
||||
|
||||
//create Animate3D using Animation.
|
||||
|
@ -68,6 +69,7 @@ bool Animate3D::init(Animation3D* animation)
|
|||
animation->retain();
|
||||
setDuration(animation->getDuration());
|
||||
setOriginInterval(animation->getDuration());
|
||||
setHighQuality(Configuration::getInstance()->isHighAnimate3DQuality());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -83,6 +85,7 @@ bool Animate3D::init(Animation3D* animation, float fromTime, float duration)
|
|||
setOriginInterval(duration);
|
||||
_animation = animation;
|
||||
animation->retain();
|
||||
setHighQuality(Configuration::getInstance()->isHighAnimate3DQuality());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -120,26 +123,98 @@ Animate3D* Animate3D::reverse() const
|
|||
return animate;
|
||||
}
|
||||
|
||||
Node* findChildByNameRecursively(Node* node, const std::string &childName)
|
||||
{
|
||||
const std::string& name = node->getName();
|
||||
if (name == childName)
|
||||
return node;
|
||||
|
||||
const Vector<Node*>& children = node->getChildren();
|
||||
for (const auto& child : children)
|
||||
{
|
||||
Node* findNode = findChildByNameRecursively(child, childName);
|
||||
if (findNode)
|
||||
return findNode;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//! called before the action start. It will also set the target.
|
||||
void Animate3D::startWithTarget(Node *target)
|
||||
{
|
||||
Sprite3D* sprite = dynamic_cast<Sprite3D*>(target);
|
||||
CCASSERT(sprite && sprite->getSkeleton() && _animation, "Animate3D apply to Sprite3D only");
|
||||
|
||||
ActionInterval::startWithTarget(target);
|
||||
|
||||
_boneCurves.clear();
|
||||
auto skin = sprite->getSkeleton();
|
||||
_nodeCurves.clear();
|
||||
|
||||
bool hasCurve = false;
|
||||
for (int i = 0; i < skin->getBoneCount(); i++) {
|
||||
auto bone = skin->getBoneByIndex(static_cast<unsigned int>(i));
|
||||
auto curve = _animation->getBoneCurveByName(bone->getName());
|
||||
if (curve)
|
||||
Sprite3D* sprite = dynamic_cast<Sprite3D*>(target);
|
||||
|
||||
if(sprite)
|
||||
{
|
||||
if (_animation)
|
||||
{
|
||||
_boneCurves[bone] = curve;
|
||||
hasCurve = true;
|
||||
const std::unordered_map<std::string, Animation3D::Curve*>& boneCurves = _animation->getBoneCurves();
|
||||
for (const auto& iter: boneCurves)
|
||||
{
|
||||
const std::string& boneName = iter.first;
|
||||
auto skin = sprite->getSkeleton();
|
||||
if(skin)
|
||||
{
|
||||
auto bone = skin->getBoneByName(boneName);
|
||||
if (bone)
|
||||
{
|
||||
auto curve = _animation->getBoneCurveByName(boneName);
|
||||
_boneCurves[bone] = curve;
|
||||
hasCurve = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Node* node = nullptr;
|
||||
if (target->getName() == boneName)
|
||||
node = target;
|
||||
else
|
||||
node = findChildByNameRecursively(target, boneName);
|
||||
|
||||
if (node)
|
||||
{
|
||||
auto curve = _animation->getBoneCurveByName(boneName);
|
||||
if (curve)
|
||||
{
|
||||
_nodeCurves[node] = curve;
|
||||
hasCurve = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::unordered_map<std::string, Animation3D::Curve*>& boneCurves = _animation->getBoneCurves();
|
||||
for (const auto& iter: boneCurves)
|
||||
{
|
||||
const std::string& boneName = iter.first;
|
||||
Node* node = nullptr;
|
||||
if (target->getName() == boneName)
|
||||
node = target;
|
||||
else
|
||||
node = findChildByNameRecursively(target, boneName);
|
||||
|
||||
if (node)
|
||||
{
|
||||
auto curve = _animation->getBoneCurveByName(boneName);
|
||||
if (curve)
|
||||
{
|
||||
_nodeCurves[node] = curve;
|
||||
hasCurve = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasCurve)
|
||||
{
|
||||
CCLOG("warning: no animation finde for the skeleton");
|
||||
|
@ -238,26 +313,51 @@ void Animate3D::update(float t)
|
|||
t = 1 - t;
|
||||
|
||||
t = _start + t * _last;
|
||||
|
||||
for (const auto& it : _boneCurves) {
|
||||
auto bone = it.first;
|
||||
auto curve = it.second;
|
||||
if (curve->translateCurve)
|
||||
{
|
||||
curve->translateCurve->evaluate(t, transDst, EvaluateType::INT_LINEAR);
|
||||
curve->translateCurve->evaluate(t, transDst, _translateEvaluate);
|
||||
trans = &transDst[0];
|
||||
}
|
||||
if (curve->rotCurve)
|
||||
{
|
||||
curve->rotCurve->evaluate(t, rotDst, EvaluateType::INT_QUAT_SLERP);
|
||||
curve->rotCurve->evaluate(t, rotDst, _roteEvaluate);
|
||||
rot = &rotDst[0];
|
||||
}
|
||||
if (curve->scaleCurve)
|
||||
{
|
||||
curve->scaleCurve->evaluate(t, scaleDst, EvaluateType::INT_LINEAR);
|
||||
curve->scaleCurve->evaluate(t, scaleDst, _scaleEvaluate);
|
||||
scale = &scaleDst[0];
|
||||
}
|
||||
bone->setAnimationValue(trans, rot, scale, this, _weight);
|
||||
}
|
||||
|
||||
for (const auto& it : _nodeCurves)
|
||||
{
|
||||
auto node = it.first;
|
||||
auto curve = it.second;
|
||||
Mat4 transform;
|
||||
if (curve->translateCurve)
|
||||
{
|
||||
curve->translateCurve->evaluate(t, transDst, _translateEvaluate);
|
||||
transform.translate(transDst[0], transDst[1], transDst[2]);
|
||||
}
|
||||
if (curve->rotCurve)
|
||||
{
|
||||
curve->rotCurve->evaluate(t, rotDst, _roteEvaluate);
|
||||
Quaternion qua(rotDst[0], rotDst[1], rotDst[2], rotDst[3]);
|
||||
transform.rotate(qua);
|
||||
}
|
||||
if (curve->scaleCurve)
|
||||
{
|
||||
curve->scaleCurve->evaluate(t, scaleDst, _scaleEvaluate);
|
||||
transform.scale(scaleDst[0], scaleDst[1], scaleDst[2]);
|
||||
}
|
||||
node->setAdditionalTransform(&transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -284,6 +384,28 @@ void Animate3D::setOriginInterval(float interval)
|
|||
_originInterval = interval;
|
||||
}
|
||||
|
||||
void Animate3D::setHighQuality(bool isHighQuality)
|
||||
{
|
||||
if (isHighQuality)
|
||||
{
|
||||
_translateEvaluate = EvaluateType::INT_LINEAR;
|
||||
_roteEvaluate = EvaluateType::INT_QUAT_SLERP;
|
||||
_scaleEvaluate = EvaluateType::INT_LINEAR;
|
||||
}
|
||||
else
|
||||
{
|
||||
_translateEvaluate = EvaluateType::INT_NEAR;
|
||||
_roteEvaluate = EvaluateType::INT_NEAR;
|
||||
_scaleEvaluate = EvaluateType::INT_NEAR;
|
||||
}
|
||||
_isHighQuality = isHighQuality;
|
||||
}
|
||||
|
||||
bool Animate3D::isHighQuality() const
|
||||
{
|
||||
return _isHighQuality;
|
||||
}
|
||||
|
||||
Animate3D::Animate3D()
|
||||
: _state(Animate3D::Animate3DState::Running)
|
||||
, _animation(nullptr)
|
||||
|
@ -296,7 +418,7 @@ Animate3D::Animate3D()
|
|||
, _lastTime(0.0f)
|
||||
, _originInterval(0.0f)
|
||||
{
|
||||
|
||||
setHighQuality(true);
|
||||
}
|
||||
Animate3D::~Animate3D()
|
||||
{
|
||||
|
@ -311,12 +433,9 @@ void Animate3D::removeFromMap()
|
|||
if (_target)
|
||||
{
|
||||
Sprite3D* sprite = static_cast<Sprite3D*>(_target);
|
||||
if (_state == Animate3D::Animate3DState::FadeIn)
|
||||
s_fadeInAnimates.erase(sprite);
|
||||
else if (_state == Animate3D::Animate3DState::FadeOut)
|
||||
s_fadeOutAnimates.erase(sprite);
|
||||
else
|
||||
s_runningAnimates.erase(sprite);
|
||||
s_fadeInAnimates.erase(sprite);
|
||||
s_fadeOutAnimates.erase(sprite);
|
||||
s_runningAnimates.erase(sprite);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,14 @@ NS_CC_BEGIN
|
|||
|
||||
class Bone3D;
|
||||
class Sprite3D;
|
||||
|
||||
/**
|
||||
* Animate3D, Animates a Sprite3D given with an Animation3D
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Animate3D, Animates a Sprite3D given with an Animation3D
|
||||
*/
|
||||
class CC_DLL Animate3D: public ActionInterval
|
||||
{
|
||||
|
@ -99,6 +105,17 @@ public:
|
|||
CC_DEPRECATED_ATTRIBUTE bool getPlayBack() const { return _playReverse; }
|
||||
CC_DEPRECATED_ATTRIBUTE void setPlayBack(bool reverse) { _playReverse = reverse; }
|
||||
|
||||
/**set high quality
|
||||
* The default value is based on Configuration::isHighAnimate3DQuality(). You can configure it in the config.plist. However, you can modify it using the following function
|
||||
* @param true: is high quality, false: is low quality.
|
||||
*/
|
||||
void setHighQuality(bool isHighQuality);
|
||||
|
||||
/**get high quality
|
||||
* is it high quality
|
||||
*/
|
||||
bool isHighQuality() const;
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
|
||||
Animate3D();
|
||||
|
@ -131,14 +148,25 @@ protected:
|
|||
float _accTransTime; // acculate transition time
|
||||
float _lastTime; // last t (0 - 1)
|
||||
float _originInterval;// save origin interval time
|
||||
|
||||
// animation quality
|
||||
EvaluateType _translateEvaluate;
|
||||
EvaluateType _roteEvaluate;
|
||||
EvaluateType _scaleEvaluate;
|
||||
bool _isHighQuality; // true: is high quality, false: is low quality
|
||||
|
||||
std::unordered_map<Bone3D*, Animation3D::Curve*> _boneCurves; //weak ref
|
||||
std::unordered_map<Node*, Animation3D::Curve*> _nodeCurves;
|
||||
|
||||
//sprite animates
|
||||
static std::unordered_map<Sprite3D*, Animate3D*> s_fadeInAnimates;
|
||||
static std::unordered_map<Sprite3D*, Animate3D*> s_fadeOutAnimates;
|
||||
static std::unordered_map<Sprite3D*, Animate3D*> s_runningAnimates;
|
||||
static std::unordered_map<Node*, Animate3D*> s_fadeInAnimates;
|
||||
static std::unordered_map<Node*, Animate3D*> s_fadeOutAnimates;
|
||||
static std::unordered_map<Node*, Animate3D*> s_runningAnimates;
|
||||
};
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __CCANIMATE3D_H__
|
||||
|
|
|
@ -58,6 +58,8 @@ bool Animation3D::initWithFile(const std::string& filename, const std::string& a
|
|||
Animation3DData animationdata;
|
||||
if (bundle->load(fullPath) && bundle->loadAnimationData(animationName, &animationdata) && init(animationdata))
|
||||
{
|
||||
std::string key = fullPath + "#" + animationName;
|
||||
Animation3DCache::getInstance()->addAnimation(key, this);
|
||||
Bundle3D::destroyBundle(bundle);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -34,9 +34,13 @@
|
|||
#include "3d/CCBundle3DData.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
/**
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* static animation data, shared
|
||||
* @brief static animation data, shared
|
||||
*/
|
||||
class CC_DLL Animation3D: public Ref
|
||||
{
|
||||
|
@ -50,25 +54,38 @@ public:
|
|||
public:
|
||||
typedef AnimationCurve<3> AnimationCurveVec3;
|
||||
typedef AnimationCurve<4> AnimationCurveQuat;
|
||||
AnimationCurveVec3* translateCurve; //translate curve
|
||||
AnimationCurveQuat* rotCurve;//rotation curve
|
||||
AnimationCurveVec3* scaleCurve;//scale curve
|
||||
|
||||
/**translation curve*/
|
||||
AnimationCurveVec3* translateCurve;
|
||||
/**rotation curve*/
|
||||
AnimationCurveQuat* rotCurve;
|
||||
/**scaling curve*/
|
||||
AnimationCurveVec3* scaleCurve;
|
||||
/**constructor */
|
||||
Curve();
|
||||
/**constructor */
|
||||
~Curve();
|
||||
};
|
||||
|
||||
/**read all animation or only the animation with given animationName? animationName == "" read the first.*/
|
||||
static Animation3D* create(const std::string& filename, const std::string& animationName = "");
|
||||
|
||||
/**the cache method to create or get an Animation3D object*/
|
||||
CC_DEPRECATED_ATTRIBUTE static Animation3D* getOrCreate(const std::string& filename, const std::string& animationName = ""){ return create(filename, animationName); }
|
||||
|
||||
/**get duration*/
|
||||
float getDuration() const { return _duration; }
|
||||
|
||||
/**get bone curve*/
|
||||
/**
|
||||
* get bone curve
|
||||
*
|
||||
* @lua NA
|
||||
*/
|
||||
Curve* getBoneCurveByName(const std::string& name) const;
|
||||
|
||||
|
||||
/**get the bone Curves set*/
|
||||
const std::unordered_map<std::string, Curve*>& getBoneCurves() const {return _boneCurves;}
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
Animation3D();
|
||||
virtual ~Animation3D();
|
||||
|
@ -114,6 +131,8 @@ protected:
|
|||
std::unordered_map<std::string, Animation3D*> _animations; //cached animations
|
||||
};
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
NS_CC_END
|
||||
|
||||
#endif // __CCANIMATION3D_H__
|
||||
|
|
|
@ -36,6 +36,11 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Evaluate Type
|
||||
*/
|
||||
|
@ -48,7 +53,9 @@ enum class EvaluateType
|
|||
};
|
||||
|
||||
/**
|
||||
* curve of bone's position, rotation or scale
|
||||
* @brief curve of bone's position, rotation or scale
|
||||
*
|
||||
* @lua NA
|
||||
*/
|
||||
template <int componentSize>
|
||||
class AnimationCurve: public Ref
|
||||
|
@ -95,6 +102,9 @@ protected:
|
|||
std::function<void(float time, float* dst)> _evaluateFun; //user defined function
|
||||
};
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#include "CCAnimationCurve.inl"
|
||||
|
|
|
@ -33,7 +33,7 @@ void AnimationCurve<componentSize>::evaluate(float time, float* dst, EvaluateTyp
|
|||
break;
|
||||
case EvaluateType::INT_NEAR:
|
||||
{
|
||||
float* src = t > 0.5f ? toValue : fromValue;
|
||||
float* src = fabs(t) > 0.5f ? toValue : fromValue;
|
||||
memcpy(dst, src, _componentSizeByte);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -29,11 +29,14 @@
|
|||
#include "2d/CCNode.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
class Bone3D;
|
||||
|
||||
/**
|
||||
* attach a node to a bone
|
||||
* @brief attach a node to a bone
|
||||
* usage: auto sprite = Sprite3D::create("girl.c3b");
|
||||
* auto weapon = Sprite3D::create("weapon.c3b");
|
||||
* auto attachNode = sprite->getAttachNode("left hand");
|
||||
|
@ -65,6 +68,8 @@ protected:
|
|||
mutable Mat4 _transformToParent;
|
||||
};
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
#endif // __CCATTACHNODE_H__
|
||||
|
|
|
@ -173,7 +173,7 @@ bool BillBoard::calculateBillbaordTransform()
|
|||
switch (_mode)
|
||||
{
|
||||
case Mode::VIEW_POINT_ORIENTED:
|
||||
camDir = Vec3(localToWorld.m[12] - camWorldMat.m[12], localToWorld.m[13] - camWorldMat.m[13], localToWorld.m[14] - camWorldMat.m[14]);
|
||||
camDir.set(localToWorld.m[12] - camWorldMat.m[12], localToWorld.m[13] - camWorldMat.m[13], localToWorld.m[14] - camWorldMat.m[14]);
|
||||
break;
|
||||
case Mode::VIEW_PLANE_ORIENTED:
|
||||
camWorldMat.transformVector(Vec3(0.0f, 0.0f, -1.0f), &camDir);
|
||||
|
@ -196,7 +196,7 @@ bool BillBoard::calculateBillbaordTransform()
|
|||
Mat4 rotationMatrix;
|
||||
rotationMatrix.setIdentity();
|
||||
|
||||
Vec3 upAxis = Vec3(rotationMatrix.m[4],rotationMatrix.m[5],rotationMatrix.m[6]);
|
||||
Vec3 upAxis(rotationMatrix.m[4],rotationMatrix.m[5],rotationMatrix.m[6]);
|
||||
Vec3 x, y;
|
||||
camWorldMat.transformVector(upAxis, &y);
|
||||
Vec3::cross(camDir, y, &x);
|
||||
|
|
|
@ -28,9 +28,13 @@
|
|||
#include "2d/CCSprite.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
/**
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Inherit from Sprite, achieve BillBoard.
|
||||
* @brief Inherit from Sprite, achieve BillBoard.
|
||||
*/
|
||||
class CC_DLL BillBoard : public Sprite
|
||||
{
|
||||
|
@ -41,7 +45,7 @@ public:
|
|||
VIEW_POINT_ORIENTED, // orient to the camera
|
||||
VIEW_PLANE_ORIENTED // orient to the XOY plane of camera
|
||||
};
|
||||
/// @{
|
||||
|
||||
/// @name Creators
|
||||
|
||||
/**
|
||||
|
@ -92,7 +96,11 @@ public:
|
|||
/** update billboard's transform and turn it towards camera */
|
||||
virtual void visit(Renderer *renderer, const Mat4& parentTransform, uint32_t parentFlags) override;
|
||||
|
||||
/** draw BillBoard object */
|
||||
/**
|
||||
* draw BillBoard object.
|
||||
*
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
||||
|
||||
|
||||
|
@ -118,7 +126,8 @@ private:
|
|||
|
||||
};
|
||||
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
|
|
|
@ -751,8 +751,8 @@ bool Bundle3D::loadMeshDatasJson(MeshDatas& meshdatas)
|
|||
const rapidjson::Value& mesh_part_aabb = mesh_part[AABBS];
|
||||
if (mesh_part.HasMember(AABBS) && mesh_part_aabb.Size() == 6)
|
||||
{
|
||||
Vec3 min = Vec3(mesh_part_aabb[(rapidjson::SizeType)0].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)1].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)2].GetDouble());
|
||||
Vec3 max = Vec3(mesh_part_aabb[(rapidjson::SizeType)3].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)4].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)5].GetDouble());
|
||||
Vec3 min(mesh_part_aabb[(rapidjson::SizeType)0].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)1].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)2].GetDouble());
|
||||
Vec3 max(mesh_part_aabb[(rapidjson::SizeType)3].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)4].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)5].GetDouble());
|
||||
meshData->subMeshAABB.push_back(AABB(min, max));
|
||||
}
|
||||
else
|
||||
|
@ -874,9 +874,11 @@ bool Bundle3D::loadMaterialsBinary(MaterialDatas& materialdatas)
|
|||
{
|
||||
NMaterialData materialData;
|
||||
materialData.id = _binaryReader.readString();
|
||||
|
||||
// skip: diffuse(3), ambient(3), emissive(3), opacity(1), specular(3), shininess(1)
|
||||
float data[14];
|
||||
_binaryReader.read(&data,sizeof(float), 14);
|
||||
|
||||
|
||||
unsigned int textruenum = 1;
|
||||
_binaryReader.read(&textruenum, 4, 1);
|
||||
for(unsigned int j = 0; j < textruenum ; j++ )
|
||||
|
@ -1434,7 +1436,7 @@ bool Bundle3D::loadAnimationDataJson(const std::string& id, Animation3DData* ani
|
|||
{
|
||||
const rapidjson::Value& bone_keyframe_translation = bone_keyframe[TRANSLATION];
|
||||
float keytime = bone_keyframe[KEYTIME].GetDouble();
|
||||
Vec3 val = Vec3(bone_keyframe_translation[(rapidjson::SizeType)0].GetDouble(), bone_keyframe_translation[1].GetDouble(), bone_keyframe_translation[2].GetDouble());
|
||||
Vec3 val(bone_keyframe_translation[(rapidjson::SizeType)0].GetDouble(), bone_keyframe_translation[1].GetDouble(), bone_keyframe_translation[2].GetDouble());
|
||||
animationdata->_translationKeys[bone_name].push_back(Animation3DData::Vec3Key(keytime,val));
|
||||
}
|
||||
|
||||
|
@ -1450,7 +1452,7 @@ bool Bundle3D::loadAnimationDataJson(const std::string& id, Animation3DData* ani
|
|||
{
|
||||
const rapidjson::Value& bone_keyframe_scale = bone_keyframe[SCALE];
|
||||
float keytime = bone_keyframe[KEYTIME].GetDouble();
|
||||
Vec3 val = Vec3(bone_keyframe_scale[(rapidjson::SizeType)0].GetDouble(), bone_keyframe_scale[1].GetDouble(), bone_keyframe_scale[2].GetDouble());
|
||||
Vec3 val(bone_keyframe_scale[(rapidjson::SizeType)0].GetDouble(), bone_keyframe_scale[1].GetDouble(), bone_keyframe_scale[2].GetDouble());
|
||||
animationdata->_scaleKeys[bone_name].push_back(Animation3DData::Vec3Key(keytime,val));
|
||||
}
|
||||
}
|
||||
|
@ -1616,7 +1618,7 @@ bool Bundle3D::loadNodesJson(NodeDatas& nodedatas)
|
|||
{
|
||||
const rapidjson::Value& jnode = nodes[i];
|
||||
std::string id = jnode[ID].GetString();
|
||||
NodeData* nodedata = parseNodesRecursivelyJson(jnode);
|
||||
NodeData* nodedata = parseNodesRecursivelyJson(jnode, nodes.Size() == 1);
|
||||
|
||||
bool isSkeleton = jnode[SKELETON].GetBool();
|
||||
if (isSkeleton)
|
||||
|
@ -1626,23 +1628,25 @@ bool Bundle3D::loadNodesJson(NodeDatas& nodedatas)
|
|||
}
|
||||
return true;
|
||||
}
|
||||
NodeData* Bundle3D::parseNodesRecursivelyJson(const rapidjson::Value& jvalue)
|
||||
NodeData* Bundle3D::parseNodesRecursivelyJson(const rapidjson::Value& jvalue, bool singleSprite)
|
||||
{
|
||||
NodeData* nodedata = new (std::nothrow) NodeData();;
|
||||
// id
|
||||
nodedata->id = jvalue[ID].GetString();
|
||||
|
||||
// transform
|
||||
Mat4 tranform;
|
||||
Mat4 transform;
|
||||
const rapidjson::Value& jtransform = jvalue[TRANSFORM];
|
||||
|
||||
for (rapidjson::SizeType j = 0; j < jtransform.Size(); j++)
|
||||
{
|
||||
tranform.m[j] = jtransform[j].GetDouble();
|
||||
transform.m[j] = jtransform[j].GetDouble();
|
||||
}
|
||||
|
||||
nodedata->transform = tranform;
|
||||
nodedata->transform = transform;
|
||||
|
||||
bool isSkin = false;
|
||||
|
||||
// parts
|
||||
if (jvalue.HasMember(PARTS))
|
||||
{
|
||||
|
@ -1690,11 +1694,31 @@ NodeData* Bundle3D::parseNodesRecursivelyJson(const rapidjson::Value& jvalue)
|
|||
//invbindpos.inverse();
|
||||
modelnodedata->invBindPose.push_back(invbindpos);
|
||||
}
|
||||
|
||||
if (bones.Size() > 0)
|
||||
isSkin = true;
|
||||
}
|
||||
nodedata->modelNodeDatas.push_back(modelnodedata);
|
||||
}
|
||||
}
|
||||
|
||||
// set transform
|
||||
if(_version == "0.1" || _version == "0.2" || _version == "0.3" || _version == "0.4" || _version == "0.5" || _version == "0.6")
|
||||
{
|
||||
if(isSkin || singleSprite)
|
||||
{
|
||||
nodedata->transform = Mat4::IDENTITY;
|
||||
}
|
||||
else
|
||||
{
|
||||
nodedata->transform = transform;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nodedata->transform = transform;
|
||||
}
|
||||
|
||||
if (jvalue.HasMember(CHILDREN))
|
||||
{
|
||||
const rapidjson::Value& children = jvalue[CHILDREN];
|
||||
|
@ -1702,7 +1726,7 @@ NodeData* Bundle3D::parseNodesRecursivelyJson(const rapidjson::Value& jvalue)
|
|||
{
|
||||
const rapidjson::Value& child = children[i];
|
||||
|
||||
NodeData* tempdata = parseNodesRecursivelyJson(child);
|
||||
NodeData* tempdata = parseNodesRecursivelyJson(child, singleSprite);
|
||||
nodedata->children.push_back(tempdata);
|
||||
}
|
||||
}
|
||||
|
@ -1725,7 +1749,7 @@ bool Bundle3D::loadNodesBinary(NodeDatas& nodedatas)
|
|||
for (rapidjson::SizeType i = 0; i < nodeSize; i++)
|
||||
{
|
||||
bool skeleton = false;
|
||||
NodeData* nodedata = parseNodesRecursivelyBinary(skeleton);
|
||||
NodeData* nodedata = parseNodesRecursivelyBinary(skeleton, nodeSize == 1);
|
||||
|
||||
if (skeleton)
|
||||
nodedatas.skeleton.push_back(nodedata);
|
||||
|
@ -1734,7 +1758,7 @@ bool Bundle3D::loadNodesBinary(NodeDatas& nodedatas)
|
|||
}
|
||||
return true;
|
||||
}
|
||||
NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton)
|
||||
NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton, bool singleSprite)
|
||||
{
|
||||
// id
|
||||
std::string id = _binaryReader.readString();
|
||||
|
@ -1765,7 +1789,9 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton)
|
|||
|
||||
NodeData* nodedata = new (std::nothrow) NodeData();
|
||||
nodedata->id = id;
|
||||
nodedata->transform = transform;
|
||||
|
||||
bool isSkin = false;
|
||||
|
||||
if (partsSize > 0)
|
||||
{
|
||||
for (unsigned int i = 0; i < partsSize; i++)
|
||||
|
@ -1804,6 +1830,7 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton)
|
|||
|
||||
modelnodedata->invBindPose.push_back(invbindpos);
|
||||
}
|
||||
isSkin = true;
|
||||
}
|
||||
unsigned int uvMapping = 0;
|
||||
if (_binaryReader.read(&uvMapping, 4, 1) != 1)
|
||||
|
@ -1832,6 +1859,23 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton)
|
|||
}
|
||||
}
|
||||
|
||||
// set transform
|
||||
if(_version == "0.1" || _version == "0.2" || _version == "0.3" || _version == "0.4" || _version == "0.5" || _version == "0.6")
|
||||
{
|
||||
if(isSkin || singleSprite)
|
||||
{
|
||||
nodedata->transform = Mat4::IDENTITY;
|
||||
}
|
||||
else
|
||||
{
|
||||
nodedata->transform = transform;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nodedata->transform = transform;
|
||||
}
|
||||
|
||||
unsigned int childrenSize = 0;
|
||||
if (_binaryReader.read(&childrenSize, 4, 1) != 1)
|
||||
{
|
||||
|
@ -1842,7 +1886,7 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton)
|
|||
{
|
||||
for (unsigned int i = 0; i < childrenSize; i++)
|
||||
{
|
||||
NodeData* tempdata = parseNodesRecursivelyBinary(skeleton);
|
||||
NodeData* tempdata = parseNodesRecursivelyBinary(skeleton, singleSprite);
|
||||
nodedata->children.push_back(tempdata);
|
||||
}
|
||||
}
|
||||
|
@ -2058,11 +2102,11 @@ cocos2d::AABB Bundle3D::calculateAABB( const std::vector<float>& vertex, int str
|
|||
{
|
||||
AABB aabb;
|
||||
stride /= 4;
|
||||
for(const auto& it : index)
|
||||
{
|
||||
Vec3 point = Vec3(vertex[it * stride ], vertex[ it * stride + 1], vertex[it * stride + 2 ]);
|
||||
aabb.updateMinMax(&point, 1);
|
||||
}
|
||||
for (const auto& it : index)
|
||||
{
|
||||
Vec3 point(vertex[it * stride], vertex[it * stride + 1], vertex[it * stride + 2]);
|
||||
aabb.updateMinMax(&point, 1);
|
||||
}
|
||||
return aabb;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,14 +30,22 @@
|
|||
#include "json/document.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
class Animation3D;
|
||||
class Data;
|
||||
|
||||
/**
|
||||
* Defines a bundle file that contains a collection of assets. Mesh, Material, MeshSkin, Animation
|
||||
* @brief Defines a bundle file that contains a collection of assets. Mesh, Material, MeshSkin, Animation
|
||||
* There are two types of bundle files, c3t and c3b.
|
||||
* c3t text file
|
||||
* c3b binary file
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class CC_DLL Bundle3D
|
||||
{
|
||||
|
@ -114,13 +122,13 @@ protected:
|
|||
* load nodes of json
|
||||
*/
|
||||
bool loadNodesJson(NodeDatas& nodedatas);
|
||||
NodeData* parseNodesRecursivelyJson(const rapidjson::Value& jvalue);
|
||||
NodeData* parseNodesRecursivelyJson(const rapidjson::Value& jvalue, bool singleSprite);
|
||||
|
||||
/**
|
||||
* load nodes of binary
|
||||
*/
|
||||
bool loadNodesBinary(NodeDatas& nodedatas);
|
||||
NodeData* parseNodesRecursivelyBinary(bool& skeleton);
|
||||
NodeData* parseNodesRecursivelyBinary(bool& skeleton, bool singleSprite);
|
||||
|
||||
/**
|
||||
* get define data type
|
||||
|
@ -174,6 +182,9 @@ protected:
|
|||
bool _isBinary;
|
||||
};
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __CCBUNDLE3D_H__
|
||||
|
|
|
@ -35,7 +35,10 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**mesh vertex attribute*/
|
||||
/**mesh vertex attribute
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
struct MeshVertexAttrib
|
||||
{
|
||||
//attribute size
|
||||
|
@ -49,7 +52,10 @@ struct MeshVertexAttrib
|
|||
};
|
||||
|
||||
|
||||
/** model node data, since 3.3 */
|
||||
/** model node data, since 3.3
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
struct ModelData
|
||||
{
|
||||
std::string subMeshId;
|
||||
|
@ -68,7 +74,10 @@ struct ModelData
|
|||
}
|
||||
};
|
||||
|
||||
/** Node data, since 3.3 */
|
||||
/** Node data, since 3.3
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
struct NodeData
|
||||
{
|
||||
std::string id;
|
||||
|
@ -99,7 +108,10 @@ struct NodeData
|
|||
|
||||
};
|
||||
|
||||
/** node datas, since 3.3 */
|
||||
/** node datas, since 3.3
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
struct NodeDatas
|
||||
{
|
||||
std::vector<NodeData*> skeleton; //skeleton
|
||||
|
@ -120,7 +132,10 @@ struct NodeDatas
|
|||
}
|
||||
};
|
||||
|
||||
/**mesh data*/
|
||||
/**mesh data
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
struct MeshData
|
||||
{
|
||||
typedef std::vector<unsigned short> IndexArray;
|
||||
|
@ -173,7 +188,10 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/** mesh datas */
|
||||
/** mesh datas
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
struct MeshDatas
|
||||
{
|
||||
std::vector<MeshData*> meshDatas;
|
||||
|
@ -192,7 +210,10 @@ struct MeshDatas
|
|||
}
|
||||
};
|
||||
|
||||
/**skin data*/
|
||||
/**skin data
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
struct SkinData
|
||||
{
|
||||
std::vector<std::string> skinBoneNames; //skin bones affect skin
|
||||
|
@ -261,7 +282,10 @@ struct SkinData
|
|||
|
||||
};
|
||||
|
||||
/**material data, */
|
||||
/**material data,
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
struct MaterialData
|
||||
{
|
||||
std::map<int, std::string> texturePaths; //submesh id, texture path
|
||||
|
@ -272,7 +296,10 @@ struct MaterialData
|
|||
};
|
||||
|
||||
|
||||
/**new material, since 3.3 */
|
||||
/**new material, since 3.3
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
struct NTextureData
|
||||
{
|
||||
enum class Usage {
|
||||
|
@ -308,7 +335,10 @@ struct NMaterialData
|
|||
return nullptr;
|
||||
}
|
||||
};
|
||||
/** material datas, since 3.3 */
|
||||
/** material datas, since 3.3
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
struct MaterialDatas
|
||||
{
|
||||
std::vector<NMaterialData> materials;
|
||||
|
@ -326,7 +356,10 @@ struct MaterialDatas
|
|||
return nullptr;
|
||||
}
|
||||
};
|
||||
/**animation data*/
|
||||
/**animation data
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
struct Animation3DData
|
||||
{
|
||||
public:
|
||||
|
@ -396,7 +429,10 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/**reference data*/
|
||||
/**reference data
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
struct Reference
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -35,7 +35,14 @@
|
|||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* BundleReader is an interface for reading sequence of bytes.
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief BundleReader is an interface for reading sequence of bytes.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class BundleReader: public cocos2d::Ref
|
||||
{
|
||||
|
@ -122,6 +129,8 @@ private:
|
|||
char* _buffer;
|
||||
};
|
||||
|
||||
/// @cond
|
||||
|
||||
/**
|
||||
* template read routines
|
||||
*/
|
||||
|
@ -201,6 +210,10 @@ inline bool BundleReader::readArray<std::string>(unsigned int *length, std::vect
|
|||
return true;
|
||||
}
|
||||
|
||||
/// @endcond
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ class Camera;
|
|||
/**
|
||||
* the frustum is a six-side geometry, usually use the frustum to do fast-culling:
|
||||
* check a entity whether is a potential visible entity
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class CC_DLL Frustum
|
||||
{
|
||||
|
|
|
@ -36,13 +36,18 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
class Texture2D;
|
||||
class MeshSkin;
|
||||
class MeshIndexData;
|
||||
class GLProgramState;
|
||||
class GLProgram;
|
||||
/**
|
||||
* Mesh: contains ref to index buffer, GLProgramState, texture, skin, blend function, aabb and so on
|
||||
* @brief Mesh: contains ref to index buffer, GLProgramState, texture, skin, blend function, aabb and so on
|
||||
*/
|
||||
class CC_DLL Mesh : public Ref
|
||||
{
|
||||
|
@ -54,14 +59,28 @@ public:
|
|||
/**create mesh with vertex attributes*/
|
||||
CC_DEPRECATED_ATTRIBUTE static Mesh* create(const std::vector<float>& vertices, int perVertexSizeInFloat, const IndexArray& indices, int numIndex, const std::vector<MeshVertexAttrib>& attribs, int attribCount){ return create(vertices, perVertexSizeInFloat, indices, attribs); }
|
||||
|
||||
/**
|
||||
* @lua NA
|
||||
*/
|
||||
static Mesh* create(const std::vector<float>& vertices, int perVertexSizeInFloat, const IndexArray& indices, const std::vector<MeshVertexAttrib>& attribs);
|
||||
|
||||
/** create mesh */
|
||||
/**
|
||||
* create mesh
|
||||
* @lua NA
|
||||
*/
|
||||
static Mesh* create(const std::string& name, MeshIndexData* indexData, MeshSkin* skin = nullptr);
|
||||
|
||||
/**get vertex buffer*/
|
||||
/**
|
||||
* get vertex buffer
|
||||
*
|
||||
* @lua NA
|
||||
*/
|
||||
GLuint getVertexBuffer() const;
|
||||
/**has vertex attribute?*/
|
||||
/**
|
||||
* has vertex attribute?
|
||||
*
|
||||
* @lua NA
|
||||
*/
|
||||
bool hasVertexAttrib(int attrib) const;
|
||||
/**get mesh vertex attribute count*/
|
||||
ssize_t getMeshVertexAttribCount() const;
|
||||
|
@ -79,13 +98,25 @@ public:
|
|||
void setVisible(bool visible);
|
||||
bool isVisible() const { return _visible; }
|
||||
|
||||
/**skin getter */
|
||||
/**
|
||||
* skin getter
|
||||
*
|
||||
* @lua NA
|
||||
*/
|
||||
MeshSkin* getSkin() const { return _skin; }
|
||||
|
||||
/**mesh index data getter */
|
||||
/**
|
||||
* mesh index data getter
|
||||
*
|
||||
* @lua NA
|
||||
*/
|
||||
MeshIndexData* getMeshIndexData() const { return _meshIndexData; }
|
||||
|
||||
/**get GLProgramState*/
|
||||
/**
|
||||
* get GLProgramState
|
||||
*
|
||||
* @lua NA
|
||||
*/
|
||||
GLProgramState* getGLProgramState() const { return _glProgramState; }
|
||||
|
||||
/**name getter */
|
||||
|
@ -94,13 +125,29 @@ public:
|
|||
void setBlendFunc(const BlendFunc &blendFunc);
|
||||
const BlendFunc &getBlendFunc() const;
|
||||
|
||||
/** get primitive type*/
|
||||
/**
|
||||
* get primitive type
|
||||
*
|
||||
* @lua NA
|
||||
*/
|
||||
GLenum getPrimitiveType() const;
|
||||
/**get index count*/
|
||||
/**
|
||||
* get index count
|
||||
*
|
||||
* @lua NA
|
||||
*/
|
||||
ssize_t getIndexCount() const;
|
||||
/**get index format*/
|
||||
/**
|
||||
* get index format
|
||||
*
|
||||
* @lua NA
|
||||
*/
|
||||
GLenum getIndexFormat() const;
|
||||
/**get index buffer*/
|
||||
/**
|
||||
* get index buffer
|
||||
*
|
||||
* @lua NA
|
||||
*/
|
||||
GLuint getIndexBuffer() const;
|
||||
|
||||
/**get AABB*/
|
||||
|
@ -158,6 +205,10 @@ protected:
|
|||
std::function<void()> _visibleChanged;
|
||||
};
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __CCMESH_H__
|
||||
|
|
|
@ -33,12 +33,19 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
class Bone3D;
|
||||
class Skeleton3D;
|
||||
|
||||
/**
|
||||
* MeshSkin, A class maintain a collection of bones that affect Mesh vertex.
|
||||
* @brief MeshSkin, A class maintain a collection of bones that affect Mesh vertex.
|
||||
* And it is responsible for computing matrix palletes that used by skin mesh rendering.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class CC_DLL MeshSkin: public Ref
|
||||
{
|
||||
|
@ -99,6 +106,9 @@ protected:
|
|||
Vec4* _matrixPalette;
|
||||
};
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __CCSKIN_H__
|
||||
|
|
|
@ -56,7 +56,6 @@ MeshIndexData* MeshIndexData::create(const std::string& id, MeshVertexData* vert
|
|||
meshindex->_indexBuffer = indexbuffer;
|
||||
meshindex->_vertexData = vertexData;
|
||||
indexbuffer->retain();
|
||||
vertexData->retain();
|
||||
meshindex->_aabb = aabb;
|
||||
|
||||
meshindex->autorelease();
|
||||
|
@ -78,7 +77,6 @@ MeshIndexData::MeshIndexData()
|
|||
MeshIndexData::~MeshIndexData()
|
||||
{
|
||||
CC_SAFE_RELEASE(_indexBuffer);
|
||||
CC_SAFE_RELEASE(_vertexData);
|
||||
}
|
||||
|
||||
MeshVertexData* MeshVertexData::create(const MeshData& meshdata)
|
||||
|
|
|
@ -41,11 +41,18 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
class MeshVertexData;
|
||||
|
||||
/**
|
||||
* the MeshIndexData class.
|
||||
* @brief the MeshIndexData contain all of the indices data which mesh need.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class MeshIndexData : public Ref
|
||||
{
|
||||
|
@ -79,7 +86,7 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
|
||||
protected:
|
||||
IndexBuffer* _indexBuffer; //index buffer
|
||||
MeshVertexData* _vertexData; //vertex buffer
|
||||
MeshVertexData* _vertexData; //vertex buffer, weak ref
|
||||
AABB _aabb; // original aabb of the submesh
|
||||
std::string _id; //id
|
||||
GLenum _primitiveType;
|
||||
|
@ -132,6 +139,9 @@ protected:
|
|||
int _vertexCount; //vertex count
|
||||
};
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __CCMESHVERTEXINDEXDATA_H__
|
||||
|
|
|
@ -209,9 +209,9 @@ OBB::OBB(const AABB& aabb)
|
|||
|
||||
_center = (aabb._min + aabb._max);
|
||||
_center.scale(0.5f);
|
||||
_xAxis = Vec3(1.0f, 0.0f, 0.0f);
|
||||
_yAxis = Vec3(0.0f, 1.0f, 0.0f);
|
||||
_zAxis = Vec3(0.0f, 0.0f, 1.0f);
|
||||
_xAxis.set(1.0f, 0.0f, 0.0f);
|
||||
_yAxis.set(0.0f, 1.0f, 0.0f);
|
||||
_zAxis.set(0.0f, 0.0f, 1.0f);
|
||||
|
||||
_extents = aabb._max - aabb._min;
|
||||
_extents.scale(0.5f);
|
||||
|
@ -249,9 +249,9 @@ OBB::OBB(const Vec3* verts, int num)
|
|||
|
||||
matTransform.transpose();
|
||||
|
||||
_xAxis = Vec3(matTransform.m[0], matTransform.m[1], matTransform.m[2]);
|
||||
_yAxis = Vec3(matTransform.m[4], matTransform.m[5], matTransform.m[6]);
|
||||
_zAxis = Vec3(matTransform.m[8], matTransform.m[9], matTransform.m[10]);
|
||||
_xAxis.set(matTransform.m[0], matTransform.m[1], matTransform.m[2]);
|
||||
_yAxis.set(matTransform.m[4], matTransform.m[5], matTransform.m[6]);
|
||||
_zAxis.set(matTransform.m[8], matTransform.m[9], matTransform.m[10]);
|
||||
|
||||
_center = 0.5f * (vecMax + vecMin);
|
||||
_center *= matTransform;
|
||||
|
|
|
@ -29,9 +29,15 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Oritened Bounding Box(OBB)
|
||||
* @brief the OBB is similar to the AABB but the bounding box has the same direction as Sprite3D. so it's collistion detection more precise than AABB
|
||||
* @js NA
|
||||
*/
|
||||
class CC_DLL OBB
|
||||
{
|
||||
|
@ -40,11 +46,15 @@ public:
|
|||
|
||||
/*
|
||||
* Construct obb from oriented bounding box
|
||||
*
|
||||
* @lua NA
|
||||
*/
|
||||
OBB(const AABB& aabb);
|
||||
|
||||
/*
|
||||
* Construct obb from points
|
||||
*
|
||||
* @lua NA
|
||||
*/
|
||||
OBB(const Vec3* verts, int num);
|
||||
|
||||
|
@ -129,6 +139,9 @@ public:
|
|||
Vec3 _extents; // obb length along each axis
|
||||
};
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif
|
||||
|
|
|
@ -613,6 +613,8 @@ std::string ObjLoader::LoadObj(shapes_t& shapes, const char* filename, const cha
|
|||
// use mtl
|
||||
if ((0 == strncmp(token, "usemtl", 6)) && isSpace((token[6])))
|
||||
{
|
||||
exportFaceGroupToShape(vertexCache, shapes, v, vn, vt, faceGroup, material, name);
|
||||
faceGroup.clear();
|
||||
|
||||
char namebuf[4096];
|
||||
token += 7;
|
||||
|
|
|
@ -17,7 +17,14 @@
|
|||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* .obj file Loader
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief .obj file Loader
|
||||
* @js NA
|
||||
* @lua NA
|
||||
**/
|
||||
class ObjLoader
|
||||
{
|
||||
|
@ -100,6 +107,9 @@ public:
|
|||
|
||||
};
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // _TINY_OBJ_LOADER_H
|
||||
|
|
|
@ -39,6 +39,8 @@ enum class PointSide
|
|||
|
||||
/**
|
||||
* Defines plane
|
||||
* @js NA
|
||||
* @lua NA
|
||||
**/
|
||||
class CC_DLL Plane
|
||||
{
|
||||
|
|
|
@ -33,18 +33,27 @@
|
|||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* Ray is a line with one end. usually use it to check intersects with some object,such as Plane, OBB, AABB
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Ray is a line with one end. usually use it to check intersects with some object,such as Plane, OBB, AABB
|
||||
* @js NA
|
||||
**/
|
||||
class CC_DLL Ray
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @lua new
|
||||
*/
|
||||
Ray();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @lua NA
|
||||
*/
|
||||
Ray(const Ray& ray);
|
||||
|
||||
|
@ -53,11 +62,13 @@ public:
|
|||
*
|
||||
* @param origin The ray's origin.
|
||||
* @param direction The ray's direction.
|
||||
* @lua new
|
||||
*/
|
||||
Ray(const Vec3& origin, const Vec3& direction);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
* @lua NA
|
||||
*/
|
||||
~Ray();
|
||||
|
||||
|
@ -93,6 +104,9 @@ public:
|
|||
Vec3 _direction; // The ray direction vector.
|
||||
};
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif
|
||||
|
|
|
@ -33,7 +33,13 @@
|
|||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* Defines a basic hierachial structure of transformation spaces.
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Defines a basic hierachial structure of transformation spaces.
|
||||
* @lua NA
|
||||
*/
|
||||
class CC_DLL Bone3D : public Ref
|
||||
{
|
||||
|
@ -184,7 +190,9 @@ protected:
|
|||
class CC_DLL Skeleton3D: public Ref
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* @lua NA
|
||||
*/
|
||||
static Skeleton3D* create(const std::vector<NodeData*>& skeletondata);
|
||||
|
||||
/**get total bone count*/
|
||||
|
@ -226,6 +234,9 @@ protected:
|
|||
Vector<Bone3D*> _rootBones;
|
||||
};
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __CCSKELETON3D_H__
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
class TextureCube;
|
||||
|
||||
/**
|
||||
|
@ -107,6 +112,9 @@ private:
|
|||
CC_DISALLOW_COPY_AND_ASSIGN(Skybox);
|
||||
};
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __SKYBOX_H__
|
||||
|
|
|
@ -244,6 +244,7 @@ Sprite3D::Sprite3D()
|
|||
, _aabbDirty(true)
|
||||
, _lightMask(-1)
|
||||
, _shaderUsingLight(false)
|
||||
, _forceDepthWrite(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -478,6 +479,7 @@ void Sprite3D::createNode(NodeData* nodedata, Node* root, const MaterialDatas& m
|
|||
{
|
||||
if(it->bones.size() > 0 || singleSprite)
|
||||
{
|
||||
this->setName(nodedata->id);
|
||||
auto mesh = Mesh::create(nodedata->id, getMeshIndexData(it->subMeshId));
|
||||
if(mesh)
|
||||
{
|
||||
|
@ -518,6 +520,17 @@ void Sprite3D::createNode(NodeData* nodedata, Node* root, const MaterialDatas& m
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vec3 pos;
|
||||
Quaternion qua;
|
||||
Vec3 scale;
|
||||
nodedata->transform.decompose(&scale, &qua, &pos);
|
||||
setPosition3D(pos);
|
||||
setRotationQuat(qua);
|
||||
setScaleX(scale.x);
|
||||
setScaleY(scale.y);
|
||||
setScaleZ(scale.z);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -560,7 +573,7 @@ void Sprite3D::createNode(NodeData* nodedata, Node* root, const MaterialDatas& m
|
|||
}
|
||||
for(const auto& it : nodedata->children)
|
||||
{
|
||||
createNode(it,node, matrialdatas, singleSprite);
|
||||
createNode(it,node, matrialdatas, nodedata->children.size() == 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -807,6 +820,22 @@ const BlendFunc& Sprite3D::getBlendFunc() const
|
|||
return _blend;
|
||||
}
|
||||
|
||||
AABB Sprite3D::getAABBRecursively()
|
||||
{
|
||||
AABB aabb;
|
||||
const Vector<Node*>& children = getChildren();
|
||||
for (const auto& iter : children)
|
||||
{
|
||||
Sprite3D* child = dynamic_cast<Sprite3D*>(iter);
|
||||
if(child)
|
||||
{
|
||||
aabb.merge(child->getAABBRecursively());
|
||||
}
|
||||
}
|
||||
aabb.merge(getAABB());
|
||||
return aabb;
|
||||
}
|
||||
|
||||
const AABB& Sprite3D::getAABB() const
|
||||
{
|
||||
Mat4 nodeToWorldTransform(getNodeToWorldTransform());
|
||||
|
@ -819,14 +848,18 @@ const AABB& Sprite3D::getAABB() const
|
|||
else
|
||||
{
|
||||
_aabb.reset();
|
||||
Mat4 transform(nodeToWorldTransform);
|
||||
for (const auto& it : _meshes) {
|
||||
if (it->isVisible())
|
||||
_aabb.merge(it->getAABB());
|
||||
if (_meshes.size())
|
||||
{
|
||||
Mat4 transform(nodeToWorldTransform);
|
||||
for (const auto& it : _meshes) {
|
||||
if (it->isVisible())
|
||||
_aabb.merge(it->getAABB());
|
||||
}
|
||||
|
||||
_aabb.transform(transform);
|
||||
_nodeToWorldTransform = nodeToWorldTransform;
|
||||
_aabbDirty = false;
|
||||
}
|
||||
|
||||
_aabb.transform(transform);
|
||||
_nodeToWorldTransform = nodeToWorldTransform;
|
||||
}
|
||||
|
||||
return _aabb;
|
||||
|
|
|
@ -41,12 +41,17 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
class Mesh;
|
||||
class Texture2D;
|
||||
class MeshSkin;
|
||||
class AttachNode;
|
||||
struct NodeData;
|
||||
/** Sprite3D: A sprite can be loaded from 3D model files, .obj, .c3t, .c3b, then can be drawed as sprite */
|
||||
/** @brief Sprite3D: A sprite can be loaded from 3D model files, .obj, .c3t, .c3b, then can be drawed as sprite */
|
||||
class CC_DLL Sprite3D : public Node, public BlendProtocol
|
||||
{
|
||||
public:
|
||||
|
@ -85,7 +90,11 @@ public:
|
|||
/**get Mesh by Name, it returns the first one if there are more than one mesh with the same name */
|
||||
Mesh* getMeshByName(const std::string& name) const;
|
||||
|
||||
/** get mesh array by name, returns all meshes with the given name */
|
||||
/**
|
||||
* get mesh array by name, returns all meshes with the given name
|
||||
*
|
||||
* @lua NA
|
||||
*/
|
||||
std::vector<Mesh*> getMeshArrayByName(const std::string& name) const;
|
||||
|
||||
/**get mesh*/
|
||||
|
@ -126,6 +135,14 @@ public:
|
|||
*/
|
||||
const AABB& getAABB() const;
|
||||
|
||||
/*
|
||||
* Get AABB Recursively
|
||||
* Because some times we may have an empty Sprite3D Node as parent, but
|
||||
* the Sprite3D don't contain any meshes, so getAABB()
|
||||
* will return a wrong value at that time.
|
||||
*/
|
||||
AABB getAABBRecursively();
|
||||
|
||||
/**
|
||||
* Executes an action, and returns the action that is executed. For Sprite3D special logic are needed to take care of Fading.
|
||||
*
|
||||
|
@ -213,7 +230,7 @@ protected:
|
|||
|
||||
mutable AABB _aabb; // cache current aabb
|
||||
mutable Mat4 _nodeToWorldTransform; // cache the matrix
|
||||
bool _aabbDirty;
|
||||
mutable bool _aabbDirty;
|
||||
unsigned int _lightMask;
|
||||
bool _shaderUsingLight; // is current shader using light ?
|
||||
bool _forceDepthWrite; // Always write to depth buffer
|
||||
|
@ -261,10 +278,18 @@ public:
|
|||
static Sprite3DCache* getInstance();
|
||||
static void destroyInstance();
|
||||
|
||||
/**get the SpriteData struct*/
|
||||
/**
|
||||
* get the SpriteData struct
|
||||
*
|
||||
* @lua NA
|
||||
*/
|
||||
Sprite3DData* getSpriteData(const std::string& key) const;
|
||||
|
||||
/**add the SpriteData into Sprite3D by given the specified key*/
|
||||
/**
|
||||
* add the SpriteData into Sprite3D by given the specified key
|
||||
*
|
||||
* @lua NA
|
||||
*/
|
||||
bool addSprite3DData(const std::string& key, Sprite3DData* spritedata);
|
||||
|
||||
/**remove the SpriteData from Sprite3D by given the specified key*/
|
||||
|
@ -284,7 +309,12 @@ protected:
|
|||
std::unordered_map<std::string, Sprite3DData*> _spriteDatas; //cached sprite datas
|
||||
};
|
||||
|
||||
/// @cond
|
||||
extern std::string CC_DLL s_attributeNames[];//attribute names array
|
||||
/// @endcond
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
#endif // __SPRITE3D_H_
|
||||
|
|
|
@ -31,16 +31,25 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
class Texture2D;
|
||||
|
||||
/**
|
||||
* the sprite3D material is only texture for now
|
||||
* @brief the sprite3D material is only texture for now
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class Sprite3DMaterialCache
|
||||
{
|
||||
public:
|
||||
/**get & destroy cache*/
|
||||
static Sprite3DMaterialCache* getInstance();
|
||||
|
||||
/**destroy the instance*/
|
||||
static void destroyInstance();
|
||||
|
||||
/**add to cache*/
|
||||
|
@ -65,6 +74,9 @@ protected:
|
|||
|
||||
};
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __CCSPRIT3DMATERIAL_H__
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,470 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2015 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#ifndef CC_TERRAIN_H
|
||||
#define CC_TERRAIN_H
|
||||
|
||||
#include "2d/CCNode.h"
|
||||
#include "2d/CCCamera.h"
|
||||
#include "renderer/CCTexture2D.h"
|
||||
#include "renderer/CCCustomCommand.h"
|
||||
#include "3d/CCAABB.h"
|
||||
#include "3d/CCRay.h"
|
||||
#include <vector>
|
||||
#include "base/CCEventListenerCustom.h"
|
||||
#include "base/CCEventDispatcher.h"
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup _3d
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* the maximum amount of the chunkes
|
||||
**/
|
||||
#define MAX_CHUNKES 256
|
||||
|
||||
/**
|
||||
* Terrain
|
||||
* Defines a Terrain that is capable of rendering large landscapes from 2D heightmap images.
|
||||
* Terrains can be constructed from several different internal formats heightmap sources:
|
||||
* 1. RGB888
|
||||
* 2. RGBA8888
|
||||
* 3. Luminance(gray-scale)8
|
||||
*
|
||||
* Terrain use TerrainData struct to initialize.the TerrainData struct warp
|
||||
* all parameters that Terrain initialization need.
|
||||
* TerrainData provide several handy constructor for users
|
||||
*
|
||||
* Surface detail is provided via texture splatting, where multiple Detail texture layers can be added
|
||||
* along with alpha map to define how different Detail texture blend with each other. These DetailTexture
|
||||
* can be defined in TerrainData. The number of supported Detail texture is Four. although typically 2-3 levels is
|
||||
* sufficient. For simple usage ,surface detail also is provided via simple Texture.
|
||||
*
|
||||
* Internally, Terrain is divide into smaller, more manageable chunks, which can be culled
|
||||
* separately for more efficient rendering. The size of the terrain chunks can be controlled
|
||||
* via the chunkSize property in TerrainData.
|
||||
*
|
||||
* Chunks are managed under the QuadTree.As DE FACTO terminal Node of the QuadTree;
|
||||
* let us cull chunks efficientlly to reduce drawCall amount And reduce the VBOs'Size that pass to the GPU.
|
||||
*
|
||||
* Level of detail (LOD) is supported using a technique that is similar to texture mipmapping -- called GeoMapping.
|
||||
* A distance-to-camera based test used to decide
|
||||
* the appropriate LOD for a terrain chunk. The number of LOD levels is 0 by default (which
|
||||
* means only the base level is used),the maxium number of LOD levels is 4. Of course ,you can hack the value individually.
|
||||
*
|
||||
* Finally, when LOD is enabled, cracks can begin to appear between terrain Chunks of
|
||||
* different LOD levels. An acceptable solution might be to simply reduce the lower LOD(high detail,smooth) chunks border,
|
||||
* And let the higher LOD(rough) chunks to seamlessly connect it.
|
||||
*
|
||||
* We can use ray-terrain intersection to pick a point of the terrain;
|
||||
* Also we can get an arbitrary point of the terrain's height and normal vector for convenience .
|
||||
**/
|
||||
class CC_DLL Terrain :public Node
|
||||
{
|
||||
public:
|
||||
|
||||
/**the crack fix type. use to fix the gaps between different LOD chunks */
|
||||
enum class CrackFixedType{
|
||||
SKIRT,
|
||||
INCREASE_LOWER,
|
||||
};
|
||||
|
||||
/**
|
||||
*DetailMap
|
||||
*this struct maintain a detail map data ,including source file ,detail size.
|
||||
*the DetailMap can use for terrain splatting
|
||||
**/
|
||||
struct CC_DLL DetailMap{
|
||||
/*Constructors*/
|
||||
DetailMap();
|
||||
DetailMap(const char * detailMapSrc, float size = 35);
|
||||
/*detail Image source file path*/
|
||||
std::string _detailMapSrc;
|
||||
/*detailMapSize determine how many tiles that Terrain represent*/
|
||||
float _detailMapSize;
|
||||
};
|
||||
|
||||
/**
|
||||
*TerrainData
|
||||
*This TerrainData struct warp all parameter that Terrain need to create
|
||||
*/
|
||||
struct CC_DLL TerrainData
|
||||
{
|
||||
/**empty constructor*/
|
||||
TerrainData();
|
||||
/**constructor, this constructor construct a simple terrain which only have 1 detailmap*/
|
||||
TerrainData(const char* heightMapsrc, const char * textureSrc, const Size & chunksize = Size(32,32), float mapHeight = 2, float mapScale = 0.1);
|
||||
/**constructor, this constructor construct a terrain which have 4 detailmaps, 1 alpha map*/
|
||||
TerrainData(const char* heightMapsrc, const char * alphamap, const DetailMap& detail1,const DetailMap& detail2, const DetailMap& detail3, const DetailMap& detail4, const Size & chunksize = Size(32,32), float mapHeight = 2, float mapScale = 0.1);
|
||||
/**constructor, this constructor construct a terrain which have 3 detailmaps, 1 alpha map*/
|
||||
TerrainData(const char* heightMapsrc, const char * alphamap, const DetailMap& detail1,const DetailMap& detail2, const DetailMap& detail3, const Size & chunksize = Size(32,32), float mapHeight = 2, float mapScale = 0.1);
|
||||
/**
|
||||
*deterimine the chunk size,chunk is the minimal subdivision of the Terrain
|
||||
*/
|
||||
Size _chunkSize;
|
||||
/**height Map source path*/
|
||||
std::string _heightMapSrc;
|
||||
/**the source path of the alpha map*/
|
||||
char* _alphaMapSrc;
|
||||
/**detail maps*/
|
||||
DetailMap _detailMaps[4];
|
||||
/**terrain Maximum height*/
|
||||
float _mapHeight;
|
||||
/**terrain scale factor,you can combine setScale later.*/
|
||||
float _mapScale;
|
||||
/**the amount of detailmap*/
|
||||
int _detailMapAmount;
|
||||
/**the skirt height ratio, only effect when terrain use skirt to fix crack*/
|
||||
float _skirtHeightRatio;
|
||||
};
|
||||
private:
|
||||
|
||||
struct ChunkIndices
|
||||
{
|
||||
GLuint _indices;
|
||||
unsigned short _size;
|
||||
};
|
||||
|
||||
struct ChunkLODIndices
|
||||
{
|
||||
int _relativeLod[5];
|
||||
ChunkIndices _chunkIndices;
|
||||
};
|
||||
|
||||
|
||||
struct ChunkLODIndicesSkirt
|
||||
{
|
||||
int _selfLod;
|
||||
ChunkIndices _chunkIndices;
|
||||
};
|
||||
/*
|
||||
*terrain vertices internal data format
|
||||
**/
|
||||
struct TerrainVertexData
|
||||
{
|
||||
/*constructor*/
|
||||
TerrainVertexData(){};
|
||||
TerrainVertexData(Vec3 v1, Tex2F v2)
|
||||
{
|
||||
_position = v1;
|
||||
_texcoord = v2;
|
||||
};
|
||||
/*the vertex's attributes*/
|
||||
cocos2d::Vec3 _position;
|
||||
cocos2d::Tex2F _texcoord;
|
||||
cocos2d::Vec3 _normal;
|
||||
};
|
||||
|
||||
struct QuadTree;
|
||||
/*
|
||||
*the terminal node of quad, use to subdivision terrain mesh and LOD
|
||||
**/
|
||||
struct Chunk
|
||||
{
|
||||
/**Constructor*/
|
||||
Chunk();
|
||||
/**destructor*/
|
||||
~Chunk();
|
||||
/*vertices*/
|
||||
std::vector<TerrainVertexData> _originalVertices;
|
||||
/*LOD indices*/
|
||||
struct LOD{
|
||||
std::vector<GLushort> _indices;
|
||||
};
|
||||
GLuint _vbo;
|
||||
ChunkIndices _chunkIndices;
|
||||
/**we now support four levels of detail*/
|
||||
LOD _lod[4];
|
||||
/**AABB in local space*/
|
||||
AABB _aabb;
|
||||
/**setup Chunk data*/
|
||||
void generate(int map_width, int map_height, int m, int n, const unsigned char * data);
|
||||
/**calculateAABB*/
|
||||
void calculateAABB();
|
||||
/**internal use draw function*/
|
||||
void bindAndDraw();
|
||||
/**finish opengl setup*/
|
||||
void finish();
|
||||
/*use linear-sample vertices for LOD mesh*/
|
||||
void updateVerticesForLOD();
|
||||
/*updateIndices */
|
||||
void updateIndicesLOD();
|
||||
|
||||
void updateIndicesLODSkirt();
|
||||
|
||||
/**calculate the average slop of chunk*/
|
||||
void calculateSlope();
|
||||
/**current LOD of the chunk*/
|
||||
int _currentLod;
|
||||
|
||||
int _oldLod;
|
||||
|
||||
int _neighborOldLOD[4];
|
||||
/*the left,right,front,back neighbors*/
|
||||
Chunk * _left;
|
||||
Chunk * _right;
|
||||
Chunk * _front;
|
||||
Chunk * _back;
|
||||
|
||||
QuadTree * _parent;
|
||||
|
||||
/**the position X in terrain space*/
|
||||
int _posX;
|
||||
/**the position Y in terrain space*/
|
||||
int _posY;
|
||||
/**parent terrain*/
|
||||
Terrain * _terrain;
|
||||
/**chunk size*/
|
||||
Size _size;
|
||||
/**chunk's estimated slope*/
|
||||
float _slope;
|
||||
std::vector<TerrainVertexData> _currentVertices;
|
||||
};
|
||||
|
||||
/**
|
||||
*QuadTree
|
||||
* @breif use to hierarchically frustum culling and set LOD
|
||||
**/
|
||||
struct QuadTree
|
||||
{
|
||||
/**constructor*/
|
||||
QuadTree(int x, int y, int width, int height, Terrain * terrain);
|
||||
/**destructor*/
|
||||
~QuadTree();
|
||||
/**recursively draw*/
|
||||
void draw();
|
||||
/**recursively set itself and its children is need to draw*/
|
||||
void resetNeedDraw(bool value);
|
||||
/**recursively potential visible culling*/
|
||||
void cullByCamera(const Camera * camera, const Mat4 & worldTransform);
|
||||
/**precalculate the AABB(In world space) of each quad*/
|
||||
void preCalculateAABB(const Mat4 & worldTransform);
|
||||
QuadTree * _tl;
|
||||
QuadTree * _tr;
|
||||
QuadTree * _bl;
|
||||
QuadTree * _br;
|
||||
/**A flag present current quadTree node whether a terminal node,the terminal node is de facto the chunck*/
|
||||
bool _isTerminal;
|
||||
Chunk * _chunk;
|
||||
int _posX;
|
||||
int _posY;
|
||||
int _height;
|
||||
int _width;
|
||||
QuadTree * _parent;
|
||||
/**AABB's cache (in local space)*/
|
||||
AABB _localAABB;
|
||||
/**AABB's cache (in world space)*/
|
||||
AABB _worldSpaceAABB;
|
||||
Terrain * _terrain;
|
||||
/** a flag determine whether a quadTree node need draw*/
|
||||
bool _needDraw;
|
||||
};
|
||||
friend QuadTree;
|
||||
friend Chunk;
|
||||
public:
|
||||
/*init function*/
|
||||
/**initialize all Properties which terrain need */
|
||||
bool initProperties();
|
||||
/**initialize heightMap data */
|
||||
bool initHeightMap(const char* heightMap);
|
||||
/**initialize alphaMap ,detailMaps textures*/
|
||||
bool initTextures();
|
||||
/**create entry*/
|
||||
static Terrain * create(TerrainData ¶meter, CrackFixedType fixedType = CrackFixedType::INCREASE_LOWER);
|
||||
/**get specified position's height mapping to the terrain,use bi-linear interpolation method
|
||||
* @param x the X position
|
||||
* @param y the Z position
|
||||
* @param normal the specified position's normal vector in terrain . if this argument is NULL or nullptr,Normal calculation shall be skip.
|
||||
* @return the height value of the specified position of the terrain, if the (X,Z) position is out of the terrain bounds,it shall return 0;
|
||||
**/
|
||||
float getHeight(float x, float z, Vec3 * normal= nullptr);
|
||||
|
||||
/**get specified position's height mapping to the terrain,use bi-linear interpolation method
|
||||
* @param pos the position (X,Z)
|
||||
* @param normal the specified position's normal vector in terrain . if this argument is NULL or nullptr,Normal calculation shall be skip.
|
||||
* @return the height value of the specified position of the terrain, if the (X,Z) position is out of the terrain bounds,it shall return 0;
|
||||
**/
|
||||
float getHeight(Vec2 pos, Vec3*Normal = nullptr);
|
||||
|
||||
/**get the normal of the specified pistion in terrain
|
||||
* @return the normal vector of the specified position of the terrain.
|
||||
* @note the fast normal calculation may not get precise normal vector.
|
||||
**/
|
||||
Vec3 getNormal(int pixelX, int pixelY);
|
||||
/**get height from the raw height filed*/
|
||||
float getImageHeight(int pixelX, int pixelY);
|
||||
/**show the wireline instead of the surface,Debug Use only.
|
||||
* @Note only support desktop platform
|
||||
**/
|
||||
void setDrawWire(bool boolValue);
|
||||
/**
|
||||
* Set threshold distance of each LOD level,must equal or gereater than the chunk size
|
||||
* @Note when invoke initHeightMap, the LOD distance will be automatic calculated.
|
||||
*/
|
||||
void setLODDistance(float lod1, float lod2, float lod3);
|
||||
|
||||
/**Switch frustum Culling Flag
|
||||
* @Note frustum culling will remarkable improve your terrain rendering performance.
|
||||
*/
|
||||
void setIsEnableFrustumCull(bool boolValue);
|
||||
|
||||
/** set the alpha map*/
|
||||
void setAlphaMap(cocos2d::Texture2D * newAlphaMapTexture);
|
||||
/**set the Detail Map */
|
||||
void setDetailMap(unsigned int index, DetailMap detailMap);
|
||||
|
||||
// Overrides, internal use only
|
||||
virtual void draw(cocos2d::Renderer* renderer, const cocos2d::Mat4 &transform, uint32_t flags) override;
|
||||
/**
|
||||
* Ray-Terrain intersection.
|
||||
* @return the intersection point
|
||||
*/
|
||||
Vec3 getIntersectionPoint(const Ray & ray);
|
||||
|
||||
/**
|
||||
* set the MaxDetailAmount.
|
||||
*/
|
||||
void setMaxDetailMapAmount(int maxValue);
|
||||
|
||||
/**
|
||||
* Convert a world Space position (X,Z) to terrain space position (X,Z)
|
||||
*/
|
||||
Vec2 convertToTerrainSpace(Vec2 worldSpace);
|
||||
|
||||
/**
|
||||
* reset the heightmap data.
|
||||
*/
|
||||
void resetHeightMap(const char * heightMap);
|
||||
|
||||
/**
|
||||
* get the terrain's mininal height.
|
||||
*/
|
||||
float getMinHeight();
|
||||
|
||||
/**
|
||||
* get the terrain's maximum height.
|
||||
*/
|
||||
float getMaxHeight();
|
||||
|
||||
/**
|
||||
* get the terrain's AABB(in world space)
|
||||
*/
|
||||
AABB getAABB();
|
||||
|
||||
/**
|
||||
* set the skirt height ratio
|
||||
*/
|
||||
void setSkirtHeightRatio(float ratio);
|
||||
|
||||
/**
|
||||
* get the terrain's quad tree which is also the root node.
|
||||
*/
|
||||
QuadTree * getQuadTree();
|
||||
|
||||
void reload();
|
||||
protected:
|
||||
|
||||
Terrain();
|
||||
virtual ~Terrain();
|
||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
||||
|
||||
/**
|
||||
* recursively set each chunk's LOD
|
||||
* @param cameraPos the camera postion in world space
|
||||
**/
|
||||
void setChunksLOD(Vec3 cameraPos);
|
||||
|
||||
/**
|
||||
* load Vertices from height filed for the whole terrain.
|
||||
**/
|
||||
void loadVertices();
|
||||
|
||||
/**
|
||||
* calculate Normal Line for each Vertex
|
||||
**/
|
||||
void calculateNormal();
|
||||
|
||||
//override
|
||||
virtual void onEnter() override;
|
||||
|
||||
/**
|
||||
* cache all unifrom loactions in GLSL.
|
||||
**/
|
||||
void cacheUniformAttribLocation();
|
||||
|
||||
//IBO generate & cache
|
||||
ChunkIndices lookForIndicesLODSkrit(int selfLod, bool * result);
|
||||
|
||||
ChunkIndices lookForIndicesLOD(int neighborLod[4], int selfLod, bool * result);
|
||||
|
||||
ChunkIndices insertIndicesLOD(int neighborLod[4], int selfLod, GLushort * indices, int size);
|
||||
|
||||
ChunkIndices insertIndicesLODSkirt(int selfLod, GLushort * indices, int size);
|
||||
protected:
|
||||
std::vector <ChunkLODIndices> _chunkLodIndicesSet;
|
||||
std::vector<ChunkLODIndicesSkirt> _chunkLodIndicesSkirtSet;
|
||||
Mat4 _CameraMatrix;
|
||||
bool _isCameraViewChanged;
|
||||
TerrainData _terrainData;
|
||||
bool _isDrawWire;
|
||||
unsigned char * _data;
|
||||
float _lodDistance[3];
|
||||
Texture2D * _detailMapTextures[4];
|
||||
Texture2D * _alphaMap;
|
||||
CustomCommand _customCommand;
|
||||
QuadTree * _quadRoot;
|
||||
Chunk * _chunkesArray[MAX_CHUNKES][MAX_CHUNKES];
|
||||
std::vector<TerrainVertexData> _vertices;
|
||||
std::vector<GLushort> _indices;
|
||||
int _imageWidth;
|
||||
int _imageHeight;
|
||||
Size _chunkSize;
|
||||
bool _isEnableFrustumCull;
|
||||
int _maxDetailMapValue;
|
||||
cocos2d::Image * _heightMapImage;
|
||||
Mat4 _oldCameraModelMatrix;
|
||||
Mat4 _terrainModelMatrix;
|
||||
GLuint _normalLocation;
|
||||
GLuint _positionLocation;
|
||||
GLuint _texcordLocation;
|
||||
float _maxHeight;
|
||||
float _minHeight;
|
||||
CrackFixedType _crackFixedType;
|
||||
float _skirtRatio;
|
||||
int _skirtVerticesOffset[4];
|
||||
GLint _detailMapLocation[4];
|
||||
GLint _alphaMapLocation;
|
||||
GLint _alphaIsHasAlphaMapLocation;
|
||||
GLint _detailMapSizeLocation[4];
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
||||
EventListenerCustom* _backToForegroundListener;
|
||||
#endif
|
||||
};
|
||||
|
||||
// end of actions group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue