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


C++ IDriver类代码示例

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


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

示例1:

// ***************************************************************************
void			CMaterial::flushTextures (IDriver &driver, uint selectedTexture)
{
	// For each textures
	for (uint tex=0; tex<IDRV_MAT_MAXTEXTURES; tex++)
	{
		// Texture exist ?
		if (_Textures[tex])
		{
			// Select the good texture
			_Textures[tex]->selectTexture (selectedTexture);

			// Force setup texture
			driver.setupTexture (*_Textures[tex]);
		}
	}

	// If Lightmap material
	if(_ShaderType==LightMap)
	{
		// For each lightmap
		for (uint lmap=0; lmap<_LightMaps.size(); lmap++)
		{
			// Texture exist?
			if(_LightMaps[lmap].Texture)
			{
				// Force setup texture
				driver.setupTexture (*_LightMaps[lmap].Texture);
			}
		}
	}

}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:33,代码来源:material.cpp

示例2: _tmain1

int _tmain1(int argc, _TCHAR* argv[])
{
    //Client
    IDriver* pMyDriver = new BenzDriver();
    ISportCar* pMyCar = pMyDriver->SportCarDriver();
    pMyCar->run();

    getchar();
	return 0;
}
开发者ID:ircc,项目名称:test-code-backup,代码行数:10,代码来源:abstactfactory.cpp

示例3: Render

void WaterManager::Render( IDriver& driver, TerrainManager* world )
{
	if( m_isRender )
	{
		RenderTarget* now = driver.PopRenderTarget( );
		driver.PushRenderTarget( m_Refraction );
		driver.Clear( IDriver::COLOR_BUFFER | IDriver::DEPTH_BUFFER | IDriver::STENCIL_BUFFER );
		world->Render( driver );
		driver.PopRenderTarget( );
		driver.PushRenderTarget( now );
	}
}
开发者ID:RichardOpenGL,项目名称:Bohge_Engine,代码行数:12,代码来源:WaterManager.cpp

示例4: update

//*******************************************************************************
void CWaterEnvMap::update(TGlobalAnimationTime time, IDriver &driver)
{
	if (_LastRenderTime == time) return;
	_LastRenderTime = time;
	// First five updates are used to render the cubemap faces (bottom face is not rendered)
	// Sixth update project the cubemap into a 2D texture
	uint numTexToRender;
	if (_UpdateTime > 0)
	{
		uint64 currRenderTick = (uint64) (time / (_UpdateTime / (NUM_FACES_TO_RENDER + 1)));
		numTexToRender = (uint) (currRenderTick - _LastRenderTick);
		_LastRenderTick = currRenderTick;
	}
	else
	{
		numTexToRender = NUM_FACES_TO_RENDER + 1;
	}
	if (!numTexToRender) return;
	if (_NumRenderedFaces == 0)
	{
		_StartRenderTime = time;
	}
	uint lastCubeFacesToRender = std::min((uint) NUM_FACES_TO_RENDER, _NumRenderedFaces + numTexToRender); // we don't render negative Z (only top hemisphere is used)
	for(uint k = _NumRenderedFaces; k < lastCubeFacesToRender; ++k)
	{
		driver.setRenderTarget(_EnvCubic, 0, 0, _EnvCubicSize, _EnvCubicSize, 0, (uint32) k);
		render((CTextureCube::TFace) k, _StartRenderTime);
	}
	_NumRenderedFaces = lastCubeFacesToRender;
	if (_NumRenderedFaces == NUM_FACES_TO_RENDER && (_NumRenderedFaces + numTexToRender) > NUM_FACES_TO_RENDER)
	{
		// render to 2D map
		driver.setRenderTarget(_Env2D, 0, 0, _Env2DSize, _Env2DSize);
		doInit();
		//
		driver.activeVertexProgram(NULL);
		driver.activeVertexBuffer(_FlattenVB);
		driver.activeIndexBuffer(_FlattenIB);
		driver.setFrustum(-1.f, 1.f, -1.f, 1.f, 0.f, 1.f, false);
		driver.setupViewMatrix(CMatrix::Identity);
		CMatrix mat;
		//mat.scale(0.8f);
		driver.setupModelMatrix(mat);
		_MaterialPassThru.setTexture(0, _EnvCubic);
		_MaterialPassThru.texConstantColor(0, CRGBA(255, 255, 255, _Alpha));
		driver.renderTriangles(_MaterialPassThru, 0, FVB_NUM_TRIS);
		_NumRenderedFaces = 0; // start to render again
	}
	driver.setRenderTarget(NULL);
}
开发者ID:mixxit,项目名称:solinia,代码行数:51,代码来源:water_env_map.cpp

