public EngineObject()
 {
     mesh = new VertexArray();
     verts = new GPUBuffer(OpenTK.Graphics.OpenGL4.BufferTarget.ArrayBuffer);
     indices = new GPUBuffer(OpenTK.Graphics.OpenGL4.BufferTarget.ElementArrayBuffer);
     uvs = new GPUBuffer(OpenTK.Graphics.OpenGL4.BufferTarget.ArrayBuffer);
     norms = new GPUBuffer(OpenTK.Graphics.OpenGL4.BufferTarget.ArrayBuffer);
     textures = new List<Texture>();
 }
        public EngineObject(EngineObject src, bool lockChanges)
        {
            mesh = src.mesh;
            verts = src.verts;
            indices = src.indices;
            uvs = src.uvs;
            norms = src.norms;
            IndexCount = src.IndexCount;

            textures = new List<Texture>();
            lock_changes = lockChanges;
        }
        public void InitBuffers()
        {
            BufferStreamer.QueueTask((a) =>
            {
                if (vArray == null) vArray = new VertexArray();

                if (vBuf != null) vBuf.Dispose();
                vBuf = new GPUBuffer(OpenTK.Graphics.OpenGL4.BufferTarget.ArrayBuffer, Side * Side * Side * 16, false);
                //vBuf = new GPUBuffer(OpenTK.Graphics.OpenGL4.BufferTarget.ArrayBuffer);
                //vBuf.BufferData(0, vertex.ToArray(), OpenTK.Graphics.OpenGL4.BufferUsageHint.StaticDraw);
                vArray.SetBufferObject(0, vBuf, 4, OpenTK.Graphics.OpenGL4.VertexAttribPointerType.Int2101010Rev);

                if (vMat != null) vMat.Dispose();
                vMat = new GPUBuffer(OpenTK.Graphics.OpenGL4.BufferTarget.ArrayBuffer, Side * Side * Side * 8, false);
                //vMat = new GPUBuffer(OpenTK.Graphics.OpenGL4.BufferTarget.ArrayBuffer);
                //vMat.BufferData(0, mat.ToArray(), OpenTK.Graphics.OpenGL4.BufferUsageHint.StaticDraw);
                vArray.SetBufferObject(1, vMat, 1, OpenTK.Graphics.OpenGL4.VertexAttribPointerType.Short);
            }, null);
        }