public void Run() { frameCount++; if (!tileset.TilesetOptions.Show) { ToggleTiles(tileset.Root); return; } SSECalculator sse = new SSECalculator(this.tileset); foreach (Camera cam in sceneOptions.ClippingCameras) { if (cam == null) { continue; } // All of our bounding boxes and tiles are using tileset coordinate frame so lets get our frustrum planes // in tileset frame. This way we only need to transform our planes, not every bounding box we need to check against Matrix4x4 cameraMatrix = cam.projectionMatrix * cam.worldToCameraMatrix * tileset.Behaviour.transform.localToWorldMatrix; Plane[] planes = GeometryUtility.CalculateFrustumPlanes(cameraMatrix); sse.Configure(cam); Vector3 cameraPositionInTilesetFrame = tileset.Behaviour.transform.InverseTransformPoint(cam.transform.position); DetermineFrustumSet(tileset.Root, planes, sse, cameraPositionInTilesetFrame, PlaneClipMask.GetDefaultMask()); } MarkUsedSetLeaves(tileset.Root); SkipTraversal(tileset.Root); ToggleTiles(tileset.Root); //this.tileset.RequestManager.Process(); //UnloadUnusedContent called once for all tilesets at end of AbstractTilesetBehaviour.LateUpdate() }
public void Run() { frameCount++; tileset.LRUContent.MarkAllUnused(); // Move any tiles with downloaded content to the ready state for (int i = 0; i < this.tileset.Options.MaximumTilesToProcessPerFrame && this.tileset.ProcessingQueue.Count != 0; i++) { var tile = this.tileset.ProcessingQueue.Dequeue(); tile.Process(); } SSECalculator sse = new SSECalculator(this.tileset); foreach (Camera cam in tileset.Options.ClippingCameras) { if (cam == null) { continue; } // All of our bounding boxes and tiles are using tileset coordinate frame so lets get our frustrum planes // in tileset frame. This way we only need to transform our planes, not every bounding box we need to check against Matrix4x4 cameraMatrix = cam.projectionMatrix * cam.worldToCameraMatrix * tileset.Behaviour.transform.localToWorldMatrix; Plane[] planes = GeometryUtility.CalculateFrustumPlanes(cameraMatrix); sse.Configure(cam); Vector3 cameraPositionInTilesetFrame = tileset.Behaviour.transform.InverseTransformPoint(cam.transform.position); DetermineFrustumSet(tileset.Root, planes, sse, cameraPositionInTilesetFrame, PlaneClipMask.GetDefaultMask()); } MarkUsedSetLeaves(tileset.Root); SkipTraversal(tileset.Root); UnloadUnusedContent(); ToggleTiles(tileset.Root); this.tileset.RequestManager.Process(); }
public void Run() { if (!tileset.TilesetOptions.Show) { ToggleTiles(tileset.Root); return; } SSECalculator sse = new SSECalculator(tileset); foreach (Camera cam in sceneOptions.ClippingCameras) { if (cam == null) { continue; } // All of our bounding boxes and tiles are using tileset coordinate frame so lets get our frustrum // planes in tileset frame. This way we only need to transform our planes, not every bounding box we // need to check against Matrix4x4 cameraMatrix = cam.projectionMatrix * cam.worldToCameraMatrix * tileset.Behaviour.transform.localToWorldMatrix; Plane[] planes = GeometryUtility.CalculateFrustumPlanes(cameraMatrix); sse.Configure(cam); Vector3 cameraPositionInTileset = tileset.Behaviour.transform.InverseTransformPoint(cam.transform.position); Vector3 cameraForwardInTileset = tileset.Behaviour.transform.InverseTransformDirection(cam.transform.forward); DetermineFrustumSet(tileset.Root, planes, sse, cameraPositionInTileset, cameraForwardInTileset, PlaneClipMask.GetDefaultMask()); } foreach (var ft in ForceTiles) { for (var tile = ft; tile != null; tile = tile.Parent) { if (!tile.FrameState.IsUsedThisFrame) { tile.FrameState.Reset(); tile.MarkUsed(); tile.FrameState.InFrustumSet = true; tileset.Statistics.FrustumSet++; } } } MarkUsedSetLeaves(tileset.Root); AssignPrioritiesRecursively(tileset.Root); SkipTraversal(tileset.Root); ToggleTiles(tileset.Root); //RequestManager.Process() and UnloadUnusedContent() //are called once for all tilesets at end of AbstractTilesetBehaviour.LateUpdate() }