Packageaway3d.materials.methods
Classpublic class WrapDiffuseMethod
InheritanceWrapDiffuseMethod Inheritance BasicDiffuseMethod Inheritance LightingMethodBase Inheritance ShadingMethodBase
SubclassesCelDiffuseMethod, SubsurfaceScatteringDiffuseMethod

WrapDiffuseMethod provides a base class for diffuse methods that wrap a diffuse method to alter the strength of its calculated strength.

Public Properties
 PropertyDefined by
  alphaThreshold : Number
WrapDiffuseMethod
  bitmapData : BitmapData
The bitmapData to use to define the diffuse reflection color per texel.
WrapDiffuseMethod
  diffuseAlpha : Number
The alpha component of the diffuse reflection.
WrapDiffuseMethod
  diffuseColor : uint
The color of the diffuse reflection when not using a texture.
WrapDiffuseMethod
 Inheritedpasses : Vector
Any passes required that render to a texture used by this method.
ShadingMethodBase
  shadowRegister : ShaderRegisterElement
[write-only]
WrapDiffuseMethod
 Inherited_totalLightColorReg : ShaderRegisterElement
BasicDiffuseMethod
  viewDirVaryingReg : ShaderRegisterElement
[write-only]
WrapDiffuseMethod
Protected Properties
 PropertyDefined by
 Inherited_diffuseInputIndex : int
BasicDiffuseMethod
 Inherited_diffuseInputRegister : ShaderRegisterElement
BasicDiffuseMethod
 Inherited_globalPosVertexReg : ShaderRegisterElement
ShadingMethodBase
 Inherited_mipmap : Boolean = true
ShadingMethodBase
 Inherited_needsGlobalPos : Boolean
ShadingMethodBase
 Inherited_needsNormals : Boolean
ShadingMethodBase
 Inherited_needsProjection : Boolean
ShadingMethodBase
 Inherited_needsUV : Boolean
ShadingMethodBase
 Inherited_needsView : Boolean
ShadingMethodBase
 Inherited_normalFragmentReg : ShaderRegisterElement
ShadingMethodBase
 Inherited_numLights : int
ShadingMethodBase
 Inherited_passes : Vector
ShadingMethodBase
 Inherited_projectionReg : ShaderRegisterElement
ShadingMethodBase
 Inherited_repeat : Boolean
ShadingMethodBase
 Inherited_shadowRegister : ShaderRegisterElement
BasicDiffuseMethod
 Inherited_smooth : Boolean = true
ShadingMethodBase
 Inherited_useTexture : Boolean
BasicDiffuseMethod
 Inherited_uvFragmentReg : ShaderRegisterElement
ShadingMethodBase
 Inherited_viewDirFragmentReg : ShaderRegisterElement
ShadingMethodBase
 Inherited_viewDirVaryingReg : ShaderRegisterElement
ShadingMethodBase
Public Methods
 MethodDefined by
  
WrapDiffuseMethod
(modulateMethod:Function = null, baseDiffuseMethod:BasicDiffuseMethod = null)
Creates a new WrapDiffuseMethod object.
WrapDiffuseMethod
 Inherited
Copies the state from a BasicDiffuseMethod object into the current object.
BasicDiffuseMethod
  
dispose(deep:Boolean):void
Cleans up any resources used by the current object.
WrapDiffuseMethod
  
Marks the texture for update next on the next render.
WrapDiffuseMethod
Protected Methods
 MethodDefined by
 Inherited
A helper method that generates standard code for sampling from a texture using the normal uv coordinates.
ShadingMethodBase
 Inherited
Marks the shader program as invalid, so it will be recompiled before the next render.
ShadingMethodBase
Property detail
alphaThresholdproperty
alphaThreshold:Number  [read-write]Implementation
    public function get alphaThreshold():Number
    public function set alphaThreshold(value:Number):void
bitmapDataproperty 
bitmapData:BitmapData  [read-write]

The bitmapData to use to define the diffuse reflection color per texel.

Implementation
    public function get bitmapData():BitmapData
    public function set bitmapData(value:BitmapData):void
diffuseAlphaproperty 
diffuseAlpha:Number  [read-write]

The alpha component of the diffuse reflection.

Implementation
    public function get diffuseAlpha():Number
    public function set diffuseAlpha(value:Number):void
diffuseColorproperty 
diffuseColor:uint  [read-write]

The color of the diffuse reflection when not using a texture.

Implementation
    public function get diffuseColor():uint
    public function set diffuseColor(value:uint):void
globalPosVertexRegproperty 
globalPosVertexReg:ShaderRegisterElement  [read-write]

The fragment register in which the uv coordinates are stored.

Implementation
    arcane function get globalPosVertexReg():ShaderRegisterElement
    arcane function set globalPosVertexReg(value:ShaderRegisterElement):void
mipmapproperty 
mipmap:Boolean  [read-write]

Defines whether any used textures should use mipmapping.

Implementation
    arcane function get mipmap():Boolean
    arcane function set mipmap(value:Boolean):void
needsGlobalPosproperty 
needsGlobalPos:Boolean  [read-only]

Implementation
    arcane function get needsGlobalPos():Boolean
needsNormalsproperty 
needsNormals:Boolean  [read-only]

Indicates whether the material requires normals.

Implementation
    arcane function get needsNormals():Boolean
