当前位置: 首页>>代码示例>>C++>>正文


C++ RenderSystem类代码示例

本文整理汇总了C++中RenderSystem的典型用法代码示例。如果您正苦于以下问题:C++ RenderSystem类的具体用法?C++ RenderSystem怎么用?C++ RenderSystem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了RenderSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addRenderSystemToName

	//---------------------------------------------------------------------
	String GpuProgramManager::addRenderSystemToName( const String & name )
	{
		// Use the current render system
		RenderSystem* rs = Root::getSingleton().getRenderSystem();

		return rs->getName() + "_" + name;
	}
开发者ID:Ali-il,项目名称:gamekit,代码行数:8,代码来源:OgreGpuProgramManager.cpp

示例2: RenderColMesh

void xObjBound::Render(Event * sender)
{
	if (xApp::Instance()->GetSelectedObjSize() == 0)
		return ;

	if (xApp::Instance()->GetSelectedObjSize() == 1 &&
		xApp::Instance()->GetSelectedObj(0)->GetColMesh() != NULL &&
		xApp::Instance()->GetSelectedObj(0)->GetColMesh()->GetPositions().Size() > 0 &&
		xApp::Instance()->GetSelectedObj(0)->GetColMesh()->GetIndices().Size() > 0)
	{
		RenderColMesh();
		return ;
	}

	Aabb box = Aabb::Invalid;

	for (int i = 0; i < xApp::Instance()->GetSelectedObjSize(); ++i)
	{
		xObj * obj = xApp::Instance()->GetSelectedObj(i);
		box = box.Merge(obj->GetBound());
	}

	Vec3 pos = box.GetCenter();
	Vec3 scale = box.GetSize();

	RenderSystem * render = RenderSystem::Instance();

	ShaderParam * uColor = mTech->GetPixelShaderParamTable()->GetParam("gColor");

	uColor->SetUnifom(1, 1, 0, 1);

	mRenderAABB->xform.MakeTransform(pos, Quat::Identity, scale);

	render->Render(mTech, mRenderAABB);
}
开发者ID:ak4hige,项目名称:myway3d,代码行数:35,代码来源:xObjBound.cpp

示例3: Render

    void UnderWaterCaustics::Render(Texture * colorTex, Texture * depthTex)
    {
        RenderSystem * render = RenderSystem::Instance();
        Camera * cam = World::Instance()->MainCamera();

        ShaderParam * uCornerLeftTop = mTech->GetPixelShaderParamTable()->GetParam("gCornerLeftTop");
        ShaderParam * uCornerRightDir = mTech->GetPixelShaderParamTable()->GetParam("gCornerRightDir");
        ShaderParam * uCornerDownDir = mTech->GetPixelShaderParamTable()->GetParam("gCornerDownDir");
        ShaderParam * uCameraPos = mTech->GetPixelShaderParamTable()->GetParam("gCameraPos");
        ShaderParam * uCausticsParam = mTech->GetPixelShaderParamTable()->GetParam("gCausticsParam");

        const Vec3 * corner = cam->GetWorldCorner();
        const Vec3 & camPos = cam->GetPosition();

        Vec3 cornerLeftTop = corner[4] - camPos;
        Vec3 cornerRightDir = corner[5] - corner[4];
        Vec3 cornerDownDir = corner[6] - corner[4];

        float waterY = 180;
        float depthLimit = 15;
        float uvScale = 0.05f;

        uCornerLeftTop->SetUnifom(cornerLeftTop.x, cornerLeftTop.y, cornerLeftTop.z, 0);
        uCornerRightDir->SetUnifom(cornerRightDir.x, cornerRightDir.y, cornerRightDir.z, 0);
        uCornerDownDir->SetUnifom(cornerDownDir.x, cornerDownDir.y, cornerDownDir.z, 0);
        uCameraPos->SetUnifom(camPos.x, camPos.y, camPos.z, 0);
        uCausticsParam->SetUnifom(waterY, depthLimit, uvScale, 0);

        SamplerState state;
        render->SetTexture(0, state,  depthTex);
        render->SetTexture(1, state,  colorTex);
        render->SetTexture(2, state,  GetTexture());

        RenderHelper::Instance()->DrawScreenQuad(BM_OPATICY, mTech);
    }
