示例#1
0
        private SceneNodeBase GetRootNode()
        {
            var groupNode = new GroupNode();

            {
                var node = CubeNode.Create();
                node.Scale = new vec3(1, 1, 1) * 4;
                groupNode.Children.Add(node);
            }
            {
                var node = TeapotNode.Create();
                node.RenderWireframe = false;
                groupNode.Children.Add(node);
            }

            return(groupNode);
        }
示例#2
0
        public static CubeNode Create()
        {
            // vertex buffer and index buffer.
            var model = new CubeModel();
            // 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", CubeModel.strPosition);
            // build a render method.
            var builder = new RenderMethodBuilder(array, map);
            // create node.
            var node = new CubeNode(model, builder);

            // initialize node.
            node.Initialize();

            return(node);
        }