示例#1
0
        public Mesh(string name = "unnamed mesh")
        {
            this.Name = name;

            Vertices         = new BufferObjectVector3();
            Normals          = new BufferObjectVector3();
            Tangents         = new BufferObjectVector3();
            UVs              = new BufferObjectVector2();
            TriangleIndicies = new BufferObjectInt()
            {
                Target = BufTarget.ControlElementArray,
            };

            VertexArray = new VertexArrayObject();
            VertexArray.AddVertexBuffer("vertices", Vertices);
            VertexArray.AddVertexBuffer("normals", Normals);
            VertexArray.AddVertexBuffer("tangents", Tangents);
            VertexArray.AddVertexBuffer("uvs", UVs);
            VertexArray.AddVertexBuffer("triangleIndicies", TriangleIndicies);
            VertexArray.OnChanged += () => {
                isOnGPU = false;
                VersionInFile++;
            };
        }