Ejemplo n.º 1
0
 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>();
 }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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);
        }