mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of github.com:cocos2d/cocos2d-x into v3_renderPrimitive
This commit is contained in:
commit
9978065d00
23
AUTHORS
23
AUTHORS
|
@ -108,6 +108,7 @@ Developers:
|
|||
Added support for x64 target of windows.
|
||||
Added Dutch Language support.
|
||||
Added clang support for Windows.
|
||||
Cmake update and remove old scripts from build folder
|
||||
|
||||
mchinen
|
||||
fix emulator issue for OpenGL ES 2.0 on Android
|
||||
|
@ -694,6 +695,7 @@ Developers:
|
|||
Fixed an issue that there is an useless conversion in ScrollView::onTouchBegan.
|
||||
Deleted several lines of useless code in ScrollView::deaccelerateScrolling.
|
||||
Fixed that ScrollView should implement ActionTweenDelegate.
|
||||
Fixed LabelBMFont::getBoundingBox() position error
|
||||
|
||||
yinkaile (2youyouo2)
|
||||
Maintainer of Armature Bone Animation.
|
||||
|
@ -743,6 +745,7 @@ Developers:
|
|||
Corrected a few mistakes in the README file of project-creator.
|
||||
Corrected a mistake in README.
|
||||
Fixed a bug that a string which only contains CJK characters can't make a line-break when it's needed.
|
||||
Fixed a bug that if the UISlider is faded, the slide ball won't fade together
|
||||
|
||||
hbbalfred
|
||||
Fixed a bug that crash if file doesn't exist when using FileUtils::getStringFromFile.
|
||||
|
@ -910,6 +913,7 @@ Developers:
|
|||
Add a new line at the end of a file
|
||||
Fix a bug that crash happened when try to remove videoView(STATE_PLAYBACK_COMPLETED) in android
|
||||
Fix video scale issue in iOS
|
||||
Fix iOS VideoPlayer memory leak
|
||||
|
||||
billtt
|
||||
Fixed a bug that Node::setScale(float) may not work properly
|
||||
|
@ -942,6 +946,25 @@ Developers:
|
|||
|
||||
reckhou
|
||||
Optimize FPS control on Android
|
||||
|
||||
dzl-ian
|
||||
Added getter and setter for TextColor for UIText
|
||||
|
||||
zii
|
||||
Added utils::gettime()
|
||||
|
||||
takaken1994
|
||||
Added function for setting min/max scale for ScrollView
|
||||
|
||||
maltium
|
||||
Added 3D rotation support to RotateTo action
|
||||
|
||||
Hamken100per
|
||||
Added a function getAssetManager() on CCFileUtilsAndroid
|
||||
|
||||
rny
|
||||
Fixed LabelTTF::getBoundingBox() position error
|
||||
SpriteFrameCache load from plist file content data
|
||||
|
||||
Retired Core Developers:
|
||||
WenSheng Yang
|
||||
|
|
12
CHANGELOG
12
CHANGELOG
|
@ -1,22 +1,34 @@
|
|||
cocos2d-x-3.3 ??
|
||||
[NEW] Added submesh support, and support attaching a Sprite3D object to a bone
|
||||
[NEW] Added UIScale9Sprite
|
||||
[NEW] FileUtils: add isDirectoryExist(), createDirectory(), removeDirectory(), removeFile(), renameFile()
|
||||
getFileSize()
|
||||
[NEW] FileUtilsApple: allow setting bundle to use in file utils on iOS and Mac OS X
|
||||
[NEW] Image: support of software PVRTC v1 decompression
|
||||
[NEW] RotateTo: added 3D rotation support
|
||||
[NEW] ScrollView: added `setMinScale()` and `setMaxScale()`
|
||||
[NEW] SpriteFrameCache: load from plist file content data
|
||||
[NEW] UIText: added getter and setter for TextColor
|
||||
[NEW] utils: added gettime()
|
||||
[NEW] TextField: support utf8
|
||||
|
||||
[FIX] EditBox: font size is not scaled when glview is scaled on Mac OS X
|
||||
[FIX] EditBox: began/end events not work
|
||||
[FIX] Label: can not set charmap after it is created
|
||||
[FIX] Label: setTextColor does not have any effect on Mac OS X
|
||||
[FIX] Label: result of LabelTTF::getBoundingBox() is wrong
|
||||
[FIX] Label: can not set outline color correctly if using system font on iOS
|
||||
[FIX] LabelBMFont: result of LabelBMFont::getBoundingBox() is wrong
|
||||
[FIX] ParticleSystem: effect is wrong if scene scaled
|
||||
[FIX] ParticleSystemQuad: setTotalParticles() can't set a value larger than initialized value
|
||||
[FIX] Scale9Sprite: new added sprite will be hidden
|
||||
[FIX] UIListView: can not insert an item in specific position, it is added at bottom
|
||||
[FIX] TabelView: can handle touch event though its parents are invisible
|
||||
[FIX] TextField: can not use backspace to delete a character
|
||||
[FIX] UISlider: if the UISlider is faded, the slide ball won't fade together
|
||||
[FIX] UIVideoPlayer: video frame size is not calculated correctly on iOS
|
||||
[FIX] UIWidget: may crash if remove itself in touch call back function
|
||||
[FIX] VideoPlayer: memory leak on iOS
|
||||
|
||||
[FIX] Others: can not import java library shift by engine correctly when using Eclispe on Android
|
||||
[FIX] Others: optimize FPS contorl algorithm on Android
|
||||
|
|
113
CMakeLists.txt
113
CMakeLists.txt
|
@ -1,7 +1,7 @@
|
|||
#/****************************************************************************
|
||||
# Copyright (c) 2013 cocos2d-x.org
|
||||
# Copyright (c) 2012-2013 martell malone
|
||||
#
|
||||
# Copyright (c) 2014 martell malone
|
||||
#
|
||||
# http://www.cocos2d-x.org
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
@ -28,38 +28,23 @@ project (Cocos2dx)
|
|||
|
||||
# The version number
|
||||
set(Cocos2dxSamples_VERSION_MAJOR 3)
|
||||
set(Cocos2dxSamples_VERSION_MINOR 0)
|
||||
set(Cocos2dxSamples_VERSION_MINOR 1)
|
||||
|
||||
include(build/BuildHelpers.CMakeLists.txt)
|
||||
|
||||
if(WIN32 OR APPLE)
|
||||
message(${BUILDING_STRING})
|
||||
|
||||
option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
|
||||
option(USE_BOX2D "Use box2d for physics library" OFF)
|
||||
option(DEBUG_MODE "Debug or release?" ON)
|
||||
option(BUILD_LIBS_LUA "Build lua libraries" OFF)
|
||||
option(BUILD_EXTENSIONS "Build extension library" ON)
|
||||
option(BUILD_EDITOR_SPINE "Build editor support for spine" ON)
|
||||
option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON)
|
||||
option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" ON)
|
||||
|
||||
option(BUILD_CppTests "Only build TestCpp sample" ON)
|
||||
option(BUILD_LuaTests "Only build TestLua sample" OFF)
|
||||
else()#temp
|
||||
|
||||
option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
|
||||
option(USE_BOX2D "Use box2d for physics library" OFF)
|
||||
option(DEBUG_MODE "Debug or release?" ON)
|
||||
option(BUILD_EXTERN_LIBS "Build Box2d, Chipmunk, Tinyxml2 from source" ON)
|
||||
option(BUILD_CppTests "Build TestCpp samples" ON)
|
||||
option(BUILD_LIBS_LUA "Build lua libraries" ON)
|
||||
option(BUILD_EXTENSIONS "Build extension library" ON)
|
||||
option(BUILD_EDITOR_SPINE "Build editor support for spine" ON)
|
||||
option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON)
|
||||
option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" ON)
|
||||
|
||||
option(BUILD_CppTests "Only build TestCpp sample" ON)
|
||||
option(BUILD_LuaTests "Only build TestLua sample" ON)
|
||||
endif()#temp
|
||||
|
||||
option(BUILD_LuaTests "Build TestLua samples" ON)
|
||||
|
||||
if(DEBUG_MODE)
|
||||
set(CMAKE_BUILD_TYPE DEBUG)
|
||||
|
@ -70,31 +55,25 @@ endif(DEBUG_MODE)
|
|||
set(CMAKE_C_FLAGS_DEBUG "-DCOCOS2D_DEBUG=1")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
|
||||
|
||||
if(WIN32)
|
||||
if(MSVC)
|
||||
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS
|
||||
-wd4251 -wd4244 -wd4334 -wd4005 -wd4820 -wd4710
|
||||
-wd4514 -wd4056 -wd4996 -wd4099)
|
||||
else()
|
||||
set(CMAKE_C_FLAGS_DEBUG "-g -Wall -DCOCOS2D_DEBUG=1")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions -std=c99")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -std=c++11")
|
||||
endif(MSVC)
|
||||
|
||||
if(WINDOWS)
|
||||
ADD_DEFINITIONS (-D_USRDLL -DCOCOS2DXWIN32_EXPORTS -D_WINDOWS -DWIN32)
|
||||
|
||||
if(MSVC)
|
||||
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS
|
||||
-D_SCL_SECURE_NO_WARNINGS
|
||||
-wd4251 -wd4244 -wd4334
|
||||
-wd4005 -wd4820 -wd4710
|
||||
-wd4514 -wd4056 -wd4996 -wd4099)
|
||||
else(MSVC)#MINGW
|
||||
|
||||
endif(MSVC)
|
||||
elseif(APPLE)
|
||||
|
||||
|
||||
else()#Linux
|
||||
ADD_DEFINITIONS(-DLINUX)
|
||||
endif()
|
||||
|
||||
|
||||
if(NOT MSVC)# all gcc
|
||||
set(CMAKE_C_FLAGS_DEBUG "-g -Wall -DCOCOS2D_DEBUG=1")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
|
||||
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-std=c99")
|
||||
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++11")
|
||||
set(PLATFORM_FOLDER win32)
|
||||
elseif(MACOSX)
|
||||
set(PLATFORM_FOLDER mac)
|
||||
else(LINUX)
|
||||
ADD_DEFINITIONS(-DLINUX)
|
||||
set(PLATFORM_FOLDER linux)
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
|
@ -102,8 +81,12 @@ if(MINGW)
|
|||
add_definitions(-D__SSIZE_T)
|
||||
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lws2_32")
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lws2_32")
|
||||
endif()
|
||||
|
||||
if(CLANG)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions ")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions ")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_CHIPMUNK)
|
||||
message("Using chipmunk ...")
|
||||
|
@ -122,14 +105,6 @@ else()
|
|||
set(ARCH_DIR "32-bit")
|
||||
endif()
|
||||
|
||||
if(WIN32) # Win32
|
||||
set(PLATFORM_FOLDER win32)
|
||||
elseif(APPLE)# osx or ios
|
||||
set(PLATFORM_FOLDER mac)
|
||||
else() # Assume Linux
|
||||
set(PLATFORM_FOLDER linux)
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cocos
|
||||
|
@ -156,18 +131,18 @@ include_directories(
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/external/xxtea
|
||||
)
|
||||
|
||||
if(WIN32 AND NOT MINGW)
|
||||
if(MSVC)
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/gles/include/OGLES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/icon/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/zlib/include
|
||||
external/curl/include/${PLATFORM_FOLDER}
|
||||
)
|
||||
elseif(APPLE)
|
||||
elseif(MACOSX)
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/curl/include/${PLATFORM_FOLDER}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/curl/include/${PLATFORM_FOLDER}
|
||||
)
|
||||
else()
|
||||
elseif(LINUX)
|
||||
include_directories(
|
||||
/usr/include
|
||||
/usr/include/GLFW
|
||||
|
@ -177,9 +152,8 @@ else()
|
|||
endif()
|
||||
|
||||
|
||||
if(WIN32)
|
||||
if(MSVC)
|
||||
|
||||
if(NOT MINGW)
|
||||
link_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg/prebuilt/${PLATFORM_FOLDER}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/tiff/prebuilt/${PLATFORM_FOLDER}
|
||||
|
@ -189,11 +163,8 @@ if(WIN32)
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/icon/prebuilt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/zlib/prebuilt
|
||||
)
|
||||
endif()
|
||||
|
||||
elseif(APPLE)
|
||||
|
||||
else()
|
||||
elseif(LINUX)
|
||||
|
||||
link_directories(
|
||||
/usr/local/lib
|
||||
|
@ -208,17 +179,21 @@ else()
|
|||
|
||||
endif()
|
||||
|
||||
if(BUILD_EXTERN_LIBS)
|
||||
# chipmunk library
|
||||
add_subdirectory(external/chipmunk/src)
|
||||
|
||||
# box2d library
|
||||
add_subdirectory(external/Box2D)
|
||||
endif()
|
||||
|
||||
# unzip library
|
||||
add_subdirectory(external/unzip)
|
||||
|
||||
if(BUILD_EXTERN_LIBS)
|
||||
# tinyxml2 library
|
||||
add_subdirectory(external/tinyxml2)
|
||||
endif()
|
||||
|
||||
# xxhash library
|
||||
add_subdirectory(external/xxhash)
|
||||
|
@ -266,15 +241,13 @@ add_subdirectory(cocos/scripting/lua-bindings)
|
|||
add_subdirectory(external/xxtea)
|
||||
endif(BUILD_LIBS_LUA)
|
||||
|
||||
# build tests
|
||||
|
||||
add_subdirectory(tests/cpp-empty-test)
|
||||
|
||||
# build tests
|
||||
if(BUILD_CppTests)
|
||||
add_subdirectory(tests/cpp-empty-test)
|
||||
add_subdirectory(tests/cpp-tests)
|
||||
endif(BUILD_CppTests)
|
||||
|
||||
if(BUILD_LuaTests)
|
||||
add_subdirectory(tests/lua-tests/project)
|
||||
add_subdirectory(tests/lua-empty-test/project)
|
||||
endif(BUILD_LuaTests)
|
||||
endif(BUILD_LuaTests)
|
18
README.md
18
README.md
|
@ -21,12 +21,12 @@ cocos2d-x is:
|
|||
Git user attention
|
||||
-----------------------
|
||||
|
||||
1. After cloning the repo, please execute `download-deps.py` to download and install some dependences.
|
||||
1. After cloning the repo, please execute `download-deps.py` to download and install dependencies.
|
||||
|
||||
$ cd cocos2d-x
|
||||
$ python download-deps.py
|
||||
|
||||
2. Please execute `download-deps.py` once you synchronize with this repo. If there aren't any updates, it will not download dependences again.
|
||||
2. Please execute `download-deps.py` once you synchronize with this repo. If there aren't any updates, it will not download dependencies again.
|
||||
|
||||
How to start a new game
|
||||
-----------------------
|
||||
|
@ -43,21 +43,21 @@ Example:
|
|||
$ cocos new MyGame -p com.your_company.mygame -l cpp -d NEW_PROJECTS_DIR
|
||||
$ cd NEW_PROJECTS_DIR/MyGame
|
||||
|
||||
### Build and run new project for android ###
|
||||
### Build and run a new project for Android ###
|
||||
|
||||
$ cocos run -p android -j 4
|
||||
|
||||
### Build and run new project for iOS ###
|
||||
### Build and run a new project for iOS ###
|
||||
|
||||
$ cocos run -p ios
|
||||
|
||||
### Build and run new project for OSX ###
|
||||
### Build and run a new project for OSX ###
|
||||
|
||||
$ cocos run -p mac
|
||||
|
||||
### Build and run new project for linux ###
|
||||
### Build and run a new project for Linux ###
|
||||
|
||||
if you never run cocos2d-x on linux, you need to install all dependences by the
|
||||
if you never run cocos2d-x on Linux, you need to install all dependencies by the
|
||||
script in **cocos2d/build/install-deps-linux.sh**
|
||||
|
||||
$ cd cocos2d-x/build
|
||||
|
@ -104,9 +104,9 @@ Main features
|
|||
* Sound Engine support (CocosDenshion library) based on OpenAL
|
||||
* Integrated Slow motion/Fast forward
|
||||
* Fast and compressed textures: PVR compressed and uncompressed textures, ETC1 compressed textures, and more
|
||||
* Resolution Independence
|
||||
* Resolution Independent
|
||||
* Language: C++, with Lua and JavaScript bindings
|
||||
* Open Source Commercial Friendly: Compatible with open and closed source projects
|
||||
* Open Source Commercial Friendly(MIT): Compatible with open and closed source projects
|
||||
* OpenGL ES 2.0 (mobile) / OpenGL 2.1 (desktop) based
|
||||
|
||||
Build Requirements
|
||||
|
|
|
@ -11,3 +11,59 @@ macro(pre_build TARGET_NAME)
|
|||
add_custom_target( ${TARGET_NAME}_CORE_PRE_BUILD )
|
||||
add_dependencies( ${TARGET_NAME}_PRE_BUILD ${TARGET_NAME}_CORE_PRE_BUILD )
|
||||
endmacro()
|
||||
|
||||
#cmake has some strange defaults, this should help us a lot
|
||||
#Please use them everywhere
|
||||
|
||||
#WINDOWS = Windows Desktop
|
||||
#WINRT = Windows RT
|
||||
#WP8 = Windows Phone 8
|
||||
#ANDROID = ANDROID
|
||||
#IOS = IOS
|
||||
#MACOSX = MAC OSX
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
if(WINRT)
|
||||
set(SYSTEM_STRING "Windows RT")
|
||||
elseif(WP8)
|
||||
set(SYSTEM_STRING "Windows Phone 8")
|
||||
else()
|
||||
set(WINDOWS TRUE)
|
||||
set(SYSTEM_STRING "Windows Desktop")
|
||||
endif()
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
if(ANDROID)
|
||||
set(SYSTEM_STRING "Android")
|
||||
else()
|
||||
set(LINUX TRUE)
|
||||
set(SYSTEM_STRING "Linux")
|
||||
endif()
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
if(IOS)
|
||||
set(SYSTEM_STRING "IOS")
|
||||
else()
|
||||
set(MACOSX TRUE)
|
||||
set(SYSTEM_STRING "Mac OSX")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(COMPILER_STRING ${CMAKE_CXX_COMPILER_ID})
|
||||
set(CLANG TRUE)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
if(MINGW)
|
||||
set(COMPILER_STRING "Mingw GCC")
|
||||
else()
|
||||
set(COMPILER_STRING "GCC")
|
||||
endif()
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||
set(COMPILER_STRING "${CMAKE_CXX_COMPILER_ID} C++")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
set(COMPILER_STRING "Visual Studio C++")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
set(BUILDING_STRING "It appears you are cross compiling for ${SYSTEM_STRING} with ${COMPILER_STRING}")
|
||||
else()
|
||||
set(BUILDING_STRING "It appears you are builing natively for ${SYSTEM_STRING} with ${COMPILER_STRING}")
|
||||
endif()
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# msys2 Pacman Manager for cocos2d-x
|
||||
|
||||
#/****************************************************************************
|
||||
# Copyright (c) 2013-2014 Martell Malone
|
||||
#
|
||||
#
|
||||
# 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.
|
||||
# ****************************************************************************/
|
||||
|
||||
set -e
|
||||
|
||||
THISDIR="$(dirname $0)"
|
||||
test "$THISDIR" = "." && THISDIR=${PWD}
|
||||
OSTYPE=${OSTYPE//[0-9.]/}
|
||||
HOST_ARCH=$(uname -m)
|
||||
|
||||
if [ "${HOST_ARCH}" = "i686" ]; then
|
||||
BITS=32
|
||||
elif [ "${HOST_ARCH}" = "x86_64" ]; then
|
||||
BITS=64
|
||||
fi
|
||||
|
||||
if [ "${OSTYPE}" = "msys" ]; then
|
||||
|
||||
CC=clang
|
||||
CXX=clang++
|
||||
PP=mingw-w64-${HOST_ARCH}
|
||||
|
||||
MINGW_PACKAGES=(glfw glew libwebp libjpeg-turbo libpng freetype libiconv zlib curl
|
||||
make clang binutils headers cmake)
|
||||
|
||||
MINGW_PACKAGES=(${MINGW_PACKAGES[@]/#/${PP}-})
|
||||
|
||||
pacman -S --force --noconfirm --needed ${MINGW_PACKAGES[@]}
|
||||
|
||||
mkdir -p mingw${BITS}-clang && cd mingw${BITS}-clang
|
||||
|
||||
export PATH=/mingw${BITS}/bin:${PATH}
|
||||
|
||||
cmake -G"MinGW Makefiles" -DCMAKE_MAKE_PROGRAM="mingw32-make" \
|
||||
-DCMAKE_C_COMPILER="${CC}" -DCMAKE_CXX_COMPILER="${CXX}" ../..
|
||||
|
||||
mingw32-make
|
||||
fi
|
|
@ -1,62 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# msys2 Pacman Manager for cocos2d-x
|
||||
|
||||
#/****************************************************************************
|
||||
# Copyright (c) 2012-2013 Martell Malone
|
||||
#
|
||||
#
|
||||
# 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.
|
||||
# ****************************************************************************/
|
||||
|
||||
set -e
|
||||
|
||||
THISDIR="$(dirname $0)"
|
||||
test "$THISDIR" = "." && THISDIR=${PWD}
|
||||
OSTYPE=${OSTYPE//[0-9.]/}
|
||||
HOST_ARCH=$(uname -m)
|
||||
|
||||
if [ "${HOST_ARCH}" = "i686" ]; then
|
||||
BITS=32
|
||||
elif [ "${HOST_ARCH}" = "x86_64" ]; then
|
||||
BITS=64
|
||||
fi
|
||||
|
||||
if [ "${OSTYPE}" = "msys" ]; then
|
||||
|
||||
CC=${HOST_ARCH}-w64-mingw32-gcc
|
||||
CXX=${HOST_ARCH}-w64-mingw32-g++
|
||||
PP=mingw-w64-${HOST_ARCH}
|
||||
|
||||
MINGW_PACKAGES=(glfw glew libwebp libjpeg-turbo libpng freetype libiconv zlib curl
|
||||
make gcc binutils headers cmake)
|
||||
|
||||
MINGW_PACKAGES=(${MINGW_PACKAGES[@]/#/${PP}-})
|
||||
|
||||
pacman -S --force --noconfirm --needed ${MINGW_PACKAGES[@]}
|
||||
|
||||
mkdir -p mingw${BITS} && cd mingw${BITS}
|
||||
|
||||
export PATH=/mingw${BITS}/bin:${PATH}
|
||||
|
||||
cmake -G"MinGW Makefiles" -DCMAKE_MAKE_PROGRAM="mingw32-make" \
|
||||
-DCMAKE_C_COMPILER="${CC}" -DCMAKE_CXX_COMPILER="${CXX}" ../..
|
||||
|
||||
mingw32-make
|
||||
fi
|
|
@ -7,8 +7,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-tests", "..\tests\cpp-t
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libnetwork", "..\cocos\network\proj.win32\libNetwork.vcxproj", "{DF2638C0-8128-4847-867C-6EAFE3DEE7B5}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblua", "..\cocos\scripting\lua-bindings\proj.win32\liblua.vcxproj", "{DDC3E27F-004D-4DD4-9DD3-931A013D2159}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua-tests", "..\tests\lua-tests\project\proj.win32\lua-tests.win32.vcxproj", "{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-empty-test", "..\tests\cpp-empty-test\proj.win32\cpp-empty-test.vcxproj", "{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}"
|
||||
|
@ -31,6 +29,22 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocosbuilder", "..\cocos
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocostudio", "..\cocos\editor-support\cocostudio\proj.win32\libcocostudio.vcxproj", "{B57CF53F-2E49-4031-9822-047CC0E6BDE2}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libluacocos2d", "..\cocos\scripting\lua-bindings\proj.win32\libluacocos2d.vcxproj", "{9F2D6CE6-C893-4400-B50C-6DB70CC2562F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libluacocosdenshion", "..\cocos\scripting\lua-bindings\proj.win32\libluacocosdenshion.vcxproj", "{46A7D57A-7F25-4F52-823B-FFAC4FF3A624}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libluanetwork", "..\cocos\scripting\lua-bindings\proj.win32\libluanetwork.vcxproj", "{65E52F4B-703F-419E-AD67-926241A10042}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libluacocosbuilder", "..\cocos\scripting\lua-bindings\proj.win32\libluacocosbuilder.vcxproj", "{F8198014-F4F3-49F0-88AB-C1969A5829AF}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libluacocostudio", "..\cocos\scripting\lua-bindings\proj.win32\libluacocostudio.vcxproj", "{9640951E-C5D0-47B5-9C42-0BCADA261C50}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libluaui", "..\cocos\scripting\lua-bindings\proj.win32\libluaui.vcxproj", "{FE78EEBB-3DBB-4713-8CBF-63D742C5BD82}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libluaextension", "..\cocos\scripting\lua-bindings\proj.win32\libluaextension.vcxproj", "{7068296E-38A4-4BCA-85DB-3A09BD014847}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libluaspine", "..\cocos\scripting\lua-bindings\proj.win32\libluaspine.vcxproj", "{31EF6AB1-0D9A-4BC6-99B8-2C482EA373C4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
|
@ -49,10 +63,6 @@ Global
|
|||
{DF2638C0-8128-4847-867C-6EAFE3DEE7B5}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{DF2638C0-8128-4847-867C-6EAFE3DEE7B5}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{DF2638C0-8128-4847-867C-6EAFE3DEE7B5}.Release|Win32.Build.0 = Release|Win32
|
||||
{DDC3E27F-004D-4DD4-9DD3-931A013D2159}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{DDC3E27F-004D-4DD4-9DD3-931A013D2159}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{DDC3E27F-004D-4DD4-9DD3-931A013D2159}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{DDC3E27F-004D-4DD4-9DD3-931A013D2159}.Release|Win32.Build.0 = Release|Win32
|
||||
{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Release|Win32.ActiveCfg = Release|Win32
|
||||
|
@ -97,6 +107,38 @@ Global
|
|||
{B57CF53F-2E49-4031-9822-047CC0E6BDE2}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B57CF53F-2E49-4031-9822-047CC0E6BDE2}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B57CF53F-2E49-4031-9822-047CC0E6BDE2}.Release|Win32.Build.0 = Release|Win32
|
||||
{9F2D6CE6-C893-4400-B50C-6DB70CC2562F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9F2D6CE6-C893-4400-B50C-6DB70CC2562F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9F2D6CE6-C893-4400-B50C-6DB70CC2562F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9F2D6CE6-C893-4400-B50C-6DB70CC2562F}.Release|Win32.Build.0 = Release|Win32
|
||||
{46A7D57A-7F25-4F52-823B-FFAC4FF3A624}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{46A7D57A-7F25-4F52-823B-FFAC4FF3A624}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{46A7D57A-7F25-4F52-823B-FFAC4FF3A624}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{46A7D57A-7F25-4F52-823B-FFAC4FF3A624}.Release|Win32.Build.0 = Release|Win32
|
||||
{65E52F4B-703F-419E-AD67-926241A10042}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{65E52F4B-703F-419E-AD67-926241A10042}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{65E52F4B-703F-419E-AD67-926241A10042}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{65E52F4B-703F-419E-AD67-926241A10042}.Release|Win32.Build.0 = Release|Win32
|
||||
{F8198014-F4F3-49F0-88AB-C1969A5829AF}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F8198014-F4F3-49F0-88AB-C1969A5829AF}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F8198014-F4F3-49F0-88AB-C1969A5829AF}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{F8198014-F4F3-49F0-88AB-C1969A5829AF}.Release|Win32.Build.0 = Release|Win32
|
||||
{9640951E-C5D0-47B5-9C42-0BCADA261C50}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9640951E-C5D0-47B5-9C42-0BCADA261C50}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9640951E-C5D0-47B5-9C42-0BCADA261C50}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9640951E-C5D0-47B5-9C42-0BCADA261C50}.Release|Win32.Build.0 = Release|Win32
|
||||
{FE78EEBB-3DBB-4713-8CBF-63D742C5BD82}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{FE78EEBB-3DBB-4713-8CBF-63D742C5BD82}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{FE78EEBB-3DBB-4713-8CBF-63D742C5BD82}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{FE78EEBB-3DBB-4713-8CBF-63D742C5BD82}.Release|Win32.Build.0 = Release|Win32
|
||||
{7068296E-38A4-4BCA-85DB-3A09BD014847}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{7068296E-38A4-4BCA-85DB-3A09BD014847}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{7068296E-38A4-4BCA-85DB-3A09BD014847}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{7068296E-38A4-4BCA-85DB-3A09BD014847}.Release|Win32.Build.0 = Release|Win32
|
||||
{31EF6AB1-0D9A-4BC6-99B8-2C482EA373C4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{31EF6AB1-0D9A-4BC6-99B8-2C482EA373C4}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{31EF6AB1-0D9A-4BC6-99B8-2C482EA373C4}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{31EF6AB1-0D9A-4BC6-99B8-2C482EA373C4}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -50,6 +50,10 @@
|
|||
/* End PBXAggregateTarget section */
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
15EFA211198A2BB5000C57D3 /* CCProtectedNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15EFA20F198A2BB5000C57D3 /* CCProtectedNode.cpp */; };
|
||||
15EFA212198A2BB5000C57D3 /* CCProtectedNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15EFA20F198A2BB5000C57D3 /* CCProtectedNode.cpp */; };
|
||||
15EFA213198A2BB5000C57D3 /* CCProtectedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 15EFA210198A2BB5000C57D3 /* CCProtectedNode.h */; };
|
||||
15EFA214198A2BB5000C57D3 /* CCProtectedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 15EFA210198A2BB5000C57D3 /* CCProtectedNode.h */; };
|
||||
1A01C68418F57BE800EFE3A6 /* CCArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A01C67618F57BE800EFE3A6 /* CCArray.cpp */; };
|
||||
1A01C68518F57BE800EFE3A6 /* CCArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A01C67618F57BE800EFE3A6 /* CCArray.cpp */; };
|
||||
1A01C68618F57BE800EFE3A6 /* CCArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A01C67718F57BE800EFE3A6 /* CCArray.h */; };
|
||||
|
@ -580,6 +584,22 @@
|
|||
3E6176771960F89B00DE83F5 /* CCEventListenerController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E6176641960F89B00DE83F5 /* CCEventListenerController.h */; };
|
||||
3E6176781960F89B00DE83F5 /* CCGameController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E6176651960F89B00DE83F5 /* CCGameController.h */; };
|
||||
3E61781D1966A5A300DE83F5 /* CCController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E61781C1966A5A300DE83F5 /* CCController.cpp */; };
|
||||
3E9E80E9198639EF00FA95D0 /* CCAttachNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E9E80E3198639EF00FA95D0 /* CCAttachNode.cpp */; };
|
||||
3E9E80EA198639EF00FA95D0 /* CCAttachNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E9E80E3198639EF00FA95D0 /* CCAttachNode.cpp */; };
|
||||
3E9E80EB198639EF00FA95D0 /* CCAttachNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E9E80E4198639EF00FA95D0 /* CCAttachNode.h */; };
|
||||
3E9E80EC198639EF00FA95D0 /* CCAttachNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E9E80E4198639EF00FA95D0 /* CCAttachNode.h */; };
|
||||
3E9E80ED198639EF00FA95D0 /* CCSubMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E9E80E5198639EF00FA95D0 /* CCSubMesh.cpp */; };
|
||||
3E9E80EE198639EF00FA95D0 /* CCSubMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E9E80E5198639EF00FA95D0 /* CCSubMesh.cpp */; };
|
||||
3E9E80EF198639EF00FA95D0 /* CCSubMesh.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E9E80E6198639EF00FA95D0 /* CCSubMesh.h */; };
|
||||
3E9E80F0198639EF00FA95D0 /* CCSubMesh.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E9E80E6198639EF00FA95D0 /* CCSubMesh.h */; };
|
||||
3E9E80F1198639EF00FA95D0 /* CCSubMeshState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E9E80E7198639EF00FA95D0 /* CCSubMeshState.cpp */; };
|
||||
3E9E80F2198639EF00FA95D0 /* CCSubMeshState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E9E80E7198639EF00FA95D0 /* CCSubMeshState.cpp */; };
|
||||
3E9E80F3198639EF00FA95D0 /* CCSubMeshState.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E9E80E8198639EF00FA95D0 /* CCSubMeshState.h */; };
|
||||
3E9E80F4198639EF00FA95D0 /* CCSubMeshState.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E9E80E8198639EF00FA95D0 /* CCSubMeshState.h */; };
|
||||
3EA2A8401987A6810077B3D4 /* CCSkeleton3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EA2A83E1987A6810077B3D4 /* CCSkeleton3D.cpp */; };
|
||||
3EA2A8411987A6810077B3D4 /* CCSkeleton3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EA2A83E1987A6810077B3D4 /* CCSkeleton3D.cpp */; };
|
||||
3EA2A8421987A6810077B3D4 /* CCSkeleton3D.h in Headers */ = {isa = PBXBuildFile; fileRef = 3EA2A83F1987A6810077B3D4 /* CCSkeleton3D.h */; };
|
||||
3EA2A8431987A6810077B3D4 /* CCSkeleton3D.h in Headers */ = {isa = PBXBuildFile; fileRef = 3EA2A83F1987A6810077B3D4 /* CCSkeleton3D.h */; };
|
||||
3EA47870195478E00068D9D1 /* CCBundleReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EA4786E195478E00068D9D1 /* CCBundleReader.cpp */; };
|
||||
3EA47871195478E00068D9D1 /* CCBundleReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EA4786E195478E00068D9D1 /* CCBundleReader.cpp */; };
|
||||
3EA47872195478E00068D9D1 /* CCBundleReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 3EA4786F195478E00068D9D1 /* CCBundleReader.h */; };
|
||||
|
@ -877,8 +897,8 @@
|
|||
503DD8E91926736A00CD74DD /* CCES2Renderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 503DD8D71926736A00CD74DD /* CCES2Renderer.m */; };
|
||||
503DD8EA1926736A00CD74DD /* CCESRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 503DD8D81926736A00CD74DD /* CCESRenderer.h */; };
|
||||
503DD8EB1926736A00CD74DD /* CCGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 503DD8D91926736A00CD74DD /* CCGL.h */; };
|
||||
503DD8EC1926736A00CD74DD /* CCGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = 503DD8DA1926736A00CD74DD /* CCGLView.h */; };
|
||||
503DD8ED1926736A00CD74DD /* CCGLView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 503DD8DB1926736A00CD74DD /* CCGLView.mm */; };
|
||||
503DD8EC1926736A00CD74DD /* CCGLViewImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 503DD8DA1926736A00CD74DD /* CCGLViewImpl.h */; };
|
||||
503DD8ED1926736A00CD74DD /* CCGLViewImpl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 503DD8DB1926736A00CD74DD /* CCGLViewImpl.mm */; };
|
||||
503DD8EE1926736A00CD74DD /* CCImage.mm in Sources */ = {isa = PBXBuildFile; fileRef = 503DD8DC1926736A00CD74DD /* CCImage.mm */; };
|
||||
503DD8EF1926736A00CD74DD /* CCPlatformDefine.h in Headers */ = {isa = PBXBuildFile; fileRef = 503DD8DD1926736A00CD74DD /* CCPlatformDefine.h */; };
|
||||
503DD8F01926736A00CD74DD /* CCStdC.h in Headers */ = {isa = PBXBuildFile; fileRef = 503DD8DE1926736A00CD74DD /* CCStdC.h */; };
|
||||
|
@ -1203,10 +1223,10 @@
|
|||
50ABC00E1926664800A911A9 /* CCFileUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF231926664700A911A9 /* CCFileUtils.cpp */; };
|
||||
50ABC00F1926664800A911A9 /* CCFileUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF241926664700A911A9 /* CCFileUtils.h */; };
|
||||
50ABC0101926664800A911A9 /* CCFileUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF241926664700A911A9 /* CCFileUtils.h */; };
|
||||
50ABC0111926664800A911A9 /* CCGLViewProtocol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF251926664700A911A9 /* CCGLViewProtocol.cpp */; };
|
||||
50ABC0121926664800A911A9 /* CCGLViewProtocol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF251926664700A911A9 /* CCGLViewProtocol.cpp */; };
|
||||
50ABC0131926664800A911A9 /* CCGLViewProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF261926664700A911A9 /* CCGLViewProtocol.h */; };
|
||||
50ABC0141926664800A911A9 /* CCGLViewProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF261926664700A911A9 /* CCGLViewProtocol.h */; };
|
||||
50ABC0111926664800A911A9 /* CCGLView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF251926664700A911A9 /* CCGLView.cpp */; };
|
||||
50ABC0121926664800A911A9 /* CCGLView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF251926664700A911A9 /* CCGLView.cpp */; };
|
||||
50ABC0131926664800A911A9 /* CCGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF261926664700A911A9 /* CCGLView.h */; };
|
||||
50ABC0141926664800A911A9 /* CCGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF261926664700A911A9 /* CCGLView.h */; };
|
||||
50ABC0151926664800A911A9 /* CCImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF271926664700A911A9 /* CCImage.cpp */; };
|
||||
50ABC0161926664800A911A9 /* CCImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF271926664700A911A9 /* CCImage.cpp */; };
|
||||
50ABC0171926664800A911A9 /* CCImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF281926664700A911A9 /* CCImage.h */; };
|
||||
|
@ -1219,8 +1239,8 @@
|
|||
50ABC01E1926664800A911A9 /* CCThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF2B1926664700A911A9 /* CCThread.cpp */; };
|
||||
50ABC01F1926664800A911A9 /* CCThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF2C1926664700A911A9 /* CCThread.h */; };
|
||||
50ABC0201926664800A911A9 /* CCThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF2C1926664700A911A9 /* CCThread.h */; };
|
||||
50ABC0211926664800A911A9 /* CCGLView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF2E1926664700A911A9 /* CCGLView.cpp */; };
|
||||
50ABC0231926664800A911A9 /* CCGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF2F1926664700A911A9 /* CCGLView.h */; };
|
||||
50ABC0211926664800A911A9 /* CCGLViewImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF2E1926664700A911A9 /* CCGLViewImpl.cpp */; };
|
||||
50ABC0231926664800A911A9 /* CCGLViewImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF2F1926664700A911A9 /* CCGLViewImpl.h */; };
|
||||
50ABC05D1926664800A911A9 /* CCApplication.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF4F1926664700A911A9 /* CCApplication.h */; };
|
||||
50ABC05F1926664800A911A9 /* CCApplication.mm in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF501926664700A911A9 /* CCApplication.mm */; };
|
||||
50ABC0611926664800A911A9 /* CCCommon.mm in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF511926664700A911A9 /* CCCommon.mm */; };
|
||||
|
@ -1354,7 +1374,6 @@
|
|||
B2C59A2919777E7A00B452DF /* CocosGUI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905F9E918CF08D000240AA3 /* CocosGUI.cpp */; };
|
||||
B2C59A2A19777E8300B452DF /* UIDeprecated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29BDBA52195D597A003225C9 /* UIDeprecated.cpp */; };
|
||||
B2C59A2B19777E8300B452DF /* UIWidget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905FA1318CF08D100240AA3 /* UIWidget.cpp */; };
|
||||
B2C59A2C19777E8300B452DF /* CCProtectedNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E6D30C18DADB5D0051CA34 /* CCProtectedNode.cpp */; };
|
||||
B2C59A2D19777E8300B452DF /* UIHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905F9F418CF08D000240AA3 /* UIHelper.cpp */; };
|
||||
B2C59A2E19777E8C00B452DF /* UIHBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E6D32E18E174130051CA34 /* UIHBox.cpp */; };
|
||||
B2C59A2F19777E8C00B452DF /* UIRelativeBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E6D33018E174130051CA34 /* UIRelativeBox.cpp */; };
|
||||
|
@ -1378,7 +1397,6 @@
|
|||
B2C59A4119777EBC00B452DF /* UIVideoPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 3EA0FB69191C841D00B170C8 /* UIVideoPlayer.h */; };
|
||||
B2C59A4219777EC700B452DF /* UIDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 29080DEB191B82CE0066F8DF /* UIDeprecated.h */; };
|
||||
B2C59A4319777EC700B452DF /* UIWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA1418CF08D100240AA3 /* UIWidget.h */; };
|
||||
B2C59A4419777EC700B452DF /* CCProtectedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 50E6D30D18DADB5D0051CA34 /* CCProtectedNode.h */; };
|
||||
B2C59A4519777EC700B452DF /* UIHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905F9F518CF08D000240AA3 /* UIHelper.h */; };
|
||||
B2C59A4619777EC700B452DF /* GUIDefine.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905F9EB18CF08D000240AA3 /* GUIDefine.h */; };
|
||||
B2C59A4719777ECF00B452DF /* UIHBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 50E6D32F18E174130051CA34 /* UIHBox.h */; };
|
||||
|
@ -1563,11 +1581,9 @@
|
|||
B2CC507C19776DD10041958E /* CCPhysicsJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A170721807CE7A005B8026 /* CCPhysicsJoint.cpp */; };
|
||||
B2D3D3B91948613300BA4831 /* CCBundle3DData.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D3D3B81948613300BA4831 /* CCBundle3DData.h */; };
|
||||
B2D3D3BA1948613300BA4831 /* CCBundle3DData.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D3D3B81948613300BA4831 /* CCBundle3DData.h */; };
|
||||
B2DB4763197661CD00411E16 /* CCProtectedNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E6D30C18DADB5D0051CA34 /* CCProtectedNode.cpp */; };
|
||||
B2DB4764197661D500411E16 /* UIWidget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905FA1318CF08D100240AA3 /* UIWidget.cpp */; };
|
||||
B2DB4765197661E400411E16 /* UIHBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E6D32E18E174130051CA34 /* UIHBox.cpp */; };
|
||||
B2DB4766197661EE00411E16 /* UILayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905F9F818CF08D000240AA3 /* UILayout.cpp */; };
|
||||
B2DB4767197664EE00411E16 /* CCProtectedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 50E6D30D18DADB5D0051CA34 /* CCProtectedNode.h */; };
|
||||
B2DB47681976650A00411E16 /* UIWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA1418CF08D100240AA3 /* UIWidget.h */; };
|
||||
B2DB47691976651E00411E16 /* UIHBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 50E6D32F18E174130051CA34 /* UIHBox.h */; };
|
||||
B2DB476A1976653000411E16 /* UILayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905F9F918CF08D000240AA3 /* UILayout.h */; };
|
||||
|
@ -2052,6 +2068,8 @@
|
|||
06CAAAC1186AD63B0012A414 /* TriggerObj.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TriggerObj.h; sourceTree = "<group>"; };
|
||||
1551A33F158F2AB200E66CFE /* libcocos2d Mac.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libcocos2d Mac.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1551A342158F2AB200E66CFE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
15EFA20F198A2BB5000C57D3 /* CCProtectedNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCProtectedNode.cpp; sourceTree = "<group>"; };
|
||||
15EFA210198A2BB5000C57D3 /* CCProtectedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCProtectedNode.h; sourceTree = "<group>"; };
|
||||
1A01C67618F57BE800EFE3A6 /* CCArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCArray.cpp; sourceTree = "<group>"; };
|
||||
1A01C67718F57BE800EFE3A6 /* CCArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCArray.h; sourceTree = "<group>"; };
|
||||
1A01C67818F57BE800EFE3A6 /* CCBool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBool.h; sourceTree = "<group>"; };
|
||||
|
@ -2465,8 +2483,16 @@
|
|||
3E6176641960F89B00DE83F5 /* CCEventListenerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCEventListenerController.h; path = ../base/CCEventListenerController.h; sourceTree = "<group>"; };
|
||||
3E6176651960F89B00DE83F5 /* CCGameController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCGameController.h; path = ../base/CCGameController.h; sourceTree = "<group>"; };
|
||||
3E61781C1966A5A300DE83F5 /* CCController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCController.cpp; path = ../base/CCController.cpp; sourceTree = "<group>"; };
|
||||
3E9E80E3198639EF00FA95D0 /* CCAttachNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCAttachNode.cpp; sourceTree = "<group>"; };
|
||||
3E9E80E4198639EF00FA95D0 /* CCAttachNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCAttachNode.h; sourceTree = "<group>"; };
|
||||
3E9E80E5198639EF00FA95D0 /* CCSubMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSubMesh.cpp; sourceTree = "<group>"; };
|
||||
3E9E80E6198639EF00FA95D0 /* CCSubMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSubMesh.h; sourceTree = "<group>"; };
|
||||
3E9E80E7198639EF00FA95D0 /* CCSubMeshState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSubMeshState.cpp; sourceTree = "<group>"; };
|
||||
3E9E80E8198639EF00FA95D0 /* CCSubMeshState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSubMeshState.h; sourceTree = "<group>"; };
|
||||
3EA0FB69191C841D00B170C8 /* UIVideoPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIVideoPlayer.h; sourceTree = "<group>"; };
|
||||
3EA0FB6A191C841D00B170C8 /* UIVideoPlayerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIVideoPlayerIOS.mm; sourceTree = "<group>"; };
|
||||
3EA2A83E1987A6810077B3D4 /* CCSkeleton3D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSkeleton3D.cpp; sourceTree = "<group>"; };
|
||||
3EA2A83F1987A6810077B3D4 /* CCSkeleton3D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSkeleton3D.h; sourceTree = "<group>"; };
|
||||
3EA4786E195478E00068D9D1 /* CCBundleReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBundleReader.cpp; sourceTree = "<group>"; };
|
||||
3EA4786F195478E00068D9D1 /* CCBundleReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBundleReader.h; sourceTree = "<group>"; };
|
||||
464AD6E3197EBB1400E502D8 /* pvr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pvr.cpp; path = ../base/pvr.cpp; sourceTree = "<group>"; };
|
||||
|
@ -2736,8 +2762,8 @@
|
|||
503DD8D71926736A00CD74DD /* CCES2Renderer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCES2Renderer.m; sourceTree = "<group>"; };
|
||||
503DD8D81926736A00CD74DD /* CCESRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCESRenderer.h; sourceTree = "<group>"; };
|
||||
503DD8D91926736A00CD74DD /* CCGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGL.h; sourceTree = "<group>"; };
|
||||
503DD8DA1926736A00CD74DD /* CCGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGLView.h; sourceTree = "<group>"; };
|
||||
503DD8DB1926736A00CD74DD /* CCGLView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCGLView.mm; sourceTree = "<group>"; };
|
||||
503DD8DA1926736A00CD74DD /* CCGLViewImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGLViewImpl.h; sourceTree = "<group>"; };
|
||||
503DD8DB1926736A00CD74DD /* CCGLViewImpl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCGLViewImpl.mm; sourceTree = "<group>"; };
|
||||
503DD8DC1926736A00CD74DD /* CCImage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCImage.mm; sourceTree = "<group>"; };
|
||||
503DD8DD1926736A00CD74DD /* CCPlatformDefine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPlatformDefine.h; sourceTree = "<group>"; };
|
||||
503DD8DE1926736A00CD74DD /* CCStdC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCStdC.h; sourceTree = "<group>"; };
|
||||
|
@ -2909,16 +2935,16 @@
|
|||
50ABBF221926664700A911A9 /* CCDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCDevice.h; sourceTree = "<group>"; };
|
||||
50ABBF231926664700A911A9 /* CCFileUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCFileUtils.cpp; sourceTree = "<group>"; };
|
||||
50ABBF241926664700A911A9 /* CCFileUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCFileUtils.h; sourceTree = "<group>"; };
|
||||
50ABBF251926664700A911A9 /* CCGLViewProtocol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCGLViewProtocol.cpp; sourceTree = "<group>"; };
|
||||
50ABBF261926664700A911A9 /* CCGLViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGLViewProtocol.h; sourceTree = "<group>"; };
|
||||
50ABBF251926664700A911A9 /* CCGLView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCGLView.cpp; sourceTree = "<group>"; };
|
||||
50ABBF261926664700A911A9 /* CCGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGLView.h; sourceTree = "<group>"; };
|
||||
50ABBF271926664700A911A9 /* CCImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCImage.cpp; sourceTree = "<group>"; };
|
||||
50ABBF281926664700A911A9 /* CCImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCImage.h; sourceTree = "<group>"; };
|
||||
50ABBF291926664700A911A9 /* CCSAXParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSAXParser.cpp; sourceTree = "<group>"; };
|
||||
50ABBF2A1926664700A911A9 /* CCSAXParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSAXParser.h; sourceTree = "<group>"; };
|
||||
50ABBF2B1926664700A911A9 /* CCThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCThread.cpp; sourceTree = "<group>"; };
|
||||
50ABBF2C1926664700A911A9 /* CCThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCThread.h; sourceTree = "<group>"; };
|
||||
50ABBF2E1926664700A911A9 /* CCGLView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCGLView.cpp; sourceTree = "<group>"; };
|
||||
50ABBF2F1926664700A911A9 /* CCGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGLView.h; sourceTree = "<group>"; };
|
||||
50ABBF2E1926664700A911A9 /* CCGLViewImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCGLViewImpl.cpp; sourceTree = "<group>"; };
|
||||
50ABBF2F1926664700A911A9 /* CCGLViewImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGLViewImpl.h; sourceTree = "<group>"; };
|
||||
50ABBF4F1926664700A911A9 /* CCApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCApplication.h; sourceTree = "<group>"; };
|
||||
50ABBF501926664700A911A9 /* CCApplication.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCApplication.mm; sourceTree = "<group>"; };
|
||||
50ABBF511926664700A911A9 /* CCCommon.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCCommon.mm; sourceTree = "<group>"; };
|
||||
|
@ -2927,8 +2953,6 @@
|
|||
50ABBF541926664700A911A9 /* CCPlatformDefine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPlatformDefine.h; sourceTree = "<group>"; };
|
||||
50ABBF551926664700A911A9 /* CCStdC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCStdC.h; sourceTree = "<group>"; };
|
||||
50DC5180187B817900A9C23F /* RELEASE_NOTES.md */ = {isa = PBXFileReference; lastKnownFileType = text; name = RELEASE_NOTES.md; path = ../docs/RELEASE_NOTES.md; sourceTree = "<group>"; };
|
||||
50E6D30C18DADB5D0051CA34 /* CCProtectedNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCProtectedNode.cpp; sourceTree = "<group>"; };
|
||||
50E6D30D18DADB5D0051CA34 /* CCProtectedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCProtectedNode.h; sourceTree = "<group>"; };
|
||||
50E6D32E18E174130051CA34 /* UIHBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIHBox.cpp; sourceTree = "<group>"; };
|
||||
50E6D32F18E174130051CA34 /* UIHBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIHBox.h; sourceTree = "<group>"; };
|
||||
50E6D33018E174130051CA34 /* UIRelativeBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIRelativeBox.cpp; sourceTree = "<group>"; };
|
||||
|
@ -3378,6 +3402,8 @@
|
|||
1A570095180BC5B00088DEC7 /* base-nodes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
15EFA20F198A2BB5000C57D3 /* CCProtectedNode.cpp */,
|
||||
15EFA210198A2BB5000C57D3 /* CCProtectedNode.h */,
|
||||
1A57009C180BC5D20088DEC7 /* CCNode.cpp */,
|
||||
1A57009D180BC5D20088DEC7 /* CCNode.h */,
|
||||
1A570096180BC5C10088DEC7 /* CCAtlasNode.cpp */,
|
||||
|
@ -4310,8 +4336,6 @@
|
|||
29BDBA52195D597A003225C9 /* UIDeprecated.cpp */,
|
||||
2905FA1318CF08D100240AA3 /* UIWidget.cpp */,
|
||||
2905FA1418CF08D100240AA3 /* UIWidget.h */,
|
||||
50E6D30C18DADB5D0051CA34 /* CCProtectedNode.cpp */,
|
||||
50E6D30D18DADB5D0051CA34 /* CCProtectedNode.h */,
|
||||
2905F9F418CF08D000240AA3 /* UIHelper.cpp */,
|
||||
2905F9F518CF08D000240AA3 /* UIHelper.h */,
|
||||
2905F9EB18CF08D000240AA3 /* GUIDefine.h */,
|
||||
|
@ -4981,8 +5005,8 @@
|
|||
503DD8D71926736A00CD74DD /* CCES2Renderer.m */,
|
||||
503DD8D81926736A00CD74DD /* CCESRenderer.h */,
|
||||
503DD8D91926736A00CD74DD /* CCGL.h */,
|
||||
503DD8DA1926736A00CD74DD /* CCGLView.h */,
|
||||
503DD8DB1926736A00CD74DD /* CCGLView.mm */,
|
||||
503DD8DA1926736A00CD74DD /* CCGLViewImpl.h */,
|
||||
503DD8DB1926736A00CD74DD /* CCGLViewImpl.mm */,
|
||||
503DD8DC1926736A00CD74DD /* CCImage.mm */,
|
||||
503DD8DD1926736A00CD74DD /* CCPlatformDefine.h */,
|
||||
503DD8DE1926736A00CD74DD /* CCStdC.h */,
|
||||
|
@ -5003,8 +5027,8 @@
|
|||
50ABBF221926664700A911A9 /* CCDevice.h */,
|
||||
50ABBF231926664700A911A9 /* CCFileUtils.cpp */,
|
||||
50ABBF241926664700A911A9 /* CCFileUtils.h */,
|
||||
50ABBF251926664700A911A9 /* CCGLViewProtocol.cpp */,
|
||||
50ABBF261926664700A911A9 /* CCGLViewProtocol.h */,
|
||||
50ABBF251926664700A911A9 /* CCGLView.cpp */,
|
||||
50ABBF261926664700A911A9 /* CCGLView.h */,
|
||||
50ABBF271926664700A911A9 /* CCImage.cpp */,
|
||||
50ABBF281926664700A911A9 /* CCImage.h */,
|
||||
50ABBF291926664700A911A9 /* CCSAXParser.cpp */,
|
||||
|
@ -5031,8 +5055,8 @@
|
|||
50ABBF2D1926664700A911A9 /* desktop */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
50ABBF2E1926664700A911A9 /* CCGLView.cpp */,
|
||||
50ABBF2F1926664700A911A9 /* CCGLView.h */,
|
||||
50ABBF2E1926664700A911A9 /* CCGLViewImpl.cpp */,
|
||||
50ABBF2F1926664700A911A9 /* CCGLViewImpl.h */,
|
||||
);
|
||||
path = desktop;
|
||||
sourceTree = "<group>";
|
||||
|
@ -5194,6 +5218,14 @@
|
|||
B29594B81926D61F003EEF37 /* 3d */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3EA2A83E1987A6810077B3D4 /* CCSkeleton3D.cpp */,
|
||||
3EA2A83F1987A6810077B3D4 /* CCSkeleton3D.h */,
|
||||
3E9E80E3198639EF00FA95D0 /* CCAttachNode.cpp */,
|
||||
3E9E80E4198639EF00FA95D0 /* CCAttachNode.h */,
|
||||
3E9E80E5198639EF00FA95D0 /* CCSubMesh.cpp */,
|
||||
3E9E80E6198639EF00FA95D0 /* CCSubMesh.h */,
|
||||
3E9E80E7198639EF00FA95D0 /* CCSubMeshState.cpp */,
|
||||
3E9E80E8198639EF00FA95D0 /* CCSubMeshState.h */,
|
||||
3EA4786E195478E00068D9D1 /* CCBundleReader.cpp */,
|
||||
3EA4786F195478E00068D9D1 /* CCBundleReader.h */,
|
||||
B6AAF83F19404E0D0069DE01 /* CCBundle3D.cpp */,
|
||||
|
@ -5277,6 +5309,7 @@
|
|||
1A570093180BC5A10088DEC7 /* CCActionTween.h in Headers */,
|
||||
50ABBD4A1925AB0000A911A9 /* Mat4.h in Headers */,
|
||||
1A57009A180BC5C10088DEC7 /* CCAtlasNode.h in Headers */,
|
||||
3E9E80F3198639EF00FA95D0 /* CCSubMeshState.h in Headers */,
|
||||
1A5700A0180BC5D20088DEC7 /* CCNode.h in Headers */,
|
||||
50ABC0671926664800A911A9 /* CCPlatformDefine.h in Headers */,
|
||||
46C02E0918E91123004B7456 /* xxhash.h in Headers */,
|
||||
|
@ -5298,6 +5331,7 @@
|
|||
1A5701BB180BCB5A0088DEC7 /* CCLabel.h in Headers */,
|
||||
1A5701BF180BCB5A0088DEC7 /* CCLabelAtlas.h in Headers */,
|
||||
50ABBED91925AB6F00A911A9 /* ZipUtils.h in Headers */,
|
||||
3E9E80EB198639EF00FA95D0 /* CCAttachNode.h in Headers */,
|
||||
1A5701C3180BCB5A0088DEC7 /* CCLabelBMFont.h in Headers */,
|
||||
50ABBE5F1925AB6F00A911A9 /* CCEventListener.h in Headers */,
|
||||
1A5701C9180BCB5A0088DEC7 /* CCLabelTextFormatter.h in Headers */,
|
||||
|
@ -5354,6 +5388,7 @@
|
|||
50ABBE431925AB6F00A911A9 /* CCDirector.h in Headers */,
|
||||
1A12775B18DFCC540005F345 /* CCTweenFunction.h in Headers */,
|
||||
1A5702CA180BCE370088DEC7 /* CCTextFieldTTF.h in Headers */,
|
||||
15EFA213198A2BB5000C57D3 /* CCProtectedNode.h in Headers */,
|
||||
1A5702EC180BCE750088DEC7 /* CCTileMapAtlas.h in Headers */,
|
||||
1A5702F0180BCE750088DEC7 /* CCTMXLayer.h in Headers */,
|
||||
50ABC01B1926664800A911A9 /* CCSAXParser.h in Headers */,
|
||||
|
@ -5368,6 +5403,7 @@
|
|||
1A570302180BCE890088DEC7 /* CCParallaxNode.h in Headers */,
|
||||
50ABBE4B1925AB6F00A911A9 /* CCEventAcceleration.h in Headers */,
|
||||
1A57030E180BCF190088DEC7 /* CCComponent.h in Headers */,
|
||||
3E9E80EF198639EF00FA95D0 /* CCSubMesh.h in Headers */,
|
||||
1A570312180BCF190088DEC7 /* CCComponentContainer.h in Headers */,
|
||||
50ABBD851925AB4100A911A9 /* CCBatchCommand.h in Headers */,
|
||||
50ABC0651926664800A911A9 /* CCGL.h in Headers */,
|
||||
|
@ -5398,6 +5434,7 @@
|
|||
50ABBD3A1925AB0000A911A9 /* CCAffineTransform.h in Headers */,
|
||||
50ABBE571925AB6F00A911A9 /* CCEventFocus.h in Headers */,
|
||||
1A01C69218F57BE800EFE3A6 /* CCDouble.h in Headers */,
|
||||
3EA2A8421987A6810077B3D4 /* CCSkeleton3D.h in Headers */,
|
||||
50ABBE251925AB6F00A911A9 /* base64.h in Headers */,
|
||||
50ABBEC91925AB6F00A911A9 /* firePngData.h in Headers */,
|
||||
B29594CC1926D61F003EEF37 /* CCSprite3D.h in Headers */,
|
||||
|
@ -5405,7 +5442,7 @@
|
|||
50ABBD5A1925AB0000A911A9 /* Vec2.h in Headers */,
|
||||
B24AA987195A675C007B4522 /* CCFastTMXLayer.h in Headers */,
|
||||
50ABBEBD1925AB6F00A911A9 /* ccUtils.h in Headers */,
|
||||
50ABC0231926664800A911A9 /* CCGLView.h in Headers */,
|
||||
50ABC0231926664800A911A9 /* CCGLViewImpl.h in Headers */,
|
||||
50ABBFFD1926664800A911A9 /* CCFileUtilsApple.h in Headers */,
|
||||
5034CA41191D591100CE6051 /* ccShader_Position_uColor.frag in Headers */,
|
||||
50ABBE7F1925AB6F00A911A9 /* CCEventTouch.h in Headers */,
|
||||
|
@ -5431,7 +5468,7 @@
|
|||
B29594B61926D5EC003EEF37 /* CCMeshCommand.h in Headers */,
|
||||
50ABBE371925AB6F00A911A9 /* CCConsole.h in Headers */,
|
||||
50ABC00B1926664800A911A9 /* CCDevice.h in Headers */,
|
||||
50ABC0131926664800A911A9 /* CCGLViewProtocol.h in Headers */,
|
||||
50ABC0131926664800A911A9 /* CCGLView.h in Headers */,
|
||||
50ABBDB31925AB4100A911A9 /* ccShaders.h in Headers */,
|
||||
50ABBDAB1925AB4100A911A9 /* CCRenderCommandPool.h in Headers */,
|
||||
5034CA45191D591100CE6051 /* ccShader_Label_outline.frag in Headers */,
|
||||
|
@ -5619,7 +5656,7 @@
|
|||
B257B4511989D5E800D9A687 /* CCPrimitive.h in Headers */,
|
||||
50ABBE401925AB6F00A911A9 /* CCDataVisitor.h in Headers */,
|
||||
1A570064180BC5A10088DEC7 /* CCAction.h in Headers */,
|
||||
503DD8EC1926736A00CD74DD /* CCGLView.h in Headers */,
|
||||
503DD8EC1926736A00CD74DD /* CCGLViewImpl.h in Headers */,
|
||||
50ABBEBA1925AB6F00A911A9 /* ccUTF8.h in Headers */,
|
||||
1A570068180BC5A10088DEC7 /* CCActionCamera.h in Headers */,
|
||||
1A57006C180BC5A10088DEC7 /* CCActionCatmullRom.h in Headers */,
|
||||
|
@ -5640,8 +5677,9 @@
|
|||
B37510861823ACA100B3BA6A /* CCPhysicsWorldInfo_chipmunk.h in Headers */,
|
||||
1A570080180BC5A10088DEC7 /* CCActionInterval.h in Headers */,
|
||||
1A570084180BC5A10088DEC7 /* CCActionManager.h in Headers */,
|
||||
50ABC0141926664800A911A9 /* CCGLViewProtocol.h in Headers */,
|
||||
50ABC0141926664800A911A9 /* CCGLView.h in Headers */,
|
||||
1A570088180BC5A10088DEC7 /* CCActionPageTurn3D.h in Headers */,
|
||||
3EA2A8431987A6810077B3D4 /* CCSkeleton3D.h in Headers */,
|
||||
50ABBD9E1925AB4100A911A9 /* ccGLStateCache.h in Headers */,
|
||||
1A57008C180BC5A10088DEC7 /* CCActionProgressTimer.h in Headers */,
|
||||
1A570090180BC5A10088DEC7 /* CCActionTiledGrid.h in Headers */,
|
||||
|
@ -5712,6 +5750,7 @@
|
|||
5034CA2C191D591100CE6051 /* ccShader_PositionTextureA8Color.vert in Headers */,
|
||||
50ABBE981925AB6F00A911A9 /* CCProtocols.h in Headers */,
|
||||
50ABBD431925AB0000A911A9 /* CCMathBase.h in Headers */,
|
||||
15EFA214198A2BB5000C57D3 /* CCProtectedNode.h in Headers */,
|
||||
50ABBE441925AB6F00A911A9 /* CCDirector.h in Headers */,
|
||||
5034CA4A191D591100CE6051 /* ccShader_Label_df.frag in Headers */,
|
||||
1A570281180BCC900088DEC7 /* CCSprite.h in Headers */,
|
||||
|
@ -5731,6 +5770,7 @@
|
|||
5034CA44191D591100CE6051 /* ccShader_Label.vert in Headers */,
|
||||
1A5702F5180BCE750088DEC7 /* CCTMXObjectGroup.h in Headers */,
|
||||
1A5702F9180BCE750088DEC7 /* CCTMXTiledMap.h in Headers */,
|
||||
3E9E80F0198639EF00FA95D0 /* CCSubMesh.h in Headers */,
|
||||
1AC0269D1914068200FA920D /* ConvertUTF.h in Headers */,
|
||||
1A5702FD180BCE750088DEC7 /* CCTMXXMLParser.h in Headers */,
|
||||
1A570303180BCE890088DEC7 /* CCParallaxNode.h in Headers */,
|
||||
|
@ -5760,6 +5800,7 @@
|
|||
5034CA4C191D591100CE6051 /* ccShader_Label_df_glow.frag in Headers */,
|
||||
503DD8EB1926736A00CD74DD /* CCGL.h in Headers */,
|
||||
50ABBE3C1925AB6F00A911A9 /* CCData.h in Headers */,
|
||||
3E9E80EC198639EF00FA95D0 /* CCAttachNode.h in Headers */,
|
||||
503DD8FA1926B0DB00CD74DD /* CCIMEDispatcher.h in Headers */,
|
||||
50ABBEC81925AB6F00A911A9 /* etc1.h in Headers */,
|
||||
50ABBDB01925AB4100A911A9 /* CCRenderer.h in Headers */,
|
||||
|
@ -5821,6 +5862,7 @@
|
|||
503DD8F11926736A00CD74DD /* OpenGL_Internal.h in Headers */,
|
||||
B37510801823ACA100B3BA6A /* CCPhysicsHelper_chipmunk.h in Headers */,
|
||||
50ABBDAA1925AB4100A911A9 /* CCRenderCommand.h in Headers */,
|
||||
3E9E80F4198639EF00FA95D0 /* CCSubMeshState.h in Headers */,
|
||||
50ABBE601925AB6F00A911A9 /* CCEventListener.h in Headers */,
|
||||
50ABBEB21925AB6F00A911A9 /* CCUserDefault.h in Headers */,
|
||||
B6B2634019381FBF0088FE25 /* CCAnimationCurve.h in Headers */,
|
||||
|
@ -5975,7 +6017,6 @@
|
|||
B2DB47881976663A00411E16 /* UIRichText.h in Headers */,
|
||||
B2DB47801976660200411E16 /* UIButton.h in Headers */,
|
||||
B2DB47821976660C00411E16 /* UICheckBox.h in Headers */,
|
||||
B2DB4767197664EE00411E16 /* CCProtectedNode.h in Headers */,
|
||||
B2DB47861976662D00411E16 /* UILoadingBar.h in Headers */,
|
||||
B2DB47681976650A00411E16 /* UIWidget.h in Headers */,
|
||||
2958244D19873D8E00F9746D /* UIScale9Sprite.h in Headers */,
|
||||
|
@ -6017,7 +6058,6 @@
|
|||
B2C59A4119777EBC00B452DF /* UIVideoPlayer.h in Headers */,
|
||||
B2C59A4219777EC700B452DF /* UIDeprecated.h in Headers */,
|
||||
B2C59A4319777EC700B452DF /* UIWidget.h in Headers */,
|
||||
B2C59A4419777EC700B452DF /* CCProtectedNode.h in Headers */,
|
||||
B2C59A4519777EC700B452DF /* UIHelper.h in Headers */,
|
||||
B2C59A4619777EC700B452DF /* GUIDefine.h in Headers */,
|
||||
B2C59A4719777ECF00B452DF /* UIHBox.h in Headers */,
|
||||
|
@ -6733,7 +6773,9 @@
|
|||
50ABBDA71925AB4100A911A9 /* CCRenderCommand.cpp in Sources */,
|
||||
50ABBD501925AB0000A911A9 /* Quaternion.cpp in Sources */,
|
||||
50ABBEBB1925AB6F00A911A9 /* ccUtils.cpp in Sources */,
|
||||
15EFA211198A2BB5000C57D3 /* CCProtectedNode.cpp in Sources */,
|
||||
50ABBEB71925AB6F00A911A9 /* ccUTF8.cpp in Sources */,
|
||||
3E9E80F1198639EF00FA95D0 /* CCSubMeshState.cpp in Sources */,
|
||||
50ABBE271925AB6F00A911A9 /* CCAutoreleasePool.cpp in Sources */,
|
||||
50ABBE8B1925AB6F00A911A9 /* CCNS.cpp in Sources */,
|
||||
46A170E81807CECA005B8026 /* CCPhysicsContact.cpp in Sources */,
|
||||
|
@ -6758,6 +6800,7 @@
|
|||
1A57008D180BC5A10088DEC7 /* CCActionTiledGrid.cpp in Sources */,
|
||||
1A570091180BC5A10088DEC7 /* CCActionTween.cpp in Sources */,
|
||||
50ABBEBF1925AB6F00A911A9 /* CCValue.cpp in Sources */,
|
||||
3E9E80E9198639EF00FA95D0 /* CCAttachNode.cpp in Sources */,
|
||||
1A570098180BC5C10088DEC7 /* CCAtlasNode.cpp in Sources */,
|
||||
1A57009E180BC5D20088DEC7 /* CCNode.cpp in Sources */,
|
||||
B257B460198A353E00D9A687 /* CCPrimitiveCommand.cpp in Sources */,
|
||||
|
@ -6776,6 +6819,7 @@
|
|||
1A5701B1180BCB590088DEC7 /* CCFontFNT.cpp in Sources */,
|
||||
1A5701B5180BCB590088DEC7 /* CCFontFreeType.cpp in Sources */,
|
||||
1A5701B9180BCB5A0088DEC7 /* CCLabel.cpp in Sources */,
|
||||
3EA2A8401987A6810077B3D4 /* CCSkeleton3D.cpp in Sources */,
|
||||
1A5701BD180BCB5A0088DEC7 /* CCLabelAtlas.cpp in Sources */,
|
||||
50ABBE551925AB6F00A911A9 /* CCEventFocus.cpp in Sources */,
|
||||
50ABBE491925AB6F00A911A9 /* CCEventAcceleration.cpp in Sources */,
|
||||
|
@ -6788,6 +6832,7 @@
|
|||
1A5701CB180BCB5A0088DEC7 /* CCLabelTTF.cpp in Sources */,
|
||||
50ABBE711925AB6F00A911A9 /* CCEventListenerMouse.cpp in Sources */,
|
||||
1A5701DE180BCB8C0088DEC7 /* CCLayer.cpp in Sources */,
|
||||
3E9E80ED198639EF00FA95D0 /* CCSubMesh.cpp in Sources */,
|
||||
1A5701E2180BCB8C0088DEC7 /* CCScene.cpp in Sources */,
|
||||
1A12775C18DFCC590005F345 /* CCTweenFunction.cpp in Sources */,
|
||||
1A5701E6180BCB8C0088DEC7 /* CCTransition.cpp in Sources */,
|
||||
|
@ -6820,7 +6865,7 @@
|
|||
50ABBE351925AB6F00A911A9 /* CCConsole.cpp in Sources */,
|
||||
50ABBEAF1925AB6F00A911A9 /* CCUserDefault.cpp in Sources */,
|
||||
50ABBE791925AB6F00A911A9 /* CCEventMouse.cpp in Sources */,
|
||||
50ABC0111926664800A911A9 /* CCGLViewProtocol.cpp in Sources */,
|
||||
50ABC0111926664800A911A9 /* CCGLView.cpp in Sources */,
|
||||
B29594C21926D61F003EEF37 /* CCMesh.cpp in Sources */,
|
||||
50ABBE3D1925AB6F00A911A9 /* CCDataVisitor.cpp in Sources */,
|
||||
1A5702C8180BCE370088DEC7 /* CCTextFieldTTF.cpp in Sources */,
|
||||
|
@ -6883,7 +6928,7 @@
|
|||
50ABBDBD1925AB4100A911A9 /* CCTextureCache.cpp in Sources */,
|
||||
B29594CE1926D61F003EEF37 /* CCSprite3DMaterial.cpp in Sources */,
|
||||
299754F4193EC95400A54AC3 /* ObjectFactory.cpp in Sources */,
|
||||
50ABC0211926664800A911A9 /* CCGLView.cpp in Sources */,
|
||||
50ABC0211926664800A911A9 /* CCGLViewImpl.cpp in Sources */,
|
||||
50ABC00D1926664800A911A9 /* CCFileUtils.cpp in Sources */,
|
||||
50ABBE4D1925AB6F00A911A9 /* CCEventCustom.cpp in Sources */,
|
||||
50ABBE9F1925AB6F00A911A9 /* CCScheduler.cpp in Sources */,
|
||||
|
@ -7061,6 +7106,7 @@
|
|||
46A170FE1807CECB005B8026 /* CCPhysicsContact.cpp in Sources */,
|
||||
1A570062180BC5A10088DEC7 /* CCAction.cpp in Sources */,
|
||||
1A570066180BC5A10088DEC7 /* CCActionCamera.cpp in Sources */,
|
||||
3E9E80F2198639EF00FA95D0 /* CCSubMeshState.cpp in Sources */,
|
||||
1A57006A180BC5A10088DEC7 /* CCActionCatmullRom.cpp in Sources */,
|
||||
1A57006E180BC5A10088DEC7 /* CCActionEase.cpp in Sources */,
|
||||
50ABBD8C1925AB4100A911A9 /* CCGLProgram.cpp in Sources */,
|
||||
|
@ -7072,6 +7118,7 @@
|
|||
50ABBE6E1925AB6F00A911A9 /* CCEventListenerKeyboard.cpp in Sources */,
|
||||
50ABBE461925AB6F00A911A9 /* CCEvent.cpp in Sources */,
|
||||
50ABBEA01925AB6F00A911A9 /* CCScheduler.cpp in Sources */,
|
||||
3E9E80EA198639EF00FA95D0 /* CCAttachNode.cpp in Sources */,
|
||||
50ABBE4E1925AB6F00A911A9 /* CCEventCustom.cpp in Sources */,
|
||||
50ABBE761925AB6F00A911A9 /* CCEventListenerTouch.cpp in Sources */,
|
||||
50ABBE5A1925AB6F00A911A9 /* CCEventKeyboard.cpp in Sources */,
|
||||
|
@ -7134,7 +7181,7 @@
|
|||
1A570203180BCBD40088DEC7 /* CCClippingNode.cpp in Sources */,
|
||||
1A570209180BCBDF0088DEC7 /* CCMotionStreak.cpp in Sources */,
|
||||
1A570211180BCBF40088DEC7 /* CCProgressTimer.cpp in Sources */,
|
||||
503DD8ED1926736A00CD74DD /* CCGLView.mm in Sources */,
|
||||
503DD8ED1926736A00CD74DD /* CCGLViewImpl.mm in Sources */,
|
||||
1A570215180BCBF40088DEC7 /* CCRenderTexture.cpp in Sources */,
|
||||
1A570222180BCC1A0088DEC7 /* CCParticleBatchNode.cpp in Sources */,
|
||||
1A570226180BCC1A0088DEC7 /* CCParticleExamples.cpp in Sources */,
|
||||
|
@ -7144,6 +7191,7 @@
|
|||
1A57022E180BCC1A0088DEC7 /* CCParticleSystemQuad.cpp in Sources */,
|
||||
50ABBD901925AB4100A911A9 /* CCGLProgramCache.cpp in Sources */,
|
||||
1A57027F180BCC900088DEC7 /* CCSprite.cpp in Sources */,
|
||||
3EA2A8411987A6810077B3D4 /* CCSkeleton3D.cpp in Sources */,
|
||||
1A570283180BCC900088DEC7 /* CCSpriteBatchNode.cpp in Sources */,
|
||||
1A570287180BCC900088DEC7 /* CCSpriteFrame.cpp in Sources */,
|
||||
1A57028B180BCC900088DEC7 /* CCSpriteFrameCache.cpp in Sources */,
|
||||
|
@ -7205,9 +7253,10 @@
|
|||
50ABBE9A1925AB6F00A911A9 /* CCRef.cpp in Sources */,
|
||||
3E6176741960F89B00DE83F5 /* CCEventController.cpp in Sources */,
|
||||
50ABBE361925AB6F00A911A9 /* CCConsole.cpp in Sources */,
|
||||
3E9E80EE198639EF00FA95D0 /* CCSubMesh.cpp in Sources */,
|
||||
503DD8E51926736A00CD74DD /* CCDirectorCaller.mm in Sources */,
|
||||
50ABBD5D1925AB0000A911A9 /* Vec3.cpp in Sources */,
|
||||
50ABC0121926664800A911A9 /* CCGLViewProtocol.cpp in Sources */,
|
||||
50ABC0121926664800A911A9 /* CCGLView.cpp in Sources */,
|
||||
50ABC0021926664800A911A9 /* CCLock.cpp in Sources */,
|
||||
50ABBEBC1925AB6F00A911A9 /* ccUtils.cpp in Sources */,
|
||||
50ABBE721925AB6F00A911A9 /* CCEventListenerMouse.cpp in Sources */,
|
||||
|
@ -7226,6 +7275,7 @@
|
|||
1A1645B3191B726C008C7C7F /* ConvertUTFWrapper.cpp in Sources */,
|
||||
1ABA68AF1888D700007D1BB4 /* CCFontCharMap.cpp in Sources */,
|
||||
50ABBE7A1925AB6F00A911A9 /* CCEventMouse.cpp in Sources */,
|
||||
15EFA212198A2BB5000C57D3 /* CCProtectedNode.cpp in Sources */,
|
||||
50ABBD981925AB4100A911A9 /* CCGLProgramStateCache.cpp in Sources */,
|
||||
B6B26344193884D60088FE25 /* CCAnimation3D.cpp in Sources */,
|
||||
B276EF621988D1D500CD400F /* CCVertexIndexData.cpp in Sources */,
|
||||
|
@ -7370,7 +7420,6 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B2DB4763197661CD00411E16 /* CCProtectedNode.cpp in Sources */,
|
||||
B2DB4764197661D500411E16 /* UIWidget.cpp in Sources */,
|
||||
B2DB4765197661E400411E16 /* UIHBox.cpp in Sources */,
|
||||
B2DB4766197661EE00411E16 /* UILayout.cpp in Sources */,
|
||||
|
@ -7419,7 +7468,6 @@
|
|||
B2C59A2819777E7500B452DF /* UIImageView.cpp in Sources */,
|
||||
B2C59A2A19777E8300B452DF /* UIDeprecated.cpp in Sources */,
|
||||
B2C59A2B19777E8300B452DF /* UIWidget.cpp in Sources */,
|
||||
B2C59A2C19777E8300B452DF /* CCProtectedNode.cpp in Sources */,
|
||||
B2C59A2D19777E8300B452DF /* UIHelper.cpp in Sources */,
|
||||
B2C59A2E19777E8C00B452DF /* UIHBox.cpp in Sources */,
|
||||
B2C59A2F19777E8C00B452DF /* UIRelativeBox.cpp in Sources */,
|
||||
|
@ -7888,7 +7936,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_EXTENSION = a;
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
|
@ -7921,7 +7969,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_EXTENSION = a;
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
|
@ -7954,6 +8002,7 @@
|
|||
A03F2CB61780BD04006731B9 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
|
@ -7964,6 +8013,7 @@
|
|||
A03F2CB71780BD04006731B9 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
|
||||
|
@ -7975,6 +8025,7 @@
|
|||
A03F2D991780BDF7006731B9 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
CLANG_WARN_BOOL_CONVERSION = NO;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = NO;
|
||||
EXECUTABLE_PREFIX = "";
|
||||
|
@ -7990,6 +8041,7 @@
|
|||
A03F2D9A1780BDF7006731B9 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
CLANG_WARN_BOOL_CONVERSION = NO;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = NO;
|
||||
EXECUTABLE_PREFIX = "";
|
||||
|
@ -8006,6 +8058,7 @@
|
|||
A03F2E90178141C1006731B9 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"COCOS2D_DEBUG=1",
|
||||
|
@ -8022,6 +8075,7 @@
|
|||
A03F2E91178141C1006731B9 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"/Applications/Xcode\\ 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
|
||||
|
@ -8033,6 +8087,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = CC_TARGET_OS_MAC;
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
|
||||
|
@ -8045,6 +8100,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = CC_TARGET_OS_MAC;
|
||||
|
@ -8058,6 +8114,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
|
@ -8076,6 +8133,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
|
@ -8322,6 +8380,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
|
@ -8340,6 +8399,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
|
@ -8580,6 +8640,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
|
@ -8598,6 +8659,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
|
@ -8617,6 +8679,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
|
@ -8635,6 +8698,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
|
@ -8654,6 +8718,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
|
@ -8672,6 +8737,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
|
@ -8691,6 +8757,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
|
@ -8712,6 +8779,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = "$(ARCHS_STANDARD)";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -84,7 +84,7 @@ public:
|
|||
virtual ActionInstant* reverse() const override;
|
||||
virtual Show* clone() const override;
|
||||
|
||||
protected:
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
Show(){}
|
||||
virtual ~Show(){}
|
||||
|
||||
|
@ -108,7 +108,7 @@ public:
|
|||
virtual ActionInstant* reverse() const override;
|
||||
virtual Hide* clone() const override;
|
||||
|
||||
protected:
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
Hide(){}
|
||||
virtual ~Hide(){}
|
||||
|
||||
|
@ -131,7 +131,7 @@ public:
|
|||
virtual ToggleVisibility* reverse() const override;
|
||||
virtual ToggleVisibility* clone() const override;
|
||||
|
||||
protected:
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
ToggleVisibility(){}
|
||||
virtual ~ToggleVisibility(){}
|
||||
|
||||
|
|
|
@ -724,41 +724,57 @@ Spawn* Spawn::reverse() const
|
|||
// RotateTo
|
||||
//
|
||||
|
||||
RotateTo* RotateTo::create(float duration, float deltaAngle)
|
||||
RotateTo* RotateTo::create(float duration, float dstAngle)
|
||||
{
|
||||
RotateTo* rotateTo = new RotateTo();
|
||||
rotateTo->initWithDuration(duration, deltaAngle);
|
||||
rotateTo->initWithDuration(duration, dstAngle, dstAngle);
|
||||
rotateTo->autorelease();
|
||||
|
||||
return rotateTo;
|
||||
}
|
||||
|
||||
bool RotateTo::initWithDuration(float duration, float deltaAngle)
|
||||
{
|
||||
if (ActionInterval::initWithDuration(duration))
|
||||
{
|
||||
_dstAngleX = _dstAngleY = deltaAngle;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
RotateTo* RotateTo::create(float duration, float deltaAngleX, float deltaAngleY)
|
||||
RotateTo* RotateTo::create(float duration, float dstAngleX, float dstAngleY)
|
||||
{
|
||||
RotateTo* rotateTo = new RotateTo();
|
||||
rotateTo->initWithDuration(duration, deltaAngleX, deltaAngleY);
|
||||
rotateTo->initWithDuration(duration, dstAngleX, dstAngleY);
|
||||
rotateTo->autorelease();
|
||||
|
||||
return rotateTo;
|
||||
}
|
||||
|
||||
bool RotateTo::initWithDuration(float duration, float deltaAngleX, float deltaAngleY)
|
||||
RotateTo* RotateTo::create(float duration, const Vec3& dstAngle3D)
|
||||
{
|
||||
RotateTo* rotateTo = new RotateTo();
|
||||
rotateTo->initWithDuration(duration, dstAngle3D);
|
||||
rotateTo->autorelease();
|
||||
|
||||
return rotateTo;
|
||||
}
|
||||
|
||||
RotateTo::RotateTo()
|
||||
: _is3D(false)
|
||||
{
|
||||
}
|
||||
|
||||
bool RotateTo::initWithDuration(float duration, float dstAngleX, float dstAngleY)
|
||||
{
|
||||
if (ActionInterval::initWithDuration(duration))
|
||||
{
|
||||
_dstAngleX = deltaAngleX;
|
||||
_dstAngleY = deltaAngleY;
|
||||
_dstAngle.x = dstAngleX;
|
||||
_dstAngle.y = dstAngleY;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RotateTo::initWithDuration(float duration, const Vec3& dstAngle3D)
|
||||
{
|
||||
if (ActionInterval::initWithDuration(duration))
|
||||
{
|
||||
_dstAngle = dstAngle3D;
|
||||
_is3D = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -770,84 +786,90 @@ RotateTo* RotateTo::clone(void) const
|
|||
{
|
||||
// no copy constructor
|
||||
auto a = new RotateTo();
|
||||
a->initWithDuration(_duration, _dstAngleX, _dstAngleY);
|
||||
if(_is3D)
|
||||
a->initWithDuration(_duration, _dstAngle);
|
||||
else
|
||||
a->initWithDuration(_duration, _dstAngle.x, _dstAngle.y);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
void RotateTo::calculateAngles(float &startAngle, float &diffAngle, float dstAngle)
|
||||
{
|
||||
if (startAngle > 0)
|
||||
{
|
||||
startAngle = fmodf(startAngle, 360.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
startAngle = fmodf(startAngle, -360.0f);
|
||||
}
|
||||
|
||||
diffAngle = dstAngle - startAngle;
|
||||
if (diffAngle > 180)
|
||||
{
|
||||
diffAngle -= 360;
|
||||
}
|
||||
if (diffAngle < -180)
|
||||
{
|
||||
diffAngle += 360;
|
||||
}
|
||||
}
|
||||
|
||||
void RotateTo::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(target);
|
||||
|
||||
// Calculate X
|
||||
_startAngleX = target->getRotationSkewX();
|
||||
if (_startAngleX > 0)
|
||||
if (_is3D)
|
||||
{
|
||||
_startAngleX = fmodf(_startAngleX, 360.0f);
|
||||
_startAngle = _target->getRotation3D();
|
||||
}
|
||||
else
|
||||
{
|
||||
_startAngleX = fmodf(_startAngleX, -360.0f);
|
||||
_startAngle.x = _target->getRotationSkewX();
|
||||
_startAngle.y = _target->getRotationSkewY();
|
||||
}
|
||||
|
||||
_diffAngleX = _dstAngleX - _startAngleX;
|
||||
if (_diffAngleX > 180)
|
||||
{
|
||||
_diffAngleX -= 360;
|
||||
}
|
||||
if (_diffAngleX < -180)
|
||||
{
|
||||
_diffAngleX += 360;
|
||||
}
|
||||
|
||||
//Calculate Y: It's duplicated from calculating X since the rotation wrap should be the same
|
||||
_startAngleY = _target->getRotationSkewY();
|
||||
|
||||
if (_startAngleY > 0)
|
||||
{
|
||||
_startAngleY = fmodf(_startAngleY, 360.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
_startAngleY = fmodf(_startAngleY, -360.0f);
|
||||
}
|
||||
|
||||
_diffAngleY = _dstAngleY - _startAngleY;
|
||||
if (_diffAngleY > 180)
|
||||
{
|
||||
_diffAngleY -= 360;
|
||||
}
|
||||
|
||||
if (_diffAngleY < -180)
|
||||
{
|
||||
_diffAngleY += 360;
|
||||
}
|
||||
calculateAngles(_startAngle.x, _diffAngle.x, _dstAngle.x);
|
||||
calculateAngles(_startAngle.y, _diffAngle.y, _dstAngle.y);
|
||||
calculateAngles(_startAngle.z, _diffAngle.z, _dstAngle.z);
|
||||
}
|
||||
|
||||
void RotateTo::update(float time)
|
||||
{
|
||||
if (_target)
|
||||
{
|
||||
#if CC_USE_PHYSICS
|
||||
if (_startAngleX == _startAngleY && _diffAngleX == _diffAngleY)
|
||||
if(_is3D)
|
||||
{
|
||||
_target->setRotation(_startAngleX + _diffAngleX * time);
|
||||
_target->setRotation3D(Vec3(
|
||||
_startAngle.x + _diffAngle.x * time,
|
||||
_startAngle.y + _diffAngle.y * time,
|
||||
_startAngle.z + _diffAngle.z * time
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
// _startAngleX != _startAngleY || _diffAngleX != _diffAngleY
|
||||
if (_target->getPhysicsBody() != nullptr)
|
||||
#if CC_USE_PHYSICS
|
||||
if (_startAngle.x == _startAngle.y && _diffAngle.x == _diffAngle.y)
|
||||
{
|
||||
CCLOG("RotateTo WARNING: PhysicsBody doesn't support skew rotation");
|
||||
_target->setRotation(_startAngle.x + _diffAngle.x * time);
|
||||
}
|
||||
else
|
||||
{
|
||||
// _startAngle.x != _startAngle.y || _diffAngle.x != _diffAngle.y
|
||||
if (_target->getPhysicsBody() != nullptr)
|
||||
{
|
||||
CCLOG("RotateTo WARNING: PhysicsBody doesn't support skew rotation");
|
||||
}
|
||||
|
||||
_target->setRotationSkewX(_startAngle.x + _diffAngle.x * time);
|
||||
_target->setRotationSkewY(_startAngle.y + _diffAngle.y * time);
|
||||
}
|
||||
|
||||
_target->setRotationSkewX(_startAngleX + _diffAngleX * time);
|
||||
_target->setRotationSkewY(_startAngleY + _diffAngleY * time);
|
||||
}
|
||||
#else
|
||||
_target->setRotationSkewX(_startAngleX + _diffAngleX * time);
|
||||
_target->setRotationSkewY(_startAngleY + _diffAngleY * time);
|
||||
_target->setRotationSkewX(_startAngle.x + _diffAngle.x * time);
|
||||
_target->setRotationSkewY(_startAngle.y + _diffAngle.y * time);
|
||||
#endif // CC_USE_PHYSICS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -897,7 +919,7 @@ bool RotateBy::initWithDuration(float duration, float deltaAngle)
|
|||
{
|
||||
if (ActionInterval::initWithDuration(duration))
|
||||
{
|
||||
_angleZ_X = _angleZ_Y = deltaAngle;
|
||||
_deltaAngle.x = _deltaAngle.y = deltaAngle;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -908,8 +930,8 @@ bool RotateBy::initWithDuration(float duration, float deltaAngleX, float deltaAn
|
|||
{
|
||||
if (ActionInterval::initWithDuration(duration))
|
||||
{
|
||||
_angleZ_X = deltaAngleX;
|
||||
_angleZ_Y = deltaAngleY;
|
||||
_deltaAngle.x = deltaAngleX;
|
||||
_deltaAngle.y = deltaAngleY;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -920,7 +942,7 @@ bool RotateBy::initWithDuration(float duration, const Vec3& deltaAngle3D)
|
|||
{
|
||||
if (ActionInterval::initWithDuration(duration))
|
||||
{
|
||||
_angle3D = deltaAngle3D;
|
||||
_deltaAngle = deltaAngle3D;
|
||||
_is3D = true;
|
||||
return true;
|
||||
}
|
||||
|
@ -934,9 +956,9 @@ RotateBy* RotateBy::clone() const
|
|||
// no copy constructor
|
||||
auto a = new RotateBy();
|
||||
if(_is3D)
|
||||
a->initWithDuration(_duration, _angle3D);
|
||||
a->initWithDuration(_duration, _deltaAngle);
|
||||
else
|
||||
a->initWithDuration(_duration, _angleZ_X, _angleZ_Y);
|
||||
a->initWithDuration(_duration, _deltaAngle.x, _deltaAngle.y);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -946,12 +968,12 @@ void RotateBy::startWithTarget(Node *target)
|
|||
ActionInterval::startWithTarget(target);
|
||||
if(_is3D)
|
||||
{
|
||||
_startAngle3D = target->getRotation3D();
|
||||
_startAngle = target->getRotation3D();
|
||||
}
|
||||
else
|
||||
{
|
||||
_startAngleZ_X = target->getRotationSkewX();
|
||||
_startAngleZ_Y = target->getRotationSkewY();
|
||||
_startAngle.x = target->getRotationSkewX();
|
||||
_startAngle.y = target->getRotationSkewY();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -963,32 +985,32 @@ void RotateBy::update(float time)
|
|||
if(_is3D)
|
||||
{
|
||||
Vec3 v;
|
||||
v.x = _startAngle3D.x + _angle3D.x * time;
|
||||
v.y = _startAngle3D.y + _angle3D.y * time;
|
||||
v.z = _startAngle3D.z + _angle3D.z * time;
|
||||
v.x = _startAngle.x + _deltaAngle.x * time;
|
||||
v.y = _startAngle.y + _deltaAngle.y * time;
|
||||
v.z = _startAngle.z + _deltaAngle.z * time;
|
||||
_target->setRotation3D(v);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if CC_USE_PHYSICS
|
||||
if (_startAngleZ_X == _startAngleZ_Y && _angleZ_X == _angleZ_Y)
|
||||
if (_startAngle.x == _startAngle.y && _deltaAngle.x == _deltaAngle.y)
|
||||
{
|
||||
_target->setRotation(_startAngleZ_X + _angleZ_X * time);
|
||||
_target->setRotation(_startAngle.x + _deltaAngle.x * time);
|
||||
}
|
||||
else
|
||||
{
|
||||
// _startAngleZ_X != _startAngleZ_Y || _angleZ_X != _angleZ_Y
|
||||
// _startAngle.x != _startAngle.y || _deltaAngle.x != _deltaAngle.y
|
||||
if (_target->getPhysicsBody() != nullptr)
|
||||
{
|
||||
CCLOG("RotateBy WARNING: PhysicsBody doesn't support skew rotation");
|
||||
}
|
||||
|
||||
_target->setRotationSkewX(_startAngleZ_X + _angleZ_X * time);
|
||||
_target->setRotationSkewY(_startAngleZ_Y + _angleZ_Y * time);
|
||||
_target->setRotationSkewX(_startAngle.x + _deltaAngle.x * time);
|
||||
_target->setRotationSkewY(_startAngle.y + _deltaAngle.y * time);
|
||||
}
|
||||
#else
|
||||
_target->setRotationSkewX(_startAngleZ_X + _angleZ_X * time);
|
||||
_target->setRotationSkewY(_startAngleZ_Y + _angleZ_Y * time);
|
||||
_target->setRotationSkewX(_startAngle.x + _deltaAngle.x * time);
|
||||
_target->setRotationSkewY(_startAngle.y + _deltaAngle.y * time);
|
||||
#endif // CC_USE_PHYSICS
|
||||
}
|
||||
}
|
||||
|
@ -999,12 +1021,15 @@ RotateBy* RotateBy::reverse() const
|
|||
if(_is3D)
|
||||
{
|
||||
Vec3 v;
|
||||
v.x = - _angle3D.x;
|
||||
v.y = - _angle3D.y;
|
||||
v.z = - _angle3D.z;
|
||||
v.x = - _deltaAngle.x;
|
||||
v.y = - _deltaAngle.y;
|
||||
v.z = - _deltaAngle.z;
|
||||
return RotateBy::create(_duration, v);
|
||||
}
|
||||
return RotateBy::create(_duration, -_angleZ_X, -_angleZ_Y);
|
||||
else
|
||||
{
|
||||
return RotateBy::create(_duration, -_deltaAngle.x, -_deltaAngle.y);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -339,10 +339,13 @@ class CC_DLL RotateTo : public ActionInterval
|
|||
{
|
||||
public:
|
||||
/** creates the action with separate rotation angles */
|
||||
static RotateTo* create(float duration, float deltaAngleX, float deltaAngleY);
|
||||
static RotateTo* create(float duration, float dstAngleX, float dstAngleY);
|
||||
|
||||
/** creates the action */
|
||||
static RotateTo* create(float duration, float deltaAngle);
|
||||
static RotateTo* create(float duration, float dstAngle);
|
||||
|
||||
/** creates the action with 3D rotation angles */
|
||||
static RotateTo* create(float duration, const Vec3& dstAngle3D);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -353,21 +356,21 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
RotateTo() {}
|
||||
RotateTo();
|
||||
virtual ~RotateTo() {}
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float duration, float deltaAngle);
|
||||
bool initWithDuration(float duration, float deltaAngleX, float deltaAngleY);
|
||||
bool initWithDuration(float duration, float dstAngleX, float dstAngleY);
|
||||
bool initWithDuration(float duration, const Vec3& dstAngle3D);
|
||||
|
||||
/** calculates the start and diff angles */
|
||||
void calculateAngles(float &startAngle, float &diffAngle, float dstAngle);
|
||||
|
||||
protected:
|
||||
float _dstAngleX;
|
||||
float _startAngleX;
|
||||
float _diffAngleX;
|
||||
|
||||
float _dstAngleY;
|
||||
float _startAngleY;
|
||||
float _diffAngleY;
|
||||
bool _is3D;
|
||||
Vec3 _dstAngle;
|
||||
Vec3 _startAngle;
|
||||
Vec3 _diffAngle;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(RotateTo);
|
||||
|
@ -403,14 +406,9 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
bool initWithDuration(float duration, const Vec3& deltaAngle3D);
|
||||
|
||||
protected:
|
||||
float _angleZ_X;
|
||||
float _startAngleZ_X;
|
||||
float _angleZ_Y;
|
||||
float _startAngleZ_Y;
|
||||
|
||||
bool _is3D;
|
||||
Vec3 _angle3D;
|
||||
Vec3 _startAngle3D;
|
||||
Vec3 _deltaAngle;
|
||||
Vec3 _startAngle;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(RotateBy);
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
LabelAtlas()
|
||||
:_string("")
|
||||
{}
|
||||
|
|
|
@ -204,7 +204,7 @@ const Size& LabelBMFont::getContentSize() const
|
|||
|
||||
Rect LabelBMFont::getBoundingBox() const
|
||||
{
|
||||
return _label->getBoundingBox();
|
||||
return Node::getBoundingBox();
|
||||
}
|
||||
#if CC_LABELBMFONT_DEBUG_DRAW
|
||||
void LabelBMFont::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||
|
|
|
@ -280,7 +280,8 @@ const Size& LabelTTF::getContentSize() const
|
|||
|
||||
Rect LabelTTF::getBoundingBox() const
|
||||
{
|
||||
return _renderLabel->getBoundingBox();
|
||||
const_cast<LabelTTF*>(this)->setContentSize(_renderLabel->getContentSize());
|
||||
return Node::getBoundingBox();
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
|
||||
|
|
|
@ -1852,7 +1852,10 @@ bool Node::removeComponent(const std::string& name)
|
|||
|
||||
bool Node::removeComponent(Component *component)
|
||||
{
|
||||
return _componentContainer->remove(component);
|
||||
if (_componentContainer) {
|
||||
return _componentContainer->remove(component);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Node::removeAllComponents()
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
virtual void removeAllChildrenWithCleanup(bool cleanup) override;
|
||||
virtual void visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override;
|
||||
|
||||
protected:
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
/** Adds a child to the container with a z-order, a parallax ratio and a position offset
|
||||
It returns self, so you can chain several addChilds.
|
||||
@since v0.8
|
||||
|
@ -83,6 +83,7 @@ protected:
|
|||
*/
|
||||
virtual ~ParallaxNode();
|
||||
|
||||
protected:
|
||||
Vec2 absolutePosition();
|
||||
|
||||
Vec2 _lastPosition;
|
||||
|
|
|
@ -31,11 +31,10 @@
|
|||
|
||||
|
||||
#include "2d/CCNode.h"
|
||||
#include "ui/GUIExport.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class CC_GUI_DLL ProtectedNode : public Node
|
||||
class CC_DLL ProtectedNode : public Node
|
||||
{
|
||||
public:
|
||||
static ProtectedNode * create(void);
|
|
@ -555,7 +555,7 @@ void RenderTexture::onBegin()
|
|||
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
||||
Mat4 modifiedProjection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
modifiedProjection = CCEGLView::sharedOpenGLView()->getReverseOrientationMatrix() * modifiedProjection;
|
||||
modifiedProjection = GLViewImpl::sharedOpenGLView()->getReverseOrientationMatrix() * modifiedProjection;
|
||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION,modifiedProjection);
|
||||
#endif
|
||||
|
||||
|
@ -574,7 +574,7 @@ void RenderTexture::onBegin()
|
|||
{
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
||||
Mat4 modifiedProjection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
modifiedProjection = CCEGLView::sharedOpenGLView()->getReverseOrientationMatrix() * modifiedProjection;
|
||||
modifiedProjection = GLViewImpl::sharedOpenGLView()->getReverseOrientationMatrix() * modifiedProjection;
|
||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, modifiedProjection);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -210,6 +210,12 @@ void SpriteFrameCache::addSpriteFramesWithFile(const std::string& plist, Texture
|
|||
_loadedFileNames->insert(plist);
|
||||
}
|
||||
|
||||
void SpriteFrameCache::addSpriteFramesWithFileContent(const std::string& plist_content, Texture2D *texture)
|
||||
{
|
||||
ValueMap dict = FileUtils::getInstance()->getValueMapFromData(plist_content.c_str(), plist_content.size());
|
||||
addSpriteFramesWithDictionary(dict, texture);
|
||||
}
|
||||
|
||||
void SpriteFrameCache::addSpriteFramesWithFile(const std::string& plist, const std::string& textureFileName)
|
||||
{
|
||||
CCASSERT(textureFileName.size()>0, "texture name should not be null");
|
||||
|
@ -357,6 +363,17 @@ void SpriteFrameCache::removeSpriteFramesFromFile(const std::string& plist)
|
|||
}
|
||||
}
|
||||
|
||||
void SpriteFrameCache::removeSpriteFramesFromFileContent(const std::string& plist_content)
|
||||
{
|
||||
ValueMap dict = FileUtils::getInstance()->getValueMapFromData(plist_content.data(), plist_content.size());
|
||||
if (dict.empty())
|
||||
{
|
||||
CCLOG("cocos2d:SpriteFrameCache:removeSpriteFramesFromFileContent: create dict by fail.");
|
||||
return;
|
||||
}
|
||||
removeSpriteFramesFromDictionary(dict);
|
||||
}
|
||||
|
||||
void SpriteFrameCache::removeSpriteFramesFromDictionary(ValueMap& dictionary)
|
||||
{
|
||||
ValueMap framesDict = dictionary["frames"].asValueMap();
|
||||
|
|
|
@ -106,6 +106,12 @@ public:
|
|||
*/
|
||||
void addSpriteFramesWithFile(const std::string&plist, Texture2D *texture);
|
||||
|
||||
/** Adds multiple Sprite Frames from a plist file content. The texture will be associated with the created sprite frames.
|
||||
* @js addSpriteFrames
|
||||
* @lua addSpriteFrames
|
||||
*/
|
||||
void addSpriteFramesWithFileContent(const std::string& plist_content, Texture2D *texture);
|
||||
|
||||
/** Adds an sprite frame with a given name.
|
||||
If the name already exists, then the contents of the old name will be replaced with the new one.
|
||||
*/
|
||||
|
@ -135,6 +141,12 @@ public:
|
|||
*/
|
||||
void removeSpriteFramesFromFile(const std::string& plist);
|
||||
|
||||
/** Removes multiple Sprite Frames from a plist file content.
|
||||
* Sprite Frames stored in this file will be removed.
|
||||
* It is convenient to call this method when a specific texture needs to be removed.
|
||||
*/
|
||||
void removeSpriteFramesFromFileContent(const std::string& plist_content);
|
||||
|
||||
/** Removes all Sprite Frames associated with the specified textures.
|
||||
* It is convenient to call this method when a specific texture needs to be removed.
|
||||
* @since v0.995.
|
||||
|
|
|
@ -26,7 +26,6 @@ THE SOFTWARE.
|
|||
#include "CCTextFieldTTF.h"
|
||||
|
||||
#include "base/CCDirector.h"
|
||||
#include "CCGLView.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -140,7 +139,7 @@ bool TextFieldTTF::attachWithIME()
|
|||
if (ret)
|
||||
{
|
||||
// open keyboard
|
||||
GLView * pGlView = Director::getInstance()->getOpenGLView();
|
||||
auto pGlView = Director::getInstance()->getOpenGLView();
|
||||
if (pGlView)
|
||||
{
|
||||
pGlView->setIMEKeyboardState(true);
|
||||
|
@ -155,7 +154,7 @@ bool TextFieldTTF::detachWithIME()
|
|||
if (ret)
|
||||
{
|
||||
// close keyboard
|
||||
GLView * glView = Director::getInstance()->getOpenGLView();
|
||||
auto glView = Director::getInstance()->getOpenGLView();
|
||||
if (glView)
|
||||
{
|
||||
glView->setIMEKeyboardState(false);
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
if(WIN32)
|
||||
|
||||
ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
|
||||
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
../external/ConvertUTF
|
||||
)
|
||||
|
@ -58,6 +52,7 @@ set(COCOS_2D_SRC
|
|||
2d/CCParticleSystem.cpp
|
||||
2d/CCParticleSystemQuad.cpp
|
||||
2d/CCProgressTimer.cpp
|
||||
2d/CCProtectedNode.cpp
|
||||
2d/CCRenderTexture.cpp
|
||||
2d/CCScene.cpp
|
||||
2d/CCSpriteBatchNode.cpp
|
||||
|
@ -75,4 +70,3 @@ set(COCOS_2D_SRC
|
|||
2d/CCTransitionProgress.cpp
|
||||
2d/CCTweenFunction.cpp
|
||||
)
|
||||
|
||||
|
|
|
@ -316,7 +316,7 @@
|
|||
<ClCompile Include="..\physics\chipmunk\CCPhysicsShapeInfo_chipmunk.cpp" />
|
||||
<ClCompile Include="..\physics\chipmunk\CCPhysicsWorldInfo_chipmunk.cpp" />
|
||||
<ClCompile Include="..\platform\CCFileUtils.cpp" />
|
||||
<ClCompile Include="..\platform\CCGLViewProtocol.cpp" />
|
||||
<ClCompile Include="..\platform\CCGLView.cpp" />
|
||||
<ClCompile Include="..\platform\CCImage.cpp" />
|
||||
<ClCompile Include="..\platform\CCSAXParser.cpp" />
|
||||
<ClCompile Include="..\platform\CCThread.cpp" />
|
||||
|
@ -332,7 +332,7 @@
|
|||
<ClCompile Include="..\platform\winrt\inet_ntop_winrt.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\InputEvent.cpp" />
|
||||
<ClCompile Include="..\platform\winrt\sha1.cpp" />
|
||||
<ClCompile Include="..\platform\wp8\CCGLView.cpp" />
|
||||
<ClCompile Include="..\platform\wp8\CCGLViewImpl.cpp" />
|
||||
<ClCompile Include="..\platform\wp8\Direct3DBase.cpp" />
|
||||
<ClCompile Include="..\platform\wp8\DirectXBase.cpp" />
|
||||
<ClCompile Include="..\platform\wp8\pch.cpp">
|
||||
|
@ -406,6 +406,7 @@
|
|||
<ClCompile Include="CCParticleSystem.cpp" />
|
||||
<ClCompile Include="CCParticleSystemQuad.cpp" />
|
||||
<ClCompile Include="CCProgressTimer.cpp" />
|
||||
<ClCompile Include="CCProtectedNode.cpp" />
|
||||
<ClCompile Include="CCRenderTexture.cpp" />
|
||||
<ClCompile Include="CCScene.cpp" />
|
||||
<ClCompile Include="CCSprite.cpp" />
|
||||
|
@ -533,7 +534,7 @@
|
|||
<ClInclude Include="..\platform\CCCommon.h" />
|
||||
<ClInclude Include="..\platform\CCDevice.h" />
|
||||
<ClInclude Include="..\platform\CCFileUtils.h" />
|
||||
<ClInclude Include="..\platform\CCGLViewProtocol.h" />
|
||||
<ClInclude Include="..\platform\CCGLView.h" />
|
||||
<ClInclude Include="..\platform\CCImage.h" />
|
||||
<ClInclude Include="..\platform\CCSAXParser.h" />
|
||||
<ClInclude Include="..\platform\CCThread.h" />
|
||||
|
@ -552,7 +553,7 @@
|
|||
<ClInclude Include="..\platform\winrt\InputEvent.h" />
|
||||
<ClInclude Include="..\platform\winrt\InputEventTypes.h" />
|
||||
<ClInclude Include="..\platform\winrt\sha1.h" />
|
||||
<ClInclude Include="..\platform\wp8\CCGLView.h" />
|
||||
<ClInclude Include="..\platform\wp8\CCGLViewImpl.h" />
|
||||
<ClInclude Include="..\platform\wp8\Direct3DBase.h" />
|
||||
<ClInclude Include="..\platform\wp8\DirectXBase.h" />
|
||||
<ClInclude Include="..\platform\wp8\pch.h" />
|
||||
|
@ -622,6 +623,7 @@
|
|||
<ClInclude Include="CCParticleSystem.h" />
|
||||
<ClInclude Include="CCParticleSystemQuad.h" />
|
||||
<ClInclude Include="CCProgressTimer.h" />
|
||||
<ClInclude Include="CCProtectedNode.h" />
|
||||
<ClInclude Include="CCRenderTexture.h" />
|
||||
<ClInclude Include="CCScene.h" />
|
||||
<ClInclude Include="CCSprite.h" />
|
||||
|
|
|
@ -490,9 +490,6 @@
|
|||
<ClCompile Include="..\base\CCUserDefault.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\base\CCUserDefaultAndroid.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\base\ccUTF8.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
|
@ -517,9 +514,6 @@
|
|||
<ClCompile Include="..\platform\CCFileUtils.cpp">
|
||||
<Filter>platform</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\CCGLViewProtocol.cpp">
|
||||
<Filter>platform</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\CCImage.cpp">
|
||||
<Filter>platform</Filter>
|
||||
</ClCompile>
|
||||
|
@ -529,9 +523,6 @@
|
|||
<ClCompile Include="..\platform\CCThread.cpp">
|
||||
<Filter>platform</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\wp8\CCGLView.cpp">
|
||||
<Filter>platform\wp8</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\wp8\Direct3DBase.cpp">
|
||||
<Filter>platform\wp8</Filter>
|
||||
</ClCompile>
|
||||
|
@ -617,6 +608,15 @@
|
|||
<ClCompile Include="CCFastTMXTiledMap.cpp">
|
||||
<Filter>2d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\CCGLView.cpp">
|
||||
<Filter>platform</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\wp8\CCGLViewImpl.cpp">
|
||||
<Filter>platform\wp8</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CCProtectedNode.cpp">
|
||||
<Filter>2d</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
||||
|
@ -1141,9 +1141,6 @@
|
|||
<ClInclude Include="..\platform\CCFileUtils.h">
|
||||
<Filter>platform</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\CCGLViewProtocol.h">
|
||||
<Filter>platform</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\CCImage.h">
|
||||
<Filter>platform</Filter>
|
||||
</ClInclude>
|
||||
|
@ -1156,9 +1153,6 @@
|
|||
<ClInclude Include="..\platform\wp8\DirectXBase.h">
|
||||
<Filter>platform\wp8</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\wp8\CCGLView.h">
|
||||
<Filter>platform\wp8</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\wp8\Direct3DBase.h">
|
||||
<Filter>platform\wp8</Filter>
|
||||
</ClInclude>
|
||||
|
@ -1259,6 +1253,15 @@
|
|||
<ClInclude Include="CCFastTMXTiledMap.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\CCGLView.h">
|
||||
<Filter>platform</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\wp8\CCGLViewImpl.h">
|
||||
<Filter>platform\wp8</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CCProtectedNode.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\math\Mat4.inl">
|
||||
|
|
|
@ -185,13 +185,17 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
|||
<ClCompile Include="..\..\external\xxhash\xxhash.c" />
|
||||
<ClCompile Include="..\3d\CCAnimate3D.cpp" />
|
||||
<ClCompile Include="..\3d\CCAnimation3D.cpp" />
|
||||
<ClCompile Include="..\3d\CCAttachNode.cpp" />
|
||||
<ClCompile Include="..\3d\CCBundle3D.cpp" />
|
||||
<ClCompile Include="..\3d\CCBundleReader.cpp" />
|
||||
<ClCompile Include="..\3d\CCMesh.cpp" />
|
||||
<ClCompile Include="..\3d\CCMeshSkin.cpp" />
|
||||
<ClCompile Include="..\3d\CCObjLoader.cpp" />
|
||||
<ClCompile Include="..\3d\CCSkeleton3D.cpp" />
|
||||
<ClCompile Include="..\3d\CCSprite3D.cpp" />
|
||||
<ClCompile Include="..\3d\CCSprite3DMaterial.cpp" />
|
||||
<ClCompile Include="..\3d\CCSubMesh.cpp" />
|
||||
<ClCompile Include="..\3d\CCSubMeshState.cpp" />
|
||||
<ClCompile Include="..\base\atitc.cpp" />
|
||||
<ClCompile Include="..\base\base64.cpp" />
|
||||
<ClCompile Include="..\base\CCAutoreleasePool.cpp" />
|
||||
|
@ -263,11 +267,11 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
|||
<ClCompile Include="..\physics\chipmunk\CCPhysicsShapeInfo_chipmunk.cpp" />
|
||||
<ClCompile Include="..\physics\chipmunk\CCPhysicsWorldInfo_chipmunk.cpp" />
|
||||
<ClCompile Include="..\platform\CCFileUtils.cpp" />
|
||||
<ClCompile Include="..\platform\CCGLViewProtocol.cpp" />
|
||||
<ClCompile Include="..\platform\CCGLView.cpp" />
|
||||
<ClCompile Include="..\platform\CCImage.cpp" />
|
||||
<ClCompile Include="..\platform\CCSAXParser.cpp" />
|
||||
<ClCompile Include="..\platform\CCThread.cpp" />
|
||||
<ClCompile Include="..\platform\desktop\CCGLView.cpp" />
|
||||
<ClCompile Include="..\platform\desktop\CCGLViewImpl.cpp" />
|
||||
<ClCompile Include="..\platform\win32\CCApplication.cpp" />
|
||||
<ClCompile Include="..\platform\win32\CCCommon.cpp" />
|
||||
<ClCompile Include="..\platform\win32\CCDevice.cpp" />
|
||||
|
@ -339,6 +343,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
|||
<ClCompile Include="CCParticleSystem.cpp" />
|
||||
<ClCompile Include="CCParticleSystemQuad.cpp" />
|
||||
<ClCompile Include="CCProgressTimer.cpp" />
|
||||
<ClCompile Include="CCProtectedNode.cpp" />
|
||||
<ClCompile Include="CCRenderTexture.cpp" />
|
||||
<ClCompile Include="CCScene.cpp" />
|
||||
<ClCompile Include="CCSprite.cpp" />
|
||||
|
@ -366,14 +371,18 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
|||
<ClInclude Include="..\3d\CCAnimate3D.h" />
|
||||
<ClInclude Include="..\3d\CCAnimation3D.h" />
|
||||
<ClInclude Include="..\3d\CCAnimationCurve.h" />
|
||||
<ClInclude Include="..\3d\CCAttachNode.h" />
|
||||
<ClInclude Include="..\3d\CCBundle3D.h" />
|
||||
<ClInclude Include="..\3d\CCBundle3DData.h" />
|
||||
<ClInclude Include="..\3d\CCBundleReader.h" />
|
||||
<ClInclude Include="..\3d\CCMesh.h" />
|
||||
<ClInclude Include="..\3d\CCMeshSkin.h" />
|
||||
<ClInclude Include="..\3d\CCObjLoader.h" />
|
||||
<ClInclude Include="..\3d\CCSkeleton3D.h" />
|
||||
<ClInclude Include="..\3d\CCSprite3D.h" />
|
||||
<ClInclude Include="..\3d\CCSprite3DMaterial.h" />
|
||||
<ClInclude Include="..\3d\CCSubMesh.h" />
|
||||
<ClInclude Include="..\3d\CCSubMeshState.h" />
|
||||
<ClInclude Include="..\base\atitc.h" />
|
||||
<ClInclude Include="..\base\base64.h" />
|
||||
<ClInclude Include="..\base\CCAutoreleasePool.h" />
|
||||
|
@ -468,11 +477,11 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
|||
<ClInclude Include="..\platform\CCCommon.h" />
|
||||
<ClInclude Include="..\platform\CCDevice.h" />
|
||||
<ClInclude Include="..\platform\CCFileUtils.h" />
|
||||
<ClInclude Include="..\platform\CCGLViewProtocol.h" />
|
||||
<ClInclude Include="..\platform\CCGLView.h" />
|
||||
<ClInclude Include="..\platform\CCImage.h" />
|
||||
<ClInclude Include="..\platform\CCSAXParser.h" />
|
||||
<ClInclude Include="..\platform\CCThread.h" />
|
||||
<ClInclude Include="..\platform\desktop\CCGLView.h" />
|
||||
<ClInclude Include="..\platform\desktop\CCGLViewImpl.h" />
|
||||
<ClInclude Include="..\platform\win32\CCApplication.h" />
|
||||
<ClInclude Include="..\platform\win32\CCFileUtilsWin32.h" />
|
||||
<ClInclude Include="..\platform\win32\CCGL.h" />
|
||||
|
@ -546,6 +555,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
|||
<ClInclude Include="CCParticleSystem.h" />
|
||||
<ClInclude Include="CCParticleSystemQuad.h" />
|
||||
<ClInclude Include="CCProgressTimer.h" />
|
||||
<ClInclude Include="CCProtectedNode.h" />
|
||||
<ClInclude Include="CCRenderTexture.h" />
|
||||
<ClInclude Include="CCScene.h" />
|
||||
<ClInclude Include="CCSprite.h" />
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="physics">
|
||||
|
@ -475,9 +475,6 @@
|
|||
<ClCompile Include="..\renderer\CCTextureCache.cpp">
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\desktop\CCGLView.cpp">
|
||||
<Filter>platform\desktop</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\win32\CCApplication.cpp">
|
||||
<Filter>platform\win32</Filter>
|
||||
</ClCompile>
|
||||
|
@ -526,9 +523,6 @@
|
|||
<ClCompile Include="..\platform\CCFileUtils.cpp">
|
||||
<Filter>platform</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\CCGLViewProtocol.cpp">
|
||||
<Filter>platform</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\CCImage.cpp">
|
||||
<Filter>platform</Filter>
|
||||
</ClCompile>
|
||||
|
@ -595,6 +589,27 @@
|
|||
<ClCompile Include="..\storage\local-storage\LocalStorage.cpp">
|
||||
<Filter>storage</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCAttachNode.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCSkeleton3D.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCSubMesh.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\3d\CCSubMeshState.cpp">
|
||||
<Filter>3d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\desktop\CCGLViewImpl.cpp">
|
||||
<Filter>platform\desktop</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\CCGLView.cpp">
|
||||
<Filter>platform</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CCProtectedNode.cpp">
|
||||
<Filter>2d</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
||||
|
@ -1063,9 +1078,6 @@
|
|||
<ClInclude Include="..\renderer\CCTextureCache.h">
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\desktop\CCGLView.h">
|
||||
<Filter>platform\desktop</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\win32\compat\stdint.h">
|
||||
<Filter>platform\win32\compat</Filter>
|
||||
</ClInclude>
|
||||
|
@ -1132,9 +1144,6 @@
|
|||
<ClInclude Include="..\platform\CCFileUtils.h">
|
||||
<Filter>platform</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\CCGLViewProtocol.h">
|
||||
<Filter>platform</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\CCImage.h">
|
||||
<Filter>platform</Filter>
|
||||
</ClInclude>
|
||||
|
@ -1210,6 +1219,27 @@
|
|||
<ClInclude Include="..\storage\local-storage\LocalStorage.h">
|
||||
<Filter>storage</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\CCAttachNode.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\CCSkeleton3D.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\CCSubMesh.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\3d\CCSubMeshState.h">
|
||||
<Filter>3d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\desktop\CCGLViewImpl.h">
|
||||
<Filter>platform\desktop</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\CCGLView.h">
|
||||
<Filter>platform</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CCProtectedNode.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\math\Mat4.inl">
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "3d/CCAnimate3D.h"
|
||||
#include "3d/CCAnimation3D.h"
|
||||
#include "3d/CCSprite3D.h"
|
||||
#include "3d/CCSkeleton3D.h"
|
||||
#include "3d/CCMeshSkin.h"
|
||||
|
||||
#include "base/ccMacros.h"
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "3d/CCAttachNode.h"
|
||||
#include "3d/CCSkeleton3D.h"
|
||||
|
||||
#include "2d/CCNode.h"
|
||||
|
||||
#include "base/CCDirector.h"
|
||||
#include "base/CCPlatformMacros.h"
|
||||
#include "base/ccMacros.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
AttachNode* AttachNode::create(Bone3D* attachBone)
|
||||
{
|
||||
auto attachnode = new AttachNode();
|
||||
attachnode->_attachBone = attachBone;
|
||||
attachnode->autorelease();
|
||||
|
||||
return attachnode;
|
||||
}
|
||||
|
||||
AttachNode::AttachNode()
|
||||
: _attachBone(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
AttachNode::~AttachNode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Mat4 AttachNode::getWorldToNodeTransform() const
|
||||
{
|
||||
static Mat4 mat;
|
||||
mat.setIdentity();
|
||||
auto parent = getParent();
|
||||
if (parent)
|
||||
{
|
||||
mat = parent->getWorldToNodeTransform() * _attachBone->getWorldMat() * getNodeToParentTransform();
|
||||
}
|
||||
else
|
||||
{
|
||||
mat = _attachBone->getWorldMat() * getNodeToParentTransform();
|
||||
}
|
||||
return mat;
|
||||
}
|
||||
|
||||
void AttachNode::visit(Renderer *renderer, const Mat4& parentTransform, uint32_t parentFlags)
|
||||
{
|
||||
Node::visit(renderer, parentTransform * _attachBone->getWorldMat(), Node::FLAGS_DIRTY_MASK);
|
||||
}
|
||||
NS_CC_END
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCATTACHNODE_H__
|
||||
#define __CCATTACHNODE_H__
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "base/CCVector.h"
|
||||
#include "base/ccTypes.h"
|
||||
#include "base/CCProtocols.h"
|
||||
#include "math/CCMath.h"
|
||||
#include "2d/CCNode.h"
|
||||
#include "renderer/CCMeshCommand.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class Bone3D;
|
||||
|
||||
/**
|
||||
* attach a node to a bone
|
||||
* usage: auto sprite = Sprite3D::create("girl.c3b");
|
||||
* auto weapon = Sprite3D::create("weapon.c3b");
|
||||
* auto attachNode = sprite->getAttachNode("left hand");
|
||||
* attachNode->addChild(weapon);
|
||||
*/
|
||||
class CC_DLL AttachNode : public Node
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* creates an AttachNode
|
||||
* @param attachBone The bone to which the AttachNode is going to attach, the attacheBone must be a bone of the AttachNode's parent
|
||||
*/
|
||||
static AttachNode* create(Bone3D* attachBone);
|
||||
|
||||
virtual Mat4 getWorldToNodeTransform() const override;
|
||||
virtual void visit(Renderer *renderer, const Mat4& parentTransform, uint32_t parentFlags) override;
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
|
||||
AttachNode();
|
||||
virtual ~AttachNode();
|
||||
|
||||
|
||||
protected:
|
||||
Bone3D* _attachBone;
|
||||
};
|
||||
|
||||
|
||||
NS_CC_END
|
||||
#endif // __CCATTACHNODE_H__
|
|
@ -31,7 +31,6 @@
|
|||
#include "base/CCData.h"
|
||||
#include "json/document.h"
|
||||
|
||||
|
||||
#define BUNDLE_TYPE_SCENE 1
|
||||
#define BUNDLE_TYPE_NODE 2
|
||||
#define BUNDLE_TYPE_ANIMATIONS 3
|
||||
|
@ -46,14 +45,17 @@
|
|||
#define BUNDLE_TYPE_MESHPART 35
|
||||
#define BUNDLE_TYPE_MESHSKIN 36
|
||||
|
||||
static const char* VERSION = "version";
|
||||
static const char* ID = "id";
|
||||
|
||||
static const char* MESHDATA_MESH = "mesh";
|
||||
static const char* MESHDATA_DEFAULTPART = "body";
|
||||
static const char* MESHDATA_VERTEXSIZE = "vertexsize";
|
||||
static const char* MESHDATA_VERTEX = "vertex";
|
||||
static const char* MESHDATA_VERTICES = "vertices";
|
||||
static const char* MESHDATA_INDEXNUM = "indexnum";
|
||||
static const char* MESHDATA_INDICES = "indices";
|
||||
static const char* MESHDATA_SUBMESH = "submesh";
|
||||
static const char* MESHDATA_ATTRIBUTES = "attributes";
|
||||
static const char* MESHDATA_SIZE = "size";
|
||||
static const char* MESHDATA_TYPE = "type";
|
||||
|
@ -69,6 +71,7 @@ static const char* SKINDATA_TRANSFORM = "tansform";
|
|||
static const char* MATERIALDATA_MATERIAL = "material";
|
||||
static const char* MATERIALDATA_BASE = "base";
|
||||
static const char* MATERIALDATA_FILENAME = "filename";
|
||||
static const char* MATERIALDATA_TEXTURES = "textures";
|
||||
|
||||
static const char* ANIMATIONDATA_ANIMATION = "animation";
|
||||
static const char* ANIMATIONDATA_LENGTH = "length";
|
||||
|
@ -140,6 +143,12 @@ void getChildMap(std::map<int, std::vector<int> >& map, SkinData* skinData, cons
|
|||
|
||||
Bundle3D* Bundle3D::_instance = nullptr;
|
||||
|
||||
void Bundle3D::setBundleInstance(Bundle3D* bundleInstance)
|
||||
{
|
||||
CC_SAFE_DELETE(_instance);
|
||||
_instance = bundleInstance;
|
||||
}
|
||||
|
||||
Bundle3D* Bundle3D::getInstance()
|
||||
{
|
||||
if (_instance == nullptr)
|
||||
|
@ -197,6 +206,8 @@ bool Bundle3D::load(const std::string& path)
|
|||
|
||||
bool Bundle3D::loadMeshData(const std::string& id, MeshData* meshdata)
|
||||
{
|
||||
meshdata->resetData();
|
||||
|
||||
if (_isBinary)
|
||||
{
|
||||
return loadMeshDataBinary(meshdata);
|
||||
|
@ -209,6 +220,8 @@ bool Bundle3D::loadMeshData(const std::string& id, MeshData* meshdata)
|
|||
|
||||
bool Bundle3D::loadSkinData(const std::string& id, SkinData* skindata)
|
||||
{
|
||||
skindata->resetData();
|
||||
|
||||
if (_isBinary)
|
||||
{
|
||||
return loadSkinDataBinary(skindata);
|
||||
|
@ -221,6 +234,8 @@ bool Bundle3D::loadSkinData(const std::string& id, SkinData* skindata)
|
|||
|
||||
bool Bundle3D::loadMaterialData(const std::string& id, MaterialData* materialdata)
|
||||
{
|
||||
materialdata->resetData();
|
||||
|
||||
if (_isBinary)
|
||||
{
|
||||
return loadMaterialDataBinary(materialdata);
|
||||
|
@ -233,6 +248,8 @@ bool Bundle3D::loadMaterialData(const std::string& id, MaterialData* materialdat
|
|||
|
||||
bool Bundle3D::loadAnimationData(const std::string& id, Animation3DData* animationdata)
|
||||
{
|
||||
animationdata->resetData();
|
||||
|
||||
if (_isBinary)
|
||||
{
|
||||
return loadAnimationDataBinary(animationdata);
|
||||
|
@ -243,6 +260,14 @@ bool Bundle3D::loadAnimationData(const std::string& id, Animation3DData* animati
|
|||
}
|
||||
}
|
||||
|
||||
bool Bundle3D::loadSkeletonData(const std::string& id, Skeleton3DData* skeletondata)
|
||||
{
|
||||
skeletondata->resetData();
|
||||
|
||||
//TODO
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bundle3D::loadJson(const std::string& path)
|
||||
{
|
||||
clear();
|
||||
|
@ -260,58 +285,129 @@ bool Bundle3D::loadJson(const std::string& path)
|
|||
clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
const rapidjson::Value& mash_data_array = _jsonReader[VERSION];
|
||||
_version = mash_data_array.GetString();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bundle3D::loadMeshDataJson(MeshData* meshdata)
|
||||
{
|
||||
meshdata->resetData();
|
||||
|
||||
assert(_jsonReader.HasMember(MESHDATA_MESH));
|
||||
const rapidjson::Value& mash_data_array = _jsonReader[MESHDATA_MESH];
|
||||
|
||||
assert(mash_data_array.IsArray());
|
||||
const rapidjson::Value& mash_data_val = mash_data_array[(rapidjson::SizeType)0];
|
||||
//1.2 is a wrong version. Our first released fbx-conv write this version id, so we keep on using it.
|
||||
if (_version == "1.2")
|
||||
{
|
||||
return loadMeshDataJson_0_1(meshdata);
|
||||
}
|
||||
else if(_version == "0.2")
|
||||
{
|
||||
return loadMeshDataJson_0_2(meshdata);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOGINFO(false, "Unsupported version of loadMeshDataJson(): %s", _version);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
assert(mash_data_val.HasMember(MESHDATA_DEFAULTPART));
|
||||
const rapidjson::Value& mesh_data_body_array = mash_data_val[MESHDATA_DEFAULTPART];
|
||||
bool Bundle3D::loadMeshDataJson_0_1(MeshData* meshdata)
|
||||
{
|
||||
const rapidjson::Value& mesh_data_array = _jsonReader[MESHDATA_MESH];
|
||||
|
||||
const rapidjson::Value& mesh_data_val = mesh_data_array[(rapidjson::SizeType)0];
|
||||
|
||||
const rapidjson::Value& mesh_data_body_array = mesh_data_val[MESHDATA_DEFAULTPART];
|
||||
|
||||
assert(mesh_data_body_array.IsArray());
|
||||
const rapidjson::Value& mesh_data_body_array_0 = mesh_data_body_array[(rapidjson::SizeType)0];
|
||||
|
||||
// vertex_size
|
||||
assert(mesh_data_body_array_0.HasMember(MESHDATA_VERTEXSIZE));
|
||||
meshdata->vertexSizeInFloat = mesh_data_body_array_0[MESHDATA_VERTEXSIZE].GetInt();
|
||||
|
||||
// vertices
|
||||
meshdata->vertex.resize(meshdata->vertexSizeInFloat);
|
||||
const rapidjson::Value& mesh_data_body_vertices = mesh_data_body_array_0[MESHDATA_VERTICES];
|
||||
for (rapidjson::SizeType i = 0; i < mesh_data_body_vertices.Size(); i++)
|
||||
meshdata->vertex[i] = mesh_data_body_vertices[i].GetDouble();
|
||||
|
||||
// index_number
|
||||
meshdata->numIndex = mesh_data_body_array_0[MESHDATA_INDEXNUM].GetUint();
|
||||
|
||||
// indices
|
||||
meshdata->indices.resize(meshdata->numIndex);
|
||||
const rapidjson::Value& mesh_data_body_indices_val = mesh_data_body_array_0[MESHDATA_INDICES];
|
||||
for (rapidjson::SizeType i = 0; i < mesh_data_body_indices_val.Size(); i++)
|
||||
meshdata->indices[i] = (unsigned short)mesh_data_body_indices_val[i].GetUint();
|
||||
|
||||
// mesh_vertex_attribute
|
||||
const rapidjson::Value& mesh_vertex_attribute = mash_data_val[MESHDATA_ATTRIBUTES];
|
||||
const rapidjson::Value& mesh_vertex_attribute = mesh_data_val[MESHDATA_ATTRIBUTES];
|
||||
meshdata->attribCount = mesh_vertex_attribute.Size();
|
||||
meshdata->attribs.resize(meshdata->attribCount);
|
||||
for (rapidjson::SizeType i = 0; i < mesh_vertex_attribute.Size(); i++)
|
||||
{
|
||||
const rapidjson::Value& mesh_vertex_attribute_val = mesh_vertex_attribute[i];
|
||||
|
||||
|
||||
meshdata->attribs[i].size = mesh_vertex_attribute_val[MESHDATA_SIZE].GetUint();
|
||||
meshdata->attribs[i].attribSizeBytes = meshdata->attribs[i].size * 4;
|
||||
meshdata->attribs[i].type = parseGLType(mesh_vertex_attribute_val[MESHDATA_TYPE].GetString());
|
||||
meshdata->attribs[i].vertexAttrib = parseGLProgramAttribute(mesh_vertex_attribute_val[MESHDATA_ATTRIBUTE].GetString());
|
||||
}
|
||||
|
||||
// vertices
|
||||
meshdata->vertexSizeInFloat = mesh_data_body_array_0[MESHDATA_VERTEXSIZE].GetInt();
|
||||
meshdata->vertex.resize(meshdata->vertexSizeInFloat);
|
||||
|
||||
const rapidjson::Value& mesh_data_body_vertices = mesh_data_body_array_0[MESHDATA_VERTICES];
|
||||
for (rapidjson::SizeType i = 0; i < mesh_data_body_vertices.Size(); i++)
|
||||
meshdata->vertex[i] = mesh_data_body_vertices[i].GetDouble();
|
||||
|
||||
// index_number
|
||||
unsigned int indexnum = mesh_data_body_array_0[MESHDATA_INDEXNUM].GetUint();
|
||||
|
||||
// indices
|
||||
std::vector<unsigned short> indices;
|
||||
indices.resize(indexnum);
|
||||
|
||||
const rapidjson::Value& indices_val_array = mesh_data_body_array_0[MESHDATA_INDICES];
|
||||
for (rapidjson::SizeType i = 0; i < indices_val_array.Size(); i++)
|
||||
indices[i] = (unsigned short)indices_val_array[i].GetUint();
|
||||
|
||||
meshdata->subMeshIndices.push_back(indices);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bundle3D::loadMeshDataJson_0_2(MeshData* meshdata)
|
||||
{
|
||||
const rapidjson::Value& mesh_array = _jsonReader[MESHDATA_MESH];
|
||||
|
||||
const rapidjson::Value& mesh_array_0 = mesh_array[(rapidjson::SizeType)0];
|
||||
|
||||
// mesh_vertex_attribute
|
||||
const rapidjson::Value& mesh_vertex_attribute = mesh_array_0[MESHDATA_ATTRIBUTES];
|
||||
meshdata->attribCount = mesh_vertex_attribute.Size();
|
||||
meshdata->attribs.resize(meshdata->attribCount);
|
||||
for (rapidjson::SizeType i = 0; i < mesh_vertex_attribute.Size(); i++)
|
||||
{
|
||||
const rapidjson::Value& mesh_vertex_attribute_val = mesh_vertex_attribute[i];
|
||||
|
||||
meshdata->attribs[i].size = mesh_vertex_attribute_val[MESHDATA_SIZE].GetUint();
|
||||
meshdata->attribs[i].attribSizeBytes = meshdata->attribs[i].size * 4;
|
||||
meshdata->attribs[i].type = parseGLType(mesh_vertex_attribute_val[MESHDATA_TYPE].GetString());
|
||||
meshdata->attribs[i].vertexAttrib = parseGLProgramAttribute(mesh_vertex_attribute_val[MESHDATA_ATTRIBUTE].GetString());
|
||||
}
|
||||
|
||||
// vertices
|
||||
const rapidjson::Value& mesh_data_vertex = mesh_array_0[MESHDATA_VERTEX];
|
||||
const rapidjson::Value& mesh_data_vertex_0 = mesh_data_vertex[(rapidjson::SizeType)0];
|
||||
|
||||
meshdata->vertexSizeInFloat = mesh_data_vertex_0[MESHDATA_VERTEXSIZE].GetInt();
|
||||
meshdata->vertex.resize(meshdata->vertexSizeInFloat);
|
||||
|
||||
const rapidjson::Value& mesh_data_body_vertices = mesh_data_vertex_0[MESHDATA_VERTICES];
|
||||
for (rapidjson::SizeType i = 0; i < mesh_data_body_vertices.Size(); i++)
|
||||
meshdata->vertex[i] = mesh_data_body_vertices[i].GetDouble();
|
||||
|
||||
// submesh
|
||||
const rapidjson::Value& mesh_submesh_array = mesh_array_0[MESHDATA_SUBMESH];
|
||||
for (rapidjson::SizeType i = 0; i < mesh_submesh_array.Size(); i++)
|
||||
{
|
||||
const rapidjson::Value& mesh_submesh_val = mesh_submesh_array[i];
|
||||
//std::string id = mesh_submesh_val[ID].GetString();
|
||||
|
||||
// index_number
|
||||
unsigned int indexnum = mesh_submesh_val[MESHDATA_INDEXNUM].GetUint();
|
||||
|
||||
// indices
|
||||
std::vector<unsigned short> indices;
|
||||
indices.resize(indexnum);
|
||||
|
||||
const rapidjson::Value& indices_val_array = mesh_submesh_val[MESHDATA_INDICES];
|
||||
for (rapidjson::SizeType j = 0; j < indices_val_array.Size(); j++)
|
||||
indices[j] = (unsigned short)indices_val_array[j].GetUint();
|
||||
|
||||
meshdata->subMeshIndices.push_back(indices);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -319,8 +415,6 @@ bool Bundle3D::loadSkinDataJson(SkinData* skindata)
|
|||
{
|
||||
if (!_jsonReader.HasMember(SKINDATA_SKIN )) return false;
|
||||
|
||||
skindata->resetData();
|
||||
|
||||
const rapidjson::Value& skin_data_array = _jsonReader[SKINDATA_SKIN ];
|
||||
|
||||
assert(skin_data_array.IsArray());
|
||||
|
@ -350,12 +444,29 @@ bool Bundle3D::loadSkinDataJson(SkinData* skindata)
|
|||
|
||||
// parent and child relationship map
|
||||
skindata->skinBoneOriginMatrices.resize(skindata->skinBoneNames.size());
|
||||
//skindata->nodeBoneOriginMatrices.resize(skindata->nodeBoneNames.size());
|
||||
getChildMap(skindata->boneChild, skindata, skin_data_1);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bundle3D::loadMaterialDataJson(MaterialData* materialdata)
|
||||
{
|
||||
//1.2 is a wrong version. Our first released fbx-conv write this version id, so we keep on using it.
|
||||
if (_version == "1.2")
|
||||
{
|
||||
return loadMaterialDataJson_0_1(materialdata);
|
||||
}
|
||||
else if(_version == "0.2")
|
||||
{
|
||||
return loadMaterialDataJson_0_2(materialdata);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOGINFO(false, "Unsupported version of loadMaterialDataJson() : %s", _version);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Bundle3D::loadMaterialDataJson_0_1(MaterialData* materialdata)
|
||||
{
|
||||
if (!_jsonReader.HasMember(MATERIALDATA_MATERIAL))
|
||||
return false;
|
||||
|
@ -368,19 +479,35 @@ bool Bundle3D::loadMaterialDataJson(MaterialData* materialdata)
|
|||
|
||||
const rapidjson::Value& material_data_base_array_0 = material_data_base_array[(rapidjson::SizeType)0];
|
||||
|
||||
materialdata->texturePath = _modelRelativePath + material_data_base_array_0[MATERIALDATA_FILENAME].GetString();
|
||||
// set texture
|
||||
materialdata->texturePaths[0] =_modelRelativePath + material_data_base_array_0[MATERIALDATA_FILENAME].GetString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bundle3D::loadMaterialDataJson_0_2(MaterialData* materialdata)
|
||||
{
|
||||
if (!_jsonReader.HasMember(MATERIALDATA_MATERIAL))
|
||||
return false;
|
||||
|
||||
const rapidjson::Value& material_array = _jsonReader[MATERIALDATA_MATERIAL];
|
||||
|
||||
for (rapidjson::SizeType i = 0; i < material_array.Size(); i++)
|
||||
{
|
||||
const rapidjson::Value& material_val = material_array[i];
|
||||
//std::string id = material_val[ID].GetString();
|
||||
|
||||
// set texture
|
||||
materialdata->texturePaths[i] = _modelRelativePath + material_val[MATERIALDATA_TEXTURES].GetString();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bundle3D::loadAnimationDataJson(Animation3DData* animationdata)
|
||||
{
|
||||
if (!_jsonReader.HasMember(ANIMATIONDATA_ANIMATION)) return false;
|
||||
|
||||
animationdata->_rotationKeys.clear();
|
||||
animationdata->_scaleKeys.clear();
|
||||
animationdata->_translationKeys.clear();
|
||||
|
||||
const rapidjson::Value& animation_data_array = _jsonReader[ANIMATIONDATA_ANIMATION];
|
||||
if (animation_data_array.Size()==0) return false;
|
||||
|
||||
|
@ -467,18 +594,9 @@ bool Bundle3D::loadBinary(const std::string& path)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (ver[0] != 0) {
|
||||
clear();
|
||||
CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ver[1] <= 0 || ver[1] > 2) {
|
||||
clear();
|
||||
CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]);
|
||||
return false;
|
||||
}
|
||||
|
||||
char version[20] = {0};
|
||||
sprintf(version, "%d.%d", ver[0], ver[1]);
|
||||
_version = version;
|
||||
|
||||
// Read ref table size
|
||||
if (_binaryReader.read(&_referenceCount, 4, 1) != 1)
|
||||
|
@ -508,11 +626,26 @@ bool Bundle3D::loadBinary(const std::string& path)
|
|||
}
|
||||
|
||||
bool Bundle3D::loadMeshDataBinary(MeshData* meshdata)
|
||||
{
|
||||
if (_version == "0.1")
|
||||
{
|
||||
return loadMeshDataBinary_0_1(meshdata);
|
||||
}
|
||||
else if(_version == "0.2")
|
||||
{
|
||||
return loadMeshDataBinary_0_2(meshdata);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOGINFO(false, "Unsupported version of loadMeshDataBinary() : %s", _version);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Bundle3D::loadMeshDataBinary_0_1(MeshData* meshdata)
|
||||
{
|
||||
if (!seekToFirstType(BUNDLE_TYPE_MESH))
|
||||
return false;
|
||||
|
||||
meshdata->resetData();
|
||||
|
||||
// read mesh data
|
||||
if (_binaryReader.read(&meshdata->attribCount, 4, 1) != 1 || meshdata->attribCount < 1)
|
||||
|
@ -563,26 +696,101 @@ bool Bundle3D::loadMeshDataBinary(MeshData* meshdata)
|
|||
CCLOGINFO("Failed to read meshdata: nIndexCount '%s'.", _path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
meshdata->numIndex = nIndexCount;
|
||||
meshdata->indices.resize(meshdata->numIndex);
|
||||
if (_binaryReader.read(&meshdata->indices[0], 2, meshdata->numIndex) != nIndexCount)
|
||||
|
||||
std::vector<unsigned short> indices;
|
||||
indices.resize(nIndexCount);
|
||||
if (_binaryReader.read(&indices[0], 2, nIndexCount) != nIndexCount)
|
||||
{
|
||||
CCLOGINFO("Failed to read meshdata: indices '%s'.", _path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
meshdata->subMeshIndices.push_back(indices);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bundle3D::loadMeshDataBinary_0_2(MeshData* meshdata)
|
||||
{
|
||||
if (!seekToFirstType(BUNDLE_TYPE_MESH))
|
||||
return false;
|
||||
|
||||
meshdata->resetData();
|
||||
|
||||
// read mesh data
|
||||
if (_binaryReader.read(&meshdata->attribCount, 4, 1) != 1 || meshdata->attribCount < 1)
|
||||
{
|
||||
CCLOGINFO("Failed to read meshdata: attribCount '%s'.", _path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
meshdata->attribs.resize(meshdata->attribCount);
|
||||
for (ssize_t i = 0; i < meshdata->attribCount; i++)
|
||||
{
|
||||
unsigned int vUsage, vSize;
|
||||
if (_binaryReader.read(&vUsage, 4, 1) != 1 || _binaryReader.read(&vSize, 4, 1) != 1)
|
||||
{
|
||||
CCLOGINFO("Failed to read meshdata: usage or size '%s'.", _path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
meshdata->attribs[i].size = vSize;
|
||||
meshdata->attribs[i].attribSizeBytes = meshdata->attribs[i].size * 4;
|
||||
meshdata->attribs[i].type = GL_FLOAT;
|
||||
meshdata->attribs[i].vertexAttrib = vUsage;
|
||||
}
|
||||
|
||||
// Read vertex data
|
||||
if (_binaryReader.read(&meshdata->vertexSizeInFloat, 4, 1) != 1 || meshdata->vertexSizeInFloat == 0)
|
||||
{
|
||||
CCLOGINFO("Failed to read meshdata: vertexSizeInFloat '%s'.", _path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
meshdata->vertex.resize(meshdata->vertexSizeInFloat);
|
||||
if (_binaryReader.read(&meshdata->vertex[0], 4, meshdata->vertexSizeInFloat) != meshdata->vertexSizeInFloat)
|
||||
{
|
||||
CCLOGINFO("Failed to read meshdata: vertex element '%s'.", _path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// read submesh
|
||||
unsigned int submeshCount;
|
||||
if (_binaryReader.read(&submeshCount, 4, 1) != 1)
|
||||
{
|
||||
CCLOGINFO("Failed to read meshdata: submeshCount '%s'.", _path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < submeshCount; ++i)
|
||||
{
|
||||
unsigned int nIndexCount;
|
||||
if (_binaryReader.read(&nIndexCount, 4, 1) != 1)
|
||||
{
|
||||
CCLOGINFO("Failed to read meshdata: nIndexCount '%s'.", _path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<unsigned short> indices;
|
||||
indices.resize(nIndexCount);
|
||||
if (_binaryReader.read(&indices[0], 2, nIndexCount) != nIndexCount)
|
||||
{
|
||||
CCLOGINFO("Failed to read meshdata: indices '%s'.", _path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
meshdata->subMeshIndices.push_back(indices);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bundle3D::loadSkinDataBinary(SkinData* skindata)
|
||||
{
|
||||
if (!seekToFirstType(BUNDLE_TYPE_MESHSKIN))
|
||||
return false;
|
||||
|
||||
skindata->resetData();
|
||||
|
||||
std::string boneName = _binaryReader.readString();
|
||||
|
||||
// transform
|
||||
|
@ -684,14 +892,25 @@ bool Bundle3D::loadMaterialDataBinary(MaterialData* materialdata)
|
|||
if (!seekToFirstType(BUNDLE_TYPE_MATERIAL))
|
||||
return false;
|
||||
|
||||
std::string texturePath = _binaryReader.readString();
|
||||
if (texturePath.empty())
|
||||
unsigned int materialnum = 1;
|
||||
if (_version == "0.2")
|
||||
{
|
||||
CCLOGINFO("Failed to read Materialdata: texturePath is empty '%s'.", _path.c_str());
|
||||
return false;
|
||||
_binaryReader.read(&materialnum, 4, 1);
|
||||
}
|
||||
|
||||
materialdata->texturePath = _modelRelativePath + texturePath;
|
||||
|
||||
for (int i = 0; i < materialnum; i++)
|
||||
{
|
||||
std::string texturePath = _binaryReader.readString();
|
||||
if (texturePath.empty())
|
||||
{
|
||||
CCLOGINFO("Failed to read Materialdata: texturePath is empty '%s'.", _path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string path = _modelRelativePath + texturePath;
|
||||
materialdata->texturePaths[i] = path;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -700,10 +919,6 @@ bool Bundle3D::loadAnimationDataBinary(Animation3DData* animationdata)
|
|||
if (!seekToFirstType(BUNDLE_TYPE_ANIMATIONS))
|
||||
return false;
|
||||
|
||||
animationdata->_rotationKeys.clear();
|
||||
animationdata->_scaleKeys.clear();
|
||||
animationdata->_translationKeys.clear();
|
||||
|
||||
_binaryReader.readString();
|
||||
|
||||
if (!_binaryReader.read(&animationdata->_totalTime))
|
||||
|
@ -877,6 +1092,7 @@ Bundle3D::Bundle3D()
|
|||
:_isBinary(false),
|
||||
_modelRelativePath(""),
|
||||
_path(""),
|
||||
_version(""),
|
||||
_jsonBuffer(nullptr),
|
||||
_binaryBuffer(nullptr),
|
||||
_referenceCount(0),
|
||||
|
|
|
@ -46,56 +46,68 @@ class Data;
|
|||
* c3t text file
|
||||
* c3b binary file
|
||||
*/
|
||||
class Bundle3D
|
||||
class CC_DLL Bundle3D
|
||||
{
|
||||
public:
|
||||
/**you can define yourself bundle and set it, use default bundle otherwise*/
|
||||
static void setBundleInstance(Bundle3D* bundleInstance);
|
||||
|
||||
static Bundle3D* getInstance();
|
||||
|
||||
static void destroyInstance();
|
||||
|
||||
void clear();
|
||||
virtual void clear();
|
||||
|
||||
/**
|
||||
* load a file. You must load a file first, then call loadMeshData, loadSkinData, and so on
|
||||
* @param path File to be loaded
|
||||
* @return result of load
|
||||
*/
|
||||
bool load(const std::string& path);
|
||||
virtual bool load(const std::string& path);
|
||||
|
||||
/**
|
||||
* load mesh data from bundle
|
||||
* @param id The ID of the mesh, load the first Mesh in the bundle if it is empty
|
||||
*/
|
||||
bool loadMeshData(const std::string& id, MeshData* meshdata);
|
||||
virtual bool loadMeshData(const std::string& id, MeshData* meshdata);
|
||||
|
||||
/**
|
||||
* load skin data from bundle
|
||||
* @param id The ID of the skin, load the first Skin in the bundle if it is empty
|
||||
*/
|
||||
bool loadSkinData(const std::string& id, SkinData* skindata);
|
||||
virtual bool loadSkinData(const std::string& id, SkinData* skindata);
|
||||
|
||||
/**
|
||||
* load material data from bundle
|
||||
* @param id The ID of the material, load the first Material in the bundle if it is empty
|
||||
*/
|
||||
bool loadMaterialData(const std::string& id, MaterialData* materialdata);
|
||||
virtual bool loadMaterialData(const std::string& id, MaterialData* materialdata);
|
||||
|
||||
/**
|
||||
* load material data from bundle
|
||||
* @param id The ID of the animation, load the first animation in the bundle if it is empty
|
||||
*/
|
||||
bool loadAnimationData(const std::string& id, Animation3DData* animationdata);
|
||||
virtual bool loadAnimationData(const std::string& id, Animation3DData* animationdata);
|
||||
|
||||
/**
|
||||
* load skeleton data from bundle
|
||||
*
|
||||
*/
|
||||
virtual bool loadSkeletonData(const std::string& id, Skeleton3DData* skeletondata);
|
||||
|
||||
protected:
|
||||
|
||||
bool loadJson(const std::string& path);
|
||||
|
||||
bool loadMeshDataJson(MeshData* meshdata);
|
||||
bool loadMeshDataJson_0_1(MeshData* meshdata);
|
||||
bool loadMeshDataJson_0_2(MeshData* meshdata);
|
||||
|
||||
bool loadSkinDataJson(SkinData* skindata);
|
||||
|
||||
bool loadMaterialDataJson(MaterialData* materialdata);
|
||||
bool loadMaterialDataJson_0_1(MaterialData* materialdata);
|
||||
bool loadMaterialDataJson_0_2(MaterialData* materialdata);
|
||||
|
||||
bool loadAnimationDataJson(Animation3DData* animationdata);
|
||||
|
||||
|
@ -110,6 +122,8 @@ protected:
|
|||
* @param meshdata The mesh data pointer
|
||||
*/
|
||||
bool loadMeshDataBinary(MeshData* meshdata);
|
||||
bool loadMeshDataBinary_0_1(MeshData* meshdata);
|
||||
bool loadMeshDataBinary_0_2(MeshData* meshdata);
|
||||
|
||||
/**
|
||||
* load skin data in binary
|
||||
|
@ -129,7 +143,6 @@ protected:
|
|||
*/
|
||||
bool loadAnimationDataBinary(Animation3DData* animationdata);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* get define data type
|
||||
* @param str The type in string
|
||||
|
@ -166,6 +179,8 @@ protected:
|
|||
std::string _modelRelativePath;
|
||||
std::string _path;
|
||||
|
||||
std::string _version;// the c3b or c3t version
|
||||
|
||||
// for json reading
|
||||
char* _jsonBuffer;
|
||||
rapidjson::Document _jsonReader;
|
||||
|
@ -181,4 +196,4 @@ protected:
|
|||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __CCANIMATE3D_H__
|
||||
#endif // __CCBUNDLE3D_H__
|
||||
|
|
|
@ -50,9 +50,10 @@ struct MeshVertexAttrib
|
|||
/**mesh data*/
|
||||
struct MeshData
|
||||
{
|
||||
typedef std::vector<unsigned short> IndexArray;
|
||||
std::vector<float> vertex;
|
||||
int vertexSizeInFloat;
|
||||
std::vector<unsigned short> indices;
|
||||
std::vector<IndexArray> subMeshIndices;
|
||||
int numIndex;
|
||||
std::vector<MeshVertexAttrib> attribs;
|
||||
int attribCount;
|
||||
|
@ -61,7 +62,7 @@ public:
|
|||
void resetData()
|
||||
{
|
||||
vertex.clear();
|
||||
indices.clear();
|
||||
subMeshIndices.clear();
|
||||
attribs.clear();
|
||||
vertexSizeInFloat = 0;
|
||||
numIndex = 0;
|
||||
|
@ -104,30 +105,22 @@ struct SkinData
|
|||
|
||||
void addSkinBoneNames(const std::string& name)
|
||||
{
|
||||
for (auto iter : skinBoneNames)
|
||||
{
|
||||
if ((iter) == name)
|
||||
return;
|
||||
}
|
||||
|
||||
skinBoneNames.push_back(name);
|
||||
auto it = std::find(skinBoneNames.begin(), skinBoneNames.end(), name);
|
||||
if (it == skinBoneNames.end())
|
||||
skinBoneNames.push_back(name);
|
||||
}
|
||||
|
||||
void addNodeBoneNames(const std::string& name)
|
||||
{
|
||||
for (auto iter : nodeBoneNames)
|
||||
{
|
||||
if ((iter) == name)
|
||||
return;
|
||||
}
|
||||
|
||||
nodeBoneNames.push_back(name);
|
||||
auto it = std::find(nodeBoneNames.begin(), nodeBoneNames.end(), name);
|
||||
if (it == nodeBoneNames.end())
|
||||
nodeBoneNames.push_back(name);
|
||||
}
|
||||
|
||||
int getSkinBoneNameIndex(const std::string& name)const
|
||||
{
|
||||
int i = 0;
|
||||
for (auto iter : skinBoneNames)
|
||||
for (const auto& iter : skinBoneNames)
|
||||
{
|
||||
if ((iter) == name)
|
||||
return i;
|
||||
|
@ -139,13 +132,13 @@ struct SkinData
|
|||
int getBoneNameIndex(const std::string& name)const
|
||||
{
|
||||
int i = 0;
|
||||
for (auto iter : skinBoneNames)
|
||||
for (const auto& iter : skinBoneNames)
|
||||
{
|
||||
if ((iter) == name)
|
||||
return i;
|
||||
i++;
|
||||
}
|
||||
for(auto iter : nodeBoneNames)
|
||||
for(const auto& iter : nodeBoneNames)
|
||||
{
|
||||
if (iter == name)
|
||||
return i;
|
||||
|
@ -156,10 +149,54 @@ struct SkinData
|
|||
|
||||
};
|
||||
|
||||
/**skin data*/
|
||||
struct Skeleton3DData
|
||||
{
|
||||
std::vector<std::string> boneNames; //bone names
|
||||
std::vector<Mat4> inverseBindPoseMatrices; //bind pose of skin bone
|
||||
std::vector<Mat4> boneOriginMatrices; // original bone transform
|
||||
|
||||
//bone child info, both skinbone and node bone
|
||||
std::map<int, std::vector<int> > boneChild;//key parent, value child
|
||||
int rootBoneIndex;
|
||||
|
||||
void resetData()
|
||||
{
|
||||
boneNames.clear();
|
||||
inverseBindPoseMatrices.clear();
|
||||
boneOriginMatrices.clear();
|
||||
boneChild.clear();
|
||||
rootBoneIndex = -1;
|
||||
}
|
||||
|
||||
void addBoneNames(const std::string& name)
|
||||
{
|
||||
auto it = std::find(boneNames.begin(), boneNames.end(), name);
|
||||
if (it == boneNames.end())
|
||||
boneNames.push_back(name);
|
||||
}
|
||||
|
||||
int getBoneNameIndex(const std::string& name)const
|
||||
{
|
||||
int i = 0;
|
||||
for (auto iter : boneNames)
|
||||
{
|
||||
if ((iter) == name)
|
||||
return i;
|
||||
i++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
/**material data*/
|
||||
struct MaterialData
|
||||
{
|
||||
std::string texturePath;
|
||||
std::map<int, std::string> texturePaths; //submesh id, texture path
|
||||
void resetData()
|
||||
{
|
||||
texturePaths.clear();
|
||||
}
|
||||
};
|
||||
|
||||
/**animation data*/
|
||||
|
@ -223,7 +260,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
void clear()
|
||||
void resetData()
|
||||
{
|
||||
_totalTime = 0;
|
||||
_translationKeys.clear();
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCBundleReader.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "3d/CCSubMesh.h"
|
||||
#include "3d/CCObjLoader.h"
|
||||
#include "3d/CCSprite3DMaterial.h"
|
||||
|
||||
|
@ -58,7 +59,7 @@ bool RenderMeshData::hasVertexAttrib(int attrib)
|
|||
bool RenderMeshData::init(const std::vector<float>& positions,
|
||||
const std::vector<float>& normals,
|
||||
const std::vector<float>& texs,
|
||||
const std::vector<unsigned short>& indices)
|
||||
const std::vector<IndexArray>& indices)
|
||||
{
|
||||
CC_ASSERT(positions.size()<65536 * 3 && "index may out of bound");
|
||||
|
||||
|
@ -120,15 +121,15 @@ bool RenderMeshData::init(const std::vector<float>& positions,
|
|||
_vertexs.push_back(texs[i * 2 + 1]);
|
||||
}
|
||||
}
|
||||
_indices = indices;
|
||||
_subMeshIndices = indices;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RenderMeshData::init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, const std::vector<MeshVertexAttrib>& attribs)
|
||||
bool RenderMeshData::init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<IndexArray>& indices, const std::vector<MeshVertexAttrib>& attribs)
|
||||
{
|
||||
_vertexs = vertices;
|
||||
_indices = indices;
|
||||
_subMeshIndices = indices;
|
||||
_vertexAttribs = attribs;
|
||||
|
||||
_vertexsizeBytes = calVertexSizeBytes();
|
||||
|
@ -150,19 +151,23 @@ int RenderMeshData::calVertexSizeBytes()
|
|||
|
||||
Mesh::Mesh()
|
||||
:_vertexBuffer(0)
|
||||
, _indexBuffer(0)
|
||||
, _primitiveType(PrimitiveType::TRIANGLES)
|
||||
, _indexFormat(IndexFormat::INDEX16)
|
||||
, _indexCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
Mesh::~Mesh()
|
||||
{
|
||||
_subMeshes.clear();
|
||||
cleanAndFreeBuffers();
|
||||
}
|
||||
|
||||
Mesh* Mesh::create(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices)
|
||||
Mesh* Mesh::create(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const IndexArray& indices)
|
||||
{
|
||||
std::vector<IndexArray> submeshIndices;
|
||||
submeshIndices.push_back(indices);
|
||||
return create(positions, normals, texs, submeshIndices);
|
||||
}
|
||||
|
||||
Mesh* Mesh::create(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<IndexArray>& indices)
|
||||
{
|
||||
auto mesh = new Mesh();
|
||||
if(mesh && mesh->init(positions, normals, texs, indices))
|
||||
|
@ -174,7 +179,14 @@ Mesh* Mesh::create(const std::vector<float>& positions, const std::vector<float>
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Mesh* Mesh::create(const std::vector<float> &vertices, int vertexSizeInFloat, const std::vector<unsigned short> &indices, const std::vector<MeshVertexAttrib> &attribs)
|
||||
Mesh* Mesh::create(const std::vector<float>& vertices, int vertexSizeInFloat, const IndexArray& indices, const std::vector<MeshVertexAttrib>& attribs)
|
||||
{
|
||||
std::vector<IndexArray> submeshIndices;
|
||||
submeshIndices.push_back(indices);
|
||||
return create(vertices, vertexSizeInFloat, submeshIndices, attribs);
|
||||
}
|
||||
|
||||
Mesh* Mesh::create(const std::vector<float> &vertices, int vertexSizeInFloat, const std::vector<IndexArray> &indices, const std::vector<MeshVertexAttrib> &attribs)
|
||||
{
|
||||
auto mesh = new Mesh();
|
||||
if (mesh && mesh->init(vertices, vertexSizeInFloat, indices, attribs))
|
||||
|
@ -186,26 +198,40 @@ Mesh* Mesh::create(const std::vector<float> &vertices, int vertexSizeInFloat, co
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
bool Mesh::init(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices)
|
||||
bool Mesh::init(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<IndexArray>& indices)
|
||||
{
|
||||
bool bRet = _renderdata.init(positions, normals, texs, indices);
|
||||
if (!bRet)
|
||||
return false;
|
||||
|
||||
buildSubMeshes();
|
||||
|
||||
buildBuffer();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Mesh::init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, const std::vector<MeshVertexAttrib>& attribs)
|
||||
|
||||
bool Mesh::init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<IndexArray>& indices, const std::vector<MeshVertexAttrib>& attribs)
|
||||
{
|
||||
bool bRet = _renderdata.init(vertices, vertexSizeInFloat, indices, attribs);
|
||||
if (!bRet)
|
||||
return false;
|
||||
|
||||
buildSubMeshes();
|
||||
|
||||
buildBuffer();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Mesh::buildSubMeshes()
|
||||
{
|
||||
_subMeshes.clear();
|
||||
for (auto& it : _renderdata._subMeshIndices) {
|
||||
auto subMesh = SubMesh::create(PrimitiveType::TRIANGLES, IndexFormat::INDEX16, it);
|
||||
_subMeshes.pushBack(subMesh);
|
||||
}
|
||||
}
|
||||
|
||||
void Mesh::cleanAndFreeBuffers()
|
||||
{
|
||||
if(glIsBuffer(_vertexBuffer))
|
||||
|
@ -214,14 +240,9 @@ void Mesh::cleanAndFreeBuffers()
|
|||
_vertexBuffer = 0;
|
||||
}
|
||||
|
||||
if(glIsBuffer(_indexBuffer))
|
||||
{
|
||||
glDeleteBuffers(1, &_indexBuffer);
|
||||
_indexBuffer = 0;
|
||||
for (auto& it : _subMeshes) {
|
||||
(*it).cleanAndFreeBuffers();
|
||||
}
|
||||
_primitiveType = PrimitiveType::TRIANGLES;
|
||||
_indexFormat = IndexFormat::INDEX16;
|
||||
_indexCount = 0;
|
||||
}
|
||||
|
||||
void Mesh::buildBuffer()
|
||||
|
@ -237,25 +258,18 @@ void Mesh::buildBuffer()
|
|||
GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
glGenBuffers(1, &_indexBuffer);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
|
||||
|
||||
unsigned int indexSize = 2;
|
||||
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexSize * _renderdata._indices.size(), &_renderdata._indices[0], GL_STATIC_DRAW);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
_primitiveType = PrimitiveType::TRIANGLES;
|
||||
_indexFormat = IndexFormat::INDEX16;
|
||||
_indexCount = _renderdata._indices.size();
|
||||
for (size_t i = 0; i < _subMeshes.size(); i++) {
|
||||
_subMeshes.at(i)->buildBuffer(_renderdata._subMeshIndices[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void Mesh::restore()
|
||||
{
|
||||
_vertexBuffer = 0;
|
||||
_indexBuffer = 0;
|
||||
for (auto& it : _subMeshes) {
|
||||
it->_indexBuffer = 0;
|
||||
}
|
||||
|
||||
buildBuffer();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,9 +29,11 @@
|
|||
#include <vector>
|
||||
|
||||
#include "3d/CCBundle3DData.h"
|
||||
#include "3d/CCSubMesh.h"
|
||||
|
||||
#include "base/CCRef.h"
|
||||
#include "base/ccTypes.h"
|
||||
#include "base/CCVector.h"
|
||||
#include "math/CCMath.h"
|
||||
#include "renderer/CCGLProgram.h"
|
||||
|
||||
|
@ -42,14 +44,15 @@ class EventCustom;
|
|||
|
||||
class CC_DLL RenderMeshData
|
||||
{
|
||||
typedef std::vector<unsigned short> IndexArray;
|
||||
friend class Mesh;
|
||||
public:
|
||||
RenderMeshData(): _vertexsizeBytes(0)
|
||||
{
|
||||
}
|
||||
bool hasVertexAttrib(int attrib);
|
||||
bool init(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices);
|
||||
bool init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, const std::vector<MeshVertexAttrib>& attribs);
|
||||
bool init(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<IndexArray>& subMeshIndices);
|
||||
bool init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<IndexArray>& subMeshIndices, const std::vector<MeshVertexAttrib>& attribs);
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -58,7 +61,7 @@ protected:
|
|||
int _vertexsizeBytes;
|
||||
ssize_t _vertexNum;
|
||||
std::vector<float> _vertexs;
|
||||
std::vector<unsigned short> _indices;
|
||||
std::vector<IndexArray> _subMeshIndices;
|
||||
std::vector<MeshVertexAttrib> _vertexAttribs;
|
||||
};
|
||||
|
||||
|
@ -68,32 +71,34 @@ protected:
|
|||
*/
|
||||
class CC_DLL Mesh : public Ref
|
||||
{
|
||||
typedef std::vector<unsigned short> IndexArray;
|
||||
public:
|
||||
/** Defines supported index formats. */
|
||||
enum class IndexFormat
|
||||
{
|
||||
INDEX8 = GL_UNSIGNED_BYTE,
|
||||
INDEX16 = GL_UNSIGNED_SHORT,
|
||||
};
|
||||
|
||||
/** Defines supported primitive types. */
|
||||
enum class PrimitiveType
|
||||
{
|
||||
TRIANGLES = GL_TRIANGLES,
|
||||
TRIANGLE_STRIP = GL_TRIANGLE_STRIP,
|
||||
LINES = GL_LINES,
|
||||
LINE_STRIP = GL_LINE_STRIP,
|
||||
POINTS = GL_POINTS
|
||||
};
|
||||
|
||||
/**create mesh from positions, normals, and so on*/
|
||||
static Mesh* create(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices);
|
||||
/**create mesh from positions, normals, and so on, sigle SubMesh*/
|
||||
static Mesh* create(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const IndexArray& indices);
|
||||
|
||||
/**create mesh from positions, normals, and so on, multi-SubMesh*/
|
||||
static Mesh* create(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<IndexArray>& subMeshIndices);
|
||||
|
||||
/**create mesh with vertex attributes*/
|
||||
CC_DEPRECATED_ATTRIBUTE static Mesh* create(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, int numIndex, const std::vector<MeshVertexAttrib>& attribs, int attribCount) { return create(vertices, vertexSizeInFloat, indices, attribs); }
|
||||
CC_DEPRECATED_ATTRIBUTE static Mesh* create(const std::vector<float>& vertices, int vertexSizeInFloat, const IndexArray& indices, int numIndex, const std::vector<MeshVertexAttrib>& attribs, int attribCount) { return create(vertices, vertexSizeInFloat, indices, attribs); }
|
||||
|
||||
/**create mesh with vertex attributes*/
|
||||
static Mesh* create(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, const std::vector<MeshVertexAttrib>& attribs);
|
||||
/**
|
||||
* create Mesh
|
||||
* @param vertices vertices buffer data
|
||||
* @param vertexSizeInFloat size of each vertex
|
||||
* @param indices index buffer data that denotes how to connect the vertex, sigle SubMesh
|
||||
* @param attribs vertex attributes
|
||||
*/
|
||||
static Mesh* create(const std::vector<float>& vertices, int vertexSizeInFloat, const IndexArray& indices, const std::vector<MeshVertexAttrib>& attribs);
|
||||
|
||||
/**
|
||||
* create Mesh
|
||||
* @param vertices vertices buffer data
|
||||
* @param vertexSizeInFloat size of each vertex
|
||||
* @param subMeshIndices index buffer data that denotes how to connect the vertex, multi-SubMesh
|
||||
* @param attribs vertex attributes
|
||||
*/
|
||||
static Mesh* create(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<IndexArray>& subMeshIndices, const std::vector<MeshVertexAttrib>& attribs);
|
||||
|
||||
/**get vertex buffer*/
|
||||
inline GLuint getVertexBuffer() const { return _vertexBuffer; }
|
||||
|
@ -107,39 +112,45 @@ public:
|
|||
/**get per vertex size in bytes*/
|
||||
int getVertexSizeInBytes() const { return _renderdata._vertexsizeBytes; }
|
||||
|
||||
/** get primitive type*/
|
||||
PrimitiveType getPrimitiveType() const { return _primitiveType; }
|
||||
/**get index count*/
|
||||
ssize_t getIndexCount() const { return _indexCount; }
|
||||
/**get index format*/
|
||||
IndexFormat getIndexFormat() const { return _indexFormat; }
|
||||
/**get index buffer*/
|
||||
GLuint getIndexBuffer() const {return _indexBuffer; }
|
||||
/**get sub mesh count*/
|
||||
ssize_t getSubMeshCount() const { return _subMeshes.size(); }
|
||||
|
||||
/**get sub mesh by index*/
|
||||
SubMesh* getSubMesh(int index) const { return _subMeshes.at(index); }
|
||||
|
||||
/**build vertex buffer from renderdata*/
|
||||
void restore();
|
||||
|
||||
/**to be deprecated, those functions have been moved to SubMesh*/
|
||||
/** get primitive type*/
|
||||
CC_DEPRECATED_ATTRIBUTE PrimitiveType getPrimitiveType() const { return _subMeshes.at(0)->getPrimitiveType(); }
|
||||
/**get index count*/
|
||||
CC_DEPRECATED_ATTRIBUTE ssize_t getIndexCount() const { return _subMeshes.at(0)->getIndexCount(); }
|
||||
/**get index format*/
|
||||
CC_DEPRECATED_ATTRIBUTE IndexFormat getIndexFormat() const { return _subMeshes.at(0)->getIndexFormat(); }
|
||||
/**get index buffer*/
|
||||
CC_DEPRECATED_ATTRIBUTE GLuint getIndexBuffer() const {return _subMeshes.at(0)->getIndexBuffer(); }
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
|
||||
Mesh();
|
||||
virtual ~Mesh();
|
||||
/**init mesh*/
|
||||
bool init(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices);
|
||||
bool init(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<IndexArray>& indices);
|
||||
|
||||
/**init mesh*/
|
||||
bool init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, const std::vector<MeshVertexAttrib>& attribs);
|
||||
bool init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<IndexArray>& indices, const std::vector<MeshVertexAttrib>& attribs);
|
||||
|
||||
/**build sub meshes*/
|
||||
void buildSubMeshes();
|
||||
/**build buffer*/
|
||||
void buildBuffer();
|
||||
/**free buffer*/
|
||||
void cleanAndFreeBuffers();
|
||||
|
||||
protected:
|
||||
PrimitiveType _primitiveType;
|
||||
IndexFormat _indexFormat;
|
||||
GLuint _vertexBuffer;
|
||||
GLuint _indexBuffer;
|
||||
ssize_t _indexCount;
|
||||
Vector<SubMesh*> _subMeshes;
|
||||
|
||||
RenderMeshData _renderdata;
|
||||
};
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "3d/CCMeshSkin.h"
|
||||
#include "3d/CCSkeleton3D.h"
|
||||
#include "3d/CCBundle3D.h"
|
||||
|
||||
#include "base/ccMacros.h"
|
||||
|
@ -31,221 +32,6 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* Sets the inverse bind pose matrix.
|
||||
*
|
||||
* @param m C3DMatrix representing the inverse bind pose for this Bone.
|
||||
*/
|
||||
void Bone3D::setInverseBindPose(const Mat4& m)
|
||||
{
|
||||
_invBindPose = m;
|
||||
}
|
||||
|
||||
const Mat4& Bone3D::getInverseBindPose()
|
||||
{
|
||||
return _invBindPose;
|
||||
}
|
||||
|
||||
void Bone3D::setOriPose(const Mat4& m)
|
||||
{
|
||||
_oriPose = m;
|
||||
}
|
||||
|
||||
void Bone3D::resetPose()
|
||||
{
|
||||
_local =_oriPose;
|
||||
|
||||
for (auto it : _children) {
|
||||
it->resetPose();
|
||||
}
|
||||
}
|
||||
|
||||
void Bone3D::setWorldMatDirty(bool dirty)
|
||||
{
|
||||
_worldDirty = dirty;
|
||||
for (auto it : _children) {
|
||||
it->setWorldMatDirty(dirty);
|
||||
}
|
||||
}
|
||||
|
||||
//update own world matrix and children's
|
||||
void Bone3D::updateWorldMat()
|
||||
{
|
||||
getWorldMat();
|
||||
for (auto itor : _children) {
|
||||
itor->updateWorldMat();
|
||||
}
|
||||
}
|
||||
|
||||
const Mat4& Bone3D::getWorldMat()
|
||||
{
|
||||
if (_worldDirty)
|
||||
{
|
||||
updateLocalMat();
|
||||
if (_parent)
|
||||
{
|
||||
_world = _parent->getWorldMat() * _local;
|
||||
}
|
||||
else
|
||||
_world = _local;
|
||||
|
||||
_worldDirty = false;
|
||||
}
|
||||
|
||||
return _world;
|
||||
}
|
||||
|
||||
void Bone3D::setAnimationValue(float* trans, float* rot, float* scale, void* tag, float weight)
|
||||
{
|
||||
for (auto& it : _blendStates) {
|
||||
if (it.tag == tag)
|
||||
{
|
||||
if (trans)
|
||||
it.localTranslate.set(trans);
|
||||
if (rot)
|
||||
it.localRot.set(rot);
|
||||
if (scale)
|
||||
it.localScale.set(scale);
|
||||
it.weight = weight;
|
||||
return;
|
||||
}
|
||||
}
|
||||
BoneBlendState state;
|
||||
if (trans)
|
||||
state.localTranslate.set(trans);
|
||||
if (rot)
|
||||
state.localRot.set(rot);
|
||||
if (scale)
|
||||
state.localScale.set(scale);
|
||||
|
||||
state.weight = weight;
|
||||
state.tag = tag;
|
||||
|
||||
_blendStates.push_back(state);
|
||||
}
|
||||
|
||||
void Bone3D::clearBoneBlendState()
|
||||
{
|
||||
_blendStates.clear();
|
||||
for (auto it : _children) {
|
||||
it->clearBoneBlendState();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates C3DBone.
|
||||
*/
|
||||
Bone3D* Bone3D::create(const std::string& id)
|
||||
{
|
||||
auto bone = new Bone3D(id);
|
||||
bone->autorelease();
|
||||
return bone;
|
||||
}
|
||||
|
||||
void Bone3D::updateJointMatrix(Vec4* matrixPalette)
|
||||
{
|
||||
{
|
||||
static Mat4 t;
|
||||
Mat4::multiply(_world, getInverseBindPose(), &t);
|
||||
|
||||
matrixPalette[0].set(t.m[0], t.m[4], t.m[8], t.m[12]);
|
||||
matrixPalette[1].set(t.m[1], t.m[5], t.m[9], t.m[13]);
|
||||
matrixPalette[2].set(t.m[2], t.m[6], t.m[10], t.m[14]);
|
||||
}
|
||||
}
|
||||
|
||||
Bone3D* Bone3D::getParentBone()
|
||||
{
|
||||
return _parent;
|
||||
}
|
||||
ssize_t Bone3D::getChildBoneCount() const
|
||||
{
|
||||
return _children.size();
|
||||
}
|
||||
Bone3D* Bone3D::getChildBoneByIndex(int index)
|
||||
{
|
||||
return _children.at(index);
|
||||
}
|
||||
void Bone3D::addChildBone(Bone3D* bone)
|
||||
{
|
||||
if (_children.find(bone) == _children.end())
|
||||
_children.pushBack(bone);
|
||||
}
|
||||
void Bone3D::removeChildBoneByIndex(int index)
|
||||
{
|
||||
_children.erase(index);
|
||||
}
|
||||
void Bone3D::removeChildBone(Bone3D* bone)
|
||||
{
|
||||
_children.eraseObject(bone);
|
||||
}
|
||||
void Bone3D::removeAllChildBone()
|
||||
{
|
||||
_children.clear();
|
||||
}
|
||||
|
||||
Bone3D::Bone3D(const std::string& id)
|
||||
: _name(id)
|
||||
, _parent(nullptr)
|
||||
, _worldDirty(true)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Bone3D::~Bone3D()
|
||||
{
|
||||
removeAllChildBone();
|
||||
}
|
||||
|
||||
void Bone3D::updateLocalMat()
|
||||
{
|
||||
if (_blendStates.size())
|
||||
{
|
||||
Vec3 translate(Vec3::ZERO), scale(Vec3::ZERO);
|
||||
Quaternion quat(Quaternion::zero());
|
||||
|
||||
float total = 0.f;
|
||||
for (auto it: _blendStates) {
|
||||
total += it.weight;
|
||||
}
|
||||
if (total)
|
||||
{
|
||||
if (_blendStates.size() == 1)
|
||||
{
|
||||
auto& state = _blendStates[0];
|
||||
translate = state.localTranslate;
|
||||
scale = state.localScale;
|
||||
quat = state.localRot;
|
||||
}
|
||||
else
|
||||
{
|
||||
float invTotal = 1.f / total;
|
||||
for (auto it : _blendStates) {
|
||||
float weight = (it.weight * invTotal);
|
||||
translate += it.localTranslate * weight;
|
||||
scale.x += it.localScale.x * weight;
|
||||
scale.y += it.localScale.y * weight;
|
||||
scale.z += it.localScale.z * weight;
|
||||
if (!quat.isZero())
|
||||
{
|
||||
Quaternion& q = _blendStates[0].localRot;
|
||||
if (q.x * quat.x + q.y * quat.y + q.z * quat.z + q.w * quat.w < 0)
|
||||
weight = -weight;
|
||||
}
|
||||
quat = Quaternion(it.localRot.x * weight + quat.x, it.localRot.y * weight + quat.y, it.localRot.z * weight + quat.z, it.localRot.w * weight + quat.w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Mat4::createTranslation(translate, &_local);
|
||||
_local.rotate(quat);
|
||||
_local.scale(scale);
|
||||
|
||||
_blendStates.clear();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
static int PALETTE_ROWS = 3;
|
||||
|
||||
MeshSkin::MeshSkin()
|
||||
|
@ -258,10 +44,10 @@ MeshSkin::MeshSkin()
|
|||
MeshSkin::~MeshSkin()
|
||||
{
|
||||
removeAllBones();
|
||||
CC_SAFE_RELEASE(_skeleton);
|
||||
}
|
||||
|
||||
//create a new meshskin if do not want to share meshskin
|
||||
MeshSkin* MeshSkin::create(const std::string& filename, const std::string& name)
|
||||
MeshSkin* MeshSkin::create(Skeleton3D* skeleton, const std::string& filename, const std::string& name)
|
||||
{
|
||||
//load skin here;
|
||||
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filename);
|
||||
|
@ -270,6 +56,8 @@ MeshSkin* MeshSkin::create(const std::string& filename, const std::string& name)
|
|||
if (skindata)
|
||||
{
|
||||
auto skin = new MeshSkin();
|
||||
skin->_skeleton = skeleton;
|
||||
skeleton->retain();
|
||||
skin->initFromSkinData(*skindata);
|
||||
skin->autorelease();
|
||||
return skin;
|
||||
|
@ -284,6 +72,8 @@ MeshSkin* MeshSkin::create(const std::string& filename, const std::string& name)
|
|||
if (instance->loadSkinData(name, &data))
|
||||
{
|
||||
auto skin = new MeshSkin();
|
||||
skin->_skeleton = skeleton;
|
||||
skeleton->retain();
|
||||
skin->initFromSkinData(data);
|
||||
skin->autorelease();
|
||||
MeshSkinDataCache::getInstance()->addMeshSkinData(key, data);
|
||||
|
@ -302,6 +92,7 @@ bool MeshSkin::initFromSkinData(const SkinData& skindata)
|
|||
auto bone = Bone3D::create(skindata.skinBoneNames[i]);
|
||||
bone->_invBindPose = skindata.inverseBindPoseMatrices[i];
|
||||
bone->setOriPose(skindata.skinBoneOriginMatrices[i]);
|
||||
_invBindPoses.push_back(skindata.inverseBindPoseMatrices[i]);
|
||||
addSkinBone(bone);
|
||||
}
|
||||
for (i = 0; i < skindata.nodeBoneNames.size(); i++) {
|
||||
|
@ -343,12 +134,12 @@ Bone3D* MeshSkin::getBoneByIndex(unsigned int index) const
|
|||
Bone3D* MeshSkin::getBoneByName(const std::string& id) const
|
||||
{
|
||||
//search from skin bones
|
||||
for (auto it : _skinBones) {
|
||||
for (const auto& it : _skinBones) {
|
||||
if (it->getName() == id)
|
||||
return it;
|
||||
}
|
||||
//search from node bones
|
||||
for (auto it : _nodeBones) {
|
||||
for (const auto& it : _nodeBones) {
|
||||
if (it->getName() == id )
|
||||
return it;
|
||||
}
|
||||
|
@ -390,11 +181,15 @@ Vec4* MeshSkin::getMatrixPalette()
|
|||
{
|
||||
_matrixPalette = new Vec4[_skinBones.size() * PALETTE_ROWS];
|
||||
}
|
||||
int i = 0;
|
||||
for (auto it : _skinBones )
|
||||
{
|
||||
it->updateJointMatrix(&_matrixPalette[i++ * PALETTE_ROWS]);
|
||||
}
|
||||
int i = 0, paletteIndex = 0;
|
||||
static Mat4 t;
|
||||
for (auto it : _skinBones )
|
||||
{
|
||||
Mat4::multiply(it->getWorldMat(), _invBindPoses[i++], &t);
|
||||
_matrixPalette[paletteIndex++].set(t.m[0], t.m[4], t.m[8], t.m[12]);
|
||||
_matrixPalette[paletteIndex++].set(t.m[1], t.m[5], t.m[9], t.m[13]);
|
||||
_matrixPalette[paletteIndex++].set(t.m[2], t.m[6], t.m[10], t.m[14]);
|
||||
}
|
||||
|
||||
return _matrixPalette;
|
||||
}
|
||||
|
|
|
@ -37,146 +37,8 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* Defines a basic hierachial structure of transformation spaces.
|
||||
*/
|
||||
class Bone3D : public Ref
|
||||
{
|
||||
friend class MeshSkin;
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns the inverse bind pose matrix for this joint.
|
||||
*
|
||||
* @return Inverse bind pose matrix.
|
||||
*/
|
||||
const Mat4& getInverseBindPose();
|
||||
|
||||
/**update own world matrix and children's*/
|
||||
void updateWorldMat();
|
||||
|
||||
/**get wrod matrix*/
|
||||
const Mat4& getWorldMat();
|
||||
|
||||
/**get bone name*/
|
||||
const std::string& getName() const { return _name; }
|
||||
|
||||
/**
|
||||
* set animation value
|
||||
* @param trans translate vec3
|
||||
* @param rot rotation quaternion
|
||||
* @param scale scale vec3
|
||||
* @param tag, unique tag, only blend animation between different tags
|
||||
* @param weight, blend weight
|
||||
*/
|
||||
void setAnimationValue(float* trans, float* rot, float* scale, void* tag = nullptr, float weight = 1.0f);
|
||||
|
||||
/**clear bone blend states*/
|
||||
void clearBoneBlendState();
|
||||
/**
|
||||
* Creates C3DBone.
|
||||
*/
|
||||
static Bone3D* create(const std::string& id);
|
||||
|
||||
/**
|
||||
* Sets the inverse bind pose matrix.
|
||||
*
|
||||
* @param m Mat4 representing the inverse bind pose for this Bone.
|
||||
*/
|
||||
void setInverseBindPose(const Mat4& m);
|
||||
|
||||
/**
|
||||
* Sets the bone's original pose.
|
||||
*
|
||||
* @param m Mat4 representing the original pose for this Bone.
|
||||
*/
|
||||
void setOriPose(const Mat4& m);
|
||||
|
||||
/**
|
||||
* reset pose to origin
|
||||
*/
|
||||
void resetPose();
|
||||
|
||||
/**
|
||||
* Updates the joint matrix.
|
||||
*
|
||||
* @param matrixPalette The matrix palette to update.
|
||||
*/
|
||||
void updateJointMatrix(Vec4* matrixPalette);
|
||||
|
||||
/**bone tree, we do not inherit from Node, Node has too many properties that we do not need. A clean Node is needed.*/
|
||||
Bone3D* getParentBone();
|
||||
/**get child bone count*/
|
||||
ssize_t getChildBoneCount() const;
|
||||
/**get child bone by index*/
|
||||
Bone3D* getChildBoneByIndex(int index);
|
||||
/**add child bone*/
|
||||
void addChildBone(Bone3D* bone);
|
||||
/**remove child bone by index*/
|
||||
void removeChildBoneByIndex(int index);
|
||||
/**remove child bone*/
|
||||
void removeChildBone(Bone3D* bone);
|
||||
/**remove all child bone*/
|
||||
void removeAllChildBone();
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
struct BoneBlendState
|
||||
{
|
||||
Vec3 localTranslate;
|
||||
Quaternion localRot;
|
||||
Vec3 localScale;
|
||||
float weight;
|
||||
void* tag; //
|
||||
BoneBlendState()
|
||||
: localTranslate(Vec3::ZERO)
|
||||
, localRot(Quaternion::identity())
|
||||
, localScale(Vec3::ONE)
|
||||
, weight(1.f)
|
||||
, tag(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
Bone3D(const std::string& id);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~Bone3D();
|
||||
|
||||
/**
|
||||
* Update local matrix
|
||||
*/
|
||||
void updateLocalMat();
|
||||
|
||||
/**set world matrix dirty flag*/
|
||||
void setWorldMatDirty(bool dirty = true);
|
||||
|
||||
std::string _name; // bone name
|
||||
/**
|
||||
* The Mat4 representation of the Joint's bind pose.
|
||||
*/
|
||||
Mat4 _invBindPose;
|
||||
|
||||
Mat4 _oriPose; //original bone pose
|
||||
|
||||
Bone3D* _parent; //parent bone
|
||||
|
||||
Vector<Bone3D*> _children;
|
||||
|
||||
bool _worldDirty;
|
||||
Mat4 _world;
|
||||
Mat4 _local;
|
||||
|
||||
std::vector<BoneBlendState> _blendStates;
|
||||
|
||||
};
|
||||
class Bone3D;
|
||||
class Skeleton3D;
|
||||
|
||||
/**
|
||||
* MeshSkin, A class maintain a collection of bones that affect Mesh vertex.
|
||||
|
@ -187,7 +49,7 @@ class MeshSkin: public Ref
|
|||
public:
|
||||
|
||||
/**create a new meshskin if do not want to share meshskin*/
|
||||
static MeshSkin* create(const std::string& filename, const std::string& name);
|
||||
static MeshSkin* create(Skeleton3D* skeleton, const std::string& filename, const std::string& name);
|
||||
|
||||
/**get total bone count, skin bone + node bone*/
|
||||
ssize_t getBoneCount() const;
|
||||
|
@ -232,10 +94,12 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
|
||||
protected:
|
||||
|
||||
Vector<Bone3D*> _skinBones; // bones with skin
|
||||
Vector<Bone3D*> _skinBones; // bones with skin
|
||||
std::vector<Mat4> _invBindPoses; //inverse bind pose of bone
|
||||
Vector<Bone3D*> _nodeBones; //bones without skin, only used to compute transform of children
|
||||
|
||||
Bone3D* _rootBone;
|
||||
Skeleton3D* _skeleton; //skeleton the skin refered
|
||||
|
||||
// Pointer to the array of palette matrices.
|
||||
// This array is passed to the vertex shader as a uniform.
|
||||
|
|
|
@ -0,0 +1,436 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "3d/CCSkeleton3D.h"
|
||||
#include "3d/CCBundle3D.h"
|
||||
|
||||
#include "base/ccMacros.h"
|
||||
#include "base/CCPlatformMacros.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* Sets the inverse bind pose matrix.
|
||||
*
|
||||
* @param m C3DMatrix representing the inverse bind pose for this Bone.
|
||||
*/
|
||||
void Bone3D::setInverseBindPose(const Mat4& m)
|
||||
{
|
||||
_invBindPose = m;
|
||||
}
|
||||
|
||||
const Mat4& Bone3D::getInverseBindPose()
|
||||
{
|
||||
return _invBindPose;
|
||||
}
|
||||
|
||||
void Bone3D::setOriPose(const Mat4& m)
|
||||
{
|
||||
_oriPose = m;
|
||||
}
|
||||
|
||||
void Bone3D::resetPose()
|
||||
{
|
||||
_local =_oriPose;
|
||||
|
||||
for (auto it : _children) {
|
||||
it->resetPose();
|
||||
}
|
||||
}
|
||||
|
||||
void Bone3D::setWorldMatDirty(bool dirty)
|
||||
{
|
||||
_worldDirty = dirty;
|
||||
for (auto it : _children) {
|
||||
it->setWorldMatDirty(dirty);
|
||||
}
|
||||
}
|
||||
|
||||
//update own world matrix and children's
|
||||
void Bone3D::updateWorldMat()
|
||||
{
|
||||
getWorldMat();
|
||||
for (auto itor : _children) {
|
||||
itor->updateWorldMat();
|
||||
}
|
||||
}
|
||||
|
||||
const Mat4& Bone3D::getWorldMat()
|
||||
{
|
||||
if (_worldDirty)
|
||||
{
|
||||
updateLocalMat();
|
||||
if (_parent)
|
||||
{
|
||||
_world = _parent->getWorldMat() * _local;
|
||||
}
|
||||
else
|
||||
_world = _local;
|
||||
|
||||
_worldDirty = false;
|
||||
}
|
||||
|
||||
return _world;
|
||||
}
|
||||
|
||||
void Bone3D::setAnimationValue(float* trans, float* rot, float* scale, void* tag, float weight)
|
||||
{
|
||||
for (auto& it : _blendStates) {
|
||||
if (it.tag == tag)
|
||||
{
|
||||
if (trans)
|
||||
it.localTranslate.set(trans);
|
||||
if (rot)
|
||||
it.localRot.set(rot);
|
||||
if (scale)
|
||||
it.localScale.set(scale);
|
||||
it.weight = weight;
|
||||
return;
|
||||
}
|
||||
}
|
||||
BoneBlendState state;
|
||||
if (trans)
|
||||
state.localTranslate.set(trans);
|
||||
if (rot)
|
||||
state.localRot.set(rot);
|
||||
if (scale)
|
||||
state.localScale.set(scale);
|
||||
|
||||
state.weight = weight;
|
||||
state.tag = tag;
|
||||
|
||||
_blendStates.push_back(state);
|
||||
}
|
||||
|
||||
void Bone3D::clearBoneBlendState()
|
||||
{
|
||||
_blendStates.clear();
|
||||
for (auto it : _children) {
|
||||
it->clearBoneBlendState();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates C3DBone.
|
||||
*/
|
||||
Bone3D* Bone3D::create(const std::string& id)
|
||||
{
|
||||
auto bone = new Bone3D(id);
|
||||
bone->autorelease();
|
||||
return bone;
|
||||
}
|
||||
|
||||
void Bone3D::updateJointMatrix(Vec4* matrixPalette)
|
||||
{
|
||||
{
|
||||
static Mat4 t;
|
||||
Mat4::multiply(_world, getInverseBindPose(), &t);
|
||||
|
||||
matrixPalette[0].set(t.m[0], t.m[4], t.m[8], t.m[12]);
|
||||
matrixPalette[1].set(t.m[1], t.m[5], t.m[9], t.m[13]);
|
||||
matrixPalette[2].set(t.m[2], t.m[6], t.m[10], t.m[14]);
|
||||
}
|
||||
}
|
||||
|
||||
Bone3D* Bone3D::getParentBone()
|
||||
{
|
||||
return _parent;
|
||||
}
|
||||
ssize_t Bone3D::getChildBoneCount() const
|
||||
{
|
||||
return _children.size();
|
||||
}
|
||||
Bone3D* Bone3D::getChildBoneByIndex(int index) const
|
||||
{
|
||||
return _children.at(index);
|
||||
}
|
||||
void Bone3D::addChildBone(Bone3D* bone)
|
||||
{
|
||||
if (_children.find(bone) == _children.end())
|
||||
_children.pushBack(bone);
|
||||
}
|
||||
void Bone3D::removeChildBoneByIndex(int index)
|
||||
{
|
||||
_children.erase(index);
|
||||
}
|
||||
void Bone3D::removeChildBone(Bone3D* bone)
|
||||
{
|
||||
_children.eraseObject(bone);
|
||||
}
|
||||
void Bone3D::removeAllChildBone()
|
||||
{
|
||||
_children.clear();
|
||||
}
|
||||
|
||||
Bone3D::Bone3D(const std::string& id)
|
||||
: _name(id)
|
||||
, _parent(nullptr)
|
||||
, _worldDirty(true)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Bone3D::~Bone3D()
|
||||
{
|
||||
removeAllChildBone();
|
||||
}
|
||||
|
||||
void Bone3D::updateLocalMat()
|
||||
{
|
||||
if (_blendStates.size())
|
||||
{
|
||||
Vec3 translate(Vec3::ZERO), scale(Vec3::ZERO);
|
||||
Quaternion quat(Quaternion::ZERO);
|
||||
|
||||
float total = 0.f;
|
||||
for (auto it: _blendStates) {
|
||||
total += it.weight;
|
||||
}
|
||||
if (total)
|
||||
{
|
||||
if (_blendStates.size() == 1)
|
||||
{
|
||||
auto& state = _blendStates[0];
|
||||
translate = state.localTranslate;
|
||||
scale = state.localScale;
|
||||
quat = state.localRot;
|
||||
}
|
||||
else
|
||||
{
|
||||
float invTotal = 1.f / total;
|
||||
for (const auto& it : _blendStates)
|
||||
{
|
||||
float weight = (it.weight * invTotal);
|
||||
translate += it.localTranslate * weight;
|
||||
scale.x += it.localScale.x * weight;
|
||||
scale.y += it.localScale.y * weight;
|
||||
scale.z += it.localScale.z * weight;
|
||||
if (!quat.isZero())
|
||||
{
|
||||
Quaternion& q = _blendStates[0].localRot;
|
||||
if (q.x * quat.x + q.y * quat.y + q.z * quat.z + q.w * quat.w < 0)
|
||||
weight = -weight;
|
||||
}
|
||||
quat = Quaternion(it.localRot.x * weight + quat.x, it.localRot.y * weight + quat.y, it.localRot.z * weight + quat.z, it.localRot.w * weight + quat.w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Mat4::createTranslation(translate, &_local);
|
||||
_local.rotate(quat);
|
||||
_local.scale(scale);
|
||||
|
||||
_blendStates.clear();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Skeleton3D::Skeleton3D()
|
||||
: _rootBone(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Skeleton3D::~Skeleton3D()
|
||||
{
|
||||
removeAllBones();
|
||||
}
|
||||
|
||||
//create a new meshskin if do not want to share meshskin
|
||||
Skeleton3D* Skeleton3D::create(const std::string& filename, const std::string& name)
|
||||
{
|
||||
//load skin here;
|
||||
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filename);
|
||||
std::string key(fullPath + "#" + name);
|
||||
const auto skeletondata = Skeleton3DDataCache::getInstance()->getSkeletonData(key);
|
||||
if (skeletondata)
|
||||
{
|
||||
auto skeleton = new Skeleton3D();
|
||||
skeleton->initFromSkeletonData(*skeletondata);
|
||||
skeleton->autorelease();
|
||||
return skeleton;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto instance = Bundle3D::getInstance();
|
||||
bool ret = instance->load(fullPath);
|
||||
if (ret)
|
||||
{
|
||||
Skeleton3DData data;
|
||||
if (instance->loadSkeletonData(name, &data))
|
||||
{
|
||||
auto skeleton = new Skeleton3D();
|
||||
skeleton->initFromSkeletonData(data);
|
||||
skeleton->autorelease();
|
||||
Skeleton3DDataCache::getInstance()->addSkeletonData(key, data);
|
||||
return skeleton;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Skeleton3D::initFromSkeletonData(const Skeleton3DData& skeletondata)
|
||||
{
|
||||
ssize_t i = 0;
|
||||
for (; i < skeletondata.boneNames.size(); i++) {
|
||||
auto bone = Bone3D::create(skeletondata.boneNames[i]);
|
||||
bone->setOriPose(skeletondata.boneOriginMatrices[i]);
|
||||
addBone(bone);
|
||||
}
|
||||
|
||||
for (auto it : skeletondata.boneChild) {
|
||||
auto parent = getBoneByIndex(it.first);
|
||||
for (auto childIt : it.second) {
|
||||
auto child = getBoneByIndex(childIt);
|
||||
child->_parent = parent;
|
||||
parent->_children.pushBack(child);
|
||||
}
|
||||
}
|
||||
|
||||
setRootBone(getBoneByIndex(skeletondata.rootBoneIndex));
|
||||
if (_rootBone)
|
||||
_rootBone->resetPose();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ssize_t Skeleton3D::getBoneCount() const
|
||||
{
|
||||
return _bones.size();
|
||||
}
|
||||
|
||||
//get bone
|
||||
Bone3D* Skeleton3D::getBoneByIndex(unsigned int index) const
|
||||
{
|
||||
if (index < _bones.size())
|
||||
return _bones.at(index);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
Bone3D* Skeleton3D::getBoneByName(const std::string& id) const
|
||||
{
|
||||
//search from bones
|
||||
for (auto it : _bones) {
|
||||
if (it->getName() == id)
|
||||
return it;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Bone3D* Skeleton3D::getRootBone() const
|
||||
{
|
||||
return _rootBone;
|
||||
}
|
||||
void Skeleton3D::setRootBone(Bone3D* joint)
|
||||
{
|
||||
CC_SAFE_RETAIN(joint);
|
||||
CC_SAFE_RELEASE(_rootBone);
|
||||
_rootBone = joint;
|
||||
}
|
||||
|
||||
int Skeleton3D::getBoneIndex(Bone3D* bone) const
|
||||
{
|
||||
int i = 0;
|
||||
for (; i < _bones.size(); i++) {
|
||||
if (_bones.at(i) == bone)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//refresh bone world matrix
|
||||
void Skeleton3D::updateBoneMatrix()
|
||||
{
|
||||
_rootBone->setWorldMatDirty(true);
|
||||
_rootBone->updateWorldMat();
|
||||
}
|
||||
|
||||
void Skeleton3D::removeAllBones()
|
||||
{
|
||||
_bones.clear();
|
||||
CC_SAFE_RELEASE(_rootBone);
|
||||
}
|
||||
|
||||
void Skeleton3D::addBone(Bone3D* bone)
|
||||
{
|
||||
_bones.pushBack(bone);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
Skeleton3DDataCache* Skeleton3DDataCache::_cacheInstance = nullptr;
|
||||
|
||||
Skeleton3DDataCache* Skeleton3DDataCache::getInstance()
|
||||
{
|
||||
if (_cacheInstance == nullptr)
|
||||
_cacheInstance = new Skeleton3DDataCache();
|
||||
return _cacheInstance;
|
||||
}
|
||||
void Skeleton3DDataCache::destroyInstance()
|
||||
{
|
||||
if (_cacheInstance)
|
||||
{
|
||||
CC_SAFE_DELETE(_cacheInstance);
|
||||
}
|
||||
}
|
||||
|
||||
const Skeleton3DData* Skeleton3DDataCache::getSkeletonData(const std::string& key) const
|
||||
{
|
||||
auto it = _skeletonDatas.find(key);
|
||||
if (it != _skeletonDatas.end())
|
||||
return &it->second;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Skeleton3DDataCache::addSkeletonData(const std::string& key, const Skeleton3DData& data)
|
||||
{
|
||||
if (_skeletonDatas.find(key) != _skeletonDatas.end())
|
||||
return false; // already have this key
|
||||
|
||||
_skeletonDatas[key] = data;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Skeleton3DDataCache::removeAllSkeletonData()
|
||||
{
|
||||
_skeletonDatas.clear();
|
||||
}
|
||||
|
||||
Skeleton3DDataCache::Skeleton3DDataCache()
|
||||
{
|
||||
|
||||
}
|
||||
Skeleton3DDataCache::~Skeleton3DDataCache()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_CC_END
|
|
@ -0,0 +1,262 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCSKELETON3D_H__
|
||||
#define __CCSKELETON3D_H__
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "3d/CCBundle3DData.h"
|
||||
|
||||
#include "base/ccMacros.h"
|
||||
#include "base/CCRef.h"
|
||||
#include "base/CCVector.h"
|
||||
#include "base/ccTypes.h"
|
||||
#include "math/CCMath.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* Defines a basic hierachial structure of transformation spaces.
|
||||
*/
|
||||
class CC_DLL Bone3D : public Ref
|
||||
{
|
||||
friend class Skeleton3D;
|
||||
friend class MeshSkin;
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns the inverse bind pose matrix for this joint.
|
||||
*
|
||||
* @return Inverse bind pose matrix.
|
||||
*/
|
||||
const Mat4& getInverseBindPose();
|
||||
|
||||
/**update own world matrix and children's*/
|
||||
void updateWorldMat();
|
||||
|
||||
/**get wrod matrix*/
|
||||
const Mat4& getWorldMat();
|
||||
|
||||
/**get bone name*/
|
||||
const std::string& getName() const { return _name; }
|
||||
|
||||
/**
|
||||
* set animation value
|
||||
* @param trans translate vec3
|
||||
* @param rot rotation quaternion
|
||||
* @param scale scale vec3
|
||||
* @param tag, unique tag, only blend animation between different tags
|
||||
* @param weight, blend weight
|
||||
*/
|
||||
void setAnimationValue(float* trans, float* rot, float* scale, void* tag = nullptr, float weight = 1.0f);
|
||||
|
||||
/**clear bone blend states*/
|
||||
void clearBoneBlendState();
|
||||
/**
|
||||
* Creates C3DBone.
|
||||
*/
|
||||
static Bone3D* create(const std::string& id);
|
||||
|
||||
/**
|
||||
* Sets the inverse bind pose matrix.
|
||||
*
|
||||
* @param m Mat4 representing the inverse bind pose for this Bone.
|
||||
*/
|
||||
void setInverseBindPose(const Mat4& m);
|
||||
|
||||
/**
|
||||
* Sets the bone's original pose.
|
||||
*
|
||||
* @param m Mat4 representing the original pose for this Bone.
|
||||
*/
|
||||
void setOriPose(const Mat4& m);
|
||||
|
||||
/**
|
||||
* reset pose to origin
|
||||
*/
|
||||
void resetPose();
|
||||
|
||||
/**
|
||||
* Updates the joint matrix.
|
||||
*
|
||||
* @param matrixPalette The matrix palette to update.
|
||||
*/
|
||||
void updateJointMatrix(Vec4* matrixPalette);
|
||||
|
||||
/**bone tree, we do not inherit from Node, Node has too many properties that we do not need. A clean Node is needed.*/
|
||||
Bone3D* getParentBone();
|
||||
/**get child bone count*/
|
||||
ssize_t getChildBoneCount() const;
|
||||
/**get child bone by index*/
|
||||
Bone3D* getChildBoneByIndex(int index) const;
|
||||
/**add child bone*/
|
||||
void addChildBone(Bone3D* bone);
|
||||
/**remove child bone by index*/
|
||||
void removeChildBoneByIndex(int index);
|
||||
/**remove child bone*/
|
||||
void removeChildBone(Bone3D* bone);
|
||||
/**remove all child bone*/
|
||||
void removeAllChildBone();
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
struct BoneBlendState
|
||||
{
|
||||
Vec3 localTranslate;
|
||||
Quaternion localRot;
|
||||
Vec3 localScale;
|
||||
float weight;
|
||||
void* tag; //
|
||||
BoneBlendState()
|
||||
: localTranslate(Vec3::ZERO)
|
||||
, localRot(Quaternion::identity())
|
||||
, localScale(Vec3::ONE)
|
||||
, weight(1.f)
|
||||
, tag(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
Bone3D(const std::string& id);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~Bone3D();
|
||||
|
||||
/**
|
||||
* Update local matrix
|
||||
*/
|
||||
void updateLocalMat();
|
||||
|
||||
/**set world matrix dirty flag*/
|
||||
void setWorldMatDirty(bool dirty = true);
|
||||
|
||||
std::string _name; // bone name
|
||||
/**
|
||||
* The Mat4 representation of the Joint's bind pose.
|
||||
*/
|
||||
Mat4 _invBindPose;
|
||||
|
||||
Mat4 _oriPose; //original bone pose
|
||||
|
||||
Bone3D* _parent; //parent bone
|
||||
|
||||
Vector<Bone3D*> _children;
|
||||
|
||||
bool _worldDirty;
|
||||
Mat4 _world;
|
||||
Mat4 _local;
|
||||
|
||||
std::vector<BoneBlendState> _blendStates;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Skeleton
|
||||
*
|
||||
*/
|
||||
class CC_DLL Skeleton3D: public Ref
|
||||
{
|
||||
public:
|
||||
|
||||
/**create a new meshskin if do not want to share Skeleton3D*/
|
||||
static Skeleton3D* create(const std::string& filename, const std::string& name);
|
||||
|
||||
/**get total bone count*/
|
||||
ssize_t getBoneCount() const;
|
||||
|
||||
/**get bone*/
|
||||
Bone3D* getBoneByIndex(unsigned int index) const;
|
||||
Bone3D* getBoneByName(const std::string& id) const;
|
||||
|
||||
/**get & set root bone*/
|
||||
Bone3D* getRootBone() const;
|
||||
void setRootBone(Bone3D* bone);
|
||||
|
||||
/**get bone index*/
|
||||
int getBoneIndex(Bone3D* bone) const;
|
||||
|
||||
/**refresh bone world matrix*/
|
||||
void updateBoneMatrix();
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
|
||||
Skeleton3D();
|
||||
|
||||
~Skeleton3D();
|
||||
|
||||
/**init from skeleton data*/
|
||||
bool initFromSkeletonData(const Skeleton3DData& skeletondata);
|
||||
|
||||
/**remove all bones*/
|
||||
void removeAllBones();
|
||||
|
||||
/**add bone*/
|
||||
void addBone(Bone3D* bone);
|
||||
|
||||
protected:
|
||||
|
||||
Vector<Bone3D*> _bones; // bones
|
||||
|
||||
Bone3D* _rootBone;
|
||||
};
|
||||
|
||||
/**
|
||||
* Skeleton3DData Cache
|
||||
*/
|
||||
class Skeleton3DDataCache
|
||||
{
|
||||
public:
|
||||
/**get & destroy*/
|
||||
static Skeleton3DDataCache* getInstance();
|
||||
static void destroyInstance();
|
||||
|
||||
/**get mesh skin data from cache*/
|
||||
const Skeleton3DData* getSkeletonData(const std::string& key) const;
|
||||
|
||||
/**add skeleton data to cache*/
|
||||
bool addSkeletonData(const std::string& key, const Skeleton3DData& skeletonData);
|
||||
|
||||
/**remove all skeleton data*/
|
||||
void removeAllSkeletonData();
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
Skeleton3DDataCache();
|
||||
~Skeleton3DDataCache();
|
||||
|
||||
static Skeleton3DDataCache* _cacheInstance; // instance
|
||||
|
||||
std::unordered_map<std::string, Skeleton3DData> _skeletonDatas; //cached skeleton datas
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __CCSKELETON3D_H__
|
|
@ -28,6 +28,10 @@
|
|||
#include "3d/CCMeshSkin.h"
|
||||
#include "3d/CCBundle3D.h"
|
||||
#include "3d/CCSprite3DMaterial.h"
|
||||
#include "3d/CCSubMesh.h"
|
||||
#include "3d/CCAttachNode.h"
|
||||
#include "3d/CCSubMeshState.h"
|
||||
#include "3d/CCSkeleton3D.h"
|
||||
|
||||
#include "base/CCDirector.h"
|
||||
#include "base/CCPlatformMacros.h"
|
||||
|
@ -70,24 +74,7 @@ Sprite3D* Sprite3D::create(const std::string &modelPath, const std::string &text
|
|||
return sprite;
|
||||
}
|
||||
|
||||
// Sprite3D* Sprite3D::create(Mesh* mesh, const std::string& texturePath)
|
||||
// {
|
||||
// CCASSERT(nullptr != mesh, "Could not create a Sprite3D from a null Mesh");
|
||||
// auto sprite = new Sprite3D();
|
||||
// if(sprite)
|
||||
// {
|
||||
// sprite->_mesh = mesh;
|
||||
// sprite->_mesh->retain();
|
||||
// sprite->setTexture(texturePath);
|
||||
// sprite->autorelease();
|
||||
// return sprite;
|
||||
// }
|
||||
// CC_SAFE_DELETE(sprite);
|
||||
// return nullptr;
|
||||
// }
|
||||
|
||||
//.mtl file should at the same directory with the same name if exist
|
||||
bool Sprite3D::loadFromObj(const std::string& path)
|
||||
bool Sprite3D::loadFromCache(const std::string& path)
|
||||
{
|
||||
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(path);
|
||||
|
||||
|
@ -99,14 +86,35 @@ bool Sprite3D::loadFromObj(const std::string& path)
|
|||
_mesh = mesh;
|
||||
_mesh->retain();
|
||||
|
||||
auto tex = Sprite3DMaterialCache::getInstance()->getSprite3DMaterial(key);
|
||||
setTexture(tex);
|
||||
char str[20];
|
||||
for (int i = 0; i < (int)_mesh->getSubMeshCount(); i++) {
|
||||
sprintf(str, "submesh%d", i);
|
||||
std::string submeshkey = key + std::string(str);
|
||||
auto tex = Sprite3DMaterialCache::getInstance()->getSprite3DMaterial(submeshkey);
|
||||
auto submeshstate = SubMeshState::create();
|
||||
submeshstate->setTexture(tex);
|
||||
_subMeshStates.pushBack(submeshstate);
|
||||
}
|
||||
|
||||
_skeleton = Skeleton3D::create(fullPath, "");
|
||||
CC_SAFE_RETAIN(_skeleton);
|
||||
_skin = MeshSkin::create(_skeleton, fullPath, "");
|
||||
CC_SAFE_RETAIN(_skin);
|
||||
|
||||
genGLProgramState();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//.mtl file should at the same directory with the same name if exist
|
||||
bool Sprite3D::loadFromObj(const std::string& path)
|
||||
{
|
||||
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(path);
|
||||
std::string key = fullPath + "#";
|
||||
|
||||
//.mtl file directory
|
||||
std::string dir = "";
|
||||
auto last = fullPath.rfind("/");
|
||||
|
@ -119,67 +127,36 @@ bool Sprite3D::loadFromObj(const std::string& path)
|
|||
return false;
|
||||
|
||||
//convert to mesh and material
|
||||
std::vector<unsigned short> indices;
|
||||
std::vector<std::vector<unsigned short> > submeshIndices;
|
||||
std::vector<std::string> matnames;
|
||||
std::string texname;
|
||||
for (auto it = shapes.shapes.begin(); it != shapes.shapes.end(); it++)
|
||||
{
|
||||
indices.insert(indices.end(), (*it).mesh.indices.begin(),(*it).mesh.indices.end());
|
||||
//indices.push_back((*it).mesh.indices);
|
||||
if (texname.empty())
|
||||
texname = (*it).material.diffuse_texname;
|
||||
else if (texname != (*it).material.diffuse_texname)
|
||||
{
|
||||
CCLOGWARN("cocos2d:WARNING: more than one texture in %s", path.c_str());
|
||||
}
|
||||
|
||||
matnames.push_back(dir + (*it).material.diffuse_texname);
|
||||
submeshIndices.push_back((*it).mesh.indices);
|
||||
|
||||
texname = (*it).material.diffuse_texname;
|
||||
if (!texname.empty())
|
||||
texname = dir + (*it).material.diffuse_texname;
|
||||
matnames.push_back(texname);
|
||||
}
|
||||
_mesh = Mesh::create(shapes.positions, shapes.normals, shapes.texcoords, indices);
|
||||
|
||||
_mesh = Mesh::create(shapes.positions, shapes.normals, shapes.texcoords, submeshIndices);
|
||||
_mesh->retain();
|
||||
if (_mesh == nullptr)
|
||||
return false;
|
||||
|
||||
if (matnames.size())
|
||||
{
|
||||
setTexture(matnames[0]);
|
||||
}
|
||||
genGLProgramState();
|
||||
|
||||
//add to cache
|
||||
|
||||
if (_texture)
|
||||
{
|
||||
Sprite3DMaterialCache::getInstance()->addSprite3DMaterial(key, _texture);
|
||||
}
|
||||
|
||||
//add mesh to cache
|
||||
MeshCache::getInstance()->addMesh(key, _mesh);
|
||||
|
||||
genMaterials(key, matnames);
|
||||
|
||||
genGLProgramState();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Sprite3D::loadFromC3x(const std::string& path)
|
||||
{
|
||||
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(path);
|
||||
//find from the cache
|
||||
std::string key = fullPath + "#";
|
||||
auto mesh = MeshCache::getInstance()->getMesh(key);
|
||||
if (mesh)
|
||||
{
|
||||
_mesh = mesh;
|
||||
_mesh->retain();
|
||||
|
||||
auto tex = Sprite3DMaterialCache::getInstance()->getSprite3DMaterial(key);
|
||||
setTexture(tex);
|
||||
|
||||
_skin = MeshSkin::create(fullPath, "");
|
||||
CC_SAFE_RETAIN(_skin);
|
||||
|
||||
genGLProgramState();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//load from .c3b or .c3t
|
||||
auto bundle = Bundle3D::getInstance();
|
||||
|
@ -193,52 +170,60 @@ bool Sprite3D::loadFromC3x(const std::string& path)
|
|||
return false;
|
||||
}
|
||||
|
||||
_mesh = Mesh::create(meshdata.vertex, meshdata.vertexSizeInFloat, meshdata.indices, meshdata.attribs);
|
||||
_mesh = Mesh::create(meshdata.vertex, meshdata.vertexSizeInFloat, meshdata.subMeshIndices, meshdata.attribs);
|
||||
|
||||
CC_SAFE_RETAIN(_mesh);
|
||||
|
||||
_skin = MeshSkin::create(fullPath, "");
|
||||
//add mesh to cache
|
||||
MeshCache::getInstance()->addMesh(key, _mesh);
|
||||
_skeleton = Skeleton3D::create(fullPath, "");
|
||||
CC_SAFE_RETAIN(_skeleton);
|
||||
_skin = MeshSkin::create(_skeleton, fullPath, "");
|
||||
CC_SAFE_RETAIN(_skin);
|
||||
|
||||
MaterialData materialdata;
|
||||
ret = bundle->loadMaterialData("", &materialdata);
|
||||
if (ret)
|
||||
{
|
||||
setTexture(materialdata.texturePath);
|
||||
std::vector<std::string> texpaths;
|
||||
texpaths.resize(_mesh->getSubMeshCount(), "");
|
||||
for (auto& it : materialdata.texturePaths)
|
||||
{
|
||||
texpaths[it.first] = it.second;
|
||||
}
|
||||
genMaterials(key, texpaths);
|
||||
}
|
||||
|
||||
genGLProgramState();
|
||||
|
||||
//add to cache
|
||||
auto cache = Director::getInstance()->getTextureCache();
|
||||
auto tex = cache->addImage(materialdata.texturePath);
|
||||
if (tex)
|
||||
Sprite3DMaterialCache::getInstance()->addSprite3DMaterial(key, tex);
|
||||
|
||||
MeshCache::getInstance()->addMesh(key, _mesh);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Sprite3D::Sprite3D()
|
||||
: _mesh(nullptr)
|
||||
, _skin(nullptr)
|
||||
, _texture(nullptr)
|
||||
, _skeleton(nullptr)
|
||||
, _blend(BlendFunc::ALPHA_NON_PREMULTIPLIED)
|
||||
{
|
||||
}
|
||||
|
||||
Sprite3D::~Sprite3D()
|
||||
{
|
||||
CC_SAFE_RELEASE_NULL(_texture);
|
||||
_subMeshStates.clear();
|
||||
CC_SAFE_RELEASE_NULL(_mesh);
|
||||
CC_SAFE_RELEASE_NULL(_skin);
|
||||
CC_SAFE_RELEASE_NULL(_skeleton);
|
||||
removeAllAttachNode();
|
||||
}
|
||||
|
||||
bool Sprite3D::initWithFile(const std::string &path)
|
||||
{
|
||||
_subMeshStates.clear();
|
||||
CC_SAFE_RELEASE_NULL(_mesh);
|
||||
CC_SAFE_RELEASE_NULL(_skin);
|
||||
CC_SAFE_RELEASE_NULL(_texture);
|
||||
CC_SAFE_RELEASE_NULL(_skeleton);
|
||||
|
||||
if (loadFromCache(path))
|
||||
return true;
|
||||
|
||||
//load from file
|
||||
std::string ext = path.substr(path.length() - 4, 4);
|
||||
|
@ -273,8 +258,13 @@ void Sprite3D::genGLProgramState()
|
|||
}
|
||||
|
||||
setGLProgramState(programstate);
|
||||
GLuint texID = _texture ? _texture->getName() : 0;
|
||||
_meshCommand.genMaterialID(texID, programstate, _mesh, _blend);
|
||||
auto count = _mesh->getSubMeshCount();
|
||||
_meshCommands.resize(count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
auto tex = _subMeshStates.at(i)->getTexture();
|
||||
GLuint texID = tex ? tex->getName() : 0;
|
||||
_meshCommands[i].genMaterialID(texID, programstate, _mesh, _blend);
|
||||
}
|
||||
}
|
||||
|
||||
GLProgram* Sprite3D::getDefaultGLProgram(bool textured)
|
||||
|
@ -295,59 +285,105 @@ GLProgram* Sprite3D::getDefaultGLProgram(bool textured)
|
|||
}
|
||||
}
|
||||
|
||||
void Sprite3D::genMaterials(const std::string& keyprefix, const std::vector<std::string>& texpaths)
|
||||
{
|
||||
_subMeshStates.clear();
|
||||
|
||||
char str[20];
|
||||
auto cache = Director::getInstance()->getTextureCache();
|
||||
int index = 0;
|
||||
for (auto& it : texpaths) {
|
||||
auto tex = cache->addImage(it);
|
||||
auto subMeshState = SubMeshState::create();
|
||||
subMeshState->setTexture(tex);
|
||||
_subMeshStates.pushBack(subMeshState);
|
||||
|
||||
//add to cache
|
||||
sprintf(str, "submesh%d", index);
|
||||
std::string submeshkey = keyprefix + std::string(str);
|
||||
Sprite3DMaterialCache::getInstance()->addSprite3DMaterial(submeshkey, tex);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
void Sprite3D::setTexture(const std::string& texFile)
|
||||
{
|
||||
auto tex = Director::getInstance()->getTextureCache()->addImage(texFile);
|
||||
// if( tex && _texture != tex ) {
|
||||
// CC_SAFE_RETAIN(tex);
|
||||
// CC_SAFE_RELEASE_NULL(_texture);
|
||||
// _texture = tex;
|
||||
// }
|
||||
setTexture(tex);
|
||||
}
|
||||
|
||||
void Sprite3D::setTexture(Texture2D* texture)
|
||||
{
|
||||
if(_texture != texture) {
|
||||
CC_SAFE_RETAIN(texture);
|
||||
CC_SAFE_RELEASE_NULL(_texture);
|
||||
_texture = texture;
|
||||
if (getGLProgramState() && _mesh)
|
||||
{
|
||||
GLuint texID = _texture ? _texture->getName() : 0;
|
||||
_meshCommand.genMaterialID(texID, getGLProgramState(), _mesh, _blend);
|
||||
}
|
||||
_subMeshStates.at(0)->setTexture(texture);
|
||||
}
|
||||
|
||||
AttachNode* Sprite3D::getAttachNode(const std::string& boneName)
|
||||
{
|
||||
auto it = _attachments.find(boneName);
|
||||
if (it != _attachments.end())
|
||||
return it->second;
|
||||
|
||||
if (_skin)
|
||||
{
|
||||
auto bone = _skin->getBoneByName(boneName);
|
||||
auto attachNode = AttachNode::create(bone);
|
||||
addChild(attachNode);
|
||||
_attachments[boneName] = attachNode;
|
||||
return attachNode;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Sprite3D::removeAttachNode(const std::string& boneName)
|
||||
{
|
||||
auto it = _attachments.find(boneName);
|
||||
if (it != _attachments.end())
|
||||
{
|
||||
removeChild(it->second);
|
||||
_attachments.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
void Sprite3D::removeAllAttachNode()
|
||||
{
|
||||
for (auto& it : _attachments) {
|
||||
removeChild(it.second);
|
||||
}
|
||||
_attachments.clear();
|
||||
}
|
||||
|
||||
void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||
{
|
||||
// if (_skeleton)
|
||||
// _skeleton->updateBoneMatrix();
|
||||
|
||||
GLProgramState* programstate = getGLProgramState();
|
||||
Color4F color(getDisplayedColor());
|
||||
color.a = getDisplayedOpacity() / 255.0f;
|
||||
|
||||
GLuint textureID = _texture ? _texture->getName() : 0;
|
||||
_meshCommand.init(_globalZOrder,
|
||||
textureID,
|
||||
programstate,
|
||||
_blend,
|
||||
_mesh->getVertexBuffer(),
|
||||
_mesh->getIndexBuffer(),
|
||||
(GLenum)_mesh->getPrimitiveType(),
|
||||
(GLenum)_mesh->getIndexFormat(),
|
||||
_mesh->getIndexCount(),
|
||||
transform);
|
||||
|
||||
_meshCommand.setCullFaceEnabled(true);
|
||||
_meshCommand.setDepthTestEnabled(true);
|
||||
if (_skin)
|
||||
{
|
||||
_meshCommand.setMatrixPaletteSize((int)_skin->getMatrixPaletteSize());
|
||||
_meshCommand.setMatrixPalette(_skin->getMatrixPalette());
|
||||
for (ssize_t i = 0; i < _mesh->getSubMeshCount(); i++) {
|
||||
auto submeshstate = _subMeshStates.at(i);
|
||||
if (!submeshstate->isVisible())
|
||||
continue;
|
||||
|
||||
auto submesh = _mesh->getSubMesh((int)i);
|
||||
auto& meshCommand = _meshCommands[i];
|
||||
|
||||
GLuint textureID = submeshstate->getTexture() ? submeshstate->getTexture()->getName() : 0;
|
||||
meshCommand.init(_globalZOrder, textureID, programstate, _blend, _mesh->getVertexBuffer(), submesh->getIndexBuffer(), (GLenum)submesh->getPrimitiveType(), (GLenum)submesh->getIndexFormat(), submesh->getIndexCount(), transform);
|
||||
|
||||
meshCommand.setCullFaceEnabled(true);
|
||||
meshCommand.setDepthTestEnabled(true);
|
||||
if (_skin)
|
||||
{
|
||||
meshCommand.setMatrixPaletteSize((int)_skin->getMatrixPaletteSize());
|
||||
meshCommand.setMatrixPalette(_skin->getMatrixPalette());
|
||||
}
|
||||
//support tint and fade
|
||||
meshCommand.setDisplayColor(Vec4(color.r, color.g, color.b, color.a));
|
||||
Director::getInstance()->getRenderer()->addCommand(&meshCommand);
|
||||
}
|
||||
//support tint and fade
|
||||
_meshCommand.setDisplayColor(Vec4(color.r, color.g, color.b, color.a));
|
||||
Director::getInstance()->getRenderer()->addCommand(&_meshCommand);
|
||||
}
|
||||
|
||||
void Sprite3D::setBlendFunc(const BlendFunc &blendFunc)
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#define __CCSPRITE3D_H__
|
||||
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "base/CCVector.h"
|
||||
#include "base/ccTypes.h"
|
||||
|
@ -39,6 +40,9 @@ class GLProgramState;
|
|||
class Mesh;
|
||||
class Texture2D;
|
||||
class MeshSkin;
|
||||
class AttachNode;
|
||||
class SubMeshState;
|
||||
class Skeleton3D;
|
||||
|
||||
/** Sprite3D: A sprite can be loaded from 3D model files, .obj, .c3t, .c3b, then can be drawed as sprite */
|
||||
class CC_DLL Sprite3D : public Node, public BlendProtocol
|
||||
|
@ -50,15 +54,27 @@ public:
|
|||
// creates a Sprite3D. It only supports one texture, and overrides the internal texture with 'texturePath'
|
||||
static Sprite3D* create(const std::string &modelPath, const std::string &texturePath);
|
||||
|
||||
/**set texture*/
|
||||
/**set texture, set the first if multiple textures exist*/
|
||||
void setTexture(const std::string& texFile);
|
||||
void setTexture(Texture2D* texture);
|
||||
|
||||
/**get SubMeshState by index*/
|
||||
SubMeshState* getSubMeshState(int index) const;
|
||||
|
||||
/**get mesh*/
|
||||
Mesh* getMesh() const { return _mesh; }
|
||||
|
||||
/**get skin*/
|
||||
MeshSkin* getSkin() const { return _skin; }
|
||||
|
||||
/**get AttachNode by bone name, return nullptr if not exist*/
|
||||
AttachNode* getAttachNode(const std::string& boneName);
|
||||
|
||||
/**remove attach node*/
|
||||
void removeAttachNode(const std::string& boneName);
|
||||
|
||||
/**remove all attach nodes*/
|
||||
void removeAllAttachNode();
|
||||
|
||||
// overrides
|
||||
virtual void setBlendFunc(const BlendFunc &blendFunc) override;
|
||||
|
@ -70,6 +86,9 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
virtual ~Sprite3D();
|
||||
bool initWithFile(const std::string &path);
|
||||
|
||||
/**load sprite3d from cache, return true if succeed, false otherwise*/
|
||||
bool loadFromCache(const std::string& path);
|
||||
|
||||
/**.mtl file should at the same directory with the same name if exist*/
|
||||
bool loadFromObj(const std::string& path);
|
||||
|
||||
|
@ -84,14 +103,22 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
|
||||
/**generate default GLProgramState*/
|
||||
void genGLProgramState();
|
||||
|
||||
/**generate materials, and add them to cache, keyprefix is used as key prefix when added to cache*/
|
||||
void genMaterials(const std::string& keyprefix, const std::vector<std::string>& texpaths);
|
||||
|
||||
protected:
|
||||
Mesh* _mesh;//mesh
|
||||
MeshSkin* _skin;//skin
|
||||
Mesh* _mesh;//mesh
|
||||
MeshSkin* _skin;//skin
|
||||
Skeleton3D* _skeleton; //skeleton
|
||||
|
||||
MeshCommand _meshCommand; //render command
|
||||
Texture2D* _texture;
|
||||
BlendFunc _blend;
|
||||
std::vector<MeshCommand> _meshCommands; //render command each for one submesh
|
||||
|
||||
Vector<SubMeshState*> _subMeshStates; // SubMeshStates
|
||||
|
||||
std::unordered_map<std::string, AttachNode*> _attachments;
|
||||
|
||||
BlendFunc _blend;
|
||||
};
|
||||
|
||||
extern std::string CC_DLL s_attributeNames[];//attribute names array
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCSubMesh.h"
|
||||
|
||||
#include <list>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "3d/CCObjLoader.h"
|
||||
#include "3d/CCSprite3DMaterial.h"
|
||||
|
||||
#include "base/ccMacros.h"
|
||||
#include "base/CCEventCustom.h"
|
||||
#include "base/CCEventListenerCustom.h"
|
||||
#include "base/CCEventDispatcher.h"
|
||||
#include "base/CCEventType.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include "renderer/ccGLStateCache.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
SubMesh::SubMesh()
|
||||
: _indexBuffer(0)
|
||||
, _primitiveType(PrimitiveType::TRIANGLES)
|
||||
, _indexFormat(IndexFormat::INDEX16)
|
||||
, _indexCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
SubMesh::~SubMesh()
|
||||
{
|
||||
cleanAndFreeBuffers();
|
||||
}
|
||||
|
||||
SubMesh* SubMesh::create(PrimitiveType primitivetype, IndexFormat indexformat, const std::vector<unsigned short>& indices)
|
||||
{
|
||||
auto submesh = new SubMesh();
|
||||
submesh->_primitiveType = primitivetype;
|
||||
submesh->_indexFormat = indexformat;
|
||||
submesh->autorelease();
|
||||
|
||||
return submesh;
|
||||
}
|
||||
|
||||
void SubMesh::cleanAndFreeBuffers()
|
||||
{
|
||||
if(glIsBuffer(_indexBuffer))
|
||||
{
|
||||
glDeleteBuffers(1, &_indexBuffer);
|
||||
_indexBuffer = 0;
|
||||
}
|
||||
|
||||
_indexCount = 0;
|
||||
}
|
||||
|
||||
void SubMesh::buildBuffer(const std::vector<unsigned short>& indices)
|
||||
{
|
||||
glGenBuffers(1, &_indexBuffer);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
|
||||
|
||||
unsigned int indexSize = 2;
|
||||
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexSize * indices.size(), &indices[0], GL_STATIC_DRAW);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
_indexCount = indices.size();
|
||||
}
|
||||
|
||||
NS_CC_END
|
|
@ -0,0 +1,98 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCSUBMESH_H__
|
||||
#define __CCSUBMESH_H__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "3d/CCBundle3DData.h"
|
||||
|
||||
#include "base/CCRef.h"
|
||||
#include "base/ccTypes.h"
|
||||
#include "math/CCMath.h"
|
||||
#include "renderer/CCGLProgram.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/** Defines supported index formats. */
|
||||
enum class IndexFormat
|
||||
{
|
||||
INDEX8 = GL_UNSIGNED_BYTE,
|
||||
INDEX16 = GL_UNSIGNED_SHORT,
|
||||
};
|
||||
|
||||
/** Defines supported primitive types. */
|
||||
enum class PrimitiveType
|
||||
{
|
||||
TRIANGLES = GL_TRIANGLES,
|
||||
TRIANGLE_STRIP = GL_TRIANGLE_STRIP,
|
||||
LINES = GL_LINES,
|
||||
LINE_STRIP = GL_LINE_STRIP,
|
||||
POINTS = GL_POINTS
|
||||
};
|
||||
|
||||
/**
|
||||
* SubMesh: Defines the way the mesh's vertices how to be connected together.
|
||||
*/
|
||||
class CC_DLL SubMesh : public Ref
|
||||
{
|
||||
friend class Mesh;
|
||||
public:
|
||||
|
||||
/**create submesh from primitivetype indexformat and indices*/
|
||||
static SubMesh* create(PrimitiveType primitivetype, IndexFormat indexformat, const std::vector<unsigned short>& indices);
|
||||
|
||||
/** get primitive type*/
|
||||
PrimitiveType getPrimitiveType() const { return _primitiveType; }
|
||||
/**get index count*/
|
||||
ssize_t getIndexCount() const { return _indexCount; }
|
||||
/**get index format*/
|
||||
IndexFormat getIndexFormat() const { return _indexFormat; }
|
||||
/**get index buffer*/
|
||||
GLuint getIndexBuffer() const {return _indexBuffer; }
|
||||
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
|
||||
SubMesh();
|
||||
virtual ~SubMesh();
|
||||
|
||||
/**build buffer*/
|
||||
void buildBuffer(const std::vector<unsigned short>& indices);
|
||||
/**free buffer*/
|
||||
void cleanAndFreeBuffers();
|
||||
|
||||
protected:
|
||||
PrimitiveType _primitiveType;
|
||||
IndexFormat _indexFormat;
|
||||
|
||||
GLuint _indexBuffer;
|
||||
ssize_t _indexCount;
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __CCMESH_H_
|
|
@ -0,0 +1,89 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include <list>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "3d/CCSubMeshState.h"
|
||||
#include "3d/CCMeshSkin.h"
|
||||
#include "3d/CCSubMesh.h"
|
||||
|
||||
#include "base/ccMacros.h"
|
||||
#include "base/CCEventCustom.h"
|
||||
#include "base/CCEventListenerCustom.h"
|
||||
#include "base/CCEventDispatcher.h"
|
||||
#include "base/CCEventType.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include "renderer/ccGLStateCache.h"
|
||||
#include "renderer/CCTexture2D.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
SubMeshState::SubMeshState()
|
||||
: _visible(true)
|
||||
, _texture(nullptr)
|
||||
, _skin(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
SubMeshState::~SubMeshState()
|
||||
{
|
||||
CC_SAFE_RELEASE(_texture);
|
||||
CC_SAFE_RELEASE(_skin);
|
||||
}
|
||||
|
||||
SubMeshState* SubMeshState::create()
|
||||
{
|
||||
auto state = new SubMeshState();
|
||||
state->autorelease();
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
void SubMeshState::setTexture(Texture2D* tex)
|
||||
{
|
||||
if (tex != _texture)
|
||||
{
|
||||
CC_SAFE_RETAIN(tex);
|
||||
CC_SAFE_RELEASE(_texture);
|
||||
_texture = tex;
|
||||
}
|
||||
}
|
||||
|
||||
void SubMeshState::setSkin(MeshSkin* skin)
|
||||
{
|
||||
if (_skin != skin)
|
||||
{
|
||||
CC_SAFE_RETAIN(skin);
|
||||
CC_SAFE_RELEASE(_skin);
|
||||
_skin = skin;
|
||||
}
|
||||
}
|
||||
|
||||
NS_CC_END
|
|
@ -0,0 +1,77 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCSUBMESHSTATE_H__
|
||||
#define __CCSUBMESHSTATE_H__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "3d/CCBundle3DData.h"
|
||||
|
||||
#include "base/CCRef.h"
|
||||
#include "base/ccTypes.h"
|
||||
#include "math/CCMath.h"
|
||||
#include "renderer/CCGLProgram.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class Texture2D;
|
||||
class MeshSkin;
|
||||
/**
|
||||
* SubMeshState: visibility and apperence of submesh
|
||||
*/
|
||||
class CC_DLL SubMeshState : public Ref
|
||||
{
|
||||
public:
|
||||
|
||||
/**create submesh from primitivetype indexformat and indices*/
|
||||
static SubMeshState* create();
|
||||
|
||||
/**texture getter and setter*/
|
||||
void setTexture(Texture2D* tex);
|
||||
Texture2D* getTexture() const { return _texture; }
|
||||
|
||||
/**visible getter and setter*/
|
||||
void setVisible(bool visible) { _visible = visible; }
|
||||
bool isVisible() const { return _visible; }
|
||||
|
||||
/**skin getter and setter*/
|
||||
void setSkin(MeshSkin* skin);
|
||||
MeshSkin* getSkin() const { return _skin; }
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
|
||||
SubMeshState();
|
||||
virtual ~SubMeshState();
|
||||
|
||||
protected:
|
||||
Texture2D* _texture; //texture that submesh is using
|
||||
MeshSkin* _skin; //skin
|
||||
bool _visible; // is the submesh visible
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __CCSUBMESHSTATE_H__
|
|
@ -1,4 +1,8 @@
|
|||
set(COCOS_3D_SRC
|
||||
3d/CCSkeleton3D.cpp
|
||||
3d/CCAttachNode.cpp
|
||||
3d/CCSubMesh.cpp
|
||||
3d/CCSubMeshState.cpp
|
||||
3d/CCMesh.cpp
|
||||
3d/CCObjLoader.cpp
|
||||
3d/CCSprite3D.cpp
|
||||
|
@ -9,4 +13,3 @@ set(COCOS_3D_SRC
|
|||
3d/CCMeshSkin.cpp
|
||||
3d/CCBundleReader.cpp
|
||||
)
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ cocos2d.cpp \
|
|||
2d/CCParticleSystem.cpp \
|
||||
2d/CCParticleSystemQuad.cpp \
|
||||
2d/CCProgressTimer.cpp \
|
||||
2d/CCProtectedNode.cpp \
|
||||
2d/CCRenderTexture.cpp \
|
||||
2d/CCScene.cpp \
|
||||
2d/CCSprite.cpp \
|
||||
|
@ -75,14 +76,18 @@ cocos2d.cpp \
|
|||
2d/CCTweenFunction.cpp \
|
||||
3d/CCAnimate3D.cpp \
|
||||
3d/CCAnimation3D.cpp \
|
||||
3d/CCAttachNode.cpp \
|
||||
3d/CCBundle3D.cpp \
|
||||
3d/CCBundleReader.cpp \
|
||||
3d/CCMesh.cpp \
|
||||
3d/CCMeshSkin.cpp \
|
||||
3d/CCSprite3DMaterial.cpp \
|
||||
3d/CCObjLoader.cpp \
|
||||
3d/CCSkeleton3D.cpp \
|
||||
3d/CCSprite3D.cpp \
|
||||
platform/CCGLViewProtocol.cpp \
|
||||
3d/CCSubMesh.cpp \
|
||||
3d/CCSubMeshState.cpp \
|
||||
platform/CCGLView.cpp \
|
||||
platform/CCFileUtils.cpp \
|
||||
platform/CCSAXParser.cpp \
|
||||
platform/CCThread.cpp \
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
if(WIN32)
|
||||
ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
|
||||
if(WINDOWS)
|
||||
ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
|
||||
endif()
|
||||
|
||||
|
||||
set(COCOS_SRC
|
||||
cocos2d.cpp
|
||||
)
|
||||
set(COCOS_SRC cocos2d.cpp)
|
||||
|
||||
include(2d/CMakeLists.txt)
|
||||
include(3d/CMakeLists.txt)
|
||||
|
@ -34,60 +31,12 @@ add_library(cocos2d STATIC
|
|||
${COCOS_DEPRECATED_SRC}
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
|
||||
if(MINGW)
|
||||
|
||||
set(COCOS_LINK
|
||||
z
|
||||
jpeg
|
||||
png
|
||||
webp
|
||||
tiff
|
||||
glfw3
|
||||
glew32
|
||||
opengl32
|
||||
iconv
|
||||
freetype
|
||||
bz2
|
||||
)
|
||||
|
||||
else()
|
||||
|
||||
|
||||
set(COCOS_LINK
|
||||
libjpeg
|
||||
libpng
|
||||
libwebp
|
||||
libtiff
|
||||
freetype250
|
||||
glfw3
|
||||
glew32
|
||||
opengl32
|
||||
libiconv
|
||||
libzlib
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
elseif(APPLE)
|
||||
|
||||
else()
|
||||
set(COCOS_LINK
|
||||
jpeg
|
||||
webp
|
||||
tiff
|
||||
freetype
|
||||
fontconfig
|
||||
png
|
||||
pthread
|
||||
glfw
|
||||
GLEW
|
||||
GL
|
||||
X11
|
||||
rt
|
||||
z
|
||||
)
|
||||
set(COCOS_LINK z jpeg png webp tiff glfw3 glew32 opengl32 iconv freetype bz2)
|
||||
elseif(WINDOWS)
|
||||
set(COCOS_LINK libjpeg libpng libwebp libtiff freetype250 glfw3 glew32 opengl32 libiconv libzlib)
|
||||
elseif(LINUX)
|
||||
set(COCOS_LINK jpeg webp tiff freetype fontconfig png pthread glfw GLEW GL X11 rt z)
|
||||
endif()
|
||||
|
||||
target_link_libraries(cocos2d
|
||||
|
@ -105,4 +54,3 @@ set_target_properties(cocos2d
|
|||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,29 +1,26 @@
|
|||
# architecture
|
||||
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||
set(ARCH_DIR "64-bit")
|
||||
else()
|
||||
set(ARCH_DIR "32-bit")
|
||||
endif()
|
||||
#if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||
#set(ARCH_DIR "64-bit")
|
||||
#else()
|
||||
#set(ARCH_DIR "32-bit")
|
||||
#endif()
|
||||
|
||||
if(WIN32)
|
||||
if(WINDOWS)
|
||||
set(AUDIO_SRC
|
||||
win32/SimpleAudioEngine.cpp
|
||||
win32/MciPlayer.cpp
|
||||
win32/MciPlayer.h
|
||||
win32/MciPlayer.h
|
||||
)
|
||||
elseif(APPLE)
|
||||
|
||||
else()
|
||||
elseif(LINUX)
|
||||
set(AUDIO_SRC
|
||||
linux/SimpleAudioEngineFMOD.cpp
|
||||
linux/FmodAudioPlayer.cpp
|
||||
linux/FmodAudioPlayer.h
|
||||
linux/AudioPlayer.h
|
||||
linux/FmodAudioPlayer.h
|
||||
linux/AudioPlayer.h
|
||||
)
|
||||
|
||||
include_directories(
|
||||
../../external/linux-specific/fmod/include/${ARCH_DIR}
|
||||
)
|
||||
include_directories( ../../external/linux-specific/fmod/include/${ARCH_DIR} )
|
||||
|
||||
endif()
|
||||
|
||||
|
@ -33,28 +30,23 @@ add_library(audio STATIC
|
|||
include/SimpleAudioEngine.h
|
||||
)
|
||||
|
||||
if((NOT APPLE) AND (NOT WIN32))
|
||||
if(LINUX)
|
||||
|
||||
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||
set(FMOD_LIB "fmodex64")
|
||||
else()
|
||||
set(FMOD_LIB "fmodex")
|
||||
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||
set(FMOD_LIB "fmodex64")
|
||||
else()
|
||||
set(FMOD_LIB "fmodex")
|
||||
endif()
|
||||
|
||||
target_link_libraries(audio ${FMOD_LIB})
|
||||
elseif(WINDOWS)
|
||||
target_link_libraries(audio Winmm)
|
||||
endif()
|
||||
|
||||
target_link_libraries(audio
|
||||
${FMOD_LIB}
|
||||
)
|
||||
|
||||
set_target_properties(audio
|
||||
PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
)
|
||||
|
||||
elseif(WIN32)
|
||||
|
||||
target_link_libraries(audio
|
||||
Winmm
|
||||
)
|
||||
|
||||
endif()
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
#include "2d/CCScene.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "renderer/CCTextureCache.h"
|
||||
#include "CCGLView.h"
|
||||
#include "base/base64.h"
|
||||
#include "base/ccUtils.h"
|
||||
NS_CC_BEGIN
|
||||
|
|
|
@ -61,7 +61,7 @@ THE SOFTWARE.
|
|||
#include "base/CCNS.h"
|
||||
#include "math/CCMath.h"
|
||||
#include "CCApplication.h"
|
||||
#include "CCGLView.h"
|
||||
#include "CCGLViewImpl.h"
|
||||
|
||||
/**
|
||||
Position of the FPS
|
||||
|
@ -263,7 +263,7 @@ void Director::drawScene()
|
|||
|
||||
if (_openGLView)
|
||||
{
|
||||
_openGLView->pollInputEvents();
|
||||
_openGLView->pollEvents();
|
||||
}
|
||||
|
||||
//tick before glClear: issue #533
|
||||
|
|
|
@ -39,6 +39,7 @@ THE SOFTWARE.
|
|||
#include "2d/CCScene.h"
|
||||
#include <stack>
|
||||
#include "math/CCMath.h"
|
||||
#include "platform/CCGLView.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -50,7 +51,7 @@ NS_CC_BEGIN
|
|||
/* Forward declarations. */
|
||||
class LabelAtlas;
|
||||
class Scene;
|
||||
class GLView;
|
||||
//class GLView;
|
||||
class DirectorDelegate;
|
||||
class Node;
|
||||
class Scheduler;
|
||||
|
@ -442,7 +443,8 @@ protected:
|
|||
/* delta time since last tick to main loop */
|
||||
float _deltaTime;
|
||||
|
||||
/* The GLView, where everything is rendered */
|
||||
/* The _openGLView, where everything is rendered, GLView is a abstract class,cocos2d-x provide GLViewImpl
|
||||
which inherit from it as default renderer context,you can have your own by inherit from it*/
|
||||
GLView *_openGLView;
|
||||
|
||||
//texture cache belongs to this director
|
||||
|
@ -509,8 +511,8 @@ protected:
|
|||
Console *_console;
|
||||
#endif
|
||||
|
||||
// GLViewProtocol will recreate stats labels to fit visible rect
|
||||
friend class GLViewProtocol;
|
||||
// GLView will recreate stats labels to fit visible rect
|
||||
friend class GLView;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -60,7 +60,7 @@ private:
|
|||
EventCode _eventCode;
|
||||
std::vector<Touch*> _touches;
|
||||
|
||||
friend class GLViewProtocol;
|
||||
friend class GLView;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ THE SOFTWARE.
|
|||
#include "renderer/CCRenderer.h"
|
||||
#include "platform/CCImage.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "CCGLView.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -184,7 +183,15 @@ double atof(const char* str)
|
|||
|
||||
return ::atof(buf);
|
||||
}
|
||||
|
||||
|
||||
double gettime()
|
||||
{
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, nullptr);
|
||||
|
||||
return (double)tv.tv_sec + (double)tv.tv_usec/1000000;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -78,6 +78,10 @@ namespace utils
|
|||
* Why we need this? Because in android c++_static, atof ( and std::atof ) is unsupported for numbers have long decimal part and contain several numbers can approximate to 1 ( like 90.099998474121094 ), it will return inf. this function is used to fix this bug.
|
||||
*/
|
||||
double CC_DLL atof(const char* str);
|
||||
|
||||
/** Get current exact time, accurate to nanoseconds.
|
||||
*/
|
||||
double CC_DLL gettime();
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -173,49 +173,49 @@ THE SOFTWARE.
|
|||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
#include "platform/ios/CCApplication.h"
|
||||
#include "platform/ios/CCGLView.h"
|
||||
#include "platform/ios/CCGLViewImpl.h"
|
||||
#include "platform/ios/CCGL.h"
|
||||
#include "platform/ios/CCStdC.h"
|
||||
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_IOS
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
#include "platform/android/CCApplication.h"
|
||||
#include "platform/android/CCGLView.h"
|
||||
#include "platform/android/CCGLViewImpl.h"
|
||||
#include "platform/android/CCGL.h"
|
||||
#include "platform/android/CCStdC.h"
|
||||
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_BLACKBERRY)
|
||||
#include "platform/blackberry/CCApplication.h"
|
||||
#include "platform/blackberry/CCGLView.h"
|
||||
#include "platform/blackberry/CCGLViewImpl.h"
|
||||
#include "platform/blackberry/CCGL.h"
|
||||
#include "platform/blackberry/CCStdC.h"
|
||||
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_BLACKBERRY
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
#include "platform/win32/CCApplication.h"
|
||||
#include "platform/desktop/CCGLView.h"
|
||||
#include "platform/desktop/CCGLViewImpl.h"
|
||||
#include "platform/win32/CCGL.h"
|
||||
#include "platform/win32/CCStdC.h"
|
||||
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
#include "platform/mac/CCApplication.h"
|
||||
#include "platform/desktop/CCGLView.h"
|
||||
#include "platform/desktop/CCGLViewImpl.h"
|
||||
#include "platform/mac/CCGL.h"
|
||||
#include "platform/mac/CCStdC.h"
|
||||
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_MAC
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
|
||||
#include "platform/linux/CCApplication.h"
|
||||
#include "platform/desktop/CCGLView.h"
|
||||
#include "platform/desktop/CCGLViewImpl.h"
|
||||
#include "platform/linux/CCGL.h"
|
||||
#include "platform/linux/CCStdC.h"
|
||||
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
||||
#include "platform/winrt/CCApplication.h"
|
||||
#include "platform/winrt/CCGLView.h"
|
||||
#include "platform/winrt/CCGLViewImpl.h"
|
||||
#include "platform/winrt/CCGL.h"
|
||||
#include "platform/winrt/CCStdC.h"
|
||||
#include "platform/winrt/CCPrecompiledShaders.h"
|
||||
|
@ -223,7 +223,7 @@ THE SOFTWARE.
|
|||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
||||
#include "platform/winrt/CCApplication.h"
|
||||
#include "platform/wp8/CCGLView.h"
|
||||
#include "platform/wp8/CCGLViewImpl.h"
|
||||
#include "platform/winrt/CCGL.h"
|
||||
#include "platform/winrt/CCStdC.h"
|
||||
#include "platform/winrt/CCPrecompiledShaders.h"
|
||||
|
@ -267,6 +267,8 @@ THE SOFTWARE.
|
|||
#include "3d/CCAnimate3D.h"
|
||||
#include "3d/CCAnimation3D.h"
|
||||
#include "3d/CCSprite3DMaterial.h"
|
||||
#include "3d/CCSubMeshState.h"
|
||||
#include "3d/CCAttachNode.h"
|
||||
|
||||
// Deprecated include
|
||||
#include "deprecated/CCDictionary.h"
|
||||
|
|
|
@ -23,17 +23,12 @@ set(CCB_SRC
|
|||
CCNode+CCBRelativePositioning.cpp
|
||||
)
|
||||
|
||||
include_directories(
|
||||
..
|
||||
)
|
||||
include_directories( .. )
|
||||
|
||||
add_library(cocosbuilder STATIC
|
||||
${CCB_SRC}
|
||||
)
|
||||
add_library(cocosbuilder STATIC ${CCB_SRC})
|
||||
|
||||
set_target_properties(cocosbuilder
|
||||
PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
)
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ void RotationFrame::onEnter(Frame *nextFrame)
|
|||
|
||||
void RotationFrame::apply(float percent)
|
||||
{
|
||||
if (_tween && percent != 0 && _betwennRotation != 0)
|
||||
if (_tween && _betwennRotation != 0)
|
||||
{
|
||||
float rotation = _rotation + percent * _betwennRotation;
|
||||
_node->setRotation(rotation);
|
||||
|
@ -227,7 +227,7 @@ void SkewFrame::onEnter(Frame *nextFrame)
|
|||
|
||||
void SkewFrame::apply(float percent)
|
||||
{
|
||||
if (_tween && percent != 0 && (_betweenSkewX != 0 || _betweenSkewY != 0))
|
||||
if (_tween && (_betweenSkewX != 0 || _betweenSkewY != 0))
|
||||
{
|
||||
float skewx = _skewX + percent * _betweenSkewX;
|
||||
float skewy = _skewY + percent * _betweenSkewY;
|
||||
|
@ -282,7 +282,7 @@ void RotationSkewFrame::onEnter(Frame *nextFrame)
|
|||
|
||||
void RotationSkewFrame::apply(float percent)
|
||||
{
|
||||
if (_tween && percent != 0 && (_betweenSkewX != 0 || _betweenSkewY != 0))
|
||||
if (_tween && (_betweenSkewX != 0 || _betweenSkewY != 0))
|
||||
{
|
||||
float skewx = _skewX + percent * _betweenSkewX;
|
||||
float skewy = _skewY + percent * _betweenSkewY;
|
||||
|
@ -335,7 +335,7 @@ void PositionFrame::onEnter(Frame *nextFrame)
|
|||
|
||||
void PositionFrame::apply(float percent)
|
||||
{
|
||||
if (_tween && percent != 0 && (_betweenX != 0 || _betweenY != 0))
|
||||
if (_tween && (_betweenX != 0 || _betweenY != 0))
|
||||
{
|
||||
Point p;
|
||||
p.x = _position.x + _betweenX * percent;
|
||||
|
@ -389,7 +389,7 @@ void ScaleFrame::onEnter(Frame *nextFrame)
|
|||
|
||||
void ScaleFrame::apply(float percent)
|
||||
{
|
||||
if (_tween && percent != 0 && (_betweenScaleX != 0 || _betweenScaleY != 0))
|
||||
if (_tween && (_betweenScaleX != 0 || _betweenScaleY != 0))
|
||||
{
|
||||
float scaleX = _scaleX + _betweenScaleX * percent;
|
||||
float scaleY = _scaleY + _betweenScaleY * percent;
|
||||
|
@ -523,7 +523,7 @@ void ColorFrame::onEnter(Frame *nextFrame)
|
|||
|
||||
void ColorFrame::apply(float percent)
|
||||
{
|
||||
if (_tween && percent != 0 && (_betweenAlpha !=0 || _betweenRed != 0 || _betweenGreen != 0 || _betweenBlue != 0))
|
||||
if (_tween && (_betweenAlpha !=0 || _betweenRed != 0 || _betweenGreen != 0 || _betweenBlue != 0))
|
||||
{
|
||||
GLubyte alpha = _alpha + _betweenAlpha * percent;
|
||||
|
||||
|
|
|
@ -462,8 +462,10 @@ Node* NodeReader::loadWidget(const rapidjson::Value& json)
|
|||
CC_SAFE_DELETE(guiReader);
|
||||
|
||||
int actionTag = DICTOOL->getIntValue_json(json, ACTION_TAG);
|
||||
widget->setUserObject(ActionTimelineData::create(actionTag));
|
||||
|
||||
widget->setUserObject(ActionTimelineData::create(actionTag));
|
||||
|
||||
initNode(widget, json);
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,16 +55,11 @@ set(CS_SRC
|
|||
ActionTimeline/CCTimeLine.cpp
|
||||
)
|
||||
|
||||
include_directories(
|
||||
..
|
||||
)
|
||||
include_directories( .. )
|
||||
|
||||
add_library(cocostudio STATIC
|
||||
${CS_SRC}
|
||||
)
|
||||
add_library(cocostudio STATIC ${CS_SRC} )
|
||||
|
||||
target_link_libraries(cocostudio
|
||||
)
|
||||
target_link_libraries(cocostudio)
|
||||
|
||||
set_target_properties(cocostudio
|
||||
PROPERTIES
|
||||
|
|
|
@ -32,13 +32,9 @@ set(SPINE_SRC
|
|||
SkeletonBounds.cpp
|
||||
)
|
||||
|
||||
include_directories(
|
||||
..
|
||||
)
|
||||
include_directories( .. )
|
||||
|
||||
add_library(spine STATIC
|
||||
${SPINE_SRC}
|
||||
)
|
||||
add_library(spine STATIC ${SPINE_SRC})
|
||||
|
||||
set_target_properties(spine
|
||||
PROPERTIES
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
NS_CC_MATH_BEGIN
|
||||
|
||||
const Quaternion Quaternion::ZERO(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
Quaternion::Quaternion()
|
||||
: x(0.0f), y(0.0f), z(0.0f), w(1.0f)
|
||||
{
|
||||
|
|
|
@ -369,6 +369,9 @@ public:
|
|||
* @return This quaternion, after the multiplication occurs.
|
||||
*/
|
||||
inline Quaternion& operator*=(const Quaternion& q);
|
||||
|
||||
/** equals to Quaternion(0,0,0, 0) */
|
||||
static const Quaternion ZERO;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -1,37 +1,13 @@
|
|||
if(WIN32)
|
||||
set(PLATFORM_SRC
|
||||
network/WebSocket.cpp
|
||||
)
|
||||
|
||||
set(PLATFORM_LINK
|
||||
websockets
|
||||
)
|
||||
elseif(NOT APPLE)
|
||||
set(PLATFORM_SRC
|
||||
network/WebSocket.cpp
|
||||
)
|
||||
|
||||
set(PLATFORM_LINK
|
||||
websockets
|
||||
ssl
|
||||
crypto
|
||||
)
|
||||
if(WINDOWS)
|
||||
set(PLATFORM_LINK websockets)
|
||||
elseif(LINUX)
|
||||
set(PLATFORM_LINK websockets ssl crypto)
|
||||
endif()
|
||||
|
||||
set(COCOS_NETWORK_SRC
|
||||
network/HttpClient.cpp
|
||||
network/SocketIO.cpp
|
||||
${PLATFORM_SRC}
|
||||
)
|
||||
set(COCOS_NETWORK_SRC network/HttpClient.cpp network/SocketIO.cpp network/WebSocket.cpp)
|
||||
|
||||
IF (WIN32 AND NOT MINGW)
|
||||
set(COCOS_NETWORK_LINK
|
||||
libcurl_imp
|
||||
${PLATFORM_LINK}
|
||||
)
|
||||
ELSE()
|
||||
set(COCOS_NETWORK_LINK
|
||||
curl
|
||||
${PLATFORM_LINK}
|
||||
)
|
||||
ENDIF()
|
||||
if(MSVC)
|
||||
set(COCOS_NETWORK_LINK libcurl_imp ${PLATFORM_LINK})
|
||||
else()
|
||||
set(COCOS_NETWORK_LINK curl ${PLATFORM_LINK} )
|
||||
endif()
|
||||
|
|
|
@ -105,6 +105,18 @@ public:
|
|||
return _rootDict;
|
||||
}
|
||||
|
||||
ValueMap dictionaryWithDataOfFile(const char* filedata, int filesize)
|
||||
{
|
||||
_resultType = SAX_RESULT_DICT;
|
||||
SAXParser parser;
|
||||
|
||||
CCASSERT(parser.init("UTF-8"), "The file format isn't UTF-8");
|
||||
parser.setDelegator(this);
|
||||
|
||||
parser.parse(filedata, filesize);
|
||||
return _rootDict;
|
||||
}
|
||||
|
||||
ValueVector arrayWithContentsOfFile(const std::string& fileName)
|
||||
{
|
||||
_resultType = SAX_RESULT_ARRAY;
|
||||
|
@ -321,6 +333,12 @@ ValueMap FileUtils::getValueMapFromFile(const std::string& filename)
|
|||
return tMaker.dictionaryWithContentsOfFile(fullPath.c_str());
|
||||
}
|
||||
|
||||
ValueMap FileUtils::getValueMapFromData(const char* filedata, int filesize)
|
||||
{
|
||||
DictMaker tMaker;
|
||||
return tMaker.dictionaryWithDataOfFile(filedata, filesize);
|
||||
}
|
||||
|
||||
ValueVector FileUtils::getValueVectorFromFile(const std::string& filename)
|
||||
{
|
||||
const std::string fullPath = fullPathForFilename(filename.c_str());
|
||||
|
@ -472,6 +490,7 @@ NS_CC_BEGIN
|
|||
|
||||
/* The subclass FileUtilsApple should override these two method. */
|
||||
ValueMap FileUtils::getValueMapFromFile(const std::string& filename) {return ValueMap();}
|
||||
ValueMap FileUtils::getValueMapFromData(const char* filedata, int filesize) {return ValueMap();}
|
||||
ValueVector FileUtils::getValueVectorFromFile(const std::string& filename) {return ValueVector();}
|
||||
bool FileUtils::writeToFile(ValueMap& dict, const std::string &fullPath) {return false;}
|
||||
|
||||
|
|
|
@ -294,6 +294,12 @@ public:
|
|||
* @note This method is used internally.
|
||||
*/
|
||||
virtual ValueMap getValueMapFromFile(const std::string& filename);
|
||||
|
||||
/**
|
||||
* Converts the contents of a file to a ValueMap.
|
||||
* @note This method is used internally.
|
||||
*/
|
||||
virtual ValueMap getValueMapFromData(const char* filedata, int filesize);
|
||||
|
||||
/**
|
||||
* Write a ValueMap to a plist file.
|
||||
|
|
|
@ -23,7 +23,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "platform/CCGLViewProtocol.h"
|
||||
#include "platform/CCGLView.h"
|
||||
|
||||
#include "base/CCTouch.h"
|
||||
#include "base/CCDirector.h"
|
||||
|
@ -70,24 +70,28 @@ namespace {
|
|||
|
||||
}
|
||||
|
||||
GLViewProtocol::GLViewProtocol()
|
||||
GLView::GLView()
|
||||
: _scaleX(1.0f)
|
||||
, _scaleY(1.0f)
|
||||
, _resolutionPolicy(ResolutionPolicy::UNKNOWN)
|
||||
{
|
||||
}
|
||||
|
||||
GLViewProtocol::~GLViewProtocol()
|
||||
GLView::~GLView()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void GLViewProtocol::pollInputEvents()
|
||||
void GLView::pollInputEvents()
|
||||
{
|
||||
pollEvents();
|
||||
}
|
||||
|
||||
void GLView::pollEvents()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GLViewProtocol::updateDesignResolutionSize()
|
||||
void GLView::updateDesignResolutionSize()
|
||||
{
|
||||
if (_screenSize.width > 0 && _screenSize.height > 0
|
||||
&& _designResolutionSize.width > 0 && _designResolutionSize.height > 0)
|
||||
|
@ -129,7 +133,7 @@ void GLViewProtocol::updateDesignResolutionSize()
|
|||
}
|
||||
}
|
||||
|
||||
void GLViewProtocol::setDesignResolutionSize(float width, float height, ResolutionPolicy resolutionPolicy)
|
||||
void GLView::setDesignResolutionSize(float width, float height, ResolutionPolicy resolutionPolicy)
|
||||
{
|
||||
CCASSERT(resolutionPolicy != ResolutionPolicy::UNKNOWN, "should set resolutionPolicy");
|
||||
|
||||
|
@ -144,22 +148,22 @@ void GLViewProtocol::setDesignResolutionSize(float width, float height, Resoluti
|
|||
updateDesignResolutionSize();
|
||||
}
|
||||
|
||||
const Size& GLViewProtocol::getDesignResolutionSize() const
|
||||
const Size& GLView::getDesignResolutionSize() const
|
||||
{
|
||||
return _designResolutionSize;
|
||||
}
|
||||
|
||||
const Size& GLViewProtocol::getFrameSize() const
|
||||
const Size& GLView::getFrameSize() const
|
||||
{
|
||||
return _screenSize;
|
||||
}
|
||||
|
||||
void GLViewProtocol::setFrameSize(float width, float height)
|
||||
void GLView::setFrameSize(float width, float height)
|
||||
{
|
||||
_designResolutionSize = _screenSize = Size(width, height);
|
||||
}
|
||||
|
||||
Rect GLViewProtocol::getVisibleRect() const
|
||||
Rect GLView::getVisibleRect() const
|
||||
{
|
||||
Rect ret;
|
||||
ret.size = getVisibleSize();
|
||||
|
@ -167,7 +171,7 @@ Rect GLViewProtocol::getVisibleRect() const
|
|||
return ret;
|
||||
}
|
||||
|
||||
Size GLViewProtocol::getVisibleSize() const
|
||||
Size GLView::getVisibleSize() const
|
||||
{
|
||||
if (_resolutionPolicy == ResolutionPolicy::NO_BORDER)
|
||||
{
|
||||
|
@ -179,7 +183,7 @@ Size GLViewProtocol::getVisibleSize() const
|
|||
}
|
||||
}
|
||||
|
||||
Vec2 GLViewProtocol::getVisibleOrigin() const
|
||||
Vec2 GLView::getVisibleOrigin() const
|
||||
{
|
||||
if (_resolutionPolicy == ResolutionPolicy::NO_BORDER)
|
||||
{
|
||||
|
@ -192,7 +196,7 @@ Vec2 GLViewProtocol::getVisibleOrigin() const
|
|||
}
|
||||
}
|
||||
|
||||
void GLViewProtocol::setViewPortInPoints(float x , float y , float w , float h)
|
||||
void GLView::setViewPortInPoints(float x , float y , float w , float h)
|
||||
{
|
||||
glViewport((GLint)(x * _scaleX + _viewPortRect.origin.x),
|
||||
(GLint)(y * _scaleY + _viewPortRect.origin.y),
|
||||
|
@ -200,7 +204,7 @@ void GLViewProtocol::setViewPortInPoints(float x , float y , float w , float h)
|
|||
(GLsizei)(h * _scaleY));
|
||||
}
|
||||
|
||||
void GLViewProtocol::setScissorInPoints(float x , float y , float w , float h)
|
||||
void GLView::setScissorInPoints(float x , float y , float w , float h)
|
||||
{
|
||||
glScissor((GLint)(x * _scaleX + _viewPortRect.origin.x),
|
||||
(GLint)(y * _scaleY + _viewPortRect.origin.y),
|
||||
|
@ -208,12 +212,12 @@ void GLViewProtocol::setScissorInPoints(float x , float y , float w , float h)
|
|||
(GLsizei)(h * _scaleY));
|
||||
}
|
||||
|
||||
bool GLViewProtocol::isScissorEnabled()
|
||||
bool GLView::isScissorEnabled()
|
||||
{
|
||||
return (GL_FALSE == glIsEnabled(GL_SCISSOR_TEST)) ? false : true;
|
||||
}
|
||||
|
||||
Rect GLViewProtocol::getScissorRect() const
|
||||
Rect GLView::getScissorRect() const
|
||||
{
|
||||
GLfloat params[4];
|
||||
glGetFloatv(GL_SCISSOR_BOX, params);
|
||||
|
@ -224,17 +228,17 @@ Rect GLViewProtocol::getScissorRect() const
|
|||
return Rect(x, y, w, h);
|
||||
}
|
||||
|
||||
void GLViewProtocol::setViewName(const std::string& viewname )
|
||||
void GLView::setViewName(const std::string& viewname )
|
||||
{
|
||||
_viewName = viewname;
|
||||
}
|
||||
|
||||
const std::string& GLViewProtocol::getViewName() const
|
||||
const std::string& GLView::getViewName() const
|
||||
{
|
||||
return _viewName;
|
||||
}
|
||||
|
||||
void GLViewProtocol::handleTouchesBegin(int num, intptr_t ids[], float xs[], float ys[])
|
||||
void GLView::handleTouchesBegin(int num, intptr_t ids[], float xs[], float ys[])
|
||||
{
|
||||
intptr_t id = 0;
|
||||
float x = 0.0f;
|
||||
|
@ -283,7 +287,7 @@ void GLViewProtocol::handleTouchesBegin(int num, intptr_t ids[], float xs[], flo
|
|||
dispatcher->dispatchEvent(&touchEvent);
|
||||
}
|
||||
|
||||
void GLViewProtocol::handleTouchesMove(int num, intptr_t ids[], float xs[], float ys[])
|
||||
void GLView::handleTouchesMove(int num, intptr_t ids[], float xs[], float ys[])
|
||||
{
|
||||
intptr_t id = 0;
|
||||
float x = 0.0f;
|
||||
|
@ -331,7 +335,7 @@ void GLViewProtocol::handleTouchesMove(int num, intptr_t ids[], float xs[], floa
|
|||
dispatcher->dispatchEvent(&touchEvent);
|
||||
}
|
||||
|
||||
void GLViewProtocol::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num, intptr_t ids[], float xs[], float ys[])
|
||||
void GLView::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num, intptr_t ids[], float xs[], float ys[])
|
||||
{
|
||||
intptr_t id = 0;
|
||||
float x = 0.0f;
|
||||
|
@ -391,27 +395,27 @@ void GLViewProtocol::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode,
|
|||
}
|
||||
}
|
||||
|
||||
void GLViewProtocol::handleTouchesEnd(int num, intptr_t ids[], float xs[], float ys[])
|
||||
void GLView::handleTouchesEnd(int num, intptr_t ids[], float xs[], float ys[])
|
||||
{
|
||||
handleTouchesOfEndOrCancel(EventTouch::EventCode::ENDED, num, ids, xs, ys);
|
||||
}
|
||||
|
||||
void GLViewProtocol::handleTouchesCancel(int num, intptr_t ids[], float xs[], float ys[])
|
||||
void GLView::handleTouchesCancel(int num, intptr_t ids[], float xs[], float ys[])
|
||||
{
|
||||
handleTouchesOfEndOrCancel(EventTouch::EventCode::CANCELLED, num, ids, xs, ys);
|
||||
}
|
||||
|
||||
const Rect& GLViewProtocol::getViewPortRect() const
|
||||
const Rect& GLView::getViewPortRect() const
|
||||
{
|
||||
return _viewPortRect;
|
||||
}
|
||||
|
||||
float GLViewProtocol::getScaleX() const
|
||||
float GLView::getScaleX() const
|
||||
{
|
||||
return _scaleX;
|
||||
}
|
||||
|
||||
float GLViewProtocol::getScaleY() const
|
||||
float GLView::getScaleY() const
|
||||
{
|
||||
return _scaleY;
|
||||
}
|
|
@ -23,14 +23,22 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCGLVIEWPROTOCOL_H__
|
||||
#define __CCGLVIEWPROTOCOL_H__
|
||||
#ifndef __CCGLVIEW_H__
|
||||
#define __CCGLVIEW_H__
|
||||
|
||||
#include "base/ccTypes.h"
|
||||
#include "base/CCEventTouch.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
#include <windows.h>
|
||||
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) */
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
typedef void* id;
|
||||
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) */
|
||||
|
||||
enum class ResolutionPolicy
|
||||
{
|
||||
// The entire application is visible in the specified area without trying to preserve the original aspect ratio.
|
||||
|
@ -63,18 +71,18 @@ NS_CC_BEGIN
|
|||
* @{
|
||||
*/
|
||||
|
||||
class CC_DLL GLViewProtocol
|
||||
class CC_DLL GLView : public Ref
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
GLViewProtocol();
|
||||
GLView();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~GLViewProtocol();
|
||||
virtual ~GLView();
|
||||
|
||||
/** Force destroying EGL view, subclass must implement this method. */
|
||||
virtual void end() = 0;
|
||||
|
@ -87,12 +95,16 @@ public:
|
|||
|
||||
/** Open or close IME keyboard , subclass must implement this method. */
|
||||
virtual void setIMEKeyboardState(bool open) = 0;
|
||||
|
||||
virtual bool windowShouldClose() { return false; };
|
||||
|
||||
/**
|
||||
* Polls input events. Subclass must implement methods if platform
|
||||
* does not provide event callbacks.
|
||||
*/
|
||||
virtual void pollInputEvents();
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void pollInputEvents();
|
||||
|
||||
virtual void pollEvents();
|
||||
|
||||
/**
|
||||
* Get the frame size of EGL view.
|
||||
|
@ -105,6 +117,25 @@ public:
|
|||
*/
|
||||
virtual void setFrameSize(float width, float height);
|
||||
|
||||
virtual float getFrameZoomFactor() const { return 1.0; }
|
||||
|
||||
/** Get retina factor */
|
||||
virtual int getRetinaFactor() const { return 1; }
|
||||
|
||||
virtual float getContentScaleFactor() const { return 1.0; }
|
||||
|
||||
/** returns whether or not the view is in Retina Display mode */
|
||||
virtual bool isRetinaDisplay() const { return false; }
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
virtual void* getEAGLView() const { return nullptr; }
|
||||
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) */
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
||||
virtual Size getRenerTargetSize() const = 0;
|
||||
virtual const Mat4& getOrientationMatrix() const = 0;
|
||||
virtual const Mat4& getReverseOrientationMatrix() const = 0;
|
||||
#endif
|
||||
/**
|
||||
* Get the visible area size of opengl viewport.
|
||||
*/
|
||||
|
@ -183,6 +214,14 @@ public:
|
|||
/** returns the current Resolution policy */
|
||||
ResolutionPolicy getResolutionPolicy() const { return _resolutionPolicy; }
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
virtual HWND getWin32Window() = 0;
|
||||
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) */
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
virtual id getCocoaWindow() = 0;
|
||||
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) */
|
||||
|
||||
protected:
|
||||
void updateDesignResolutionSize();
|
||||
|
||||
|
@ -207,4 +246,4 @@ protected:
|
|||
|
||||
NS_CC_END
|
||||
|
||||
#endif /* __CCGLVIEWPROTOCOL_H__ */
|
||||
#endif /* __CCGLVIEW_H__ */
|
|
@ -31,10 +31,10 @@ include_directories(
|
|||
set(COCOS_PLATFORM_SRC
|
||||
platform/CCSAXParser.cpp
|
||||
platform/CCThread.cpp
|
||||
platform/CCGLViewProtocol.cpp
|
||||
platform/CCGLView.cpp
|
||||
platform/CCFileUtils.cpp
|
||||
platform/CCImage.cpp
|
||||
platform/desktop/CCGLView.cpp
|
||||
platform/desktop/CCGLViewImpl.cpp
|
||||
../external/edtaa3func/edtaa3func.cpp
|
||||
../external/ConvertUTF/ConvertUTFWrapper.cpp
|
||||
../external/ConvertUTF/ConvertUTF.c
|
||||
|
|
|
@ -10,7 +10,7 @@ LOCAL_SRC_FILES := \
|
|||
CCApplication.cpp \
|
||||
CCCommon.cpp \
|
||||
CCDevice.cpp \
|
||||
CCGLView.cpp \
|
||||
CCGLViewImpl.cpp \
|
||||
CCFileUtilsAndroid.cpp \
|
||||
javaactivity.cpp \
|
||||
jni/DPIJni.cpp \
|
||||
|
|
|
@ -30,7 +30,6 @@ THE SOFTWARE.
|
|||
#include "jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h"
|
||||
#include "CCApplication.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include "CCGLView.h"
|
||||
#include <android/log.h>
|
||||
#include <jni.h>
|
||||
#include <cstring>
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
virtual ~FileUtilsAndroid();
|
||||
|
||||
static void setassetmanager(AAssetManager* a);
|
||||
static AAssetManager* getAssetManager() { return assetmanager; }
|
||||
|
||||
/* override funtions */
|
||||
bool init();
|
||||
|
|
|
@ -26,7 +26,7 @@ THE SOFTWARE.
|
|||
#include "base/CCPlatformConfig.h"
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
|
||||
|
||||
#include "CCGLView.h"
|
||||
#include "CCGLViewImpl.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include "base/ccMacros.h"
|
||||
#include "jni/IMEJni.h"
|
||||
|
@ -51,9 +51,9 @@ void initExtensions() {
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
GLView* GLView::createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||
GLViewImpl* GLViewImpl::createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||
{
|
||||
auto ret = new GLView;
|
||||
auto ret = new GLViewImpl;
|
||||
if(ret && ret->initWithRect(viewName, rect, frameZoomFactor)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
|
@ -62,9 +62,9 @@ GLView* GLView::createWithRect(const std::string& viewName, Rect rect, float fra
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GLView* GLView::create(const std::string& viewName)
|
||||
GLViewImpl* GLViewImpl::create(const std::string& viewName)
|
||||
{
|
||||
auto ret = new GLView;
|
||||
auto ret = new GLViewImpl;
|
||||
if(ret && ret->initWithFullScreen(viewName)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
|
@ -73,9 +73,9 @@ GLView* GLView::create(const std::string& viewName)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GLView* GLView::createWithFullScreen(const std::string& viewName)
|
||||
GLViewImpl* GLViewImpl::createWithFullScreen(const std::string& viewName)
|
||||
{
|
||||
auto ret = new GLView();
|
||||
auto ret = new GLViewImpl();
|
||||
if(ret && ret->initWithFullScreen(viewName)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
|
@ -84,42 +84,42 @@ GLView* GLView::createWithFullScreen(const std::string& viewName)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GLView::GLView()
|
||||
GLViewImpl::GLViewImpl()
|
||||
{
|
||||
initExtensions();
|
||||
}
|
||||
|
||||
GLView::~GLView()
|
||||
GLViewImpl::~GLViewImpl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||
bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GLView::initWithFullScreen(const std::string& viewName)
|
||||
bool GLViewImpl::initWithFullScreen(const std::string& viewName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool GLView::isOpenGLReady()
|
||||
bool GLViewImpl::isOpenGLReady()
|
||||
{
|
||||
return (_screenSize.width != 0 && _screenSize.height != 0);
|
||||
}
|
||||
|
||||
void GLView::end()
|
||||
void GLViewImpl::end()
|
||||
{
|
||||
terminateProcessJNI();
|
||||
}
|
||||
|
||||
void GLView::swapBuffers()
|
||||
void GLViewImpl::swapBuffers()
|
||||
{
|
||||
}
|
||||
|
||||
void GLView::setIMEKeyboardState(bool bOpen)
|
||||
void GLViewImpl::setIMEKeyboardState(bool bOpen)
|
||||
{
|
||||
setKeyboardStateJNI((int)bOpen);
|
||||
}
|
|
@ -23,26 +23,26 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CC_EGLVIEW_ANDROID_H__
|
||||
#define __CC_EGLVIEW_ANDROID_H__
|
||||
#ifndef __CC_EGLVIEWIMPL_ANDROID_H__
|
||||
#define __CC_EGLVIEWIMPL_ANDROID_H__
|
||||
|
||||
#include "base/CCPlatformConfig.h"
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
|
||||
|
||||
#include "base/CCRef.h"
|
||||
#include "math/CCGeometry.h"
|
||||
#include "platform/CCGLViewProtocol.h"
|
||||
#include "platform/CCGLView.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class CC_DLL GLView : public GLViewProtocol, public Ref
|
||||
class CC_DLL GLViewImpl : public GLView
|
||||
{
|
||||
public:
|
||||
|
||||
// static function
|
||||
static GLView* create(const std::string &viewname);
|
||||
static GLView* createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor = 1.0f);
|
||||
static GLView* createWithFullScreen(const std::string& viewName);
|
||||
static GLViewImpl* create(const std::string &viewname);
|
||||
static GLViewImpl* createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor = 1.0f);
|
||||
static GLViewImpl* createWithFullScreen(const std::string& viewName);
|
||||
|
||||
bool isOpenGLReady() override;
|
||||
void end() override;
|
||||
|
@ -50,8 +50,8 @@ public:
|
|||
void setIMEKeyboardState(bool bOpen) override;
|
||||
|
||||
protected:
|
||||
GLView();
|
||||
virtual ~GLView();
|
||||
GLViewImpl();
|
||||
virtual ~GLViewImpl();
|
||||
|
||||
bool initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor);
|
||||
bool initWithFullScreen(const std::string& viewName);
|
||||
|
@ -61,5 +61,5 @@ NS_CC_END
|
|||
|
||||
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
|
||||
|
||||
#endif // end of __CC_EGLVIEW_ANDROID_H__
|
||||
#endif // end of __CC_EGLVIEWIMPL_ANDROID_H__
|
||||
|
|
@ -32,7 +32,7 @@ THE SOFTWARE.
|
|||
#include "renderer/CCGLProgramCache.h"
|
||||
#include "renderer/CCTextureCache.h"
|
||||
#include "2d/CCDrawingPrimitives.h"
|
||||
#include "CCGLView.h"
|
||||
#include "CCGLViewImpl.h"
|
||||
#include "platform/android/jni/JniHelper.h"
|
||||
#include <android/log.h>
|
||||
#include <jni.h>
|
||||
|
@ -60,7 +60,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
|
|||
auto glview = director->getOpenGLView();
|
||||
if (!glview)
|
||||
{
|
||||
glview = cocos2d::GLView::create("Android app");
|
||||
glview = cocos2d::GLViewImpl::create("Android app");
|
||||
glview->setFrameSize(w, h);
|
||||
director->setOpenGLView(glview);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ THE SOFTWARE.
|
|||
****************************************************************************/
|
||||
#include "base/CCDirector.h"
|
||||
#include "base/CCEventKeyboard.h"
|
||||
#include "CCGLView.h"
|
||||
#include "CCGLViewImpl.h"
|
||||
|
||||
#include <android/log.h>
|
||||
#include <jni.h>
|
||||
|
|
|
@ -49,6 +49,7 @@ public:
|
|||
virtual std::string getFullPathForDirectoryAndFilename(const std::string& directory, const std::string& filename) override;
|
||||
|
||||
virtual ValueMap getValueMapFromFile(const std::string& filename) override;
|
||||
virtual ValueMap getValueMapFromData(const char* filedata, int filesize);
|
||||
virtual bool writeToFile(ValueMap& dict, const std::string& fullPath) override;
|
||||
|
||||
virtual ValueVector getValueVectorFromFile(const std::string& filename) override;
|
||||
|
|
|
@ -428,6 +428,26 @@ ValueMap FileUtilsApple::getValueMapFromFile(const std::string& filename)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ValueMap FileUtilsApple::getValueMapFromData(const char* filedata, int filesize)
|
||||
{
|
||||
NSData* file = [NSData dataWithBytes:filedata length:filesize];
|
||||
NSPropertyListFormat format;
|
||||
NSError* error;
|
||||
NSDictionary* dict = [NSPropertyListSerialization propertyListWithData:file options:NSPropertyListImmutable format:&format error:&error];
|
||||
|
||||
ValueMap ret;
|
||||
|
||||
if (dict != nil)
|
||||
{
|
||||
for (id key in [dict allKeys])
|
||||
{
|
||||
id value = [dict objectForKey:key];
|
||||
addValueToDict(key, value, ret);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool FileUtilsApple::writeToFile(ValueMap& dict, const std::string &fullPath)
|
||||
{
|
||||
//CCLOG("iOS||Mac Dictionary %d write to file %s", dict->_ID, fullPath.c_str());
|
||||
|
|
|
@ -23,7 +23,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCGLView.h"
|
||||
#include "CCGLViewImpl.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include "base/CCTouch.h"
|
||||
#include "base/CCEventDispatcher.h"
|
||||
|
@ -95,16 +95,16 @@ public:
|
|||
_view->onGLFWWindowSizeFunCallback(window, width, height);
|
||||
}
|
||||
|
||||
static void setGLView(GLView* view)
|
||||
static void setGLViewImpl(GLViewImpl* view)
|
||||
{
|
||||
_view = view;
|
||||
}
|
||||
|
||||
private:
|
||||
static GLView* _view;
|
||||
static GLViewImpl* _view;
|
||||
};
|
||||
|
||||
GLView* GLFWEventHandler::_view = nullptr;
|
||||
GLViewImpl* GLFWEventHandler::_view = nullptr;
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
|
@ -247,11 +247,11 @@ static keyCodeItem g_keyCodeStructArray[] = {
|
|||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// implement GLView
|
||||
// implement GLViewImpl
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
GLView::GLView()
|
||||
GLViewImpl::GLViewImpl()
|
||||
: _captured(false)
|
||||
, _supportTouch(false)
|
||||
, _isInRetinaMonitor(false)
|
||||
|
@ -270,22 +270,22 @@ GLView::GLView()
|
|||
g_keyCodeMap[item.glfwKeyCode] = item.keyCode;
|
||||
}
|
||||
|
||||
GLFWEventHandler::setGLView(this);
|
||||
GLFWEventHandler::setGLViewImpl(this);
|
||||
|
||||
glfwSetErrorCallback(GLFWEventHandler::onGLFWError);
|
||||
glfwInit();
|
||||
}
|
||||
|
||||
GLView::~GLView()
|
||||
GLViewImpl::~GLViewImpl()
|
||||
{
|
||||
CCLOGINFO("deallocing GLView: %p", this);
|
||||
GLFWEventHandler::setGLView(nullptr);
|
||||
CCLOGINFO("deallocing GLViewImpl: %p", this);
|
||||
GLFWEventHandler::setGLViewImpl(nullptr);
|
||||
glfwTerminate();
|
||||
}
|
||||
|
||||
GLView* GLView::create(const std::string& viewName)
|
||||
GLViewImpl* GLViewImpl::create(const std::string& viewName)
|
||||
{
|
||||
auto ret = new GLView;
|
||||
auto ret = new GLViewImpl;
|
||||
if(ret && ret->initWithRect(viewName, Rect(0, 0, 960, 640), 1)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
|
@ -294,9 +294,9 @@ GLView* GLView::create(const std::string& viewName)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GLView* GLView::createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||
GLViewImpl* GLViewImpl::createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||
{
|
||||
auto ret = new GLView;
|
||||
auto ret = new GLViewImpl;
|
||||
if(ret && ret->initWithRect(viewName, rect, frameZoomFactor)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
|
@ -305,9 +305,9 @@ GLView* GLView::createWithRect(const std::string& viewName, Rect rect, float fra
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GLView* GLView::createWithFullScreen(const std::string& viewName)
|
||||
GLViewImpl* GLViewImpl::createWithFullScreen(const std::string& viewName)
|
||||
{
|
||||
auto ret = new GLView();
|
||||
auto ret = new GLViewImpl();
|
||||
if(ret && ret->initWithFullScreen(viewName)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
|
@ -316,9 +316,9 @@ GLView* GLView::createWithFullScreen(const std::string& viewName)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GLView* GLView::createWithFullScreen(const std::string& viewName, const GLFWvidmode &videoMode, GLFWmonitor *monitor)
|
||||
GLViewImpl* GLViewImpl::createWithFullScreen(const std::string& viewName, const GLFWvidmode &videoMode, GLFWmonitor *monitor)
|
||||
{
|
||||
auto ret = new GLView();
|
||||
auto ret = new GLViewImpl();
|
||||
if(ret && ret->initWithFullscreen(viewName, videoMode, monitor)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
|
@ -328,7 +328,7 @@ GLView* GLView::createWithFullScreen(const std::string& viewName, const GLFWvidm
|
|||
}
|
||||
|
||||
|
||||
bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||
bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||
{
|
||||
setViewName(viewName);
|
||||
|
||||
|
@ -375,7 +375,7 @@ bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoo
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GLView::initWithFullScreen(const std::string& viewName)
|
||||
bool GLViewImpl::initWithFullScreen(const std::string& viewName)
|
||||
{
|
||||
//Create fullscreen window on primary monitor at its current video mode.
|
||||
_monitor = glfwGetPrimaryMonitor();
|
||||
|
@ -386,7 +386,7 @@ bool GLView::initWithFullScreen(const std::string& viewName)
|
|||
return initWithRect(viewName, Rect(0, 0, videoMode->width, videoMode->height), 1.0f);
|
||||
}
|
||||
|
||||
bool GLView::initWithFullscreen(const std::string &viewname, const GLFWvidmode &videoMode, GLFWmonitor *monitor)
|
||||
bool GLViewImpl::initWithFullscreen(const std::string &viewname, const GLFWvidmode &videoMode, GLFWmonitor *monitor)
|
||||
{
|
||||
//Create fullscreen on specified monitor at the specified video mode.
|
||||
_monitor = monitor;
|
||||
|
@ -402,29 +402,29 @@ bool GLView::initWithFullscreen(const std::string &viewname, const GLFWvidmode &
|
|||
return initWithRect(viewname, Rect(0, 0, videoMode.width, videoMode.height), 1.0f);
|
||||
}
|
||||
|
||||
bool GLView::isOpenGLReady()
|
||||
bool GLViewImpl::isOpenGLReady()
|
||||
{
|
||||
return nullptr != _mainWindow;
|
||||
}
|
||||
|
||||
void GLView::end()
|
||||
void GLViewImpl::end()
|
||||
{
|
||||
if(_mainWindow)
|
||||
{
|
||||
glfwSetWindowShouldClose(_mainWindow,1);
|
||||
_mainWindow = nullptr;
|
||||
}
|
||||
// Release self. Otherwise, GLView could not be freed.
|
||||
// Release self. Otherwise, GLViewImpl could not be freed.
|
||||
release();
|
||||
}
|
||||
|
||||
void GLView::swapBuffers()
|
||||
void GLViewImpl::swapBuffers()
|
||||
{
|
||||
if(_mainWindow)
|
||||
glfwSwapBuffers(_mainWindow);
|
||||
}
|
||||
|
||||
bool GLView::windowShouldClose()
|
||||
bool GLViewImpl::windowShouldClose()
|
||||
{
|
||||
if(_mainWindow)
|
||||
return glfwWindowShouldClose(_mainWindow) ? true : false;
|
||||
|
@ -432,13 +432,12 @@ bool GLView::windowShouldClose()
|
|||
return true;
|
||||
}
|
||||
|
||||
void GLView::pollEvents()
|
||||
void GLViewImpl::pollEvents()
|
||||
{
|
||||
glfwPollEvents();
|
||||
}
|
||||
|
||||
|
||||
void GLView::enableRetina(bool enabled)
|
||||
void GLViewImpl::enableRetina(bool enabled)
|
||||
{
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
_isRetinaEnabled = enabled;
|
||||
|
@ -455,12 +454,12 @@ void GLView::enableRetina(bool enabled)
|
|||
}
|
||||
|
||||
|
||||
void GLView::setIMEKeyboardState(bool /*bOpen*/)
|
||||
void GLViewImpl::setIMEKeyboardState(bool /*bOpen*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void GLView::setFrameZoomFactor(float zoomFactor)
|
||||
void GLViewImpl::setFrameZoomFactor(float zoomFactor)
|
||||
{
|
||||
CCASSERT(zoomFactor > 0.0f, "zoomFactor must be larger than 0");
|
||||
|
||||
|
@ -473,12 +472,12 @@ void GLView::setFrameZoomFactor(float zoomFactor)
|
|||
updateFrameSize();
|
||||
}
|
||||
|
||||
float GLView::getFrameZoomFactor()
|
||||
float GLViewImpl::getFrameZoomFactor() const
|
||||
{
|
||||
return _frameZoomFactor;
|
||||
}
|
||||
|
||||
void GLView::updateFrameSize()
|
||||
void GLViewImpl::updateFrameSize()
|
||||
{
|
||||
if (_screenSize.width > 0 && _screenSize.height > 0)
|
||||
{
|
||||
|
@ -515,13 +514,13 @@ void GLView::updateFrameSize()
|
|||
}
|
||||
}
|
||||
|
||||
void GLView::setFrameSize(float width, float height)
|
||||
void GLViewImpl::setFrameSize(float width, float height)
|
||||
{
|
||||
GLViewProtocol::setFrameSize(width, height);
|
||||
GLView::setFrameSize(width, height);
|
||||
updateFrameSize();
|
||||
}
|
||||
|
||||
void GLView::setViewPortInPoints(float x , float y , float w , float h)
|
||||
void GLViewImpl::setViewPortInPoints(float x , float y , float w , float h)
|
||||
{
|
||||
glViewport((GLint)(x * _scaleX * _retinaFactor * _frameZoomFactor + _viewPortRect.origin.x * _retinaFactor * _frameZoomFactor),
|
||||
(GLint)(y * _scaleY * _retinaFactor * _frameZoomFactor + _viewPortRect.origin.y * _retinaFactor * _frameZoomFactor),
|
||||
|
@ -529,7 +528,7 @@ void GLView::setViewPortInPoints(float x , float y , float w , float h)
|
|||
(GLsizei)(h * _scaleY * _retinaFactor * _frameZoomFactor));
|
||||
}
|
||||
|
||||
void GLView::setScissorInPoints(float x , float y , float w , float h)
|
||||
void GLViewImpl::setScissorInPoints(float x , float y , float w , float h)
|
||||
{
|
||||
glScissor((GLint)(x * _scaleX * _retinaFactor * _frameZoomFactor + _viewPortRect.origin.x * _retinaFactor * _frameZoomFactor),
|
||||
(GLint)(y * _scaleY * _retinaFactor * _frameZoomFactor + _viewPortRect.origin.y * _retinaFactor * _frameZoomFactor),
|
||||
|
@ -537,12 +536,12 @@ void GLView::setScissorInPoints(float x , float y , float w , float h)
|
|||
(GLsizei)(h * _scaleY * _retinaFactor * _frameZoomFactor));
|
||||
}
|
||||
|
||||
void GLView::onGLFWError(int errorID, const char* errorDesc)
|
||||
void GLViewImpl::onGLFWError(int errorID, const char* errorDesc)
|
||||
{
|
||||
CCLOGERROR("GLFWError #%d Happen, %s\n", errorID, errorDesc);
|
||||
}
|
||||
|
||||
void GLView::onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int modify)
|
||||
void GLViewImpl::onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int modify)
|
||||
{
|
||||
if(GLFW_MOUSE_BUTTON_LEFT == button)
|
||||
{
|
||||
|
@ -586,7 +585,7 @@ void GLView::onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int
|
|||
}
|
||||
}
|
||||
|
||||
void GLView::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y)
|
||||
void GLViewImpl::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y)
|
||||
{
|
||||
_mouseX = (float)x;
|
||||
_mouseY = (float)y;
|
||||
|
@ -631,7 +630,7 @@ void GLView::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y)
|
|||
Director::getInstance()->getEventDispatcher()->dispatchEvent(&event);
|
||||
}
|
||||
|
||||
void GLView::onGLFWMouseScrollCallback(GLFWwindow* window, double x, double y)
|
||||
void GLViewImpl::onGLFWMouseScrollCallback(GLFWwindow* window, double x, double y)
|
||||
{
|
||||
EventMouse event(EventMouse::MouseEventType::MOUSE_SCROLL);
|
||||
//Because OpenGL and cocos2d-x uses different Y axis, we need to convert the coordinate here
|
||||
|
@ -640,7 +639,7 @@ void GLView::onGLFWMouseScrollCallback(GLFWwindow* window, double x, double y)
|
|||
Director::getInstance()->getEventDispatcher()->dispatchEvent(&event);
|
||||
}
|
||||
|
||||
void GLView::onGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
|
||||
void GLViewImpl::onGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
if (GLFW_REPEAT != action)
|
||||
{
|
||||
|
@ -653,17 +652,17 @@ void GLView::onGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int ac
|
|||
}
|
||||
}
|
||||
|
||||
void GLView::onGLFWCharCallback(GLFWwindow *window, unsigned int character)
|
||||
void GLViewImpl::onGLFWCharCallback(GLFWwindow *window, unsigned int character)
|
||||
{
|
||||
IMEDispatcher::sharedDispatcher()->dispatchInsertText((const char*) &character, 1);
|
||||
}
|
||||
|
||||
void GLView::onGLFWWindowPosCallback(GLFWwindow *windows, int x, int y)
|
||||
void GLViewImpl::onGLFWWindowPosCallback(GLFWwindow *windows, int x, int y)
|
||||
{
|
||||
Director::getInstance()->setViewport();
|
||||
}
|
||||
|
||||
void GLView::onGLFWframebuffersize(GLFWwindow* window, int w, int h)
|
||||
void GLViewImpl::onGLFWframebuffersize(GLFWwindow* window, int w, int h)
|
||||
{
|
||||
float frameSizeW = _screenSize.width;
|
||||
float frameSizeH = _screenSize.height;
|
||||
|
@ -692,7 +691,7 @@ void GLView::onGLFWframebuffersize(GLFWwindow* window, int w, int h)
|
|||
}
|
||||
}
|
||||
|
||||
void GLView::onGLFWWindowSizeFunCallback(GLFWwindow *window, int width, int height)
|
||||
void GLViewImpl::onGLFWWindowSizeFunCallback(GLFWwindow *window, int width, int height)
|
||||
{
|
||||
if (_resolutionPolicy != ResolutionPolicy::UNKNOWN)
|
||||
{
|
||||
|
@ -766,7 +765,7 @@ static bool glew_dynamic_binding()
|
|||
#endif
|
||||
|
||||
// helper
|
||||
bool GLView::initGlew()
|
||||
bool GLViewImpl::initGlew()
|
||||
{
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MAC)
|
||||
GLenum GlewInitResult = glewInit();
|
|
@ -23,23 +23,43 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CC_EGLVIEW_DESKTOP_H__
|
||||
#define __CC_EGLVIEW_DESKTOP_H__
|
||||
#ifndef __CC_EGLViewIMPL_DESKTOP_H__
|
||||
#define __CC_EGLViewIMPL_DESKTOP_H__
|
||||
|
||||
#include "base/CCRef.h"
|
||||
#include "platform/CCCommon.h"
|
||||
#include "platform/CCGLViewProtocol.h"
|
||||
#include "platform/CCGLView.h"
|
||||
#include "glfw3.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
#ifndef GLFW_EXPOSE_NATIVE_WIN32
|
||||
#define GLFW_EXPOSE_NATIVE_WIN32
|
||||
#endif
|
||||
#ifndef GLFW_EXPOSE_NATIVE_WGL
|
||||
#define GLFW_EXPOSE_NATIVE_WGL
|
||||
#endif
|
||||
#include "glfw3native.h"
|
||||
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) */
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
#ifndef GLFW_EXPOSE_NATIVE_NSGL
|
||||
#define GLFW_EXPOSE_NATIVE_NSGL
|
||||
#endif
|
||||
#ifndef GLFW_EXPOSE_NATIVE_COCOA
|
||||
#define GLFW_EXPOSE_NATIVE_COCOA
|
||||
#endif
|
||||
#include "glfw3native.h"
|
||||
#endif // #if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class CC_DLL GLView : public GLViewProtocol, public Ref
|
||||
class CC_DLL GLViewImpl : public GLView
|
||||
{
|
||||
public:
|
||||
static GLView* create(const std::string& viewName);
|
||||
static GLView* createWithRect(const std::string& viewName, Rect size, float frameZoomFactor = 1.0f);
|
||||
static GLView* createWithFullScreen(const std::string& viewName);
|
||||
static GLView* createWithFullScreen(const std::string& viewName, const GLFWvidmode &videoMode, GLFWmonitor *monitor);
|
||||
static GLViewImpl* create(const std::string& viewName);
|
||||
static GLViewImpl* createWithRect(const std::string& viewName, Rect size, float frameZoomFactor = 1.0f);
|
||||
static GLViewImpl* createWithFullScreen(const std::string& viewName);
|
||||
static GLViewImpl* createWithFullScreen(const std::string& viewName, const GLFWvidmode &videoMode, GLFWmonitor *monitor);
|
||||
|
||||
/*
|
||||
*frameZoomFactor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
|
||||
|
@ -47,7 +67,7 @@ public:
|
|||
|
||||
//void resize(int width, int height);
|
||||
|
||||
float getFrameZoomFactor();
|
||||
float getFrameZoomFactor() const;
|
||||
//void centerWindow();
|
||||
|
||||
virtual void setViewPortInPoints(float x , float y , float w , float h);
|
||||
|
@ -79,10 +99,18 @@ public:
|
|||
|
||||
/** Get retina factor */
|
||||
int getRetinaFactor() const { return _retinaFactor; }
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
HWND getWin32Window() { return glfwGetWin32Window(_mainWindow); }
|
||||
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) */
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
id getCocoaWindow() { return glfwGetCocoaWindow(_mainWindow); }
|
||||
#endif // #if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
|
||||
protected:
|
||||
GLView();
|
||||
virtual ~GLView();
|
||||
GLViewImpl();
|
||||
virtual ~GLViewImpl();
|
||||
|
||||
bool initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor);
|
||||
bool initWithFullScreen(const std::string& viewName);
|
||||
|
@ -120,9 +148,9 @@ protected:
|
|||
friend class GLFWEventHandler;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(GLView);
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(GLViewImpl);
|
||||
};
|
||||
|
||||
NS_CC_END // end of namespace cocos2d
|
||||
|
||||
#endif // end of __CC_EGLVIEW_DESKTOP_H__
|
||||
#endif // end of __CC_EGLViewImpl_DESKTOP_H__
|
|
@ -348,7 +348,7 @@ static bool _initWithString(const char * text, cocos2d::Device::TextAlign align,
|
|||
}
|
||||
|
||||
// text color
|
||||
CGContextSetRGBFillColor(context, info->tintColorR / 255.0f, info->tintColorG / 255.0f, info->tintColorB / 255.0f, 1);
|
||||
CGContextSetRGBFillColor(context, info->tintColorR, info->tintColorG, info->tintColorB, 1);
|
||||
// move Y rendering to the top of the image
|
||||
CGContextTranslateCTM(context, 0.0f, (dim.height - shadowStrokePaddingY) );
|
||||
CGContextScaleCTM(context, 1.0f, -1.0f); //NOTE: NSString draws in UIKit referential i.e. renders upside-down compared to CGBitmapContext referential
|
||||
|
@ -456,13 +456,13 @@ Data Device::getTextureDataForText(const char * text, const FontDefinition& text
|
|||
info.shadowBlur = textDefinition._shadow._shadowBlur;
|
||||
info.shadowOpacity = textDefinition._shadow._shadowOpacity;
|
||||
info.hasStroke = textDefinition._stroke._strokeEnabled;
|
||||
info.strokeColorR = textDefinition._stroke._strokeColor.r;
|
||||
info.strokeColorG = textDefinition._stroke._strokeColor.g;
|
||||
info.strokeColorB = textDefinition._stroke._strokeColor.b;
|
||||
info.strokeColorR = textDefinition._stroke._strokeColor.r / 255.0f;
|
||||
info.strokeColorG = textDefinition._stroke._strokeColor.g / 255.0f;
|
||||
info.strokeColorB = textDefinition._stroke._strokeColor.b / 255.0f;
|
||||
info.strokeSize = textDefinition._stroke._strokeSize;
|
||||
info.tintColorR = textDefinition._fontFillColor.r;
|
||||
info.tintColorG = textDefinition._fontFillColor.g;
|
||||
info.tintColorB = textDefinition._fontFillColor.b;
|
||||
info.tintColorR = textDefinition._fontFillColor.r / 255.0f;
|
||||
info.tintColorG = textDefinition._fontFillColor.g / 255.0f;
|
||||
info.tintColorB = textDefinition._fontFillColor.b / 255.0f;
|
||||
|
||||
if (! _initWithString(text, align, textDefinition._fontName.c_str(), textDefinition._fontSize, &info))
|
||||
{
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#import <OpenGLES/EAGL.h>
|
||||
#import "CCDirectorCaller.h"
|
||||
#import "CCDirector.h"
|
||||
#import "CCGLView.h"
|
||||
#import "CCEAGLView.h"
|
||||
|
||||
static id s_sharedDirectorCaller;
|
||||
|
|
|
@ -65,7 +65,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
|||
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS
|
||||
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#import "CCGLView.h"
|
||||
#import "CCGLViewImpl.h"
|
||||
#import "CCEAGLView.h"
|
||||
#import "CCES2Renderer.h"
|
||||
#import "CCDirector.h"
|
||||
|
@ -73,7 +73,6 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
|||
#import "CCTouch.h"
|
||||
#import "CCIMEDispatcher.h"
|
||||
#import "OpenGL_Internal.h"
|
||||
#import "CCGLView.h"
|
||||
//CLASS IMPLEMENTATIONS:
|
||||
|
||||
#define IOS_MAX_TOUCHES_COUNT 10
|
||||
|
|
|
@ -23,35 +23,35 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CC_EGLVIEW_IPHONE_H__
|
||||
#define __CC_EGLVIEW_IPHONE_H__
|
||||
#ifndef __CC_EGLVIEWIMPL_IPHONE_H__
|
||||
#define __CC_EGLVIEWIMPL_IPHONE_H__
|
||||
|
||||
#include "base/CCPlatformConfig.h"
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS
|
||||
|
||||
#include "base/CCRef.h"
|
||||
#include "platform/CCCommon.h"
|
||||
#include "platform/CCGLViewProtocol.h"
|
||||
#include "platform/CCGLView.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
||||
/** Class that represent the OpenGL View
|
||||
*/
|
||||
class CC_DLL GLView : public GLViewProtocol, public Ref
|
||||
class CC_DLL GLViewImpl : public GLView
|
||||
{
|
||||
public:
|
||||
/** creates a GLView with a objective-c CCEAGLView instance */
|
||||
static GLView* createWithEAGLView(void* eaglview);
|
||||
/** creates a GLViewImpl with a objective-c CCEAGLViewImpl instance */
|
||||
static GLViewImpl* createWithEAGLView(void* eaGLView);
|
||||
|
||||
/** creates a GLView with a title name in fullscreen mode */
|
||||
static GLView* create(const std::string& viewName);
|
||||
/** creates a GLViewImpl with a title name in fullscreen mode */
|
||||
static GLViewImpl* create(const std::string& viewName);
|
||||
|
||||
/** creates a GLView with a title name, a rect and the zoom factor */
|
||||
static GLView* createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor = 1.0f);
|
||||
/** creates a GLViewImpl with a title name, a rect and the zoom factor */
|
||||
static GLViewImpl* createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor = 1.0f);
|
||||
|
||||
/** creates a GLView with a name in fullscreen mode */
|
||||
static GLView* createWithFullScreen(const std::string& viewName);
|
||||
/** creates a GLViewImpl with a name in fullscreen mode */
|
||||
static GLViewImpl* createWithFullScreen(const std::string& viewName);
|
||||
|
||||
/** sets the content scale factor */
|
||||
bool setContentScaleFactor(float contentScaleFactor);
|
||||
|
@ -72,10 +72,10 @@ public:
|
|||
virtual void setIMEKeyboardState(bool bOpen) override;
|
||||
|
||||
protected:
|
||||
GLView();
|
||||
virtual ~GLView();
|
||||
GLViewImpl();
|
||||
virtual ~GLViewImpl();
|
||||
|
||||
bool initWithEAGLView(void* eaglview);
|
||||
bool initWithEAGLView(void* eaGLView);
|
||||
bool initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor);
|
||||
bool initWithFullScreen(const std::string& viewName);
|
||||
|
||||
|
@ -87,4 +87,4 @@ NS_CC_END
|
|||
|
||||
#endif // CC_PLATFORM_IOS
|
||||
|
||||
#endif // end of __CC_EGLVIEW_IPHONE_H__
|
||||
#endif // end of __CC_EGLViewImpl_IPHONE_H__
|
|
@ -30,15 +30,15 @@
|
|||
|
||||
#include "CCEAGLView.h"
|
||||
#include "CCDirectorCaller.h"
|
||||
#include "CCGLView.h"
|
||||
#include "CCGLViewImpl.h"
|
||||
#include "CCSet.h"
|
||||
#include "base/CCTouch.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
GLView* GLView::createWithEAGLView(void *eaglview)
|
||||
GLViewImpl* GLViewImpl::createWithEAGLView(void *eaglview)
|
||||
{
|
||||
auto ret = new GLView;
|
||||
auto ret = new GLViewImpl;
|
||||
if(ret && ret->initWithEAGLView(eaglview)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
|
@ -47,9 +47,9 @@ GLView* GLView::createWithEAGLView(void *eaglview)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GLView* GLView::create(const std::string& viewName)
|
||||
GLViewImpl* GLViewImpl::create(const std::string& viewName)
|
||||
{
|
||||
auto ret = new GLView;
|
||||
auto ret = new GLViewImpl;
|
||||
if(ret && ret->initWithFullScreen(viewName)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
|
@ -58,9 +58,9 @@ GLView* GLView::create(const std::string& viewName)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GLView* GLView::createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||
GLViewImpl* GLViewImpl::createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||
{
|
||||
auto ret = new GLView;
|
||||
auto ret = new GLViewImpl;
|
||||
if(ret && ret->initWithRect(viewName, rect, frameZoomFactor)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
|
@ -69,9 +69,9 @@ GLView* GLView::createWithRect(const std::string& viewName, Rect rect, float fra
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GLView* GLView::createWithFullScreen(const std::string& viewName)
|
||||
GLViewImpl* GLViewImpl::createWithFullScreen(const std::string& viewName)
|
||||
{
|
||||
auto ret = new GLView();
|
||||
auto ret = new GLViewImpl();
|
||||
if(ret && ret->initWithFullScreen(viewName)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
|
@ -80,17 +80,17 @@ GLView* GLView::createWithFullScreen(const std::string& viewName)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GLView::GLView()
|
||||
GLViewImpl::GLViewImpl()
|
||||
{
|
||||
}
|
||||
|
||||
GLView::~GLView()
|
||||
GLViewImpl::~GLViewImpl()
|
||||
{
|
||||
CCEAGLView *glview = (CCEAGLView*) _eaglview;
|
||||
[glview release];
|
||||
}
|
||||
|
||||
bool GLView::initWithEAGLView(void *eaglview)
|
||||
bool GLViewImpl::initWithEAGLView(void *eaglview)
|
||||
{
|
||||
_eaglview = eaglview;
|
||||
CCEAGLView *glview = (CCEAGLView*) _eaglview;
|
||||
|
@ -102,7 +102,7 @@ bool GLView::initWithEAGLView(void *eaglview)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||
bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||
{
|
||||
CGRect r = CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
|
||||
CCEAGLView *eaglview = [CCEAGLView viewWithFrame: r
|
||||
|
@ -123,7 +123,7 @@ bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoo
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GLView::initWithFullScreen(const std::string& viewName)
|
||||
bool GLViewImpl::initWithFullScreen(const std::string& viewName)
|
||||
{
|
||||
CGRect rect = [[UIScreen mainScreen] bounds];
|
||||
Rect r;
|
||||
|
@ -135,12 +135,12 @@ bool GLView::initWithFullScreen(const std::string& viewName)
|
|||
return initWithRect(viewName, r, 1);
|
||||
}
|
||||
|
||||
bool GLView::isOpenGLReady()
|
||||
bool GLViewImpl::isOpenGLReady()
|
||||
{
|
||||
return _eaglview != nullptr;
|
||||
}
|
||||
|
||||
bool GLView::setContentScaleFactor(float contentScaleFactor)
|
||||
bool GLViewImpl::setContentScaleFactor(float contentScaleFactor)
|
||||
{
|
||||
CC_ASSERT(_resolutionPolicy == ResolutionPolicy::UNKNOWN); // cannot enable retina mode
|
||||
_scaleX = _scaleY = contentScaleFactor;
|
||||
|
@ -151,7 +151,7 @@ bool GLView::setContentScaleFactor(float contentScaleFactor)
|
|||
return true;
|
||||
}
|
||||
|
||||
float GLView::getContentScaleFactor() const
|
||||
float GLViewImpl::getContentScaleFactor() const
|
||||
{
|
||||
CCEAGLView *eaglview = (CCEAGLView*) _eaglview;
|
||||
|
||||
|
@ -162,7 +162,7 @@ float GLView::getContentScaleFactor() const
|
|||
return scaleFactor;
|
||||
}
|
||||
|
||||
void GLView::end()
|
||||
void GLViewImpl::end()
|
||||
{
|
||||
[CCDirectorCaller destroy];
|
||||
|
||||
|
@ -174,13 +174,13 @@ void GLView::end()
|
|||
}
|
||||
|
||||
|
||||
void GLView::swapBuffers()
|
||||
void GLViewImpl::swapBuffers()
|
||||
{
|
||||
CCEAGLView *eaglview = (CCEAGLView*) _eaglview;
|
||||
[eaglview swapBuffers];
|
||||
}
|
||||
|
||||
void GLView::setIMEKeyboardState(bool open)
|
||||
void GLViewImpl::setIMEKeyboardState(bool open)
|
||||
{
|
||||
CCEAGLView *eaglview = (CCEAGLView*) _eaglview;
|
||||
|
|
@ -32,7 +32,6 @@ THE SOFTWARE.
|
|||
#include <string>
|
||||
#include "base/CCDirector.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "CCGLView.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ THE SOFTWARE.
|
|||
#include "platform/CCFileUtils.h"
|
||||
#include "math/CCGeometry.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include "CCGLView.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
|
|
@ -29,11 +29,6 @@ THE SOFTWARE.
|
|||
#include "platform/CCCommon.h"
|
||||
|
||||
#include "base/CCDirector.h"
|
||||
#include "CCGLView.h"
|
||||
|
||||
#define GLFW_EXPOSE_NATIVE_NSGL
|
||||
#define GLFW_EXPOSE_NATIVE_COCOA
|
||||
#include "glfw3native.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
@ -58,8 +53,8 @@ void MessageBox(const char * msg, const char * title)
|
|||
[alert setInformativeText:tmpTitle];
|
||||
[alert setAlertStyle:NSWarningAlertStyle];
|
||||
|
||||
GLView* glview = Director::getInstance()->getOpenGLView();
|
||||
id window = glfwGetCocoaWindow(glview->getWindow());
|
||||
auto glview = Director::getInstance()->getOpenGLView();
|
||||
id window = glview->getCocoaWindow();
|
||||
[alert beginSheetModalForWindow:window
|
||||
modalDelegate:[window delegate]
|
||||
didEndSelector:nil
|
||||
|
|
|
@ -27,7 +27,6 @@ THE SOFTWARE.
|
|||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
|
||||
|
||||
#include "CCApplication.h"
|
||||
#include "CCGLView.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include <algorithm>
|
||||
#include "platform/CCFileUtils.h"
|
||||
|
|
|
@ -405,7 +405,8 @@ Data Device::getTextureDataForText(const char * text, const FontDefinition& text
|
|||
}
|
||||
|
||||
// draw text
|
||||
SIZE size = {textDefinition._dimensions.width, textDefinition._dimensions.height};
|
||||
// does changing to SIZE here affects the font size by rounding from float?
|
||||
SIZE size = {(LONG) textDefinition._dimensions.width,(LONG) textDefinition._dimensions.height};
|
||||
CC_BREAK_IF(! dc.drawText(text, size, align));
|
||||
|
||||
int dataLen = size.cx * size.cy * 4;
|
||||
|
|
|
@ -124,12 +124,14 @@ inline int vsnprintf_s(char *buffer, size_t sizeOfBuffer, size_t count,
|
|||
const char *format, va_list argptr) {
|
||||
return vsnprintf(buffer, sizeOfBuffer, format, argptr);
|
||||
}
|
||||
|
||||
#ifndef __clang__
|
||||
inline errno_t strcpy_s(char *strDestination, size_t numberOfElements,
|
||||
const char *strSource) {
|
||||
strcpy(strDestination, strSource);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // __MINGW32__
|
||||
|
||||
// Conflicted with cocos2d::MessageBox, so we need to undef it.
|
||||
|
|
|
@ -26,7 +26,7 @@ THE SOFTWARE.
|
|||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
|
||||
#include "platform/winrt/CCGLView.h"
|
||||
#else
|
||||
#include "platform/wp8/CCGLView.h"
|
||||
#include "platform/wp8/CCGLViewImpl.h"
|
||||
#endif
|
||||
#include "base/CCDirector.h"
|
||||
#include <algorithm>
|
||||
|
@ -75,7 +75,7 @@ int Application::run()
|
|||
return 0;
|
||||
}
|
||||
|
||||
GLView::sharedOpenGLView()->Run();
|
||||
GLViewImpl::sharedOpenGLView()->Run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ THE SOFTWARE.
|
|||
#include "CCWinRTUtils.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
||||
#include "platform/wp8/CCGLView.h"
|
||||
#include "platform/wp8/CCGLViewImpl.h"
|
||||
#endif
|
||||
|
||||
#if defined(VLD_DEBUG_MEMORY)
|
||||
|
@ -50,7 +50,7 @@ void MessageBox(const char * pszMsg, const char * pszTitle)
|
|||
// Show the message dialog
|
||||
msg->ShowAsync();
|
||||
#else
|
||||
GLView::sharedOpenGLView()->ShowMessageBox(title, message);
|
||||
GLViewImpl::sharedOpenGLView()->ShowMessageBox(title, message);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ void Device::setAccelerometerEnabled(bool isEnabled)
|
|||
acc.timestamp = 0;
|
||||
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
||||
auto orientation = GLView::sharedOpenGLView()->getDeviceOrientation();
|
||||
auto orientation = GLViewImpl::sharedOpenGLView()->getDeviceOrientation();
|
||||
|
||||
switch (orientation)
|
||||
{
|
||||
|
@ -115,7 +115,7 @@ void Device::setAccelerometerEnabled(bool isEnabled)
|
|||
}
|
||||
#endif
|
||||
std::shared_ptr<cocos2d::InputEvent> event(new AccelerometerEvent(acc));
|
||||
cocos2d::GLView::sharedOpenGLView()->QueueEvent(event);
|
||||
cocos2d::GLViewImpl::sharedOpenGLView()->QueueEvent(event);
|
||||
});
|
||||
}
|
||||
else
|
||||
|
|
|
@ -57,13 +57,13 @@ void PointerEvent::execute()
|
|||
switch(m_type)
|
||||
{
|
||||
case PointerEventType::PointerPressed:
|
||||
GLView::sharedOpenGLView()->OnPointerPressed(m_args.Get());
|
||||
GLViewImpl::sharedOpenGLView()->OnPointerPressed(m_args.Get());
|
||||
break;
|
||||
case PointerEventType::PointerMoved:
|
||||
GLView::sharedOpenGLView()->OnPointerMoved(m_args.Get());
|
||||
GLViewImpl::sharedOpenGLView()->OnPointerMoved(m_args.Get());
|
||||
break;
|
||||
case PointerEventType::PointerReleased:
|
||||
GLView::sharedOpenGLView()->OnPointerReleased(m_args.Get());
|
||||
GLViewImpl::sharedOpenGLView()->OnPointerReleased(m_args.Get());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ BackButtonEvent::BackButtonEvent()
|
|||
|
||||
void BackButtonEvent::execute()
|
||||
{
|
||||
GLView::sharedOpenGLView()->OnBackKeyPress();
|
||||
GLViewImpl::sharedOpenGLView()->OnBackKeyPress();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ void Cocos2dRenderer::CreateGLResources()
|
|||
if(!mInitialized)
|
||||
{
|
||||
mInitialized = true;
|
||||
GLView* glview = GLView::create("Test Cpp");
|
||||
GLViewImpl* glview = GLViewImpl::create("Test Cpp");
|
||||
glview->Create(m_eglDisplay, m_eglContext, m_eglSurface, m_renderTargetSize.Width, m_renderTargetSize.Height,m_orientation);
|
||||
director->setOpenGLView(glview);
|
||||
CCApplication::getInstance()->run();
|
||||
|
@ -102,14 +102,14 @@ IAsyncAction^ Cocos2dRenderer::OnSuspending()
|
|||
|
||||
void Cocos2dRenderer::OnUpdateDevice()
|
||||
{
|
||||
GLView* glview = GLView::sharedOpenGLView();
|
||||
glview->UpdateDevice(m_eglDisplay, m_eglContext, m_eglSurface);
|
||||
//GLView* glview = GLView::sharedOpenGLView();
|
||||
GLViewImpl::sharedOpenGLView()->UpdateDevice(m_eglDisplay, m_eglContext, m_eglSurface);
|
||||
}
|
||||
|
||||
void Cocos2dRenderer::OnOrientationChanged(Windows::Graphics::Display::DisplayOrientations orientation)
|
||||
{
|
||||
DirectXBase::OnOrientationChanged(orientation);
|
||||
GLView::sharedOpenGLView()->UpdateOrientation(orientation);
|
||||
GLViewImpl::sharedOpenGLView()->UpdateOrientation(orientation);
|
||||
}
|
||||
|
||||
// return true if eglSwapBuffers was called by OnRender()
|
||||
|
@ -117,8 +117,8 @@ bool Cocos2dRenderer::OnRender()
|
|||
{
|
||||
if(m_loadingComplete)
|
||||
{
|
||||
GLView* glview = GLView::sharedOpenGLView();
|
||||
glview->Render();
|
||||
//GLView* glview = GLView::sharedOpenGLView();
|
||||
GLViewImpl::sharedOpenGLView()->Render();
|
||||
return true; // eglSwapBuffers was called by glview->Render();
|
||||
}
|
||||
return false;
|
||||
|
@ -154,7 +154,7 @@ void Cocos2dRenderer::OnCocos2dKeyEvent(Cocos2dKeyEvent event)
|
|||
void Cocos2dRenderer::SetXamlEventDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEventDelegate^ delegate)
|
||||
{
|
||||
m_delegate = delegate;
|
||||
GLView* eglView = GLView::sharedOpenGLView();
|
||||
GLViewImpl* eglView = GLViewImpl::sharedOpenGLView();
|
||||
if(eglView)
|
||||
{
|
||||
eglView->SetXamlEventDelegate(delegate);
|
||||
|
@ -164,7 +164,7 @@ void Cocos2dRenderer::SetXamlEventDelegate(PhoneDirect3DXamlAppComponent::Cocos2
|
|||
void Cocos2dRenderer::SetXamlMessageBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dMessageBoxDelegate^ delegate)
|
||||
{
|
||||
m_messageBoxDelegate = delegate;
|
||||
GLView* eglView = GLView::sharedOpenGLView();
|
||||
GLViewImpl* eglView = GLViewImpl::sharedOpenGLView();
|
||||
if(eglView)
|
||||
{
|
||||
eglView->SetXamlMessageBoxDelegate(delegate);
|
||||
|
@ -174,7 +174,7 @@ void Cocos2dRenderer::SetXamlMessageBoxDelegate(PhoneDirect3DXamlAppComponent::C
|
|||
void Cocos2dRenderer::SetXamlEditBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEditBoxDelegate^ delegate)
|
||||
{
|
||||
m_editBoxDelegate = delegate;
|
||||
GLView* eglView = GLView::sharedOpenGLView();
|
||||
GLViewImpl* eglView = GLViewImpl::sharedOpenGLView();
|
||||
if(eglView)
|
||||
{
|
||||
eglView->SetXamlEditBoxDelegate(delegate);
|
||||
|
|
|
@ -90,43 +90,43 @@ IAsyncAction^ Direct3DInterop::OnSuspending()
|
|||
|
||||
void Direct3DInterop::OnBackKeyPress()
|
||||
{
|
||||
cocos2d::GLView::sharedOpenGLView()->QueueBackKeyPress();
|
||||
cocos2d::GLViewImpl::sharedOpenGLView()->QueueBackKeyPress();
|
||||
}
|
||||
|
||||
// Pointer Event Handlers. We need to queue up pointer events to pass them to the drawing thread
|
||||
void Direct3DInterop::OnPointerPressed(DrawingSurfaceManipulationHost^ sender, PointerEventArgs^ args)
|
||||
{
|
||||
cocos2d::GLView::sharedOpenGLView()->QueuePointerEvent(cocos2d::PointerEventType::PointerPressed, args);
|
||||
cocos2d::GLViewImpl::sharedOpenGLView()->QueuePointerEvent(cocos2d::PointerEventType::PointerPressed, args);
|
||||
}
|
||||
|
||||
void Direct3DInterop::OnPointerMoved(DrawingSurfaceManipulationHost^ sender, PointerEventArgs^ args)
|
||||
{
|
||||
cocos2d::GLView::sharedOpenGLView()->QueuePointerEvent(cocos2d::PointerEventType::PointerMoved, args);
|
||||
cocos2d::GLViewImpl::sharedOpenGLView()->QueuePointerEvent(cocos2d::PointerEventType::PointerMoved, args);
|
||||
}
|
||||
|
||||
void Direct3DInterop::OnPointerReleased(DrawingSurfaceManipulationHost^ sender, PointerEventArgs^ args)
|
||||
{
|
||||
cocos2d::GLView::sharedOpenGLView()->QueuePointerEvent(cocos2d::PointerEventType::PointerReleased, args);
|
||||
cocos2d::GLViewImpl::sharedOpenGLView()->QueuePointerEvent(cocos2d::PointerEventType::PointerReleased, args);
|
||||
}
|
||||
|
||||
void Direct3DInterop::OnCocos2dKeyEvent(Cocos2dKeyEvent key)
|
||||
{
|
||||
std::shared_ptr<cocos2d::InputEvent> e(new cocos2d::KeyboardEvent(key));
|
||||
cocos2d::GLView::sharedOpenGLView()->QueueEvent(e);
|
||||
cocos2d::GLViewImpl::sharedOpenGLView()->QueueEvent(e);
|
||||
}
|
||||
|
||||
|
||||
void Direct3DInterop::OnCocos2dKeyEvent(Cocos2dKeyEvent key, Platform::String^ text)
|
||||
{
|
||||
std::shared_ptr<cocos2d::InputEvent> e(new cocos2d::KeyboardEvent(key,text));
|
||||
cocos2d::GLView::sharedOpenGLView()->QueueEvent(e);
|
||||
cocos2d::GLViewImpl::sharedOpenGLView()->QueueEvent(e);
|
||||
}
|
||||
|
||||
|
||||
void Direct3DInterop::OnCocos2dEditboxEvent(Object^ sender, Platform::String^ args, Windows::Foundation::EventHandler<Platform::String^>^ handler)
|
||||
{
|
||||
std::shared_ptr<cocos2d::InputEvent> e(new EditBoxEvent(sender, args, handler));
|
||||
cocos2d::GLView::sharedOpenGLView()->QueueEvent(e);
|
||||
cocos2d::GLViewImpl::sharedOpenGLView()->QueueEvent(e);
|
||||
}
|
||||
|
||||
|
||||
|
@ -150,7 +150,7 @@ HRESULT Direct3DInterop::Draw(_In_ ID3D11Device1* device, _In_ ID3D11DeviceConte
|
|||
}
|
||||
#endif // 0
|
||||
|
||||
cocos2d::GLView::sharedOpenGLView()->ProcessEvents();
|
||||
cocos2d::GLViewImpl::sharedOpenGLView()->ProcessEvents();
|
||||
m_renderer->Render();
|
||||
RequestAdditionalFrame();
|
||||
return S_OK;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue