//---------------------------------------------------------------------
    void OverlayElement::_update(void)
    {
        // Check size if pixel-based
        switch (mMetricsMode)
        {
        case GMM_PIXELS :
            if (OverlayManager::getSingleton().hasViewportChanged() || mGeomPositionsOutOfDate)
            {
                Real vpWidth, vpHeight;
                OverlayManager& oMgr = OverlayManager::getSingleton();
                vpWidth = (Real) (oMgr.getViewportWidth());
                vpHeight = (Real) (oMgr.getViewportHeight());

                mPixelScaleX = 1.0f / vpWidth;
                mPixelScaleY = 1.0f / vpHeight;

                mLeft = mPixelLeft * mPixelScaleX;
                mTop = mPixelTop * mPixelScaleY;
                mWidth = mPixelWidth * mPixelScaleX;
                mHeight = mPixelHeight * mPixelScaleY;
            }
            break;

        case GMM_RELATIVE_ASPECT_ADJUSTED :
            if (OverlayManager::getSingleton().hasViewportChanged() || mGeomPositionsOutOfDate)
            {
                Real vpWidth, vpHeight;
                OverlayManager& oMgr = OverlayManager::getSingleton();
                vpWidth = (Real) (oMgr.getViewportWidth());
                vpHeight = (Real) (oMgr.getViewportHeight());

                mPixelScaleX = 1.0f / (10000.0f * (vpWidth / vpHeight));
                mPixelScaleY = 1.0f /  10000.0f;

                mLeft = mPixelLeft * mPixelScaleX;
                mTop = mPixelTop * mPixelScaleY;
                mWidth = mPixelWidth * mPixelScaleX;
                mHeight = mPixelHeight * mPixelScaleY;
            }
            break;
        default:
            break;
        }

        _updateFromParent();
        // NB container subclasses will update children too

        // Tell self to update own position geometry
        if (mGeomPositionsOutOfDate && mInitialised)
        {
            updatePositionGeometry();
            mGeomPositionsOutOfDate = false;
        }
		// Tell self to update own texture geometry
		if (mGeomUVsOutOfDate && mInitialised)
		{
			updateTextureGeometry();
			mGeomUVsOutOfDate = false;
		}
    }
Beispiel #2
0
	//-----------------------------------------------------------------------
    Vector3 Node::convertWorldToLocalPosition( const Vector3 &worldPos )
	{
		if (mNeedParentUpdate)
        {
            _updateFromParent();
        }
		return mDerivedOrientation.Inverse() * (worldPos - mDerivedPosition) / mDerivedScale;
	}
Beispiel #3
0
 //-----------------------------------------------------------------------
 const Vector3 & Node::_getDerivedScale(void) const
 {
     if (mNeedParentUpdate)
     {
         _updateFromParent();
     }
     return mDerivedScale;
 }
Beispiel #4
0
	//-----------------------------------------------------------------------
	Quaternion Node::convertWorldToLocalOrientation( const Quaternion &worldOrientation )
	{
		if (mNeedParentUpdate)
		{
			_updateFromParent();
		}
		return mDerivedOrientation.Inverse() * worldOrientation;
	}
 //---------------------------------------------------------------------    
 void OverlayElement::_getClippingRegion(Rectangle &clippingRegion)
 {
     if (mDerivedOutOfDate)
     {
         _updateFromParent();
     }
     clippingRegion = mClippingRegion;
 }
Beispiel #6
0
	// Transform to Vector Helpers
	const Vector3 & Transform::Forward() 
	{
		if (cachedTransformOutOfDate)
		{
			_updateFromParent();
		}
		return forward;
	};
Beispiel #7
0
 //-----------------------------------------------------------------------
 const Vector3 & Transform::_getDerivedScale(void)
 {
     if (needParentUpdate)
     {
         _updateFromParent();
     }
     return derivedScale;
 }
Beispiel #8
0
    //-----------------------------------------------------------------------
    const Quaternion & Node::_getDerivedOrientation(void) const
    {
		if (mNeedParentUpdate)
		{
        	_updateFromParent();
		}
        return mDerivedOrientation;
    }
Beispiel #9
0
    //-----------------------------------------------------------------------
    const Quaternion & Transform::_getDerivedOrientation(void)
    {
		if (needParentUpdate)
		{
        	_updateFromParent();
		}
        return derivedOrientation;
    }
Beispiel #10
0
	const Vector3 & Transform::Right()
	{
		if (cachedTransformOutOfDate)
		{
			_updateFromParent();
		}
		return right;
	};
