예제 #1
0
    void CreateShape(List <List <VData> > dataMesh)
    {
        // Vertices holds the positions and dataPoints
        // holds the actual data. Their indices must
        // match each other.
        vertices   = new List <Vector3>();
        dataPoints = new List <VData>();

        // DataMesh is our array of longitudes
        for (int k = 0; k < dataMesh.Count; k++)
        {
            for (int j = 0; j < dataMesh[k].Count; j++)
            {
                VData dataPoint = dataMesh[k][j];
                vertices.Add(dataPoint.GetUnityPosition());
                dataPoints.Add(dataPoint);
            }
        }

        triangles = new List <int>();

        int vert = 0;

        for (int i = 0; i < dataMesh.Count - 1; i++)
        {
            for (int j = 0; j < dataMesh[i].Count - 1; j++)
            {
                triangles.Add(vert + 0);
                triangles.Add(vert + dataMesh[i].Count);
                triangles.Add(vert + 1);
                triangles.Add(vert + 1);
                triangles.Add(vert + dataMesh[i].Count);
                triangles.Add(vert + dataMesh[i].Count + 1);

                vert++;
            }
            vert++;
        }

        triangles.Reverse();

        colors = new List <Color>();
        //System.Random rand = new System.Random();
        for (int i = 0, k = 0; k < dataMesh.Count; k++)
        {
            for (int j = 0; j < dataMesh[k].Count; j++)
            {
                float value = Mathf.InverseLerp(DataStore.Instance.minVpVs, DataStore.Instance.maxVpVs, dataPoints[i].vPvS);
                //float value = (float)rand.NextDouble();
                colors.Add(gradient.Evaluate(value));
            }
            i++;
        }
    }
예제 #2
0
 public ValuePatch _Set(string key, string v, FileMould t)
 {
     mDataValues[key] = new VData(v, t);
     return(this);
 }