void OgreRTTexture::end()
	{
		Ogre::RenderSystem* system = Ogre::Root::getSingleton().getRenderSystem();
		system->_setViewport(mSaveViewport);
#if OGRE_VERSION >= MYGUI_DEFINE_VERSION(1, 7, 0) && OGRE_NO_VIEWPORT_ORIENTATIONMODE == 0
		Ogre::OrientationMode orient = mSaveViewport->getOrientationMode();
		system->_setProjectionMatrix(Ogre::Matrix4::IDENTITY * Ogre::Quaternion(Ogre::Degree(orient * 90.f), Ogre::Vector3::UNIT_Z));
#else
		system->_setProjectionMatrix(Ogre::Matrix4::IDENTITY);
#endif
	}
Ejemplo n.º 2
0
    void begin()
    {
        // set-up matrices
        mRenderSystem->_setWorldMatrix(Ogre::Matrix4::IDENTITY);
        mRenderSystem->_setViewMatrix(Ogre::Matrix4::IDENTITY);

#if OGRE_VERSION >= MYGUI_DEFINE_VERSION(1, 7, 0) && OGRE_NO_VIEWPORT_ORIENTATIONMODE == 0
        Ogre::OrientationMode orient = mWindow->getViewport(mActiveViewport)->getOrientationMode();
        mRenderSystem->_setProjectionMatrix(Ogre::Matrix4::IDENTITY * Ogre::Quaternion(Ogre::Degree(orient * 90.f), Ogre::Vector3::UNIT_Z));
#else
        mRenderSystem->_setProjectionMatrix(Ogre::Matrix4::IDENTITY);
#endif

        // initialise render settings
        mRenderSystem->setLightingEnabled(false);
        mRenderSystem->_setDepthBufferParams(false, false);
        mRenderSystem->_setDepthBias(0, 0);
        mRenderSystem->_setCullingMode(Ogre::CULL_NONE);
        mRenderSystem->_setFog(Ogre::FOG_NONE);
        mRenderSystem->_setColourBufferWriteEnabled(true, true, true, true);
        mRenderSystem->unbindGpuProgram(Ogre::GPT_FRAGMENT_PROGRAM);
        mRenderSystem->unbindGpuProgram(Ogre::GPT_VERTEX_PROGRAM);
        mRenderSystem->setShadingType(Ogre::SO_GOURAUD);

        // initialise texture settings
        mRenderSystem->_setTextureCoordCalculation(0, Ogre::TEXCALC_NONE);
        mRenderSystem->_setTextureCoordSet(0, 0);
        mRenderSystem->_setTextureUnitFiltering(0, Ogre::FO_LINEAR, Ogre::FO_LINEAR, Ogre::FO_NONE);
        mRenderSystem->_setTextureAddressingMode(0, mTextureAddressMode);
        mRenderSystem->_setTextureMatrix(0, Ogre::Matrix4::IDENTITY);
#if OGRE_VERSION < MYGUI_DEFINE_VERSION(1, 6, 0)
        mRenderSystem->_setAlphaRejectSettings(Ogre::CMPF_ALWAYS_PASS, 0);
#else
        mRenderSystem->_setAlphaRejectSettings(Ogre::CMPF_ALWAYS_PASS, 0, false);
#endif
        mRenderSystem->_setTextureBlendMode(0, mColorBlendMode);
        mRenderSystem->_setTextureBlendMode(0, mAlphaBlendMode);
        mRenderSystem->_disableTextureUnitsFrom(1);

        // enable alpha blending
        mRenderSystem->_setSceneBlending(Ogre::SBF_SOURCE_ALPHA, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);

        // always use wireframe
        // TODO: add option to enable wireframe mode in platform
        mRenderSystem->_setPolygonMode(Ogre::PM_SOLID);
    }
	void OgreRTTexture::begin()
	{
		Ogre::RenderTexture* rtt = mTexture->getBuffer()->getRenderTarget();

		if (mViewport == nullptr)
		{
			mViewport = rtt->addViewport(nullptr);
			mViewport->setClearEveryFrame(false);
			mViewport->setOverlaysEnabled(false);
		}

		Ogre::RenderSystem* system = Ogre::Root::getSingleton().getRenderSystem();
		system->_setProjectionMatrix(mProjectMatrix);
		mSaveViewport = system->_getViewport();
		system->_setViewport(mViewport);
		system->clearFrameBuffer(Ogre::FBT_COLOUR, Ogre::ColourValue::ZERO);
	}