Returns the selected IterationAlgorithm which determines the sequence in which the tiles are rendered.
Sets the selected IterationAlgorithm which determines the order in which the tiles are rendered. The default is
ScanLine
. If needed, it automatically adjusts the tileSize to match the new algorithm.
Read-only access to the tiled camera that has the viewport of the current tile of the input/source camera.
Returns the total number of tiles based on the how many of tileSize fit inside the sourceViewport.
Returns the number of tiles along the x-axis based on the number of tiles that fit inside the horizontal extent of the source camera's viewport.
Returns the number of tiles along the y-axis based on the number of tiles that fit inside the vertical extent of the source camera's viewport.
Returns the offset of the current tile. The padding is not included in the offset.
Returns the sourceCamera which viewport should be divided in tiles. If the sourceCamera has not been set, it returns a default camera.
Assigns the input camera whose viewport will be divided in tiles. Additionally it creates a deep copy of the input camera which is used as the tiled camera camera.
The input camera whose viewport will be divided in tiles.
Returns the size of the original viewport which should be divided in tiles based on the tile size. If the viewport has not been set, it returns [-1, -1].
Sets the size of the viewport from the sourceCamera. It checks if the sourceViewport is compatible with the selected algorithm and eventually adjusts the tileSize to match the conditions of the algorithm.
Returns the current tile index.
Sets the current tile index.
The new index.
Creates a 4-tuple with x0, y0, and width and height of the viewport for the current tile and camera.
Ensures that the indices are available. If not, indices using the algorithm set will be generated.
Returns the padded tileSize.
Returns if tiles still need to be rendered.
Used for Iterator behavior. It sets the tile to 0 (first tile) if the value of tile is negative and therefore initiates the iteration. Otherwise it increments the tile and calls update to directly change the camera. If the tile index would get out of range it returns false to indicate, that all tiles were rendered.
Resets the tile index to prepare the generator for the next rendering. Should be called after iteration with nextTile().
Reassigns all values from the source camera to the tile camera, e.g., when the source camera is altered.
Converts the tile index from the selected Algorithm to table indices.
Updates the camera view frustum to current tile based on the sourceViewport, tileSize and the padding. If the tile is less than zero, the camera is set to the first tile. If the tile is too high, the camera is not updated and remains in the last valid state.
Fills the iterationAlgorithmIndices with the table indices from the HilbertCurve-Iteration-Algorithm.
Generates interleaved table indices using the ZCurve-Iteration-Algorithm.
Fills the sequence/array of indices with the table indices from the ZCurve-Iteration-Algorithm.
Recursively fills the interleaved indices using the Hilbert Curve. This method is not intended to be used directly. Use generateHilbertIndices generateHilbertIndices instead.
Support Class that wraps the calculation of camera tiling and iteration with various algorithms by giving access to an adjusted camera which NDC-Coordinates match the current tile index. Iteration can be done manually (variant: 1) or automatically (variant: 2). It is intended to be used like:
tileCameraGenerator = new TileCameraGenerator(); tileCameraGenerator.sourceCamera = camera; tileCameraGenerator.sourceViewport = canvasSize; tileCameraGenerator.tileSize = [128, 128]; tileCameraGenerator.algorithm = TileCameraGenerator.Algorithm.ScanLine; let offset: [number, number];
iteration variant 1: for (let i = 0; i < tileCameraGenerator.numberOfTiles(); ++i){ tileCameraGenerator.tile = i; // property tileCameraGenerator.update(); offset = tileCameraGenerator.offset; "render camera" }
iteration variant 2: while(tileCameraGenerator.nextTile()){ offset = tileCameraGenerator.offset; "render" } // reset generator tileCameraGenerator.reset();
NOTE: Use
sourceCameraChanged
if the source camera is altered.