Skip to content

Rasterize

Overview

Test rasterization

@author Jonathan Olson <jonathan.olson@colorado.edu>

Class Rasterize

import { Rasterize } from 'scenerystack/alpenglow';

Static Methods

rasterizeAccumulate( outputRaster : OutputRaster, renderableFaces : RenderableFace[], bounds : Bounds2, contributionBounds : Bounds2, outputRasterOffset : Vector2, polygonFiltering : PolygonFilterType, polygonFilterWindowMultiplier : number, executionMethod : RenderExecutionMethod, log : RasterLog | null )

markStart( name : string )

markEnd( name : string )

partitionRenderableFaces( renderProgram : RenderProgram, bounds : Bounds2, providedOptions? : RasterizationOptions ) : RenderableFace[]

rasterize( renderProgram : RenderProgram, outputRaster : OutputRaster, bounds : Bounds2, providedOptions? : RasterizationOptions )

imageDataToCanvas( imageData : ImageData ) : HTMLCanvasElement

writeImageDataToCanvas( imageData : ImageData, canvas : HTMLCanvasElement, context : CanvasRenderingContext2D )

Type RasterizationOptions

import type { RasterizationOptions } from 'scenerystack/alpenglow';
  • outputRasterOffset?: Vector2
    We'll write our results into the output raster at this x,y offset. NOTE: This is not needed when tiling, if we are rendering a region that goes from x:(100,200), by default we will output into the raster at x:(100,200). This should be used if we want to e.g. render a region that goes from x:(100,200) into the raster at x:(0,100).
  • tileSize?: number
    Tiling is splitting our processing into (tileSize x tileSize) chunks BEFORE sending our processing to the CAG. Each tile will get CAG'ed separately, and then we'll combine the results. This is useful for large images, where it can reduce the edge-intersection costs. In addition, it will likely be helpful for parallelization.
  • polygonFiltering?: PolygonFilterType
    TODO: doc
  • polygonFilterWindowMultiplier?: number
    We'll expand the filter self by this multiplier. If it is not 1, it will potentially drop performance significantly (we won't be able to grid-clip to do it efficiently, and it might cover significantly more area).
  • edgeIntersectionSortMethod?: "none" | "center-size" | "min-max" | "min-max-size" | "center-min-max" | "random"
    TODO: consistent naming conventions
  • edgeIntersectionMethod?: "quadratic" | "boundsTree" | "arrayBoundsTree"
  • renderableFaceType?: "polygonal" | "edged" | "edgedClipped"
  • renderableFaceMethod?: "simple" | "fullyCombined" | "simplifyingCombined" | "traced"
    - 'simple' will simply pass through the edges to the renderable faces
  • 'fullyCombined' will combine ALL faces with equivalent RenderPrograms into one.
  • 'simplifyingCombined' will (a) only combine compatible faces if they touch, and (b) will remove edges between compatible faces.
  • 'traced' will function similarly to simplifyingCombined, but will trace out the resulting polygonal faces.
  • splitPrograms?: boolean
  • executionMethod?: RenderExecutionMethod
  • log?: RasterLog | null

Source Code

See the source for Rasterize.ts in the alpenglow repository.