mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-04 18:42:40 +08:00
optimize camera detection
This commit is contained in:
@@ -111,7 +111,7 @@ Node::Node()
|
||||
, _realColor(Color3B::WHITE)
|
||||
, _cascadeColorEnabled(false)
|
||||
, _cascadeOpacityEnabled(false)
|
||||
, _cameraMask(1)
|
||||
, _cameraMask(0)
|
||||
{
|
||||
// set default scheduler and actionManager
|
||||
_director = Director::getInstance();
|
||||
@@ -1255,14 +1255,13 @@ void Node::visit(Renderer* renderer, const Mat4 &parentTransform, uint32_t paren
|
||||
auto camera = creator::CameraNode::getInstance();
|
||||
if (camera) {
|
||||
if (camera->visitingIndex <= 0) {
|
||||
if (camera->containsNode(this)) {
|
||||
if (_cameraMask > 0) {
|
||||
camera->visitingIndex ++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
camera->visitingIndex ++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!_children.empty())
|
||||
|
||||
@@ -84,6 +84,7 @@ namespace creator {
|
||||
}
|
||||
|
||||
_nodes.push_back(target);
|
||||
target->setCameraMask(1, false);
|
||||
|
||||
CustomCommand* beforeVisitCommand = new CustomCommand();
|
||||
CustomCommand* afterVisitCommand = new CustomCommand();
|
||||
@@ -107,6 +108,7 @@ namespace creator {
|
||||
{
|
||||
target->setBeforeVisitCallback(nullptr);
|
||||
target->setAfterVisitCallback(nullptr);
|
||||
target->setCameraMask(0, false);
|
||||
|
||||
for (auto i = _commands.begin(); i != _commands.end(); i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user