@awayjs/renderer
Version:
Renderer for AwayJS
133 lines • 5.22 kB
TypeScript
import { Box, Sphere, Matrix3D, Vector3D, AssetBase, Rectangle, Matrix } from '@awayjs/core';
import { AttributesBuffer, AttributesView, Short3Attributes } from '@awayjs/stage';
import { PickingCollision, ContainerNode } from '@awayjs/view';
import { IElements } from '../base/IElements';
import { IHullImpl } from '../utils/ConvexHullUtils';
import { IMaterial } from '../base/IMaterial';
export type THullImplId = IHullImpl & {
offset: number;
count: number;
};
/**
* @class away.base.TriangleElements
*/
export declare class ElementsBase extends AssetBase implements IElements {
isDynamic: boolean;
private _indices;
private _customAttributesNames;
private _customAttributes;
protected _useCondensedIndices: boolean;
protected _condensedIndexLookUp: Array<number>;
protected _autoDeriveNormals: boolean;
protected _autoDeriveTangents: boolean;
protected _convexHull: THullImplId;
protected _boundsRequests: number;
_numElements: number;
_numVertices: number;
_concatenatedBuffer: AttributesBuffer;
private _invalidateIndices;
_verticesDirty: Object;
_invalidateVertices: Object;
/**
* Original Bounds for 9Slice
*/
originalScale9Bounds: Rectangle;
/**
* Scale constraints! Not a Recangle. x - left side, width - right side, y - top, height - bottom
*/
scale9Grid: Rectangle;
/**
* Right index bound for vertices for scalable regions
* Lenght MUST BE A 9
*/
scale9Indices: number[];
/**
* Initial position buffer, store only XY values
*/
initialScale9Positions: ArrayLike<number>;
usages: number;
get concatenatedBuffer(): AttributesBuffer;
/**
* The raw index data that define the faces.
*/
get indices(): Short3Attributes;
/**
*
*/
getCustomAtributesNames(): Array<string>;
/**
*
*/
getCustomAtributes(name: string): AttributesView;
/**
* The total amount of triangles in the TriangleElements.
*/
get numElements(): number;
get numVertices(): number;
get condensedIndexLookUp(): Array<number>;
/**
* True if the vertex normals should be derived from the geometry, false if the vertex normals are set
* explicitly.
*/
get autoDeriveNormals(): boolean;
set autoDeriveNormals(value: boolean);
/**
* True if the vertex tangents should be derived from the geometry, false if the vertex normals are set
* explicitly.
*/
get autoDeriveTangents(): boolean;
set autoDeriveTangents(value: boolean);
/**
* Offers the option of enabling GPU accelerated animation on skeletons larger than 32 joints
* by condensing the number of joint index values required per sprite. Only applicable to
* skeleton animations that utilise more than one sprite object. Defaults to false.
*/
get useCondensedIndices(): boolean;
set useCondensedIndices(value: boolean);
/**
*
*/
constructor(concatenatedBuffer?: AttributesBuffer);
copyTo(elements: ElementsBase): void;
/**
*
*/
dispose(): void;
/**
* Updates the face indices of the TriangleElements.
*
* @param indices The face indices to upload.
*/
setIndices(array: Array<number>, offset?: number): any;
setIndices(uint16Array: Uint16Array, offset?: number): any;
setIndices(short3Attributes: Short3Attributes, offset?: number): any;
/**
* Updates custom attributes.
*/
setCustomAttributes(name: string, array: Array<number>, offset?: number): any;
setCustomAttributes(name: string, arrayBufferView: ArrayBufferView, offset?: number): any;
setCustomAttributes(name: string, attributesView: AttributesView, offset?: number): any;
updateScale9(targetScaleX: number, targetScaleY: number): void;
prepareScale9(bounds: Rectangle, grid: Rectangle, clone: boolean, emitUV?: boolean, uvMatrix?: Matrix): ElementsBase;
/**
* Clones the current object
* @return An exact duplicate of the current object.
*/
clone(): ElementsBase;
applyTransformation(transform: Matrix3D, count?: number, offset?: number): void;
/**
* Scales the geometry.
* @param scale The amount by which to scale.
*/
scale(scale: number, count?: number, offset?: number): void;
scaleUV(scaleU?: number, scaleV?: number, count?: number, offset?: number): void;
getBoxBounds(node?: ContainerNode, strokeFlag?: boolean, matrix3D?: Matrix3D, cache?: Box, target?: Box, count?: number, offset?: number): Box;
getSphereBounds(center: Vector3D, matrix3D?: Matrix3D, strokeFlag?: boolean, cache?: Sphere, target?: Sphere, count?: number, offset?: number): Sphere;
hitTestPoint(node: ContainerNode, x: number, y: number, z: number, box: Box, count?: number, offset?: number): boolean;
invalidateIndices(): void;
private clearIndices;
invalidateVertices(attributesView: AttributesView): void;
clearVertices(attributesView: AttributesView): void;
testCollision(collision: PickingCollision, box: Box, closestFlag: boolean, material: IMaterial, count: number, offset?: number): boolean;
}
//# sourceMappingURL=ElementsBase.d.ts.map