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];
        }
Exemple #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);
        }
Exemple #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];
        }
        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];
        }
        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];
        }