-
Notifications
You must be signed in to change notification settings - Fork 0
/
globals.js
39 lines (33 loc) · 1.01 KB
/
globals.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { mat4, mat3, vec4, vec3 } = glMatrix;
const toRad = glMatrix.glMatrix.toRadian;
const shaderPrograms = {
noLightProgram: new ShaderProgram(),
gourandDiffuseProgram: new ShaderProgram(),
gourandSpecularProgram: new ShaderProgram(),
phongDiffuseProgram: new ShaderProgram(),
phongSpecularProgram: new ShaderProgram(),
cookTorranceProgram: new ShaderProgram()
}
const shaders = {
noLight: "v-shader-nolight",
fragment: "f-shader"
}
let currentShaderProgram = null;
const shaderInfo = {
attributes: {
vertexLocation: "vertexPosition",
colorLocation: "vertexColor",
normalLocation: "vertexNormal"
}, uniforms: {
modelViewMatrix: "modelViewMatrix",
projectionMatrix: "projectionMatrix",
viewMatrix: "viewMatrix",
normalMatrix: "normalMatrix",
lightViewPosition: "lightViewPosition",
cameraPosition: "cameraPosition"
}
}
const matrices = {
viewMatrix: mat4.create(),
projectionMatrix: mat4.create(),
}