needsProjectionproperty 
needsProjection:Boolean  [read-only]Implementation
    arcane function get needsProjection():Boolean
needsUVproperty 
needsUV:Boolean  [read-only]

Indicates whether the material requires uv coordinates.

Implementation
    arcane function get needsUV():Boolean
needsViewproperty 
needsView:Boolean  [read-only]

Indicates whether the material requires the view direction.

Implementation
    arcane function get needsView():Boolean
normalFragmentRegproperty 
normalFragmentReg:ShaderRegisterElement  [read-write]

The fragment register in which the normal is stored.

Implementation
    arcane function get normalFragmentReg():ShaderRegisterElement
    arcane function set normalFragmentReg(value:ShaderRegisterElement):void
numLightsproperty 
numLights:int  [read-write]

The amount of lights the method needs to support.

Implementation
    arcane function get numLights():int
    arcane function set numLights(value:int):void
parentPassproperty 
parentPass:MaterialPassBase  [read-write]

Implementation
    arcane function get parentPass():MaterialPassBase
    arcane function set parentPass(value:MaterialPassBase):void
projectionRegproperty 
projectionReg:ShaderRegisterElement  [write-only]Implementation
    arcane function set projectionReg(value:ShaderRegisterElement):void
repeatproperty 
repeat:Boolean  [read-write]

Defines whether textures should be tiled.

Implementation
    arcane function get repeat():Boolean
    arcane function set repeat(value:Boolean):void
shadowRegisterproperty 
shadowRegister:ShaderRegisterElement  [write-only]Implementation
    public function set shadowRegister(value:ShaderRegisterElement):void
smoothproperty 
smooth:Boolean  [read-write]

Defines whether smoothing should be applied to any used textures.

Implementation
    arcane function get smooth():Boolean
    arcane function set smooth(value:Boolean):void
UVFragmentRegproperty 
UVFragmentReg:ShaderRegisterElement  [read-write]

The fragment register in which the uv coordinates are stored.

Implementation
    arcane function get UVFragmentReg():ShaderRegisterElement
    arcane function set UVFragmentReg(value:ShaderRegisterElement):void
viewDirFragmentRegproperty 
viewDirFragmentReg:ShaderRegisterElement  [read-write]

The fragment register in which the view direction is stored.

Implementation
    arcane function get viewDirFragmentReg():ShaderRegisterElement
    arcane function set viewDirFragmentReg(value:ShaderRegisterElement):void
viewDirVaryingRegproperty 
viewDirVaryingReg:ShaderRegisterElement  [write-only]Implementation
    public function set viewDirVaryingReg(value:ShaderRegisterElement):void
Constructor detail
WrapDiffuseMethod()constructor
public function WrapDiffuseMethod(modulateMethod:Function = null, baseDiffuseMethod:BasicDiffuseMethod = null)Parameters
modulateMethod:Function (default = null) — The method which will add the code to alter the base method's strength. It needs to have the signature clampDiffuse(t : ShaderRegisterElement, regCache : ShaderRegisterCache) : String, in which t.w will contain the diffuse strength.
 
baseDiffuseMethod:BasicDiffuseMethod (default = null) — The base diffuse method on which this method's shading is based.
Init Parameters
Method detail
activate()method
arcane override function activate(context:Context3D, contextIndex:uint):void

Sets the render state for this method.

Parameters
context:Context3D — The Context3D currently used for rendering.
 
contextIndex:uint
deactivate()method 
arcane override function deactivate(context:Context3D):void Parameters
context:Context3D
dispose()method 
public override function dispose(deep:Boolean):void

Cleans up any resources used by the current object.

Parameters
deep:Boolean — Indicates whether other resources should be cleaned up, that could potentially be shared across different instances.
getFragmentAGALPreLightingCode()method 
arcane override function getFragmentAGALPreLightingCode(regCache:ShaderRegisterCache):String

Get the fragment shader code that will be needed before any per-light code is added.

Parameters
regCache:ShaderRegisterCache — The register cache used during the compilation.

Returns
String
getFragmentCodePerLight()method 
arcane override function getFragmentCodePerLight(lightIndex:int, lightDirReg:ShaderRegisterElement, lightColReg:ShaderRegisterElement, regCache:ShaderRegisterCache):String

Get the fragment shader code that will generate the code relevant to a single light.

Parameters
lightIndex:int — The register cache used during the compilation.
 
lightDirReg:ShaderRegisterElement
 
lightColReg:ShaderRegisterElement
 
regCache:ShaderRegisterCache

Returns
String
getFragmentPostLightingCode()method 
arcane override function getFragmentPostLightingCode(regCache:ShaderRegisterCache, targetReg:ShaderRegisterElement):String

Get the fragment shader code that should be added after all per-light code. Usually composits everything to the target register.

Parameters
regCache:ShaderRegisterCache — The register cache used during the compilation.
 
targetReg:ShaderRegisterElement

Returns
String
getVertexCode()method 
arcane override function getVertexCode(regCache:ShaderRegisterCache):String

Get the vertex shader code for this method.

Parameters
regCache:ShaderRegisterCache — The register cache used during the compilation.

Returns
String
invalidateBitmapData()method 
public override function invalidateBitmapData():void

Marks the texture for update next on the next render.

reset()method 
arcane override function reset():void

Wiki link
Click to go to the wiki page for 'away3d.materials.methods.WrapDiffuseMethod'

Code examples

Comments