Beispiel #1
0
    void InitHistogramLookups()
    {
        // Init histogram GPU buffer
        CPUBuffers.Get.HistogramData.Clear();
        foreach (var path in SceneManager.Get.SceneHierarchy)
        {
            var hist = new HistStruct
            {
                parent    = -1,
                all       = 0,
                cutaway   = 0,
                occluding = 0,
                visible   = 0
            };

            if (MyUtility.IsPathRoot(path))
            {
                hist.parent = -1;
            }
            else
            {
                var parentPath = MyUtility.GetParentUrlPath(path);
                if (!SceneManager.Get.SceneHierarchy.Contains(parentPath))
                {
                    throw new Exception("Hierarchy corrupted");
                }
                hist.parent = SceneManager.Get.SceneHierarchy.IndexOf(parentPath);
            }

            CPUBuffers.Get.HistogramData.Add(hist);
        }

        //*******************************//

        CPUBuffers.Get.IngredientToNodeLookup.Clear();

        foreach (var ingredientName in SceneManager.Get.AllIngredientNames)
        {
            if (SceneManager.Get.SceneHierarchy.Contains(ingredientName))
            {
                CPUBuffers.Get.IngredientToNodeLookup.Add(SceneManager.Get.SceneHierarchy.IndexOf(ingredientName));
            }
        }

        //*******************************//

        CPUBuffers.Get.NodeToIngredientLookup.Clear();

        foreach (var path in SceneManager.Get.SceneHierarchy)
        {
            if (SceneManager.Get.AllIngredientNames.Contains(path))
            {
                CPUBuffers.Get.NodeToIngredientLookup.Add(SceneManager.Get.AllIngredientNames.IndexOf(path));
            }
            else
            {
                CPUBuffers.Get.NodeToIngredientLookup.Add(-1);
            }
        }
    }