From a31279f8cb860abbb80cf0dfd3e77d2b7592cea9 Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Wed, 22 Jun 2016 11:28:58 -0700 Subject: [PATCH] fix: reverse iterator on events + doesn't use additionalTransform use reverse Camera iterator when traversing events (of course). but somehow setAdditionalTransform() breaks setNodeToParentTransform(). And since setAdditionalTransform is not needed, we just don't use it. Github issue #15909 --- cocos/2d/CCScene.cpp | 2 -- cocos/base/CCEventDispatcher.cpp | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cocos/2d/CCScene.cpp b/cocos/2d/CCScene.cpp index 907be59d73..2e83ebe6fd 100644 --- a/cocos/2d/CCScene.cpp +++ b/cocos/2d/CCScene.cpp @@ -210,8 +210,6 @@ void Scene::render(Renderer* renderer, const Mat4& eyeTransform, const Mat4* eye // culling and other stuff. if (eyeProjection) camera->setAdditionalProjection(*eyeProjection * camera->getProjectionMatrix().getInversed()); - else - camera->setAdditionalTransform(eyeTransform.getInversed()); director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, Camera::_visitingCamera->getViewProjectionMatrix()); diff --git a/cocos/base/CCEventDispatcher.cpp b/cocos/base/CCEventDispatcher.cpp index b477ffca8f..ffa6e46ae2 100644 --- a/cocos/base/CCEventDispatcher.cpp +++ b/cocos/base/CCEventDispatcher.cpp @@ -845,8 +845,10 @@ void EventDispatcher::dispatchTouchEventToListeners(EventListenerVector* listene // second, for all camera call all listeners // get a copy of cameras, prevent it's been modified in listener callback // if camera's depth is greater, process it earlier - for (auto& camera: scene->getCameras()) + auto cameras = scene->getCameras(); + for (auto rit = cameras.rbegin(); rit != cameras.rend(); ++rit) { + Camera* camera = *rit; if (camera->isVisible() == false) { continue;