@awayjs/graphics
Version:
AwayJS graphics classes
124 lines • 4.38 kB
TypeScript
import { Box, Matrix3D, Sphere, Vector3D, AssetBase, Rectangle } from '@awayjs/core';
import { PickingCollision, _Pick_PickableBase, IPickable } from '@awayjs/view';
import { IMaterial, Style, ElementsBase, TriangleElements, IRenderable } from '@awayjs/renderer';
import { IFillStyle } from '../draw/IGraphicsData';
import { ParticleCollection } from '../animators/data/ParticleCollection';
/**
* Graphic wraps a Elements as a scene graph instantiation. A Graphic is owned by a Sprite object.
*
*
* @see away.base.ElementsBase
* @see away.entities.Sprite
*
* @class away.base.Graphic
*/
export declare class Shape<T extends ElementsBase = ElementsBase> extends AssetBase implements IPickable, IRenderable {
_renderObjects: Record<number, _Render_RenderableBase>;
_pickObjects: Record<number, _Pick_PickableBase>;
private static _pool;
static getShape<T extends ElementsBase>(elements: T, material?: IMaterial, style?: Style, count?: number, offset?: number): Shape<T>;
static clearPool(): void;
static assetType: string;
static quadElement(rect: Rectangle, slices?: number, genUv?: boolean): TriangleElements;
static getElement(rectangle: Rectangle): TriangleElements;
private static _imageShapeElements;
static getTriangleElement(rectangle: Rectangle, cache?: boolean, uv?: boolean, slices?: number): TriangleElements;
private _onInvalidatePropertiesDelegate;
private _onInvalidateVerticesDelegate;
private _elements;
private _material;
private _style;
usages: number;
count: number;
offset: number;
particleCollection: ParticleCollection;
originalFillStyle: IFillStyle;
/**
* Process per-triangle hit test - superslow for huge elements
*/
deepHitCheck: boolean;
/**
* The Elements object which provides the geometry data for this Shape.
*/
get elements(): T;
set elements(value: T);
/**
*
*/
get assetType(): string;
/**
* The material used to render the current Shape.
* If set to null, the containing Graphics's material will be used instead.
*/
get material(): IMaterial;
set material(value: IMaterial);
/**
* The style used to render the current Shape. If set to null, its parent Sprite's style will be used instead.
*/
get style(): Style;
set style(value: Style);
/**
* Creates a new Shape object
*/
constructor(elements: T, material?: IMaterial, style?: Style, count?: number, offset?: number);
/**
*
*/
dispose(): void;
invalidateElements(): void;
invalidateMaterial(): void;
invalidateStyle(): void;
private _onInvalidateProperties;
private _onInvalidateVertices;
/**
* //TODO
*
* @param shortestCollisionDistance
* @param findClosest
* @returns {boolean}
*
* @internal
*/
applyTransformation(transform: Matrix3D): void;
scale(scale: number): void;
scaleUV(scaleU?: number, scaleV?: number): void;
}
import { _Render_RenderableBase, RenderEntity, _Stage_ElementsBase, _Render_MaterialBase } from '@awayjs/renderer';
/**
* @class away.pool._Render_Shape
*/
export declare class _Render_Shape extends _Render_RenderableBase {
private _scaleX;
private _scaleY;
private _scale9Elements;
/**
* //TODO
*
* @param renderEntity
* @param shape
* @param level
* @param indexOffset
*/
init(shape: Shape, renderEntity: RenderEntity): void;
onClear(): void;
/**
*
* @returns {ElementsBase}
* @protected
*/
protected _getStageElements(): _Stage_ElementsBase;
protected _getRenderMaterial(): _Render_MaterialBase;
protected _getStyle(): Style;
protected getDefaultMaterial(): IMaterial;
updateScale9(scale9Grid: Rectangle, scaleX: number, scaleY: number): ElementsBase;
}
/**
* @class away.pool._Render_Shape
*/
export declare class _Pick_Shape extends _Pick_PickableBase {
hitTestPoint(x: number, y: number, z: number): boolean;
getBoxBounds(matrix3D?: Matrix3D, strokeFlag?: boolean, cache?: Box, target?: Box): Box;
getSphereBounds(center: Vector3D, matrix3D?: Matrix3D, strokeFlag?: boolean, cache?: Sphere, target?: Sphere): Sphere;
testCollision(collision: PickingCollision, findClosestCollision: boolean): boolean;
}
//# sourceMappingURL=Shape.d.ts.map