Ejemplo n.º 1
0
        private SceneNodeBase GetRootNode()
        {
            var rootNode = new GroupNode();

            {
                var node = CubeNode.Create();
                node.WorldPosition = new vec3(1, 1, 1) * 0.5f;
                node.Scale         = new vec3(1, 1, 1) * 0.5f;
                rootNode.Children.Add(node);
            }
            {
                var node = SliceNode.Create();
                //node.Scale = new vec3(1, 1, 1) * 5;
                //rootNode.Children.Add(node);
                this.sliceNode = node;
            }
            {
                var node = IntersectionNode.Create();
                //node.Scale = new vec3(1, 1, 1) * 5;
                rootNode.Children.Add(node);
                this.intersectionNode = node;
            }
            //{
            //    var node = GroundNode.Create();
            //    node.Scale = new vec3(1, 1, 1) * 5;
            //    node.Color = Color.Yellow.ToVec4();
            //    rootNode.Children.Add(node);
            //}

            return(rootNode);
        }
Ejemplo n.º 2
0
        public static SliceNode Create()
        {
            // vertex buffer and index buffer.
            var model = new SliceModel();
            // vertex shader and fragment shader.
            var vs    = new VertexShader(vertexCode);
            var fs    = new FragmentShader(fragmentCode);
            var array = new ShaderArray(vs, fs);
            // which vertex buffer maps to which attribute in shader.
            var map = new AttributeMap();

            map.Add("inPosition", SliceModel.strPosition);
            // build a render method.
            var builder = new RenderMethodBuilder(array, map);
            // create node.
            var node = new SliceNode(model, builder);

            // initialize node.
            node.Initialize();

            return(node);
        }