Skip to content

RenderPhong

Overview

RenderProgram for a phong 3d reflection model

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

Class RenderPhong

import { RenderPhong } from 'scenerystack/alpenglow';

Constructor

new RenderPhong( alpha : number, ambientColorProgram : RenderProgram, diffuseColorProgram : RenderProgram, specularColorProgram : RenderProgram, positionProgram : RenderProgram, normalProgram : RenderProgram, lights : RenderLight[] )

Instance Methods

getName() : string

withChildren( children : RenderProgram[] ) : RenderPhong

equalsTyped( other : this ) : boolean

(protected)

getSimplified( children : RenderProgram[] ) : RenderProgram | null

(protected)

getPhong( ambientColor : Vector4, diffuseColor : Vector4, specularColor : Vector4, position : Vector4, normal : Vector4, lightDirections : Vector4[], lightColors : Vector4[] ) : Vector4

evaluate( context : RenderEvaluationContext ) : Vector4

writeInstructions( instructions : RenderInstruction[] )

serialize() : SerializedRenderPhong

Static Methods

deserialize( obj : SerializedRenderPhong ) : RenderPhong

Class RenderInstructionPhong

import { RenderInstructionPhong } from 'scenerystack/alpenglow';

Constructor

new RenderInstructionPhong( alpha : number, numLights : number )

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 ) : RenderInstructionPhong

Type SerializedRenderPhong

import type { SerializedRenderPhong } from 'scenerystack/alpenglow';

Source Code

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