示例5: doInit

//*******************************************************************************
void CWaterEnvMap::renderTestMesh(IDriver &driver)
{
	doInit();
	CMaterial testMat;
	testMat.setLighting(false);
	testMat.texEnvOpRGB(0, CMaterial::Modulate);
	testMat.texEnvArg0RGB(0, CMaterial::Texture, CMaterial::SrcColor);
	testMat.texEnvArg0RGB(1, CMaterial::Diffuse, CMaterial::SrcColor);
	testMat.texEnvOpAlpha(0, CMaterial::Replace);
	testMat.texEnvArg0Alpha(0, CMaterial::Constant, CMaterial::SrcAlpha);
	testMat.texConstantColor(0, CRGBA(255, 255, 255, 255));
	testMat.setDoubleSided(true);
	testMat.setZWrite(false);
	testMat.setZFunc(CMaterial::always);
	// tmp : test cubemap
	driver.activeVertexProgram(&testMeshVP);
	driver.activeVertexBuffer(_TestVB);
	driver.activeIndexBuffer(_TestIB);
	driver.setConstantMatrix(0, IDriver::ModelViewProjection, IDriver::Identity); // tmp
	_MaterialPassThruZTest.setTexture(0, _EnvCubic);
	driver.setConstantMatrix(0, IDriver::ModelViewProjection, IDriver::Identity);
	driver.setConstant(4, 2.f, 1.f, 0.f, 0.f);
	//driver.renderTriangles(testMat, 0, TEST_VB_NUM_TRIS);
	driver.renderTriangles(_MaterialPassThruZTest, 0, TEST_VB_NUM_TRIS);
	driver.activeVertexProgram(NULL);
}
开发者ID:mixxit,项目名称:solinia,代码行数:27,代码来源:water_env_map.cpp

示例6: OnBeginUpdate

//-------------------------------------------------------------------------------------------------------
void WaterManager::OnBeginUpdate( IDriver& driver )
{
	m_isRender = false;
	Frustumf frustum = driver.GetCamera().GetFrustum();
	for ( WaterMeshes::iterator it = m_WaterDatas.begin();
		it != m_WaterDatas.end();
		it ++ )
	{
		if( frustum.Intersect( (*it)->BindBox() ) )
		{
			m_isRender = true;
			if( m_LastTileIndex != (*it)->GetIndex() )
			{
				m_LastTileIndex = (*it)->GetIndex();
				m_MiddleHeight = (*it)->GetWaterParameter().get_float( p_fWaterBaseHeight );
				m_pWater->WaterSurface( (*it)->GetMaterial(), (*it)->GetWaterParameter() );
			}
			break;
		}
	}
	if( m_isRender )
	{
		m_pWater->OnBeginUpdate( driver );
	}
}
开发者ID:RichardOpenGL,项目名称:Bohge_Engine,代码行数:26,代码来源:WaterManager.cpp

示例7: while

//++ ------------------------------------------------------------------------------------
// Details:	Unregister all the Driver registered with *this manager. The manager also
//			deletes
// Type:	Method.
// Args:	None.
// Return:	MIstatus::success - Functional succeeded.
//			MIstatus::failure - Functional failed.
// Throws:	None.
//--
bool CMIDriverMgr::UnregisterDriverAll( void )
{
	MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.begin();
	while( it != m_mapDriverIdToDriver.end() )
	{
		IDriver * pDriver = (*it).second;
		pDriver->DoShutdown();
		
		// Next
		++it;
	}

	m_mapDriverIdToDriver.clear();
	m_pDriverCurrent = NULL;

	return MIstatus::success;
}
开发者ID:chee-z,项目名称:lldb,代码行数:26,代码来源:MIDriverMgr.cpp

示例8: RegisterDriver

