/// <summary>
        /// Creates a billboard in 3D world. Its size is described by Width\Height(in pixels).
        /// </summary>
        /// <param name="textureSource"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <returns></returns>
        public static TextureBillboardNode Create(ITextureSource textureSource, int width, int height)
        {
            var vs       = new VertexShader(vertexCode);// this vertex shader has no vertex attributes.
            var fs       = new FragmentShader(fragmentCode);
            var provider = new ShaderArray(vs, fs);
            var map      = new AttributeMap();
            var builder  = new RenderUnitBuilder(provider, map);
            var node     = new TextureBillboardNode(textureSource, width, height, new Billboard(), builder);

            node.Initialize();

            return(node);
        }
Example #2
0
        /// <summary>
        /// Render propeller in modern opengl.
        /// </summary>
        /// <returns></returns>
        public static CubeNode Create()
        {
            var vs       = new VertexShader(vertexCode, inPosition);
            var fs       = new FragmentShader(fragmentCode);
            var provider = new ShaderArray(vs, fs);
            var map      = new AttributeMap();

            map.Add(inPosition, CubeModel.strPosition);
            var builder = new RenderUnitBuilder(provider, map);
            var node    = new CubeNode(new CubeModel(), CubeModel.strPosition, builder);

            node.Initialize();

            return(node);
        }
Example #3
0
        /// <summary>
        /// Render propeller in modern opengl.
        /// </summary>
        /// <returns></returns>
        public static DepthGroundNode Create()
        {
            RenderUnitBuilder shadowmapBuilder;
            {
                var vs       = new VertexShader(vertexCode, inPosition);
                var provider = new ShaderArray(vs);
                var map      = new AttributeMap();
                map.Add(inPosition, GroundModel.strPosition);
                shadowmapBuilder = new RenderUnitBuilder(provider, map);
            }
            var node = new DepthGroundNode(new GroundModel(), GroundModel.strPosition, shadowmapBuilder);

            node.Initialize();

            return(node);
        }
        public static KleinBottleNode Create(KleinBottleModel model)
        {
            var vs       = new VertexShader(vertexShaderCode, "in_Position", "in_TexCoord");
            var fs       = new FragmentShader(fragmentShaderCode);
            var provider = new ShaderArray(vs, fs);
            var map      = new AttributeMap();

            map.Add("in_Position", KleinBottleModel.strPosition);
            map.Add("in_TexCoord", KleinBottleModel.strTexCoord);
            var builder = new RenderUnitBuilder(provider, map, new LineWidthState(3));
            var node    = new KleinBottleNode(model, KleinBottleModel.strPosition, builder);

            node.ModelSize = model.Size;

            return(node);
        }
Example #5
0
        /// <summary>
        /// Render flabellum in modern opengl.
        /// </summary>
        /// <returns></returns>
        public static FlabellumNode Create()
        {
            var vs       = new VertexShader(vertexCode, "inPositoin", "inColor");
            var fs       = new FragmentShader(fragmentCode);
            var provider = new ShaderArray(vs, fs);
            var map      = new AttributeMap();

            map.Add("inPosition", Flabellum.strPosition);
            map.Add("inColor", Flabellum.strColor);
            var model   = new Flabellum();
            var builder = new RenderUnitBuilder(provider, map);
            var node    = new FlabellumNode(model, builder);

            node.Initialize();

            return(node);
        }
Example #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static ObjVNFNode Create(ObjVNFMesh mesh)
        {
            var model = new ObjVNF(mesh);
            RenderUnitBuilder builder;
            {
                var vs       = new VertexShader(vertexCode, inPosition, inNormal);
                var fs       = new FragmentShader(fragmentCode);
                var provider = new ShaderArray(vs, fs);
                var map      = new AttributeMap();
                map.Add(inPosition, Teapot.strPosition);
                map.Add(inNormal, Teapot.strNormal);
                builder = new RenderUnitBuilder(provider, map);
            }
            var node = new ObjVNFNode(model, ObjVNF.strPosition, builder);

            node.ModelSize     = model.GetSize();
            node.WorldPosition = model.GetPosition();

            node.Initialize();

            return(node);
        }
 private TextureBillboardNode(ITextureSource textureSource, int width, int height, IBufferSource model, RenderUnitBuilder builder)
     : base(model, builder)
 {
     this.TextureSource = textureSource;
     this.Width         = width;
     this.Height        = height;
 }