Merge: gamnit: Blinn-Phong specular lighting, 3 axes of rotation and more
authorJean Privat <jean@pryen.org>
Wed, 7 Jun 2017 20:11:08 +0000 (16:11 -0400)
committerJean Privat <jean@pryen.org>
Wed, 7 Jun 2017 20:11:08 +0000 (16:11 -0400)
commit3c60c3f7e691f2585019d4b8b1a5308084ed0108
tree8bad073eab16b97a8e3c0807ba39c59447d63726
parentb25bb8ac861e985a52d0b36a06a97075987ab386
parent7d72f2b14c712313bc3d9e03a34654e396ef15ca
Merge: gamnit: Blinn-Phong specular lighting, 3 axes of rotation and more

Implement a Blinn-Phong specular lighting shader to replace the previous Lamber diffuse lighting. It creates a reflection effect either from `specular_color` (as on the shields) or `specular_texture` (as on the gold tower).

![screenshot from 2017-05-31 10 16 13](https://cloud.githubusercontent.com/assets/208057/26636318/5a017ffc-45ea-11e7-8571-0918f13f6d9c.png)
![screenshot from 2017-05-30 23 13 32](https://cloud.githubusercontent.com/assets/208057/26636316/59c940c4-45ea-11e7-9106-99f9344cecbf.png)

The required material attributes for the specular effect were already present but not implemented. This PR adds similar attributes for normal maps, but leave them as a TODO. The new shader is fine but not optimal, I'll probably need to rewrite it to gain some performance, support normal maps and improve normals per vertex.

Add two angles of rotation to actors for full 3D rotation with Euler angles. All rotation angles follow the right-hand rule and are consistent between the camera and actors.

Other changes:
* Intro `Cuboid` that can be created by `Boxed3d::to_mesh`.
* Better error management when loading models.
* Fix missing `lock_cursor` implementation on desktop. It allows creating FPS like cameras.
* Fix and update `angle_lerp` to follow the style of `lerp` (where `self` is the weight).
* Improve the template project so 3D objects don't blend in the background and explain the printed performance statistics.

In a future PR, I'll standardize the assets classes and move some service up to `Asset`. This would allow for easier loading of all assets at once, no matter their type, and offer a standard behavior regarding errors and lazy loading.

Pull-Request: #2471
Reviewed-by: Jean-Christophe Beaupré <jcbrinfo.public@gmail.com>