Final project for Computer Graphics course of PoliMi (A.Y. 2020/2021) by Aida Gasanova and Marco Donzelli
Press play and move the hammer with q
, w
, e
, a
, s
keys. You have 60 seconds to hit as much moles as you can!
The game is implemented in WebGL, GLSL and Javascript with the use of the following libraries:
- TWGL.js, to initialize buffers, bind uniforms, etc.
- WebGL-obj-loader, to load meshes from .obj file
- jQuery 3.6.0, to handle keyboard events
The scene graph of the game holds two main nodes:
- cabinetSpace which contains the hammer, the cabinet and moleSpace
- moleSpace which contains the five moles
The root of the scene graph is stored in a global variable of the app so that the method updateWorldMatrices() can be called on it and all the local matrices of child nodes get updated accordingly with changes performed meanwhile.
The game is illuminated with two type of ligths, implemented in camera space:
- direct light still, can't be controlled by the user
- spot light direction controllable by the user along with usual spot parameters such as coneIn,coneOut, etc.
The BRDFs implemented in the shaders are the Lambert model for the diffuse part and Phong for the specular part.
Also ambient light is implemented by simply summing a term in the output vector that provides a little bit more of the colour from the texel.
We implemented a separate WebGL program and drawing pipeline to draw a "skybox" type object which surrounds the main scene.