Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Rendertarget9(Device targetDevice, Viewport dstViewport)
- {
- mViewport = dstViewport;
- mDevice = targetDevice;
- Surface backBuffer = targetDevice.GetBackBuffer(0, 0);
- mTargetTexture = new Texture(
- mDevice,
- mViewport.Width,
- mViewport.Height,
- 1,
- Usage.RenderTarget,
- backBuffer.Description.Format,
- Pool.Default
- );
- backBuffer.Dispose();
- mTargetSurface = mTargetTexture.GetSurfaceLevel(0);
- mDeclaration = new VertexDeclaration(targetDevice,
- new VertexElement[]
- {
- new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
- new VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
- new VertexElement(0, 16, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
- VertexElement.VertexDeclarationEnd
- }
- );
- mShader = new Shader9(targetDevice);
- LoadVertices();
- mScreenMatrix = Matrix.OrthoLH(mViewport.Width, mViewport.Height, 0, 1);
- mDevice.SetRenderState(RenderState.AlphaBlendEnable, true);
- mDevice.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha);
- mDevice.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
- mRectDrawProvider = new DrawRectangle(this, mDevice);
- mEllipseProvider = new EllipseProvider(mDevice, this);
- }
- public override void BeginUI()
- {
- if (mBaseRendertarget != null)
- mBaseRendertarget.Dispose();
- mBaseRendertarget = mDevice.GetRenderTarget(0);
- mDevice.SetRenderTarget(0, mTargetSurface);
- mDevice.Clear(ClearFlags.Target, 0, 0, 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment