Game Development Reference
In-Depth Information
In the
setMatrixUniforms()
function, we associate the values of the
diffuseColor
components to the reference of the
materialDiffuseColor
uniform using the
uniform4f()
function.
function drawScene() {
...
...
mat4.rotateY(mvMatrix,rotateY);
mat4.rotateZ(mvMatrix,rotateZ);
...
}
The
drawScene()
function remains nearly the same, except we have added two
functions to add rotation transformation to the ModelView matrix by angles,
rotateY
and
rotateZ
, along the
y
and
z
axes. The values of variables are controlled by the
handleKeys(e)
function, which is invoked when any of the arrow keys are pressed.
Rendering without light
Open the
02-Loading-Model-JSON.html
file in your browser and you will see an
outcome similar to the following screenshot. The render does not show distinct
object features. We exported a monkey model from Blender in an OBJ file and
converted it to JSON. Select
Monkey
from the
Select Model
option. The output of
the
02-Loading-Model-JSON.html
file is shown in the following screenshot: