CanvasField
Canvas class for 2D/3D Context
Constructor Summary
Public Constructor | ||
public |
constructor(canvasElement: HTMLCanvasElement, options: Map) constructor |
Method Summary
Public Methods | ||
public |
addObject(obj: DH3DObject | DH2DObject, alpha: boolean, notReflection: boolean): void add object to draw |
|
public |
checkGLError(message: string): void output WebGL errors to console |
|
public |
create message window |
|
public |
disableDropEvent(): void disable Drag&Drop event: not implemented |
|
public |
disableMirror(): void disable mirror |
|
public |
drawOneFrame(): void draw one frame without animation |
|
public |
drawPicture(): void draw one frame |
|
public |
enableMirror(): void enable mirror |
|
public |
get 2D canvas context |
|
public |
getCameras(): Array<Camera> get camera objects |
|
public |
getContext(): WebGLRenderingContext get WebGL context |
|
public |
getFPS(): float get FPS |
|
public |
get Light objects |
|
public |
getProgram(): WebGLProgram get WebGL program |
|
public |
pause(): void pause animation |
|
public |
removeObject(obj: DH2DObject | DH3DObject): void remove object to draw |
|
public |
reshape canvas field |
|
public |
add Camera object |
|
public |
setDropEvent(func: Function): void set callback function for Drag&Drop event |
|
public |
setFPS(fps: float): void set FPS to limit the max FPS |
|
public |
setFrameCallback(func: Function): void set callback function which is called after each frame |
|
public |
add Light object |
|
public |
setProgram(program: WebGLProgram): void set WebGLProgram |
|
public |
start(): void start animation |
Public Constructors
Public Methods
public addObject(obj: DH3DObject | DH2DObject, alpha: boolean, notReflection: boolean): void source
add object to draw
Params:
Name | Type | Attribute | Description |
obj | DH3DObject | DH2DObject | object to draw |
|
alpha | boolean | true if it has alpha channel (it needs z-sort before drawing) |
|
notReflection | boolean | true if it has reflection (like mirror) |
Return:
void |
public checkGLError(message: string): void source
output WebGL errors to console
Params:
Name | Type | Attribute | Description |
message | string | extra message to add to error log |
Return:
void |
public getContext(): WebGLRenderingContext source
get WebGL context
Return:
WebGLRenderingContext | WebGL context |
public getProgram(): WebGLProgram source
get WebGL program
Return:
WebGLProgram | WebGL program object |
public removeObject(obj: DH2DObject | DH3DObject): void source
remove object to draw
Params:
Name | Type | Attribute | Description |
obj | DH2DObject | DH3DObject | object to remove |
Return:
void |
public reshape(force: boolean): void source
reshape canvas field
Params:
Name | Type | Attribute | Description |
force | boolean |
Return:
void |
public setCamera(camera: Camera): void source
add Camera object
Params:
Name | Type | Attribute | Description |
camera | Camera | Camera object to add |
Return:
void |
public setDropEvent(func: Function): void source
set callback function for Drag&Drop event
Params:
Name | Type | Attribute | Description |
func | Function | callback function |
Return:
void |
public setFPS(fps: float): void source
set FPS to limit the max FPS
Params:
Name | Type | Attribute | Description |
fps | float | max FPS |
Return:
void |
public setFrameCallback(func: Function): void source
set callback function which is called after each frame
Params:
Name | Type | Attribute | Description |
func | Function | callback function which takes an int parameter (timestamp) |
Return:
void |
public setLights(light: Light): void source
add Light object
Params:
Name | Type | Attribute | Description |
light | Light | Light object to add |
Return:
void |
public setProgram(program: WebGLProgram): void source
set WebGLProgram
Params:
Name | Type | Attribute | Description |
program | WebGLProgram | WebGLProgram object |
Return:
void |