Beispiel #1
0
        public static TrianglesNode Create(IBufferSource model, string position, string color, vec3 size)
        {
            RenderMethodBuilder randomBuilder, gl_VertexIDBuilder;
            {
                var vs    = new VertexShader(randomVert);
                var fs    = new FragmentShader(randomFrag);
                var array = new ShaderArray(vs, fs);
                var map   = new AttributeMap();
                map.Add("inPosition", position);
                map.Add("inColor", color);
                randomBuilder = new RenderMethodBuilder(array, map);
            }
            {
                var vs    = new VertexShader(gl_VertexIDVert);
                var fs    = new FragmentShader(gl_VertexIDFrag);
                var array = new ShaderArray(vs, fs);
                var map   = new AttributeMap();
                map.Add("inPosition", position);
                gl_VertexIDBuilder = new RenderMethodBuilder(array, map);
            }

            var node = new TrianglesNode(model, position, randomBuilder, gl_VertexIDBuilder);

            node.Initialize();
            node.ModelSize = size;

            return(node);
        }
Beispiel #2
0
        private SceneNodeBase GetRootNode()
        {
            var group = new GroupNode();

            {
                const int length = 5;
                var       model  = new TrianglesModel(length, length, length);
                var       node   = TrianglesNode.Create(model, TrianglesModel.strPosition, TrianglesModel.strColor, model.GetSize());
                group.Children.Add(node);

                this.triangleNode = node;
            }
            return(group);
        }