Beispiel #1
0
        /// <summary>
        ///     Create a new <see cref="BoxRenderer" />.
        /// </summary>
        public BoxRenderer()
        {
            drawGroup = ElementDrawGroup.Create();

            Shaders.Selection.Use();

            drawGroup.VertexArrayBindBuffer(size: 3);

            int vertexLocation = Shaders.Selection.GetAttributeLocation("aPosition");

            drawGroup.VertexArrayBindAttribute(vertexLocation, size: 3, offset: 0);
        }
        /// <summary>
        ///     Create a new overlay renderer.
        /// </summary>
        public OverlayRenderer()
        {
            (float[] vertices, uint[] indices) = BlockModels.CreatePlaneModel();

            drawGroup = ElementDrawGroup.Create();
            drawGroup.SetStorage(elements: 6, vertices.Length, vertices, indices.Length, indices);

            Shaders.Overlay.Use();

            drawGroup.VertexArrayBindBuffer(size: 5);

            int vertexLocation = Shaders.Overlay.GetAttributeLocation("aPosition");

            drawGroup.VertexArrayBindAttribute(vertexLocation, size: 3, offset: 0);

            int texCordLocation = Shaders.Overlay.GetAttributeLocation("aTexCoord");

            drawGroup.VertexArrayBindAttribute(texCordLocation, size: 2, offset: 3);
        }