コード例 #1
0
ファイル: win_main.cpp プロジェクト: jiangguang5201314/ZNginx
void Combined()
{
    // Begin rendering the Sobel Filter along the X-axis
    gRenderTarget.begin(&gBlurTexture2);
    gRenderTarget.clear(D3DCOLOR_XRGB(255, 255, 255));

    // Select unfiltered render target to the left side of the screen
    gDiffTex.select();
    g3D->renderSAQ(0, 0, 256, 256, "GuassianBlurVert");

    gRenderTarget.end(); // Finish rendering to the shadow map

    // Begin rendering the Sobel Filter along the Y-axis
    gRenderTarget.begin(&gBlurTexture1);

    gRenderTarget.clear(D3DCOLOR_XRGB(255, 255, 255));

    // Select unfiltered render target to the left side of the screen
    gBlurTexture2.select();
    g3D->renderSAQ(0, 0, 256, 256, "GuassianBlurHorz");

    gRenderTarget.end(); // Finish rendering to the shadow map

    ////// Sobel

    // Begin rendering the Sobel Filter along the X-axis
    gRenderTarget.begin(&gBlurTexture2);
    gRenderTarget.clear(D3DCOLOR_XRGB(255, 255, 255));

    // Select unfiltered render target to the left side of the screen
    gBlurTexture1.select();
    g3D->renderSAQ(0, 0, 256, 256, "SobelFilter");

    gRenderTarget.end(); // Finish rendering to the shadow map
}
コード例 #2
0
ファイル: win_main.cpp プロジェクト: 88er/tutorials
void RenderShadowMap()
{
	D3DXMATRIX wMat; // world matrix for each object we want to render
	
	// Begin rendering to the shadow map texture
	gRenderTarget.begin(&gShadowMap);
	gRenderTarget.clear(D3DCOLOR_XRGB(255, 255, 255));
	
	D3DXMATRIXA16 viewMat;
	D3DXVECTOR3 target(0.0f, 0.0f, 0.0f); // Point where light is focused
	D3DXVECTOR3 up(0.0f, 1.0f, 0.0f); // World's up vector
	
	// Create view matrix for light
	// **NOTE** It is very important to remember that we are treating the light as
	// a point light when rendering the objects, but for shadow casting, we are 
	// assuming the light is always shining towards (0,0,0).  Keep that in mind when thinking about
	// if the shadows look correct or not.
	D3DXMatrixLookAtLH(&viewMat, &gLightPos, &target, &up);
	
	// Set the view matrix of the light
	g3D->mShader->SetFloatArray("gLightViewMat", &viewMat._11, 16);	
	
	// Set world matrix of box and render
	D3DXMatrixTranslation(&wMat, kBoxPos.x, kBoxPos.y, kBoxPos.z);
	g3D->setWorldMatrix(&wMat);
	g3D->render("ShadowMap", gBox);
	
	// Set world matrix of sphere and render
	D3DXMatrixTranslation(&wMat, kSherePos.x, kSherePos.y, kSherePos.z);
	g3D->setWorldMatrix(&wMat);
	g3D->render("ShadowMap", gSphere);
		
	gRenderTarget.end(); // Finish rendering to the shadow map
}
コード例 #3
0
ファイル: win_main.cpp プロジェクト: jiangguang5201314/ZNginx
void RenderSobelFilter()
{
    // Begin rendering the Sobel Filter along the X-axis
    gRenderTarget.begin(&gBlurTexture2);
    gRenderTarget.clear(D3DCOLOR_XRGB(255, 255, 255));

    // Select unfiltered render target to the left side of the screen
    gDiffTex.select();
    g3D->renderSAQ(0, 0, 256, 256, "SobelFilter");

    gRenderTarget.end(); // Finish rendering to the shadow map
}