MasDennis/Rajawali — pull request #467 by Davhed (2013-03-11 07:43:31+00:00)
Title: Added `SpotLight`

Reason

Rajawali has previously supported only two light types `PointLight` and `DirectionalLight`. `SpotLight` is useful for simulating attenuated directional light, such as that from a desk lamp, flashlight, etc.

![Screenshot_2013-03-11-00-29-01](https://f.cloud.github.com/assets/2634010/242587/726f78dc-8a1e-11e2-9fea-f503c6417bc8.png)

Method

`SpotLight` is built as a hybrid of `PointLight` and `DirectionalLight` with the added feature of a "cutoffAngle" and a controllable exponential "falloff". A new class was created to contain the various data, and `AAdvancedMaterial` was updated to pass in necessary uniforms.

Per-vertex spot lights look terrible and make very little sense, so only `PhongMaterial` and `DiffuseMaterial` have had spotlight support added.

Usage

Instantiate the spot light, and set the desired parameters. Then link the light to your target objects.

````java
SpotLight mSpotLight = new SpotLight();
mSpotLight.setCutoffAngle(40); // Range 0 -180
mSpotLight.setFalloff(0.4f); // Range 0.0 - 1.0 // Spot edge hardens with smaller numbers
....
myObject.addLight(mSpotLight)
````