Packageaway3d.materials
Classpublic class MaterialBase
InheritanceMaterialBase Inheritance NamedAssetBase Inheritance flash.events.EventDispatcher
Implements IAsset
Subclasses MultiPassMaterialBase, SegmentMaterial, SinglePassMaterialBase, SkyBoxMaterial

MaterialBase forms an abstract base class for any material. A material consists of several passes, each of which constitutes at least one render call. Several passes could be used for special effects (render lighting for many lights in several passes, render an outline in a separate pass) or to provide additional render-to-texture passes (rendering diffuse light to texture for texture-space subsurface scattering, or rendering a depth map for specialized self-shadowing). Away3D provides default materials trough SinglePassMaterialBase and MultiPassMaterialBase, which use modular methods to build the shader code. MaterialBase can be extended to build specific and high-performant custom shaders, or entire new material frameworks.



Public Properties
 PropertyDefined By
  alphaPremultiplied : Boolean
Indicates whether visible textures (or other pixels) used by this material have already been premultiplied.
MaterialBase
 InheritedassetFullPath : Array
[read-only]
NamedAssetBase
 InheritedassetNamespace : String
[read-only]
NamedAssetBase
  assetType : String
[read-only] The type of the asset.
MaterialBase
  blendMode : String
The blend mode to use when drawing this renderable.
MaterialBase
  bothSides : Boolean
Defines whether or not the material should cull triangles facing away from the camera.
MaterialBase
  depthCompareMode : String
The depth compare mode used to render the renderables using this material.
MaterialBase
  extra : Object
An object to contain any extra data.
MaterialBase
 Inheritedid : String
NamedAssetBase
  lightPicker : LightPickerBase
The light picker used by the material to provide lights to the material if it supports lighting.
MaterialBase
  mipmap : Boolean
Indicates whether or not any used textures should use mipmapping.
MaterialBase
 Inheritedname : String
NamedAssetBase
 InheritedoriginalName : String
