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


C++ LPDIRECT3DDEVICE9::SetClipPlane方法代码示例

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


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

示例1:

HRESULT HookIDirect3DDevice9::SetClipPlane(LPVOID _this, DWORD Index,CONST float* pPlane)
{
	LOG_API();
	return pD3Dev->SetClipPlane(Index, pPlane);
}
开发者ID:zxmarcos,项目名称:bg4t_monitor,代码行数:5,代码来源:D3DWrapper.cpp

示例2: Render

void Render(float alpha, float elapsedtime)
{
	static float time = 0;
	LPDIRECT3DSURFACE9 backbuffer = 0;

	D3DXMATRIX		view, proj, viewproj;
	D3DXMATRIX		world, inv;

	D3DXVECTOR4		texelsize;
	D3DXVECTOR4		lightpos(-600, 350, 1000, 1);
	D3DXVECTOR4		refllight;
	D3DXVECTOR3		eye(0, 0, -5.0f);
	D3DXVECTOR3		look(0, 1.2f, 0);
	D3DXVECTOR3		refleye, refllook;
	D3DXVECTOR3		up(0, 1, 0);
	D3DXVECTOR2		orient	= cameraangle.smooth(alpha);

	D3DXMatrixRotationYawPitchRoll(&view, orient.x, orient.y, 0);
	D3DXVec3TransformCoord(&eye, &eye, &view);
	
	eye.y += 1.2f;

	D3DXMatrixPerspectiveFovLH(&proj, D3DX_PI / 2, (float)screenwidth / (float)screenheight, 0.1f, 30);

	time += elapsedtime;

	if( SUCCEEDED(device->BeginScene()) )
	{
		device->GetRenderTarget(0, &backbuffer);

		// STEP 1: render reflection texture
		device->SetRenderTarget(0, reflectsurf);
		device->Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, 0xff6694ed, 1.0f, 0);

		D3DXPLANE plane(0, 1, 0, 1);

		refleye = eye - 2 * D3DXPlaneDotCoord(&plane, &eye) * (D3DXVECTOR3&)plane;
		refllook = look - 2 * D3DXPlaneDotCoord(&plane, &look) * (D3DXVECTOR3&)plane;

		refllight = lightpos - 2 * D3DXPlaneDot(&plane, &lightpos) * (D3DXVECTOR4&)plane;
		refllight.w = 1;

		D3DXMatrixLookAtLH(&view, &refleye, &refllook, &up);
		D3DXMatrixMultiply(&viewproj, &view, &proj);

		D3DXMatrixInverse(&inv, 0, &viewproj);
		D3DXMatrixTranspose(&inv, &inv);
		D3DXPlaneTransform(&plane, &plane, &inv);

		device->SetClipPlane(0, &plane.a);

		RenderScene(viewproj, refleye, refllight, true);

		// STEP 2: render scene (later used for refraction)
		D3DXMatrixLookAtLH(&view, &eye, &look, &up);
		D3DXMatrixMultiply(&viewproj, &view, &proj);

		device->SetRenderTarget(0, refractsurf);
		device->Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, 0xff6694ed, 1.0f, 0);

		RenderScene(viewproj, eye, lightpos, false);

		// render water surface into alpha channel for masking
		device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA);

		D3DXMatrixTranslation(&world, 0, -1, 0);

		device->SetTransform(D3DTS_WORLD, &world);
		device->SetTransform(D3DTS_VIEW, &view);
		device->SetTransform(D3DTS_PROJECTION, &proj);

		waterplane->DrawSubset(0, DXObject::Opaque);

		device->SetRenderState(D3DRS_COLORWRITEENABLE, 0x0f);

		// STEP 3: light shafts
		quadvertices[6] = quadvertices[24] = quadvertices[30]	= (float)screenwidth - 0.5f;
		quadvertices[13] = quadvertices[19] = quadvertices[31]	= (float)screenheight - 0.5f;

		RenderLightShafts(view, proj, eye, lightpos);

		// STEP 4: gamma correct
		device->SetRenderTarget(0, sceneldrsurf);

		device->SetRenderState(D3DRS_ZENABLE, FALSE);
		device->SetVertexDeclaration(quaddecl);

		bloom->SetTechnique("gammacorrect");
		bloom->Begin(0, 0);
		bloom->BeginPass(0);
		{
			device->SetTexture(0, refraction);
			device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, quadvertices, 6 * sizeof(float));
		}
		bloom->EndPass();
		bloom->End();

		device->SetRenderState(D3DRS_ZENABLE, TRUE);

		// STEP 5: water surface
//.........这里部分代码省略.........
开发者ID:JasSra,项目名称:Asylum_Tutorials,代码行数:101,代码来源:main.cpp


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