mirror of https://github.com/axmolengine/axmol.git
merge cocos
This commit is contained in:
commit
75e5ca30ee
|
@ -30,6 +30,7 @@ THE SOFTWARE.
|
|||
#include "base/CCCamera.h"
|
||||
#include "base/CCEventDispatcher.h"
|
||||
#include "base/CCEventListenerCustom.h"
|
||||
#include "renderer/CCRenderer.h"
|
||||
#include "deprecated/CCString.h"
|
||||
|
||||
#if CC_USE_PHYSICS
|
||||
|
@ -124,6 +125,44 @@ void Scene::onProjectionChanged(EventCustom* event)
|
|||
}
|
||||
}
|
||||
|
||||
void Scene::render(Renderer* renderer)
|
||||
{
|
||||
auto director = Director::getInstance();
|
||||
Camera* defaultCamera = nullptr;
|
||||
for (const auto& camera : _cameras)
|
||||
{
|
||||
Camera::_visitingCamera = camera;
|
||||
if (Camera::_visitingCamera->getCameraFlag() == CameraFlag::DEFAULT)
|
||||
{
|
||||
defaultCamera = Camera::_visitingCamera;
|
||||
continue;
|
||||
}
|
||||
|
||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, Camera::_visitingCamera->getViewProjectionMatrix());
|
||||
|
||||
//visit the scene
|
||||
visit(renderer, Mat4::IDENTITY, 0);
|
||||
renderer->render();
|
||||
|
||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
}
|
||||
//draw with default camera
|
||||
if (defaultCamera)
|
||||
{
|
||||
Camera::_visitingCamera = defaultCamera;
|
||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, Camera::_visitingCamera->getViewProjectionMatrix());
|
||||
|
||||
//visit the scene
|
||||
visit(renderer, Mat4::IDENTITY, 0);
|
||||
renderer->render();
|
||||
|
||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
}
|
||||
Camera::_visitingCamera = nullptr;
|
||||
}
|
||||
|
||||
#if CC_USE_PHYSICS
|
||||
void Scene::addChild(Node* child, int zOrder, int tag)
|
||||
{
|
||||
|
|
|
@ -35,6 +35,7 @@ NS_CC_BEGIN
|
|||
|
||||
class Camera;
|
||||
class BaseLight3D;
|
||||
class Renderer;
|
||||
class EventListenerCustom;
|
||||
class EventCustom;
|
||||
#if CC_USE_PHYSICS
|
||||
|
@ -75,6 +76,9 @@ public:
|
|||
|
||||
const std::vector<BaseLight3D*>& getLights() const { return _lights; }
|
||||
|
||||
/** render the scene */
|
||||
void render(Renderer* renderer);
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
Scene();
|
||||
virtual ~Scene();
|
||||
|
@ -89,7 +93,6 @@ protected:
|
|||
friend class ProtectedNode;
|
||||
friend class SpriteBatchNode;
|
||||
friend class Camera;
|
||||
friend class Director;
|
||||
friend class BaseLight3D;
|
||||
friend class Renderer;
|
||||
|
||||
|
|
|
@ -287,41 +287,8 @@ void Director::drawScene()
|
|||
//clear draw stats
|
||||
_renderer->clearDrawStats();
|
||||
|
||||
Camera* defaultCamera = nullptr;
|
||||
const auto& cameras = _runningScene->_cameras;
|
||||
//draw with camera
|
||||
for (size_t i = 0; i < cameras.size(); i++)
|
||||
{
|
||||
Camera::_visitingCamera = cameras[i];
|
||||
if (Camera::_visitingCamera->getCameraFlag() == CameraFlag::DEFAULT)
|
||||
{
|
||||
defaultCamera = Camera::_visitingCamera;
|
||||
continue;
|
||||
}
|
||||
|
||||
pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, Camera::_visitingCamera->getViewProjectionMatrix());
|
||||
|
||||
//visit the scene
|
||||
_runningScene->visit(_renderer, Mat4::IDENTITY, 0);
|
||||
_renderer->render();
|
||||
|
||||
popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
}
|
||||
//draw with default camera
|
||||
if (defaultCamera)
|
||||
{
|
||||
Camera::_visitingCamera = defaultCamera;
|
||||
pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, Camera::_visitingCamera->getViewProjectionMatrix());
|
||||
|
||||
//visit the scene
|
||||
_runningScene->visit(_renderer, Mat4::IDENTITY, 0);
|
||||
_renderer->render();
|
||||
|
||||
popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
}
|
||||
Camera::_visitingCamera = nullptr;
|
||||
//render the scene
|
||||
_runningScene->render(_renderer);
|
||||
|
||||
_eventDispatcher->dispatchEvent(_eventAfterVisit);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
150906F019D556C5002C4D97 /* lua_cocos2dx_audioengine_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDB0319C5E5FE0055CDCD /* lua_cocos2dx_audioengine_auto.cpp */; };
|
||||
150906F119D556C8002C4D97 /* lua_cocos2dx_audioengine_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3E2BDB0419C5E5FE0055CDCD /* lua_cocos2dx_audioengine_auto.hpp */; };
|
||||
150906F219D556CE002C4D97 /* lua_cocos2dx_audioengine_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDB0819C5E6100055CDCD /* lua_cocos2dx_audioengine_manual.cpp */; };
|
||||
150906F319D556D1002C4D97 /* lua_cocos2dx_audioengine_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2BDB0919C5E6100055CDCD /* lua_cocos2dx_audioengine_manual.h */; };
|
||||
15415A7019A71768004F1E71 /* lua_cocos2dx_extension_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AACE74C18BC45C200215002 /* lua_cocos2dx_extension_auto.cpp */; };
|
||||
15415A7119A71782004F1E71 /* lua_cocos2dx_extension_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AACE74C18BC45C200215002 /* lua_cocos2dx_extension_auto.cpp */; };
|
||||
15415A7219A718FB004F1E71 /* lua_cocos2dx_3d_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1516227F19A0F3E3006099B8 /* lua_cocos2dx_3d_auto.cpp */; };
|
||||
|
@ -749,6 +753,7 @@
|
|||
15AC69E01987711400D17520 /* luaconf.h in Headers */,
|
||||
155C7DF819A71C4400F08B25 /* lua_cocos2dx_cocosdenshion_manual.h in Headers */,
|
||||
15415AAF19A71A53004F1E71 /* except.h in Headers */,
|
||||
150906F319D556D1002C4D97 /* lua_cocos2dx_audioengine_manual.h in Headers */,
|
||||
155C7E0419A71C6D00F08B25 /* lua_cocos2dx_cocosbuilder_manual.h in Headers */,
|
||||
15415ACB19A71A53004F1E71 /* socket.h in Headers */,
|
||||
15415ADF19A71A53004F1E71 /* usocket.h in Headers */,
|
||||
|
@ -784,6 +789,7 @@
|
|||
15415AC719A71A53004F1E71 /* select.h in Headers */,
|
||||
155C7E1C19A71CC200F08B25 /* lua_cocos2dx_spine_manual.hpp in Headers */,
|
||||
15C1C2D41987499F00A46ACC /* lua_cocos2dx_auto.hpp in Headers */,
|
||||
150906F119D556C8002C4D97 /* lua_cocos2dx_audioengine_auto.hpp in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -921,6 +927,7 @@
|
|||
files = (
|
||||
15415A7219A718FB004F1E71 /* lua_cocos2dx_3d_auto.cpp in Sources */,
|
||||
15415A7319A718FB004F1E71 /* lua_cocos2dx_cocosbuilder_auto.cpp in Sources */,
|
||||
150906F219D556CE002C4D97 /* lua_cocos2dx_audioengine_manual.cpp in Sources */,
|
||||
15415A7519A718FB004F1E71 /* lua_cocos2dx_experimental_video_auto.cpp in Sources */,
|
||||
15415A7619A718FB004F1E71 /* lua_cocos2dx_ui_auto.cpp in Sources */,
|
||||
15415A7719A718FB004F1E71 /* lua_cocos2dx_spine_auto.cpp in Sources */,
|
||||
|
@ -962,6 +969,7 @@
|
|||
15C1C2CE1987498B00A46ACC /* LuaOpengl.cpp in Sources */,
|
||||
566F015F19B5EB0F00FCA620 /* CustomGUIReader.cpp in Sources */,
|
||||
15415AC119A71A53004F1E71 /* options.c in Sources */,
|
||||
150906F019D556C5002C4D97 /* lua_cocos2dx_audioengine_auto.cpp in Sources */,
|
||||
155C7E0A19A71C8B00F08B25 /* lua_cocos2dx_network_manual.cpp in Sources */,
|
||||
15415AD119A71A53004F1E71 /* timeout.c in Sources */,
|
||||
15C1C2CF1987498B00A46ACC /* lua_cocos2dx_deprecated.cpp in Sources */,
|
||||
|
|
|
@ -3636,6 +3636,7 @@
|
|||
"cocos/scripting/lua-bindings/auto/api/ControlSwitch.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/Controller.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/DelayTime.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/Device.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/Director.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/DisplayData.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/DisplayManager.lua",
|
||||
|
|
|
@ -350,7 +350,7 @@ function AudioProfileTest.create()
|
|||
AudioProfileTest._files = {}
|
||||
AudioProfileTest._files[1] = "background.mp3"
|
||||
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
|
||||
if (cc.PLATFORM_OS_MAC == currPlatform or cc.PLATFORM_OS_IPHONE == targetPlatform or cc.PLATFORM_OS_IPAD == targetPlatform) then
|
||||
if (cc.PLATFORM_OS_MAC == targetPlatform or cc.PLATFORM_OS_IPHONE == targetPlatform or cc.PLATFORM_OS_IPAD == targetPlatform) then
|
||||
AudioProfileTest._files[2] = "background.caf"
|
||||
elseif (cc.PLATFORM_OS_ANDROID == targetPlatform) then
|
||||
AudioProfileTest._files[2] = "background.ogg"
|
||||
|
@ -388,7 +388,7 @@ function AudioProfileTest.create()
|
|||
ccexp.AudioEngine:setFinishCallback(audioID,finishCallback)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local item = cc.MenuItemFont:create("play "..AudioProfileTest._files[index])
|
||||
item:setFontSizeObj(20)
|
||||
item:setPosition(cc.p(layerSize.width * 0.5,layerSize.height * heightRatio))
|
||||
|
@ -490,7 +490,7 @@ function LargeAudioFileTest.create()
|
|||
local layerSize = layer:getContentSize()
|
||||
|
||||
local function playAudio(tag, sender)
|
||||
ccexp.AudioEngine:play2d("audio/Chee Lai(Arise).mp3")
|
||||
ccexp.AudioEngine:play2d("audio/LuckyDay.mp3")
|
||||
end
|
||||
|
||||
local playItem = cc.MenuItemFont:create("play large audio file")
|
||||
|
|
|
@ -7,6 +7,8 @@ prefix = cocos2dx_audioengine
|
|||
# all classes will be embedded in that namespace
|
||||
target_namespace = ccexp
|
||||
|
||||
macro_judgement = #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC
|
||||
|
||||
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include
|
||||
android_flags = -D_SIZE_T_DEFINED_
|
||||
|
||||
|
|
Loading…
Reference in New Issue