зеркало из https://github.com/microsoft/cocos2d-x.git
2d cull only for default camera
This commit is contained in:
Родитель
31f406bbdd
Коммит
26f7345693
|
@ -193,6 +193,8 @@ void Scene::addChildToPhysicsWorld(Node* child)
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void Scene::onProjectionChanged(EventCustom* event)
|
||||
{
|
||||
if (_defaultCamera)
|
||||
|
@ -201,6 +203,4 @@ void Scene::onProjectionChanged(EventCustom* event)
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -83,6 +83,7 @@ protected:
|
|||
friend class SpriteBatchNode;
|
||||
friend class Camera;
|
||||
friend class Director;
|
||||
friend class Renderer;
|
||||
|
||||
std::vector<Camera*> _cameras; //weak ref to Camera
|
||||
Camera* _defaultCamera; //weak ref, default camera created by scene, _cameras[0], Caution that the default camera can not be added to _cameras before onEnter is called
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
#include "base/CCEventDispatcher.h"
|
||||
#include "base/CCEventListenerCustom.h"
|
||||
#include "base/CCEventType.h"
|
||||
#include "base/CCCamera.h"
|
||||
#include "2d/CCScene.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -549,6 +551,11 @@ void Renderer::flush3D()
|
|||
|
||||
bool Renderer::checkVisibility(const Mat4 &transform, const Size &size)
|
||||
{
|
||||
auto scene = Director::getInstance()->getRunningScene();
|
||||
// only cull the default camera. The culling algorithm is valid for default camera.
|
||||
if (scene->_defaultCamera != Camera::getVisitingCamera())
|
||||
return true;
|
||||
|
||||
// half size of the screen
|
||||
Size screen_half = Director::getInstance()->getWinSize();
|
||||
screen_half.width /= 2;
|
||||
|
|
Загрузка…
Ссылка в новой задаче