Ejemplo n.º 1
0
        /// <summary>
        /// render many cubes in regular way.
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static ManyCubesNode0 Create(ManyCubesModel model)
        {
            var map = new AttributeMap();

            map.Add("vPosition", ManyCubesModel.strPosition);
            map.Add("vColor", ManyCubesModel.strColor);
            var vs               = new VertexShader(regularVert);
            var fs               = new FragmentShader(regularFrag);
            var array            = new ShaderArray(vs, fs);
            var firstPassBuilder = new RenderMethodBuilder(array, map);
            var node             = new ManyCubesNode0(model, firstPassBuilder);

            node.Initialize();

            return(node);
        }
Ejemplo n.º 2
0
        private SceneNodeBase GetRootElement()
        {
            int   lengthX = 50;
            int   lengthY = 40;
            int   lengthZ = 30;
            float scale   = 1.5f;
            var   model   = new ManyCubesModel((int)(lengthX * scale), (int)(lengthY * scale), (int)(lengthZ * scale));

            var manyCubesNode       = ManyCubesNode.Create(model);
            var deferredShadingNode = new DeferredShadingNode();

            deferredShadingNode.Children.Add(manyCubesNode);
            var fullScreenNode = FullScreenNode.Create(deferredShadingNode as ITextureSource);
            var groupNode      = new GroupNode(deferredShadingNode, fullScreenNode);

            this.deferredShadingNode = groupNode;

            var manyCubesNode0 = ManyCubesNode0.Create(model);

            this.regularNode = manyCubesNode0;

            return(groupNode);
        }