Options
Menu

Class MethodMaterial

MethodMaterial forms an abstract base class for the default shaded materials provided by Stage, using material methods to define their appearance.

Hierarchy

  • MaterialBase

Implements

  • IAsset
  • IAssetAdapter
  • IMaterial

Index

Constructors

constructor

  • Creates a new MethodMaterial object.

    Parameters

    • Optional image: Image2D
    • Optional alpha: number

    Returns MethodMaterial

  • Creates a new MethodMaterial object.

    Parameters

    • Optional color: number
    • Optional alpha: number

    Returns MethodMaterial

Properties

_adapter

_adapter: IAssetAdapter

_iBaseScreenPassIndex

_iBaseScreenPassIndex: number

Private _iClassification

_iClassification: string

A value that can be used by materials that only work with a given type of renderer. The renderer can test the classification to choose which render path to use. For example, a deferred material could set this value so that the deferred renderer knows not to take the forward rendering path.

_pAlphaThreshold

_pAlphaThreshold: number

_pAnimateUVs

_pAnimateUVs: boolean

_pBlendMode

_pBlendMode: string

_pLightPicker

_pLightPicker: LightPickerBase

adaptee

adaptee: AssetBase

adapter

adapter: IAssetAdapter

adapter is used to provide MovieClip to scripts taken from different platforms setter typically managed by factory. getter defaults to AwayJS class

alpha

alpha: number

The alpha of the surface.

alphaBlending

alphaBlending: boolean

Indicates whether or not the material has transparency. If binary transparency is sufficient, for example when using textures of foliage, consider using alphaThreshold instead.

alphaPremultiplied

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.

alphaThreshold

alphaThreshold: number

The minimum alpha value for which pixels should be drawn. This is used for transparency that is either invisible or entirely opaque, often used with textures for foliage, etc. Recommended values are 0 to disable alpha, or 0.5 to create smooth edges. Default value is 0 (disabled).

animateUVs

animateUVs: boolean

Specifies whether or not the UV coordinates should be animated using a transformation matrix.

animationSet

animationSet: IAnimationSet

assetFullPath

assetFullPath: Array<string>

assetNamespace

assetNamespace: string

blendMode

blendMode: string

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

  • BlendMode.NORMAL: No blending, unless the material inherently needs it
  • BlendMode.LAYER: Force blending. This will draw the object the same as NORMAL, but without writing depth writes.
  • BlendMode.MULTIPLY
  • BlendMode.ADD
  • BlendMode.ALPHA

bothSides

bothSides: boolean

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

colorTransform

colorTransform: ColorTransform

The ColorTransform object to transform the colour of the material with. Defaults to null.

curves

curves: boolean

Indicates whether material should use curves. Defaults to false.

extra

extra: Object

An object to contain any extra data.

Private iOwners

iOwners: Array<IEntity>

A list of the IEntities that use this material

id

id: number

A unique id for the asset, used to identify assets in an associative array

imageRect

imageRect: boolean

Indicates whether or not any used textures should use an atlas. Defaults to false.

name

name: string

originalName

originalName: string

The original name used for this asset in the resource (e.g. file) in which it was found. This may not be the same as name, which may have changed due to of a name conflict.

style

style: Style

The style used to render the current TriangleGraphic. If set to null, its parent Sprite's style will be used instead.

useColorTransform

useColorTransform: boolean

Specifies whether or not the UV coordinates should be animated using a transformation matrix.

Static DEFAULT_NAMESPACE

DEFAULT_NAMESPACE: string

Static ID_COUNT

ID_COUNT: number

Static assetType

assetType: string

Accessors

ambientMethod

  • The method that provides the ambient lighting contribution. Defaults to AmbientBasicMethod.

    Returns AmbientBasicMethod

  • The method that provides the ambient lighting contribution. Defaults to AmbientBasicMethod.

    Parameters

    Returns void

assetType

  • get (): string
  • Returns string

depthCompareMode

  • get (): ContextGLCompareMode
  • set (value: ContextGLCompareMode): void
  • The depth compare mode used to render the renderables using this material.

    see

    away.stagegl.ContextGLCompareMode

    Returns ContextGLCompareMode

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

    Parameters

    • value: ContextGLCompareMode

    Returns void

diffuseLightSources

  • get (): number
  • set (value: number): void
  • Define which light source types to use for diffuse reflections. This allows choosing between regular lights and/or light probes for diffuse reflections.

    see

    away3d.materials.LightSources

    Returns number

  • Define which light source types to use for diffuse reflections. This allows choosing between regular lights and/or light probes for diffuse reflections.

    Parameters

    • value: number

    Returns void

diffuseMethod

enableLightFallOff

  • get (): boolean
  • set (value: boolean): void
  • Whether or not to use fallOff and radius properties for lights. This can be used to improve performance and compatibility for constrained mode.

    Returns boolean

  • Whether or not to use fallOff and radius properties for lights. This can be used to improve performance and compatibility for constrained mode.

    Parameters

    • value: boolean

    Returns void

lightPicker

  • get (): LightPickerBase
  • set (value: LightPickerBase): void
  • The light picker used by the material to provide lights to the material if it supports lighting.

    see

    LightPickerBase

    see

    StaticLightPicker

    Returns LightPickerBase

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

    Parameters

    • value: LightPickerBase

    Returns void

