Beispiel #1
0
    //---------------------------------------------------------------------
    void Overlay::_findVisibleObjects(Camera* cam, RenderQueue* queue)
    {
        OverlayContainerList::iterator i, iend;

        if (OverlayManager::getSingleton().hasViewportChanged())
        {
            iend = m2DElements.end();
            for (i = m2DElements.begin(); i != iend; ++i)
            {
                (*i)->_notifyViewport();
            }
        }

        // update elements
        if (mTransformUpdated)
        {
            OverlayContainerList::iterator i, iend;
            Matrix4 xform;

            _getWorldTransforms(&xform);
            iend = m2DElements.end();
            for (i = m2DElements.begin(); i != iend; ++i)
            {
                (*i)->_notifyWorldTransforms(xform);
            }

            mTransformUpdated = false;
        }

        if (mVisible)
        {
            // Add 3D elements
            mRootNode->setPosition(cam->getDerivedPosition());
            mRootNode->setOrientation(cam->getDerivedOrientation());
            mRootNode->_update(true, false);
            // Set up the default queue group for the objects about to be added
            uint8 oldgrp = queue->getDefaultQueueGroup();
            ushort oldPriority = queue-> getDefaultRenderablePriority();
            queue->setDefaultQueueGroup(RENDER_QUEUE_OVERLAY);
            queue->setDefaultRenderablePriority((mZOrder*100)-1);
            mRootNode->_findVisibleObjects(cam, queue, NULL, true, false);
            // Reset the group
            queue->setDefaultQueueGroup(oldgrp);
            queue->setDefaultRenderablePriority(oldPriority);
            // Add 2D elements
            iend = m2DElements.end();
            for (i = m2DElements.begin(); i != iend; ++i)
            {
                (*i)->_update();

                (*i)->_updateRenderQueue(queue);
            }
        }



       
    }
Beispiel #2
0
	//---------------------------------------------------------------------
    void Overlay::add2D(OverlayContainer* cont)
    {
        m2DElements.push_back(cont);
        // Notify parent
        cont->_notifyParent(0, this);

		assignZOrders();

        Matrix4 xform;
        _getWorldTransforms(&xform);
        cont->_notifyWorldTransforms(xform);
        cont->_notifyViewport();
    }
Beispiel #3
0
	//---------------------------------------------------------------------
    void Overlay::add2D(OverlayContainer* cont)
    {
        m2DElements.push_back(cont);
        // Notify parent
        cont->_notifyParent(0, this);
        // Set Z order, scaled to separate overlays
        // NB max 100 container levels per overlay, should be plenty
        cont->_notifyZOrder(mZOrder * 100);

        Matrix4 xform;
        _getWorldTransforms(&xform);
        cont->_notifyWorldTransforms(xform);
        cont->_notifyViewport();
    }
Beispiel #4
0
	//---------------------------------------------------------------------
	void Overlay::_findVisibleObjects(Camera* cam, RenderQueue* queue, Viewport* vp)
	{
		if (mVisible)
		{
			// Flag for update pixel-based GUIElements if viewport has changed dimensions
			bool tmpViewportDimensionsChanged = false;
			if (mLastViewportWidth != vp->getActualWidth() ||
				mLastViewportHeight != vp->getActualHeight())
			{
				tmpViewportDimensionsChanged = true;
				mLastViewportWidth = vp->getActualWidth();
				mLastViewportHeight = vp->getActualHeight();
			}

			OverlayContainerList::iterator i, iend;

			if (tmpViewportDimensionsChanged)
			{
				iend = m2DElements.end();
				for (i = m2DElements.begin(); i != iend; ++i)
				{
					(*i)->_notifyViewport();
				}
			}

			// update elements
			if (mTransformUpdated)
			{
				Matrix4 xform;
				_getWorldTransforms(&xform);

				iend = m2DElements.end();
				for (i = m2DElements.begin(); i != iend; ++i)
				{
					(*i)->_notifyWorldTransforms(xform);
				}

				mTransformUpdated = false;
			}


#ifdef ENABLE_INCOMPATIBLE_OGRE_2_0
			// Add 3D elements
			mRootNode->setPosition(cam->getDerivedPosition());
			mRootNode->setOrientation(cam->getDerivedOrientation());
			//TODO: (dark_sylinc)
			mRootNode->_update(true, false);
#endif
			// Set up the default queue group for the objects about to be added
			uint8 oldgrp = queue->getDefaultQueueGroup();
			ushort oldPriority = queue->getDefaultRenderablePriority();
			queue->setDefaultQueueGroup(RENDER_QUEUE_OVERLAY);
			queue->setDefaultRenderablePriority(static_cast<ushort>((mZOrder * 100) - 1));
#ifdef ENABLE_INCOMPATIBLE_OGRE_2_0
			mRootNode->_findVisibleObjects(cam, queue, NULL, true, false);
#endif
			// Reset the group
			queue->setDefaultQueueGroup(oldgrp);
			queue->setDefaultRenderablePriority(oldPriority);
			// Add 2D elements
			iend = m2DElements.end();
			for (i = m2DElements.begin(); i != iend; ++i)
			{
				(*i)->_update();

				(*i)->_updateRenderQueue(queue, cam, cam);
			}
		}
	}