示例#1
0
        void Generate(Mesh mesh, List <Vector3> dataPoints, bool pointSphere, float pointSize, float modelScale)
        {
            //mesh.Clear();
            var verts     = new List <Vector3>();
            var normals   = new List <Vector3>();
            var tris      = new List <int>();
            var baseIndex = 0;

            var dimx = pointSize * pointScale;
            var dimy = pointSize * pointScale;
            var dimz = pointSize * pointScale;

            for (int i = 0; i < dataPoints.Count; i++)
            {
                var pos = modelScale * dataPoints[i];
                if (pointSphere)
                {
                    baseIndex = GeomUtil.CreateSpheroid(
                        baseIndex,
                        xySegments,
                        zSegments,
                        dimx, dimz, dimy,
                        pos,
                        Quaternion.identity,
                        verts,
                        normals,
                        tris);
                }
                else
                {
                    baseIndex = GeomUtil.CreateCubic(
                        baseIndex,
                        dimx,
                        dimy,
                        dimz,
                        pos,
                        Quaternion.identity,
                        verts,
                        normals,
                        tris
                        );
                }
            }
            mesh.SetVertices(verts);
            mesh.SetNormals(normals);
            mesh.SetTriangles(tris, 0);
        }