[read-only] The original name used for this asset in the resource (e.g.
NamedAssetBase
  repeat : Boolean
Indicates whether or not any used textures should be tiled.
MaterialBase
  requiresBlending : Boolean
[read-only] Indicates whether or not the material requires alpha blending during rendering.
MaterialBase
  smooth : Boolean
Indicates whether or not any used textures should use smoothing.
MaterialBase
  uniqueId : uint
[read-only] An id for this material used to sort the renderables by material, which reduces render state changes across materials using the same Program3D.
MaterialBase
Protected Properties
 PropertyDefined By
  _depthPass : DepthMapPass
MaterialBase
  _distancePass : DistanceMapPass
MaterialBase
  _lightPicker : LightPickerBase
MaterialBase
  _mipmap : Boolean = true
MaterialBase
  _numPasses : uint
MaterialBase
  _passes : Vector.<MaterialPassBase>
MaterialBase
  _repeat : Boolean
MaterialBase
  _smooth : Boolean = true
MaterialBase
Public Methods
 MethodDefined By
  
Creates a new MaterialBase object.
MaterialBase
 Inherited
assetPathEquals(name:String, ns:String):Boolean
NamedAssetBase
  
dispose():void
Cleans up resources owned by the material, including passes.
MaterialBase
 Inherited
resetAssetPath(name:String, ns:String = null, overrideOriginal:Boolean = true):void
NamedAssetBase
Protected Methods
 MethodDefined By
  
Adds a pass to the material
MaterialBase
  
Removes all passes from the material
MaterialBase
  
Removes a pass from the material.
MaterialBase
Public Constants
 ConstantDefined By
 InheritedDEFAULT_NAMESPACE : String = default
[static]
NamedAssetBase
Property Detail
_depthPassproperty
protected var _depthPass:DepthMapPass

_distancePassproperty 
protected var _distancePass:DistanceMapPass

_lightPickerproperty 
protected var _lightPicker:LightPickerBase

_mipmapproperty 
protected var _mipmap:Boolean = true

_numPassesproperty 
protected var _numPasses:uint

_passesproperty 
protected var _passes:Vector.<MaterialPassBase>

_repeatproperty 
protected var _repeat:Boolean

_smoothproperty 
protected var _smooth:Boolean = true

alphaPremultipliedproperty 
alphaPremultiplied:Boolean

Indicates whether visible textures (or other pixels) used by this material have already been premultiplied. Toggle this if you are seeing black halos around your blended alpha edges.


Implementation
    public function get alphaPremultiplied():Boolean
    public function set alphaPremultiplied(value:Boolean):void
assetTypeproperty 
assetType:String  [read-only]

The type of the asset.


Implementation
    public function get assetType():String
blendModeproperty 
blendMode:String

The blend mode to use when drawing this renderable. The following blend modes are supported:


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

Defines whether or not the material should cull triangles facing away from the camera.


Implementation
    public function get bothSides():Boolean
    public function set bothSides(value:Boolean):void
depthCompareModeproperty 
depthCompareMode:String

The depth compare mode used to render the renderables using this material.


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

See also

flash.display3D.Context3DCompareMode
extraproperty 
public var extra:Object

An object to contain any extra data.

lightPickerproperty 
lightPicker:LightPickerBase

The light picker used by the material to provide lights to the material if it supports lighting.


Implementation
    public function get lightPicker():LightPickerBase
    public function set lightPicker(value:LightPickerBase):void

See also

mipmapproperty 
mipmap:Boolean

Indicates whether or not any used textures should use mipmapping. Defaults to true.


Implementation
    public function get mipmap():Boolean
    public function set mipmap(value:Boolean):void
repeatproperty 
repeat:Boolean

Indicates whether or not any used textures should be tiled. If set to false, texture samples are clamped to the texture's borders when the uv coordinates are outside the [0, 1] interval.


Implementation
    public function get repeat():Boolean
    public function set repeat(value:Boolean):void
requiresBlendingproperty 
requiresBlending:Boolean  [read-only]

Indicates whether or not the material requires alpha blending during rendering.


Implementation
    public function get requiresBlending():Boolean
smoothproperty 
smooth:Boolean

Indicates whether or not any used textures should use smoothing.


Implementation
    public function get smooth():Boolean
    public function set smooth(value:Boolean):void
uniqueIdproperty 
uniqueId:uint  [read-only]

An id for this material used to sort the renderables by material, which reduces render state changes across materials using the same Program3D.


Implementation
    public function get uniqueId():uint
Constructor Detail
MaterialBase()Constructor
public function MaterialBase()

Creates a new MaterialBase object.

Method Detail
addPass()method
protected function addPass(pass:MaterialPassBase):void

Adds a pass to the material

Parameters

pass:MaterialPassBase

clearPasses()method 
protected function clearPasses():void

Removes all passes from the material

dispose()method 
public function dispose():void

Cleans up resources owned by the material, including passes. Textures are not owned by the material since they could be used by other materials and will not be disposed.

removePass()method 
protected function removePass(pass:MaterialPassBase):void

Removes a pass from the material.

Parameters

pass:MaterialPassBase — The pass to be removed.

renderPass()method 
arcane function renderPass(index:uint, renderable:IRenderable, stage3DProxy:Stage3DProxy, entityCollector:EntityCollector, viewProjection:Matrix3D):void

Renders the current pass. Before calling renderPass, activatePass needs to be called with the same index.

Parameters

index:uint — The index of the pass used to render the renderable.
 
renderable:IRenderable — The IRenderable object to draw.
 
stage3DProxy:Stage3DProxy — The Stage3DProxy object used for rendering.
 
entityCollector:EntityCollector — The EntityCollector object that contains the visible scene data.
 
viewProjection:Matrix3D — The view-projection matrix used to project to the screen. This is not the same as camera.viewProjection as it includes the scaling factors when rendering to textures.