Пример #1
0
    public void SetMaterialData(CloudAPI.FileParameterDataBin data, int layer)
    {
        int            num_dates = data.info.num_dates;
        int            w         = data.info.width;
        int            h         = data.info.height;
        int            l         = data.info.num_layers;
        int            offset    = w * h * layer;
        Texture2DArray array     = new Texture2DArray(w, h, num_dates, TextureFormat.RFloat, false, false);

        for (int t = 0; t < num_dates; t++)
        {
            array.SetPixelData <float>(data.data, 0, t, l * w * h * t + offset);
        }
        array.Apply(false);
        material.SetTexture("Texture2DArray_28e7e253cb18486a8c14899af2143136", array);                                     // Textures
        material.SetVector("Vector2_540929bd5a9e4b91803993f7ccde8e73", new Vector4(data.info.lon_min, data.info.lon_max)); // LonMinMax
        material.SetVector("Vector2_a03a182a418a49fd8146e64479d05bb6", new Vector4(data.info.lat_min, data.info.lat_max)); // LatMinMax
        material.SetFloat("Vector1_8211db379e8f4f01b70f108ef594b658", data.info.width);                                    // Width
        material.SetFloat("Vector1_51fb8cd46af548f6af8aef823b6bffa7", 0);                                                  // Overlay Opacity
        // material.SetFloat("Vector1_eb79a7293bb64596949928ce17eb143b", 0); // Texture Index

        currentLayer = layer;
        currentData  = data;

        ResetRange();
    }
Пример #2
0
        private FileParameterDataBin GenerateRandomMatrix(FileParameterInfo param)
        {
            var random = new System.Random(param.GetHashCode());
            int count  = param.num_dates * param.num_layers * param.height * param.width;

            float[] result = new float[count];
            for (int i = 0; i < count; i++)
            {
                result[i] = (float)random.NextDouble();
            }

            var r = new FileParameterDataBin()
            {
                data = result,
                info = param
            };

            r.UpdateMinMax();
            return(r);
        }
Пример #3
0
        public static FileParameterDataBin FromBytes(byte[] data, FileParameterInfo info)
        {
            int count = info.num_dates * info.num_layers * info.width * info.height;

            if (data.Length != sizeof(float) * count)
            {
                return(null);
            }

            float[] buffer = new float[count];
            Buffer.BlockCopy(data, 0, buffer, 0, data.Length);
            var result = new FileParameterDataBin()
            {
                data = buffer,
                info = info
            };

            result.UpdateMinMax();
            return(result);
        }
Пример #4
0
    public void SetDefaultMaterial()
    {
        material.SetFloat("Vector1_51fb8cd46af548f6af8aef823b6bffa7", 1); // Overlay Opacity

        currentData = null;
    }