Пример #1
0
 private void init(DisposableI parent, BufferLayoutDescI bufferLayoutDesc)
 {
     try
     {
         video = parent.FindParentOrSelfWithException<Video>();
         vertexBuffer = new VertexBuffer(this, bufferLayoutDesc, BufferUsages.Write, VertexBufferTopologys.Triangle, vertices);
     }
     catch (Exception e)
     {
         Dispose();
         throw e;
     }
 }
Пример #2
0
 public QuickDraw(DisposableI parent, BufferLayoutDescI bufferLayoutDesc)
     : base(parent, bufferLayoutDesc)
 {
     try
     {
         vertexBuffer = new VertexBuffer(this, bufferLayoutDesc, BufferUsages.Write, VertexBufferTopologys.Triangle, vertices);
     }
     catch (Exception e)
     {
         Dispose();
         throw e;
     }
 }
Пример #3
0
 private void init(DisposableI parent, BufferLayoutDescI bufferLayoutDesc)
 {
     try
     {
         video        = parent.FindParentOrSelfWithException <Video>();
         vertexBuffer = new VertexBuffer(this, bufferLayoutDesc, BufferUsages.Write, VertexBufferTopologys.Triangle, vertices);
     }
     catch (Exception e)
     {
         Dispose();
         throw e;
     }
 }
Пример #4
0
 public QuickDraw(DisposableI parent, BufferLayoutDescI bufferLayoutDesc)
     : base(parent, bufferLayoutDesc)
 {
     try
     {
         vertexBuffer = new VertexBuffer(this, bufferLayoutDesc, BufferUsages.Write, VertexBufferTopologys.Triangle, vertices);
     }
     catch (Exception e)
     {
         Dispose();
         throw e;
     }
 }
Пример #5
0
        private void init(DisposableI parent, BufferLayoutDescI bufferLayoutDesc, BufferUsages bufferUsage, VertexBufferTopologys vertexBufferTopology, float[] vertices, int[] indices)
        {
            try
            {
                video    = parent.FindParentOrSelfWithException <Video>();
                Topology = vertexBufferTopology;

                var format = new G.VertexFormat[bufferLayoutDesc.Elements.Count];
                for (int i = 0; i != bufferLayoutDesc.Elements.Count; ++i)
                {
                    switch (bufferLayoutDesc.Elements[i].FloatCount)
                    {
                    case 1: format[i] = G.VertexFormat.Float; break;

                    case 2: format[i] = G.VertexFormat.Float2; break;

                    case 3: format[i] = G.VertexFormat.Float3; break;

                    case 4: format[i] = G.VertexFormat.Float4; break;
                    }
                }

                if (indices != null && indices.Length != 0)
                {
                    vertexBuffer = new G.VertexBuffer(vertexCount, indices.Length, format);

                    indexCount = indices.Length;
                    var indicesShort = new ushort[indexCount];
                    for (int i = 0; i != indexCount; ++i)
                    {
                        indicesShort[i] = (ushort)indices[i];
                    }
                    vertexBuffer.SetIndices(indicesShort);
                }
                else
                {
                    vertexBuffer = new G.VertexBuffer(vertexCount, format);
                }
                vertexBuffer.SetVertices(vertices);
            }
            catch (Exception e)
            {
                Dispose();
                throw e;
            }
        }
Пример #6
0
        private void init(DisposableI parent, ShaderI shader, BufferLayoutDescI inputLayoutDesc, bool construct)
        {
            if (!construct)
            {
                return;
            }

            try
            {
                video = parent.FindParentOrSelfWithException <Video>();

                var inputLayoutDescTEMP = (BufferLayoutDesc)inputLayoutDesc;
                layout = new VertexDeclaration(inputLayoutDescTEMP.desc);
            }
            catch (Exception e)
            {
                Dispose();
                throw e;
            }
        }
Пример #7
0
        private void init(DisposableI parent, BufferLayoutDescI bufferLayoutDesc, BufferUsages bufferUsage, VertexBufferTopologys vertexBufferTopology, float[] vertices, int[] indices)
        {
            try
            {
                video        = parent.FindParentOrSelfWithException <Video>();
                Topology     = vertexBufferTopology;
                bufferLayout = new BufferLayout(this, null, bufferLayoutDesc, true);

                vertexBuffer = new X.VertexBuffer(video.Device, bufferLayout.layout, vertexCount, X.BufferUsage.WriteOnly);
                Update(vertices, vertexCount);

                if (indices != null && indices.Length != 0)
                {
                    indexBuffer = new IndexBuffer(this, usage, indices);
                }
            }
            catch (Exception e)
            {
                Dispose();
                throw e;
            }
        }
