Exemplo n.º 1
0
        private SceneNodeBase GetTree()
        {
            var group = new GroupNode();
            //{
            //    var cube = CubeNode.Create();
            //    cube.Color = new vec4(0, 1, 0, 0.3f);
            //    group.Children.Add(cube);
            //}
            const float alpha = 0.5f;

            {
                var glass = RectGlassNode.Create(4, 3);
                glass.WorldPosition = new vec3(-1, 0, 0);
                glass.Color         = new vec4(0, 1, 0, alpha);
                glass.Name          = "Green Glass";
                group.Children.Add(glass);
            }
            {
                var glass = RectGlassNode.Create(4, 3);
                glass.WorldPosition = new vec3(1, 0, 1);
                glass.Color         = new vec4(1, 0, 0, alpha);
                glass.Name          = "Red Glass";
                group.Children.Add(glass);
            }

            return(group);
        }
Exemplo n.º 2
0
        public static RectGlassNode Create(float width, float height)
        {
            var model = new RectGlassModel(width, height);
            var vs    = new VertexShader(vert);
            var fs    = new FragmentShader(frag);
            var array = new ShaderArray(vs, fs);
            var map   = new AttributeMap();

            map.Add("inPosition", RectGlassModel.strPosition);
            var blend     = new BlendFuncSwitch(BlendSrcFactor.SrcAlpha, BlendDestFactor.OneMinusSrcAlpha);
            var depthMask = new DepthMaskSwitch(false);
            var builder   = new RenderMethodBuilder(array, map, blend, depthMask);
            var node      = new RectGlassNode(model, builder);

            node.Blend     = blend;
            node.ModelSize = new vec3(width, height, 0);
            node.Initialize();

            return(node);
        }