Exemple #1
0
        public static void LoadMembrane(string path = null)
        {
            if (string.IsNullOrEmpty(path) || !File.Exists(path))
            {
                path = MyUtility.GetInputFile("mbr", GlobalProperties.Get.LastMembraneFileLoaded);
            }

            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            GlobalProperties.Get.LastMembraneFileLoaded = path;

            // Add membrane
            SceneManager.Get.AddMembrane(path, Vector3.zero, Quaternion.identity);

            // Upload scene data to the GPU
            CPUBuffers.Get.CopyDataToGPU();
        }
Exemple #2
0
        public static void LoadCellPackPositions(string path = null)
        {
            if (string.IsNullOrEmpty(path) || !File.Exists(path))
            {
                path = MyUtility.GetInputFile("bin", GlobalProperties.Get.LastPositionsFileLoaded);
            }

            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            GlobalProperties.Get.LastPositionsFileLoaded = path;

            // Load position from .bin file
            LoadPositions(path);

            // Upload scene data to the GPU
            CPUBuffers.Get.CopyDataToGPU();
        }
Exemple #3
0
        public static void LoadCellPackRecipe(string path = null)
        {
            SceneManager.Get.ClearScene();

            if (string.IsNullOrEmpty(path) || !File.Exists(path))
            {
                path = MyUtility.GetInputFile("json", GlobalProperties.Get.LastRecipeFileLoaded);
            }

            if (path == null || !File.Exists(path))
            {
                return;
            }
            GlobalProperties.Get.LastRecipeFileLoaded = path;

            var rootCompartment = CompartmentUtility.DeserializeJson(path);

            CompartmentUtility.PostProcessSceneGraph(rootCompartment);

            LoadRecipe(rootCompartment);

            //CPUBuffers.Get.CopyDataToGPU();
        }
    public void LoadColorPalette(string path = null)
    {
        if (string.IsNullOrEmpty(path) || !File.Exists(path))
        {
            path = MyUtility.GetInputFile("json", GlobalProperties.Get.LastColorPaletteLoaded);
        }

        if (path == null || !File.Exists(path))
        {
            return;
        }
        GlobalProperties.Get.LastColorPaletteLoaded = path;

        var str     = File.ReadAllText(path);
        var palette = JsonConvert.DeserializeObject <Dictionary <string, CColor> >(str);

        foreach (var entry in palette)
        {
            var index = SceneManager.Get.AllIngredientNames.IndexOf(entry.Key);
            CPUBuffers.Get.IngredientsColors[index] = new Vector4(entry.Value.x / 255.0f, entry.Value.y / 255.0f, entry.Value.z / 255.0f);
        }

        GPUBuffers.Get.IngredientsColors.SetData(CPUBuffers.Get.IngredientsColors.ToArray());
    }