Ejemplo n.º 1
0
        public static IntersectionNode Create()
        {
            // vertex buffer and index buffer.
            var model = new IntersectionModel();
            // 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", IntersectionModel.strPosition);
            // build a render method.
            var polygonModeSwitch = new PolygonModeSwitch(PolygonMode.Line);
            var lineWidthSwitch   = new LineWidthSwitch(5);
            var offsetSwitch      = new PolygonOffsetFillSwitch();
            var builder           = new RenderMethodBuilder(array, map, offsetSwitch, polygonModeSwitch, lineWidthSwitch);
            // create node.
            var node = new IntersectionNode(model, builder);

            // initialize node.
            node.Initialize();

            return(node);
        }
Ejemplo n.º 2
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);
        }