RenderProgram¶
Overview¶
Represents an abstract rendering program, that may be location-varying
@author Jonathan Olson <jonathan.olson@colorado.edu>
Class RenderProgram¶
Constructor¶
new RenderProgram( children : RenderProgram[], isFullyTransparent : boolean, isFullyOpaque : boolean, needsFace, needsArea, needsCentroid )¶
Instance Methods¶
withChildren( children : RenderProgram[] ) : RenderProgram¶
Should return an otherwise-identical version of the RenderProgram with the given children.
getName() : string¶
Should return the name of the RenderProgram, for serialization and debugging purposes.
simplified() : RenderProgram¶
getSimplified( children : RenderProgram[] ) : RenderProgram | null¶
(protected)
This is an internal method for RenderPrograms to implement their simplification. It will get called by simplified() with pre-simplified children.
null should be returned when there is no simplification possible. The simplification engine will be able to use this information to reduce the number of RenderPrograms created during simplification. (For instance, if none of the children were actually simplified, it will be able to mark THIS RenderProgram as being "fully simplified", and further calls to simplified() can short-circuit.
writeInstructions( instructions : RenderInstruction[] )¶
evaluate( context : RenderEvaluationContext ) : Vector4¶
Premultiplied linear RGB, ignoring the path
equals( other : RenderProgram ) : boolean¶
equalsTyped( other : this ) : boolean¶
(protected)
getEvaluator() : RenderEvaluator¶
transformed( transform : Matrix3 ) : RenderProgram¶
Returns a new RenderProgram with the given transform applied to it.
NOTE: Default implementation, should be overridden by subclasses that have positioning information embedded inside
depthFirst( callback : ( program: RenderProgram ) => void )¶
TODO: add early exit!
containsRenderProgram( renderProgram : RenderProgram ) : boolean¶
replace( callback : ( program: RenderProgram ) => RenderProgram | null ) : RenderProgram¶
withPathInclusion( pathTest : ( renderPath: RenderPath ) => boolean ) : RenderProgram¶
isSplittable() : boolean¶
split( face : RenderableFace ) : RenderableFace[]¶
getNeeds() : RenderProgramNeeds¶
colorConverted( fromSpace : RenderColorSpace, toSpace : RenderColorSpace ) : RenderProgram¶
toRecursiveString( indent ) : string¶
getExtraDebugString() : string¶
(protected)
print()¶
serialize() : SerializedRenderProgram¶
Instance Properties¶
children : RenderProgram[]¶
(readonly)
isSimplified¶
Whether it is fully simplified (so simplification steps can be skipped)
isFullyTransparent : boolean¶
(readonly)
Whether it is fully transparent (so we can skip rendering it)
isFullyOpaque : boolean¶
(readonly)
Whether it is fully opaque (so we could potentially skip rendering other things)
needsFace : boolean¶
(readonly)
Whether this subtree wants a computed face for its evaluation (If not, can give bogus values for evaluate)
needsArea : boolean¶
(readonly)
Whether this subtree wants a computed area for its evaluation (If not, can give bogus values for evaluate)
needsCentroid : boolean¶
(readonly)
Whether this subtree wants a computed centroid for its evaluation (If not, can give bogus values for evaluate)
hasPathBoolean : boolean¶
(readonly)
Whether this subtree contains a RenderPathBoolean
Static Methods¶
deserialize( obj : SerializedRenderProgram ) : RenderProgram¶
ensureFace( face : ClippableFace | null, minX : number, minY : number, maxX : number, maxY : number ) : ClippableFace¶
TODO: Prefer RenderEvaluationContext.getFace() @deprecated
closureIsFullyTransparent( renderProgram : RenderProgram ) : boolean¶
closureIsFullyOpaque( renderProgram : RenderProgram ) : boolean¶
closureSimplified( renderProgram : RenderProgram ) : RenderProgram¶
Static Properties¶
simplify¶
Global flag for controlling whether simplification happens. Useful for debugging.
Type RenderEvaluator¶
Output should be chained (the output
parameter should be returned, for convenience)
( context: RenderEvaluationContext, output: Vector4 ) => Vector4
Type SerializedRenderProgram¶
- type: string
Source Code¶
See the source for RenderProgram.ts in the alpenglow repository.