Members
(readonly) _OBJisLoading
Indicates if an object is currently loading or not. True when loading, otherwise false.
- Source:
(readonly) _TEXisLoading
Indicates if an texture is currently loading or not. True when loading, otherwise false.
- Source:
(readonly) canvas :HTMLCanvasElement
The HTMLCanvasElement.
Type:
- HTMLCanvasElement
- Source:
controller :Object
The main controller Object which handles mouse, keyboard and touch events.
Mouse: Left-Mousebutton and drag | Rotation Right-Mousebutton and drag | Translation Mousewheel | Zoom/Object scaling Keyboard: Arrow-Keys | Translation +/- Keys | Zoom/Object scaling Touch-Gestures: Touch and drag | Rotation Double-Tap and drag | Translation Two-finger pinch | Zoom/Object scaling
Type:
- Object
- Source:
controller:deltaXRot :Number
The delta x-Rotation of the current interaction.
Type:
- Number
- Source:
controller:deltaXTrans :Number
The delta x-Translation of the current interaction.
Type:
- Number
- Source:
controller:deltaYRot :Number
The delta y-Rotation of the current interaction.
Type:
- Number
- Source:
controller:deltaYTrans :Number
The delta y-Translation of the current interaction.
Type:
- Number
- Source:
controller:deltaZTrans :Number
The delta z-Translation of the current interaction.
Type:
- Number
- Source:
controller:objectScale :Number
The scaling factor.
Type:
- Number
- Source:
controller:velocity :Number
Sets the sensitivity of interactions. Typical values are 1/x, where x is a number.
Type:
- Number
- Source:
controller:xRot :Number
The overall amount of x-Rotation of all interactions.
Type:
- Number
- Source:
controller:xTrans :Number
The overall amount of x-Translation of all interactions.
Type:
- Number
- Source:
controller:yRot :Number
The overall amount of y-Rotation of all interactions.
Type:
- Number
- Source:
controller:yTrans :Number
The overall amount of y-Translation of all interactions.
Type:
- Number
- Source:
controller:zTrans :Number
The overall amount of z-Translation of all interactions.
Type:
- Number
- Source:
(readonly) gl :WebGLRenderingContext
Access to the WebGLRenderingContext interface.
Type:
- WebGLRenderingContext
- Source:
Methods
flatten(m) → {Float32Array}
Takes in a javascript array and copies it into a Float32Array.
Parameters:
Name | Type | Description |
---|---|---|
m |
Array | An array in javascript representation |
- Source:
Returns:
The newly created Float32Array
- Type
- Float32Array
getFragmentShaderSource() → {String}
Returns the fragment shader code in String representation provided in the FS form.
- Source:
Returns:
String representation of the fragment shader code.
- Type
- String
getVertexShaderSource() → {String}
Returns the vertex shader code in String representation provided in the VS form.
- Source:
Returns:
String representation of the vertex shader code.
- Type
- String
initShaders(gl) → {WebGLProgram}
Takes in the WebGLRenderingContext and starts to compile, attach and link the Vertex- and Fragment Shader.
Parameters:
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext | is the WebGLRenderingContext instance |
- Source:
Returns:
A WebGLProgram object that is a combination of two compiled WebGLShaders consisting of a vertex shader and
a fragment shader (both written in GLSL). These are then linked into a usable program.
- Type
- WebGLProgram
lookAtArcballCamera(matrix, eye, at, up)
Generates a mat4 viewing matrix and connects it with the control of an arcball camera, by using the Object literals of the controller Object.
Note: In order to see the changes when interacting with the canvas, the provided matrix has to be send to the vertex shader (e.g. as an uniform) in the render-loop.
Parameters:
Name | Type | Description |
---|---|---|
matrix |
mat4 | Placeholder matrix in which the viewing matrix will be stored |
eye |
vec3 | The starting camera position |
at |
vec3 | The starting focus point |
up |
vec3 | The starting roll of the camera |
- Source:
modelInteraction(matrix)
Takes in a mat4 model matrix and manipulates it by using the Object literals of the controller Object.
Note: In order to see the changes when interacting with the canvas, the provided matrix has to be send to the vertex shader (e.g. as an uniform) in the render-loop.
Parameters:
Name | Type | Description |
---|---|---|
matrix |
mat4 | Placeholder matrix in which the model matrix will be stored |
- Source:
writeLog(message)
Logging function which prints the value of any given Type to the status-window.
Parameters:
Name | Type | Description |
---|---|---|
message |
* | The message to be displayed |
- Source: