MasDennis/Rajawali — pull request #438 by Davhed (2013-03-02 18:02:16+00:00)
Title: Smart Materials - Clean branch

Summary

There is a need for a super simple process for adding bump/normal, spec, and alpha maps to `PhongMaterial`, `GouraudMaterial`, and `SimpleMaterial`.

Method

Macros are used to determine what code branch to implement within each shader. The macros are added to the shader programs based on a boolean condition for each texture type. `addTexture` checks the incoming `TextureType` and handles them accordingly.

Usage

Map support by material:
`PhongMaterial` - Bump/Norm, Spec, Alpha
`GouraudMaterial` - Spec, Alpha
`SimpleMaterial` - Alpha

````java
PhongMaterial myNewMaterial = new PhongMaterial();
myNewMaterial.addTexture(BitmapFactory.decodeResource(mContext.getResources(), R.drawable.diffuseTexture));
myNewMaterial.addTexture(BitmapFactory.decodeResource(mContext.getResources(), R.drawable.alphaTexture), TextureType.ALPHA);
myNewMaterial.addTexture(BitmapFactory.decodeResource(mContext.getResources(), R.drawable.normalTexture), TextureType.BUMP);

BaseObject3D myObject = newBaseObject3D();
myObject.setMaterial(myNewMaterial);
myObject.addLight(new PointLight());

addChild(myObject);
````