Packageaway3d.materials
Classpublic class BitmapMaterial
InheritanceBitmapMaterial Inheritance flash.events.EventDispatcher
ImplementsILayerMaterial, ITriangleMaterial, IUpdatingMaterial, IUVMaterial
SubclassesBitmapMaterialContainer, TransformBitmapMaterial

Basic bitmap material

Public Properties
 PropertyDefined by
  alpha : Number
Defines an alpha value for the texture bitmap.
BitmapMaterial
  bitmap : BitmapData
[read-only] Returns the bitmapData object being used as the material texture.
BitmapMaterial
  blendMode : String
Defines a blendMode value for the texture bitmap.
BitmapMaterial
  color : uint
Defines a colored tint for the texture bitmap.
BitmapMaterial
  debug : Boolean = false
Toggles debug mode: textured triangles are drawn with white outlines, precision correction triangles are drawn with blue outlines.
BitmapMaterial
  height : Number
[read-only] Returns the height of the bitmapData being used as the material texture.
BitmapMaterial
  precision : Number
Corrects distortion caused by the affine transformation (non-perpective) of textures.
BitmapMaterial
  repeat : Boolean = false
Determines if texture bitmap will tile in uv-space
BitmapMaterial
  smooth : Boolean = false
Determines if texture bitmap is smoothed (bilinearly filtered) when drawn to screen.
BitmapMaterial
  visible : Boolean
[read-only] Indicates whether the material is visible
BitmapMaterial
  width : Number
[read-only] Returns the width of the bitmapData being used as the material texture.
BitmapMaterial
Protected Properties
 PropertyDefined by
  ini : Init
Instance of the Init object used to hold and parse default property values specified by the initialiser object in the 3d object constructor.
BitmapMaterial
Public Methods
 MethodDefined by
  
BitmapMaterial
(bitmap:BitmapData, init:Object = null)
Creates a new BitmapMaterial object.
BitmapMaterial
  
addOnResize(listener:Function):void
Default method for adding a materialresize event listener
BitmapMaterial
  
getPixel32(u:Number, v:Number):uint
Returns the argb value of the bitmapData pixel at the given u v coordinate.
BitmapMaterial
  
removeOnResize(listener:Function):void
Default method for removing a materialresize event listener
BitmapMaterial
  
renderFace(face:Face, containerRect:Rectangle, parentFaceVO:FaceVO):FaceVO
Renders a bitmapData surface object for the speficied face.
BitmapMaterial
  
renderLayer(tri:DrawTriangle, layer:Sprite, level:int):void
Renders a material layer for the specified triangle.
BitmapMaterial
  
Sends data from the material coupled with data from the DrawTriangle primitive to the render session.
BitmapMaterial
  
updateMaterial(source:Object3D, view:View3D):void
Called once per render loop when material is visible.
BitmapMaterial
Protected Methods
 MethodDefined by
  
getMapping(tri:DrawTriangle):Matrix
Calculates the mapping matrix required to draw the triangle texture to screen.
BitmapMaterial
  
Updates the colortransform object applied to the texture from the color and alpha properties.
BitmapMaterial
  
Updates the texture bitmapData with the colortransform determined from the color and alpha properties.
BitmapMaterial
Events
 EventSummaryDefined by
   Dispatched when the bitmapData used for the material texture is resized.BitmapMaterial
Property detail
alphaproperty
alpha:Number  [read-write]

Defines an alpha value for the texture bitmap.

Implementation
    public function get alpha():Number
    public function set alpha(value:Number):void
bitmapproperty 
bitmap:BitmapData  [read-only]

Returns the bitmapData object being used as the material texture.

Implementation
    public function get bitmap():BitmapData
blendModeproperty 
blendMode:String  [read-write]

Defines a blendMode value for the texture bitmap. Applies to materials rendered as children of BitmapMaterialContainer or CompositeMaterial.

Implementation
    public function get blendMode():String
    public function set blendMode(value:String):void

See also

colorproperty 
color:uint  [read-write]

Defines a colored tint for the texture bitmap.

Implementation
    public function get color():uint
    public function set color(value:uint):void