//++ ------------------------------------------------------------------------------------
// Details:	Register a driver with *this Driver Manager. Call SetUseThisDriverToDoWork()
//			inform the manager which driver is the one to the work. The manager calls
//			the driver's init function which must be successful in order to complete the
//			registration.
// Type:	Method.
// Args:	vrDriver	- (R) The driver to register.
//			vrDriverID	- (R) The driver's ID to lookup by.
// Return:	MIstatus::success - Functional succeeded.
//			MIstatus::failure - Functional failed.
// Throws:	None.
//--
bool CMIDriverMgr::RegisterDriver( const IDriver & vrDriver, const CMIUtilString & vrDriverID )
{
	if( HaveDriverAlready( vrDriver ) )
		return MIstatus::success;

	IDriver * pDriver = const_cast< IDriver * >( &vrDriver );
	if( !pDriver->SetId( vrDriverID ) )
		return MIstatus::failure;
	if( !pDriver->DoInitialize() )
	{
		SetErrorDescriptionn( MIRSRC( IDS_DRIVERMGR_DRIVER_ERR_INIT ), pDriver->GetName().c_str(), vrDriverID.c_str(), pDriver->GetError().c_str() );
		return MIstatus::failure;
	}

	MapPairDriverIdToDriver_t pr( vrDriverID, pDriver );
	m_mapDriverIdToDriver.insert( pr );

	return MIstatus::success;
}
开发者ID:chee-z,项目名称:lldb,代码行数:31,代码来源:MIDriverMgr.cpp

示例9:

//***************************************************************************************************************
void				CFlareShape::flushTextures (IDriver &driver, uint selectedTexture)
{
	// Flush each texture
	for (uint tex=0; tex<MaxFlareNum; tex++)
	{
		if (_Tex[tex] != NULL)
		{
			// Select the good texture
			_Tex[tex]->selectTexture (selectedTexture);

			// Flush texture
			driver.setupTexture (*_Tex[tex]);
		}
	}
}
开发者ID:mixxit,项目名称:solinia,代码行数:16,代码来源:flare_shape.cpp

示例10: isSupportedByDriver

