2010-08-02 10:58:00 +08:00
|
|
|
/****************************************************************************
|
2014-01-07 11:25:07 +08:00
|
|
|
Copyright (c) 2008-2010 Ricardo Quesada
|
|
|
|
Copyright (c) 2010-2013 cocos2d-x.org
|
|
|
|
Copyright (c) 2011 Zynga Inc.
|
2018-01-29 16:25:32 +08:00
|
|
|
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
metal support for cocos2d-x (#19305)
* remove deprecated files
* remove some deprecated codes
* remove more deprecated codes
* remove ui deprecated codes
* remove more deprecated codes
* remove deprecated codes in ccmenuitem
* remove more deprecated codes in ui
* remove more deprecated codes in ui
* remove more deprecated codes in ui
* remove more deprecated codes
* remove more deprecated codes
* remove more deprecated codes
* remove vr related codes and ignore some modules
* remove allocator
* remove some config
* 【Feature】add back-end project file
* [Feature] add back-end file
* add pipeline descriptor and shader cache
* [Feature] support sprite for backend
* [Feature] remove unneeded code
* [Feature] according to es2.0 spec, you must use clamp-to-edge as texture wrap mode, and no mipmapping for non-power-of-two texture
* [Feature] set texture wrap mode to clamp-to-edge, and no mipmapping for non-power-of-two texture
* [Feature] remove macro define to .cpp file
* [Feature] add log info
* [Feature] add PipelineDescriptor for TriangleCommand
* [Feature] add PipelineDescriptor object as member of TriangleCommand
* [Feature] add getPipelineDescriptor method
* add renderbackend
* complete pipeline descriptor
* [Feature] add viewport in RenderCommand
* set viewport when rendrering
* [Feature] occur error when using RendererBackend, to be fixed.
* a workaround to fix black screen on macOS 10.14 (#19090)
* add rendererbackend init function
* fix typo
* [Feature] modify testFile
* [BugFix] modify shader path
* [Feature] set default viewport
* fix projection
* [Feature] modify log info
* [BugFix] change viewport data type to int
* [BugFix] add BindGroup to PipelienDescriptor
* [BugFix] change a_position to vec3 in sprite.vert
* [BugFix] set vertexLayout according to V3F_C4B_T2F structure
* [Feature] revert a_position to vec4
* [Feature] renderer should not use gl codes directly
* [Feature] it's better not use default value parameter
* fix depth test setting
* rendererbackend -> renderer
* clear color and depth at begin
* add metal backend
* metal support normalized attribute
* simplify codes
* update external
* add render pass desctriptor in pipeline descriptor
* fix warnings
* fix crash and memeory leak
* refactor Texture2D
* put pipeline descriptor into render command
* simplify codes
* [Feature] update Sprite
* fix crash when closing app
* [Feature] update SpriteBatchNode and TextureAtlas
* support render texture(not finish)
* [Feature] remove unused code
* make tests work on mac
* fix download-deps path error
* make tests work on iOS
* [Feature] support ttf under normal label effect
* refactor triangle command processing
* let renderer handle more common commands
* refactor backend
* make render texture work
* [Feature] refactor backend for GL
* [Feature]Renaming to make it easy to understand
* [Feature] change warp mode to CLAMP_TO_EDGE
* fix ghost
* simplify visit render queue logic
* support progress timer without rial mode
* support partcile system
* Feature/update label (#149)
* [BugFix] fix compile error
* [Feature] support outline effect in ios
* [Feature] add shader file
* [BugFix] fix begin and end RenderPass
* [Feature] update CustomCommand
* [Feature] revert project.pbxproj
* [Feature] simplify codes
* [BugFix] pack AI88 to RGBA8888 only when outline enable
* [Feature] support shadow effect in Label
* [Feature] support BMFont
* [Feature] support glow effect
* [Feature] simplify shader files
* LabelAtlas work
* handle blend function correctly
* support tile map
* don't share buffer in metal
* alloc buffer size as needed
* support more tilemap
* Merge branch 'minggo/metal-support' into feature/updateLabel
* minggo/metal-support:
support tile map
handle blend function correctly
LabelAtlas work
Feature/update label (#149)
support partcile system
# Conflicts:
# cocos/2d/CCLabel.cpp
# cocos/2d/CCSprite.cpp
# cocos/2d/CCSpriteBatchNode.cpp
# cocos/renderer/CCQuadCommand.cpp
# cocos/renderer/CCQuadCommand.h
* render texture work without saving file
* use global viewport
* grid3d works
* remove grabber
* tiled3d works
* [BugFix] fix label bug
* [Feature] add updateSubData for buffer
* [Feature] remove setVertexCount
* support depth test
* add callback command
* [Feature] add UITest
* [Feature] update UITest
* [Feature] remove unneeded codes
* fix custom command issue
* fix layer color blend issue
* [BugFix] fix iOS compile error
* [Feature] remove unneeded codes
* [Feature] fix updateVertexBuffer
* layerradial works
* add draw test back
* fix batch issue
* fix compiling error
* [BugFix] support ETC1
* [BugFix] get the correct pipelineDescriptor
* [BugFix] skip draw when backendTexture nullptr
* clipping node support
* [Feature] add shader files
* fix stencil issue in metal
* [Feature] update UILayoutTest
* [BugFix] skip drawing when vertexCount is zero
* refactor renderer
* add set global z order for stencil manager commands
* fix warnings caused by type
* remove viewport in render command
* [Feature] fix warnings caused by type
* [BugFix] clear vertexCount and indexCount for CustomComand when needed
* [Feature] update clear for CustomCommand
* ios use metal
* fix viewport issue
* fix LayerColorGradient crash
* [cmake] transport to android and windows (#160)
* save point 1
* compile on windows
* run on android
* revert useless change
* android set CC_ENABLE_CACHE_TEXTURE_DATA to 1
* add initGlew
* fix android crash
* add TODO new-renderer
* review update
* revert onGLFWWindowPosCallback
* fix android compiling error
* Impl progress radial (#162)
* progresstimer add radial impl
* default drawType to element
* dec invoke times of createVertexBuffer (#163)
* support depth/stencil format for gl backend
* simplify progress timer codes
* support motionstreak, effect is wrong
* fix motionstreak issue
* [Feature] update Scissor Test (#161)
* [Feature] update Scissor Test
* [Feature] update ScissorTest
* [Feature] rename function
* [Feature] get constant reference if needed
* [Feature] show render status (#164)
* improve performance
* fix depth state
* fill error that triangle vertex/index number bigger than buffer
* fix compiline error in release mode
* fix buffer conflict between CPU and GPU on iOS/macOS
* Renderer refactor (#165)
* use one vertes/index buffer with opengl
* fix error on windows
* custom command support index format config
* CCLayer: compact vertex data structure
* update comment
* fix doc
* support fast tilemap
* pass index format instead
* fix some wrong effect
* fix render texture error
* fix texture per-element size
* fix texture format error
* BlendFunc type refactor, GLenum -> backend::BlendFactor (#167)
* BlendFunc use backend::BlendFactor as inner field
* update comments
* use int to replace GLenum
* update xcode project fiel
* rename to GLBlendConst
* add ccConstants.h
* update xcode project file
* update copyright
* remove primitive command
* remove CCPrimitive.cpp/.h
* remove deprecated files
* remove unneeded files
* remove multiple view support
* remove multiple view support
* remove the usage of frame buffer in camera
* director don't use frame buffer
* remove FrameBuffer
* remove BatchCommand
* add some api reference
* add physics2d back
* fix crash when close app on mac
* improve render texture
* fix rendertexture issue
* fix rendertexture issue
* simplify codes
* CMake support for mac & ios (#169)
* update cmake
* fix compile error
* update 3rd libs version
* remove CCThread.h/.cpp
* remove ccthread
* use audio engine to implement simple audio engine
* remove unneeded codes
* remove deprecated codes
* remove winrt macro
* remove CC_USE_WIC
* set partcile blend function in more elegant way
* remove unneeded codes
* remove unneeded codes
* cmake works on windows
* update project setting
* improve performance
* GLFloat -> float
* sync v3 cmake improvements into metal-support (#172)
* pick: modern cmake, compile definitions improvement (#19139)
* modern cmake, use target_compile_definitions partly
* simplify macro define, remove USE_*
* modern cmake, macro define
* add physics 2d macro define into ccConfig.h
* remove USE_CHIPMUNK macro in build.gradle
* remove CocosSelectModule.cmake
* shrink useless define
* simplify compile options config, re-add if necessary
* update external for tmp CI test
* un-quote target_compile_options value
* add "-g" parameter only when debug mode
* keep single build type when generator Xcode & VS projecy
* update external for tmp CI tes
* add static_cast<char>(-1), fix -Wc++11-narrowing
* simplify win32 compile define
* not modify code, only improve compile options
# Conflicts:
# .gitignore
# cmake/Modules/CocosConfigDepend.cmake
# cocos/CMakeLists.txt
# external/config.json
# tests/cpp-tests/CMakeLists.txt
* modern cmake, improve cmake_compiler_flags (#19145)
* cmake_compiler_flags
* Fix typo
* Fix typo2
* Remove chanages from Android.mk
* correct lua template cmake build (#19149)
* don't add -Wno-deprecated into jsb target
* correct lua template cmake build
* fix win32 lua template compile error
* prevent cmake in-source-build friendly (#19151)
* pick: Copy resources to "Resources/" on win32 like in linux configuration
* add "/Z7" for cpp-tests on windows
* [cmake] fix iOS xcode property setting failed (#19208)
* fix iOS xcode property setting failed
* use search_depend_libs_recursive at dlls collect
* fix typo
* [cmake] add find_host_library into iOS toolchain file (#19230)
* pick: [lua android] use luajit & template cmake update (#19239)
* increase cmake stability , remove tests/CMakeLists.txt (#19261)
* cmake win32 Precompiled header (#19273)
* Precompiled header
* Fix
* Precompiled header for cocos
* Precompiled header jscocos2d
* Fix for COCOS2D_DEBUG is always 1 on Android (#19291)
Related #19289
* little build fix, tests cpp-tests works on mac
* sync v3 build related codes into metal-support (#173)
* strict initialization for std::array
* remove proj.win32 project configs
* modern cmake, cmake_cleanup_remove_unused_variables (#19146)
* Switch travis CI to xenial (#19207)
* Switch travis CI to xenial
* Remove language: android
* Set language: cpp
* Fix java problem
* Update sdkmanager
* Fix sdkmanger
* next sdkmanager fix
* Remove xenial from android
* revert to sdk-tools-{system}-3859397
* Remove linux cmake install
* Update before-install.sh
* Update .travis.yml
* Simplify install-deps-linux.sh, tested on Ubuntu 16.04 (#19212)
* Simplify install-deps-linux.sh
* Cleanup
* pick: install ninja
* update cocos2d-console submodule
* for metal-support alpha release, we only test cpp
* add HelloCpp into project(Cocos2d-x) for tmp test
* update extenal metal-support-4
* update uniform setting
* [Feature] update BindGroup
* [Feature] empty-test
* [Feature] cpp-test
* [Feature] fix GL compiler error
* [Feature] fix GL crash
* [Feature] empty-test
* [Feature] cpp-tests
* [feature] improve frameRate
* [feature] fix opengl compile error
* [feature] fix opengl compile error
* [BugFix] fix compute maxLocation error
* [Feature] update setting unifrom
* [Feature] fix namespace
* [Feature] remove unneeded code
* [Bugfix] fix project file
* [Feature] update review
* [texture2d] impl texture format support (#175)
* texture update
* update
* update texture
* commit
* compile on windows
* ddd
* rename
* rename methods
* no crash
* save gl
* save
* save
* rename
* move out pixel format convert functions
* metal crash
* update
* update android
* support gles compressed texture format
* support more compress format
* add more conversion methods
* ss
* save
* update conversion methods
* add PVRTC format support
* reformat
* add marco linux
* fix GL marcro
* pvrtc supported only by ios 8.0+
* remove unused cmake
* revert change
* refactor Texture2D::initWithData
* fix conversion log
* refactor Texture2D::initWithData
* remove some OpenGL constants for PVRTC
* add todo
* fix typo
* AutoTest works on mac/iOS by disable part cases, sync v3 bug fix (#174)
* review cpp-tests, and fix part issues on start auto test
* sync png format fix: Node:Particle3D abnormal texture effects #19204
* fix cpp-tests SpritePolygon crash, wrong png format (#19170)
* fix wrong png convert format from sRGB to Gray
* erase plist index if all frames was erased
* test_A8.png have I8 format, fix it
* [CCSpriteCache] allow re-add plist & add testcase (#19175)
* allow re-add plist & add testcase
* remove comments/rename method/update testcase
* fix isSpriteFramesWithFileLoaded & add testcase
* remove used variable
* remove unused variable
* fix double free issues when js/lua-tests exit on iOS (#19236)
* disable part cases, AutoTest works without crash on mac
* update cocos2dx files json, to test cocos new next
* fix spritecache plist parsing issue (#19269)
* [linux] Fix FileUtils::getContents with folder (#19157)
* fix FileUtils::getContents on linux/mac
* use stat.st_mode
* simplify
* [CCFileUtils] win32 getFileSize (#19176)
* win32 getFileSize
* fix stat
* [cpp test-Android]20:FileUtils/2 change title (#19197)
* sync #19200
* sync #19231
* [android lua] improve performance of lua loader (#19234)
* [lua] improve performance of lua loader
* remove cache fix
* Revert "fix spritecache plist parsing issue (#19269)"
This reverts commit f3a85ece4307a7b90816c34489d1ed2c8fd11baf.
* remove win32 project files ref in template.json
* add metal framework lnk ref into cpp template
* test on iOS, and disable part cases
* alBufferData instead of alBufferDataStatic for small audio file on Apple (#19227)
* changes AudioCache to use alBufferData instead of alBufferDataStatic
(also makes test 19 faster to trigger openal bugs faster)
The original problem: CrashIfClientProvidedBogusAudioBufferList
https://github.com/cocos2d/cocos2d-x/issues/18948
is not happening anymore, but there's still a not very frequent issue
that makes OpenAL crash with a call stack like this.
AudioCache::readDataTask > alBufferData > CleanUpDeadBufferList
It happes more frequently when the device is "cold", which means after
half an hour of not using the device (locked).
I could not find the actual source code for iOS OpenAL, so I used the
macOS versions:
https://opensource.apple.com/source/OpenAL/OpenAL-48.7/Source/OpenAL/oalImp.cpp.auto.html
They seem to use CAGuard.h to make sure the dead buffer list
has no threading issues. I'm worried because the CAGuard code I found
has macos and win32 define but no iOS, so I'm not sure. I guess the
iOS version is different and has the guard.
I could not find a place in the code that's unprotected by the locks
except the InitializeBufferMap() which should not be called more than
once from cocos, and there's a workaround in AudioEngine-impl for it.
I reduced the occurence of the CleanUpDeadBufferList crash by moving
the guard in ~AudioCache to cover the alDeleteBuffers call.
* remove hack method "setTimeout" on audio
* AutoTest works on iOS
* support set ios deployment target for root project
* enable all texture2d cases, since Jiang have fixed
* add CCTextureUtils to xcode project file (#176)
* add leak cases for SpriteFrameCache (#177)
* re-add SpriteFrameCache cases
* update template file json
* Update SpriteFrameCacheTest.cpp
* fix compiling error
2019-01-18 15:08:25 +08:00
|
|
|
Copyright (c) 2017-2019 Xiamen Yaji Software Co., Ltd.
|
2021-11-07 16:14:31 +08:00
|
|
|
Copyright (c) 2021 Bytedance Inc.
|
2010-08-02 10:58:00 +08:00
|
|
|
|
2021-11-07 16:14:31 +08:00
|
|
|
https://adxe.org
|
2010-08-02 10:58:00 +08:00
|
|
|
|
|
|
|
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.
|
|
|
|
****************************************************************************/
|
metal support for cocos2d-x (#19305)
* remove deprecated files
* remove some deprecated codes
* remove more deprecated codes
* remove ui deprecated codes
* remove more deprecated codes
* remove deprecated codes in ccmenuitem
* remove more deprecated codes in ui
* remove more deprecated codes in ui
* remove more deprecated codes in ui
* remove more deprecated codes
* remove more deprecated codes
* remove more deprecated codes
* remove vr related codes and ignore some modules
* remove allocator
* remove some config
* 【Feature】add back-end project file
* [Feature] add back-end file
* add pipeline descriptor and shader cache
* [Feature] support sprite for backend
* [Feature] remove unneeded code
* [Feature] according to es2.0 spec, you must use clamp-to-edge as texture wrap mode, and no mipmapping for non-power-of-two texture
* [Feature] set texture wrap mode to clamp-to-edge, and no mipmapping for non-power-of-two texture
* [Feature] remove macro define to .cpp file
* [Feature] add log info
* [Feature] add PipelineDescriptor for TriangleCommand
* [Feature] add PipelineDescriptor object as member of TriangleCommand
* [Feature] add getPipelineDescriptor method
* add renderbackend
* complete pipeline descriptor
* [Feature] add viewport in RenderCommand
* set viewport when rendrering
* [Feature] occur error when using RendererBackend, to be fixed.
* a workaround to fix black screen on macOS 10.14 (#19090)
* add rendererbackend init function
* fix typo
* [Feature] modify testFile
* [BugFix] modify shader path
* [Feature] set default viewport
* fix projection
* [Feature] modify log info
* [BugFix] change viewport data type to int
* [BugFix] add BindGroup to PipelienDescriptor
* [BugFix] change a_position to vec3 in sprite.vert
* [BugFix] set vertexLayout according to V3F_C4B_T2F structure
* [Feature] revert a_position to vec4
* [Feature] renderer should not use gl codes directly
* [Feature] it's better not use default value parameter
* fix depth test setting
* rendererbackend -> renderer
* clear color and depth at begin
* add metal backend
* metal support normalized attribute
* simplify codes
* update external
* add render pass desctriptor in pipeline descriptor
* fix warnings
* fix crash and memeory leak
* refactor Texture2D
* put pipeline descriptor into render command
* simplify codes
* [Feature] update Sprite
* fix crash when closing app
* [Feature] update SpriteBatchNode and TextureAtlas
* support render texture(not finish)
* [Feature] remove unused code
* make tests work on mac
* fix download-deps path error
* make tests work on iOS
* [Feature] support ttf under normal label effect
* refactor triangle command processing
* let renderer handle more common commands
* refactor backend
* make render texture work
* [Feature] refactor backend for GL
* [Feature]Renaming to make it easy to understand
* [Feature] change warp mode to CLAMP_TO_EDGE
* fix ghost
* simplify visit render queue logic
* support progress timer without rial mode
* support partcile system
* Feature/update label (#149)
* [BugFix] fix compile error
* [Feature] support outline effect in ios
* [Feature] add shader file
* [BugFix] fix begin and end RenderPass
* [Feature] update CustomCommand
* [Feature] revert project.pbxproj
* [Feature] simplify codes
* [BugFix] pack AI88 to RGBA8888 only when outline enable
* [Feature] support shadow effect in Label
* [Feature] support BMFont
* [Feature] support glow effect
* [Feature] simplify shader files
* LabelAtlas work
* handle blend function correctly
* support tile map
* don't share buffer in metal
* alloc buffer size as needed
* support more tilemap
* Merge branch 'minggo/metal-support' into feature/updateLabel
* minggo/metal-support:
support tile map
handle blend function correctly
LabelAtlas work
Feature/update label (#149)
support partcile system
# Conflicts:
# cocos/2d/CCLabel.cpp
# cocos/2d/CCSprite.cpp
# cocos/2d/CCSpriteBatchNode.cpp
# cocos/renderer/CCQuadCommand.cpp
# cocos/renderer/CCQuadCommand.h
* render texture work without saving file
* use global viewport
* grid3d works
* remove grabber
* tiled3d works
* [BugFix] fix label bug
* [Feature] add updateSubData for buffer
* [Feature] remove setVertexCount
* support depth test
* add callback command
* [Feature] add UITest
* [Feature] update UITest
* [Feature] remove unneeded codes
* fix custom command issue
* fix layer color blend issue
* [BugFix] fix iOS compile error
* [Feature] remove unneeded codes
* [Feature] fix updateVertexBuffer
* layerradial works
* add draw test back
* fix batch issue
* fix compiling error
* [BugFix] support ETC1
* [BugFix] get the correct pipelineDescriptor
* [BugFix] skip draw when backendTexture nullptr
* clipping node support
* [Feature] add shader files
* fix stencil issue in metal
* [Feature] update UILayoutTest
* [BugFix] skip drawing when vertexCount is zero
* refactor renderer
* add set global z order for stencil manager commands
* fix warnings caused by type
* remove viewport in render command
* [Feature] fix warnings caused by type
* [BugFix] clear vertexCount and indexCount for CustomComand when needed
* [Feature] update clear for CustomCommand
* ios use metal
* fix viewport issue
* fix LayerColorGradient crash
* [cmake] transport to android and windows (#160)
* save point 1
* compile on windows
* run on android
* revert useless change
* android set CC_ENABLE_CACHE_TEXTURE_DATA to 1
* add initGlew
* fix android crash
* add TODO new-renderer
* review update
* revert onGLFWWindowPosCallback
* fix android compiling error
* Impl progress radial (#162)
* progresstimer add radial impl
* default drawType to element
* dec invoke times of createVertexBuffer (#163)
* support depth/stencil format for gl backend
* simplify progress timer codes
* support motionstreak, effect is wrong
* fix motionstreak issue
* [Feature] update Scissor Test (#161)
* [Feature] update Scissor Test
* [Feature] update ScissorTest
* [Feature] rename function
* [Feature] get constant reference if needed
* [Feature] show render status (#164)
* improve performance
* fix depth state
* fill error that triangle vertex/index number bigger than buffer
* fix compiline error in release mode
* fix buffer conflict between CPU and GPU on iOS/macOS
* Renderer refactor (#165)
* use one vertes/index buffer with opengl
* fix error on windows
* custom command support index format config
* CCLayer: compact vertex data structure
* update comment
* fix doc
* support fast tilemap
* pass index format instead
* fix some wrong effect
* fix render texture error
* fix texture per-element size
* fix texture format error
* BlendFunc type refactor, GLenum -> backend::BlendFactor (#167)
* BlendFunc use backend::BlendFactor as inner field
* update comments
* use int to replace GLenum
* update xcode project fiel
* rename to GLBlendConst
* add ccConstants.h
* update xcode project file
* update copyright
* remove primitive command
* remove CCPrimitive.cpp/.h
* remove deprecated files
* remove unneeded files
* remove multiple view support
* remove multiple view support
* remove the usage of frame buffer in camera
* director don't use frame buffer
* remove FrameBuffer
* remove BatchCommand
* add some api reference
* add physics2d back
* fix crash when close app on mac
* improve render texture
* fix rendertexture issue
* fix rendertexture issue
* simplify codes
* CMake support for mac & ios (#169)
* update cmake
* fix compile error
* update 3rd libs version
* remove CCThread.h/.cpp
* remove ccthread
* use audio engine to implement simple audio engine
* remove unneeded codes
* remove deprecated codes
* remove winrt macro
* remove CC_USE_WIC
* set partcile blend function in more elegant way
* remove unneeded codes
* remove unneeded codes
* cmake works on windows
* update project setting
* improve performance
* GLFloat -> float
* sync v3 cmake improvements into metal-support (#172)
* pick: modern cmake, compile definitions improvement (#19139)
* modern cmake, use target_compile_definitions partly
* simplify macro define, remove USE_*
* modern cmake, macro define
* add physics 2d macro define into ccConfig.h
* remove USE_CHIPMUNK macro in build.gradle
* remove CocosSelectModule.cmake
* shrink useless define
* simplify compile options config, re-add if necessary
* update external for tmp CI test
* un-quote target_compile_options value
* add "-g" parameter only when debug mode
* keep single build type when generator Xcode & VS projecy
* update external for tmp CI tes
* add static_cast<char>(-1), fix -Wc++11-narrowing
* simplify win32 compile define
* not modify code, only improve compile options
# Conflicts:
# .gitignore
# cmake/Modules/CocosConfigDepend.cmake
# cocos/CMakeLists.txt
# external/config.json
# tests/cpp-tests/CMakeLists.txt
* modern cmake, improve cmake_compiler_flags (#19145)
* cmake_compiler_flags
* Fix typo
* Fix typo2
* Remove chanages from Android.mk
* correct lua template cmake build (#19149)
* don't add -Wno-deprecated into jsb target
* correct lua template cmake build
* fix win32 lua template compile error
* prevent cmake in-source-build friendly (#19151)
* pick: Copy resources to "Resources/" on win32 like in linux configuration
* add "/Z7" for cpp-tests on windows
* [cmake] fix iOS xcode property setting failed (#19208)
* fix iOS xcode property setting failed
* use search_depend_libs_recursive at dlls collect
* fix typo
* [cmake] add find_host_library into iOS toolchain file (#19230)
* pick: [lua android] use luajit & template cmake update (#19239)
* increase cmake stability , remove tests/CMakeLists.txt (#19261)
* cmake win32 Precompiled header (#19273)
* Precompiled header
* Fix
* Precompiled header for cocos
* Precompiled header jscocos2d
* Fix for COCOS2D_DEBUG is always 1 on Android (#19291)
Related #19289
* little build fix, tests cpp-tests works on mac
* sync v3 build related codes into metal-support (#173)
* strict initialization for std::array
* remove proj.win32 project configs
* modern cmake, cmake_cleanup_remove_unused_variables (#19146)
* Switch travis CI to xenial (#19207)
* Switch travis CI to xenial
* Remove language: android
* Set language: cpp
* Fix java problem
* Update sdkmanager
* Fix sdkmanger
* next sdkmanager fix
* Remove xenial from android
* revert to sdk-tools-{system}-3859397
* Remove linux cmake install
* Update before-install.sh
* Update .travis.yml
* Simplify install-deps-linux.sh, tested on Ubuntu 16.04 (#19212)
* Simplify install-deps-linux.sh
* Cleanup
* pick: install ninja
* update cocos2d-console submodule
* for metal-support alpha release, we only test cpp
* add HelloCpp into project(Cocos2d-x) for tmp test
* update extenal metal-support-4
* update uniform setting
* [Feature] update BindGroup
* [Feature] empty-test
* [Feature] cpp-test
* [Feature] fix GL compiler error
* [Feature] fix GL crash
* [Feature] empty-test
* [Feature] cpp-tests
* [feature] improve frameRate
* [feature] fix opengl compile error
* [feature] fix opengl compile error
* [BugFix] fix compute maxLocation error
* [Feature] update setting unifrom
* [Feature] fix namespace
* [Feature] remove unneeded code
* [Bugfix] fix project file
* [Feature] update review
* [texture2d] impl texture format support (#175)
* texture update
* update
* update texture
* commit
* compile on windows
* ddd
* rename
* rename methods
* no crash
* save gl
* save
* save
* rename
* move out pixel format convert functions
* metal crash
* update
* update android
* support gles compressed texture format
* support more compress format
* add more conversion methods
* ss
* save
* update conversion methods
* add PVRTC format support
* reformat
* add marco linux
* fix GL marcro
* pvrtc supported only by ios 8.0+
* remove unused cmake
* revert change
* refactor Texture2D::initWithData
* fix conversion log
* refactor Texture2D::initWithData
* remove some OpenGL constants for PVRTC
* add todo
* fix typo
* AutoTest works on mac/iOS by disable part cases, sync v3 bug fix (#174)
* review cpp-tests, and fix part issues on start auto test
* sync png format fix: Node:Particle3D abnormal texture effects #19204
* fix cpp-tests SpritePolygon crash, wrong png format (#19170)
* fix wrong png convert format from sRGB to Gray
* erase plist index if all frames was erased
* test_A8.png have I8 format, fix it
* [CCSpriteCache] allow re-add plist & add testcase (#19175)
* allow re-add plist & add testcase
* remove comments/rename method/update testcase
* fix isSpriteFramesWithFileLoaded & add testcase
* remove used variable
* remove unused variable
* fix double free issues when js/lua-tests exit on iOS (#19236)
* disable part cases, AutoTest works without crash on mac
* update cocos2dx files json, to test cocos new next
* fix spritecache plist parsing issue (#19269)
* [linux] Fix FileUtils::getContents with folder (#19157)
* fix FileUtils::getContents on linux/mac
* use stat.st_mode
* simplify
* [CCFileUtils] win32 getFileSize (#19176)
* win32 getFileSize
* fix stat
* [cpp test-Android]20:FileUtils/2 change title (#19197)
* sync #19200
* sync #19231
* [android lua] improve performance of lua loader (#19234)
* [lua] improve performance of lua loader
* remove cache fix
* Revert "fix spritecache plist parsing issue (#19269)"
This reverts commit f3a85ece4307a7b90816c34489d1ed2c8fd11baf.
* remove win32 project files ref in template.json
* add metal framework lnk ref into cpp template
* test on iOS, and disable part cases
* alBufferData instead of alBufferDataStatic for small audio file on Apple (#19227)
* changes AudioCache to use alBufferData instead of alBufferDataStatic
(also makes test 19 faster to trigger openal bugs faster)
The original problem: CrashIfClientProvidedBogusAudioBufferList
https://github.com/cocos2d/cocos2d-x/issues/18948
is not happening anymore, but there's still a not very frequent issue
that makes OpenAL crash with a call stack like this.
AudioCache::readDataTask > alBufferData > CleanUpDeadBufferList
It happes more frequently when the device is "cold", which means after
half an hour of not using the device (locked).
I could not find the actual source code for iOS OpenAL, so I used the
macOS versions:
https://opensource.apple.com/source/OpenAL/OpenAL-48.7/Source/OpenAL/oalImp.cpp.auto.html
They seem to use CAGuard.h to make sure the dead buffer list
has no threading issues. I'm worried because the CAGuard code I found
has macos and win32 define but no iOS, so I'm not sure. I guess the
iOS version is different and has the guard.
I could not find a place in the code that's unprotected by the locks
except the InitializeBufferMap() which should not be called more than
once from cocos, and there's a workaround in AudioEngine-impl for it.
I reduced the occurence of the CleanUpDeadBufferList crash by moving
the guard in ~AudioCache to cover the alDeleteBuffers call.
* remove hack method "setTimeout" on audio
* AutoTest works on iOS
* support set ios deployment target for root project
* enable all texture2d cases, since Jiang have fixed
* add CCTextureUtils to xcode project file (#176)
* add leak cases for SpriteFrameCache (#177)
* re-add SpriteFrameCache cases
* update template file json
* Update SpriteFrameCacheTest.cpp
* fix compiling error
2019-01-18 15:08:25 +08:00
|
|
|
#pragma once
|
2010-08-02 10:58:00 +08:00
|
|
|
|
2014-09-10 07:50:02 +08:00
|
|
|
#include <stack>
|
2015-08-13 15:14:10 +08:00
|
|
|
#include <thread>
|
2016-07-20 12:43:40 +08:00
|
|
|
#include <chrono>
|
2013-07-19 13:42:45 +08:00
|
|
|
|
2014-09-10 08:17:07 +08:00
|
|
|
#include "platform/CCPlatformMacros.h"
|
2014-04-27 01:11:22 +08:00
|
|
|
#include "base/CCRef.h"
|
2014-04-27 01:35:57 +08:00
|
|
|
#include "base/CCVector.h"
|
2014-08-29 16:44:20 +08:00
|
|
|
#include "2d/CCScene.h"
|
2014-04-26 13:03:25 +08:00
|
|
|
#include "math/CCMath.h"
|
2014-08-02 16:31:16 +08:00
|
|
|
#include "platform/CCGLView.h"
|
2011-06-20 17:31:38 +08:00
|
|
|
|
2012-04-18 18:43:45 +08:00
|
|
|
NS_CC_BEGIN
|
2010-07-12 17:03:27 +08:00
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
/**
|
2015-03-24 11:15:40 +08:00
|
|
|
* @addtogroup base
|
2012-06-20 18:09:11 +08:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2012-05-22 08:20:47 +08:00
|
|
|
/* Forward declarations. */
|
2013-06-20 14:13:12 +08:00
|
|
|
class LabelAtlas;
|
2014-08-02 16:31:16 +08:00
|
|
|
//class GLView;
|
2013-06-20 14:13:12 +08:00
|
|
|
class DirectorDelegate;
|
|
|
|
class Node;
|
|
|
|
class Scheduler;
|
|
|
|
class ActionManager;
|
2013-10-26 15:04:01 +08:00
|
|
|
class EventDispatcher;
|
2013-12-21 16:56:28 +08:00
|
|
|
class EventCustom;
|
|
|
|
class EventListenerCustom;
|
2013-11-07 18:52:36 +08:00
|
|
|
class TextureCache;
|
2013-12-18 09:50:17 +08:00
|
|
|
class Renderer;
|
2014-08-07 15:23:31 +08:00
|
|
|
class Camera;
|
2014-03-22 20:55:08 +08:00
|
|
|
|
2014-01-11 09:11:14 +08:00
|
|
|
class Console;
|
2015-06-04 15:53:13 +08:00
|
|
|
|
2010-09-28 18:27:33 +08:00
|
|
|
/**
|
2015-03-18 21:39:50 +08:00
|
|
|
* @brief Matrix stack type.
|
|
|
|
*/
|
2014-04-02 16:47:23 +08:00
|
|
|
enum class MATRIX_STACK_TYPE
|
|
|
|
{
|
2015-03-18 21:39:50 +08:00
|
|
|
/// Model view matrix stack
|
2014-04-02 16:47:23 +08:00
|
|
|
MATRIX_STACK_MODELVIEW,
|
2015-03-18 21:39:50 +08:00
|
|
|
|
|
|
|
/// projection matrix stack
|
2014-04-02 16:47:23 +08:00
|
|
|
MATRIX_STACK_PROJECTION,
|
2015-03-18 21:39:50 +08:00
|
|
|
|
|
|
|
/// texture matrix stack
|
2014-04-02 16:47:23 +08:00
|
|
|
MATRIX_STACK_TEXTURE
|
|
|
|
};
|
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
|
|
|
@brief Class that creates and handles the main Window and manages how
|
|
|
|
and when to execute the Scenes.
|
|
|
|
|
|
|
|
The Director is also responsible for:
|
|
|
|
- initializing the OpenGL context
|
|
|
|
- setting the OpenGL buffer depth (default one is 0-bit)
|
|
|
|
- setting the projection (default one is 3D)
|
|
|
|
|
|
|
|
Since the Director is a singleton, the standard way to use it is by calling:
|
|
|
|
_ Director::getInstance()->methodName();
|
|
|
|
*/
|
2014-02-20 10:53:49 +08:00
|
|
|
class CC_DLL Director : public Ref
|
2010-07-12 17:03:27 +08:00
|
|
|
{
|
2012-03-21 17:35:20 +08:00
|
|
|
public:
|
2017-06-05 13:37:50 +08:00
|
|
|
/** Director will trigger an event before set next scene. */
|
|
|
|
static const char* EVENT_BEFORE_SET_NEXT_SCENE;
|
|
|
|
/** Director will trigger an event after set next scene. */
|
|
|
|
static const char* EVENT_AFTER_SET_NEXT_SCENE;
|
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Director will trigger an event when projection type is changed. */
|
2015-10-27 17:32:57 +08:00
|
|
|
static const char* EVENT_PROJECTION_CHANGED;
|
|
|
|
/** Director will trigger an event before Schedule::update() is invoked. */
|
|
|
|
static const char* EVENT_BEFORE_UPDATE;
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Director will trigger an event after Schedule::update() is invoked. */
|
2013-12-21 16:56:28 +08:00
|
|
|
static const char* EVENT_AFTER_UPDATE;
|
2016-02-29 18:55:51 +08:00
|
|
|
/** Director will trigger an event while resetting Director */
|
|
|
|
static const char* EVENT_RESET;
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Director will trigger an event after Scene::render() is invoked. */
|
2013-12-21 16:56:28 +08:00
|
|
|
static const char* EVENT_AFTER_VISIT;
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Director will trigger an event after a scene is drawn, the data is sent to GPU. */
|
2013-12-21 16:56:28 +08:00
|
|
|
static const char* EVENT_AFTER_DRAW;
|
2017-05-26 11:09:24 +08:00
|
|
|
/** Director will trigger an event before a scene is drawn, right after clear. */
|
|
|
|
static const char* EVENT_BEFORE_DRAW;
|
2013-12-21 16:56:28 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
|
|
|
* @brief Possible OpenGL projections used by director
|
2013-07-25 14:39:32 +08:00
|
|
|
*/
|
2013-07-26 04:36:19 +08:00
|
|
|
enum class Projection
|
2013-07-25 14:39:32 +08:00
|
|
|
{
|
2015-03-18 21:39:50 +08:00
|
|
|
/// Sets a 2D projection (orthogonal projection).
|
2013-07-26 04:36:19 +08:00
|
|
|
_2D,
|
2013-07-25 14:39:32 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/// Sets a 3D projection with a fovy=60, znear=0.5f and zfar=1500.
|
2013-07-26 04:36:19 +08:00
|
|
|
_3D,
|
2013-07-25 14:39:32 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/// It calls "updateProjection" on the projection delegate.
|
2013-07-26 04:36:19 +08:00
|
|
|
CUSTOM,
|
2013-07-25 14:39:32 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/// Default projection is 3D projection.
|
2013-07-26 04:36:19 +08:00
|
|
|
DEFAULT = _3D,
|
2013-07-25 14:39:32 +08:00
|
|
|
};
|
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
2015-03-19 10:33:11 +08:00
|
|
|
* Returns a shared instance of the director.
|
|
|
|
* @js _getInstance
|
|
|
|
*/
|
2013-07-16 03:43:22 +08:00
|
|
|
static Director* getInstance();
|
|
|
|
|
2013-09-13 16:46:31 +08:00
|
|
|
/**
|
|
|
|
* @js ctor
|
|
|
|
*/
|
2015-03-18 21:39:50 +08:00
|
|
|
Director();
|
|
|
|
|
2013-09-13 13:52:42 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2016-08-19 09:13:15 +08:00
|
|
|
~Director();
|
|
|
|
bool init();
|
2010-07-16 14:09:31 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// attribute
|
2010-07-16 14:09:31 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Gets current running Scene. Director can only run one Scene at a time. */
|
2016-09-12 09:44:21 +08:00
|
|
|
Scene* getRunningScene() { return _runningScene; }
|
2010-07-12 17:03:27 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Gets the FPS value. */
|
2016-09-12 09:44:21 +08:00
|
|
|
float getAnimationInterval() { return _animationInterval; }
|
2015-09-06 17:59:36 +08:00
|
|
|
/** Sets the FPS value. FPS = 1/interval. */
|
2016-08-19 09:13:15 +08:00
|
|
|
void setAnimationInterval(float interval);
|
2010-07-12 17:03:27 +08:00
|
|
|
|
2015-09-06 17:59:36 +08:00
|
|
|
/** Whether or not displaying the FPS on the bottom-left corner of the screen. */
|
2016-09-12 09:44:21 +08:00
|
|
|
bool isDisplayStats() { return _displayStats; }
|
2015-09-06 17:59:36 +08:00
|
|
|
/** Display the FPS on the bottom-left corner of the screen. */
|
2016-09-12 09:44:21 +08:00
|
|
|
void setDisplayStats(bool displayStats) { _displayStats = displayStats; }
|
2012-04-13 11:22:17 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Get seconds per frame. */
|
2016-09-12 09:44:21 +08:00
|
|
|
float getSecondsPerFrame() { return _secondsPerFrame; }
|
2010-07-12 17:03:27 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
|
|
|
* Get the GLView.
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
GLView* getOpenGLView() { return _openGLView; }
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
|
|
|
* Sets the GLView.
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2014-01-31 07:40:56 +08:00
|
|
|
void setOpenGLView(GLView *openGLView);
|
2010-07-12 17:03:27 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/*
|
2015-03-19 10:33:11 +08:00
|
|
|
* Gets singleton of TextureCache.
|
|
|
|
* @js NA
|
|
|
|
*/
|
2013-11-07 18:52:36 +08:00
|
|
|
TextureCache* getTextureCache() const;
|
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Whether or not `_nextDeltaTimeZero` is set to 0. */
|
2016-09-12 09:44:21 +08:00
|
|
|
bool isNextDeltaTimeZero() { return _nextDeltaTimeZero; }
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
2015-09-22 16:08:23 +08:00
|
|
|
* Sets the delta time between current frame and next frame is 0.
|
|
|
|
* This value will be used in Schedule, and will affect all functions that are using frame delta time, such as Actions.
|
2015-03-18 21:39:50 +08:00
|
|
|
* This value will take effect only one time.
|
|
|
|
*/
|
2013-07-26 04:36:19 +08:00
|
|
|
void setNextDeltaTimeZero(bool nextDeltaTimeZero);
|
2010-07-12 17:03:27 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Whether or not the Director is paused. */
|
2016-09-12 09:44:21 +08:00
|
|
|
bool isPaused() { return _paused; }
|
2012-06-11 10:59:57 +08:00
|
|
|
|
2011-07-08 14:48:25 +08:00
|
|
|
/** How many frames were called since the director started */
|
2016-09-12 09:44:21 +08:00
|
|
|
unsigned int getTotalFrames() { return _totalFrames; }
|
2011-07-08 14:48:25 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Gets an OpenGL projection.
|
2015-03-19 10:33:11 +08:00
|
|
|
* @since v0.8.2
|
2013-09-13 11:41:20 +08:00
|
|
|
* @lua NA
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
Projection getProjection() { return _projection; }
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Sets OpenGL projection. */
|
2013-07-26 04:36:19 +08:00
|
|
|
void setProjection(Projection projection);
|
2013-02-27 15:44:36 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Sets the glViewport.*/
|
2013-02-27 15:44:36 +08:00
|
|
|
void setViewport();
|
2011-07-08 14:48:25 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** Whether or not the replaced scene will receive the cleanup message.
|
2015-03-18 21:39:50 +08:00
|
|
|
* If the new scene is pushed, then the old scene won't receive the "cleanup" message.
|
|
|
|
* If the new scene replaces the old one, the it will receive the "cleanup" message.
|
|
|
|
* @since v0.99.0
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
bool isSendCleanupToScene() { return _sendCleanupToScene; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** This object will be visited after the main scene is visited.
|
2015-03-18 21:39:50 +08:00
|
|
|
* This object MUST implement the "visit" function.
|
|
|
|
* Useful to hook a notification object, like Notifications (http://github.com/manucorporat/CCNotifications)
|
|
|
|
* @since v0.99.5
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2014-01-11 09:11:14 +08:00
|
|
|
Node* getNotificationNode() const { return _notificationNode; }
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
|
|
|
* Sets the notification node.
|
|
|
|
* @see Director::getNotificationNode()
|
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
void setNotificationNode(Node *node);
|
2012-11-13 11:06:32 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// window size
|
2010-07-12 17:03:27 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Returns the size of the OpenGL view in points. */
|
2021-10-23 23:27:14 +08:00
|
|
|
const Vec2& getWinSize() const;
|
2010-07-12 17:03:27 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Returns the size of the OpenGL view in pixels. */
|
2021-10-23 23:27:14 +08:00
|
|
|
Vec2 getWinSizeInPixels() const;
|
2012-08-09 10:23:39 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
|
|
|
* Returns visible size of the OpenGL view in points.
|
|
|
|
* The value is equal to `Director::getWinSize()` if don't invoke `GLView::setDesignResolutionSize()`.
|
2012-08-09 10:23:39 +08:00
|
|
|
*/
|
2021-10-23 23:27:14 +08:00
|
|
|
Vec2 getVisibleSize() const;
|
2012-08-09 10:23:39 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Returns visible origin coordinate of the OpenGL view in points. */
|
2014-05-15 01:07:09 +08:00
|
|
|
Vec2 getVisibleOrigin() const;
|
2010-07-12 17:03:27 +08:00
|
|
|
|
2017-11-23 09:34:23 +08:00
|
|
|
/**
|
|
|
|
* Returns safe area rectangle of the OpenGL view in points.
|
|
|
|
*/
|
|
|
|
Rect getSafeAreaRect() const;
|
|
|
|
|
|
|
|
/**
|
2015-03-18 21:39:50 +08:00
|
|
|
* Converts a screen coordinate to an OpenGL coordinate.
|
|
|
|
* Useful to convert (multi) touch coordinates to the current layout (portrait or landscape).
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
Vec2 convertToGL(const Vec2& point);
|
2010-07-12 17:03:27 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
|
|
|
* Converts an OpenGL coordinate to a screen coordinate.
|
|
|
|
* Useful to convert node points to window points for calls such as glScissor.
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2014-05-15 01:07:09 +08:00
|
|
|
Vec2 convertToUI(const Vec2& point);
|
2010-07-12 17:03:27 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
2015-09-06 17:59:36 +08:00
|
|
|
* Gets the distance between camera and near clipping frame.
|
|
|
|
* It is correct for default camera that near clipping frame is same as the screen.
|
2015-03-18 21:39:50 +08:00
|
|
|
*/
|
2013-08-08 16:31:44 +08:00
|
|
|
float getZEye() const;
|
2010-07-12 17:03:27 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// Scene Management
|
2010-07-12 17:03:27 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
|
|
|
* Enters the Director's main loop with the given Scene.
|
2012-04-19 14:35:52 +08:00
|
|
|
* Call it to run only your FIRST scene.
|
|
|
|
* Don't call it if there is already a running scene.
|
2012-04-13 11:22:17 +08:00
|
|
|
*
|
|
|
|
* It will call pushScene: and then it will call startAnimation
|
2015-03-19 10:33:11 +08:00
|
|
|
* @js NA
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-07-26 04:36:19 +08:00
|
|
|
void runWithScene(Scene *scene);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
|
|
|
* Suspends the execution of the running scene, pushing it on the stack of suspended scenes.
|
2012-04-19 14:35:52 +08:00
|
|
|
* The new scene will be executed.
|
|
|
|
* Try to avoid big stacks of pushed scenes to reduce memory allocation.
|
|
|
|
* ONLY call it if there is a running scene.
|
|
|
|
*/
|
2013-07-26 04:36:19 +08:00
|
|
|
void pushScene(Scene *scene);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
|
|
|
* Pops out a scene from the stack.
|
2012-04-19 14:35:52 +08:00
|
|
|
* This scene will replace the running one.
|
|
|
|
* The running scene will be deleted. If there are no more scenes in the stack the execution is terminated.
|
|
|
|
* ONLY call it if there is a running scene.
|
|
|
|
*/
|
2013-08-08 16:31:44 +08:00
|
|
|
void popScene();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
|
|
|
* Pops out all scenes from the stack until the root scene in the queue.
|
2012-06-12 02:50:32 +08:00
|
|
|
* This scene will replace the running one.
|
2015-03-18 21:39:50 +08:00
|
|
|
* Internally it will call `popToSceneStackLevel(1)`.
|
2012-06-12 02:50:32 +08:00
|
|
|
*/
|
2013-08-08 16:31:44 +08:00
|
|
|
void popToRootScene();
|
2012-06-11 10:59:57 +08:00
|
|
|
|
2013-09-23 02:39:42 +08:00
|
|
|
/** Pops out all scenes from the stack until it reaches `level`.
|
2013-05-01 06:33:22 +08:00
|
|
|
If level is 0, it will end the director.
|
|
|
|
If level is 1, it will pop all scenes until it reaches to root scene.
|
|
|
|
If level is <= than the current stack level, it won't do anything.
|
|
|
|
*/
|
|
|
|
void popToSceneStackLevel(int level);
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** Replaces the running scene with a new one. The running scene is terminated.
|
|
|
|
* ONLY call it if there is a running scene.
|
2015-03-19 10:33:11 +08:00
|
|
|
* @js NA
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-07-26 04:36:19 +08:00
|
|
|
void replaceScene(Scene *scene);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** Ends the execution, releases the running scene.
|
2013-09-13 11:41:20 +08:00
|
|
|
* @lua endToLua
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-08-08 16:31:44 +08:00
|
|
|
void end();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** Pauses the running scene.
|
2015-03-18 21:39:50 +08:00
|
|
|
* The running scene will be _drawed_ but all scheduled timers will be paused.
|
|
|
|
* While paused, the draw rate will be 4 FPS to reduce CPU consumption.
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-08-08 16:31:44 +08:00
|
|
|
void pause();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Resumes the paused scene.
|
|
|
|
* The scheduled timers will be activated again.
|
|
|
|
* The "delta time" will be 0 (as if the game wasn't paused).
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-08-08 16:31:44 +08:00
|
|
|
void resume();
|
2014-12-28 11:55:06 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/*
|
2015-03-19 10:33:11 +08:00
|
|
|
* Restart the director.
|
|
|
|
* @js NA
|
|
|
|
*/
|
2014-12-28 11:55:06 +08:00
|
|
|
void restart();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** Stops the animation. Nothing will be drawn. The main loop won't be triggered anymore.
|
2015-03-18 21:39:50 +08:00
|
|
|
* If you don't want to pause your animation call [pause] instead.
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2016-08-19 09:13:15 +08:00
|
|
|
void stopAnimation();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** The main loop is triggered again.
|
2015-03-18 21:39:50 +08:00
|
|
|
* Call this function only if [stopAnimation] was called earlier.
|
|
|
|
* @warning Don't call this function to start the main loop. To run the main loop call runWithScene.
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2016-08-19 09:13:15 +08:00
|
|
|
void startAnimation();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** Draw the scene.
|
2015-03-18 21:39:50 +08:00
|
|
|
* This method is called every frame. Don't call it manually.
|
|
|
|
*/
|
2013-08-08 16:31:44 +08:00
|
|
|
void drawScene();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// Memory Helper
|
|
|
|
|
2013-09-23 02:39:42 +08:00
|
|
|
/** Removes all cocos2d cached data.
|
2015-03-18 21:39:50 +08:00
|
|
|
* It will purge the TextureCache, SpriteFrameCache, LabelBMFont cache
|
|
|
|
* @since v0.99.3
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-08-08 16:31:44 +08:00
|
|
|
void purgeCachedData();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Sets the default values based on the Configuration info. */
|
2013-08-08 16:31:44 +08:00
|
|
|
void setDefaultValues();
|
2013-06-07 03:23:44 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// OpenGL Helper
|
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Sets the OpenGL default values.
|
|
|
|
* It will enable alpha blending, disable depth test.
|
2015-03-19 10:33:11 +08:00
|
|
|
* @js NA
|
2015-03-18 21:39:50 +08:00
|
|
|
*/
|
2013-08-08 16:31:44 +08:00
|
|
|
void setGLDefaultValues();
|
2014-12-24 11:53:38 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Sets clear values for the color buffers,
|
2015-03-19 10:33:11 +08:00
|
|
|
* value range of each element is [0.0, 1.0].
|
|
|
|
* @js NA
|
|
|
|
*/
|
2014-12-24 11:53:38 +08:00
|
|
|
void setClearColor(const Color4F& clearColor);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2016-08-19 09:13:15 +08:00
|
|
|
void mainLoop();
|
2017-05-23 08:46:13 +08:00
|
|
|
/** Invoke main loop with delta time. Then `calculateDeltaTime` can just use the delta time directly.
|
|
|
|
* The delta time paseed may include vsync time. See issue #17806
|
|
|
|
* @since 3.16
|
|
|
|
*/
|
|
|
|
void mainLoop(float dt);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** The size in pixels of the surface. It could be different than the screen size.
|
2015-03-18 21:39:50 +08:00
|
|
|
* High-res devices might have a higher surface size than the screen size.
|
|
|
|
* Only available when compiled using SDK >= 4.0.
|
|
|
|
* @since v0.99.4
|
2015-03-19 10:33:11 +08:00
|
|
|
*/
|
2012-08-01 15:30:12 +08:00
|
|
|
void setContentScaleFactor(float scaleFactor);
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
|
|
|
* Gets content scale factor.
|
|
|
|
* @see Director::setContentScaleFactor()
|
|
|
|
*/
|
2014-01-11 09:11:14 +08:00
|
|
|
float getContentScaleFactor() const { return _contentScaleFactor; }
|
2010-12-29 18:01:37 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Gets the Scheduler associated with this director.
|
|
|
|
* @since v2.0
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2014-01-11 09:11:14 +08:00
|
|
|
Scheduler* getScheduler() const { return _scheduler; }
|
2013-07-23 15:19:26 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Sets the Scheduler associated with this director.
|
|
|
|
* @since v2.0
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-07-23 15:19:26 +08:00
|
|
|
void setScheduler(Scheduler* scheduler);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Gets the ActionManager associated with this director.
|
|
|
|
* @since v2.0
|
2013-07-23 15:19:26 +08:00
|
|
|
*/
|
2014-01-11 09:11:14 +08:00
|
|
|
ActionManager* getActionManager() const { return _actionManager; }
|
2013-07-23 15:19:26 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Sets the ActionManager associated with this director.
|
|
|
|
* @since v2.0
|
2013-07-23 15:19:26 +08:00
|
|
|
*/
|
|
|
|
void setActionManager(ActionManager* actionManager);
|
2013-10-26 15:04:01 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Gets the EventDispatcher associated with this director.
|
|
|
|
* @since v3.0
|
2015-03-19 10:33:11 +08:00
|
|
|
* @js NA
|
2013-10-26 15:04:01 +08:00
|
|
|
*/
|
2014-01-11 09:11:14 +08:00
|
|
|
EventDispatcher* getEventDispatcher() const { return _eventDispatcher; }
|
2013-10-26 15:04:01 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Sets the EventDispatcher associated with this director.
|
|
|
|
* @since v3.0
|
2015-03-19 10:33:11 +08:00
|
|
|
* @js NA
|
2013-10-26 15:04:01 +08:00
|
|
|
*/
|
|
|
|
void setEventDispatcher(EventDispatcher* dispatcher);
|
2013-12-18 09:50:17 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Returns the Renderer associated with this director.
|
|
|
|
* @since v3.0
|
2013-12-18 09:50:17 +08:00
|
|
|
*/
|
2014-01-11 09:11:14 +08:00
|
|
|
Renderer* getRenderer() const { return _renderer; }
|
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Returns the Console associated with this director.
|
|
|
|
* @since v3.0
|
2015-03-19 10:33:11 +08:00
|
|
|
* @js NA
|
2014-01-11 09:11:14 +08:00
|
|
|
*/
|
|
|
|
Console* getConsole() const { return _console; }
|
2013-12-18 09:50:17 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/* Gets delta time since last tick to main loop. */
|
2013-07-23 15:19:26 +08:00
|
|
|
float getDeltaTime() const;
|
2013-09-30 16:22:55 +08:00
|
|
|
|
|
|
|
/**
|
2015-03-18 21:39:50 +08:00
|
|
|
* Gets Frame Rate.
|
2015-03-19 10:33:11 +08:00
|
|
|
* @js NA
|
2013-09-30 16:22:55 +08:00
|
|
|
*/
|
|
|
|
float getFrameRate() const { return _frameRate; }
|
2010-07-12 17:03:27 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
2015-03-19 10:33:11 +08:00
|
|
|
* Clones a specified type matrix and put it to the top of specified type of matrix stack.
|
|
|
|
* @js NA
|
|
|
|
*/
|
2014-11-05 08:46:14 +08:00
|
|
|
void pushMatrix(MATRIX_STACK_TYPE type);
|
2016-10-28 09:33:31 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/** Pops the top matrix of the specified type of matrix stack.
|
2015-03-19 10:33:11 +08:00
|
|
|
* @js NA
|
|
|
|
*/
|
2014-11-05 08:46:14 +08:00
|
|
|
void popMatrix(MATRIX_STACK_TYPE type);
|
2016-10-28 09:33:31 +08:00
|
|
|
|
2015-09-22 16:08:23 +08:00
|
|
|
/** Adds an identity matrix to the top of specified type of matrix stack.
|
2015-03-19 10:33:11 +08:00
|
|
|
* @js NA
|
|
|
|
*/
|
2014-11-05 08:46:14 +08:00
|
|
|
void loadIdentityMatrix(MATRIX_STACK_TYPE type);
|
2016-10-28 09:33:31 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
|
|
|
* Adds a matrix to the top of specified type of matrix stack.
|
|
|
|
*
|
|
|
|
* @param type Matrix type.
|
|
|
|
* @param mat The matrix that to be added.
|
2015-03-19 10:33:11 +08:00
|
|
|
* @js NA
|
2015-03-18 21:39:50 +08:00
|
|
|
*/
|
2014-11-05 08:46:14 +08:00
|
|
|
void loadMatrix(MATRIX_STACK_TYPE type, const Mat4& mat);
|
2016-10-28 09:33:31 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
2015-09-22 16:08:23 +08:00
|
|
|
* Multiplies a matrix to the top of specified type of matrix stack.
|
2015-03-18 21:39:50 +08:00
|
|
|
*
|
|
|
|
* @param type Matrix type.
|
2015-09-22 16:08:23 +08:00
|
|
|
* @param mat The matrix that to be multiplied.
|
2015-03-19 10:33:11 +08:00
|
|
|
* @js NA
|
2015-03-18 21:39:50 +08:00
|
|
|
*/
|
2014-11-05 08:46:14 +08:00
|
|
|
void multiplyMatrix(MATRIX_STACK_TYPE type, const Mat4& mat);
|
2016-10-28 09:33:31 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
2015-03-19 10:33:11 +08:00
|
|
|
* Gets the top matrix of specified type of matrix stack.
|
|
|
|
* @js NA
|
|
|
|
*/
|
2016-02-09 03:25:37 +08:00
|
|
|
const Mat4& getMatrix(MATRIX_STACK_TYPE type) const;
|
2016-10-28 09:33:31 +08:00
|
|
|
|
2015-03-18 21:39:50 +08:00
|
|
|
/**
|
2015-09-22 16:08:23 +08:00
|
|
|
* Clear all types of matrix stack, and add identity matrix to these matrix stacks.
|
2015-03-19 10:33:11 +08:00
|
|
|
* @js NA
|
|
|
|
*/
|
2014-11-05 08:46:14 +08:00
|
|
|
void resetMatrixStack();
|
|
|
|
|
2015-08-13 15:14:10 +08:00
|
|
|
/**
|
|
|
|
* returns the cocos2d thread id.
|
|
|
|
Useful to know if certain code is already running on the cocos2d thread
|
|
|
|
*/
|
|
|
|
const std::thread::id& getCocos2dThreadId() const { return _cocos2d_thread_id; }
|
|
|
|
|
2021-11-07 16:14:31 +08:00
|
|
|
void setChildrenIndexerEnabled(bool enable) { _childrenIndexerEnabled = enable; }
|
|
|
|
bool isChildrenIndexerEnabled() const { return _childrenIndexerEnabled; }
|
|
|
|
|
2016-08-19 09:13:15 +08:00
|
|
|
/**
|
|
|
|
* returns whether or not the Director is in a valid state
|
|
|
|
*/
|
2016-09-12 09:44:21 +08:00
|
|
|
bool isValid() const { return !_invalid; }
|
2016-08-19 09:13:15 +08:00
|
|
|
|
2010-07-12 17:03:27 +08:00
|
|
|
protected:
|
2014-12-30 10:09:56 +08:00
|
|
|
void reset();
|
|
|
|
|
2017-06-05 13:37:50 +08:00
|
|
|
|
|
|
|
virtual void startAnimation(SetIntervalReason reason);
|
|
|
|
virtual void setAnimationInterval(float interval, SetIntervalReason reason);
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
void purgeDirector();
|
2018-10-24 16:00:33 +08:00
|
|
|
bool _purgeDirectorInNextLoop = false; // this flag will be set to true in end()
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-12-28 11:55:06 +08:00
|
|
|
void restartDirector();
|
2018-10-24 16:00:33 +08:00
|
|
|
bool _restartDirectorInNextLoop = false; // this flag will be set to true in restart()
|
2014-12-28 11:55:06 +08:00
|
|
|
|
2013-08-08 16:31:44 +08:00
|
|
|
void setNextScene();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2017-06-05 13:37:50 +08:00
|
|
|
void updateFrameRate();
|
2017-06-20 09:02:13 +08:00
|
|
|
#if !CC_STRIP_FPS
|
2012-04-13 11:22:17 +08:00
|
|
|
void showStats();
|
|
|
|
void createStatsLabel();
|
|
|
|
void calculateMPF();
|
2013-12-05 17:19:01 +08:00
|
|
|
void getFPSImageData(unsigned char** datapointer, ssize_t* length);
|
2017-06-20 09:02:13 +08:00
|
|
|
#endif
|
2013-02-27 09:38:30 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** calculates delta time since last time it was called */
|
2012-04-13 11:22:17 +08:00
|
|
|
void calculateDeltaTime();
|
2013-07-16 03:43:22 +08:00
|
|
|
|
2013-11-07 18:52:36 +08:00
|
|
|
//textureCache creation or release
|
|
|
|
void initTextureCache();
|
|
|
|
void destroyTextureCache();
|
|
|
|
|
2014-11-05 08:46:14 +08:00
|
|
|
void initMatrixStack();
|
|
|
|
|
|
|
|
std::stack<Mat4> _modelViewMatrixStack;
|
|
|
|
std::stack<Mat4> _textureMatrixStack;
|
metal support for cocos2d-x (#19305)
* remove deprecated files
* remove some deprecated codes
* remove more deprecated codes
* remove ui deprecated codes
* remove more deprecated codes
* remove deprecated codes in ccmenuitem
* remove more deprecated codes in ui
* remove more deprecated codes in ui
* remove more deprecated codes in ui
* remove more deprecated codes
* remove more deprecated codes
* remove more deprecated codes
* remove vr related codes and ignore some modules
* remove allocator
* remove some config
* 【Feature】add back-end project file
* [Feature] add back-end file
* add pipeline descriptor and shader cache
* [Feature] support sprite for backend
* [Feature] remove unneeded code
* [Feature] according to es2.0 spec, you must use clamp-to-edge as texture wrap mode, and no mipmapping for non-power-of-two texture
* [Feature] set texture wrap mode to clamp-to-edge, and no mipmapping for non-power-of-two texture
* [Feature] remove macro define to .cpp file
* [Feature] add log info
* [Feature] add PipelineDescriptor for TriangleCommand
* [Feature] add PipelineDescriptor object as member of TriangleCommand
* [Feature] add getPipelineDescriptor method
* add renderbackend
* complete pipeline descriptor
* [Feature] add viewport in RenderCommand
* set viewport when rendrering
* [Feature] occur error when using RendererBackend, to be fixed.
* a workaround to fix black screen on macOS 10.14 (#19090)
* add rendererbackend init function
* fix typo
* [Feature] modify testFile
* [BugFix] modify shader path
* [Feature] set default viewport
* fix projection
* [Feature] modify log info
* [BugFix] change viewport data type to int
* [BugFix] add BindGroup to PipelienDescriptor
* [BugFix] change a_position to vec3 in sprite.vert
* [BugFix] set vertexLayout according to V3F_C4B_T2F structure
* [Feature] revert a_position to vec4
* [Feature] renderer should not use gl codes directly
* [Feature] it's better not use default value parameter
* fix depth test setting
* rendererbackend -> renderer
* clear color and depth at begin
* add metal backend
* metal support normalized attribute
* simplify codes
* update external
* add render pass desctriptor in pipeline descriptor
* fix warnings
* fix crash and memeory leak
* refactor Texture2D
* put pipeline descriptor into render command
* simplify codes
* [Feature] update Sprite
* fix crash when closing app
* [Feature] update SpriteBatchNode and TextureAtlas
* support render texture(not finish)
* [Feature] remove unused code
* make tests work on mac
* fix download-deps path error
* make tests work on iOS
* [Feature] support ttf under normal label effect
* refactor triangle command processing
* let renderer handle more common commands
* refactor backend
* make render texture work
* [Feature] refactor backend for GL
* [Feature]Renaming to make it easy to understand
* [Feature] change warp mode to CLAMP_TO_EDGE
* fix ghost
* simplify visit render queue logic
* support progress timer without rial mode
* support partcile system
* Feature/update label (#149)
* [BugFix] fix compile error
* [Feature] support outline effect in ios
* [Feature] add shader file
* [BugFix] fix begin and end RenderPass
* [Feature] update CustomCommand
* [Feature] revert project.pbxproj
* [Feature] simplify codes
* [BugFix] pack AI88 to RGBA8888 only when outline enable
* [Feature] support shadow effect in Label
* [Feature] support BMFont
* [Feature] support glow effect
* [Feature] simplify shader files
* LabelAtlas work
* handle blend function correctly
* support tile map
* don't share buffer in metal
* alloc buffer size as needed
* support more tilemap
* Merge branch 'minggo/metal-support' into feature/updateLabel
* minggo/metal-support:
support tile map
handle blend function correctly
LabelAtlas work
Feature/update label (#149)
support partcile system
# Conflicts:
# cocos/2d/CCLabel.cpp
# cocos/2d/CCSprite.cpp
# cocos/2d/CCSpriteBatchNode.cpp
# cocos/renderer/CCQuadCommand.cpp
# cocos/renderer/CCQuadCommand.h
* render texture work without saving file
* use global viewport
* grid3d works
* remove grabber
* tiled3d works
* [BugFix] fix label bug
* [Feature] add updateSubData for buffer
* [Feature] remove setVertexCount
* support depth test
* add callback command
* [Feature] add UITest
* [Feature] update UITest
* [Feature] remove unneeded codes
* fix custom command issue
* fix layer color blend issue
* [BugFix] fix iOS compile error
* [Feature] remove unneeded codes
* [Feature] fix updateVertexBuffer
* layerradial works
* add draw test back
* fix batch issue
* fix compiling error
* [BugFix] support ETC1
* [BugFix] get the correct pipelineDescriptor
* [BugFix] skip draw when backendTexture nullptr
* clipping node support
* [Feature] add shader files
* fix stencil issue in metal
* [Feature] update UILayoutTest
* [BugFix] skip drawing when vertexCount is zero
* refactor renderer
* add set global z order for stencil manager commands
* fix warnings caused by type
* remove viewport in render command
* [Feature] fix warnings caused by type
* [BugFix] clear vertexCount and indexCount for CustomComand when needed
* [Feature] update clear for CustomCommand
* ios use metal
* fix viewport issue
* fix LayerColorGradient crash
* [cmake] transport to android and windows (#160)
* save point 1
* compile on windows
* run on android
* revert useless change
* android set CC_ENABLE_CACHE_TEXTURE_DATA to 1
* add initGlew
* fix android crash
* add TODO new-renderer
* review update
* revert onGLFWWindowPosCallback
* fix android compiling error
* Impl progress radial (#162)
* progresstimer add radial impl
* default drawType to element
* dec invoke times of createVertexBuffer (#163)
* support depth/stencil format for gl backend
* simplify progress timer codes
* support motionstreak, effect is wrong
* fix motionstreak issue
* [Feature] update Scissor Test (#161)
* [Feature] update Scissor Test
* [Feature] update ScissorTest
* [Feature] rename function
* [Feature] get constant reference if needed
* [Feature] show render status (#164)
* improve performance
* fix depth state
* fill error that triangle vertex/index number bigger than buffer
* fix compiline error in release mode
* fix buffer conflict between CPU and GPU on iOS/macOS
* Renderer refactor (#165)
* use one vertes/index buffer with opengl
* fix error on windows
* custom command support index format config
* CCLayer: compact vertex data structure
* update comment
* fix doc
* support fast tilemap
* pass index format instead
* fix some wrong effect
* fix render texture error
* fix texture per-element size
* fix texture format error
* BlendFunc type refactor, GLenum -> backend::BlendFactor (#167)
* BlendFunc use backend::BlendFactor as inner field
* update comments
* use int to replace GLenum
* update xcode project fiel
* rename to GLBlendConst
* add ccConstants.h
* update xcode project file
* update copyright
* remove primitive command
* remove CCPrimitive.cpp/.h
* remove deprecated files
* remove unneeded files
* remove multiple view support
* remove multiple view support
* remove the usage of frame buffer in camera
* director don't use frame buffer
* remove FrameBuffer
* remove BatchCommand
* add some api reference
* add physics2d back
* fix crash when close app on mac
* improve render texture
* fix rendertexture issue
* fix rendertexture issue
* simplify codes
* CMake support for mac & ios (#169)
* update cmake
* fix compile error
* update 3rd libs version
* remove CCThread.h/.cpp
* remove ccthread
* use audio engine to implement simple audio engine
* remove unneeded codes
* remove deprecated codes
* remove winrt macro
* remove CC_USE_WIC
* set partcile blend function in more elegant way
* remove unneeded codes
* remove unneeded codes
* cmake works on windows
* update project setting
* improve performance
* GLFloat -> float
* sync v3 cmake improvements into metal-support (#172)
* pick: modern cmake, compile definitions improvement (#19139)
* modern cmake, use target_compile_definitions partly
* simplify macro define, remove USE_*
* modern cmake, macro define
* add physics 2d macro define into ccConfig.h
* remove USE_CHIPMUNK macro in build.gradle
* remove CocosSelectModule.cmake
* shrink useless define
* simplify compile options config, re-add if necessary
* update external for tmp CI test
* un-quote target_compile_options value
* add "-g" parameter only when debug mode
* keep single build type when generator Xcode & VS projecy
* update external for tmp CI tes
* add static_cast<char>(-1), fix -Wc++11-narrowing
* simplify win32 compile define
* not modify code, only improve compile options
# Conflicts:
# .gitignore
# cmake/Modules/CocosConfigDepend.cmake
# cocos/CMakeLists.txt
# external/config.json
# tests/cpp-tests/CMakeLists.txt
* modern cmake, improve cmake_compiler_flags (#19145)
* cmake_compiler_flags
* Fix typo
* Fix typo2
* Remove chanages from Android.mk
* correct lua template cmake build (#19149)
* don't add -Wno-deprecated into jsb target
* correct lua template cmake build
* fix win32 lua template compile error
* prevent cmake in-source-build friendly (#19151)
* pick: Copy resources to "Resources/" on win32 like in linux configuration
* add "/Z7" for cpp-tests on windows
* [cmake] fix iOS xcode property setting failed (#19208)
* fix iOS xcode property setting failed
* use search_depend_libs_recursive at dlls collect
* fix typo
* [cmake] add find_host_library into iOS toolchain file (#19230)
* pick: [lua android] use luajit & template cmake update (#19239)
* increase cmake stability , remove tests/CMakeLists.txt (#19261)
* cmake win32 Precompiled header (#19273)
* Precompiled header
* Fix
* Precompiled header for cocos
* Precompiled header jscocos2d
* Fix for COCOS2D_DEBUG is always 1 on Android (#19291)
Related #19289
* little build fix, tests cpp-tests works on mac
* sync v3 build related codes into metal-support (#173)
* strict initialization for std::array
* remove proj.win32 project configs
* modern cmake, cmake_cleanup_remove_unused_variables (#19146)
* Switch travis CI to xenial (#19207)
* Switch travis CI to xenial
* Remove language: android
* Set language: cpp
* Fix java problem
* Update sdkmanager
* Fix sdkmanger
* next sdkmanager fix
* Remove xenial from android
* revert to sdk-tools-{system}-3859397
* Remove linux cmake install
* Update before-install.sh
* Update .travis.yml
* Simplify install-deps-linux.sh, tested on Ubuntu 16.04 (#19212)
* Simplify install-deps-linux.sh
* Cleanup
* pick: install ninja
* update cocos2d-console submodule
* for metal-support alpha release, we only test cpp
* add HelloCpp into project(Cocos2d-x) for tmp test
* update extenal metal-support-4
* update uniform setting
* [Feature] update BindGroup
* [Feature] empty-test
* [Feature] cpp-test
* [Feature] fix GL compiler error
* [Feature] fix GL crash
* [Feature] empty-test
* [Feature] cpp-tests
* [feature] improve frameRate
* [feature] fix opengl compile error
* [feature] fix opengl compile error
* [BugFix] fix compute maxLocation error
* [Feature] update setting unifrom
* [Feature] fix namespace
* [Feature] remove unneeded code
* [Bugfix] fix project file
* [Feature] update review
* [texture2d] impl texture format support (#175)
* texture update
* update
* update texture
* commit
* compile on windows
* ddd
* rename
* rename methods
* no crash
* save gl
* save
* save
* rename
* move out pixel format convert functions
* metal crash
* update
* update android
* support gles compressed texture format
* support more compress format
* add more conversion methods
* ss
* save
* update conversion methods
* add PVRTC format support
* reformat
* add marco linux
* fix GL marcro
* pvrtc supported only by ios 8.0+
* remove unused cmake
* revert change
* refactor Texture2D::initWithData
* fix conversion log
* refactor Texture2D::initWithData
* remove some OpenGL constants for PVRTC
* add todo
* fix typo
* AutoTest works on mac/iOS by disable part cases, sync v3 bug fix (#174)
* review cpp-tests, and fix part issues on start auto test
* sync png format fix: Node:Particle3D abnormal texture effects #19204
* fix cpp-tests SpritePolygon crash, wrong png format (#19170)
* fix wrong png convert format from sRGB to Gray
* erase plist index if all frames was erased
* test_A8.png have I8 format, fix it
* [CCSpriteCache] allow re-add plist & add testcase (#19175)
* allow re-add plist & add testcase
* remove comments/rename method/update testcase
* fix isSpriteFramesWithFileLoaded & add testcase
* remove used variable
* remove unused variable
* fix double free issues when js/lua-tests exit on iOS (#19236)
* disable part cases, AutoTest works without crash on mac
* update cocos2dx files json, to test cocos new next
* fix spritecache plist parsing issue (#19269)
* [linux] Fix FileUtils::getContents with folder (#19157)
* fix FileUtils::getContents on linux/mac
* use stat.st_mode
* simplify
* [CCFileUtils] win32 getFileSize (#19176)
* win32 getFileSize
* fix stat
* [cpp test-Android]20:FileUtils/2 change title (#19197)
* sync #19200
* sync #19231
* [android lua] improve performance of lua loader (#19234)
* [lua] improve performance of lua loader
* remove cache fix
* Revert "fix spritecache plist parsing issue (#19269)"
This reverts commit f3a85ece4307a7b90816c34489d1ed2c8fd11baf.
* remove win32 project files ref in template.json
* add metal framework lnk ref into cpp template
* test on iOS, and disable part cases
* alBufferData instead of alBufferDataStatic for small audio file on Apple (#19227)
* changes AudioCache to use alBufferData instead of alBufferDataStatic
(also makes test 19 faster to trigger openal bugs faster)
The original problem: CrashIfClientProvidedBogusAudioBufferList
https://github.com/cocos2d/cocos2d-x/issues/18948
is not happening anymore, but there's still a not very frequent issue
that makes OpenAL crash with a call stack like this.
AudioCache::readDataTask > alBufferData > CleanUpDeadBufferList
It happes more frequently when the device is "cold", which means after
half an hour of not using the device (locked).
I could not find the actual source code for iOS OpenAL, so I used the
macOS versions:
https://opensource.apple.com/source/OpenAL/OpenAL-48.7/Source/OpenAL/oalImp.cpp.auto.html
They seem to use CAGuard.h to make sure the dead buffer list
has no threading issues. I'm worried because the CAGuard code I found
has macos and win32 define but no iOS, so I'm not sure. I guess the
iOS version is different and has the guard.
I could not find a place in the code that's unprotected by the locks
except the InitializeBufferMap() which should not be called more than
once from cocos, and there's a workaround in AudioEngine-impl for it.
I reduced the occurence of the CleanUpDeadBufferList crash by moving
the guard in ~AudioCache to cover the alDeleteBuffers call.
* remove hack method "setTimeout" on audio
* AutoTest works on iOS
* support set ios deployment target for root project
* enable all texture2d cases, since Jiang have fixed
* add CCTextureUtils to xcode project file (#176)
* add leak cases for SpriteFrameCache (#177)
* re-add SpriteFrameCache cases
* update template file json
* Update SpriteFrameCacheTest.cpp
* fix compiling error
2019-01-18 15:08:25 +08:00
|
|
|
std::stack<Mat4> _projectionMatrixStack;
|
2014-11-05 08:46:14 +08:00
|
|
|
|
2013-07-23 15:19:26 +08:00
|
|
|
/** Scheduler associated with this director
|
|
|
|
@since v2.0
|
|
|
|
*/
|
2018-10-24 16:00:33 +08:00
|
|
|
Scheduler *_scheduler = nullptr;
|
2013-07-23 15:19:26 +08:00
|
|
|
|
|
|
|
/** ActionManager associated with this director
|
|
|
|
@since v2.0
|
|
|
|
*/
|
2018-10-24 16:00:33 +08:00
|
|
|
ActionManager *_actionManager = nullptr;
|
2013-10-26 15:04:01 +08:00
|
|
|
|
|
|
|
/** EventDispatcher associated with this director
|
|
|
|
@since v3.0
|
|
|
|
*/
|
2018-10-24 16:00:33 +08:00
|
|
|
EventDispatcher* _eventDispatcher = nullptr;
|
|
|
|
EventCustom* _eventProjectionChanged = nullptr;
|
|
|
|
EventCustom* _eventBeforeDraw =nullptr;
|
|
|
|
EventCustom* _eventAfterDraw = nullptr;
|
|
|
|
EventCustom* _eventAfterVisit = nullptr;
|
|
|
|
EventCustom* _eventBeforeUpdate = nullptr;
|
|
|
|
EventCustom* _eventAfterUpdate = nullptr;
|
|
|
|
EventCustom* _eventResetDirector = nullptr;
|
|
|
|
EventCustom* _beforeSetNextScene = nullptr;
|
|
|
|
EventCustom* _afterSetNextScene = nullptr;
|
2013-09-03 18:22:03 +08:00
|
|
|
|
2013-07-23 15:19:26 +08:00
|
|
|
/* delta time since last tick to main loop */
|
2018-10-24 16:00:33 +08:00
|
|
|
float _deltaTime = 0.0f;
|
|
|
|
bool _deltaTimePassedByCaller = false;
|
2013-07-23 15:19:26 +08:00
|
|
|
|
2014-07-31 00:53:04 +08:00
|
|
|
/* The _openGLView, where everything is rendered, GLView is a abstract class,cocos2d-x provide GLViewImpl
|
|
|
|
which inherit from it as default renderer context,you can have your own by inherit from it*/
|
2018-10-24 16:00:33 +08:00
|
|
|
GLView *_openGLView = nullptr;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-11-07 18:52:36 +08:00
|
|
|
//texture cache belongs to this director
|
2018-10-24 16:00:33 +08:00
|
|
|
TextureCache *_textureCache = nullptr;
|
2013-11-07 18:52:36 +08:00
|
|
|
|
2018-10-24 16:00:33 +08:00
|
|
|
float _animationInterval = 0.0f;
|
|
|
|
float _oldAnimationInterval = 0.0f;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2018-10-24 16:00:33 +08:00
|
|
|
bool _displayStats = false;
|
|
|
|
float _accumDt = 0.0f;
|
|
|
|
float _frameRate = 0.0f;
|
2012-04-13 11:22:17 +08:00
|
|
|
|
2018-10-24 16:00:33 +08:00
|
|
|
LabelAtlas *_FPSLabel = nullptr;
|
|
|
|
LabelAtlas *_drawnBatchesLabel = nullptr;
|
|
|
|
LabelAtlas *_drawnVerticesLabel = nullptr;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-11 10:59:57 +08:00
|
|
|
/** Whether or not the Director is paused */
|
2018-10-24 16:00:33 +08:00
|
|
|
bool _paused = false;
|
2012-06-11 10:59:57 +08:00
|
|
|
|
2011-07-08 14:48:25 +08:00
|
|
|
/* How many frames were called since the director started */
|
2018-10-24 16:00:33 +08:00
|
|
|
unsigned int _totalFrames = 0;
|
|
|
|
unsigned int _frames = 0;
|
|
|
|
float _secondsPerFrame = 1.f;
|
2013-11-27 10:35:12 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/* The running scene */
|
2018-10-24 16:00:33 +08:00
|
|
|
Scene *_runningScene = nullptr;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/* will be the next 'runningScene' in the next frame
|
|
|
|
nextScene is a weak reference. */
|
2018-10-24 16:00:33 +08:00
|
|
|
Scene *_nextScene = nullptr;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-01 16:39:42 +08:00
|
|
|
/* If true, then "old" scene will receive the cleanup message */
|
2018-10-24 16:00:33 +08:00
|
|
|
bool _sendCleanupToScene = false;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/* scheduled scenes */
|
2013-12-07 10:48:02 +08:00
|
|
|
Vector<Scene*> _scenesStack;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/* last time the main loop was updated */
|
2016-07-20 12:43:40 +08:00
|
|
|
std::chrono::steady_clock::time_point _lastUpdate;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/* whether or not the next delta time will be zero */
|
2018-10-24 16:00:33 +08:00
|
|
|
bool _nextDeltaTimeZero = false;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/* projection used */
|
2018-10-24 16:00:33 +08:00
|
|
|
Projection _projection = Projection::DEFAULT;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/* window size in points */
|
2021-10-23 23:27:14 +08:00
|
|
|
Vec2 _winSizeInPoints = Vec2::ZERO;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/* content scale factor */
|
2018-10-24 16:00:33 +08:00
|
|
|
float _contentScaleFactor = 1.0f;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/* This object will be visited after the scene. Useful to hook a notification node */
|
2018-10-24 16:00:33 +08:00
|
|
|
Node *_notificationNode = nullptr;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-01-11 09:11:14 +08:00
|
|
|
/* Renderer for the Director */
|
2018-10-24 16:00:33 +08:00
|
|
|
Renderer *_renderer = nullptr;
|
2014-01-11 09:11:14 +08:00
|
|
|
|
metal support for cocos2d-x (#19305)
* remove deprecated files
* remove some deprecated codes
* remove more deprecated codes
* remove ui deprecated codes
* remove more deprecated codes
* remove deprecated codes in ccmenuitem
* remove more deprecated codes in ui
* remove more deprecated codes in ui
* remove more deprecated codes in ui
* remove more deprecated codes
* remove more deprecated codes
* remove more deprecated codes
* remove vr related codes and ignore some modules
* remove allocator
* remove some config
* 【Feature】add back-end project file
* [Feature] add back-end file
* add pipeline descriptor and shader cache
* [Feature] support sprite for backend
* [Feature] remove unneeded code
* [Feature] according to es2.0 spec, you must use clamp-to-edge as texture wrap mode, and no mipmapping for non-power-of-two texture
* [Feature] set texture wrap mode to clamp-to-edge, and no mipmapping for non-power-of-two texture
* [Feature] remove macro define to .cpp file
* [Feature] add log info
* [Feature] add PipelineDescriptor for TriangleCommand
* [Feature] add PipelineDescriptor object as member of TriangleCommand
* [Feature] add getPipelineDescriptor method
* add renderbackend
* complete pipeline descriptor
* [Feature] add viewport in RenderCommand
* set viewport when rendrering
* [Feature] occur error when using RendererBackend, to be fixed.
* a workaround to fix black screen on macOS 10.14 (#19090)
* add rendererbackend init function
* fix typo
* [Feature] modify testFile
* [BugFix] modify shader path
* [Feature] set default viewport
* fix projection
* [Feature] modify log info
* [BugFix] change viewport data type to int
* [BugFix] add BindGroup to PipelienDescriptor
* [BugFix] change a_position to vec3 in sprite.vert
* [BugFix] set vertexLayout according to V3F_C4B_T2F structure
* [Feature] revert a_position to vec4
* [Feature] renderer should not use gl codes directly
* [Feature] it's better not use default value parameter
* fix depth test setting
* rendererbackend -> renderer
* clear color and depth at begin
* add metal backend
* metal support normalized attribute
* simplify codes
* update external
* add render pass desctriptor in pipeline descriptor
* fix warnings
* fix crash and memeory leak
* refactor Texture2D
* put pipeline descriptor into render command
* simplify codes
* [Feature] update Sprite
* fix crash when closing app
* [Feature] update SpriteBatchNode and TextureAtlas
* support render texture(not finish)
* [Feature] remove unused code
* make tests work on mac
* fix download-deps path error
* make tests work on iOS
* [Feature] support ttf under normal label effect
* refactor triangle command processing
* let renderer handle more common commands
* refactor backend
* make render texture work
* [Feature] refactor backend for GL
* [Feature]Renaming to make it easy to understand
* [Feature] change warp mode to CLAMP_TO_EDGE
* fix ghost
* simplify visit render queue logic
* support progress timer without rial mode
* support partcile system
* Feature/update label (#149)
* [BugFix] fix compile error
* [Feature] support outline effect in ios
* [Feature] add shader file
* [BugFix] fix begin and end RenderPass
* [Feature] update CustomCommand
* [Feature] revert project.pbxproj
* [Feature] simplify codes
* [BugFix] pack AI88 to RGBA8888 only when outline enable
* [Feature] support shadow effect in Label
* [Feature] support BMFont
* [Feature] support glow effect
* [Feature] simplify shader files
* LabelAtlas work
* handle blend function correctly
* support tile map
* don't share buffer in metal
* alloc buffer size as needed
* support more tilemap
* Merge branch 'minggo/metal-support' into feature/updateLabel
* minggo/metal-support:
support tile map
handle blend function correctly
LabelAtlas work
Feature/update label (#149)
support partcile system
# Conflicts:
# cocos/2d/CCLabel.cpp
# cocos/2d/CCSprite.cpp
# cocos/2d/CCSpriteBatchNode.cpp
# cocos/renderer/CCQuadCommand.cpp
# cocos/renderer/CCQuadCommand.h
* render texture work without saving file
* use global viewport
* grid3d works
* remove grabber
* tiled3d works
* [BugFix] fix label bug
* [Feature] add updateSubData for buffer
* [Feature] remove setVertexCount
* support depth test
* add callback command
* [Feature] add UITest
* [Feature] update UITest
* [Feature] remove unneeded codes
* fix custom command issue
* fix layer color blend issue
* [BugFix] fix iOS compile error
* [Feature] remove unneeded codes
* [Feature] fix updateVertexBuffer
* layerradial works
* add draw test back
* fix batch issue
* fix compiling error
* [BugFix] support ETC1
* [BugFix] get the correct pipelineDescriptor
* [BugFix] skip draw when backendTexture nullptr
* clipping node support
* [Feature] add shader files
* fix stencil issue in metal
* [Feature] update UILayoutTest
* [BugFix] skip drawing when vertexCount is zero
* refactor renderer
* add set global z order for stencil manager commands
* fix warnings caused by type
* remove viewport in render command
* [Feature] fix warnings caused by type
* [BugFix] clear vertexCount and indexCount for CustomComand when needed
* [Feature] update clear for CustomCommand
* ios use metal
* fix viewport issue
* fix LayerColorGradient crash
* [cmake] transport to android and windows (#160)
* save point 1
* compile on windows
* run on android
* revert useless change
* android set CC_ENABLE_CACHE_TEXTURE_DATA to 1
* add initGlew
* fix android crash
* add TODO new-renderer
* review update
* revert onGLFWWindowPosCallback
* fix android compiling error
* Impl progress radial (#162)
* progresstimer add radial impl
* default drawType to element
* dec invoke times of createVertexBuffer (#163)
* support depth/stencil format for gl backend
* simplify progress timer codes
* support motionstreak, effect is wrong
* fix motionstreak issue
* [Feature] update Scissor Test (#161)
* [Feature] update Scissor Test
* [Feature] update ScissorTest
* [Feature] rename function
* [Feature] get constant reference if needed
* [Feature] show render status (#164)
* improve performance
* fix depth state
* fill error that triangle vertex/index number bigger than buffer
* fix compiline error in release mode
* fix buffer conflict between CPU and GPU on iOS/macOS
* Renderer refactor (#165)
* use one vertes/index buffer with opengl
* fix error on windows
* custom command support index format config
* CCLayer: compact vertex data structure
* update comment
* fix doc
* support fast tilemap
* pass index format instead
* fix some wrong effect
* fix render texture error
* fix texture per-element size
* fix texture format error
* BlendFunc type refactor, GLenum -> backend::BlendFactor (#167)
* BlendFunc use backend::BlendFactor as inner field
* update comments
* use int to replace GLenum
* update xcode project fiel
* rename to GLBlendConst
* add ccConstants.h
* update xcode project file
* update copyright
* remove primitive command
* remove CCPrimitive.cpp/.h
* remove deprecated files
* remove unneeded files
* remove multiple view support
* remove multiple view support
* remove the usage of frame buffer in camera
* director don't use frame buffer
* remove FrameBuffer
* remove BatchCommand
* add some api reference
* add physics2d back
* fix crash when close app on mac
* improve render texture
* fix rendertexture issue
* fix rendertexture issue
* simplify codes
* CMake support for mac & ios (#169)
* update cmake
* fix compile error
* update 3rd libs version
* remove CCThread.h/.cpp
* remove ccthread
* use audio engine to implement simple audio engine
* remove unneeded codes
* remove deprecated codes
* remove winrt macro
* remove CC_USE_WIC
* set partcile blend function in more elegant way
* remove unneeded codes
* remove unneeded codes
* cmake works on windows
* update project setting
* improve performance
* GLFloat -> float
* sync v3 cmake improvements into metal-support (#172)
* pick: modern cmake, compile definitions improvement (#19139)
* modern cmake, use target_compile_definitions partly
* simplify macro define, remove USE_*
* modern cmake, macro define
* add physics 2d macro define into ccConfig.h
* remove USE_CHIPMUNK macro in build.gradle
* remove CocosSelectModule.cmake
* shrink useless define
* simplify compile options config, re-add if necessary
* update external for tmp CI test
* un-quote target_compile_options value
* add "-g" parameter only when debug mode
* keep single build type when generator Xcode & VS projecy
* update external for tmp CI tes
* add static_cast<char>(-1), fix -Wc++11-narrowing
* simplify win32 compile define
* not modify code, only improve compile options
# Conflicts:
# .gitignore
# cmake/Modules/CocosConfigDepend.cmake
# cocos/CMakeLists.txt
# external/config.json
# tests/cpp-tests/CMakeLists.txt
* modern cmake, improve cmake_compiler_flags (#19145)
* cmake_compiler_flags
* Fix typo
* Fix typo2
* Remove chanages from Android.mk
* correct lua template cmake build (#19149)
* don't add -Wno-deprecated into jsb target
* correct lua template cmake build
* fix win32 lua template compile error
* prevent cmake in-source-build friendly (#19151)
* pick: Copy resources to "Resources/" on win32 like in linux configuration
* add "/Z7" for cpp-tests on windows
* [cmake] fix iOS xcode property setting failed (#19208)
* fix iOS xcode property setting failed
* use search_depend_libs_recursive at dlls collect
* fix typo
* [cmake] add find_host_library into iOS toolchain file (#19230)
* pick: [lua android] use luajit & template cmake update (#19239)
* increase cmake stability , remove tests/CMakeLists.txt (#19261)
* cmake win32 Precompiled header (#19273)
* Precompiled header
* Fix
* Precompiled header for cocos
* Precompiled header jscocos2d
* Fix for COCOS2D_DEBUG is always 1 on Android (#19291)
Related #19289
* little build fix, tests cpp-tests works on mac
* sync v3 build related codes into metal-support (#173)
* strict initialization for std::array
* remove proj.win32 project configs
* modern cmake, cmake_cleanup_remove_unused_variables (#19146)
* Switch travis CI to xenial (#19207)
* Switch travis CI to xenial
* Remove language: android
* Set language: cpp
* Fix java problem
* Update sdkmanager
* Fix sdkmanger
* next sdkmanager fix
* Remove xenial from android
* revert to sdk-tools-{system}-3859397
* Remove linux cmake install
* Update before-install.sh
* Update .travis.yml
* Simplify install-deps-linux.sh, tested on Ubuntu 16.04 (#19212)
* Simplify install-deps-linux.sh
* Cleanup
* pick: install ninja
* update cocos2d-console submodule
* for metal-support alpha release, we only test cpp
* add HelloCpp into project(Cocos2d-x) for tmp test
* update extenal metal-support-4
* update uniform setting
* [Feature] update BindGroup
* [Feature] empty-test
* [Feature] cpp-test
* [Feature] fix GL compiler error
* [Feature] fix GL crash
* [Feature] empty-test
* [Feature] cpp-tests
* [feature] improve frameRate
* [feature] fix opengl compile error
* [feature] fix opengl compile error
* [BugFix] fix compute maxLocation error
* [Feature] update setting unifrom
* [Feature] fix namespace
* [Feature] remove unneeded code
* [Bugfix] fix project file
* [Feature] update review
* [texture2d] impl texture format support (#175)
* texture update
* update
* update texture
* commit
* compile on windows
* ddd
* rename
* rename methods
* no crash
* save gl
* save
* save
* rename
* move out pixel format convert functions
* metal crash
* update
* update android
* support gles compressed texture format
* support more compress format
* add more conversion methods
* ss
* save
* update conversion methods
* add PVRTC format support
* reformat
* add marco linux
* fix GL marcro
* pvrtc supported only by ios 8.0+
* remove unused cmake
* revert change
* refactor Texture2D::initWithData
* fix conversion log
* refactor Texture2D::initWithData
* remove some OpenGL constants for PVRTC
* add todo
* fix typo
* AutoTest works on mac/iOS by disable part cases, sync v3 bug fix (#174)
* review cpp-tests, and fix part issues on start auto test
* sync png format fix: Node:Particle3D abnormal texture effects #19204
* fix cpp-tests SpritePolygon crash, wrong png format (#19170)
* fix wrong png convert format from sRGB to Gray
* erase plist index if all frames was erased
* test_A8.png have I8 format, fix it
* [CCSpriteCache] allow re-add plist & add testcase (#19175)
* allow re-add plist & add testcase
* remove comments/rename method/update testcase
* fix isSpriteFramesWithFileLoaded & add testcase
* remove used variable
* remove unused variable
* fix double free issues when js/lua-tests exit on iOS (#19236)
* disable part cases, AutoTest works without crash on mac
* update cocos2dx files json, to test cocos new next
* fix spritecache plist parsing issue (#19269)
* [linux] Fix FileUtils::getContents with folder (#19157)
* fix FileUtils::getContents on linux/mac
* use stat.st_mode
* simplify
* [CCFileUtils] win32 getFileSize (#19176)
* win32 getFileSize
* fix stat
* [cpp test-Android]20:FileUtils/2 change title (#19197)
* sync #19200
* sync #19231
* [android lua] improve performance of lua loader (#19234)
* [lua] improve performance of lua loader
* remove cache fix
* Revert "fix spritecache plist parsing issue (#19269)"
This reverts commit f3a85ece4307a7b90816c34489d1ed2c8fd11baf.
* remove win32 project files ref in template.json
* add metal framework lnk ref into cpp template
* test on iOS, and disable part cases
* alBufferData instead of alBufferDataStatic for small audio file on Apple (#19227)
* changes AudioCache to use alBufferData instead of alBufferDataStatic
(also makes test 19 faster to trigger openal bugs faster)
The original problem: CrashIfClientProvidedBogusAudioBufferList
https://github.com/cocos2d/cocos2d-x/issues/18948
is not happening anymore, but there's still a not very frequent issue
that makes OpenAL crash with a call stack like this.
AudioCache::readDataTask > alBufferData > CleanUpDeadBufferList
It happes more frequently when the device is "cold", which means after
half an hour of not using the device (locked).
I could not find the actual source code for iOS OpenAL, so I used the
macOS versions:
https://opensource.apple.com/source/OpenAL/OpenAL-48.7/Source/OpenAL/oalImp.cpp.auto.html
They seem to use CAGuard.h to make sure the dead buffer list
has no threading issues. I'm worried because the CAGuard code I found
has macos and win32 define but no iOS, so I'm not sure. I guess the
iOS version is different and has the guard.
I could not find a place in the code that's unprotected by the locks
except the InitializeBufferMap() which should not be called more than
once from cocos, and there's a workaround in AudioEngine-impl for it.
I reduced the occurence of the CleanUpDeadBufferList crash by moving
the guard in ~AudioCache to cover the alDeleteBuffers call.
* remove hack method "setTimeout" on audio
* AutoTest works on iOS
* support set ios deployment target for root project
* enable all texture2d cases, since Jiang have fixed
* add CCTextureUtils to xcode project file (#176)
* add leak cases for SpriteFrameCache (#177)
* re-add SpriteFrameCache cases
* update template file json
* Update SpriteFrameCacheTest.cpp
* fix compiling error
2019-01-18 15:08:25 +08:00
|
|
|
Color4F _clearColor = {0, 0, 0, 1};
|
|
|
|
|
2014-01-11 09:11:14 +08:00
|
|
|
/* Console for the director */
|
2018-10-24 16:00:33 +08:00
|
|
|
Console *_console = nullptr;
|
2014-03-22 20:55:08 +08:00
|
|
|
|
2018-10-24 16:00:33 +08:00
|
|
|
bool _isStatusLabelUpdated = true;
|
2015-04-02 23:35:56 +08:00
|
|
|
|
2016-08-19 09:13:15 +08:00
|
|
|
/* whether or not the director is in a valid state */
|
2018-10-24 16:00:33 +08:00
|
|
|
bool _invalid = false;
|
2016-08-19 09:13:15 +08:00
|
|
|
|
2021-11-07 16:14:31 +08:00
|
|
|
bool _childrenIndexerEnabled = false;
|
|
|
|
|
|
|
|
/* cocos2d thread id */
|
|
|
|
std::thread::id _cocos2d_thread_id;
|
|
|
|
|
2014-07-31 00:53:04 +08:00
|
|
|
// GLView will recreate stats labels to fit visible rect
|
2014-08-02 16:31:16 +08:00
|
|
|
friend class GLView;
|
2010-08-02 10:58:00 +08:00
|
|
|
};
|
|
|
|
|
2016-08-19 09:13:15 +08:00
|
|
|
// end of base group
|
|
|
|
/** @} */
|
2010-08-02 10:58:00 +08:00
|
|
|
|
2012-04-18 18:43:45 +08:00
|
|
|
NS_CC_END
|