debugproperty 
public var debug:Boolean = false

Toggles debug mode: textured triangles are drawn with white outlines, precision correction triangles are drawn with blue outlines.

heightproperty 
height:Number  [read-only]

Returns the height of the bitmapData being used as the material texture.

Implementation
    public function get height():Number
iniproperty 
protected var ini:Init

Instance of the Init object used to hold and parse default property values specified by the initialiser object in the 3d object constructor.

precisionproperty 
precision:Number  [read-write]

Corrects distortion caused by the affine transformation (non-perpective) of textures. The number refers to the pixel correction value - ie. a value of 2 means a distorion correction to within 2 pixels of the correct perspective distortion. 0 performs no precision.

Implementation
    public function get precision():Number
    public function set precision(value:Number):void
repeatproperty 
public var repeat:Boolean = false

Determines if texture bitmap will tile in uv-space

smoothproperty 
public var smooth:Boolean = false

Determines if texture bitmap is smoothed (bilinearly filtered) when drawn to screen.

visibleproperty 
visible:Boolean  [read-only]

Indicates whether the material is visible

Implementation
    public function get visible():Boolean
widthproperty 
width:Number  [read-only]

Returns the width of the bitmapData being used as the material texture.

Implementation
    public function get width():Number
Constructor detail
BitmapMaterial()constructor
public function BitmapMaterial(bitmap:BitmapData, init:Object = null)Parameters
bitmap:BitmapData — The bitmapData object to be used as the material's texture.
 
init:Object (default = null) — [optional] An initialisation object for specifying default instance properties.
####INIT####
Method detail
addOnResize()method
public function addOnResize(listener:Function):void

Default method for adding a materialresize event listener

Parameters
listener:Function — The listener function
getMapping()method 
protected function getMapping(tri:DrawTriangle):Matrix

Calculates the mapping matrix required to draw the triangle texture to screen.

Parameters
tri:DrawTriangle — The data object holding all information about the triangle to be drawn.

Returns
Matrix — The required matrix object.
getPixel32()method 
public function getPixel32(u:Number, v:Number):uint

Returns the argb value of the bitmapData pixel at the given u v coordinate.

Parameters
u:Number — The u (horizontal) texture coordinate.
 
v:Number — The v (verical) texture coordinate.

Returns
uint — The argb pixel value.
removeOnResize()method 
public function removeOnResize(listener:Function):void

Default method for removing a materialresize event listener

Parameters
listener:Function — The listener function
renderFace()method 
public function renderFace(face:Face, containerRect:Rectangle, parentFaceVO:FaceVO):FaceVO

Renders a bitmapData surface object for the speficied face.

Parameters
face:Face — The face object onto which the rendered sufrace is applied.
 
containerRect:Rectangle — The rectangle object defining the bounds of the face in uv-space.
 
parentFaceVO:FaceVO — The value object of the preceeding surface.

Returns
FaceVO
renderLayer()method 
public function renderLayer(tri:DrawTriangle, layer:Sprite, level:int):void

Renders a material layer for the specified triangle.

Parameters
tri:DrawTriangle — The drawtriangle used for render information.
 
layer:Sprite — The parent layer into which the triangle is drawn.
 
level:int — Defines the sprite level for the layer.
renderTriangle()method 
public function renderTriangle(tri:DrawTriangle):void

Sends data from the material coupled with data from the DrawTriangle primitive to the render session.

Parameters
tri:DrawTriangle
setColorTransform()method 
protected function setColorTransform():void

Updates the colortransform object applied to the texture from the color and alpha properties.

See also

color
alpha
updateMaterial()method 
public function updateMaterial(source:Object3D, view:View3D):void

Called once per render loop when material is visible.

Parameters
source:Object3D
 
view:View3D
updateRenderBitmap()method 
protected function updateRenderBitmap():void

Updates the texture bitmapData with the colortransform determined from the color and alpha properties.

See also

color
alpha
setColorTransform()
Event detail
materialresizeevent 
Event object type: away3d.events.MaterialEvent

Dispatched when the bitmapData used for the material texture is resized.

Wiki link
Click to go to the wiki page for ####WIKI####

Code examples

Comments