// Path: MarsImages/Rajawali/src/main/java/rajawali/lights/ALight.java
// public abstract class ALight extends ATransformable3D {
// 	public static final int DIRECTIONAL_LIGHT = 0;
// 	public static final int POINT_LIGHT = 1;
// 	public static final int SPOT_LIGHT = 2;
// 
// 	protected float[] mColor = new float[] { 1.0f, 1.0f, 1.0f };
// 	protected float[] mPositionArray = new float[3];
// 	protected float[] mDirectionArray = new float[3];
// 	protected float mPower = .5f;
// 	private int mLightType;
// 
// 	protected boolean mUseObjectTransform;
// 
// 	public ALight(int lightType) {
// 		super();
// 		mLightType = lightType;
// 	}
// 
// 	public void setColor(final float r, final float g, final float b) {
// 		mColor[0] = r;
// 		mColor[1] = g;
// 		mColor[2] = b;
// 	}
// 
// 	public void setColor(int color) {
// 		mColor[0] = ((color >> 16) & 0xFF) / 255f;
// 		mColor[1] = ((color >> 8) & 0xFF) / 255f;
// 		mColor[2] = (color & 0xFF) / 255f;
// 	}
// 
// 	public void setColor(Number3D color) {
// 		mColor[0] = color.x;
// 		mColor[1] = color.y;
// 		mColor[2] = color.z;
// 	}
// 
// 	public float[] getColor() {
// 		return mColor;
// 	}
// 
// 	public void setPower(float power) {
// 		mPower = power;
// 	}
// 
// 	public float getPower() {
// 		return mPower;
// 	}
// 
// 	public boolean shouldUseObjectTransform() {
// 		return mUseObjectTransform;
// 	}
// 
// 	public void shouldUseObjectTransform(boolean useObjectTransform) {
// 		this.mUseObjectTransform = useObjectTransform;
// 	}
// 
// 	public int getLightType() {
// 		return mLightType;
// 	}
// 
// 	public void setLightType(int lightType) {
// 		this.mLightType = lightType;
// 	}
// 
// 	public float[] getPositionArray() {
// 		mPositionArray[0] = mPosition.x;
// 		mPositionArray[1] = mPosition.y;
// 		mPositionArray[2] = mPosition.z;
// 		return mPositionArray;
// 	}
// }


import com.monyetmabuk.livewallpapers.photosdof.R;
import rajawali.lights.ALight;
package rajawali.materials;



public class BumpmapMaterial extends AAdvancedMaterial {

	public BumpmapMaterial() {
		this(false);
	}
	
	public BumpmapMaterial(String vertexShader, String fragmentShader, boolean isAnimated) {
		super(vertexShader, fragmentShader, isAnimated);
	}
	
	public BumpmapMaterial(boolean isAnimated) {
		super(R.raw.diffuse_material_vertex, R.raw.bumpmap_material_fragment, isAnimated);
	}
	