开发者ID:ak4hige,项目名称:myway3d,代码行数:35,代码来源:MWUnderWater.cpp

示例4: of

    //-----------------------------------------------------------------------
    void Root::saveConfig(void)
    {
        if (mConfigFileName.empty ())
            return;

		std::ofstream of(mConfigFileName.c_str());

        if (!of)
            OGRE_EXCEPT(Exception::ERR_CANNOT_WRITE_TO_FILE, "Cannot create settings file.",
            "Root::saveConfig");

        if (mActiveRenderer)
        {
            of << "Render System=" << mActiveRenderer->getName() << std::endl;
        }
        else
        {
            of << "Render System=" << std::endl;
        }

        for (RenderSystemList::const_iterator pRend = getAvailableRenderers()->begin(); pRend != getAvailableRenderers()->end(); ++pRend)
        {
            RenderSystem* rs = *pRend;
            of << std::endl;
            of << "[" << rs->getName() << "]" << std::endl;
            const ConfigOptionMap& opts = rs->getConfigOptions();
            for (ConfigOptionMap::const_iterator pOpt = opts.begin(); pOpt != opts.end(); ++pOpt)
            {
				of << pOpt->first << "=" << pOpt->second.currentValue << std::endl;
            }
        }

        of.close();

    }
开发者ID:venkatarajasekhar,项目名称:viper,代码行数:36,代码来源:OgreRoot.cpp

示例5: Do

	void Shadow::Do(Texture * depthTex)
	{
		RenderSystem * render = RenderSystem::Instance();

		RenderTarget * oldRt = render->GetRenderTarget(0);
		DepthStencil * oldDs = render->GetDepthStencil();

		_updateCamera();

		/*for (int i = 0; i < 4; ++i)
		{
		Mat4 matCrop = _calcuCropMatrix(i);
		mCascadedViewProjMatrix[i] = mLightCamera->GetViewProjMatrix() * matCrop;
		}*/

		_impVisibleCull();

		{
			RS_RenderEvent(ShadowMap);

			for (int i = 0; i < K_NumShadowLayers; ++i)
			{
				_calcuCascadedMatrix(i);
				_renderDepth(i);
				_genShadowMap(i, depthTex);
			}
		}

		render->SetRenderTarget(0, oldRt);
		render->SetDepthStencil(oldDs);
	}
开发者ID:ak4hige,项目名称:myway3d,代码行数:31,代码来源:MWShadow.cpp

示例6: OGRE_EXCEPT

    //---------------------------------------------------------------------
    void Viewport::setOrientationMode(OrientationMode orientationMode, bool setDefault)
    {
#if OGRE_NO_VIEWPORT_ORIENTATIONMODE != 0
        OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED,
                    "Setting Viewport orientation mode is not supported",
                    __FUNCTION__);
#endif
        mOrientationMode = orientationMode;

        if (setDefault)
        {
            setDefaultOrientationMode(orientationMode);
        }

        if (mCamera)
        {
            mCamera->setOrientationMode(mOrientationMode);
        }

    // Update the render system config
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS
        RenderSystem* rs = Root::getSingleton().getRenderSystem();
        if(mOrientationMode == OR_LANDSCAPELEFT)
            rs->setConfigOption("Orientation", "Landscape Left");
        else if(mOrientationMode == OR_LANDSCAPERIGHT)
            rs->setConfigOption("Orientation", "Landscape Right");
        else if(mOrientationMode == OR_PORTRAIT)
            rs->setConfigOption("Orientation", "Portrait");
#endif
    }
开发者ID:Ketzer2002,项目名称:meridian59-engine,代码行数:31,代码来源:OgreViewport.cpp

