예제 #1
0
bool D3DRendererImpl::resize(
    Renderer *renderer,
    XD3DSwapChainImpl *impl,
    xuint32 w,
    xuint32 h,
    xuint32 rotation)
  {
  // clear the state.
  clearRenderTarget();
  _d3dContext->ClearState();
  _d3dContext->Flush();

  impl->resize(renderer, _d3dDevice.Get(), _window, _handle, w, h, rotation);

  // Set the rendering viewport to target the entire window.
  CD3D11_VIEWPORT viewport(
        0.0f,
        0.0f,
        w,
        h
        );

  _d3dContext->RSSetViewports(1, &viewport);
  return true;
  }
예제 #2
0
	void Render(ID3D11Device* device,
		ID3D11DeviceContext* context,
		common_tool::functionType<std::function<void(ID3D11Device*, ID3D11DeviceContext*)> > renderFunction)
	{
		setRenderTarget(device, context);
		clearRenderTarget(device, context);
		SHADERS.bindPair("ProjectionTex", device, context);
		SHADERS.DisableShaderBind();
		renderFunction(device, context);
		SHADERS.EnableShaderBind();
	}
예제 #3
0
	void Render(ID3D11Device* device,
		ID3D11DeviceContext* context,
		common_tool::functionType<std::function<void(ID3D11Device*, ID3D11DeviceContext*)> > renderFunction)
	{
		horiBuffer->setRenderTarget(device, context);
		horiBuffer->clearRenderTarget(device, context);

		renderFunction(device, context);

		setRenderTarget(device, context);
		clearRenderTarget(device, context);
		horiBuffer->bindPS(device, context, 0);
		SHADERS.bindPair("Hblur", device, context);
		GRAPHICS.RenderRectangle(0, 0, WINWIDTH, WINHEIGHT);
	}
예제 #4
0
	void Render(ID3D11Device* device,
		ID3D11DeviceContext* context,
		std::function<void(ID3D11Device*, ID3D11DeviceContext*)> renderFunction)
	{
		tex2d->clearDepthBuffer(device, context);
		tex2d->clearRenderTarget(device, context);
		tex2d->setRenderTarget(device, context);
		renderFunction(device, context);

		depthMap->Render(device, context, renderFunction);
		blur->Render(device, context, 3, 3, renderFunction);
		
		clearDepthStencil(device, context);
		clearRenderTarget(device, context);
		setRenderTarget(device, context);
		SHADERS.bindPair("DepthFieldMerge", device, context);
		tex2d->bindPS(device, context, 0);
		blur->bindPS(device, context, 1);
		depthMap->bindPS(device,context,2);
		GRAPHICS.RenderRectangle(0, 0, WINWIDTH, WINHEIGHT);
	}
예제 #5
0
	void D3D11RenderAPI::clearViewport(UINT32 buffers, const Color& color, float depth, UINT16 stencil, UINT8 targetMask)
	{
		THROW_IF_NOT_CORE_THREAD;

		if(mActiveRenderTarget == nullptr)
			return;

		const RenderTargetProperties& rtProps = mActiveRenderTarget->getProperties();

		Rect2I clearArea((int)mViewport.TopLeftX, (int)mViewport.TopLeftY, (int)mViewport.Width, (int)mViewport.Height);

		bool clearEntireTarget = clearArea.width == 0 || clearArea.height == 0;
		clearEntireTarget |= (clearArea.x == 0 && clearArea.y == 0 && clearArea.width == rtProps.getWidth() && clearArea.height == rtProps.getHeight());

		if (!clearEntireTarget)
		{
			// TODO - Ignoring targetMask here
			D3D11RenderUtility::instance().drawClearQuad(buffers, color, depth, stencil);
			BS_INC_RENDER_STAT(NumClears);
		}
		else
			clearRenderTarget(buffers, color, depth, stencil, targetMask);
	}
예제 #6
0
angle::Result RendererD3D::initRenderTarget(const gl::Context *context,
                                            RenderTargetD3D *renderTarget)
{
    return clearRenderTarget(context, renderTarget, gl::ColorF(0, 0, 0, 0), 1, 0);
}