Packageaway3d.materials.utils
Classpublic class NormalMapGenerator
InheritanceNormalMapGenerator Inheritance flash.events.EventDispatcher

Public Properties
 PropertyDefined by
  blur : int
[write-only]
NormalMapGenerator
  bumpmap : BitmapData
[read-only] Returns the generated bump source for a displacementfilter generated by the class
NormalMapGenerator
  bumpsource : BitmapData
[write-only] An optional bump information can be burned into the normalmap
NormalMapGenerator
  growpixels : Boolean
[write-only]
NormalMapGenerator
  height : int
[write-only]
NormalMapGenerator
  maxfaces : int
[write-only]
NormalMapGenerator
  mesh : Mesh
[write-only] The mesh Object3D to be traced.
NormalMapGenerator
  normalmap : BitmapData
[read-only] Returns the normalMap generated by the class
NormalMapGenerator
  type : String
[write-only]
NormalMapGenerator
  width : int
[write-only]
NormalMapGenerator
Public Methods
 MethodDefined by
  
NormalMapGenerator
(mesh:Mesh = null, width:int = 512, height:int = 512, bumpsource:BitmapData = null, blur:int = 0, growpixels:Boolean = false, maxfaces:int = 50, type:String = "objectspace")
Class NormalMapGenerator generates a normalmap from a given Mesh object and merge an additionl bump information to it.
NormalMapGenerator
  
addOnTraceComplete(listener:Function):void
Default method for adding a tracecomplete event listener
NormalMapGenerator
  
addOnTraceProgress(listener:Function):void
Default method for adding a traceprogress event listener
NormalMapGenerator
  
apply():void
Starts the rendering of the normal map if a mesh object has been defined
NormalMapGenerator
  
applyBump(bm:BitmapData, nm:BitmapData):BitmapData
Applys a bump to a given normal map.
NormalMapGenerator
  
cancel():void
Cancels the trace
NormalMapGenerator
  
removeOnTraceComplete(listener:Function):void
Default method for removing a tracecomplete event listener
NormalMapGenerator
  
removeOnTraceProgress(listener:Function):void
Default method for removing a traceprogress event listener
NormalMapGenerator
Events
 EventSummaryDefined by
   Dispatched while the class is busy tracing.NormalMapGenerator
   Dispatched full trace is done.NormalMapGenerator
Property detail
blurproperty
blur:int  [write-only]

Implementation
    public function set blur(value:int):void
bumpmapproperty 
bumpmap:BitmapData  [read-only]

Returns the generated bump source for a displacementfilter generated by the class

Implementation
    public function get bumpmap():BitmapData
bumpsourceproperty 
bumpsource:BitmapData  [write-only]

An optional bump information can be burned into the normalmap

Implementation
    public function set bumpsource(value:BitmapData):void
growpixelsproperty 
growpixels:Boolean  [write-only]

Implementation
    public function set growpixels(value:Boolean):void
heightproperty 
height:int  [write-only]

Implementation
    public function set height(value:int):void
maxfacesproperty 
maxfaces:int  [write-only]

Implementation
    public function set maxfaces(value:int):void
meshproperty 
mesh:Mesh  [write-only]

The mesh Object3D to be traced.

Implementation
    public function set mesh(value:Mesh):void
normalmapproperty 
normalmap:BitmapData  [read-only]

Returns the normalMap generated by the class

Implementation
    public function get normalmap():BitmapData
typeproperty 
type:String  [write-only]

Implementation
    public function set type(value:String):void
widthproperty 
width:int  [write-only]

Implementation
    public function set width(value:int):void
Constructor detail
NormalMapGenerator()constructor
public function NormalMapGenerator(mesh:Mesh = null, width:int = 512, height:int = 512, bumpsource:BitmapData = null, blur:int = 0, growpixels:Boolean = false, maxfaces:int = 50, type:String = "objectspace")Parameters
mesh:Mesh (default = null) — [optional] Mesh. The Mesh object to be traced.
 
width:int (default = 512) — [optional] int. The width of the generated normalmap. Default is 512.
 
height:int (default = 512) — [optional] int. The height of the generated normalmap. Default is 512.
 
bumpsource:BitmapData (default = null) — [optional] BitmapData. The source bitmapdata for an additional bump information. Default is null;
 
blur:int (default = 0) — [optional] int. Blur value if applyed, the surface of the object becomes smoother. Default is 0;
 
growpixels:Boolean (default = false) — [optional] Boolean. To avoid some artefacts cause by the pixel trace. adds pixels at the edges of the trace.
 
maxfaces:int (default = 50) — [optional] int. To avoid that the player generates a timeout error, the class handles the trace of faces stepwize. Default is 50 faces.
 
type:String (default = "objectspace") — [optional] String. If the map is of type objectspace or tangent. Default = objectspace; It is a good practice to render the map with great size and eventually reduce after its rendered, since Flash doesn't allow to draw smaller than a pixel while the uv information might ask a smaller draw. The mesh MUST have a unique mapping. Any overlapping face area will result in artefacts.
Init Parameters
Method detail
addOnTraceComplete()method
public function addOnTraceComplete(listener:Function):void

Default method for adding a tracecomplete event listener

Parameters
listener:Function — The listener function
addOnTraceProgress()method 
public function addOnTraceProgress(listener:Function):void

Default method for adding a traceprogress event listener

Parameters
listener:Function — The listener function
apply()method 
public function apply():void

Starts the rendering of the normal map if a mesh object has been defined

applyBump()method 
public function applyBump(bm:BitmapData, nm:BitmapData):BitmapData

Applys a bump to a given normal map. If you do not generate the map from a mesh, just pass null in the constructor.

Parameters
bm:BitmapData — BitmapData. The source bumpmap.
 
nm:BitmapData — BitmapData. The source normalmap. return BitmapData. The source normalmap with the bump applied to it

Returns
BitmapData
cancel()method 
public function cancel():void

Cancels the trace

removeOnTraceComplete()method 
public function removeOnTraceComplete(listener:Function):void

Default method for removing a tracecomplete event listener

Parameters
listener:Function — The listener function
removeOnTraceProgress()method 
public function removeOnTraceProgress(listener:Function):void

Default method for removing a traceprogress event listener

Parameters
listener:Function — The listener function
Event detail
tracecompleteevent 
Event object type: away3d.events.TraceEvent

Dispatched while the class is busy tracing. Note that the source can already be used for a Material

traceprogressevent  
Event object type: away3d.events.TraceEvent

Dispatched full trace is done.

Wiki link
Click to go to the wiki page for 'away3d.materials.utils.NormalMapGenerator'

Code examples

Comments