示例7: execute

	virtual void execute(SceneManager *sm, RenderSystem *rs)
	{
		// Fire listener
		instance->_fireNotifyMaterialRender(pass_id, mat);

        Rectangle2D * mRectangle=static_cast<Rectangle2D *>(CompositorManager::getSingleton()._getTexturedRectangle2D());
        if (mQuadCornerModified)
        {
            // insure positions are using peculiar render system offsets 
            RenderSystem* rs = Root::getSingleton().getRenderSystem();
            Viewport* vp = rs->_getViewport();
            Real hOffset = rs->getHorizontalTexelOffset() / (0.5 * vp->getActualWidth());
            Real vOffset = rs->getVerticalTexelOffset() / (0.5 * vp->getActualHeight());
            mRectangle->setCorners(mQuadLeft + hOffset, mQuadTop - vOffset, mQuadRight + hOffset, mQuadBottom - vOffset);
        }
        
		// Queue passes from mat
		Technique::PassIterator i = technique->getPassIterator();
		while(i.hasMoreElements())
		{
			sm->_injectRenderWithPass(
				i.getNext(), 
				mRectangle,
				false // don't allow replacement of shadow passes
				);
		}
	}
开发者ID:masonh,项目名称:marblemax,代码行数:27,代码来源:OgreCompositorInstance.cpp

示例8:

 //-----------------------------------------------------------------------------
 const Matrix4& AutoParamDataSource::getProjectionMatrix(void) const
 {
     if (mProjMatrixDirty)
     {
         // NB use API-independent projection matrix since GPU programs
         // bypass the API-specific handedness and use right-handed coords
         if (mCurrentRenderable && mCurrentRenderable->getUseIdentityProjection())
         {
             // Use identity projection matrix, still need to take RS depth into account.
             RenderSystem* rs = Root::getSingleton().getRenderSystem();
             rs->_convertProjectionMatrix(Matrix4::IDENTITY, mProjectionMatrix, true);
         }
         else
         {
             mProjectionMatrix = mCurrentCamera->getProjectionMatrixWithRSDepth();
         }
         if (mCurrentRenderTarget && mCurrentRenderTarget->requiresTextureFlipping())
         {
             // Because we're not using setProjectionMatrix, this needs to be done here
             // Invert transformed y
             mProjectionMatrix[1][0] = -mProjectionMatrix[1][0];
             mProjectionMatrix[1][1] = -mProjectionMatrix[1][1];
             mProjectionMatrix[1][2] = -mProjectionMatrix[1][2];
             mProjectionMatrix[1][3] = -mProjectionMatrix[1][3];
         }
         mProjMatrixDirty = false;
     }
     return mProjectionMatrix;
 }
开发者ID:wjwwood,项目名称:ogre,代码行数:30,代码来源:OgreAutoParamDataSource.cpp

示例9: Update

