Isosurface.AdaptiveDualContouring.OctreeNode.GenerateVertexBuffer C# (CSharp) Method

GenerateVertexBuffer() public method

public GenerateVertexBuffer ( List vertices ) : void
vertices List
return void
        public void GenerateVertexBuffer(List<VertexPositionColorNormal> vertices)
        {
            if (type != OctreeNodeType.Leaf)
            {
                for (int i = 0; i < 8; i++)
                {
                    if (children[i] != null)
                        children[i].GenerateVertexBuffer(vertices);
                }
            }

            if (type != OctreeNodeType.Internal)
            {
                if (draw_info == null)
                    return;

                draw_info.index = vertices.Count;
                Vector3 cn = draw_info.averageNormal * 0.5f + Vector3.One * 0.5f;
                cn.Normalize();
                Color c = new Color(cn);
                vertices.Add(new VertexPositionColorNormal(draw_info.position, c, draw_info.averageNormal));
            }
        }

Usage Example

コード例 #1
0
        public override long Contour(float threshold)
        {
            Stopwatch watch = new Stopwatch();

            Vertices.Clear();
            tree = new OctreeNode();

            watch.Start();
            tree.Build(Vector3.Zero, Resolution, threshold, Vertices, Size);

            tree.GenerateVertexBuffer(Vertices);
            if (Vertices.Count > 0)
            {
                VertexBuffer.SetData <VertexPositionColorNormal>(Vertices.ToArray());
            }
            VertexCount = Vertices.Count;
            //ConstructTreeGrid(tree);
            CalculateIndexes();
            watch.Stop();

            return(watch.ElapsedMilliseconds);
        }
All Usage Examples Of Isosurface.AdaptiveDualContouring.OctreeNode::GenerateVertexBuffer