import { ColorTransform } from '@awayjs/core'; import { ShaderRegisterCache, ShaderRegisterData, ShaderRegisterElement } from '@awayjs/stage'; import { _Render_RenderableBase, _Render_ElementsBase, ShaderBase } from '@awayjs/renderer'; import { LightPickerBase } from '../lightpickers/LightPickerBase'; import { _IShader_LightingMethod } from '../methods/_IShader_LightingMethod'; import { _IShader_Method } from '../methods/_IShader_Method'; import { MethodBase } from '../methods/MethodBase'; import { EffectColorTransformMethod } from '../methods/EffectColorTransformMethod'; import { ILightingPass } from '../passes/ILightingPass'; import { PassBase } from '../passes/PassBase'; import { LightingShader } from '../shaders/LightingShader'; import { _Render_MethodMaterial } from '../MethodMaterial'; /** * CompiledPass forms an abstract base class for the default compiled pass materials provided by Away3D, * using material methods to define their appearance. */ export declare class MethodPass extends PassBase implements ILightingPass { private _maxLights; private _mode; private _lightPicker; private _includeCasters; _colorTransformChunk: _IShader_Method; _colorTransformMethod: EffectColorTransformMethod; _normalChunk: _IShader_Method; _normalMethod: MethodBase; _ambientChunk: _IShader_Method; _ambientMethod: MethodBase; _shadowChunk: _IShader_Method; _shadowMethod: MethodBase; _diffuseChunk: _IShader_LightingMethod; _diffuseMethod: MethodBase; _specularChunk: _IShader_LightingMethod; _specularMethod: MethodBase; _chunks: Array<_IShader_Method>; _methods: Array; _numEffectDependencies: number; private _onLightsChangeDelegate; private _onMethodInvalidatedDelegate; numDirectionalLights: number; numPointLights: number; numLightProbes: number; pointLightsOffset: number; directionalLightsOffset: number; lightProbesOffset: number; /** * */ get mode(): number; set mode(value: number); /** * Indicates whether or not shadow casting lights need to be included. */ get includeCasters(): boolean; set includeCasters(value: boolean); /** * * @returns {LightPickerBase} */ get lightPicker(): LightPickerBase; set lightPicker(value: LightPickerBase); /** * Whether or not to use fallOff and radius properties for lights. This can be used to improve performance and * compatibility for constrained mode. */ get enableLightFallOff(): boolean; /** * 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 */ get diffuseLightSources(): number; /** * 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 */ get specularLightSources(): number; /** * Creates a new CompiledPass object. * * @param material The material to which this pass belongs. */ constructor(mode: number, renderMaterial: _Render_MethodMaterial, renderElements: _Render_ElementsBase); private _updateShader; /** * Initializes the unchanging constant data for this material. */ _initConstantData(): void; /** * The ColorTransform object to transform the colour of the material with. Defaults to null. */ get colorTransform(): ColorTransform; set colorTransform(value: ColorTransform); /** * The EffectColorTransformMethod object to transform the colour of the material with. Defaults to null. */ get colorTransformMethod(): EffectColorTransformMethod; set colorTransformMethod(value: EffectColorTransformMethod); private _removeDependency; private _addDependency; /** * 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. */ addEffectMethod(method: MethodBase): void; /** * The number of "effect" methods added to the material. */ get numEffectMethods(): number; /** * Queries whether a given effects method was added to the material. * * @param method The method to be queried. * @return true if the method was added to the material, false otherwise. */ hasEffectMethod(method: MethodBase): boolean; /** * Returns the method added at the given index. * @param index The index of the method to retrieve. * @return The method at the given index. */ getEffectMethodAt(index: number): MethodBase; /** * 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. */ addEffectMethodAt(method: MethodBase, index: number): void; /** * Removes an effect method from the material. * @param method The method to be removed. */ removeEffectMethod(method: MethodBase): void; /** * remove an effect method at the specified index from the material. */ removeEffectMethodAt(index: number): void; /** * The method used to generate the per-pixel normals. Defaults to NormalBasicMethod. */ get normalMethod(): MethodBase; set normalMethod(value: MethodBase); /** * The method that provides the ambient lighting contribution. Defaults to AmbientBasicMethod. */ get ambientMethod(): MethodBase; set ambientMethod(value: MethodBase); /** * The method used to render shadows cast on this surface, or null if no shadows are to be rendered. Defaults to null. */ get shadowMethod(): MethodBase; set shadowMethod(value: MethodBase); /** * The method that provides the diffuse lighting contribution. Defaults to DiffuseBasicMethod. */ get diffuseMethod(): MethodBase; set diffuseMethod(value: MethodBase); /** * The method that provides the specular lighting contribution. Defaults to SpecularBasicMethod. */ get specularMethod(): MethodBase; set specularMethod(value: MethodBase); /** * @inheritDoc */ dispose(): void; /** * Called when any method's shader code is invalidated. */ private onMethodInvalidated; /** * @inheritDoc */ _activate(): void; /** * * * @param renderable * @param stage * @param camera */ _setRenderState(renderState: _Render_RenderableBase): void; /** * @inheritDoc */ _deactivate(): void; _includeDependencies(shader: LightingShader): void; /** * Counts the dependencies for a given method. * @param method The method to count the dependencies for. * @param chunk The method's data for this material. */ private setupAndCountDependencies; _getPreLightingVertexCode(registerCache: ShaderRegisterCache, sharedRegisters: ShaderRegisterData): string; _getPreLightingFragmentCode(registerCache: ShaderRegisterCache, sharedRegisters: ShaderRegisterData): string; _getPerLightDiffuseFragmentCode(lightDirReg: ShaderRegisterElement, diffuseColorReg: ShaderRegisterElement, registerCache: ShaderRegisterCache, sharedRegisters: ShaderRegisterData): string; _getPerLightSpecularFragmentCode(lightDirReg: ShaderRegisterElement, specularColorReg: ShaderRegisterElement, registerCache: ShaderRegisterCache, sharedRegisters: ShaderRegisterData): string; _getPerProbeDiffuseFragmentCode(texReg: ShaderRegisterElement, weightReg: string, registerCache: ShaderRegisterCache, sharedRegisters: ShaderRegisterData): string; _getPerProbeSpecularFragmentCode(texReg: ShaderRegisterElement, weightReg: string, registerCache: ShaderRegisterCache, sharedRegisters: ShaderRegisterData): string; _getNormalVertexCode(registerCache: ShaderRegisterCache, sharedRegisters: ShaderRegisterData): string; _getNormalFragmentCode(registerCache: ShaderRegisterCache, sharedRegisters: ShaderRegisterData): string; /** * @inheritDoc */ _getVertexCode(registerCache: ShaderRegisterCache, sharedRegisters: ShaderRegisterData): string; /** * @inheritDoc */ _getFragmentCode(registerCache: ShaderRegisterCache, sharedRegisters: ShaderRegisterData): string; _getPostAnimationFragmentCode(registerCache: ShaderRegisterCache, sharedRegisters: ShaderRegisterData): string; /** * Indicates whether the shader uses any shadows. */ _iUsesShadows(shader: ShaderBase): boolean; /** * Indicates whether the shader uses any specular component. */ _iUsesSpecular(shader: ShaderBase): boolean; /** * Indicates whether the shader uses any specular component. */ _iUsesDiffuse(shader: ShaderBase): boolean; private onLightsChange; private _updateLights; /** * Calculates the amount of directional lights this material will support. * @param numDirectionalLights The maximum amount of directional lights to support. * @return The amount of directional lights this material will support, bounded by the amount necessary. */ private calculateNumDirectionalLights; /** * Calculates the amount of point lights this material will support. * @param numDirectionalLights The maximum amount of point lights to support. * @return The amount of point lights this material will support, bounded by the amount necessary. */ private calculateNumPointLights; /** * Calculates the amount of light probes this material will support. * @param numDirectionalLights The maximum amount of light probes to support. * @return The amount of light probes this material will support, bounded by the amount necessary. */ private calculateNumProbes; } //# sourceMappingURL=MethodPass.d.ts.map