void ParticleEmitterSystem::Update(float32 timeElapsed)
{
	uint32 size = emitters.size();
	Vector<ParticleEmitter*> emittersToBeDeleted;

	for(uint32 i = 0; i < size; ++i)
	{
		// Yuri Coder, 2013/05/15. Visible emitters are always updated, "deferred" update
		// is called for invisible ones. See pls issue #DF-1140.
		uint32 flags = emitters[i]->GetFlags();
        if ((flags & RenderObject::VISIBILITY_CRITERIA) == RenderObject::VISIBILITY_CRITERIA)
        {
            emitters[i]->Update(timeElapsed);
        }
		else
		{
			emitters[i]->DeferredUpdate(timeElapsed);
		}

		if (emitters[i]->IsToBeDeleted())
		{
			emittersToBeDeleted.push_back(emitters[i]);
		}
	}

	for(Vector<ParticleEmitter*>::iterator it = emittersToBeDeleted.begin(); it != emittersToBeDeleted.end(); ++it)
	{
		ParticleEmitter* partEmitter = (*it);
		RenderSystem* renderSystem = partEmitter->GetRenderSystem();
	
		renderSystem->RemoveFromRender(partEmitter);
		SafeRelease(partEmitter);
	}
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例10: getScene

	void BillBoard::renderImpl( Matrix4 const& trans )
	{
		RenderSystem* system = getScene()->_getRenderSystem();

		Matrix4 mat = system->getViewMatrix();

		switch ( mBoardType )
		{
		case BT_CYLINDICAL_X:
			mat[ 0] = trans( 0 , 0 );
			mat[ 1] = trans( 0 , 1 );
			mat[ 2] = trans( 0 , 2 );
			break;
		case BT_CYLINDICAL_Y:
			mat[ 4] = trans( 1 , 0 );
			mat[ 5] = trans( 1 , 1 );
			mat[ 6] = trans( 1 , 2 );
			break;
		case BT_CYLINDICAL_Z:
			mat[ 8] = trans( 2 , 0 );
			mat[ 9] = trans( 2 , 1 );
			mat[10] = trans( 2 , 2 );
			break;
		case BT_SPHERIAL:
			break;
		}

		mat[12] = trans( 3 , 0 );
		mat[13] = trans( 3 , 1 );
		mat[14] = trans( 3 , 2 );
		mat.modifyTranslation( trans.getTranslation() );
		system->setWorldMatrix( mat );
		_renderInternal();
	}
开发者ID:uvbs,项目名称:GameProject,代码行数:34,代码来源:CFObject.cpp

示例11: glMatrixMode

bool TextureDemo::Render()
{
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	MainLoop *ml = MainLoop::Get();
	if (ml)
	{
		RenderSystem *rs = ml->RenderSys();
		if (rs)
		{
			unsigned int w = rs->screenWidth();
			unsigned int h = rs->screenHeight();
			if (w <= h)
				glOrtho(-2.0, 2.0, -2.0 * (GLfloat) h / (GLfloat) w,
					2.0 * (GLfloat) h / (GLfloat) w, -10.0, 10.0);
			else
				glOrtho(-2.0 * (GLfloat) w / (GLfloat) h,
					2.0 * (GLfloat) w / (GLfloat) h, -2.0, 2.0, -10.0, 10.0);
		}
	}

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glPushAttrib(GL_ALL_ATTRIB_BITS);
	theModel->Draw();
	glPopAttrib();

	return true;
}
开发者ID:callenm,项目名称:Bonra_Assignment2,代码行数:29,代码来源:TextureDemo.cpp

示例12: configureRenderer

/// @brief  Configures the render system ogre uses.
/// @return Returns true if a valid configuration was selected, false otherwise.
bool ServerGraphics::configureRenderer (void)
{
    // Automatically initialise with the config dialog
    //if (mRoot->showConfigDialog())
        //return true;
    //return false;

    // Manually initialise
    RenderSystem* rs = NULL;
    RenderSystemList systems = Root::getSingleton().getAvailableRenderers();

    // Check if any render systems exist
    if (systems.empty())
        return false;
    // Check if OpenGL is one of those rendering systems (should be)
    for (RenderSystemList::iterator itr = systems.begin(); itr != systems.end(); itr++)
        if (!strcmp((*itr)->getName().c_str(), "OpenGL Rendering Subsystem"))
            rs = *itr;
    // If it wasn't, default to the first renderer
    if (rs == NULL)
    {
        //OutputDebugString("OpenGL not found, defaulting to the first item.\n");
        rs = *systems.begin();
    }

    Root::getSingleton().setRenderSystem(rs);
    rs->setConfigOption("Video Mode", "640 x 480");
#ifdef _WIN32
    rs->setConfigOption("Colour Depth", "32");
#endif
    rs->setConfigOption("Full Screen", "No");
    rs->setConfigOption("FSAA", "0");

    return true;
}
开发者ID:Arkamarante,项目名称:collision-domain,代码行数:37,代码来源:ServerGraphics.cpp

示例13: mGlobalIndex

 //---------------------------------------------------------------------
 Viewport::Viewport(RenderTarget* target, Real left, Real top, Real width, Real height)
     : mGlobalIndex( -1 )
     , mTarget(target)
     , mRelLeft(left)
     , mRelTop(top)
     , mRelWidth(width)
     , mRelHeight(height)
     // Actual dimensions will update later
     , mUpdated(false)
     , mShowOverlays(true)
     , mShowSkies(true)
     , mVisibilityMask(0)
     , mRQSequence(0)
     , mMaterialSchemeName(MaterialManager::DEFAULT_SCHEME_NAME)
     , mColourBuffer(CBT_BACK)
 {           
     // Set the default orientation mode
     mOrientationMode = mDefaultOrientationMode;
         
     // Set the default material scheme
     RenderSystem* rs = Root::getSingleton().getRenderSystem();
     mMaterialSchemeName = rs->_getDefaultViewportMaterialScheme();
     
     // Calculate actual dimensions
     _updateDimensions();
 }
开发者ID:amerkoleci,项目名称:mogre,代码行数:27,代码来源:OgreViewport.cpp

示例14: OGRE_EXCEPT

	void SDLWindow::copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer)
	{
		if ((dst.left < 0) || (dst.right > mWidth) ||
			(dst.top < 0) || (dst.bottom > mHeight) ||
			(dst.front != 0) || (dst.back != 1))
		{
			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
						"Invalid box.",
						"SDLWindow::copyContentsToMemory" );
		}
	
		if (buffer == FB_AUTO)
		{
			buffer = mIsFullScreen? FB_FRONT : FB_BACK;
		}
	
		GLenum format = Ogre::GLPixelUtil::getGLOriginFormat(dst.format);
		GLenum type = Ogre::GLPixelUtil::getGLOriginDataType(dst.format);
	
		if ((format == GL_NONE) || (type == 0))
		{
			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
						"Unsupported format.",
						"SDLWindow::copyContentsToMemory" );
		}
	
		// Switch context if different from current one
		RenderSystem* rsys = Root::getSingleton().getRenderSystem();
		rsys->_setViewport(this->getViewport(0));
	
		// Must change the packing to ensure no overruns!
		glPixelStorei(GL_PACK_ALIGNMENT, 1);
	
		glReadBuffer((buffer == FB_FRONT)? GL_FRONT : GL_BACK);
		glReadPixels((GLint)dst.left, (GLint)dst.top,
					 (GLsizei)dst.getWidth(), (GLsizei)dst.getHeight(),
					 format, type, dst.data);
	
		// restore default alignment
		glPixelStorei(GL_PACK_ALIGNMENT, 4);
	
		//vertical flip
		{
			size_t rowSpan = dst.getWidth() * PixelUtil::getNumElemBytes(dst.format);
			size_t height = dst.getHeight();
			uchar *tmpData = new uchar[rowSpan * height];
			uchar *srcRow = (uchar *)dst.data, *tmpRow = tmpData + (height - 1) * rowSpan;
	
			while (tmpRow >= tmpData)
			{
				memcpy(tmpRow, srcRow, rowSpan);
				srcRow += rowSpan;
				tmpRow -= rowSpan;
			}
			memcpy(dst.data, tmpData, rowSpan * height);
	
			delete [] tmpData;
		}
	}
开发者ID:terminus510,项目名称:OgreBulletTest,代码行数:59,代码来源:OgreSDLWindow.cpp

示例15:

    //---------------------------------------------------------------------
    Viewport::~Viewport()
    {
		RenderSystem* rs = Root::getSingleton().getRenderSystem();
		if ((rs) && (rs->_getViewport() == this))
		{
			rs->_setViewport(NULL);
		}
    }
开发者ID:danyr,项目名称:gamekit,代码行数:9,代码来源:OgreViewport.cpp


注:本文中的RenderSystem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。