MCPcopy Create free account
hub / github.com/axmolengine/axmol / processParentFlags

Method processParentFlags

core/2d/Node.cpp:1237–1268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1235}
1236
1237uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFlags)
1238{
1239 if (_usingNormalizedPosition)
1240 {
1241 AXASSERT(_parent, "setPositionNormalized() doesn't work with orphan nodes");
1242 if ((parentFlags & FLAGS_CONTENT_SIZE_DIRTY) || _normalizedPositionDirty)
1243 {
1244 auto& s = _parent->getContentSize();
1245 _position.x = _normalizedPosition.x * s.width;
1246 _position.y = _normalizedPosition.y * s.height;
1247 _transformUpdated = _transformDirty = _inverseDirty = true;
1248 _normalizedPositionDirty = false;
1249 }
1250 }
1251
1252 // Fixes Github issue #16100. Basically when having two cameras, one camera might set as dirty the
1253 // node that is not visited by it, and might affect certain calculations. Besides, it is faster to do this.
1254 if (!isVisitableByVisitingCamera())
1255 return parentFlags;
1256
1257 uint32_t flags = parentFlags;
1258 flags |= (_transformUpdated ? FLAGS_TRANSFORM_DIRTY : 0);
1259 flags |= (_contentSizeDirty ? FLAGS_CONTENT_SIZE_DIRTY : 0);
1260
1261 if (flags & FLAGS_DIRTY_MASK)
1262 _modelViewTransform = this->transform(parentTransform);
1263
1264 _transformUpdated = false;
1265 _contentSizeDirty = false;
1266
1267 return flags;
1268}
1269
1270bool Node::isVisitableByVisitingCamera() const
1271{

Callers

nothing calls this directly

Calls 2

transformMethod · 0.95
getContentSizeMethod · 0.45

Tested by

no test coverage detected