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

GenerateVertexBuffer() public method

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

            //if (type != NodeType.Internal)
            {
                if (vertices == null || this.vertices.Length == 0)
                    return;

                if (index == 639)
                {
                }
                for (int i = 0; i < this.vertices.Length; i++)
                {
                    if (this.vertices[i] == null)
                        continue;
                    this.vertices[i].index = vertices.Count;
                    Vector3 nc = this.vertices[i].normal * 0.5f + Vector3.One * 0.5f;
                    nc.Normalize();
                    Color c = new Color(nc);
                    vertices.Add(new VertexPositionColorNormalNormal(this.vertices[i].qef.Solve(1e-6f, 4, 1e-6f), c, this.vertices[i].normal, this.vertices[i].normal));

                }
            }
        }

Usage Example

Ejemplo n.º 1
0
        public override long Contour(float threshold)
        {
            Stopwatch watch = new Stopwatch();

            watch.Start();
            if (tree == null)
            {
                Vertices.Clear();
                tree = new OctreeNode();
                List <VertexPositionColorNormal> vs = new List <VertexPositionColorNormal>();

                tree.ConstructBase(Resolution, threshold, ref vs);
                tree.ClusterCellBase(threshold);
                //Vertices = vs.ToList();

                tree.GenerateVertexBuffer(Vertices);

                if (Vertices.Count > 0)
                {
                    VertexBuffer.SetData <VertexPositionColorNormal>(Vertices.ToArray());
                }
                VertexCount = Vertices.Count;
            }

            OutlineLocation = 0;
            //ConstructTreeGrid(tree);
            CalculateIndexes(threshold);
            watch.Stop();

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