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


C++ IRenderable::getAppearance方法代码示例

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


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

示例1: renderImpl

/**
* renderlmpl for edge hight light and blur
* @ param IRenderSystem for set render state or texture.., SceneManger for ger render queue and so on
* @ return null
* @ flow: render target-> render state->setupStream-> setTexture-> setTechnique->begin pass->end pass
* @ author Milong.Wu 
*/
void EdgeblurPostEffect::renderImpl( IRenderSystem* pRenderSys, SceneManager* scene )
{
	if(!postEffect) 
		return;

	SceneManager * scenemgr = SUBSYSTEMX(SceneManager,ISceneManager);
	SceneRender * scenerender = scenemgr->getSceneRender(); 
	StagedForwardSceneRender *Stagescenerender=(StagedForwardSceneRender*)scenerender ;

	const RenderQueue::RenderableList& highItems =(*Stagescenerender).specialRenderQueue.getRenderableList((RenderQueueOrder)StagedForwardSceneRender::RENDER_QUEUE_HIGHLIGHT);
	if (highItems.size() <= 0)
		return ;

	uint blurRTT1 = scene->currentView->getFullRGBRTT1();
	uint blurRTT2 = scene->currentView->getFullRGBRTT2();
	float viewSizeFactor = 0.5f;

	if(blurRTT1 == 0 || blurRTT2 == 0)
		return;
	int numRendered = 0;

	uint oldTarget = pRenderSys->getCurrentRenderTarget();

	pRenderSys->setCurrentRenderTarget(blurRTT1);
    // so the unsee part can't be hightlihght
	pRenderSys->setDepthBufferCheckEnabled(true);
	pRenderSys->setDepthBufferFunction(CMP_LESSEQUAL);
	pRenderSys->setDepthBufferWriteEnabled(false);
	pRenderSys->setCullingMode(CULL_NONE);
	//setup common rendering state
	pRenderSys->clearFrameBuffer(ColorValue(0,0,0,0), 1.0f);

	setupRenderingState(pRenderSys);
	//get highlight queue
	
	int colorID = 0;
	int idCount = 0;
	FillMode oldFillMode = pRenderSys->getFillMode();
	bool highlight = false;

	for(size_t qi = 0; qi <highItems.size()  && colorID <Stagescenerender->highLights.num(); ++qi)
	{
		highlight = true;
		IRenderable *renderable = highItems[qi];
		const Appearance& appear = renderable->getAppearance();
		Appearance::Geometry  geo = appear.geometry;
		geo.indexBuffer =  appear.geometry.indexBuffer;     
		if(appear.material[eMaterial_0].renderOrder < RENDER_QUEUE_BLEND && geo.indexBuffer)
		{
			appear.geometry.setupStream(pRenderSys);
			//edgeColor and rimback_biggerFactor  are uniform values defined in this pass of edgeblur.fx (../date/shader) file
			postEffect->setupAutoParameters(renderable);
			postEffect->setVector4("edgeColor", (Vector4*)(&Stagescenerender->highLights(colorID).color));  
			ColorValue *ed = (ColorValue*)(&Stagescenerender->highLights(colorID).color);
			setupRenderingState(pRenderSys);  

			if(appear.material[eMaterial_0].numTextureUnit)
				appear.material[eMaterial_0].setTextureUnit(pRenderSys,0);
			else
				pRenderSys->setTexture(0, 0); 

			//postEffect->setupAutoParameters(renderable);
			uint iPass;
			//"Rimback" is defined in edgeblur.fx (../date/shader) file
			int macAcount=0;
			const EffectMacro *mac = postEffect->getMacros(macAcount);

			// for the weapon can not be paint, as no maco, so use a special technique
			if(geo.isSkinning())
			{
				postEffect->setTechnique("Rimback");
			}
			else{
				postEffect->setTechnique("RimbackNomaco");
			}
			postEffect->begin(&iPass);
			postEffect->beginPass(0);
			pRenderSys->drawRangeIndexedPrimitive(PT_TRIANGLES, geo.indexBuffer->getType(),geo.indexStart,geo.indexCount,geo.vertexStart,geo.vertexEnd);
			postEffect->endPass();
			postEffect->end();
			appear.geometry.resetStream(pRenderSys);
		}
		idCount++;
		if(idCount >= Stagescenerender->highLights(colorID).numRenderable)
		{
			colorID++;
			idCount = 0;
		}
	}

	if(highlight)
	{
		pRenderSys->setCurrentRenderTarget(blurRTT2);
//.........这里部分代码省略.........
开发者ID:codeAPmind,项目名称:Edgeblur,代码行数:101,代码来源:EdgeblurPostEffect.cpp


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