import { ColorTransform, AssetBase } from '@awayjs/core'; import { ImageBase } from '@awayjs/stage'; import { IMaterial, Style, TextureBase } from '@awayjs/renderer'; /** * 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 TriangleMaterial, 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. */ export declare class MaterialBase extends AssetBase implements IMaterial { private _textures; private _colorTransform; private _pUseColorTransform; private _alphaBlending; private _alpha; _pAlphaThreshold: number; _pAnimateUVs: boolean; private _onInvalidatePropertiesDelegate; private _onInvalidateImagesDelegate; private _style; /** * An object to contain any extra data. */ extra: Object; /** * 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. * * @private */ _iClassification: string; _iBaseScreenPassIndex: number; private _bothSides; _pBlendMode: string; private _imageRect; private _curves; private _onTextureInvalidateDelegate; /** * Creates a new MaterialBase object. */ constructor(image?: ImageBase, alpha?: number); constructor(color?: number, alpha?: number); /** * The alpha of the surface. */ get alpha(): number; set alpha(value: number); /** * The ColorTransform object to transform the colour of the material with. Defaults to null. */ get colorTransform(): ColorTransform; set colorTransform(value: ColorTransform); /** * Indicates whether or not the material has transparency. If binary transparency is sufficient, for * example when using textures of foliage, consider using alphaThreshold instead. */ get alphaBlending(): boolean; set alphaBlending(value: boolean); /** * Indicates whether material should use curves. Defaults to false. */ get curves(): boolean; set curves(value: boolean); /** * Indicates whether or not any used textures should use an atlas. Defaults to false. */ get imageRect(): boolean; set imageRect(value: boolean); /** * The style used to render the current TriangleGraphic. If set to null, its parent Sprite's style will be used instead. */ get style(): Style; set style(value: Style); /** * Specifies whether or not the UV coordinates should be animated using a transformation matrix. */ get animateUVs(): boolean; set animateUVs(value: boolean); /** * Specifies whether or not the UV coordinates should be animated using a transformation matrix. */ get useColorTransform(): boolean; set useColorTransform(value: boolean); /** * Defines whether or not the material should cull triangles facing away from the camera. */ get bothSides(): boolean; set bothSides(value: boolean); /** * The blend mode to use when drawing this renderable. The following blend modes are supported: * */ get blendMode(): string; set blendMode(value: string); /** * 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). */ get alphaThreshold(): number; set alphaThreshold(value: number); getNumTextures(): number; getTextureAt(index: number): TextureBase; dispose(): void; /** * Marks the shader programs for all passes as invalid, so they will be recompiled before the next use. * * @private */ invalidatePasses(): void; invalidateTextures(): void; addTextureAt(texture: TextureBase, index: number): void; addTexture(texture: TextureBase): void; removeTexture(texture: TextureBase): void; private onTextureInvalidate; private _onInvalidateProperties; private _onInvalidateImages; } import { ShaderRegisterCache, ShaderRegisterData } from '@awayjs/stage'; import { _Render_MaterialPassBase, _Render_ElementsBase, ShaderBase } from '@awayjs/renderer'; /** * _Render_DepthMaterial forms an abstract base class for the default shaded materials provided by Stage, * using material methods to define their appearance. */ export declare class _Render_DepthMaterial extends _Render_MaterialPassBase { private _fragmentConstantsIndex; private _shaderTexture; /** * * @param pool * @param surface * @param elementsClass * @param stage */ init(material: MaterialBase, renderElements: _Render_ElementsBase): void; invalidate(): void; _includeDependencies(shader: ShaderBase): void; _initConstantData(): void; /** * @inheritDoc */ _getFragmentCode(registerCache: ShaderRegisterCache, sharedRegisters: ShaderRegisterData): string; /** * @inheritDoc */ _activate(): void; } /** * DistanceRender is a pass that writes distance values to a depth map as a 32-bit value exploded over the 4 texture channels. * This is used to render omnidirectional shadow maps. */ export declare class _Render_DistanceMaterial extends _Render_MaterialPassBase { private _shaderTexture; private _fragmentConstantsIndex; /** * Creates a new DistanceRender object. * * @param material The material to which this pass belongs. */ init(material: MaterialBase, renderElements: _Render_ElementsBase): void; invalidate(): void; /** * Initializes the unchanging constant data for this material. */ _initConstantData(): void; _includeDependencies(shader: ShaderBase): void; /** * @inheritDoc */ _getFragmentCode(registerCache: ShaderRegisterCache, sharedRegisters: ShaderRegisterData): string; /** * @inheritDoc */ _activate(): void; } //# sourceMappingURL=MaterialBase.d.ts.map