	public void setShaders(String vertexShader, String fragmentShader) {
		StringBuffer fc = new StringBuffer();
		StringBuffer vc = new StringBuffer();
		fc.append("float normPower = 0.0;\n");
		
		for(int i=0; i<mLights.size(); ++i) {
			ALight light = mLights.get(i);
			
			if(light.getLightType() == ALight.POINT_LIGHT) {
				fc.append("L = normalize(uLightPosition").append(i).append(" - V.xyz);\n");
				vc.append("dist = distance(V.xyz, uLightPosition").append(i).append(");\n");
				vc.append("vAttenuation").append(i).append(" = 1.0 / (uLightAttenuation").append(i).append("[1] + uLightAttenuation").append(i).append("[2] * dist + uLightAttenuation").append(i).append("[3] * dist * dist);\n");
			} else if(light.getLightType() == ALight.DIRECTIONAL_LIGHT) {
// Path: MarsImages/Rajawali/src/main/java/rajawali/lights/ALight.java
// public abstract class ALight extends ATransformable3D {
// 	public static final int DIRECTIONAL_LIGHT = 0;
// 	public static final int POINT_LIGHT = 1;
// 	public static final int SPOT_LIGHT = 2;
// 
// 	protected float[] mColor = new float[] { 1.0f, 1.0f, 1.0f };
// 	protected float[] mPositionArray = new float[3];
// 	protected float[] mDirectionArray = new float[3];
// 	protected float mPower = .5f;
// 	private int mLightType;
// 
// 	protected boolean mUseObjectTransform;
// 
// 	public ALight(int lightType) {
// 		super();
// 		mLightType = lightType;
// 	}
// 
// 	public void setColor(final float r, final float g, final float b) {
// 		mColor[0] = r;
// 		mColor[1] = g;
// 		mColor[2] = b;
// 	}
// 
// 	public void setColor(int color) {
// 		mColor[0] = ((color >> 16) & 0xFF) / 255f;
// 		mColor[1] = ((color >> 8) & 0xFF) / 255f;
// 		mColor[2] = (color & 0xFF) / 255f;
// 	}
// 
// 	public void setColor(Number3D color) {
// 		mColor[0] = color.x;
// 		mColor[1] = color.y;
// 		mColor[2] = color.z;
// 	}
// 
// 	public float[] getColor() {
// 		return mColor;
// 	}
// 
// 	public void setPower(float power) {
// 		mPower = power;
// 	}
// 
// 	public float getPower() {
// 		return mPower;
// 	}
// 
// 	public boolean shouldUseObjectTransform() {
// 		return mUseObjectTransform;
// 	}
// 
// 	public void shouldUseObjectTransform(boolean useObjectTransform) {
// 		this.mUseObjectTransform = useObjectTransform;
// 	}
// 
// 	public int getLightType() {
// 		return mLightType;
// 	}
// 
// 	public void setLightType(int lightType) {
// 		this.mLightType = lightType;
// 	}
// 
// 	public float[] getPositionArray() {
// 		mPositionArray[0] = mPosition.x;
// 		mPositionArray[1] = mPosition.y;
// 		mPositionArray[2] = mPosition.z;
// 		return mPositionArray;
// 	}
// }


// Path: MarsImages/Rajawali/src/main/java/rajawali/materials/BumpmapMaterial.java
import com.monyetmabuk.livewallpapers.photosdof.R;
import rajawali.lights.ALight;

package rajawali.materials;



public class BumpmapMaterial extends AAdvancedMaterial {

	public BumpmapMaterial() {
		this(false);
	}
	
	public BumpmapMaterial(String vertexShader, String fragmentShader, boolean isAnimated) {
		super(vertexShader, fragmentShader, isAnimated);
	}
	
	public BumpmapMaterial(boolean isAnimated) {
		super(R.raw.diffuse_material_vertex, R.raw.bumpmap_material_fragment, isAnimated);
	}
	
	public void setShaders(String vertexShader, String fragmentShader) {
		StringBuffer fc = new StringBuffer();
		StringBuffer vc = new StringBuffer();
		fc.append("float normPower = 0.0;\n");
		
		for(int i=0; i<mLights.size(); ++i) {
			ALight light = mLights.get(i);
			
			if(light.getLightType() == ALight.POINT_LIGHT) {
				fc.append("L = normalize(uLightPosition").append(i).append(" - V.xyz);\n");
				vc.append("dist = distance(V.xyz, uLightPosition").append(i).append(");\n");
				vc.append("vAttenuation").append(i).append(" = 1.0 / (uLightAttenuation").append(i).append("[1] + uLightAttenuation").append(i).append("[2] * dist + uLightAttenuation").append(i).append("[3] * dist * dist);\n");
			} else if(light.getLightType() == ALight.DIRECTIONAL_LIGHT) {
				fc.append("L = -normalize(uLightDirection").append(i).append(");");				