RenderLinearBlend¶
Overview¶
RenderProgram for a linear blend (essentially a chunk of a linear gradient with only a linear transition between two things.
RenderLinearBlend will interpolate between two different RenderPrograms based on the location. It will evaluate clamp( dot( scaledNormal, point ) - offset, 0, 1 )
, and will linearly blend between the "zero" program (when the value is 0) and the "one" program (when the value is 1).
It can be used in a standalone way, however it is primarily meant to be used when a RenderLinearGradient
is split into each linear segment.
@author Jonathan Olson <jonathan.olson@colorado.edu>
Class RenderLinearBlend¶
Constructor¶
new RenderLinearBlend( scaledNormal : Vector2, offset : number, accuracy : RenderLinearBlendAccuracy, zero : RenderProgram, one : RenderProgram, logic? : RenderLinearBlendLogic )¶
Instance Methods¶
getName() : string¶
withChildren( children : RenderProgram[] ) : RenderLinearBlend¶
transformed( transform : Matrix3 ) : RenderProgram¶
equalsTyped( other : this ) : boolean¶
(protected)
getSimplified( children : RenderProgram[] ) : RenderProgram | null¶
(protected)
evaluate( context : RenderEvaluationContext ) : Vector4¶
writeInstructions( instructions : RenderInstruction[] )¶
serialize() : SerializedRenderLinearBlend¶
Instance Properties¶
logic : RenderLinearBlendLogic¶
(readonly)
Static Methods¶
deserialize( obj : SerializedRenderLinearBlend ) : RenderLinearBlend¶
Class RenderInstructionComputeBlendRatio¶
Constructor¶
new RenderInstructionComputeBlendRatio( logic : RenderLinearBlendLogic | RenderRadialBlendLogic, zeroLocation : RenderInstructionLocation, oneLocation : RenderInstructionLocation, blendLocation : RenderInstructionLocation )¶
Instance Methods¶
toString() : string¶
equals( other : RenderInstruction, areLocationsEqual : ( a: RenderInstructionLocation, b: RenderInstructionLocation ) => boolean ) : boolean¶
execute( stack : RenderExecutionStack, context : RenderEvaluationContext, executor : RenderExecutor )¶
writeBinary( encoder : ByteEncoder, getOffset : ( location: RenderInstructionLocation ) => number )¶
getBinaryLength() : number¶
Static Methods¶
fromBinary( encoder : ByteEncoder, offset : number, getLocation : ( offset: number ) => RenderInstructionLocation ) : RenderInstructionComputeBlendRatio¶
Class RenderInstructionLinearBlend¶
Takes t
value from vector.x. If t <= 0 or t >= 1, it will only return the "top" value NOTE: This is used by things in radial blends too, since it is linear at that point
Instance Methods¶
toString() : string¶
equals( other : RenderInstruction, areLocationsEqual : ( a: RenderInstructionLocation, b: RenderInstructionLocation ) => boolean ) : boolean¶
execute( stack : RenderExecutionStack, context : RenderEvaluationContext, executor : RenderExecutor )¶
( t, oneColor, zeroColor -- color )
writeBinary( encoder : ByteEncoder, getOffset : ( location: RenderInstructionLocation ) => number )¶
getBinaryLength() : number¶
Static Properties¶
INSTANCE : RenderInstructionLinearBlend¶
(readonly)
Class RenderLinearBlendLogic¶
Constructor¶
new RenderLinearBlendLogic( scaledNormal : Vector2, offset : number, accuracy : RenderLinearBlendAccuracy )¶
Instance Methods¶
equals( other : RenderLinearBlendLogic ) : boolean¶
computeLinearValue( context : RenderEvaluationContext ) : number¶
Type SerializedRenderLinearBlend¶
- type: "RenderLinearBlend"
- scaledNormal: number[]
- offset: number
- accuracy: RenderLinearBlendAccuracy
- zero: SerializedRenderProgram
- one: SerializedRenderProgram
Source Code¶
See the source for RenderLinearBlend.ts in the alpenglow repository.