Packagesandy.materials
Classpublic class BitmapMaterial
InheritanceBitmapMaterial Inheritance Material
ImplementsIAlphaMaterial
SubclassesMovieMaterial, VideoMaterial

Displays a bitmap on the faces of a 3D shape.



Public Properties
 PropertyDefined by
  alpha : Number
Indicates the alpha transparency value of the material.
BitmapMaterial
 Inheritedattributes : MaterialAttributes
The attributes of this material.
Material
 InheritedautoDispose : Boolean = true
Specifies if the material can automatically be disposed when unused Default value is to true
Material
 Inheritedfilters : Array
The array of filters for this material.
Material
 Inheritedflags : uint
Contains specific material flags.
Material
 Inheritedid : Number
The unique id of this material.
Material
 InheritedlightingEnable : Boolean = false
Specifies if the material can receive light and have light attributes applied to it.
Material
  maxRecurssionDepth : uint = 5
Maximum recurssion depth when using precision > 1 (which enables the perspective correction).
BitmapMaterial
 Inheritedmodified : Boolean
The modified state of this material.
Material
  precision : uint = 0
Precision of the bitmap mapping.
BitmapMaterial
 Inheritedrepeat : Boolean = true
The repeat property.
Material
  smooth : Boolean = false
This property enables smooth bitmap rendering when set to true.
BitmapMaterial
  texture : BitmapData
The texture ( bitmap ) of this material.
BitmapMaterial
 Inheritedtype : MaterialType
The material type of this material.
Material
 InheriteduseVertexNormal : Boolean = false
Specify if the material use the vertex normal information.
Material
Protected Properties
 PropertyDefined by
 Inheritedm_nRefCounting : int
Material
 Inheritedm_oPolygonMap : Dictionary
Material
Public Methods
 MethodDefined by
  
BitmapMaterial(p_oTexture:BitmapData = null, p_oAttr:MaterialAttributes = null, p_nPrecision:uint = 0)
Creates a new BitmapMaterial.
BitmapMaterial
 Inherited
begin(p_oScene:Scene3D):void
Calls begin method of the MaterialAttributes associated with this material.
Material
  
dispose():void
BitmapMaterial
 Inherited
finish(p_oScene:Scene3D):void
Calls finish method of the MaterialAttributes associated with this material.
Material
  
init(p_oPolygon:Polygon):void
BitmapMaterial
 Inherited
renderPolygon(p_oScene:Scene3D, p_oPolygon:Polygon, p_mcContainer:Sprite):void
Renders the polygon dress in this material.
Material
 Inherited
renderSprite(p_oSprite:Sprite2D, p_oMaterial:Material, p_oScene:Scene3D):void
Renders the sprite dress in this material.
Material
  
setTiling(p_nW:Number, p_nH:Number, p_nU:Number = 0, p_nV:Number = 0):void
Sets texture tiling and optional offset.
BitmapMaterial
  
setTransparency(p_nValue:Number):void
Changes the transparency of the texture.
BitmapMaterial
  
toString():String
Returns a string representation of this object.
BitmapMaterial
 Inherited
unlink(p_oPolygon:Polygon):void
Calls unlink method of the MaterialAttributes associated with this material.
Material
 Inherited
unlinkAll():Array
Unlink all the non used polygons
Material
Property detail
alphaproperty
alpha:Number  [read-write]

Indicates the alpha transparency value of the material. Valid values are 0 (fully transparent) to 1 (fully opaque).

The default value is 1.0.

Implementation
    public function get alpha():Number
    public function set alpha(value:Number):void

See also

setTransparency()
maxRecurssionDepthproperty 
public var maxRecurssionDepth:uint = 5

Maximum recurssion depth when using precision > 1 (which enables the perspective correction). The bigger the number is, the more accurate the result will be. Try to change this value to fits your needs to obtain the best performance.

precisionproperty 
public var precision:uint = 0

Precision of the bitmap mapping. This material uses an affine linear mapping. It results in a lack of accuracy at rendering time when the surface to draw is too big. One usual solution is to augment the number of polygon, but the performance cost can be quite big. Another solution is to change the precision property value. The lower the value, the more accurate the perspective correction is. To disable the perspective correction, set this property to zero, which is also the default value If you use the precision to solve the distortion issue, you can reduce the primitives quality (except if you are experiencing some sorting issues)

smoothproperty 
public var smooth:Boolean = false

This property enables smooth bitmap rendering when set to true. The default value is set to false to have the best performance first. Enable this property have a performance impact, use it warefully

textureproperty 
texture:BitmapData  [read-write]

The texture ( bitmap ) of this material.

Implementation
    public function get texture():BitmapData
    public function set texture(value:BitmapData):void
Constructor detail
BitmapMaterial()constructor
public function BitmapMaterial(p_oTexture:BitmapData = null, p_oAttr:MaterialAttributes = null, p_nPrecision:uint = 0)

Creates a new BitmapMaterial.

Please note that we use internally a copy of the constructor bitmapdata. That means in case you need to access this bitmapdata, you can't just use the same reference but you shall use the BitmapMaterial#texture getter property to make it work.

Parameters
p_oTexture:BitmapData (default = null) — The bitmapdata for this material.
 
p_oAttr:MaterialAttributes (default = null) — The attributes for this material.
 
p_nPrecision:uint (default = 0) — The precision of this material. Using a precision with 0 makes the material behave as before. Then 1 as precision is very high and requires a lot of computation but proceed a the best perpective mapping correction. Bigger values are less CPU intensive but also less accurate. Usually a value of 5 is enough.

See also

Method detail
dispose()method
public override function dispose():void
init()method 
public override function init(p_oPolygon:Polygon):void

Parameters
p_oPolygon:Polygon — The face dressed by this material
setTiling()method 
public function setTiling(p_nW:Number, p_nH:Number, p_nU:Number = 0, p_nV:Number = 0):void

Sets texture tiling and optional offset. Tiling is applied first.

Parameters
p_nW:Number
 
p_nH:Number
 
p_nU:Number (default = 0)
 
p_nV:Number (default = 0)
setTransparency()method 
public function setTransparency(p_nValue:Number):void

Changes the transparency of the texture.

The passed value is the percentage of opacity. Note that in order for this to work with animated texture, you need set material transparency every time after new texture frame is rendered.

Parameters
p_nValue:Number — A value between 0 and 1. (automatically constrained)
toString()method 
public function toString():String

Returns a string representation of this object.

Returns
String — The fully qualified name of this object.