Пример #1
0
        public override void PrepareInstanced(RendererContext rc, VertexBufferLayoutKind[] vblks, VertexBuffer vb)
        {
            rc._2DVertexBufferArray.BindVertexBufferArray();

            vb.BindBuffer();

            for (int i = 0; i < vblks.Length; i++)
            {
                rc.EnableVertexAttribute((int)vblks[i].AttributeID);
                rc.VertexAttributePointer(vblks[i]);
                rc.VertexAttributeDivisor((int)vblks[i].AttributeID, 1);
            }

            vb.UnbindBuffer();

            rc._2DVertexBufferArray.UnbindVertexBufferArray();
        }
Пример #2
0
        public override void PrepareInstanced(RendererContext rc, VertexBufferLayoutKind[] vblks, VertexBuffer vb)
        {
            if (MyModel != null)
            {
                foreach (Mesh msh in MyModel.Meshes)
                {
                    msh.m_VertexBufferArray.BindVertexBufferArray();

                    vb.BindBuffer();

                    foreach (VertexBufferLayoutKind vblk in vblks)
                    {
                        rc.EnableVertexAttribute((int)vblk.AttributeID);
                        rc.VertexAttributePointer(vblk);
                        rc.VertexAttributeDivisor((int)vblk.AttributeID, 1);
                    }

                    vb.UnbindBuffer();

                    msh.m_VertexBufferArray.UnbindVertexBufferArray();
                }
            }
            else
                this.ErrorCount++;
        }