Reorder members of Node, sizeof(Node) decrease from 640 to 616 on 32bit application

This commit is contained in:
halx99 2020-08-06 13:30:35 +08:00
parent 9d81f124ff
commit b781a25e16
1 changed files with 16 additions and 18 deletions

View File

@ -1837,8 +1837,6 @@ protected:
Vec2 _position; ///< position of the node Vec2 _position; ///< position of the node
float _positionZ; ///< OpenGL real Z position float _positionZ; ///< OpenGL real Z position
Vec2 _normalizedPosition; Vec2 _normalizedPosition;
bool _usingNormalizedPosition;
bool _normalizedPositionDirty;
float _skewX; ///< skew angle on x-axis float _skewX; ///< skew angle on x-axis
float _skewY; ///< skew angle on y-axis float _skewY; ///< skew angle on y-axis
@ -1847,18 +1845,12 @@ protected:
Vec2 _anchorPoint; ///< anchor point normalized (NOT in points) Vec2 _anchorPoint; ///< anchor point normalized (NOT in points)
Size _contentSize; ///< untransformed size of the node Size _contentSize; ///< untransformed size of the node
bool _contentSizeDirty; ///< whether or not the contentSize is dirty
Mat4 _modelViewTransform; ///< ModelView transform of the Node. Mat4 _modelViewTransform; ///< ModelView transform of the Node.
// "cache" variables are allowed to be mutable // "cache" variables are allowed to be mutable
mutable Mat4 _transform; ///< transform mutable Mat4 _transform; ///< transform
mutable bool _transformDirty; ///< transform dirty flag
mutable Mat4 _inverse; ///< inverse transform mutable Mat4 _inverse; ///< inverse transform
mutable bool _inverseDirty; ///< inverse transform dirty flag
mutable Mat4* _additionalTransform; ///< two transforms needed by additional transforms mutable Mat4* _additionalTransform; ///< two transforms needed by additional transforms
mutable bool _additionalTransformDirty; ///< transform dirty ?
bool _transformUpdated; ///< Whether or not the Transform object was updated since the last frame
#if CC_LITTLE_ENDIAN #if CC_LITTLE_ENDIAN
union { union {
@ -1899,15 +1891,26 @@ protected:
EventDispatcher* _eventDispatcher; ///< event dispatcher used to dispatch all kinds of events EventDispatcher* _eventDispatcher; ///< event dispatcher used to dispatch all kinds of events
bool _reorderChildDirty; ///< children order dirty flag
bool _running; ///< is running bool _running; ///< is running
bool _visible; ///< is this node visible bool _visible; ///< is this node visible
bool _ignoreAnchorPointForPosition; ///< true if the Anchor Vec2 will be (0,0) when you position the Node, false otherwise. bool _ignoreAnchorPointForPosition; ///< true if the Anchor Vec2 will be (0,0) when you position the Node, false otherwise.
///< Used by Layer and Scene. ///< Used by Layer and Scene.
bool _reorderChildDirty; ///< children order dirty flag
bool _isTransitionFinished; ///< flag to indicate whether the transition was finished bool _isTransitionFinished; ///< flag to indicate whether the transition was finished
bool _cascadeColorEnabled;
bool _cascadeOpacityEnabled;
bool _contentSizeDirty; ///< whether or not the contentSize is dirty
mutable bool _transformDirty; ///< transform dirty flag
mutable bool _inverseDirty; ///< inverse transform dirty flag
mutable bool _additionalTransformDirty; ///< transform dirty ?
bool _transformUpdated; ///< Whether or not the Transform object was updated since the last frame
bool _usingNormalizedPosition;
bool _normalizedPositionDirty;
// camera mask, it is visible only when _cameraMask & current camera' camera flag is true
unsigned short _cameraMask;
#if CC_ENABLE_SCRIPT_BINDING #if CC_ENABLE_SCRIPT_BINDING
int _scriptHandler; ///< script handler for onEnter() & onExit(), used in Javascript binding and Lua binding. int _scriptHandler; ///< script handler for onEnter() & onExit(), used in Javascript binding and Lua binding.
@ -1917,16 +1920,11 @@ protected:
ComponentContainer *_componentContainer; ///< Dictionary of components ComponentContainer *_componentContainer; ///< Dictionary of components
// opacity controls // opacity controls
uint8_t _displayedOpacity;
uint8_t _realOpacity;
Color3B _displayedColor; Color3B _displayedColor;
uint8_t _displayedOpacity;
Color3B _realColor; Color3B _realColor;
bool _cascadeColorEnabled; uint8_t _realOpacity;
bool _cascadeOpacityEnabled;
// camera mask, it is visible only when _cameraMask & current camera' camera flag is true
unsigned short _cameraMask;
std::function<void()> _onEnterCallback; std::function<void()> _onEnterCallback;
std::function<void()> _onExitCallback; std::function<void()> _onExitCallback;
std::function<void()> _onEnterTransitionDidFinishCallback; std::function<void()> _onEnterTransitionDidFinishCallback;