2014-01-14 06:48:12 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2012 cocos2d-x.org
|
2018-01-29 16:25:32 +08:00
|
|
|
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
|
|
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
2014-01-14 06:48:12 +08:00
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
// local import
|
|
|
|
#include "Texture2dTest.h"
|
|
|
|
#include "../testResource.h"
|
|
|
|
|
2015-04-09 08:37:30 +08:00
|
|
|
USING_NS_CC;
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
enum {
|
|
|
|
kTagLabel = 1,
|
|
|
|
kTagSprite1 = 2,
|
|
|
|
kTagSprite2 = 3,
|
|
|
|
};
|
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
Texture2DTests::Texture2DTests()
|
|
|
|
{
|
2020-09-03 18:01:40 +08:00
|
|
|
ADD_TEST_CASE(TextureASTC);
|
|
|
|
|
|
|
|
ADD_TEST_CASE(TextureETC1Alpha);
|
|
|
|
ADD_TEST_CASE(TextureETC2);
|
|
|
|
ADD_TEST_CASE(TextureBMP);
|
|
|
|
ADD_TEST_CASE(TexturePNG);
|
|
|
|
ADD_TEST_CASE(TextureJPEG);
|
|
|
|
ADD_TEST_CASE(TextureTGA);
|
|
|
|
ADD_TEST_CASE(TextureWEBP);
|
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
ADD_TEST_CASE(TextureMipMap);
|
|
|
|
ADD_TEST_CASE(TextureMemoryAlloc);
|
|
|
|
ADD_TEST_CASE(TextureAlias);
|
|
|
|
ADD_TEST_CASE(TexturePVRMipMap);
|
|
|
|
ADD_TEST_CASE(TexturePVRMipMap2);
|
|
|
|
ADD_TEST_CASE(TexturePVRNonSquare);
|
|
|
|
ADD_TEST_CASE(TexturePVRNPOT4444);
|
|
|
|
ADD_TEST_CASE(TexturePVRNPOT8888);
|
|
|
|
ADD_TEST_CASE(TexturePVRTest);
|
|
|
|
ADD_TEST_CASE(TexturePVR2BPP);
|
|
|
|
ADD_TEST_CASE(TexturePVR2BPPv3);
|
|
|
|
ADD_TEST_CASE(TexturePVR4BPP);
|
|
|
|
ADD_TEST_CASE(TexturePVR4BPPv3);
|
|
|
|
ADD_TEST_CASE(TexturePVRII4BPPv3);
|
|
|
|
ADD_TEST_CASE(TexturePVRRGBA8888);
|
|
|
|
ADD_TEST_CASE(TexturePVRRGBA8888v3);
|
|
|
|
ADD_TEST_CASE(TexturePVRBGRA8888);
|
|
|
|
ADD_TEST_CASE(TexturePVRBGRA8888v3);
|
|
|
|
ADD_TEST_CASE(TexturePVRRGBA4444);
|
|
|
|
ADD_TEST_CASE(TexturePVRRGBA4444v3);
|
|
|
|
ADD_TEST_CASE(TexturePVRRGBA4444GZ);
|
|
|
|
ADD_TEST_CASE(TexturePVRRGBA4444CCZ);
|
|
|
|
ADD_TEST_CASE(TexturePVRRGBA5551);
|
|
|
|
ADD_TEST_CASE(TexturePVRRGBA5551v3);
|
|
|
|
ADD_TEST_CASE(TexturePVRRGB565);
|
|
|
|
ADD_TEST_CASE(TexturePVRRGB565v3);
|
|
|
|
ADD_TEST_CASE(TexturePVRRGB888);
|
|
|
|
ADD_TEST_CASE(TexturePVRRGB888v3);
|
|
|
|
ADD_TEST_CASE(TexturePVRA8);
|
|
|
|
ADD_TEST_CASE(TexturePVRA8v3);
|
|
|
|
ADD_TEST_CASE(TexturePVRI8);
|
|
|
|
ADD_TEST_CASE(TexturePVRI8v3);
|
|
|
|
ADD_TEST_CASE(TexturePVRAI88);
|
|
|
|
ADD_TEST_CASE(TexturePVRAI88v3);
|
|
|
|
|
|
|
|
ADD_TEST_CASE(TexturePVRv3Premult);
|
|
|
|
|
|
|
|
ADD_TEST_CASE(TexturePVRBadEncoding);
|
2015-12-20 19:22:04 +08:00
|
|
|
ADD_TEST_CASE(TextureWEBPNoAlpha)
|
2015-04-03 14:31:03 +08:00
|
|
|
ADD_TEST_CASE(TexturePixelFormat);
|
|
|
|
ADD_TEST_CASE(TextureBlend);
|
|
|
|
ADD_TEST_CASE(TextureAsync);
|
|
|
|
ADD_TEST_CASE(TextureGlClamp);
|
|
|
|
ADD_TEST_CASE(TextureGlRepeat);
|
|
|
|
ADD_TEST_CASE(TextureSizeTest);
|
|
|
|
ADD_TEST_CASE(TextureCache1);
|
|
|
|
ADD_TEST_CASE(TextureDrawAtPoint);
|
|
|
|
ADD_TEST_CASE(TextureDrawInRect);
|
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
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
ADD_TEST_CASE(TextureS3TCDxt1);
|
|
|
|
ADD_TEST_CASE(TextureS3TCDxt3);
|
|
|
|
ADD_TEST_CASE(TextureS3TCDxt5);
|
|
|
|
ADD_TEST_CASE(TextureS3TCWithNoMipmaps);
|
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
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
ADD_TEST_CASE(TextureATITCRGB);
|
|
|
|
ADD_TEST_CASE(TextureATITCExplicit);
|
|
|
|
ADD_TEST_CASE(TextureATITCInterpolated);
|
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
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
ADD_TEST_CASE(TextureConvertRGB888);
|
|
|
|
ADD_TEST_CASE(TextureConvertRGBA8888);
|
2020-09-25 11:07:56 +08:00
|
|
|
ADD_TEST_CASE(TextureConvertL8);
|
|
|
|
ADD_TEST_CASE(TextureConvertLA8);
|
2012-11-20 10:42:03 +08:00
|
|
|
};
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureDemo
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TextureDemo::onEnter()
|
|
|
|
{
|
2015-04-03 14:31:03 +08:00
|
|
|
TestCase::onEnter();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto col = LayerColor::create(Color4B(128,128,128,255));
|
2013-03-04 11:53:06 +08:00
|
|
|
addChild(col, -10);
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
auto textureCache = Director::getInstance()->getTextureCache();
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", textureCache->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
TextureDemo::~TextureDemo()
|
|
|
|
{
|
2014-01-15 09:22:45 +08:00
|
|
|
auto textureCache = Director::getInstance()->getTextureCache();
|
|
|
|
textureCache->removeUnusedTextures();
|
|
|
|
log("%s\n", textureCache->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2020-09-03 18:01:40 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureASTC
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
void TextureASTC::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
|
|
|
|
|
|
|
auto& s = getContentSize();
|
|
|
|
_background = LayerColor::create(Color4B(15, 19, 42, 255), s.width, s.height);
|
|
|
|
_background->setIgnoreAnchorPointForPosition(false);
|
|
|
|
_background->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
|
|
|
|
|
|
|
_background->setPosition(Vec2(s.width / 2, s.height / 2));
|
|
|
|
this->addChild(_background);
|
|
|
|
|
|
|
|
auto sprite4 = Sprite::create("Images/ASTC_RGBA.astc");
|
|
|
|
sprite4->setPosition(Vec2(s.width * 0.2, s.height * 0.5));
|
|
|
|
_background->addChild(sprite4);
|
|
|
|
|
|
|
|
auto spriteA4 = Sprite::create("Images/ASTC_RGB.astc");
|
|
|
|
spriteA4->setPosition(Vec2(s.width * 0.5, s.height * 0.5));
|
|
|
|
_background->addChild(spriteA4);
|
|
|
|
|
|
|
|
auto sprite8 = Sprite::create("Images/ASTC_RGBA_8x8.astc");
|
|
|
|
sprite8->setPosition(Vec2(s.width * 0.8, s.height * 0.5));
|
|
|
|
_background->addChild(sprite8);
|
|
|
|
|
|
|
|
/*auto img = Sprite::create("Images/astc/astc_6x6.astc");
|
|
|
|
img->setPosition(Vec2(s.width / 2.0f, s.height / 2.0f));
|
|
|
|
this->addChild(img);*/
|
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string TextureASTC::title() const
|
|
|
|
{
|
|
|
|
return "ASTC Test";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureETC1Alpha
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
TextureETC1Alpha::TextureETC1Alpha()
|
|
|
|
{
|
|
|
|
auto listener = EventListenerTouchAllAtOnce::create();
|
|
|
|
listener->onTouchesEnded = CC_CALLBACK_2(TextureETC1Alpha::onTouchesEnded, this);
|
|
|
|
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TextureETC1Alpha::init()
|
|
|
|
{
|
|
|
|
if (!TextureDemo::init())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
auto& canvasSize = getContentSize();
|
|
|
|
_background = LayerColor::create(Color4B(15, 19, 42, 255), canvasSize.width, canvasSize.height);
|
|
|
|
_background->setIgnoreAnchorPointForPosition(false);
|
|
|
|
_background->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
|
|
|
|
|
|
|
auto s = Director::getInstance()->getWinSize();
|
|
|
|
_background->setPosition(Vec2(s.width / 2, s.height / 2));
|
|
|
|
this->addChild(_background);
|
|
|
|
|
|
|
|
addNewSpriteWithCoords(Vec2(s.width / 2, s.height / 2));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TextureETC1Alpha::addNewSpriteWithCoords(Vec2 p)
|
|
|
|
{
|
|
|
|
auto sprite = Sprite::create("Images/grossini_dance_08.png");
|
|
|
|
Texture2D* etcTexture = _director->getTextureCache()->addImage("Images/etc1-alpha.pkm");
|
|
|
|
sprite->setTexture(etcTexture);
|
|
|
|
sprite->setTextureRect(Rect(Vec2::ZERO, etcTexture->getContentSize()));
|
|
|
|
|
|
|
|
_background->addChild(sprite);
|
|
|
|
|
|
|
|
sprite->setPosition(Vec2(p.x, p.y));
|
|
|
|
|
|
|
|
ActionInterval* action;
|
|
|
|
float random = CCRANDOM_0_1();
|
|
|
|
|
|
|
|
if (random < 0.20)
|
|
|
|
action = ScaleBy::create(3, 2);
|
|
|
|
else if (random < 0.40)
|
|
|
|
action = RotateBy::create(3, 360);
|
|
|
|
else if (random < 0.60)
|
|
|
|
action = Blink::create(1, 3);
|
|
|
|
else if (random < 0.8)
|
|
|
|
action = TintBy::create(2, 0, -255, -255);
|
|
|
|
else
|
|
|
|
action = FadeOut::create(2);
|
|
|
|
auto action_back = action->reverse();
|
|
|
|
auto seq = Sequence::create(action, action_back, nullptr);
|
|
|
|
|
|
|
|
sprite->runAction(RepeatForever::create(seq));
|
|
|
|
}
|
|
|
|
|
|
|
|
void TextureETC1Alpha::onTouchesEnded(const std::vector<Touch*>& touches, Event* event)
|
|
|
|
{
|
|
|
|
for (auto touch : touches)
|
|
|
|
{
|
|
|
|
auto location = touch->getLocation();
|
|
|
|
|
|
|
|
addNewSpriteWithCoords(location);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string TextureETC1Alpha::title() const
|
|
|
|
{
|
2020-09-25 11:07:56 +08:00
|
|
|
return "Testing Texture ETC1 Alpha support";
|
2020-09-03 18:01:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string TextureETC1Alpha::subtitle() const
|
|
|
|
{
|
|
|
|
return "Tap screen to add more sprites";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureETC2
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
TextureETC2::TextureETC2()
|
|
|
|
{
|
|
|
|
auto listener = EventListenerTouchAllAtOnce::create();
|
|
|
|
listener->onTouchesEnded = CC_CALLBACK_2(TextureETC2::onTouchesEnded, this);
|
|
|
|
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TextureETC2::init()
|
|
|
|
{
|
|
|
|
if (!TextureDemo::init())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
auto& canvasSize = getContentSize();
|
|
|
|
_background = LayerColor::create(Color4B(15, 19, 42, 255), canvasSize.width, canvasSize.height);
|
|
|
|
_background->setIgnoreAnchorPointForPosition(false);
|
|
|
|
_background->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
|
|
|
|
|
|
|
auto s = Director::getInstance()->getWinSize();
|
|
|
|
_background->setPosition(Vec2(s.width / 2, s.height / 2));
|
|
|
|
this->addChild(_background);
|
|
|
|
|
|
|
|
addNewSpriteWithCoords();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TextureETC2::addNewSpriteWithCoords()
|
|
|
|
{
|
|
|
|
auto s = Director::getInstance()->getWinSize();
|
|
|
|
auto sprite4 = Sprite::create("Images/etc2_rgb.pkm");
|
|
|
|
sprite4->setPosition(Vec2(s.width * 0.3, s.height * 0.5));
|
|
|
|
_background->addChild(sprite4);
|
|
|
|
|
|
|
|
auto spriteA4 = Sprite::create("Images/etc2_rgba.pkm");
|
|
|
|
spriteA4->setPosition(Vec2(s.width * 0.7, s.height * 0.5));
|
|
|
|
_background->addChild(spriteA4);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TextureETC2::onTouchesEnded(const std::vector<Touch*>& touches, Event* event)
|
|
|
|
{
|
|
|
|
//for (auto touch : touches)
|
|
|
|
//{
|
|
|
|
// auto location = touch->getLocation();
|
|
|
|
|
|
|
|
// addNewSpriteWithCoords();
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string TextureETC2::title() const
|
|
|
|
{
|
|
|
|
return "Testing Texture ETC2 support";
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string TextureETC2::subtitle() const
|
|
|
|
{
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureBMP
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
TextureBMP::TextureBMP()
|
|
|
|
{
|
|
|
|
auto listener = EventListenerTouchAllAtOnce::create();
|
|
|
|
listener->onTouchesEnded = CC_CALLBACK_2(TextureBMP::onTouchesEnded, this);
|
|
|
|
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
|
|
|
|
|
|
|
auto s = Director::getInstance()->getWinSize();
|
|
|
|
addNewSpriteWithCoords(Vec2(s.width / 2, s.height / 2));
|
|
|
|
}
|
|
|
|
|
|
|
|
void TextureBMP::addNewSpriteWithCoords(Vec2 p)
|
|
|
|
{
|
|
|
|
int idx = (int)(CCRANDOM_0_1() * 1400.0f / 100.0f);
|
|
|
|
int x = (idx % 5) * 85;
|
|
|
|
int y = (idx / 5) * 121;
|
|
|
|
|
|
|
|
|
|
|
|
auto sprite = Sprite::create("Images/x-studio_64.bmp");
|
|
|
|
addChild(sprite);
|
|
|
|
|
|
|
|
sprite->setPosition(Vec2(p.x, p.y));
|
|
|
|
|
|
|
|
ActionInterval* action;
|
|
|
|
float random = CCRANDOM_0_1();
|
|
|
|
|
|
|
|
if (random < 0.20)
|
|
|
|
action = ScaleBy::create(3, 2);
|
|
|
|
else if (random < 0.40)
|
|
|
|
action = RotateBy::create(3, 360);
|
|
|
|
else if (random < 0.60)
|
|
|
|
action = Blink::create(1, 3);
|
|
|
|
else if (random < 0.8)
|
|
|
|
action = TintBy::create(2, 0, -255, -255);
|
|
|
|
else
|
|
|
|
action = FadeOut::create(2);
|
|
|
|
auto action_back = action->reverse();
|
|
|
|
auto seq = Sequence::create(action, action_back, nullptr);
|
|
|
|
|
|
|
|
sprite->runAction(RepeatForever::create(seq));
|
|
|
|
}
|
|
|
|
|
|
|
|
void TextureBMP::onTouchesEnded(const std::vector<Touch*>& touches, Event* event)
|
|
|
|
{
|
|
|
|
for (auto touch : touches)
|
|
|
|
{
|
|
|
|
auto location = touch->getLocation();
|
|
|
|
|
|
|
|
addNewSpriteWithCoords(location);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string TextureBMP::title() const
|
|
|
|
{
|
|
|
|
return "Testing TextureBMP";
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string TextureBMP::subtitle() const
|
|
|
|
{
|
|
|
|
return "Tap screen to add more sprites";
|
|
|
|
}
|
2013-11-29 14:31:42 +08:00
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureTGA
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
void TextureTGA::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
|
|
|
auto s = Director::getInstance()->getWinSize();
|
|
|
|
|
|
|
|
auto img = Sprite::create("TileMaps/levelmap.tga");
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2013-11-29 14:31:42 +08:00
|
|
|
this->addChild(img);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2013-11-29 14:31:42 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureTGA::title() const
|
2013-11-29 14:31:42 +08:00
|
|
|
{
|
|
|
|
return "TGA Test";
|
|
|
|
}
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePNG
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePNG::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image.png");
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2014-06-05 16:33:42 +08:00
|
|
|
|
|
|
|
// Test PNG files with different pixel formats
|
|
|
|
// grayscale without alpha
|
2014-06-06 10:37:45 +08:00
|
|
|
auto i8 = Sprite::create("Images/test_image_i8.png");
|
2014-06-05 16:33:42 +08:00
|
|
|
i8->setPosition(s.width/4.0f, s.height/4.0f);
|
|
|
|
addChild(i8);
|
|
|
|
|
|
|
|
// grayscale with alpha
|
2014-06-06 10:37:45 +08:00
|
|
|
auto ai88 = Sprite::create("Images/test_image_ai88.png");
|
2014-06-05 16:33:42 +08:00
|
|
|
ai88->setPosition(s.width / 4.0f, s.height * 3.0f / 4.0f);
|
|
|
|
addChild(ai88);
|
|
|
|
|
|
|
|
// rgb without alpha
|
2014-06-06 10:37:45 +08:00
|
|
|
auto rgb888 = Sprite::create("Images/test_image_rgb888.png");
|
2014-06-05 16:33:42 +08:00
|
|
|
rgb888->setPosition(s.width * 3.0f / 4.0f, s.height / 4.0f);
|
|
|
|
addChild(rgb888);
|
|
|
|
|
|
|
|
// rgba with alpha
|
2014-06-06 10:37:45 +08:00
|
|
|
auto rgba8888 = Sprite::create("Images/test_image_rgba8888.png");
|
2014-06-05 16:33:42 +08:00
|
|
|
rgba8888->setPosition(s.width * 3.0f / 4.0f, s.height * 3.0f / 4.0f);
|
|
|
|
addChild(rgba8888);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePNG::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PNG Test";
|
|
|
|
}
|
|
|
|
|
2014-06-05 16:33:42 +08:00
|
|
|
std::string TexturePNG::subtitle() const
|
|
|
|
{
|
|
|
|
return "LB:I8, LT:AI8\nRB:RGB888, RT: RGBA8888";
|
|
|
|
}
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureJPEG
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TextureJPEG::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image.jpeg");
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureJPEG::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "JPEG Test";
|
|
|
|
}
|
|
|
|
|
2013-02-05 11:37:13 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureWEBP
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TextureWEBP::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2013-02-05 11:37:13 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image.webp");
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2013-02-05 11:37:13 +08:00
|
|
|
addChild(img);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2015-12-20 19:22:04 +08:00
|
|
|
Texture2D* texture = Director::getInstance()->getTextureCache()->getTextureForKey("Images/test_image.webp");
|
2016-04-18 17:52:58 +08:00
|
|
|
log("pixel format:%d, premultiplied alpha:%d\n", static_cast<int>(texture->getPixelFormat()), texture->hasPremultipliedAlpha());
|
2013-02-05 11:37:13 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureWEBP::title() const
|
2013-02-05 11:37:13 +08:00
|
|
|
{
|
2015-12-20 19:22:04 +08:00
|
|
|
return "WEBP with alpha Test";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureWEBPNoAlpha
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TextureWEBPNoAlpha::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
|
|
|
auto s = Director::getInstance()->getWinSize();
|
|
|
|
|
|
|
|
auto img = Sprite::create("Images/test_image_no_alpha.webp");
|
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
|
|
|
addChild(img);
|
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
|
|
|
Texture2D* texture = Director::getInstance()->getTextureCache()->getTextureForKey("Images/test_image_no_alpha.webp");
|
2016-04-18 17:52:58 +08:00
|
|
|
log("pixel format:%d, premultiplied alpha:%d\n", static_cast<int>(texture->getPixelFormat()), texture->hasPremultipliedAlpha());
|
2015-12-20 19:22:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string TextureWEBPNoAlpha::title() const
|
|
|
|
{
|
|
|
|
return "WEBP without alpha Test";
|
2013-02-05 11:37:13 +08:00
|
|
|
}
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureMipMap
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TextureMipMap::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-11-07 21:48:39 +08:00
|
|
|
auto texture0 = Director::getInstance()->getTextureCache()->addImage("Images/grossini_dance_atlas.png");
|
2019-06-03 09:39:51 +08:00
|
|
|
texture0->generateMipmap();
|
|
|
|
Texture2D::TexParams texParams = {
|
|
|
|
backend::SamplerFilter::LINEAR_MIPMAP_LINEAR,
|
|
|
|
backend::SamplerFilter::LINEAR,
|
|
|
|
backend::SamplerAddressMode::CLAMP_TO_EDGE,
|
|
|
|
backend::SamplerAddressMode::CLAMP_TO_EDGE };
|
|
|
|
texture0->setTexParameters(texParams);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-11-07 21:48:39 +08:00
|
|
|
auto texture1 = Director::getInstance()->getTextureCache()->addImage("Images/grossini_dance_atlas_nomipmap.png");
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img0 = Sprite::createWithTexture(texture0);
|
2013-07-12 14:30:26 +08:00
|
|
|
img0->setTextureRect(Rect(85, 121, 85, 121));
|
2014-05-15 01:07:09 +08:00
|
|
|
img0->setPosition(Vec2( s.width/3.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img0);
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img1 = Sprite::createWithTexture(texture1);
|
2013-07-12 14:30:26 +08:00
|
|
|
img1->setTextureRect(Rect(85, 121, 85, 121));
|
2014-05-15 01:07:09 +08:00
|
|
|
img1->setPosition(Vec2( 2*s.width/3.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img1);
|
|
|
|
|
|
|
|
|
2013-06-22 11:02:43 +08:00
|
|
|
auto scale1 = EaseOut::create(ScaleBy::create(4, 0.01f), 3);
|
|
|
|
auto sc_back = scale1->reverse();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-22 11:02:43 +08:00
|
|
|
auto scale2 = scale1->clone();
|
|
|
|
auto sc_back2 = scale2->reverse();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
img0->runAction(RepeatForever::create(Sequence::create(scale1, sc_back, nullptr)));
|
|
|
|
img1->runAction(RepeatForever::create(Sequence::create(scale2, sc_back2, nullptr)));
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureMipMap::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Texture Mipmap";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureMipMap::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Left image uses mipmap. Right image doesn't";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVRMipMap
|
|
|
|
// To generate PVR images read this article:
|
|
|
|
// http://developer.apple.com/iphone/library/qa/qa2008/qa1611.html
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVRMipMap::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto imgMipMap = Sprite::create("Images/logo-mipmap.pvr");
|
2012-04-19 14:35:52 +08:00
|
|
|
if( imgMipMap )
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
imgMipMap->setPosition(Vec2( s.width/2.0f-100, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(imgMipMap);
|
|
|
|
|
|
|
|
// support mipmap filtering
|
2019-06-03 09:39:51 +08:00
|
|
|
Texture2D::TexParams texParams = {
|
|
|
|
backend::SamplerFilter::LINEAR_MIPMAP_LINEAR,
|
|
|
|
backend::SamplerFilter::LINEAR,
|
|
|
|
backend::SamplerAddressMode::CLAMP_TO_EDGE,
|
|
|
|
backend::SamplerAddressMode::CLAMP_TO_EDGE };
|
|
|
|
imgMipMap->getTexture()->setTexParameters(texParams);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/logo-nomipmap.pvr");
|
2012-04-19 14:35:52 +08:00
|
|
|
if( img )
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f+100, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
|
|
|
|
2013-06-22 11:02:43 +08:00
|
|
|
auto scale1 = EaseOut::create(ScaleBy::create(4, 0.01f), 3);
|
|
|
|
auto sc_back = scale1->reverse();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-22 11:02:43 +08:00
|
|
|
auto scale2 = scale1->clone();
|
|
|
|
auto sc_back2 = scale2->reverse();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
imgMipMap->runAction(RepeatForever::create(Sequence::create(scale1, sc_back, nullptr)));
|
|
|
|
img->runAction(RepeatForever::create(Sequence::create(scale2, sc_back2, nullptr)));
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRMipMap::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVRTC MipMap Test";
|
|
|
|
}
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRMipMap::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Left image uses mipmap. Right image doesn't";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVRMipMap2
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVRMipMap2::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto imgMipMap = Sprite::create("Images/test_image_rgba4444_mipmap.pvr");
|
2014-05-15 01:07:09 +08:00
|
|
|
imgMipMap->setPosition(Vec2( s.width/2.0f-100, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(imgMipMap);
|
|
|
|
|
|
|
|
// support mipmap filtering
|
2019-06-03 09:39:51 +08:00
|
|
|
Texture2D::TexParams texParams = {
|
|
|
|
backend::SamplerFilter::LINEAR_MIPMAP_LINEAR,
|
|
|
|
backend::SamplerFilter::LINEAR,
|
|
|
|
backend::SamplerAddressMode::CLAMP_TO_EDGE,
|
|
|
|
backend::SamplerAddressMode::CLAMP_TO_EDGE };
|
|
|
|
imgMipMap->getTexture()->setTexParameters(texParams);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image.png");
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f+100, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
|
|
|
|
2013-06-22 11:02:43 +08:00
|
|
|
auto scale1 = EaseOut::create(ScaleBy::create(4, 0.01f), 3);
|
|
|
|
auto sc_back = scale1->reverse();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-22 11:02:43 +08:00
|
|
|
auto scale2 = scale1->clone();
|
|
|
|
auto sc_back2 = scale2->reverse();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
imgMipMap->runAction(RepeatForever::create(Sequence::create(scale1, sc_back, nullptr)));
|
|
|
|
img->runAction(RepeatForever::create(Sequence::create(scale2, sc_back2, nullptr)));
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRMipMap2::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR MipMap Test #2";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRMipMap2::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Left image uses mipmap. Right image doesn't";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVR2BPP
|
|
|
|
// Image generated using PVRTexTool:
|
|
|
|
// http://www.imgtec.com/powervr/insider/powervr-pvrtextool.asp
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVR2BPP::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_pvrtc2bpp.pvr");
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
if( img )
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVR2BPP::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR TC 2bpp Test";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVR
|
|
|
|
// To generate PVR images read this article:
|
|
|
|
// http://developer.apple.com/iphone/library/qa/qa2008/qa1611.html
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2013-06-20 13:43:40 +08:00
|
|
|
void TexturePVRTest::onEnter()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image.pvr");
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
if( img )
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-07-24 06:20:22 +08:00
|
|
|
log("This test is not supported.");
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRTest::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR TC 4bpp Test #2";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVR4BPP
|
|
|
|
// Image generated using PVRTexTool:
|
|
|
|
// http://www.imgtec.com/powervr/insider/powervr-pvrtextool.asp
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVR4BPP::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_pvrtc4bpp.pvr");
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
if( img )
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-07-24 06:20:22 +08:00
|
|
|
log("This test is not supported in cocos2d-mac");
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVR4BPP::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR TC 4bpp Test #3";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVRRGBA8888
|
|
|
|
// Image generated using PVRTexTool:
|
|
|
|
// http://www.imgtec.com/powervr/insider/powervr-pvrtextool.asp
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVRRGBA8888::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_rgba8888.pvr");
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGBA8888::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR + RGBA 8888 Test";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVRBGRA8888
|
|
|
|
// Image generated using PVRTexTool:
|
|
|
|
// http://www.imgtec.com/powervr/insider/powervr-pvrtextool.asp
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVRBGRA8888::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_bgra8888.pvr");
|
2012-04-19 14:35:52 +08:00
|
|
|
if( img )
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-07-24 06:20:22 +08:00
|
|
|
log("BGRA8888 images are not supported");
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRBGRA8888::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR + BGRA 8888 Test";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVRRGBA5551
|
|
|
|
// Image generated using PVRTexTool:
|
|
|
|
// http://www.imgtec.com/powervr/insider/powervr-pvrtextool.asp
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVRRGBA5551::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
|
|
|
auto img = Sprite::create("Images/test_image_rgba5551.pvr");
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGBA5551::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR + RGBA 5551 Test";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVRRGBA4444
|
|
|
|
// Image generated using PVRTexTool:
|
|
|
|
// http://www.imgtec.com/powervr/insider/powervr-pvrtextool.asp
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVRRGBA4444::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_rgba4444.pvr");
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGBA4444::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR + RGBA 4444 Test";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVRRGBA4444GZ
|
|
|
|
// Image generated using PVRTexTool:
|
|
|
|
// http://www.imgtec.com/powervr/insider/powervr-pvrtextool.asp
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVRRGBA4444GZ::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
|
|
|
// android can not pack .gz file into apk file
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_rgba4444.pvr");
|
2012-04-19 14:35:52 +08:00
|
|
|
#else
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_rgba4444.pvr.gz");
|
2012-04-19 14:35:52 +08:00
|
|
|
#endif
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGBA4444GZ::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR + RGBA 4444 + GZ Test";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGBA4444GZ::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "This is a gzip PVR image";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVRRGBA4444CCZ
|
|
|
|
// Image generated using PVRTexTool:
|
|
|
|
// http://www.imgtec.com/powervr/insider/powervr-pvrtextool.asp
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVRRGBA4444CCZ::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_rgba4444.pvr.ccz");
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGBA4444CCZ::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR + RGBA 4444 + CCZ Test";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGBA4444CCZ::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "This is a ccz PVR image";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVRRGB565
|
|
|
|
// Image generated using PVRTexTool:
|
|
|
|
// http://www.imgtec.com/powervr/insider/powervr-pvrtextool.asp
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVRRGB565::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_rgb565.pvr");
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGB565::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR + RGB 565 Test";
|
|
|
|
}
|
|
|
|
|
|
|
|
// TexturePVR RGB888
|
|
|
|
// Image generated using PVRTexTool:
|
|
|
|
// http://www.imgtec.com/powervr/insider/powervr-pvrtextool.asp
|
|
|
|
void TexturePVRRGB888::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_rgb888.pvr");
|
2014-07-10 00:45:27 +08:00
|
|
|
if (img != nullptr)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
}
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGB888::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR + RGB 888 Test";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVRA8
|
|
|
|
// Image generated using PVRTexTool:
|
|
|
|
// http://www.imgtec.com/powervr/insider/powervr-pvrtextool.asp
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVRA8::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_a8.pvr");
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRA8::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR + A8 Test";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVRI8
|
|
|
|
// Image generated using PVRTexTool:
|
|
|
|
// http://www.imgtec.com/powervr/insider/powervr-pvrtextool.asp
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVRI8::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_i8.pvr");
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRI8::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR + I8 Test";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVRAI88
|
|
|
|
// Image generated using PVRTexTool:
|
|
|
|
// http://www.imgtec.com/powervr/insider/powervr-pvrtextool.asp
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVRAI88::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_ai88.pvr");
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRAI88::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR + AI88 Test";
|
|
|
|
}
|
|
|
|
|
2012-11-20 10:42:03 +08:00
|
|
|
// TexturePVR2BPPv3
|
|
|
|
void TexturePVR2BPPv3::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-11-20 10:42:03 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_pvrtc2bpp_v3.pvr");
|
2012-11-20 10:42:03 +08:00
|
|
|
|
|
|
|
if (img)
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2(s.width/2.0f, s.height/2.0f));
|
2012-11-20 10:42:03 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-11-20 10:42:03 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVR2BPPv3::title() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "PVR TC 2bpp Test";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVR2BPPv3::subtitle() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "Testing PVR File Format v3";
|
|
|
|
}
|
|
|
|
|
|
|
|
// TexturePVRII2BPPv3
|
|
|
|
void TexturePVRII2BPPv3::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-11-20 10:42:03 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_pvrtcii2bpp_v3.pvr");
|
2012-11-20 10:42:03 +08:00
|
|
|
|
|
|
|
if (img)
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2(s.width/2.0f, s.height/2.0f));
|
2012-11-20 10:42:03 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-11-20 10:42:03 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRII2BPPv3::title() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "PVR TC II 2bpp Test";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRII2BPPv3::subtitle() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "Testing PVR File Format v3";
|
|
|
|
}
|
|
|
|
|
|
|
|
// TexturePVR4BPPv3
|
|
|
|
void TexturePVR4BPPv3::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-11-20 10:42:03 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_pvrtc4bpp_v3.pvr");
|
2012-11-20 10:42:03 +08:00
|
|
|
|
|
|
|
if (img)
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2(s.width/2.0f, s.height/2.0f));
|
2012-11-20 10:42:03 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-07-24 06:20:22 +08:00
|
|
|
log("This test is not supported");
|
2012-11-20 10:42:03 +08:00
|
|
|
}
|
|
|
|
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-11-20 10:42:03 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVR4BPPv3::title() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "PVR TC 4bpp Test";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVR4BPPv3::subtitle() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "Testing PVR File Format v3";
|
|
|
|
}
|
|
|
|
|
|
|
|
// TexturePVRII4BPPv3
|
|
|
|
|
|
|
|
// Image generated using PVRTexTool:
|
|
|
|
// http://www.imgtec.com/powervr/insider/powervr-pvrtextool.asp
|
|
|
|
|
|
|
|
void TexturePVRII4BPPv3::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-11-20 10:42:03 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_pvrtcii4bpp_v3.pvr");
|
2012-11-20 10:42:03 +08:00
|
|
|
|
|
|
|
if (img)
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2(s.width/2.0f, s.height/2.0f));
|
2012-11-20 10:42:03 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-07-24 06:20:22 +08:00
|
|
|
log("This test is not supported");
|
2012-11-20 10:42:03 +08:00
|
|
|
}
|
|
|
|
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-11-20 10:42:03 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRII4BPPv3::title() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "PVR TC II 4bpp Test";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRII4BPPv3::subtitle() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "Testing PVR File Format v3";
|
|
|
|
}
|
|
|
|
|
|
|
|
// TexturePVRRGBA8888v3
|
|
|
|
void TexturePVRRGBA8888v3::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-11-20 10:42:03 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_rgba8888_v3.pvr");
|
2012-11-20 10:42:03 +08:00
|
|
|
|
|
|
|
if (img)
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2(s.width/2.0f, s.height/2.0f));
|
2012-11-20 10:42:03 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-11-20 10:42:03 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGBA8888v3::title() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "PVR + RGBA 8888 Test";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGBA8888v3::subtitle() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "Testing PVR File Format v3";
|
|
|
|
}
|
|
|
|
|
|
|
|
// TexturePVRBGRA8888v3
|
|
|
|
void TexturePVRBGRA8888v3::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-11-20 10:42:03 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_bgra8888_v3.pvr");
|
2012-11-20 10:42:03 +08:00
|
|
|
|
|
|
|
if (img)
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2(s.width/2.0f, s.height/2.0f));
|
2012-11-20 10:42:03 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-07-24 06:20:22 +08:00
|
|
|
log("BGRA images are not supported");
|
2012-11-20 10:42:03 +08:00
|
|
|
}
|
|
|
|
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-11-20 10:42:03 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRBGRA8888v3::title() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "PVR + BGRA 8888 Test";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRBGRA8888v3::subtitle() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "Testing PVR File Format v3";
|
|
|
|
}
|
|
|
|
|
|
|
|
// TexturePVRRGBA5551v3
|
|
|
|
void TexturePVRRGBA5551v3::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-11-20 10:42:03 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_rgba5551_v3.pvr");
|
2012-11-20 10:42:03 +08:00
|
|
|
|
|
|
|
if (img)
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2(s.width/2.0f, s.height/2.0f));
|
2012-11-20 10:42:03 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-11-20 10:42:03 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGBA5551v3::title() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "PVR + RGBA 5551 Test";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGBA5551v3::subtitle() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "Testing PVR File Format v3";
|
|
|
|
}
|
|
|
|
|
|
|
|
// TexturePVRRGBA4444v3
|
|
|
|
void TexturePVRRGBA4444v3::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-11-20 10:42:03 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_rgba4444_v3.pvr");
|
2012-11-20 10:42:03 +08:00
|
|
|
|
|
|
|
if (img)
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2(s.width/2.0f, s.height/2.0f));
|
2012-11-20 10:42:03 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-11-20 10:42:03 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGBA4444v3::title() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "PVR + RGBA 4444 Test";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGBA4444v3::subtitle() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "Testing PVR File Format v3";
|
|
|
|
}
|
|
|
|
|
|
|
|
// TexturePVRRGB565v3
|
|
|
|
void TexturePVRRGB565v3::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-11-20 10:42:03 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_rgb565_v3.pvr");
|
2012-11-20 10:42:03 +08:00
|
|
|
|
|
|
|
if (img)
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2(s.width/2.0f, s.height/2.0f));
|
2012-11-20 10:42:03 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-11-20 10:42:03 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGB565v3::title() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "PVR + RGB 565 Test";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGB565v3::subtitle() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "Testing PVR File Format v3";
|
|
|
|
}
|
|
|
|
|
|
|
|
// TexturePVRRGB888v3
|
|
|
|
void TexturePVRRGB888v3::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-11-20 10:42:03 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_rgb888_v3.pvr");
|
2012-11-20 10:42:03 +08:00
|
|
|
|
|
|
|
if (img)
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2(s.width/2.0f, s.height/2.0f));
|
2012-11-20 10:42:03 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-11-20 10:42:03 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGB888v3::title() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "PVR + RGB 888 Test";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRRGB888v3::subtitle() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "Testing PVR File Format v3";
|
|
|
|
}
|
|
|
|
|
|
|
|
// TexturePVRA8v3
|
|
|
|
void TexturePVRA8v3::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-11-20 10:42:03 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_a8_v3.pvr");
|
2012-11-20 10:42:03 +08:00
|
|
|
|
|
|
|
if (img)
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2(s.width/2.0f, s.height/2.0f));
|
2012-11-20 10:42:03 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-11-20 10:42:03 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRA8v3::title() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "PVR + A8 Test";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRA8v3::subtitle() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "Testing PVR File Format v3";
|
|
|
|
}
|
|
|
|
|
|
|
|
// TexturePVRI8v3
|
|
|
|
void TexturePVRI8v3::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-11-20 10:42:03 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_i8_v3.pvr");
|
2012-11-20 10:42:03 +08:00
|
|
|
|
|
|
|
if (img)
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2(s.width/2.0f, s.height/2.0f));
|
2012-11-20 10:42:03 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-11-20 10:42:03 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRI8v3::title() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "PVR + I8 Test";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRI8v3::subtitle() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "Testing PVR File Format v3";
|
|
|
|
}
|
|
|
|
|
|
|
|
// TexturePVRAI88v3
|
|
|
|
void TexturePVRAI88v3::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-11-20 10:42:03 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image_ai88_v3.pvr");
|
2012-11-20 10:42:03 +08:00
|
|
|
|
|
|
|
if (img)
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2(s.width/2.0f, s.height/2.0f));
|
2012-11-20 10:42:03 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-11-20 10:42:03 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRAI88v3::title() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "PVR + AI88 Test";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRAI88v3::subtitle() const
|
2012-11-20 10:42:03 +08:00
|
|
|
{
|
|
|
|
return "Testing PVR File Format v3";
|
|
|
|
}
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVRBadEncoding
|
|
|
|
// Image generated using PVRTexTool:
|
|
|
|
// http://www.imgtec.com/powervr/insider/powervr-pvrtextool.asp
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVRBadEncoding::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/test_image-bad_encoding.pvr");
|
2012-04-19 14:35:52 +08:00
|
|
|
if( img )
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRBadEncoding::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR Unsupported encoding";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRBadEncoding::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "You should not see any image";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVRNonSquare
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVRNonSquare::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/grossini_128x256_mipmap.pvr");
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRNonSquare::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR + Non square texture";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRNonSquare::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Loading a 128x256 texture";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVRNPOT4444
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVRNPOT4444::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/grossini_pvr_rgba4444.pvr");
|
2012-04-19 14:35:52 +08:00
|
|
|
if ( img )
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRNPOT4444::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR RGBA4 + NPOT texture";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRNPOT4444::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Loading a 81x121 RGBA4444 texture.";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePVRNPOT8888
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePVRNPOT8888::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto img = Sprite::create("Images/grossini_pvr_rgba8888.pvr");
|
2012-04-19 14:35:52 +08:00
|
|
|
if( img )
|
|
|
|
{
|
2014-05-15 01:07:09 +08:00
|
|
|
img->setPosition(Vec2( s.width/2.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(img);
|
|
|
|
}
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRNPOT8888::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "PVR RGBA8 + NPOT texture";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRNPOT8888::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Loading a 81x121 RGBA8888 texture.";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureAlias
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TextureAlias::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// Sprite 1: GL_LINEAR
|
|
|
|
//
|
|
|
|
// Default filter is GL_LINEAR
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sprite = Sprite::create("Images/grossinis_sister1.png");
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite->setPosition(Vec2( s.width/3.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(sprite);
|
|
|
|
|
2017-02-10 10:35:52 +08:00
|
|
|
// this is the default filtering
|
2012-04-19 14:35:52 +08:00
|
|
|
sprite->getTexture()->setAntiAliasTexParameters();
|
|
|
|
|
|
|
|
//
|
|
|
|
// Sprite 1: GL_NEAREST
|
|
|
|
//
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sprite2 = Sprite::create("Images/grossinis_sister2.png");
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite2->setPosition(Vec2( 2*s.width/3.0f, s.height/2.0f));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(sprite2);
|
|
|
|
|
|
|
|
// Use Nearest in this one
|
|
|
|
sprite2->getTexture()->setAliasTexParameters();
|
|
|
|
|
|
|
|
// scale them to show
|
2013-06-22 11:02:43 +08:00
|
|
|
auto sc = ScaleBy::create(3, 8.0f);
|
|
|
|
auto sc_back = sc->reverse();
|
2014-07-10 00:45:27 +08:00
|
|
|
auto scaleforever = RepeatForever::create(Sequence::create(sc, sc_back, nullptr));
|
2013-06-22 11:02:43 +08:00
|
|
|
auto scaleToo = scaleforever->clone();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
sprite2->runAction(scaleforever);
|
|
|
|
sprite->runAction(scaleToo);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureAlias::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "AntiAlias / Alias textures";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureAlias::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Left image is antialiased. Right image is aliases";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TexturePixelFormat
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TexturePixelFormat::onEnter()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
// This example displays 1 png images 4 times.
|
|
|
|
// Each time the image is generated using:
|
|
|
|
// 1- 32-bit RGBA8
|
|
|
|
// 2- 16-bit RGBA4
|
|
|
|
// 3- 16-bit RGB5A1
|
|
|
|
// 4- 16-bit RGB565
|
|
|
|
TextureDemo::onEnter();
|
2013-06-07 08:12:28 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto background = LayerColor::create(Color4B(128,128,128,255), s.width, s.height);
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(background, -1);
|
|
|
|
|
|
|
|
// RGBA 8888 image (32-bit)
|
2020-09-25 11:07:56 +08:00
|
|
|
Texture2D::setDefaultAlphaPixelFormat(backend::PixelFormat::RGBA8);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sprite1 = Sprite::create("Images/test-rgba1.png");
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite1->setPosition(Vec2(1*s.width/7, s.height/2+32));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(sprite1, 0);
|
|
|
|
|
|
|
|
// remove texture from texture manager
|
2013-11-07 21:48:39 +08:00
|
|
|
Director::getInstance()->getTextureCache()->removeTexture(sprite1->getTexture());
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// RGBA 4444 image (16-bit)
|
2020-09-25 11:07:56 +08:00
|
|
|
Texture2D::setDefaultAlphaPixelFormat(backend::PixelFormat::RGBA4);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sprite2 = Sprite::create("Images/test-rgba1.png");
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite2->setPosition(Vec2(2*s.width/7, s.height/2-32));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(sprite2, 0);
|
|
|
|
|
|
|
|
// remove texture from texture manager
|
2013-11-07 21:48:39 +08:00
|
|
|
Director::getInstance()->getTextureCache()->removeTexture(sprite2->getTexture());
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// RGB5A1 image (16-bit)
|
2019-06-03 09:39:51 +08:00
|
|
|
Texture2D::setDefaultAlphaPixelFormat(backend::PixelFormat::RGB5A1);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sprite3 = Sprite::create("Images/test-rgba1.png");
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite3->setPosition(Vec2(3*s.width/7, s.height/2+32));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(sprite3, 0);
|
|
|
|
|
|
|
|
// remove texture from texture manager
|
2013-11-07 21:48:39 +08:00
|
|
|
Director::getInstance()->getTextureCache()->removeTexture(sprite3->getTexture());
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// RGB888 image
|
2020-09-25 11:07:56 +08:00
|
|
|
Texture2D::setDefaultAlphaPixelFormat(backend::PixelFormat::RGB8);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sprite4 = Sprite::create("Images/test-rgba1.png");
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite4->setPosition(Vec2(4*s.width/7, s.height/2-32));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(sprite4, 0);
|
|
|
|
|
|
|
|
// remove texture from texture manager
|
2013-11-07 21:48:39 +08:00
|
|
|
Director::getInstance()->getTextureCache()->removeTexture(sprite4->getTexture());
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// RGB565 image (16-bit)
|
2019-06-03 09:39:51 +08:00
|
|
|
Texture2D::setDefaultAlphaPixelFormat(backend::PixelFormat::RGB565);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sprite5 = Sprite::create("Images/test-rgba1.png");
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite5->setPosition(Vec2(5*s.width/7, s.height/2+32));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(sprite5, 0);
|
|
|
|
|
|
|
|
// remove texture from texture manager
|
2013-11-07 21:48:39 +08:00
|
|
|
Director::getInstance()->getTextureCache()->removeTexture(sprite5->getTexture());
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// A8 image (8-bit)
|
2019-06-03 09:39:51 +08:00
|
|
|
Texture2D::setDefaultAlphaPixelFormat(backend::PixelFormat::A8);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sprite6 = Sprite::create("Images/test-rgba1.png");
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite6->setPosition(Vec2(6*s.width/7, s.height/2-32));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(sprite6, 0);
|
|
|
|
|
|
|
|
// remove texture from texture manager
|
2013-11-07 21:48:39 +08:00
|
|
|
Director::getInstance()->getTextureCache()->removeTexture(sprite6->getTexture());
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-22 11:02:43 +08:00
|
|
|
auto fadeout = FadeOut::create(2);
|
|
|
|
auto fadein = FadeIn::create(2);
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq = Sequence::create(DelayTime::create(2), fadeout, fadein, nullptr);
|
2013-06-22 11:02:43 +08:00
|
|
|
auto seq_4ever = RepeatForever::create(seq);
|
|
|
|
auto seq_4ever2 = seq_4ever->clone();
|
|
|
|
auto seq_4ever3 = seq_4ever->clone();
|
|
|
|
auto seq_4ever4 = seq_4ever->clone();
|
|
|
|
auto seq_4ever5 = seq_4ever->clone();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
sprite1->runAction(seq_4ever);
|
|
|
|
sprite2->runAction(seq_4ever2);
|
|
|
|
sprite3->runAction(seq_4ever3);
|
|
|
|
sprite4->runAction(seq_4ever4);
|
|
|
|
sprite5->runAction(seq_4ever5);
|
|
|
|
|
|
|
|
// restore default
|
2020-09-25 11:07:56 +08:00
|
|
|
Texture2D::setDefaultAlphaPixelFormat(backend::PixelFormat::RGBA8);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePixelFormat::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Texture Pixel Formats";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePixelFormat::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Textures: RGBA8888, RGBA4444, RGB5A1, RGB888, RGB565, A8";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureBlend
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TextureBlend::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
|
|
|
|
|
|
|
for( int i=0;i < 15;i++ )
|
|
|
|
{
|
|
|
|
// BOTTOM sprites have alpha pre-multiplied
|
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
|
|
|
// they use by default BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA
|
2013-08-16 16:05:27 +08:00
|
|
|
auto cloud = Sprite::create("Images/test_blend.png");
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(cloud, i+1, 100+i);
|
2014-05-15 01:07:09 +08:00
|
|
|
cloud->setPosition(Vec2(50+25*i, 80));
|
2013-07-26 04:36:19 +08:00
|
|
|
cloud->setBlendFunc( BlendFunc::ALPHA_PREMULTIPLIED );
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// CENTER sprites have also alpha pre-multiplied
|
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
|
|
|
// they use by default BlendFactor::SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA
|
2013-06-20 14:17:10 +08:00
|
|
|
cloud = Sprite::create("Images/test_blend.png");
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(cloud, i+1, 200+i);
|
2014-05-15 01:07:09 +08:00
|
|
|
cloud->setPosition(Vec2(50+25*i, 160));
|
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
|
|
|
BlendFunc blendFunc2 = { backend::BlendFactor::ONE_MINUS_DST_COLOR, backend::BlendFactor::ZERO };
|
2012-04-19 14:35:52 +08:00
|
|
|
cloud->setBlendFunc(blendFunc2);
|
|
|
|
|
|
|
|
// UPPER sprites are using custom blending function
|
|
|
|
// You can set any blend function to your sprites
|
2013-06-20 14:17:10 +08:00
|
|
|
cloud = Sprite::create("Images/test_blend.png");
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(cloud, i+1, 200+i);
|
2014-05-15 01:07:09 +08:00
|
|
|
cloud->setPosition(Vec2(50+25*i, 320-80));
|
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
|
|
|
BlendFunc blendFunc3 = { backend::BlendFactor::SRC_ALPHA, backend::BlendFactor::ONE };
|
2012-04-19 14:35:52 +08:00
|
|
|
cloud->setBlendFunc(blendFunc3); // additive blending
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureBlend::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Texture Blending";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureBlend::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Testing 3 different blending modes";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureAsync
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
void TextureAsync::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_imageOffset = 0;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-04-09 23:31:05 +08:00
|
|
|
auto label = Label::createWithTTF("Loading...", "fonts/Marker Felt.ttf", 32);
|
2014-05-15 01:07:09 +08:00
|
|
|
label->setPosition(Vec2( size.width/2, size.height/2));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(label, 10);
|
|
|
|
|
2013-06-22 11:02:43 +08:00
|
|
|
auto scale = ScaleBy::create(0.3f, 2);
|
|
|
|
auto scale_back = scale->reverse();
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq = Sequence::create(scale, scale_back, nullptr);
|
2013-06-20 14:17:10 +08:00
|
|
|
label->runAction(RepeatForever::create(seq));
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-10-04 00:38:36 +08:00
|
|
|
scheduleOnce(CC_SCHEDULE_SELECTOR(TextureAsync::loadImages), 1.0f);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
TextureAsync::~TextureAsync()
|
|
|
|
{
|
2014-11-26 02:43:58 +08:00
|
|
|
auto textureCache = Director::getInstance()->getTextureCache();
|
|
|
|
textureCache->unbindAllImageAsync();
|
|
|
|
textureCache->removeAllTextures();
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2012-06-08 13:55:28 +08:00
|
|
|
void TextureAsync::loadImages(float dt)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2014-11-26 02:43:58 +08:00
|
|
|
auto textureCache = Director::getInstance()->getTextureCache();
|
2012-04-19 14:35:52 +08:00
|
|
|
for( int i=0;i < 8;i++) {
|
|
|
|
for( int j=0;j < 8; j++) {
|
|
|
|
char szSpriteName[100] = {0};
|
|
|
|
sprintf(szSpriteName, "Images/sprites_test/sprite-%d-%d.png", i, j);
|
2014-11-26 02:43:58 +08:00
|
|
|
textureCache->addImageAsync(szSpriteName, CC_CALLBACK_1(TextureAsync::imageLoaded, this));
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-26 02:43:58 +08:00
|
|
|
textureCache->addImageAsync("Images/background1.jpg", CC_CALLBACK_1(TextureAsync::imageLoaded, this));
|
|
|
|
textureCache->addImageAsync("Images/background2.jpg", CC_CALLBACK_1(TextureAsync::imageLoaded, this));
|
|
|
|
textureCache->addImageAsync("Images/background.png", CC_CALLBACK_1(TextureAsync::imageLoaded, this));
|
|
|
|
textureCache->addImageAsync("Images/atlastest.png", CC_CALLBACK_1(TextureAsync::imageLoaded, this));
|
|
|
|
textureCache->addImageAsync("Images/grossini_dance_atlas.png", CC_CALLBACK_1(TextureAsync::imageLoaded, this));
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-02 17:23:00 +08:00
|
|
|
void TextureAsync::imageLoaded(Texture2D* texture)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto director = Director::getInstance();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-20 13:01:27 +08:00
|
|
|
//CCASSERT( [NSThread currentThread] == [director runningThread], @"FAIL. Callback should be on cocos2d thread");
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// IMPORTANT: The order on the callback is not guaranteed. Don't depend on the callback
|
|
|
|
|
|
|
|
// This test just creates a sprite based on the Texture
|
|
|
|
|
2014-01-02 17:23:00 +08:00
|
|
|
auto sprite = Sprite::createWithTexture(texture);
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite->setAnchorPoint(Vec2(0,0));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(sprite, -1);
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto size = director->getWinSize();
|
2013-06-15 14:03:30 +08:00
|
|
|
int i = _imageOffset * 32;
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite->setPosition(Vec2( i % (int)size.width, (i / (int)size.width) * 32 ));
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_imageOffset++;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-01-02 17:23:00 +08:00
|
|
|
log("Image loaded: %p", texture);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureAsync::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Texture Async Load";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureAsync::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Textures should load while an animation is being run";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureGlClamp
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TextureGlClamp::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// The .png image MUST be power of 2 in order to create a continue effect.
|
|
|
|
// eg: 32x64, 512x128, 256x1024, 64x64, etc..
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sprite = Sprite::create("Images/pattern1.png", Rect(0,0,512,256));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(sprite, -1, kTagSprite1);
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite->setPosition(Vec2(size.width/2,size.height/2));
|
2019-03-13 09:56:29 +08:00
|
|
|
Texture2D::TexParams texParams(
|
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
|
|
|
backend::SamplerFilter::LINEAR,
|
|
|
|
backend::SamplerFilter::LINEAR,
|
|
|
|
backend::SamplerAddressMode::CLAMP_TO_EDGE,
|
2019-03-13 09:56:29 +08:00
|
|
|
backend::SamplerAddressMode::CLAMP_TO_EDGE
|
|
|
|
);
|
2019-03-12 16:26:41 +08:00
|
|
|
sprite->getTexture()->setTexParameters(texParams);
|
2013-06-22 11:02:43 +08:00
|
|
|
auto rotate = RotateBy::create(4, 360);
|
2012-04-19 14:35:52 +08:00
|
|
|
sprite->runAction(rotate);
|
2013-06-22 11:02:43 +08:00
|
|
|
auto scale = ScaleBy::create(2, 0.04f);
|
|
|
|
auto scaleBack = scale->reverse();
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq = Sequence::create(scale, scaleBack, nullptr);
|
2012-04-19 14:35:52 +08:00
|
|
|
sprite->runAction(seq);
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureGlClamp::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Texture GL_CLAMP";
|
|
|
|
}
|
|
|
|
|
|
|
|
TextureGlClamp::~TextureGlClamp()
|
|
|
|
{
|
2013-11-07 21:48:39 +08:00
|
|
|
Director::getInstance()->getTextureCache()->removeUnusedTextures();
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureGlRepeat
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TextureGlRepeat::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
// The .png image MUST be power of 2 in order to create a continue effect.
|
|
|
|
// eg: 32x64, 512x128, 256x1024, 64x64, etc..
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sprite = Sprite::create("Images/pattern1.png", Rect(0, 0, 4096, 4096));
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(sprite, -1, kTagSprite1);
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite->setPosition(Vec2(size.width/2,size.height/2));
|
2019-03-12 16:26:41 +08:00
|
|
|
Texture2D::TexParams descriptor = {
|
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
|
|
|
backend::SamplerFilter::LINEAR,
|
|
|
|
backend::SamplerFilter::LINEAR,
|
|
|
|
backend::SamplerAddressMode::REPEAT,
|
|
|
|
backend::SamplerAddressMode::REPEAT
|
|
|
|
};
|
2019-03-12 16:26:41 +08:00
|
|
|
sprite->getTexture()->setTexParameters(descriptor);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-22 11:02:43 +08:00
|
|
|
auto rotate = RotateBy::create(4, 360);
|
2012-04-19 14:35:52 +08:00
|
|
|
sprite->runAction(rotate);
|
2013-06-22 11:02:43 +08:00
|
|
|
auto scale = ScaleBy::create(2, 0.04f);
|
|
|
|
auto scaleBack = scale->reverse();
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq = Sequence::create(scale, scaleBack, nullptr);
|
2012-04-19 14:35:52 +08:00
|
|
|
sprite->runAction(seq);
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureGlRepeat::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Texture GL_REPEAT";
|
|
|
|
}
|
|
|
|
|
|
|
|
TextureGlRepeat::~TextureGlRepeat()
|
|
|
|
{
|
2013-11-07 21:48:39 +08:00
|
|
|
Director::getInstance()->getTextureCache()->removeUnusedTextures();
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureSizeTest
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TextureSizeTest::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2014-07-10 00:45:27 +08:00
|
|
|
Sprite *sprite = nullptr;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-24 06:20:22 +08:00
|
|
|
log("Loading 512x512 image...");
|
2013-06-20 14:17:10 +08:00
|
|
|
sprite = Sprite::create("Images/texture512x512.png");
|
2012-04-19 14:35:52 +08:00
|
|
|
if( sprite )
|
2013-07-24 06:20:22 +08:00
|
|
|
log("OK");
|
2012-04-19 14:35:52 +08:00
|
|
|
else
|
2013-07-24 06:20:22 +08:00
|
|
|
log("Error");
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-24 06:20:22 +08:00
|
|
|
log("Loading 1024x1024 image...");
|
2013-06-20 14:17:10 +08:00
|
|
|
sprite = Sprite::create("Images/texture1024x1024.png");
|
2012-04-19 14:35:52 +08:00
|
|
|
if( sprite )
|
2013-07-24 06:20:22 +08:00
|
|
|
log("OK");
|
2012-04-19 14:35:52 +08:00
|
|
|
else
|
2013-07-24 06:20:22 +08:00
|
|
|
log("Error");
|
2012-04-19 14:35:52 +08:00
|
|
|
// @todo
|
2013-07-24 06:20:22 +08:00
|
|
|
// log("Loading 2048x2048 image...");
|
2013-06-20 14:17:10 +08:00
|
|
|
// sprite = Sprite::create("Images/texture2048x2048.png");
|
2012-04-19 14:35:52 +08:00
|
|
|
// if( sprite )
|
2013-07-24 06:20:22 +08:00
|
|
|
// log("OK");
|
2012-04-19 14:35:52 +08:00
|
|
|
// else
|
2013-07-24 06:20:22 +08:00
|
|
|
// log("Error");
|
2012-04-19 14:35:52 +08:00
|
|
|
//
|
2013-07-24 06:20:22 +08:00
|
|
|
// log("Loading 4096x4096 image...");
|
2013-06-20 14:17:10 +08:00
|
|
|
// sprite = Sprite::create("Images/texture4096x4096.png");
|
2012-04-19 14:35:52 +08:00
|
|
|
// if( sprite )
|
2013-07-24 06:20:22 +08:00
|
|
|
// log("OK");
|
2012-04-19 14:35:52 +08:00
|
|
|
// else
|
2013-07-24 06:20:22 +08:00
|
|
|
// log("Error");
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureSizeTest::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Different Texture Sizes";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureSizeTest::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "512x512, 1024x1024. See the console.";
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureCache1
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TextureCache1::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
Sprite *sprite;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
sprite = Sprite::create("Images/grossinis_sister1.png");
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite->setPosition(Vec2(s.width/5*1, s.height/2));
|
2012-04-19 14:35:52 +08:00
|
|
|
sprite->getTexture()->setAliasTexParameters();
|
|
|
|
sprite->setScale(2);
|
|
|
|
addChild(sprite);
|
|
|
|
|
2013-11-07 21:48:39 +08:00
|
|
|
Director::getInstance()->getTextureCache()->removeTexture(sprite->getTexture());
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
sprite = Sprite::create("Images/grossinis_sister1.png");
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite->setPosition(Vec2(s.width/5*2, s.height/2));
|
2012-04-19 14:35:52 +08:00
|
|
|
sprite->getTexture()->setAntiAliasTexParameters();
|
|
|
|
sprite->setScale(2);
|
|
|
|
addChild(sprite);
|
|
|
|
|
|
|
|
// 2nd set of sprites
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
sprite = Sprite::create("Images/grossinis_sister2.png");
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite->setPosition(Vec2(s.width/5*3, s.height/2));
|
2012-04-19 14:35:52 +08:00
|
|
|
sprite->getTexture()->setAliasTexParameters();
|
|
|
|
sprite->setScale(2);
|
|
|
|
addChild(sprite);
|
|
|
|
|
2013-11-07 21:48:39 +08:00
|
|
|
Director::getInstance()->getTextureCache()->removeTextureForKey("Images/grossinis_sister2.png");
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
sprite = Sprite::create("Images/grossinis_sister2.png");
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite->setPosition(Vec2(s.width/5*4, s.height/2));
|
2012-04-19 14:35:52 +08:00
|
|
|
sprite->getTexture()->setAntiAliasTexParameters();
|
|
|
|
sprite->setScale(2);
|
|
|
|
addChild(sprite);
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureCache1::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "CCTextureCache: remove";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureCache1::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2017-02-10 10:35:52 +08:00
|
|
|
return "4 images should appear: alias, antialias, alias, antialias";
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// TextureDrawAtPoint
|
|
|
|
void TextureDrawAtPoint::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
|
|
|
|
2013-11-07 21:48:39 +08:00
|
|
|
_tex1 = Director::getInstance()->getTextureCache()->addImage("Images/grossinis_sister1.png");
|
|
|
|
_Tex2F = Director::getInstance()->getTextureCache()->addImage("Images/grossinis_sister2.png");
|
2019-05-17 09:14:14 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_tex1->retain();
|
2013-07-05 16:49:22 +08:00
|
|
|
_Tex2F->retain();
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
TextureDrawAtPoint::~TextureDrawAtPoint()
|
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_tex1->release();
|
2013-07-05 16:49:22 +08:00
|
|
|
_Tex2F->release();
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureDrawAtPoint::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "CCTexture2D: drawAtPoint";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureDrawAtPoint::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "draws 2 textures using drawAtPoint";
|
|
|
|
}
|
|
|
|
|
2014-05-31 07:42:05 +08:00
|
|
|
void TextureDrawAtPoint::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2014-05-31 07:42:05 +08:00
|
|
|
TextureDemo::draw(renderer, transform, flags);
|
2013-12-26 10:03:45 +08:00
|
|
|
|
2019-05-17 09:14:14 +08:00
|
|
|
onDraw(transform, flags);
|
2013-12-26 10:03:45 +08:00
|
|
|
}
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-05-31 07:42:05 +08:00
|
|
|
void TextureDrawAtPoint::onDraw(const Mat4 &transform, uint32_t flags)
|
2013-12-26 10:03:45 +08:00
|
|
|
{
|
2014-04-03 15:59:55 +08:00
|
|
|
Director* director = Director::getInstance();
|
2017-02-10 10:35:52 +08:00
|
|
|
CCASSERT(nullptr != director, "Director is null when setting matrix stack");
|
2014-04-03 15:59:55 +08:00
|
|
|
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
|
|
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
2014-03-06 07:49:08 +08:00
|
|
|
|
2013-12-26 10:03:45 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
|
|
|
|
2019-05-17 09:14:14 +08:00
|
|
|
_tex1->drawAtPoint(Vec2(s.width/2-50, s.height/2 - 50), _globalZOrder);
|
|
|
|
_Tex2F->drawAtPoint(Vec2(s.width/2+50, s.height/2 - 50), _globalZOrder);
|
2013-12-26 10:03:45 +08:00
|
|
|
|
2014-04-03 15:59:55 +08:00
|
|
|
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// TextureDrawInRect
|
|
|
|
|
|
|
|
void TextureDrawInRect::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2013-11-07 21:48:39 +08:00
|
|
|
_tex1 = Director::getInstance()->getTextureCache()->addImage("Images/grossinis_sister1.png");
|
|
|
|
_Tex2F = Director::getInstance()->getTextureCache()->addImage("Images/grossinis_sister2.png");
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_tex1->retain();
|
2013-07-05 16:49:22 +08:00
|
|
|
_Tex2F->retain();
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
TextureDrawInRect::~TextureDrawInRect()
|
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_tex1->release();
|
2013-07-05 16:49:22 +08:00
|
|
|
_Tex2F->release();
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2014-05-31 07:42:05 +08:00
|
|
|
void TextureDrawInRect::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2014-05-31 07:42:05 +08:00
|
|
|
TextureDemo::draw(renderer, transform, flags);
|
2019-05-17 09:14:14 +08:00
|
|
|
onDraw(transform, flags);
|
2013-12-26 10:24:40 +08:00
|
|
|
}
|
|
|
|
|
2014-05-31 07:42:05 +08:00
|
|
|
void TextureDrawInRect::onDraw(const Mat4 &transform, uint32_t flags)
|
2013-12-26 10:24:40 +08:00
|
|
|
{
|
2014-04-03 15:59:55 +08:00
|
|
|
Director* director = Director::getInstance();
|
2017-02-10 10:35:52 +08:00
|
|
|
CCASSERT(nullptr != director, "Director is null when setting matrix stack");
|
2014-04-03 15:59:55 +08:00
|
|
|
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
|
|
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
2013-12-26 10:24:40 +08:00
|
|
|
|
|
|
|
auto s = Director::getInstance()->getWinSize();
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto rect1 = Rect( s.width/2 - 80, 20, _tex1->getContentSize().width * 0.5f, _tex1->getContentSize().height *2 );
|
|
|
|
auto rect2 = Rect( s.width/2 + 80, s.height/2, _tex1->getContentSize().width * 2, _tex1->getContentSize().height * 0.5f );
|
2013-12-26 10:24:40 +08:00
|
|
|
|
2019-05-17 09:14:14 +08:00
|
|
|
_tex1->drawInRect(rect1, _globalZOrder);
|
|
|
|
_Tex2F->drawInRect(rect2, _globalZOrder);
|
2013-12-26 10:24:40 +08:00
|
|
|
|
2014-04-03 15:59:55 +08:00
|
|
|
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureDrawInRect::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "CCTexture2D: drawInRect";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureDrawInRect::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "draws 2 textures using drawInRect";
|
|
|
|
}
|
|
|
|
|
2012-06-13 10:41:04 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// TextureMemoryAlloc
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void TextureMemoryAlloc::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
2014-07-10 00:45:27 +08:00
|
|
|
_background = nullptr;
|
2012-06-13 10:41:04 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
MenuItemFont::setFontSize(24);
|
2012-06-13 10:41:04 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto item1 = MenuItemFont::create("PNG", CC_CALLBACK_1(TextureMemoryAlloc::updateImage, this));
|
2012-06-13 10:41:04 +08:00
|
|
|
item1->setTag(0);
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto item2 = MenuItemFont::create("RGBA8", CC_CALLBACK_1(TextureMemoryAlloc::updateImage, this));
|
2012-06-13 10:41:04 +08:00
|
|
|
item2->setTag(1);
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto item3 = MenuItemFont::create("RGB8", CC_CALLBACK_1(TextureMemoryAlloc::updateImage, this));
|
2012-06-13 10:41:04 +08:00
|
|
|
item3->setTag(2);
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto item4 = MenuItemFont::create("RGBA4", CC_CALLBACK_1(TextureMemoryAlloc::updateImage, this));
|
2012-06-13 10:41:04 +08:00
|
|
|
item4->setTag(3);
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto item5 = MenuItemFont::create("A8", CC_CALLBACK_1(TextureMemoryAlloc::updateImage, this));
|
2012-06-13 10:41:04 +08:00
|
|
|
item5->setTag(4);
|
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto menu = Menu::create(item1, item2, item3, item4, item5, nullptr);
|
2012-06-13 10:41:04 +08:00
|
|
|
menu->alignItemsHorizontally();
|
|
|
|
|
|
|
|
addChild(menu);
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto warmup = MenuItemFont::create("warm up texture", CC_CALLBACK_1(TextureMemoryAlloc::changeBackgroundVisible, this));
|
2012-06-13 10:41:04 +08:00
|
|
|
|
2014-07-10 00:45:27 +08:00
|
|
|
auto menu2 = Menu::create(warmup, nullptr);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-13 10:41:04 +08:00
|
|
|
menu2->alignItemsHorizontally();
|
|
|
|
|
|
|
|
addChild(menu2);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2012-06-13 10:41:04 +08:00
|
|
|
|
2014-05-15 01:07:09 +08:00
|
|
|
menu2->setPosition(Vec2(s.width/2, s.height/4));
|
2012-06-13 10:41:04 +08:00
|
|
|
}
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
void TextureMemoryAlloc::changeBackgroundVisible(cocos2d::Ref *sender)
|
2012-06-13 10:41:04 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
if (_background)
|
2012-06-13 10:41:04 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_background->setVisible(true);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
void TextureMemoryAlloc::updateImage(cocos2d::Ref *sender)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
if (_background)
|
2012-06-13 10:41:04 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_background->removeFromParentAndCleanup(true);
|
2012-06-13 10:41:04 +08:00
|
|
|
}
|
|
|
|
|
2013-11-07 21:48:39 +08:00
|
|
|
Director::getInstance()->getTextureCache()->removeUnusedTextures();
|
2012-06-13 10:41:04 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
int tag = ((Node*)sender)->getTag();
|
2013-12-19 03:45:30 +08:00
|
|
|
std::string file;
|
2012-06-13 10:41:04 +08:00
|
|
|
switch (tag)
|
|
|
|
{
|
|
|
|
case 0:
|
2014-07-14 15:50:20 +08:00
|
|
|
file = "Images/test_image.png";
|
2012-06-13 10:41:04 +08:00
|
|
|
break;
|
2012-06-28 17:34:50 +08:00
|
|
|
case 1:
|
2014-07-14 15:50:20 +08:00
|
|
|
file = "Images/test_image_rgba8888.pvr";
|
2012-06-28 17:34:50 +08:00
|
|
|
break;
|
|
|
|
case 2:
|
2014-07-14 15:50:20 +08:00
|
|
|
file = "Images/test_image_rgb888.pvr";
|
2012-06-28 17:34:50 +08:00
|
|
|
break;
|
|
|
|
case 3:
|
2014-07-14 15:50:20 +08:00
|
|
|
file = "Images/test_image_rgba4444.pvr";
|
2012-06-28 17:34:50 +08:00
|
|
|
break;
|
|
|
|
case 4:
|
2014-05-19 12:09:55 +08:00
|
|
|
file = "Images/test_image_a8.pvr";
|
2012-06-28 17:34:50 +08:00
|
|
|
break;
|
2012-06-13 10:41:04 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
_background = Sprite::create(file.c_str());
|
2013-06-15 14:03:30 +08:00
|
|
|
addChild(_background, -10);
|
2012-06-13 10:41:04 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
_background->setVisible(false);
|
2012-06-13 10:41:04 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2014-05-15 01:07:09 +08:00
|
|
|
_background->setPosition(Vec2(s.width/2, s.height/2));
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureMemoryAlloc::title() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-06-13 10:41:04 +08:00
|
|
|
return "Texture memory";
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureMemoryAlloc::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-06-13 10:41:04 +08:00
|
|
|
return "Testing Texture Memory allocation. Use Instruments + VM Tracker";
|
2013-02-28 14:54:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// TexturePVRv3Premult
|
|
|
|
TexturePVRv3Premult::TexturePVRv3Premult()
|
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2013-02-28 14:54:09 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto background = LayerColor::create(Color4B(128,128,128,255), size.width, size.height);
|
2013-02-28 14:54:09 +08:00
|
|
|
addChild(background, -1);
|
|
|
|
|
|
|
|
|
|
|
|
// PVR premultiplied
|
2013-08-16 16:05:27 +08:00
|
|
|
auto pvr1 = Sprite::create("Images/grossinis_sister1-testalpha_premult.pvr");
|
2013-02-28 14:54:09 +08:00
|
|
|
addChild(pvr1, 0);
|
2014-05-15 01:07:09 +08:00
|
|
|
pvr1->setPosition(Vec2(size.width/4*1, size.height/2));
|
2013-02-28 14:54:09 +08:00
|
|
|
transformSprite(pvr1);
|
|
|
|
|
|
|
|
// PVR non-premultiplied
|
2013-08-16 16:05:27 +08:00
|
|
|
auto pvr2 = Sprite::create("Images/grossinis_sister1-testalpha_nopremult.pvr");
|
2013-02-28 14:54:09 +08:00
|
|
|
addChild(pvr2, 0);
|
2014-05-15 01:07:09 +08:00
|
|
|
pvr2->setPosition(Vec2(size.width/4*2, size.height/2));
|
2013-02-28 14:54:09 +08:00
|
|
|
transformSprite(pvr2);
|
|
|
|
|
|
|
|
// PNG
|
2020-09-25 11:07:56 +08:00
|
|
|
Texture2D::setDefaultAlphaPixelFormat(backend::PixelFormat::RGBA8);
|
2013-11-07 21:48:39 +08:00
|
|
|
Director::getInstance()->getTextureCache()->removeTextureForKey("Images/grossinis_sister1-testalpha.png");
|
2013-08-16 16:05:27 +08:00
|
|
|
auto png = Sprite::create("Images/grossinis_sister1-testalpha.png");
|
2013-02-28 14:54:09 +08:00
|
|
|
addChild(png, 0);
|
2014-05-15 01:07:09 +08:00
|
|
|
png->setPosition(Vec2(size.width/4*3, size.height/2));
|
2013-02-28 14:54:09 +08:00
|
|
|
transformSprite(png);
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRv3Premult::title() const
|
2013-02-28 14:54:09 +08:00
|
|
|
{
|
|
|
|
return "PVRv3 Premult Flag";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TexturePVRv3Premult::subtitle() const
|
2013-02-28 14:54:09 +08:00
|
|
|
{
|
|
|
|
return "All images should look exactly the same";
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
void TexturePVRv3Premult::transformSprite(cocos2d::Sprite *sprite)
|
2013-02-28 14:54:09 +08:00
|
|
|
{
|
2013-06-22 11:02:43 +08:00
|
|
|
auto fade = FadeOut::create(2);
|
|
|
|
auto dl = DelayTime::create(2);
|
|
|
|
auto fadein = fade->reverse();
|
2014-07-10 00:45:27 +08:00
|
|
|
auto seq = Sequence::create(fade, fadein, dl, nullptr);
|
2013-06-22 11:02:43 +08:00
|
|
|
auto repeat = RepeatForever::create(seq);
|
2013-02-28 14:54:09 +08:00
|
|
|
sprite->runAction(repeat);
|
|
|
|
}
|
2013-05-27 14:42:22 +08:00
|
|
|
|
2013-08-06 11:19:45 +08:00
|
|
|
//Implement of S3TC Dxt1
|
|
|
|
TextureS3TCDxt1::TextureS3TCDxt1()
|
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sprite = Sprite::create("Images/test_256x256_s3tc_dxt1_mipmaps.dds");
|
|
|
|
//auto sprite = Sprite::create("Images/water_2_dxt1.dds");
|
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite->setPosition(Vec2(size.width / 2, size.height / 2));
|
2013-08-06 11:19:45 +08:00
|
|
|
|
|
|
|
addChild(sprite);
|
|
|
|
}
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureS3TCDxt1::title() const
|
2013-08-06 11:19:45 +08:00
|
|
|
{
|
|
|
|
return "S3TC texture test#1";
|
|
|
|
}
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureS3TCDxt1::subtitle() const
|
2013-08-06 11:19:45 +08:00
|
|
|
{
|
2013-08-06 15:33:38 +08:00
|
|
|
return "S3TC dxt1 decode,one bit for Alpha";
|
2013-08-06 11:19:45 +08:00
|
|
|
}
|
2013-08-16 11:02:44 +08:00
|
|
|
|
2013-08-06 11:19:45 +08:00
|
|
|
//Implement of S3TC Dxt3
|
|
|
|
TextureS3TCDxt3::TextureS3TCDxt3()
|
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sprite = Sprite::create("Images/test_256x256_s3tc_dxt3_mipmaps.dds");
|
|
|
|
//auto sprite = Sprite::create("Images/water_2_dxt3.dds");
|
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite->setPosition(Vec2(size.width / 2, size.height / 2));
|
2013-08-06 11:19:45 +08:00
|
|
|
|
|
|
|
addChild(sprite);
|
|
|
|
}
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureS3TCDxt3::title() const
|
2013-08-06 11:19:45 +08:00
|
|
|
{
|
|
|
|
return "S3TC texture test#2";
|
|
|
|
}
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureS3TCDxt3::subtitle() const
|
2013-08-06 11:19:45 +08:00
|
|
|
{
|
|
|
|
return "S3TC dxt3 decode";
|
|
|
|
}
|
2013-08-16 11:02:44 +08:00
|
|
|
|
|
|
|
//Implement of S3TC Dxt5
|
2013-08-06 11:19:45 +08:00
|
|
|
TextureS3TCDxt5::TextureS3TCDxt5()
|
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sprite = Sprite::create("Images/test_256x256_s3tc_dxt5_mipmaps.dds");
|
|
|
|
//auto sprite = Sprite::create("Images/water_2_dxt5.dds");
|
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite->setPosition(Vec2(size.width / 2, size.height / 2));
|
2013-08-06 11:19:45 +08:00
|
|
|
|
|
|
|
addChild(sprite);
|
|
|
|
}
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureS3TCDxt5::title() const
|
2013-08-06 11:19:45 +08:00
|
|
|
{
|
|
|
|
return "S3TC texture test#3";
|
|
|
|
}
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureS3TCDxt5::subtitle() const
|
2013-08-06 11:19:45 +08:00
|
|
|
{
|
2013-08-16 11:02:44 +08:00
|
|
|
return "S3TC dxt5 decode";
|
|
|
|
}
|
|
|
|
|
2014-02-20 18:27:52 +08:00
|
|
|
//Implement of S3TC with no mipmaps
|
|
|
|
TextureS3TCWithNoMipmaps::TextureS3TCWithNoMipmaps()
|
|
|
|
{
|
|
|
|
auto sprite = Sprite::create("Images/test_512x512_s3tc_dxt5_with_no_mipmaps.dds");
|
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite->setPosition(Vec2(size.width / 2, size.height / 2));
|
2014-02-20 18:27:52 +08:00
|
|
|
|
|
|
|
addChild(sprite);
|
|
|
|
}
|
|
|
|
std::string TextureS3TCWithNoMipmaps::title() const
|
|
|
|
{
|
|
|
|
return "S3TC with no mipmaps";
|
|
|
|
}
|
|
|
|
|
2013-08-16 11:02:44 +08:00
|
|
|
//Implement of ATITC
|
|
|
|
TextureATITCRGB::TextureATITCRGB()
|
|
|
|
{
|
2013-08-22 13:40:57 +08:00
|
|
|
auto sprite = Sprite::create("Images/test_256x256_ATC_RGB_mipmaps.ktx");
|
2013-08-06 11:19:45 +08:00
|
|
|
|
2013-08-22 13:40:57 +08:00
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite->setPosition(Vec2(size.width / 2, size.height / 2));
|
2013-08-16 11:02:44 +08:00
|
|
|
|
|
|
|
addChild(sprite);
|
|
|
|
}
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureATITCRGB::title() const
|
2013-08-16 11:02:44 +08:00
|
|
|
{
|
|
|
|
return "ATITC texture (*.ktx file) test#1";
|
|
|
|
}
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureATITCRGB::subtitle() const
|
2013-08-16 11:02:44 +08:00
|
|
|
{
|
|
|
|
return "ATITC RGB (no Alpha channel) compressed texture test";
|
|
|
|
}
|
|
|
|
|
|
|
|
TextureATITCExplicit::TextureATITCExplicit()
|
|
|
|
{
|
2013-08-22 13:40:57 +08:00
|
|
|
auto sprite = Sprite::create("Images/test_256x256_ATC_RGBA_Explicit_mipmaps.ktx");
|
2013-08-16 11:02:44 +08:00
|
|
|
|
2013-08-22 13:40:57 +08:00
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite->setPosition(Vec2(size.width / 2, size.height / 2));
|
2013-08-16 11:02:44 +08:00
|
|
|
|
|
|
|
addChild(sprite);
|
|
|
|
}
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureATITCExplicit::title() const
|
2013-08-16 11:02:44 +08:00
|
|
|
{
|
|
|
|
return "ATITC texture (*.ktx file) test#2";
|
|
|
|
}
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureATITCExplicit::subtitle() const
|
2013-08-16 11:02:44 +08:00
|
|
|
{
|
|
|
|
return "ATITC RGBA explicit Alpha compressed texture test";
|
|
|
|
}
|
|
|
|
|
|
|
|
TextureATITCInterpolated::TextureATITCInterpolated()
|
|
|
|
{
|
2013-08-22 13:40:57 +08:00
|
|
|
auto sprite = Sprite::create("Images/test_256x256_ATC_RGBA_Interpolated_mipmaps.ktx");
|
2013-08-16 11:02:44 +08:00
|
|
|
|
2013-08-22 13:40:57 +08:00
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite->setPosition(Vec2(size.width / 2, size.height /2));
|
2013-08-16 11:02:44 +08:00
|
|
|
|
|
|
|
addChild(sprite);
|
|
|
|
}
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureATITCInterpolated::title() const
|
2013-08-16 11:02:44 +08:00
|
|
|
{
|
|
|
|
return "ATITC texture (*.ktx file) test#3";
|
|
|
|
}
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureATITCInterpolated::subtitle() const
|
2013-08-16 11:02:44 +08:00
|
|
|
{
|
2017-02-10 10:35:52 +08:00
|
|
|
return "ATITC RGBA Interpolated Alpha compressed texture test";
|
2013-08-06 11:19:45 +08:00
|
|
|
}
|
2013-07-29 17:34:33 +08:00
|
|
|
|
2019-06-03 09:39:51 +08:00
|
|
|
static void addImageToDemo(TextureDemo& demo, float x, float y, const char* path, backend::PixelFormat format)
|
2013-07-29 17:34:33 +08:00
|
|
|
{
|
|
|
|
Texture2D::setDefaultAlphaPixelFormat(format);
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sprite = Sprite::create(path);
|
2014-05-15 01:07:09 +08:00
|
|
|
sprite->setPosition(Vec2(x, y));
|
2013-07-29 17:34:33 +08:00
|
|
|
demo.addChild(sprite, 0);
|
|
|
|
|
2013-08-16 11:02:44 +08:00
|
|
|
//remove texture from texture manager
|
2013-11-07 21:48:39 +08:00
|
|
|
Director::getInstance()->getTextureCache()->removeTexture(sprite->getTexture());
|
2013-07-29 17:34:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//TextureConvertRGB888
|
|
|
|
void TextureConvertRGB888::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2013-07-29 17:34:33 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto background = LayerColor::create(Color4B(255,0,0,255), s.width, s.height);
|
2013-07-29 17:34:33 +08:00
|
|
|
addChild(background, -1);
|
|
|
|
|
|
|
|
const char* img = "Images/test_image_rgb888.png";
|
2020-09-25 11:07:56 +08:00
|
|
|
addImageToDemo(*this, 1*s.width/9, s.height/2+32, img, backend::PixelFormat::RGBA8);
|
|
|
|
addImageToDemo(*this, 2*s.width/9, s.height/2-32, img, backend::PixelFormat::RGB8);
|
2019-06-03 09:39:51 +08:00
|
|
|
addImageToDemo(*this, 3*s.width/9, s.height/2+32, img, backend::PixelFormat::RGB565);
|
|
|
|
addImageToDemo(*this, 4*s.width/9, s.height/2-32, img, backend::PixelFormat::A8);
|
2020-09-25 11:07:56 +08:00
|
|
|
addImageToDemo(*this, 5*s.width/9, s.height/2+32, img, backend::PixelFormat::L8);
|
|
|
|
addImageToDemo(*this, 6*s.width/9, s.height/2-32, img, backend::PixelFormat::LA8);
|
|
|
|
addImageToDemo(*this, 7*s.width/9, s.height/2+32, img, backend::PixelFormat::RGBA4);
|
2019-06-03 09:39:51 +08:00
|
|
|
addImageToDemo(*this, 8*s.width/9, s.height/2-32, img, backend::PixelFormat::RGB5A1);
|
2013-07-29 17:34:33 +08:00
|
|
|
|
|
|
|
// restore default
|
2020-09-25 11:07:56 +08:00
|
|
|
Texture2D::setDefaultAlphaPixelFormat(backend::PixelFormat::RGBA8);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2013-07-29 17:34:33 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureConvertRGB888::title() const
|
2013-07-29 17:34:33 +08:00
|
|
|
{
|
|
|
|
return "RGB888 convert test";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureConvertRGB888::subtitle() const
|
2013-07-29 17:34:33 +08:00
|
|
|
{
|
|
|
|
return "RGBA8888,RGB888,RGB565,A8,I8,AI88,RGBA4444,RGB5A1";
|
|
|
|
}
|
|
|
|
//TextureConvertRGBA8888
|
|
|
|
void TextureConvertRGBA8888::onEnter()
|
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2013-07-29 17:34:33 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto background = LayerColor::create(Color4B(255,0,0,255), s.width, s.height);
|
2013-07-29 17:34:33 +08:00
|
|
|
addChild(background, -1);
|
|
|
|
|
|
|
|
const char* img = "Images/test_image_rgba8888.png";
|
2020-09-25 11:07:56 +08:00
|
|
|
addImageToDemo(*this, 1*s.width/9, s.height/2+32, img, backend::PixelFormat::RGBA8);
|
|
|
|
addImageToDemo(*this, 2*s.width/9, s.height/2-32, img, backend::PixelFormat::RGB8);
|
2019-06-03 09:39:51 +08:00
|
|
|
addImageToDemo(*this, 3*s.width/9, s.height/2+32, img, backend::PixelFormat::RGB565);
|
|
|
|
addImageToDemo(*this, 4*s.width/9, s.height/2-32, img, backend::PixelFormat::A8);
|
2020-09-25 11:07:56 +08:00
|
|
|
addImageToDemo(*this, 5*s.width/9, s.height/2+32, img, backend::PixelFormat::L8);
|
|
|
|
addImageToDemo(*this, 6*s.width/9, s.height/2-32, img, backend::PixelFormat::LA8);
|
|
|
|
addImageToDemo(*this, 7*s.width/9, s.height/2+32, img, backend::PixelFormat::RGBA4);
|
2019-06-03 09:39:51 +08:00
|
|
|
addImageToDemo(*this, 8*s.width/9, s.height/2-32, img, backend::PixelFormat::RGB5A1);
|
2013-07-29 17:34:33 +08:00
|
|
|
|
|
|
|
// restore default
|
2020-09-25 11:07:56 +08:00
|
|
|
Texture2D::setDefaultAlphaPixelFormat(backend::PixelFormat::RGBA8);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2013-07-29 17:34:33 +08:00
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureConvertRGBA8888::title() const
|
2013-07-29 17:34:33 +08:00
|
|
|
{
|
|
|
|
return "RGBA8888 convert test";
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string TextureConvertRGBA8888::subtitle() const
|
2013-07-29 17:34:33 +08:00
|
|
|
{
|
|
|
|
return "RGBA8888,RGB888,RGB565,A8,I8,AI88,RGBA4444,RGB5A1";
|
|
|
|
}
|
2020-09-25 11:07:56 +08:00
|
|
|
//TextureConvertL8
|
|
|
|
void TextureConvertL8::onEnter()
|
2013-07-29 17:34:33 +08:00
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2013-07-29 17:34:33 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto background = LayerColor::create(Color4B(255,0,0,255), s.width, s.height);
|
2013-07-29 17:34:33 +08:00
|
|
|
addChild(background, -1);
|
|
|
|
|
|
|
|
const char* img = "Images/test_image_i8.png";
|
2020-09-25 11:07:56 +08:00
|
|
|
addImageToDemo(*this, 1*s.width/9, s.height/2+32, img, backend::PixelFormat::RGBA8);
|
|
|
|
addImageToDemo(*this, 2*s.width/9, s.height/2-32, img, backend::PixelFormat::RGB8);
|
2019-06-03 09:39:51 +08:00
|
|
|
addImageToDemo(*this, 3*s.width/9, s.height/2+32, img, backend::PixelFormat::RGB565);
|
|
|
|
addImageToDemo(*this, 4*s.width/9, s.height/2-32, img, backend::PixelFormat::A8);
|
2020-09-25 11:07:56 +08:00
|
|
|
addImageToDemo(*this, 5*s.width/9, s.height/2+32, img, backend::PixelFormat::L8);
|
|
|
|
addImageToDemo(*this, 6*s.width/9, s.height/2-32, img, backend::PixelFormat::LA8);
|
|
|
|
addImageToDemo(*this, 7*s.width/9, s.height/2+32, img, backend::PixelFormat::RGBA4);
|
2019-06-03 09:39:51 +08:00
|
|
|
addImageToDemo(*this, 8*s.width/9, s.height/2-32, img, backend::PixelFormat::RGB5A1);
|
2013-07-29 17:34:33 +08:00
|
|
|
|
|
|
|
// restore default
|
2020-09-25 11:07:56 +08:00
|
|
|
Texture2D::setDefaultAlphaPixelFormat(backend::PixelFormat::RGBA8);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2013-07-29 17:34:33 +08:00
|
|
|
}
|
|
|
|
|
2020-09-25 11:07:56 +08:00
|
|
|
std::string TextureConvertL8::title() const
|
2013-07-29 17:34:33 +08:00
|
|
|
{
|
|
|
|
return "I8 convert test";
|
|
|
|
}
|
|
|
|
|
2020-09-25 11:07:56 +08:00
|
|
|
std::string TextureConvertL8::subtitle() const
|
2013-07-29 17:34:33 +08:00
|
|
|
{
|
|
|
|
return "RGBA8888,RGB888,RGB565,A8,I8,AI88,RGBA4444,RGB5A1";
|
|
|
|
}
|
2020-09-25 11:07:56 +08:00
|
|
|
//TextureConvertLA8
|
|
|
|
void TextureConvertLA8::onEnter()
|
2013-07-29 17:34:33 +08:00
|
|
|
{
|
|
|
|
TextureDemo::onEnter();
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto s = Director::getInstance()->getWinSize();
|
2013-07-29 17:34:33 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto background = LayerColor::create(Color4B(255,0,0,255), s.width, s.height);
|
2013-07-29 17:34:33 +08:00
|
|
|
addChild(background, -1);
|
|
|
|
|
|
|
|
const char* img = "Images/test_image_ai88.png";
|
2020-09-25 11:07:56 +08:00
|
|
|
addImageToDemo(*this, 1*s.width/9, s.height/2+32, img, backend::PixelFormat::RGBA8);
|
|
|
|
addImageToDemo(*this, 2*s.width/9, s.height/2-32, img, backend::PixelFormat::RGB8);
|
2019-06-03 09:39:51 +08:00
|
|
|
addImageToDemo(*this, 3*s.width/9, s.height/2+32, img, backend::PixelFormat::RGB565);
|
|
|
|
addImageToDemo(*this, 4*s.width/9, s.height/2-32, img, backend::PixelFormat::A8);
|
2020-09-25 11:07:56 +08:00
|
|
|
addImageToDemo(*this, 5*s.width/9, s.height/2+32, img, backend::PixelFormat::L8);
|
|
|
|
addImageToDemo(*this, 6*s.width/9, s.height/2-32, img, backend::PixelFormat::LA8);
|
|
|
|
addImageToDemo(*this, 7*s.width/9, s.height/2+32, img, backend::PixelFormat::RGBA4);
|
2019-06-03 09:39:51 +08:00
|
|
|
addImageToDemo(*this, 8*s.width/9, s.height/2-32, img, backend::PixelFormat::RGB5A1);
|
2013-07-29 17:34:33 +08:00
|
|
|
|
|
|
|
// restore default
|
2020-09-25 11:07:56 +08:00
|
|
|
Texture2D::setDefaultAlphaPixelFormat(backend::PixelFormat::RGBA8);
|
2014-01-15 09:22:45 +08:00
|
|
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
2013-07-29 17:34:33 +08:00
|
|
|
}
|
|
|
|
|
2020-09-25 11:07:56 +08:00
|
|
|
std::string TextureConvertLA8::title() const
|
2013-07-29 17:34:33 +08:00
|
|
|
{
|
|
|
|
return "AI88 convert test";
|
|
|
|
}
|
|
|
|
|
2020-09-25 11:07:56 +08:00
|
|
|
std::string TextureConvertLA8::subtitle() const
|
2013-07-29 17:34:33 +08:00
|
|
|
{
|
|
|
|
return "RGBA8888,RGB888,RGB565,A8,I8,AI88,RGBA4444,RGB5A1";
|
|
|
|
}
|