@awayjs/renderer
Version:
Renderer for AwayJS
124 lines • 3.93 kB
TypeScript
import { AssetEvent, AbstractionBase, WeakAssetSet } from '@awayjs/core';
import { Stage, _Stage_ImageBase, ImageSampler } from '@awayjs/stage';
import { IPass } from './IPass';
import { Style } from './Style';
import { IMaterial } from './IMaterial';
import { ITexture } from '../base/ITexture';
import { MaterialEvent } from '../events/MaterialEvent';
import { IAnimationSet } from './IAnimationSet';
import { _Render_ElementsBase } from './_Render_ElementsBase';
import { _Render_RenderableBase } from './_Render_RenderableBase';
/**
*
* @class away.pool.Passes
*/
export declare class _Render_MaterialBase extends AbstractionBase {
private _onInvalidateTexturesDelegate;
private _onInvalidatePassesDelegate;
private _onPassInvalidateDelegate;
/**
* A list of material owners, renderables or custom Entities.
*/
_owners: WeakAssetSet;
protected _renderOrderId: number;
protected _passes: IPass[];
private _animationSet;
protected _stage: Stage;
private _invalidAnimation;
protected _invalidRender: boolean;
private _invalidImages;
private _imageIndices;
private _numImages;
private _usesAnimation;
_activePass: IPass;
images: _Stage_ImageBase[];
samplers: ImageSampler[];
/**
* Indicates whether or not the renderable requires alpha blending during rendering.
*/
requiresBlending: boolean;
materialID: number;
get animationSet(): IAnimationSet;
get material(): IMaterial;
get numImages(): number;
get renderOrderId(): number;
get numPasses(): number;
get style(): Style;
get renderElements(): _Render_ElementsBase;
constructor();
init(material: IMaterial, renderElements: _Render_ElementsBase): void;
activatePass(index: number): void;
deactivatePass(): 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.
*
* @param owner The IEntity that had this material assigned
*
* @internal
*/
addOwner(owner: _Render_RenderableBase): void;
/**
* Removes an IEntity as owner.
* @param owner
*
* @internal
*/
removeOwner(owner: _Render_RenderableBase): void;
getImageIndex(texture: ITexture, index?: number): number;
/**
*
*/
onClear(event: AssetEvent): void;
/**
*
*/
onInvalidatePasses(event: MaterialEvent): void;
/**
* Listener for when a pass's shader code changes. It recalculates the render order id.
*/
private onPassInvalidate;
/**
*
*/
onInvalidateTextures(event: MaterialEvent): void;
/**
*
*/
onInvalidate(event: AssetEvent): void;
/**
* Removes all passes from the surface
*/
_pClearPasses(): void;
/**
* Adds a pass to the surface
* @param pass
*/
_pAddPass(pass: IPass): void;
/**
* Removes a pass from the surface.
* @param pass The pass to be removed.
*/
_pRemovePass(pass: IPass): void;
/**
* Performs any processing that needs to occur before any of its passes are used.
*
* @private
*/
_pUpdateRender(): void;
/**
*
* @param surface
*/
protected _updateAnimation(): void;
private _updateImages;
/**
* test if animation will be able to run on gpu BEFORE compiling materials
* test if the shader objects supports animating the animation set in the vertex shader
* if any object using this material fails to support accelerated animations for any of the shader objects,
* we should do everything on cpu (otherwise we have the cost of both gpu + cpu animations)
*/
private _getEnabledGPUAnimation;
}
//# sourceMappingURL=_Render_MaterialBase.d.ts.map