the-world-engine
Version:
three.js based, unity like game engine for browser
192 lines (191 loc) • 7.33 kB
TypeScript
import type { Quaternion, Vector2, Vector3 } from "three/src/Three";
import { Component } from "../../hierarchy_object/Component";
import type { ReadonlyQuaternion } from "../../math/ReadonlyQuaternion";
import type { ReadonlyVector2 } from "../../math/ReadonlyVector2";
import type { ReadonlyVector3 } from "../../math/ReadonlyVector3";
import type { IUnknownSizeCssRenderOption } from "../render/CssRenderer";
import type { ICssImageRenderOption } from "../render/CssSpriteRenderer";
import { ImageRenderingMode } from "../render/CssSpriteRenderer";
import { CssFilter } from "../render/filter/CssFilter";
/**
* represents a sprite atlas instance
*
* this class is used from the SpriteAtlasStaticInstancer
*/
export declare class SpriteAtlasInstance {
private readonly _width;
private readonly _height;
private readonly _atlasIndex;
private readonly _position;
private readonly _rotation;
private readonly _scale;
private readonly _centerOffset;
constructor(width: number, height: number, atlasIndex: number, position: Vector3, rotation?: Quaternion, scale?: Vector3, centerOffset?: Vector2);
/**
* sprite atlas instance width
*/
get width(): number;
/**
* sprite atlas instance height
*/
get height(): number;
/**
* sprite atlas instance atlas index
*/
get atlasIndex(): number;
/**
* sprite atlas instance position
*/
get position(): ReadonlyVector3;
/**
* sprite atlas instance rotation
*/
get rotation(): ReadonlyQuaternion | undefined;
/**
* sprite atlas instance scale
*/
get scale(): ReadonlyVector3 | undefined;
/**
* sprite atlas instance center offset
*/
get centerOffset(): ReadonlyVector2 | undefined;
}
/**
* this component draws multiple sprite atlas instances
*
* drawcall optimization is not yet available
*/
export declare class SpriteAtlasStaticInstancer extends Component implements IUnknownSizeCssRenderOption, ICssImageRenderOption {
private _imageSource;
private _useZaxisSorter;
private _zaxisSortOffset;
private _columnCount;
private _rowCount;
private _pointerEvents;
private _viewScale;
private _imageRenderingMode;
private readonly _filter;
private _initializeFunction;
private _started;
start(): void;
/**
* set instances to be drawn
* @param instances instances to be drawn
* @returns
*/
setInstances(instances: SpriteAtlasInstance[]): void;
/**
* set the number of rows and columns of the sprite atlas
*
* Even if you change this value after the instance is created. Objects that have already been created will not be changed
* @param columnCount number of columns
* @param rowCount number of rows
*/
setSliceCount(columnCount: number, rowCount: number): void;
/**
* image source of the sprite atlas (default: `GlobalConfig.defaultSpriteSrc`)
*
* Even if you change this value after the instance is created. Objects that have already been created will not be changed
*/
get imageSource(): string;
/**
* image source of the sprite atlas (default: `GlobalConfig.defaultSpriteSrc`)
*
* Even if you change this value after the instance is created. Objects that have already been created will not be changed
*/
set imageSource(value: string);
/**
* column count of the sprite atlas (default: 1)
*/
get columnCount(): number;
/**
* row count of the sprite atlas (default: 1)
*/
get rowCount(): number;
/**
* if this is true, the zaxis sorter will be attached to the sprite atlas instances
* otherwise the zaxis initializer will be attached (default: false)
*
* Even if you change this value after the instance is created. Objects that have already been created will not be changed
*/
get useZindexSorter(): boolean;
/**
* if this is true, the zaxis sorter will be attached to the sprite atlas instances
* otherwise the zaxis initializer will be attached (default: false)
*
* Even if you change this value after the instance is created. Objects that have already been created will not be changed
*/
set useZindexSorter(value: boolean);
/**
* offset of the zaxis sorter (default: 0)
*
* this is only used if useZindexSorter is true
*
* Even if you change this value after the instance is created. Objects that have already been created will not be changed
*/
get zindexSortOffset(): number;
/**
* offset of the zaxis sorter (default: 0)
*
* this is only used if useZindexSorter is true
*
* Even if you change this value after the instance is created. Objects that have already been created will not be changed
*/
set zindexSortOffset(value: number);
/**
* if this is true, the sprite atlas instances can be clicked (default: true)
*
* Even if you change this value after the instance is created. Objects that have already been created will not be changed
*/
get pointerEvents(): boolean;
/**
* if this is true, the sprite atlas instances can be clicked (default: true)
*
* Even if you change this value after the instance is created. Objects that have already been created will not be changed
*/
set pointerEvents(value: boolean);
/**
* element viewScale
*
* value to scaling html element. the smaller value, the higher resolution of element.
*
* note: if the viewScale is greater than 1, render will have different behaviour depending on the browser. In the case of firefox, normal operation is guaranteed.
*
* Even if you change this value after the instance is created. Objects that have already been created will not be changed
* @param value
*/
get viewScale(): number;
/**
* element viewScale
*
* value to scaling html element. the smaller value, the higher resolution of element.
*
* note: if the viewScale is greater than 1, render will have different behaviour depending on the browser. In the case of firefox, normal operation is guaranteed.
*
* Even if you change this value after the instance is created. Objects that have already been created will not be changed
* @param value
*/
set viewScale(value: number);
/**
* css filter
*
* Even if you change this value after the instance is created. Objects that have already been created will not be changed
*/
get filter(): CssFilter;
/**
* image rendering mode (default: ImageRenderingMode.Pixelated)
*
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/image-rendering
*
* Even if you change this value after the instance is created. Objects that have already been created will not be changed
*/
get imageRenderingMode(): ImageRenderingMode;
/**
* image rendering mode (default: ImageRenderingMode.Pixelated)
*
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/image-rendering
*
* Even if you change this value after the instance is created. Objects that have already been created will not be changed
*/
set imageRenderingMode(value: ImageRenderingMode);
}