// ***************************************************************************
bool CMaterial::isSupportedByDriver(IDriver &drv, bool forceBaseCaps) const
{
	uint numTexStages = drv.getNbTextureStages();
	// special case for radeon : though 3 stages are supported, do as if there were only 2, because of the texEnvColor feature
	// not managed in Direct3D : emulation is provided, but for no more than 2 constants (and if diffuse is not used)
	if (numTexStages == 3) numTexStages = 2;
	if (forceBaseCaps) numTexStages = std::min(numTexStages, (uint) 2);
	switch(getShader())
	{
		case Normal:
		{
			if (getNumUsedTextureStages() > numTexStages) return false;
			// see if each tex env is supported
			for(uint k = 0; k < IDRV_MAT_MAXTEXTURES; ++k)
			{
				if (getTexture(k))
				{
					switch(getTexEnvOpRGB(k))
					{
						case InterpolateConstant: if (!drv.supportBlendConstantColor()) return false;
						case EMBM:				  if (forceBaseCaps || !drv.supportEMBM() || !drv.isEMBMSupportedAtStage(k)) return false;
						case Mad:				  if (!drv.supportMADOperator()) return false;
						default: break;
					}
					switch(getTexEnvOpAlpha(k))
					{
						case InterpolateConstant: if (!drv.supportBlendConstantColor()) return false;
						case EMBM:				  if (forceBaseCaps || !drv.supportEMBM() || !drv.isEMBMSupportedAtStage(k)) return false;
						case Mad:				  if (!drv.supportMADOperator()) return false;
						default: break;
					}
				}
			}
			return true;
		}
		break;
		case Bump:					return false; // not impl.
		case UserColor:				return true;
		case LightMap:				return true;
		case Specular:				return true;
		case Caustics:				return false;
		case PerPixelLighting:		 return drv.supportPerPixelLighting(true);
		case PerPixelLightingNoSpec: return drv.supportPerPixelLighting(false);
		case Cloud:					return true;
		case Water:					return true;
		default:
			nlassert(0); // unknown shader, must complete
	}
	return false;
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:51,代码来源:material.cpp

示例11: init

//*******************************************************************************
void CWaterEnvMap::init(uint cubeMapSize, uint projection2DSize, TGlobalAnimationTime updateTime, IDriver &driver)
{
	// Allocate cube map
	// a cubic texture with no sharing allowed
	class CTextureCubeUnshared : public CTextureCube
	{
	public:
		virtual bool supportSharing() const {return false;}
		virtual uint32 getWidth(uint32 numMipMap = 0) const
		{
			nlassert(numMipMap == 0);
			return Size;
		}
		virtual uint32 getHeight(uint32 numMipMap = 0) const
		{
			nlassert(numMipMap == 0);
			return Size;
		}
		uint32 Size;
	};
	// a 2D testure
	class CTexture2DUnshared : public CTextureBlank
	{
	public:
		virtual bool supportSharing() const {return false;}
		virtual uint32 getWidth(uint32 numMipMap = 0) const
		{
			nlassert(numMipMap == 0);
			return Size;
		}
		virtual uint32 getHeight(uint32 numMipMap = 0) const
		{
			nlassert(numMipMap == 0);
			return Size;
		}
		uint32 Size;
	};
	nlassert(cubeMapSize > 0);
	nlassert(NLMISC::isPowerOf2(cubeMapSize));
	nlassert(projection2DSize > 0);
	nlassert(NLMISC::isPowerOf2(projection2DSize));
	CTextureCubeUnshared *envCubic = new CTextureCubeUnshared;
	_EnvCubic = envCubic;
	_EnvCubic->setRenderTarget(true); // we will render to the texture
	_EnvCubic->setWrapS(ITexture::Clamp);
	_EnvCubic->setWrapT(ITexture::Clamp);
	_EnvCubic->setFilterMode(ITexture::Linear, ITexture::LinearMipMapOff);
	CTexture2DUnshared *tb = new CTexture2DUnshared;
	tb->resize(cubeMapSize, cubeMapSize); // Unfortunately,  must allocate memory in order for the driver to figure out the size
	                                      // that it needs to allocate for the texture, though its datas are never used (it is a render target)
	tb->Size = cubeMapSize;
	tb->setFilterMode(ITexture::Linear, ITexture::LinearMipMapOff);
	for(uint k = 0; k < 6; ++k)
	{
		_EnvCubic->setTexture((CTextureCube::TFace) k, tb);
		_EnvCubic->getTexture((CTextureCube::TFace) k)->setRenderTarget(true);
	}
	envCubic->Size = cubeMapSize;
	// setup the texture to force the driver to allocate vram for it
	driver.setupTexture(*_EnvCubic);
	tb->reset();
	// Allocate projection 2D map
	CTexture2DUnshared *env2D = new CTexture2DUnshared;
	_Env2D = env2D;
	_Env2D->resize(projection2DSize, projection2DSize);
	env2D->Size = projection2DSize;
	_Env2D->setWrapS(ITexture::Clamp);
	_Env2D->setWrapT(ITexture::Clamp);
	_Env2D->setRenderTarget(true); // we will render to the texture
	_Env2D->setFilterMode(ITexture::Linear, ITexture::LinearMipMapOff);
	driver.setupTexture(*_Env2D); // allocate vram
	_Env2D->reset();
	_UpdateTime = updateTime;
	_LastRenderTime = -1;
	invalidate();
	_NumRenderedFaces = 0;
	_EnvCubicSize = cubeMapSize;
	_Env2DSize = projection2DSize;
}
开发者ID:mixxit,项目名称:solinia,代码行数:80,代码来源:water_env_map.cpp

示例12: tempDumpColPolys

// TMP TMP
void tempDumpColPolys()
{
	CPackedWorld *pw = R2::getEditor().getIslandCollision().getPackedIsland();
	if (pw)
	{
		static CMaterial material;
		static CMaterial wiredMaterial;
		static CMaterial texturedMaterial;
		static CVertexBuffer vb;
		static bool initDone = false;
		if (!initDone)
		{
			vb.setVertexFormat(CVertexBuffer::PositionFlag);
			vb.setPreferredMemory(CVertexBuffer::AGPVolatile, false);
			material.initUnlit();
			material.setDoubleSided(true);
			material.setZFunc(CMaterial::lessequal);
			wiredMaterial.initUnlit();
			wiredMaterial.setDoubleSided(true);
			wiredMaterial.setZFunc(CMaterial::lessequal);
			wiredMaterial.setColor(CRGBA(255, 255, 255, 250));
			wiredMaterial.texEnvOpAlpha(0, CMaterial::Replace);
			wiredMaterial.texEnvArg0Alpha(0, CMaterial::Diffuse, CMaterial::SrcAlpha);
			wiredMaterial.setBlend(true);
			wiredMaterial.setBlendFunc(CMaterial::srcalpha, CMaterial::invsrcalpha);
			texturedMaterial.initUnlit();
			texturedMaterial.setDoubleSided(true);
			texturedMaterial.setZFunc(CMaterial::lessequal);
			initDone = true;
		}
		// just add a projected texture
		R2::getEditor().getIslandCollision().loadEntryPoints();
		R2::CScenarioEntryPoints &sep = R2::CScenarioEntryPoints::getInstance();
		CVectorD playerPos = UserEntity->pos();
		R2::CScenarioEntryPoints::CCompleteIsland *island = sep.getCompleteIslandFromCoords(CVector2f((float) playerPos.x, (float) playerPos.y));
		static CSString currIsland;
		if (island && island->Island != currIsland)
		{
			currIsland = island->Island;
			CTextureFile *newTex = new CTextureFile(currIsland + "_sp.tga");
			newTex->setWrapS(ITexture::Clamp);
			newTex->setWrapT(ITexture::Clamp);
			texturedMaterial.setTexture(0, newTex);
			texturedMaterial.texEnvOpRGB(0, CMaterial::Replace);
			texturedMaterial.texEnvArg0RGB(0, CMaterial::Texture, CMaterial::SrcColor);
			texturedMaterial.setTexCoordGen(0, true);
			texturedMaterial.setTexCoordGenMode(0, CMaterial::TexCoordGenObjectSpace);
			CMatrix mat;
			CVector scale((float) (island->XMax -  island->XMin),
						  (float) (island->YMax -  island->YMin), 0.f);
			scale.x = 1.f / favoid0(scale.x);
			scale.y = 1.f / favoid0(scale.y);
			scale.z = 0.f;
			mat.setScale(scale);
			mat.setPos(CVector(- island->XMin * scale.x, - island->YMin * scale.y, 0.f));
			//
			CMatrix uvScaleMat;
			//
			uint texWidth = (uint) (island->XMax -  island->XMin);
			uint texHeight = (uint) (island->YMax -  island->YMin);
			float UScale = (float) texWidth / 	raiseToNextPowerOf2(texWidth);
			float VScale = (float) texHeight / raiseToNextPowerOf2(texHeight);
			//
			uvScaleMat.setScale(CVector(UScale, - VScale, 0.f));
			uvScaleMat.setPos(CVector(0.f, VScale, 0.f));
			//
			texturedMaterial.enableUserTexMat(0, true);
			texturedMaterial.setUserTexMat(0, uvScaleMat * mat);
		}
		const CFrustum &frust = MainCam.getFrustum();

		//
		IDriver *driver = ((CDriverUser  *) Driver)->getDriver();

		driver->enableFog(true);
		const CRGBA clearColor = CRGBA(0, 0, 127, 0);
		driver->setupFog(frust.Far * 0.8f, frust.Far, clearColor);
		CViewport vp;
		vp.init(0.f, 0.f, 1.f, 1.f);
		driver->setupViewport(vp);
		CScissor scissor;
		viewportToScissor(vp, scissor);
		driver->setupScissor(scissor);
		//
		driver->setFrustum(frust.Left, frust.Right, frust.Bottom, frust.Top, frust.Near, frust.Far, frust.Perspective);
		driver->setupViewMatrix(MainCam.getMatrix().inverted());
		driver->setupModelMatrix(CMatrix::Identity);
		//
		//
		const CVector localFrustCorners[8] =
		{
			CVector(frust.Left, frust.Near, frust.Top),
			CVector(frust.Right, frust.Near, frust.Top),
			CVector(frust.Right, frust.Near, frust.Bottom),
			CVector(frust.Left, frust.Near, frust.Bottom),
			CVector(frust.Left  * frust.Far / frust.Near, frust.Far, frust.Top * frust.Far / frust.Near),
			CVector(frust.Right * frust.Far / frust.Near, frust.Far, frust.Top * frust.Far / frust.Near),
			CVector(frust.Right * frust.Far / frust.Near, frust.Far, frust.Bottom * frust.Far / frust.Near),
			CVector(frust.Left  * frust.Far / frust.Near, frust.Far, frust.Bottom * frust.Far / frust.Near)
//.........这里部分代码省略.........
开发者ID:sythaeryn,项目名称:pndrpg,代码行数:101,代码来源:main_loop_temp.cpp

示例13: vector2f

//-------------------------------------------------------------------------------------------------------
void BloomPS::Process(IDriver& driver, const RenderTarget* const org, const RenderTarget* const scene, RenderTarget* const out, bool& isSwitch)
{
	float Range = 2; //控制模糊度

	//降采样
	//driver.PushRenderTarget(m_pDownSimple_1);
	//driver.Clear( IDriver::COLOR_BUFFER );
	//QuadShader& qs = driver.GetShaderManage().GetShader<QuadShader>(ShaderManage::QuadShader);
	//driver.Draw( *m_pRendBuffer, qs, scene->GetColorBuffer() );
	//driver.PopRenderTarget();

	//流明化
	driver.PushRenderTarget(m_pDownSimple_1);
	driver.Clear( IDriver::COLOR_BUFFER );
	Luminance& le = driver.GetShaderManage().GetShader<Luminance>(ShaderManage::Luminance);
	driver.Draw( *m_pRendBuffer, le, scene->GetColorBuffer() );
	driver.PopRenderTarget();

	//x方向模糊
	driver.PushRenderTarget(m_pDownSimple_2);
	driver.Clear( IDriver::COLOR_BUFFER );
	Gaussian& gauss = driver.GetShaderManage().GetShader<Gaussian>(ShaderManage::Gaussian);
	gauss.SetParamStep( vector2f( Range / m_pDownSimple_1->GetSize().m_x, 0.0f ) );
	driver.Draw( *m_pRendBuffer, gauss, m_pDownSimple_1->GetColorBuffer() );
	driver.PopRenderTarget();

	//y方向模糊
	driver.PushRenderTarget(m_pDownSimple_1);
	driver.Clear( IDriver::COLOR_BUFFER );
	gauss.SetParamStep( vector2f( 0.0f, Range / m_pDownSimple_2->GetSize().m_y ) );
	driver.Draw( *m_pRendBuffer, gauss, m_pDownSimple_2->GetColorBuffer() );
	driver.PopRenderTarget();

	driver.PushRenderTarget( out );//如果画在了输出上面,则需要更换输出,下一个pe就用另外一张rt
	isSwitch = true;
	driver.Clear( IDriver::COLOR_BUFFER );
	//if( 0 )
	{
		driver.EnableAlphaBlend(IDriver::BL_SRC_ALPHA, IDriver::BL_ONE_MINUS_SRC_ALPHA, IDriver::BL_SRC_ALPHA, IDriver::BL_ONE_MINUS_SRC_ALPHA );
		Combine& ce = driver.GetShaderManage().GetShader<Combine>(ShaderManage::Combine);
		ce.SetParamOrginial( scene->GetColorBuffer() );
		ce.SetParamSecen( m_pDownSimple_1->GetColorBuffer() );
		ce.SetParamOrginialWeight(1.0f);
		ce.SetParamSecenWeight(0.0f);//was 0.75
		driver.Draw( *m_pRendBuffer, ce, NULL );
	}
	//else
	//{
	//	QuadShader& qs = driver.GetShaderManage().GetShader<QuadShader>(ShaderManage::QuadShader);
	//	driver.Draw( *m_pRendBuffer, qs, m_pDownSimple_1->GetColorBuffer() );
	//	//driver.Draw( *m_pRendBuffer, ui, org->GetDepthBuffer() );
	//}
	driver.PopRenderTarget( );
}
开发者ID:RichardOpenGL,项目名称:Bohge_Engine,代码行数:55,代码来源:BloomPS.cpp

示例14: buildScene

void CExportNel::buildScene (NL3D::CScene &scene, NL3D::CShapeBank &shapeBank, IDriver &driver, TimeValue tvTime, 
							 NL3D::CLandscape *landscape, IProgress *progress, bool buildHidden, 
							 bool onlySelected, bool buildLods)
{
	// Register classes
	// done in dllentry registerSerial3d ();

	CScene::registerBasics ();

	// Get node count
	int nNumNode=_Ip->GetRootNode ()->NumberOfChildren ();
	int nNbMesh=0;

	// *******************
	// * Then, build Mesh shapes
	// *******************

	// Prepare ig export.
	std::vector<INode*>						igVectNode;
	std::map<std::string, NL3D::IShape *>	igShapeMap;

	// SunDirection.
	NLMISC::CVector							igSunDirection(0, 1, -1);

	// SunColor.
	NLMISC::CRGBA							igSunColor(255, 255, 255);
	SLightBuild								sgLightBuild;

	// Build Mesh Shapes.
	_Options.FeedBack = progress;
	nNbMesh = 0;

	// View all selected objects
	int nNode;
	for (nNode=0; nNode<nNumNode; nNode++)
	{
		// Get the node
		INode* pNode=_Ip->GetRootNode ()->GetChildNode (nNode);
		if ( (!pNode->IsHidden () || buildHidden) && (pNode->Selected () || !onlySelected) )
		{
			string sTmp = "Object Name: ";
			sTmp += pNode->GetName();
			if (progress)
				progress->setLine (0, sTmp);
			sTmp = "";
			for (uint32 i = 1; i < 10; ++i) 
			{
				if (progress)
					progress->setLine (i, sTmp);
			}
			sTmp = "Last Error";
			if (progress)
			{
				progress->setLine (10, sTmp);
				progress->update();
			}
			
			// It is a zone ?
			if (RPO::isZone (*pNode, tvTime) && landscape)
			{
				// Get a Object pointer
				ObjectState os=pNode->EvalWorldState(_Ip->GetTime()); 

				// Ok ?
				if (os.obj)
				{
					// Convert in 3ds NeL patch mesh
					RPO *tri = (RPO *) os.obj->ConvertToType(_Ip->GetTime(), RYKOLPATCHOBJ_CLASS_ID);
					if (tri)
					{
						CZone zone;
						CZoneSymmetrisation	sym;
						static int zoneId = 0;
						if (tri->rpatch->exportZone (pNode, &tri->patch, zone, sym, zoneId++, 160, 1, false))
							landscape->addZone (zone);
					}
				}
			}
			// Try to export a mesh
			else if (CExportNel::isMesh (*pNode, tvTime))
			{
				// Build skined ?
				bool skined=false;
				++nNbMesh;
				
				// Skinning ?
				if (CExportNel::isSkin (*pNode))
				{
					// todo: skinning export
				}
				
				// Build skined ?
				if (!skined)
				{
					// Is it an accelerator ?
					if ((CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_ACCEL, 32)&3) == 0)
					{
						// Export the shape
						IShape *pShape = NULL;
						pShape=buildShape (*pNode, tvTime, NULL, buildLods);
//.........这里部分代码省略.........
开发者ID:mixxit,项目名称:solinia,代码行数:101,代码来源:export_scene.cpp

示例15: nlassert

void CFXAA::applyEffect()
{
	if (!m_PP)
		return;

	CDriverUser *dru = static_cast<CDriverUser *>(m_Driver);
	IDriver *drv = dru->getDriver();

	// backup
	bool fogEnabled = m_Driver->fogEnabled();
	m_Driver->enableFog(false);

	NL3D::ITexture *renderTarget = drv->getRenderTarget();
	nlassert(renderTarget);
	nlassert(renderTarget->isBloomTexture());

	uint width = renderTarget->getWidth();
	uint height = renderTarget->getHeight();
	bool mode2D = static_cast<CTextureBloom *>(renderTarget)->isMode2D();
	nlassert(renderTarget->getUploadFormat() == ITexture::Auto);

	float fwidth = (float)width;
	float fheight = (float)height;
	float pwidth = 1.0f / fwidth;
	float pheight = 1.0f / fheight;
	float hpwidth = pwidth * 0.5f;
	float hpheight = pheight * 0.5f;
	float n = 0.5f;

	//if (width != m_Width || height != m_Height)
	/*{
		// Build VB
		m_Width = width;
		m_Height = height;
		CVertexBufferReadWrite vba;
		m_VB.lock(vba);
		vba.setValueFloat3Ex(CVertexBuffer::Position, 0, 0.f, 0.f, 0.5f); // BL
		vba.setValueFloat3Ex(CVertexBuffer::Position, 1, 1.f, 0.f, 0.5f); // BR
		vba.setValueFloat3Ex(CVertexBuffer::Position, 2, 1.f, 1.f, 0.5f); // TR
		vba.setValueFloat3Ex(CVertexBuffer::Position, 3, 0.f, 1.f, 0.5f); // TL
		vba.setValueFloat2Ex(CVertexBuffer::TexCoord0, 0, 0.f, 0.f);
		vba.setValueFloat2Ex(CVertexBuffer::TexCoord0, 1, 1.f, 0.f);
		vba.setValueFloat2Ex(CVertexBuffer::TexCoord0, 2, 1.f, 1.f);
		vba.setValueFloat2Ex(CVertexBuffer::TexCoord0, 3, 0.f, 1.f);
		vba.setValueFloat4Ex(CVertexBuffer::TexCoord1, 0, 0.f - hpwidth, 0.f - hpheight, 0.f + hpwidth, 0.f + hpheight);
		vba.setValueFloat4Ex(CVertexBuffer::TexCoord1, 1, 1.f - hpwidth, 0.f - hpheight, 1.f + hpwidth, 0.f + hpheight);
		vba.setValueFloat4Ex(CVertexBuffer::TexCoord1, 2, 1.f - hpwidth, 1.f - hpheight, 1.f + hpwidth, 1.f + hpheight);
		vba.setValueFloat4Ex(CVertexBuffer::TexCoord1, 3, 0.f - hpwidth, 1.f - hpheight, 0.f + hpwidth, 1.f + hpheight);
	}*/

	// create render target
	CTextureUser *otherRenderTarget = m_Driver->getRenderTargetManager().getRenderTarget(width, height, mode2D);

	// swap render target
	CTextureUser texNull;
	dru->setRenderTarget(texNull);
	drv->swapTextureHandle(*renderTarget, *otherRenderTarget->getITexture());
	drv->setRenderTarget(renderTarget);
	m_Driver->setMatrixMode2D11();

	// debug
	// m_Driver->clearBuffers(CRGBA(128, 128, 128, 128));

	// activate program
	bool vpok = drv->activeVertexProgram(m_VP);
	nlassert(vpok);
	bool ppok = drv->activePixelProgram(m_PP);
	nlassert(ppok);
	/*drv->setUniform4f(IDriver::PixelProgram, 0, -n / fwidth, -n / fheight, n / fwidth, n / fheight); // fxaaConsoleRcpFrameOpt
	drv->setUniform4f(IDriver::PixelProgram, 1, -2.0f / fwidth, -2.0f / fheight, 2.0f / fwidth, 2.0f / fheight); // fxaaConsoleRcpFrameOpt2*/
	drv->setUniform2f(IDriver::PixelProgram, 0, 1.0f / fwidth, 1.0f / fheight); // fxaaQualityRcpFrame
	drv->setUniform1f(IDriver::PixelProgram, 1, 0.75f); // fxaaQualitySubpix
	drv->setUniform1f(IDriver::PixelProgram, 2, 0.166f); // fxaaQualityEdgeThreshold
	drv->setUniform1f(IDriver::PixelProgram, 3, 0.0833f); // fxaaQualityEdgeThresholdMin
	drv->setUniformMatrix(IDriver::VertexProgram, 0, IDriver::ModelViewProjection, IDriver::Identity);
	// drv->setUniform4f(IDriver::VertexProgram, 9, -hpwidth, -hpheight, hpwidth, hpheight);

	// render effect
	m_Mat.getObjectPtr()->setTexture(0, otherRenderTarget->getITexture());
	/*drv->activeVertexBuffer(m_VB);
	drv->renderRawQuads(*m_Mat.getObjectPtr(), 0, 1);*/
	m_Driver->drawQuad(m_QuadUV, m_Mat);
	m_Mat.getObjectPtr()->setTexture(0, NULL);

	// deactivate program
	drv->activeVertexProgram(NULL);
	drv->activePixelProgram(NULL);

	// restore
	m_Driver->enableFog(fogEnabled);

	// recycle render target
	m_Driver->getRenderTargetManager().recycleRenderTarget(otherRenderTarget);
}
开发者ID:junhuac,项目名称:ryzomcore,代码行数:94,代码来源:fxaa.cpp


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