Teapot.

Uses OneIndexBuffer

Inheritance: IBufferable
Ejemplo n.º 1
0
        /// <summary>
        /// Render a teapot in modern opengl.
        /// </summary>
        /// <returns></returns>
        public static TeapotNode Create(bool adjacent = false)
        {
            IBufferSource model; vec3 size;

            if (adjacent)
            {
                var m = new AdjacentTeapot(); size = m.GetModelSize(); model = m;
            }
            else
            {
                var m = new Teapot(); size = m.GetModelSize(); model = m;
            }
            string position = adjacent ? AdjacentTeapot.strPosition : Teapot.strPosition;
            string color    = adjacent ? AdjacentTeapot.strColor : Teapot.strColor;

            var vs       = new VertexShader(vertexCode);
            var fs       = new FragmentShader(fragmentCode);
            var provider = new ShaderArray(vs, fs);
            var map      = new AttributeMap();

            map.Add(inPosition, position);
            map.Add(inColor, color);
            var builder = new RenderMethodBuilder(provider, map);
            var node    = new TeapotNode(model, position, builder);

            node.Initialize();
            node.ModelSize = size;

            return(node);
        }
Ejemplo n.º 2
0
 private TeapotNode(Teapot model, string positionNameInIBufferable, params RenderMethodBuilder[] builders)
     : base(model, positionNameInIBufferable, builders)
 {
     this.ModelSize       = model.GetModelSize();
     this.RenderWireframe = true;
     this.RenderBody      = true;
 }
Ejemplo n.º 3
0
 private TeapotRenderer(Teapot model, IShaderProgramProvider shaderProgramProvider,
                        AttributeMap attributeMap, params GLState[] switches)
     : base(model, shaderProgramProvider, attributeMap, inPosition, switches)
 {
     this.ModelSize       = model.GetModelSize();
     this.RenderWireframe = true;
     this.RenderBody      = true;
 }