Package | away3d.materials.utils |
Class | public class NormalMapGenerator |
Inheritance | NormalMapGenerator flash.events.EventDispatcher |
Property | Defined By | ||
---|---|---|---|
blur : uint
Defines the blur value applied to the normal map generated. | NormalMapGenerator | ||
bumpMap : BitmapData [read-only]
Returns the generated bump source for a displacementfilter generated by the class
| NormalMapGenerator | ||
growPixels : Boolean
Adds pixels at the edges of the trace to avoid artifacts cause by the pixel trace. | NormalMapGenerator | ||
height : uint
The height of the generated normalmap. | NormalMapGenerator | ||
heightMap : BitmapData
An optional height map used with the normal map calculations
| NormalMapGenerator | ||
invertX : Boolean
Set to true if the mesh was created using a righthanded system, inverting the x (red) information in the normal map. | NormalMapGenerator | ||
maxFaces : uint
The maximum amount of faces processed in a frame. | NormalMapGenerator | ||
mesh : Mesh
The Mesh object to be traced. | NormalMapGenerator | ||
normalMap : BitmapData [read-only]
Returns the normalMap generated by the class
| NormalMapGenerator | ||
normalMapType : String
Defines the type of normal map generated. | NormalMapGenerator | ||
width : uint
The width of the generated normalmap. | NormalMapGenerator |
Method | Defined By | ||
---|---|---|---|
NormalMapGenerator(mesh:Mesh = null, width:int = 512, height:int = 512, heightMap:BitmapData = null, blur:int = 0, growPixels:Boolean = false, maxFaces:int = 50, normalMapType:String = null, invertX:Boolean = false)
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 | ||
applyBump(bm:BitmapData, nm:BitmapData):BitmapData
Applys a bump to a given normal map. | NormalMapGenerator | ||
cancel():void
Cancels the trace
| NormalMapGenerator | ||
execute():void
Starts the rendering of the normal map if a mesh object has been defined
| 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 |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched while the class is busy tracing. | NormalMapGenerator | |||
Dispatched full trace is done. | NormalMapGenerator |
blur | property |
public var blur:uint
Defines the blur value applied to the normal map generated. Default is 0;
bumpMap | property |
bumpMap:BitmapData
[read-only] Returns the generated bump source for a displacementfilter generated by the class
public function get bumpMap():BitmapData
growPixels | property |
public var growPixels:Boolean
Adds pixels at the edges of the trace to avoid artifacts cause by the pixel trace.
height | property |
height:uint
The height of the generated normalmap. Default is 512.
public function get height():uint
public function set height(value:uint):void
heightMap | property |
public var heightMap:BitmapData
An optional height map used with the normal map calculations
invertX | property |
public var invertX:Boolean
Set to true if the mesh was created using a righthanded system, inverting the x (red) information in the normal map.
maxFaces | property |
public var maxFaces:uint
The maximum amount of faces processed in a frame. To avoid that the Flash Player generating a timeout error, the class handles the trace of faces stepwize. Default is 50 faces.
mesh | property |
public var mesh:Mesh
The Mesh
object to be traced.
normalMap | property |
normalMap:BitmapData
[read-only] Returns the normalMap generated by the class
public function get normalMap():BitmapData
normalMapType | property |
public var normalMapType:String
Defines the type of normal map generated. Can be either object space or tangent space. Defaults to object space.
See also
width | property |
width:uint
The width of the generated normalmap. Default is 512.
public function get width():uint
public function set width(value:uint):void
NormalMapGenerator | () | Constructor |
public function NormalMapGenerator(mesh:Mesh = null, width:int = 512, height:int = 512, heightMap:BitmapData = null, blur:int = 0, growPixels:Boolean = false, maxFaces:int = 50, normalMapType:String = null, invertX:Boolean = false)
Class NormalMapGenerator generates a normalmap from a given Mesh object and merge an additionl bump information to it.
Parametersmesh:Mesh (default = null ) — [optional] The Mesh object to be traced.
| |
width:int (default = 512 ) — [optional] The width of the generated normal map. Default is 512.
| |
height:int (default = 512 ) — [optional] The height of the generated normal map. Default is 512.
| |
heightMap:BitmapData (default = null ) — [optional] The source BitmapData for 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.
| |
normalMapType:String (default = null ) — [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.
| |
invertX:Boolean (default = false )
|
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
|
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
|
BitmapData |
cancel | () | method |
public function cancel():void
Cancels the trace
execute | () | method |
public function execute():void
Starts the rendering of the normal map if a mesh object has been defined
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
|
tracecomplete | Event |
away3d.events.TraceEvent
away3d.events.TraceEvent
Dispatched while the class is busy tracing. Note that the source can already be used for a Material
traceprogress | Event |
away3d.events.TraceEvent
away3d.events.TraceEvent
Dispatched full trace is done.