private static var _calcMatrix : Matrix3D = new Matrix3D();
/**
* Creates a new ProjectiveTextureMaterial
* @param bitmap The bitmapData object to be used as the diffuse texture
* @param positionMap The bitmapData object to be used as the position map. A position map indicates the position for every texel in absolute normalized object space (0-1)
* @param normalMap The bitmapData object to be used as the normal map.
* @param projector The projector to be used for projection mappping
* @param scaleIfNil The scale to use on the position map if the size of the dimension (fe: maxY-minY for a plane) is 0. This can be used to fake height on a plane.
*/
public function ProjectiveTextureMaterial(bitmap : BitmapData, positionMap : BitmapData, normalMap : BitmapData, projector : BitmapProjector, scaleIfNil : Number = 1)
{
_forceScale = scaleIfNil;
_positionMatrices = new Dictionary(true);
_renderBitmap = bitmap.clone();
_positionMap = positionMap;
_normalMap = normalMap;
_projector = projector;
_shader = new Shader(new Kernel());
_shaderData = _shader.data;
_shaderData.texture.input = bitmap;
_shaderData.projective.input = _projector.bitmap;
_shaderData.positionMap.input = positionMap;
_shaderData.normalMap.input = normalMap;
_shaderData.incandescence.value[0] = 7;
super(bitmap);
smooth = true;
}
/**
* The amount by which the diffuse lighting is multiplied, to create a more incandescent look while not over-illuminating the scene
*/
public function get incandescence() : Number
{
return _shaderData.incandescence.value[0];
}
public function set incandescence(value : Number) : void
{
_shaderData.incandescence.value[0] = value;
}
/**
* The ambient lighting (indirect global reflected light, ie a minimum amount of light) that hits the surface
*/
public function get ambientColor() : uint
{
return _ambientColor;
}
public function set ambientColor(value : uint) : void