Esempio n. 1
0
    public FogOfWarRenderer(MapFoggingSystem fogSystem, RenderingDevice device)
    {
        _device    = device;
        _fogSystem = fogSystem;

        _vertexShader  = device.GetShaders().LoadVertexShader("fogofwar_vs");
        _bufferBinding = new BufferBinding(device, _vertexShader).Ref();

        UpdateBufferSize(true);

        Span <ushort> indices = stackalloc ushort[]
        {
            0, 2, 1, 2, 0, 3
        };

        _indexBuffer  = device.CreateIndexBuffer(indices, debugName: "FogOfWar");
        _vertexBuffer = device.CreateEmptyVertexBuffer(FogOfWarVertex.Size * 4, debugName: "FogOfWar");

        _bufferBinding.Resource
        .AddBuffer <FogOfWarVertex>(_vertexBuffer, 0)
        .AddElement(VertexElementType.Float3, VertexElementSemantic.Position)
        .AddElement(VertexElementType.Float2, VertexElementSemantic.TexCoord);
    }
 public MapFogDebugRenderer(MapFoggingSystem system, RenderingDevice device)
 {
     _system = system;
     _device = device;
 }