mode

  • get (): string
  • set (value: string): void
  • Returns string

  • Parameters

    • value: string

    Returns void

normalMethod

  • The method used to generate the per-pixel normals. Defaults to NormalBasicMethod.

    Returns NormalBasicMethod

  • The method used to generate the per-pixel normals. Defaults to NormalBasicMethod.

    Parameters

    Returns void

numEffectMethods

  • get (): number
  • Returns number

shadowMethod

  • The method used to render shadows cast on this surface, or null if no shadows are to be rendered. Defaults to null.

    Returns ShadowMethodBase | ShadowCompositeMethod

  • The method used to render shadows cast on this surface, or null if no shadows are to be rendered. Defaults to null.

    Parameters

    Returns void

specularLightSources

  • get (): number
  • set (value: number): void
  • Define which light source types to use for specular reflections. This allows choosing between regular lights and/or light probes for specular reflections.

    see

    away3d.materials.LightSources

    Returns number

  • Define which light source types to use for specular reflections. This allows choosing between regular lights and/or light probes for specular reflections.

    Parameters

    • value: number

    Returns void

specularMethod

Methods

addEffectMethod

  • Appends an "effect" shading method to the shader. Effect methods are those that do not influence the lighting but modulate the shaded colour, used for fog, outlines, etc. The method will be applied to the result of the methods added prior.

    Parameters

    Returns void

addEffectMethodAt

  • Adds an effect method at the specified index amongst the methods already added to the material. Effect methods are those that do not influence the lighting but modulate the shaded colour, used for fog, outlines, etc. The method will be applied to the result of the methods with a lower index.

    Parameters

    Returns void

addEventListener

  • addEventListener(type: string, listener: function): void
  • Add an event listener

    method

    addEventListener

    Parameters

    • type: string
    • listener: function
        • (event: EventBase): void
        • Parameters

          • event: EventBase

          Returns void

    Returns void

addTexture

  • addTexture(texture: TextureBase): void
  • Parameters

    • texture: TextureBase

    Returns void

addTextureAt

  • addTextureAt(texture: TextureBase, index: number): void
  • Parameters

    • texture: TextureBase
    • index: number

    Returns void

assetPathEquals

  • assetPathEquals(name: string, ns: string): boolean
  • Parameters

    • name: string
    • ns: string

    Returns boolean

clear

  • clear(): void
  • Returns void

dispatchEvent

  • dispatchEvent(event: EventBase): void
  • Dispatch an event

    method

    dispatchEvent

    Parameters

    • event: EventBase

    Returns void

dispose

  • dispose(): void
  • inheritdoc

    Returns void

getEffectMethodAt

  • Returns the method added at the given index.

    Parameters

    • index: number

      The index of the method to retrieve.

    Returns ShadingMethodBase

    The method at the given index.

getNumTextures

  • getNumTextures(): number
  • Returns number

getTextureAt

  • getTextureAt(index: number): TextureBase
  • Parameters

    • index: number

    Returns TextureBase

hasEventListener

  • hasEventListener(type: string, listener?: function): boolean
  • check if an object has an event listener assigned to it

    method

    hasListener

    Parameters

    • type: string
    • Optional listener: function
        • (event: EventBase): void
        • Parameters

          • event: EventBase

          Returns void

    Returns boolean

iAddOwner

  • iAddOwner(owner: IEntity): void
  • Mark an IEntity as owner of this material. Assures we're not using the same material across renderables with different animations, since the Programs depend on animation. This method needs to be called when a material is assigned.

    internal

    Parameters

    • owner: IEntity

      The IEntity that had this material assigned

    Returns void

iRemoveOwner

  • iRemoveOwner(owner: IEntity): void
  • Removes an IEntity as owner.

    internal

    Parameters

    • owner: IEntity

    Returns void

invalidate

  • invalidate(): void
  • Returns void

invalidateMaterials

  • invalidateMaterials(): void
  • Returns void

Private invalidatePasses

  • invalidatePasses(): void
  • Marks the shader programs for all passes as invalid, so they will be recompiled before the next use.

    Returns void

invalidateTexture

  • invalidateTexture(): void
  • Returns void

isAsset

  • isAsset(assetClass: IAssetClass): boolean
  • Parameters

    • assetClass: IAssetClass

    Returns boolean

removeEffectMethod

  • Removes an effect method from the material.

    Parameters

    Returns void

removeEventListener

  • removeEventListener(type: string, listener: function): void
  • Remove an event listener

    method

    removeEventListener

    Parameters

    • type: string
    • listener: function
        • (event: EventBase): void
        • Parameters

          • event: EventBase

          Returns void

    Returns void

removeTexture

  • removeTexture(texture: TextureBase): void
  • Parameters

    • texture: TextureBase

    Returns void

resetAssetPath

  • resetAssetPath(name: string, ns?: string, overrideOriginal?: boolean): void
  • Parameters

    • name: string
    • Optional ns: string
    • Optional overrideOriginal: boolean

    Returns void

updateFullPath

  • updateFullPath(): void
  • Returns void

Generated using TypeDoc