Beispiel #11
0
	const Vector3 & Transform::Up()
	{
		if (cachedTransformOutOfDate)
		{
			_updateFromParent();
		}
		return up;
	};
 //---------------------------------------------------------------------
 Real OverlayElement::_getDerivedTop(void)
 {
     if (mDerivedOutOfDate)
     {
         _updateFromParent();
     }
     return mDerivedTop;
 }
Beispiel #13
0
	//-----------------------------------------------------------------------
	Vector3 Node::convertLocalToWorldPosition( const Vector3 &localPos )
	{
		if (mNeedParentUpdate)
        {
            _updateFromParent();
        }
		return (mDerivedOrientation * localPos * mDerivedScale) + mDerivedPosition;
	}
Beispiel #14
0
	//-----------------------------------------------------------------------
	Quaternion Node::convertLocalToWorldOrientation( const Quaternion &localOrientation )
	{
		if (mNeedParentUpdate)
		{
			_updateFromParent();
		}
		return mDerivedOrientation * localOrientation;

	}
Beispiel #15
0
	void sgNode::update( Float32 deltaTime )
	{
		if(m_bNeedUpdateFromParent)
			_updateFromParent();

		// update children
		ChildNodeMap::iterator it = m_Children.begin();
		ChildNodeMap::iterator eit = m_Children.end();
		for(; it!=eit; ++it)
		{
			it->second->update(deltaTime);
		}

	}
Beispiel #16
0
    //-----------------------------------------------------------------------
    void Node::_update(bool updateChildren, bool parentHasChanged)
    {
		// always clear information about parent notification
		mParentNotified = false ;

        // Short circuit the off case
        if (!updateChildren && !mNeedParentUpdate && !mNeedChildUpdate && !parentHasChanged )
        {
            return;
        }


        // See if we should process everyone
        if (mNeedParentUpdate || parentHasChanged)
        {
            // Update transforms from parent
            _updateFromParent();
		}

		if (mNeedChildUpdate || parentHasChanged)
		{

            ChildNodeMap::iterator it, itend;
			itend = mChildren.end();
            for (it = mChildren.begin(); it != itend; ++it)
            {
                Node* child = it->second;
                child->_update(true, true);
            }
            mChildrenToUpdate.clear();
        }
        else
        {
            // Just update selected children

            ChildUpdateSet::iterator it, itend;
			itend = mChildrenToUpdate.end();
            for(it = mChildrenToUpdate.begin(); it != itend; ++it)
            {
                Node* child = *it;
                child->_update(true, false);
            }

            mChildrenToUpdate.clear();
        }

        mNeedChildUpdate = false;

    }
Beispiel #17
0
	void Transform::_update(bool updateChildren, bool parentHasChanged)
	{
        if (IsEnabled()) {
        
            // always clear information about parent notification
            parentNotified = false;
            
            // See if we should process everyone
            if (needParentUpdate || parentHasChanged)
            {
                // Update transforms from parent
                _updateFromParent();
            }
            /*
             if (childrenToUpdate.size() > 0)
             {
             for_each(childrenToUpdate.begin(), childrenToUpdate.end(), [](Transform::Ptr child){
             child->_update(true, false);
             });
             childrenToUpdate.clear();
             }
             */
            
            //if (updateChildren)
            //{
			if (needChildUpdate || parentHasChanged)
			{
				for_each(children.begin(), children.end(), [](Transform::Ptr child){
					child->_update(true, true);
				});
			}
			else
			{
				for_each(childrenToUpdate.begin(), childrenToUpdate.end(), [](Transform::Ptr child){
					child->_update(true, false);
				});
			}
			childrenToUpdate.clear();
			needChildUpdate = false;

			// Now that the children have been updated, update the this transforms bounds
			UpdateBounds();
            //}
        }

	}
Beispiel #18
0
	//  [7/30/2008 zhangxiang]
	const Quaternion &sgNode::_getDerivedOrientation(void) const{
		if(m_bNeedUpdateFromParent){
			_updateFromParent();
		}
		return m_DerivedOrientation;
	}
Beispiel #19
0
	//  [7/30/2008 zhangxiang]
	const Vector3 &sgNode::_getDerivedPosition(void) const{
		if(m_bNeedUpdateFromParent){
			_updateFromParent();
		}
		return m_DerivedPosition;
	}
Beispiel #20
0
	//  [7/30/2008 zhangxiang]
	const Vector3 &sgNode::_getDerivedScale(void) const{
		if(m_bNeedUpdateFromParent){
			_updateFromParent();
		}
		return m_DerivedScale;
	}