示例#1
0
        public SceneMetricsController(IParcelScene sceneOwner)
        {
            this.scene = sceneOwner;

            uniqueMeshesRefCount    = new Dictionary <Mesh, int>();
            uniqueMaterialsRefCount = new Dictionary <Material, int>();
            entitiesMetrics         = new Dictionary <IDCLEntity, EntityMetrics>();
            model = new SceneMetricsModel();

            if (VERBOSE)
            {
                Debug.Log("Start ScenePerformanceLimitsController...");
            }
        }
示例#2
0
        public SceneMetricsModel GetLimits()
        {
            if (cachedModel == null)
            {
                cachedModel = new SceneMetricsModel();

                int   parcelCount = scene.sceneData.parcels.Length;
                float log         = Mathf.Log(parcelCount + 1, 2);
                float lineal      = parcelCount;

                cachedModel.triangles   = (int)(lineal * LimitsConfig.triangles);
                cachedModel.bodies      = (int)(lineal * LimitsConfig.bodies);
                cachedModel.entities    = (int)(lineal * LimitsConfig.entities);
                cachedModel.materials   = (int)(log * LimitsConfig.materials);
                cachedModel.textures    = (int)(log * LimitsConfig.textures);
                cachedModel.meshes      = (int)(log * LimitsConfig.meshes);
                cachedModel.sceneHeight = (int)(log * LimitsConfig.height);
            }

            return(cachedModel);
        }
示例#3
0
        public bool IsInsideTheLimits()
        {
            SceneMetricsModel limits = GetLimits();
            SceneMetricsModel usage  = GetModel();

            if (usage.triangles > limits.triangles)
            {
                return(false);
            }

            if (usage.bodies > limits.bodies)
            {
                return(false);
            }

            if (usage.entities > limits.entities)
            {
                return(false);
            }

            if (usage.materials > limits.materials)
            {
                return(false);
            }

            if (usage.textures > limits.textures)
            {
                return(false);
            }

            if (usage.meshes > limits.meshes)
            {
                return(false);
            }

            return(true);
        }