public void Render() { if (info.waterLevel == 0) { return; } ShaderManager.Apply("VS_Water"); ShaderManager.Apply("PS_Water"); Display.context.PixelShader.SetSampler(0, DeviceStates.samplerClamp); Display.context.PixelShader.SetSampler(1, DeviceStates.samplerWrapAnistropy); Display.context.PixelShader.SetShaderResource(0, Display.backBufferCopySRV); Display.context.PixelShader.SetShaderResource(1, underwaterHeightView); Display.context.PixelShader.SetShaderResource(2, normalView); Display.context.PixelShader.SetShaderResource(3, info.WaterBump.ressource); Display.context.PixelShader.SetShaderResource(4, info.Shore.ressource); GraphicsManager.SetBlendState(DeviceStates.blendStateSolid); GraphicsManager.SetDepthState(DeviceStates.depthDefaultState); GraphicsManager.SetPrimitiveTopology(SharpDX.Direct3D.PrimitiveTopology.TriangleList); Display.context.InputAssembler.SetIndexBuffer(indexBuffer, Format.R16_UInt, 0); Display.context.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertexBuffer, VertexTexture.SizeInBytes, 0)); Display.context.DrawIndexed(IndicesLength, 0, 0); Display.context.ResolveSubresource(Display.backBuffer, 0, Display.backBufferCopy, 0, SharpDX.DXGI.Format.R8G8B8A8_UNorm); }
public static void RenderAll() { if (batch.Count > 0) { GraphicsManager.SetBlendState(DeviceStates.blendStateSolid); GraphicsManager.SetDepthState(DeviceStates.depthDefaultState); GraphicsManager.SetPrimitiveTopology(SharpDX.Direct3D.PrimitiveTopology.TriangleList); ShaderManager.Apply("VS_Model"); ShaderManager.Apply("PS_Model"); Display.context.PixelShader.SetShaderResource(0, ForegroundGame.unitPlaceholder.ressource); batch.Draw(); } }
public void Render() { int LOD_to_show = 0; if (SceneManager.Camera.eyePosition.Y > 500) { LOD_to_show = 2; } else if (SceneManager.Camera.eyePosition.Y > 250) { LOD_to_show = 1; } else { LOD_to_show = 0; } Display.context.PixelShader.SetConstantBuffer(1, objectBuffer); ShaderManager.Apply("VS_Terrain"); ShaderManager.Apply("PS_Terrain"); Display.context.PixelShader.SetSampler(0, DeviceStates.samplerClamp); Display.context.PixelShader.SetSampler(1, DeviceStates.samplerWrap); Display.context.PixelShader.SetShaderResource(0, info.TextureMap.ressource); Display.context.PixelShader.SetShaderResource(1, normalView); Display.context.PixelShader.SetShaderResource(2, info.ColorMap.ressource); Display.context.PixelShader.SetShaderResource(3, info.LightMap.ressource); Display.context.PixelShader.SetShaderResource(4, info.TextureArray.ressource); //Display.context.PixelShader.SetShaderResource(5, info.Clouds.ressource); GraphicsManager.SetBlendState(DeviceStates.blendStateSolid); GraphicsManager.SetDepthState(DeviceStates.depthDefaultState); GraphicsManager.SetPrimitiveTopology(SharpDX.Direct3D.PrimitiveTopology.TriangleList); Display.context.InputAssembler.SetIndexBuffer(indexBuffer[LOD_to_show], Format.R32_UInt, 0); Display.context.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertexBuffer[LOD_to_show], VertexTexture.SizeInBytes, 0)); Display.context.DrawIndexed(IndicesLength[LOD_to_show], 0, 0); }
public static void Begin() { #if DEBUG PixHelper.BeginEvent(Color.Orange, "QuadRenderer Batch"); #endif spritesDrawn = -1; vertices.Clear(); Display.context.VertexShader.SetConstantBuffer(0, Display.screenBuffer); GraphicsManager.SetRastState(DeviceStates.rastStateDrawing); GraphicsManager.SetDepthState(DeviceStates.depthDisabled); GraphicsManager.SetBlendState(DeviceStates.blendStateTrans); GraphicsManager.SetPrimitiveTopology(PrimitiveTopology.TriangleList); ShaderManager.Apply("VS_2D"); ShaderManager.Apply("PS_2D"); Display.context.InputAssembler.SetIndexBuffer(indexBuffer, SharpDX.DXGI.Format.R16_UInt, 0); Display.context.InputAssembler.SetVertexBuffers(0, vertexBufferBind); ResetCut(); //Display.context.Rasterizer.SetScissorRectangles(new Rectangle(0, 0, Display.width, Display.height)); }
public void Render() { Display.context.PixelShader.SetConstantBuffer(1, objectBuffer); ShaderManager.Apply("VS_Terrain"); ShaderManager.Apply("PS_Terrain"); Display.context.PixelShader.SetSampler(0, DeviceStates.samplerClamp); Display.context.PixelShader.SetSampler(1, DeviceStates.samplerWrap); Display.context.PixelShader.SetShaderResource(0, info.TextureMap.ressource); Display.context.PixelShader.SetShaderResource(1, info.ColorMap.ressource); Display.context.PixelShader.SetShaderResource(2, info.LightMap.ressource); Display.context.PixelShader.SetShaderResource(3, info.TextureArray.ressource); GraphicsManager.SetBlendState(DeviceStates.blendStateSolid); GraphicsManager.SetDepthState(DeviceStates.depthDefaultState); GraphicsManager.SetPrimitiveTopology(SharpDX.Direct3D.PrimitiveTopology.TriangleList); Display.context.InputAssembler.SetIndexBuffer(indexBuffer, SharpDX.DXGI.Format.R32_UInt, 0); Display.context.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertexBuffer, TerrainTriangle.SizeInBytes, 0)); Display.context.DrawIndexed(IndicesLength, 0, 0); }
public void Render() { if (vertices.Count > 0) { ShaderManager.Apply("VS_Debug"); ShaderManager.Apply("PS_Debug"); GraphicsManager.SetBlendState(DeviceStates.blendStateTrans); GraphicsManager.SetDepthState(DeviceStates.depthWriteOff); GraphicsManager.SetPrimitiveTopology(SharpDX.Direct3D.PrimitiveTopology.TriangleList); Display.context.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertexBuffer, VertexColor.SizeInBytes, 0)); while (vertices.Seek()) { DataStream stream; Display.context.MapSubresource(vertexBuffer, MapMode.WriteDiscard, MapFlags.None, out stream); stream.WriteRange(vertices.Get()); Display.context.UnmapSubresource(vertexBuffer, 0); Display.context.Draw(vertices.GetItemsCount(), 0); } vertices.Clear(); } }
public void Render() { if (SceneManager.Pass != RenderPass.Transparent || StrategicMode) { return; } float height = 0.5f, bracketSizeDefault = 1, radiusSize = 0; float bracketSize; Vector2 texD1 = new Vector2(0.0f, 0.0f), texD2 = new Vector2(0.0f, 1.5f), texD3 = new Vector2(0.75f, 0.0f); Vector2 tex1, tex2, tex3, tex4; tex4 = new Vector2(1); Color4 color = Color.White; foreach (InteractiveObject2D obj in list) { if (obj.onScreen && (obj.focused || obj.selected)) { radiusSize = obj.bracketSize - 1; bracketSize = bracketSizeDefault + radiusSize; tex1 = texD1; tex2 = texD2; tex3 = texD3; if (!obj.selected) { tex1.X += 0.5f; tex2.X += 0.5f; tex3.X += 0.5f; } /*if (obj.side==Main.network.me.id) { * color = new Color4(0.75f, 1, 0,1); * } else { * color = Color.OrangeRed; * }*/ Vector3 pos = obj.entity.IntObj3D.Position; batch.Add(new VertexTextureColor(pos + new Vector3(bracketSize, height, bracketSize), tex1, color)); batch.Add(new VertexTextureColor(pos + new Vector3(radiusSize, height, bracketSize), tex3, color)); batch.Add(new VertexTextureColor(pos + new Vector3(bracketSize, height, radiusSize), tex2, color)); batch.Add(new VertexTextureColor(pos + new Vector3(-bracketSize, height, -bracketSize), tex1, color)); batch.Add(new VertexTextureColor(pos + new Vector3(-radiusSize, height, -bracketSize), tex3, color)); batch.Add(new VertexTextureColor(pos + new Vector3(-bracketSize, height, -radiusSize), tex2, color)); batch.Add(new VertexTextureColor(pos + new Vector3(-bracketSize, height, bracketSize), tex1, color)); batch.Add(new VertexTextureColor(pos + new Vector3(-bracketSize, height, radiusSize), tex2, color)); batch.Add(new VertexTextureColor(pos + new Vector3(-radiusSize, height, bracketSize), tex3, color)); batch.Add(new VertexTextureColor(pos + new Vector3(bracketSize, height, -bracketSize), tex1, color)); batch.Add(new VertexTextureColor(pos + new Vector3(bracketSize, height, -radiusSize), tex2, color)); batch.Add(new VertexTextureColor(pos + new Vector3(radiusSize, height, -bracketSize), tex3, color)); } } if (batch.Count > 0) { GraphicsManager.SetBlendState(DeviceStates.blendStateTrans); GraphicsManager.SetDepthState(DeviceStates.depthWriteOff); GraphicsManager.SetPrimitiveTopology(SharpDX.Direct3D.PrimitiveTopology.TriangleList); ShaderManager.Apply("VS_UI3D"); ShaderManager.Apply("PS_UI3D"); Display.context.PixelShader.SetShaderResource(0, ForegroundGame.selectionBrackets.ressource); batch.Draw(); } }