Пример #8
0
 internal BufferLayout(DisposableI parent, ShaderI shader, BufferLayoutDescI inputLayoutDesc, bool construct)
     : base(parent)
 {
     init(parent, shader, inputLayoutDesc, construct);
 }
Пример #9
0
 public BufferLayout(DisposableI parent, ShaderI shader, BufferLayoutDescI desc)
     : base(parent)
 {
     video     = parent.FindParentOrSelfWithException <Video>();
     this.desc = (BufferLayoutDesc)desc;
 }
Пример #10
0
 public static BufferLayout New(DisposableI parent, ShaderI shader, BufferLayoutDescI desc)
 {
     return(new BufferLayout(parent, shader, desc));
 }
Пример #11
0
 public BufferLayout(DisposableI parent, ShaderI shader, BufferLayoutDescI inputLayoutDesc)
     : base(parent)
 {
     init(parent, shader, inputLayoutDesc, false);
 }
Пример #12
0
 public QuickDraw(DisposableI parent, BufferLayoutDescI bufferLayoutDesc)
     : base(parent, bufferLayoutDesc)
 {
     init(parent, bufferLayoutDesc);
 }
Пример #13
0
 public VertexBuffer(DisposableI parent, BufferLayoutDescI bufferLayoutDesc, BufferUsages bufferUsage, VertexBufferTopologys vertexBufferTopology, float[] vertices, int[] indices)
     : base(parent, bufferLayoutDesc, bufferUsage, vertices)
 {
     init(parent, bufferLayoutDesc, bufferUsage, vertexBufferTopology, vertices, indices);
 }
Пример #14
0
 public static QuickDraw New(DisposableI parent, BufferLayoutDescI bufferLayoutDesc)
 {
     return new QuickDraw(parent, bufferLayoutDesc);
 }
Пример #15
0
 public static QuickDraw New(DisposableI parent, BufferLayoutDescI bufferLayoutDesc)
 {
     return(new QuickDraw(parent, bufferLayoutDesc));
 }
Пример #16
0
 public QuickDraw(DisposableI parent, BufferLayoutDescI bufferLayoutDesc)
     : base(parent, bufferLayoutDesc)
 {
     init(parent, bufferLayoutDesc);
 }
Пример #17
0
 public static VertexBuffer New(DisposableI parent, BufferLayoutDescI bufferLayoutDesc, BufferUsages usage, VertexBufferTopologys topology, float[] vertices, int[] indices)
 {
     return(new VertexBuffer(parent, bufferLayoutDesc, usage, topology, vertices, indices));
 }
Пример #18
0
        private void init(DisposableI parent, BufferLayoutDescI bufferLayoutDesc, BufferUsages bufferUsage, VertexBufferTopologys vertexBufferTopology, float[] vertices, int[] indices)
        {
            try
            {
                video = parent.FindParentOrSelfWithException<Video>();
                Topology = vertexBufferTopology;
                bufferLayout = new BufferLayout(this, null, bufferLayoutDesc, true);

                vertexBuffer = new X.VertexBuffer(video.Device, bufferLayout.layout, vertexCount, X.BufferUsage.WriteOnly);
                Update(vertices, vertexCount);

                if (indices != null && indices.Length != 0) indexBuffer = new IndexBuffer(this, usage, indices);
            }
            catch (Exception e)
            {
                Dispose();
                throw e;
            }
        }
Пример #19
0
 public static VertexBuffer New(DisposableI parent, BufferLayoutDescI bufferLayoutDesc, BufferUsages usage, VertexBufferTopologys topology, float[] vertices, int[] indices)
 {
     return new VertexBuffer(parent, bufferLayoutDesc, usage, topology, vertices, indices);
 }
Пример #20
0
 public VertexBuffer(DisposableI parent, BufferLayoutDescI bufferLayoutDesc, BufferUsages bufferUsage, VertexBufferTopologys vertexBufferTopology, float[] vertices, int[] indices)
     : base(parent, bufferLayoutDesc, bufferUsage, vertices)
 {
     init(parent, bufferLayoutDesc, bufferUsage, vertexBufferTopology, vertices, indices);
 }