public GLSubMesh(SubMesh subMesh, List <GLMaterial> materials)
        {
            ElementBuffer = new GLBuffer <uint>(BufferTarget.ElementArrayBuffer, subMesh.Indices,
                                                BufferUsageHint.StaticDraw);

            PrimitiveType = ( PrimitiveType )subMesh.PrimitiveType;
            Material      = materials[( int )subMesh.MaterialIndex];
        }
Exemplo n.º 2
0
        private GLBuffer <T> GenerateVertexAttribute <T>(int index, T[] array, int count) where T : struct
        {
            var buffer = new GLBuffer <T>(BufferTarget.ArrayBuffer, array, count * sizeof(float), BufferUsageHint.StaticDraw);

            GL.VertexAttribPointer(index, count, VertexAttribPointerType.Float, false, buffer.Stride, 0);
            GL.EnableVertexAttribArray(index);

            return(buffer);
        }
Exemplo n.º 3
0
        public GLSubMesh(SubMesh subMesh, List <GLMaterial> materials)
        {
            ElementBuffer = new GLBuffer <ushort>(BufferTarget.ElementArrayBuffer, subMesh.Indices,
                                                  BufferUsageHint.StaticDraw);

            PrimitiveType = subMesh.PrimitiveType == MMLPrimitiveType.TriangleStrip
                ? GLPrimitiveType.TriangleStrip
                : GLPrimitiveType.Triangles;

            Material = materials[subMesh.MaterialIndex];
        }
Exemplo n.º 4
0
        public GLIndexTable(IndexTable indexTable, List <GLMaterial> materials)
        {
            ElementBuffer = new GLBuffer <ushort>(BufferTarget.ElementArrayBuffer, indexTable.Indices, sizeof(ushort), BufferUsageHint.StaticDraw);

            if (indexTable.PrimitiveType == MMLPrimitiveType.TriangleStrip)
            {
                PrimitiveType = GLPrimitiveType.TriangleStrip;
            }
            else
            {
                PrimitiveType = GLPrimitiveType.Triangles;
            }

            Material = materials[indexTable.MaterialIndex];
        }
Exemplo n.º 5
0
        public GLSubMesh(SubMesh subMesh, List <GLMaterial> materials)
        {
            ElementBuffer = new GLBuffer <ushort>(BufferTarget.ElementArrayBuffer, subMesh.Indices, sizeof(ushort),
                                                  BufferUsageHint.StaticDraw);

            if (subMesh.PrimitiveType == MMLPrimitiveType.TriangleStrip)
            {
                PrimitiveType = GLPrimitiveType.TriangleStrip;
            }
            else
            {
                PrimitiveType = GLPrimitiveType.Triangles;
            }

            Material = materials[subMesh.MaterialIndex];
        }