Skip to content

Commit 347074e

Browse files
committed
Merge branch 'minggo/metal-support' into feature/updateScissorTest
* minggo/metal-support: [cmake] transport to android and windows (cocos2d#160)
2 parents 89ba11c + c5dcbcb commit 347074e

37 files changed

+250
-183
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,4 @@ tests/lua-tests/project/proj.tizen/res/
168168
cmake-build-*/
169169
.vs
170170
cmake_build*
171+
metal-support*.zip

cmake/Modules/CocosConfigDepend.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ macro(cocos2dx_define)
114114
endif()
115115

116116
if(USE_CHIPMUNK)
117-
add_definitions(-DCC_USE_PHYSICS=1)
118-
add_definitions(-DCC_ENABLE_CHIPMUNK_INTEGRATION=1)
117+
add_definitions(-DCC_USE_PHYSICS=0)
118+
add_definitions(-DCC_ENABLE_CHIPMUNK_INTEGRATION=0)
119119
else()
120120
add_definitions(-DCC_USE_PHYSICS=0)
121121
add_definitions(-DCC_ENABLE_CHIPMUNK_INTEGRATION=0)
@@ -128,8 +128,8 @@ macro(cocos2dx_define)
128128
endif(USE_BOX2D)
129129

130130
if(USE_BULLET)
131-
add_definitions(-DCC_USE_3D_PHYSICS=1)
132-
add_definitions(-DCC_ENABLE_BULLET_INTEGRATION=1)
131+
add_definitions(-DCC_USE_3D_PHYSICS=0)
132+
add_definitions(-DCC_ENABLE_BULLET_INTEGRATION=0)
133133
else(USE_BULLET)
134134
add_definitions(-DCC_USE_3D_PHYSICS=0)
135135
add_definitions(-DCC_ENABLE_BULLET_INTEGRATION=0)

cocos/2d/CCDrawNode.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,15 @@ DrawNode::DrawNode(GLfloat lineWidth)
109109
{
110110
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
111111
#if CC_ENABLE_CACHE_TEXTURE_DATA
112+
//TODO new-renderer: interface setupBuffer removal
113+
112114
// Need to listen the event only when not use batchnode, because it will use VBO
113-
auto listener = EventListenerCustom::create(EVENT_RENDERER_RECREATED, [this](EventCustom* event){
114-
/** listen the event that renderer was recreated on Android/WP8 */
115-
this->setupBuffer();
116-
});
115+
// auto listener = EventListenerCustom::create(EVENT_RENDERER_RECREATED, [this](EventCustom* event){
116+
// /** listen the event that renderer was recreated on Android/WP8 */
117+
// this->setupBuffer();
118+
// });
117119

118-
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
120+
// _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
119121
#endif
120122
}
121123

cocos/2d/CCRenderTexture.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ void RenderTexture::listenToBackground(EventCustom* /*event*/)
7676

7777
if (_UITextureImage)
7878
{
79-
const Size& s = _texture->getContentSizeInPixels();
80-
VolatileTextureMgr::addDataTexture(_texture, _UITextureImage->getData(), s.width * s.height * 4, Texture2D::PixelFormat::RGBA8888, s);
79+
const Size& s = _texture2D->getContentSizeInPixels();
80+
VolatileTextureMgr::addDataTexture(_texture2D, _UITextureImage->getData(), s.width * s.height * 4, Texture2D::PixelFormat::RGBA8888, s);
8181

82-
if ( _textureCopy )
82+
if ( _texture2DCopy )
8383
{
84-
VolatileTextureMgr::addDataTexture(_textureCopy, _UITextureImage->getData(), s.width * s.height * 4, Texture2D::PixelFormat::RGBA8888, s);
84+
VolatileTextureMgr::addDataTexture(_texture2DCopy, _UITextureImage->getData(), s.width * s.height * 4, Texture2D::PixelFormat::RGBA8888, s);
8585
}
8686
}
8787
else
@@ -94,16 +94,17 @@ void RenderTexture::listenToBackground(EventCustom* /*event*/)
9494
void RenderTexture::listenToForeground(EventCustom* /*event*/)
9595
{
9696
#if CC_ENABLE_CACHE_TEXTURE_DATA
97-
const Size& s = _texture->getContentSizeInPixels();
98-
if (_depthAndStencilFormat != 0)
99-
{
100-
setupDepthAndStencil(s.width, s.height);
101-
}
97+
const Size& s = _texture2D->getContentSizeInPixels();
98+
//TODO new-renderer: field _depthAndStencilFormat removal
99+
// if (_depthAndStencilFormat != 0)
100+
// {
101+
// setupDepthAndStencil(s.width, s.height);
102+
// }
102103

103-
_texture->setAntiAliasTexParameters();
104-
if(_textureCopy)
104+
_texture2D->setAntiAliasTexParameters();
105+
if(_texture2DCopy)
105106
{
106-
_textureCopy->setAntiAliasTexParameters();
107+
_texture2DCopy->setAntiAliasTexParameters();
107108
}
108109
#endif
109110
}

cocos/2d/CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set(COCOS_2D_HEADER
77
2d/CCTMXTiledMap.h
88
2d/CCLayer.h
99
2d/CCActionCamera.h
10-
2d/CCLabelTTF.h
10+
# 2d/CCLabelTTF.h
1111
2d/CCParticleExamples.h
1212
2d/CCSprite.h
1313
2d/CCNode.h
@@ -28,7 +28,7 @@ set(COCOS_2D_HEADER
2828
2d/CCLabelAtlas.h
2929
2d/CCActionCatmullRom.h
3030
2d/CCActionGrid.h
31-
2d/CCDrawingPrimitives.h
31+
# 2d/CCDrawingPrimitives.h
3232
2d/CCParticleBatchNode.h
3333
2d/CCClippingRectangleNode.h
3434
2d/CCActionEase.h
@@ -45,7 +45,7 @@ set(COCOS_2D_HEADER
4545
2d/CCFastTMXTiledMap.h
4646
2d/CCLabelTextFormatter.h
4747
2d/CCMenuItem.h
48-
2d/CCLabelBMFont.h
48+
# 2d/CCLabelBMFont.h
4949
2d/CCFontFNT.h
5050
2d/CCSpriteBatchNode.h
5151
2d/CCTransitionProgress.h
@@ -70,7 +70,7 @@ set(COCOS_2D_HEADER
7070
2d/CCTMXLayer.h
7171
2d/CCCamera.h
7272
2d/CCParallaxNode.h
73-
2d/CCGrabber.h
73+
# 2d/CCGrabber.h
7474

7575
)
7676

@@ -98,7 +98,7 @@ set(COCOS_2D_SRC
9898
2d/CCClippingRectangleNode.cpp
9999
2d/CCComponentContainer.cpp
100100
2d/CCComponent.cpp
101-
2d/CCDrawingPrimitives.cpp
101+
# 2d/CCDrawingPrimitives.cpp
102102
2d/CCDrawNode.cpp
103103
2d/CCFastTMXLayer.cpp
104104
2d/CCFastTMXTiledMap.cpp
@@ -109,13 +109,13 @@ set(COCOS_2D_SRC
109109
2d/CCFontFNT.cpp
110110
2d/CCFontFreeType.cpp
111111
2d/CCGLBufferedNode.cpp
112-
2d/CCGrabber.cpp
112+
# 2d/CCGrabber.cpp
113113
2d/CCGrid.cpp
114114
2d/CCLabelAtlas.cpp
115-
2d/CCLabelBMFont.cpp
115+
# 2d/CCLabelBMFont.cpp
116116
2d/CCLabel.cpp
117117
2d/CCLabelTextFormatter.cpp
118-
2d/CCLabelTTF.cpp
118+
# 2d/CCLabelTTF.cpp
119119
2d/CCLayer.cpp
120120
2d/CCLight.cpp
121121
2d/CCMenu.cpp

cocos/3d/CCBillBoard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ void BillBoard::draw(Renderer *renderer, const Mat4 &/*transform*/, uint32_t fla
229229
{
230230
//FIXME: frustum culling here
231231
flags |= Node::FLAGS_RENDER_AS_3D;
232-
_trianglesCommand.init(0, _texture->getName(), getGLProgramState(), _blendFunc, _polyInfo.triangles, _modelViewTransform, flags);
232+
_trianglesCommand.init(0, _texture, _blendFunc, _polyInfo.triangles, _modelViewTransform, flags);
233233
_trianglesCommand.setTransparent(true);
234234
_trianglesCommand.set3D(true);
235235
renderer->addCommand(&_trianglesCommand);

cocos/3d/CCSprite3D.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,9 +759,10 @@ void Sprite3D::visit(cocos2d::Renderer *renderer, const cocos2d::Mat4 &parentTra
759759
void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
760760
{
761761
#if CC_USE_CULLING
762+
//TODO new-renderer: interface isVisibleInFrustum removal
762763
// camera clipping
763-
if(_children.size() == 0 && Camera::getVisitingCamera() && !Camera::getVisitingCamera()->isVisibleInFrustum(&getAABB()))
764-
return;
764+
// if(_children.size() == 0 && Camera::getVisitingCamera() && !Camera::getVisitingCamera()->isVisibleInFrustum(&getAABB()))
765+
// return;
765766
#endif
766767

767768
if (_skeleton)

cocos/3d/CCTerrain.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,18 +1554,19 @@ void Terrain::QuadTree::resetNeedDraw(bool value)
15541554

15551555
void Terrain::QuadTree::cullByCamera(const Camera * camera, const Mat4 & worldTransform)
15561556
{
1557-
if(!camera->isVisibleInFrustum(&_worldSpaceAABB))
1558-
{
1557+
//TODO new-renderer: interface isVisibleInFrustum removal
1558+
// if(!camera->isVisibleInFrustum(&_worldSpaceAABB))
1559+
// {
15591560
this->resetNeedDraw(false);
1560-
}else
1561-
{
1561+
// }else
1562+
// {
15621563
if(!_isTerminal){
15631564
_tl->cullByCamera(camera,worldTransform);
15641565
_tr->cullByCamera(camera,worldTransform);
15651566
_bl->cullByCamera(camera,worldTransform);
15661567
_br->cullByCamera(camera,worldTransform);
15671568
}
1568-
}
1569+
// }
15691570
}
15701571

15711572
void Terrain::QuadTree::preCalculateAABB(const Mat4 & worldTransform)

cocos/CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@ include(physics3d/CMakeLists.txt)
4646
include(math/CMakeLists.txt)
4747
include(navmesh/CMakeLists.txt)
4848
include(renderer/CMakeLists.txt)
49-
include(vr/CMakeLists.txt)
49+
#include(vr/CMakeLists.txt)
5050
include(base/CMakeLists.txt)
5151
include(deprecated/CMakeLists.txt)
5252
include(ui/CMakeLists.txt)
5353
include(network/CMakeLists.txt)
5454
include(audio/CMakeLists.txt)
5555
include(storage/CMakeLists.txt)
5656

57-
if(BUILD_EDITOR_COCOSBUILDER)
58-
include(editor-support/cocosbuilder/CMakeLists.txt)
59-
set(COCOS_EDITOR_SUPPORT_SRC ${COCOS_EDITOR_SUPPORT_SRC} ${COCOS_CCB_SRC} ${COCOS_CCB_HEADER})
60-
endif(BUILD_EDITOR_COCOSBUILDER)
57+
#if(BUILD_EDITOR_COCOSBUILDER)
58+
# include(editor-support/cocosbuilder/CMakeLists.txt)
59+
# set(COCOS_EDITOR_SUPPORT_SRC ${COCOS_EDITOR_SUPPORT_SRC} ${COCOS_CCB_SRC} ${COCOS_CCB_HEADER})
60+
#endif(BUILD_EDITOR_COCOSBUILDER)
6161

6262
if(BUILD_EDITOR_COCOSTUDIO)
6363
include(editor-support/cocostudio/CMakeLists.txt)
@@ -82,7 +82,7 @@ set(COCOS_HEADER cocos2d.h
8282
${COCOS_MATH_HEADER}
8383
${COCOS_NAVMESH_HEADER}
8484
${COCOS_RENDERER_HEADER}
85-
${COCOS_VR_HEADER}
85+
# ${COCOS_VR_HEADER}
8686
${COCOS_BASE_HEADER}
8787
${COCOS_AUDIO_HEADER}
8888
${COCOS_UI_HEADER}
@@ -102,11 +102,11 @@ set(COCOS_SRC cocos2d.cpp
102102
${COCOS_MATH_SRC}
103103
${COCOS_NAVMESH_SRC}
104104
${COCOS_RENDERER_SRC}
105-
${COCOS_VR_SRC}
105+
# ${COCOS_VR_SRC}
106106
${COCOS_BASE_SRC}
107107
${COCOS_AUDIO_SRC}
108108
${COCOS_UI_SRC}
109-
${COCOS_DEPRECATED_SRC}
109+
# ${COCOS_DEPRECATED_SRC}
110110
${COCOS_NETWORK_SRC}
111111
${COCOS_EDITOR_SUPPORT_SRC}
112112
${COCOS_EXTENSIONS_SRC}

cocos/base/CCUserDefault-android.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,7 @@ UserDefault::UserDefault()
148148
{
149149
}
150150

151-
// FIXME:: deprecated
152-
void UserDefault::purgeSharedUserDefault()
153-
{
154-
UserDefault::destroyInstance();
155-
}
151+
156152

157153
void UserDefault::destroyInstance()
158154
{
@@ -470,11 +466,6 @@ void UserDefault::setDataForKey(const char* pKey, const Data& value)
470466
free(encodedData);
471467
}
472468

473-
// FIXME:: deprecated
474-
UserDefault* UserDefault::sharedUserDefault()
475-
{
476-
return UserDefault::getInstance();
477-
}
478469

479470
UserDefault* UserDefault::getInstance()
480471
{

0 commit comments

Comments
 (0)