Skip to content

Instantly share code, notes, and snippets.

@MichaelFedora
Last active December 29, 2017 14:20
Show Gist options
  • Save MichaelFedora/c51bf0bcb270ddda40550bf389e25640 to your computer and use it in GitHub Desktop.
Save MichaelFedora/c51bf0bcb270ddda40550bf389e25640 to your computer and use it in GitHub Desktop.
PlayCanvas Engine Typings (wip). Use it by downloading and placing both this and `playcanvas-stable.js` in the same directory.
/**
* PlayCanvas Engine Typings
*
* Use it by downloading and placing both this and `playcanvas-stable.js` in the same directory.
*
* (c) 2017 Michael Fedora (michaelfedora.github.io)
* Licensed under MIT.
*/
type DomKeyboardEvent = KeyboardEvent;
type DomMouseEvent = MouseEvent;
type DomTouchEvent = TouchEvent;
type DomElement = Element;
declare namespace PlayCanvas {
type Element = DomElement | Document | Window;
interface EventSupport {
fire(event: string, ...args: any[]): void;
hasEvent(event: string): boolean;
on(event: string, callback: Function, scope?: Object): void;
off(event?: string, callback?: Function, scope?: Object): void;
once(event: string, callback: Function, scope?: Object): void;
}
interface Resource extends EventSupport {
}
interface ResourceFile {
filename?: string;
hash?: string;
size?: number;
url?: string;
}
interface ResourceData {
/**
* cubemap
*/
textures?: number[];
/**
* cubemap
*/
minFilter?: number;
/**
* cubemap
*/
magFilter?: number;
/**
* cubemap
*/
anisotropy?: number;
}
interface Animation extends Resource {
}
interface AnimationComponent extends Component {
}
interface AnimationComponentSystem extends ComponentSystem {
}
interface ApplicationOptions {
keyboard?: Keyboard,
mouse?: Mouse;
touch?: TouchDevice;
gamepads?: GamePads;
scriptPrefix?: string;
assetPrefix?: string;
graphicsDeviceOptions?: GraphicsDeviceOptions;
}
interface Application extends EventSupport {
assets: AssetRegistry;
autoRender: boolean;
elementInput: ElementInput;
gamepads: GamePads;
graphicsDevice: GraphicsDevice;
keyboard: Keyboard;
loader: ResourceLoader;
mouse: Mouse;
renderNextFrame: boolean;
root: Entity;
scene: Scene;
scripts: ScriptRegistry;
timeScale: number;
touch: TouchDevice;
configure(url: string, callback: () => any): void;
destroy(): void;
disableFullscreen(success?: () => any): void;
enableFullscreen(element?: Element, success?: () => any, error?: () => any): void;
isFullscreen(): boolean;
isHidden(): boolean;
loadSceneHierarchy(url: string, callback: (err: any, entity: Entity) => any): void;
loadSceneSettings(url: string, callback: (err: any) => any): void;
preload(callback: () => any): void;
render(): void;
renderLine(start: Vec3, end: Vec3, color: Color, lineType?: LineType): void;
renderLine(start: Vec3, end: Vec3, startColor: Color, endColor: Color, lineType?: LineType): void;
renderLines(position: Vec3[], color: Color[], lineType?: LineType);
resizeCanvas(): void;
resizeCanvas(width: number, height: number): void;
setCanvasFillMode(mode: FilleModeType): void;
setCanvasFillMode(mode: FilleModeType, width: number, height: number): void;
setCanvasResolution(mode: ResolutionModeType): void;
setCanvasResolution(mode: ResolutionModeType, width: number, height: number): void;
setSkybox(asset: Asset): void;
start(): void;
update(dt: number): void;
}
type AssetType = 'animation'
| 'audio'
| 'binary'
| 'cubemap'
| 'css'
| 'font'
| 'json'
| 'html'
| 'material'
| 'model'
| 'script'
| 'shader'
| 'text'
| 'texture';
interface Asset extends EventSupport {
data?: any;
file?: ResourceFile;
id: number;
loaded: boolean;
name: string;
preload: boolean;
registry: AssetRegistry;
resource?: Resource;
resources?: Resource[];
tags: Tags;
type: AssetType;
getFileUrl(): string;
ready(callback: (asset) => any): void;
unload(): void;
on(event: 'change', callback: (asset: Asset, property: string, value: any, oldValue: any) => any, scope?: Object): void;
on(event: 'error', callback: (err: string, asset: Asset) => any, scope?: Object): void;
on(event: 'load', callback: (asset: Asset) => any, scope?: Object): void;
on(event: 'remove', callback: (asset: Asset) => any, scope?: Object): void;
}
interface AssetRegistry extends EventSupport {
prefix: string;
add(asset: Asset): void;
filter(callback: (asset: Asset) => boolean): Asset[];
find(name: string, type?: AssetType): Asset;
findAll(name: string, type?: AssetType): Asset[];
findByTag(tag: string): Asset[];
get(id: number): Asset;
getByUrl(url: string): Asset;
list(filters: { [key: string]: any; preload?: boolean }): Asset[];
load(asset: Asset): void;
loadFromUrl(url: string, type: AssetType, callback: (err: any, asset: Asset) => void): void;
remove(asset: Asset): void;
/**
* add:[id],
* add:url:[url],
* error:[id],
* load:[id],
* load:url:[url],
* remove:[id],
* remove:url:[url],
*/
on(event: string, callback: (asset: Asset) => any, scope?: Object): void;
on(event: 'add', callback: (asset: Asset) => any, scope?: Object): void;
on(event: 'error', callback: (err: string, asset: Asset) => any, scope?: Object): void;
on(event: 'load', callback: (asset: Asset) => any, scope?: Object): void;
on(event: 'remove', callback: (asset: Asset) => any, scope?: Object): void;
}
interface AudioListenerComponent extends Component {
}
interface AudioListenerComponentSystem extends ComponentSystem {
}
interface AudioSourceComponent extends Component {
}
interface AudioSourceComponentSystem extends ComponentSystem {
setVolume(value: number): void;
}
interface BasicMaterial {
}
interface BoundingBox {
}
interface BoundingSphere {
}
interface CameraComponent extends Component {
aspectRatio: number;
calculateProjection: (transformMatrix: Mat4, view: ViewType) => void;
clearColor: Color;
clearColorBuffer: boolean;
clearDepthBuffer: boolean;
clearStencilBuffer: boolean;
cullFaces: boolean;
farClip: number;
flipFaces: boolean;
fov: number;
readonly frustum: Frustum;
frustumCulling: boolean;
horizontalFov: boolean;
nearClip: number;
readonly node: GraphNode;
orthoHeight: number;
postEffects: PostEffectQueue;
priority: number;
projection: ProjectionType;
readonly projectionMatrix: Mat4;
rect: Vec4;
renderTarget: RenderTarget;
scissorRect: Vec4;
readonly viewMatrix: Mat4;
vrDisplay: VrDisplay;
enterVr(display: VrDisplay, callback: (err) => any): void;
enterVr(callback: (err) => any): void;
exitVr(callback: (err) => any): void;
screenTWorld(screenx: number, screeny: number, cameraz: number, worldCoord?: Vec3): Vec3;
worldToScreen(worldCoord: Vec3, screenCoord?: Vec3): Vec3;
}
interface CameraComponentSystem extends ComponentSystem {
cameras: CameraComponent[];
}
interface CollisionComponent extends Component {
}
interface CollisionComponentSystem extends ComponentSystem {
}
interface Color {
clone(): Color;
copy(rhs: Color): Color;
fromString(hex: string): Color;
set(r: number, g: number, b: number, a?: number): Color;
toString(): string;
}
type ComponentType = 'animation'
| 'audiolistener'
| 'camera'
| 'collision'
| 'element'
| 'light'
| 'model'
| 'particlesystem'
| 'rigidbody'
| 'screen'
| 'script'
| 'sound'
| 'zone';
interface Component {
enabled: boolean;
}
interface ComponentSystem {
}
interface ComponentSystemRegistry {
}
interface ContactPoint {
localPoint: Vec3;
localPointOther: Vec3;
normal: Vec3;
point: Vec3;
pointOther: Vec3;
}
interface ContactResult {
contacts: ContactPoint[];
other: Entity;
}
interface Controller {
}
interface Curve {
}
interface CurveSet {
}
interface ElementComponent extends Component {
}
interface ElementComponent extends ComponentSystem {
}
interface ElementComponentSystem {
}
interface ElementInput {
}
interface ElementInputEvent {
}
interface ElementMouseEvent {
}
interface ElementTouchEvent {
}
interface Entity extends GraphNode, EventSupport {
animation?: AnimationComponent;
audiolistener?: AudioListenerComponent;
camera?: CameraComponent;
collision?: CollisionComponent;
element?: ElementComponent;
light?: LightComponent;
model?: ModelComponent;
particlesystem?: ParticleSystemComponent;
rigidbody?: RigidBodyComponent;
screen?: ScreenComponent;
script?: ScriptComponent;
sound?: SoundComponent;
zone?: ZoneComponent;
addComponent(type: 'animation', data: Partial<AnimationComponent>): AnimationComponent;
addComponent(type: 'audiolistener', data: Partial<AudioListenerComponent>): AudioListenerComponent;
addComponent(type: 'camera', data: Partial<CameraComponent>): CameraComponent;
addComponent(type: 'collision', data: Partial<CollisionComponent>): CollisionComponent;
addComponent(type: 'element', data: Partial<ElementComponent>): ElementComponent;
addComponent(type: 'light', data: Partial<LightComponent>): LightComponent;
addComponent(type: 'model', data: Partial<ModelComponent>): ModelComponent;
addComponent(type: 'particlesystem', data: Partial<ParticleSystemComponent>): ParticleSystemComponent;
addComponent(type: 'rigidbody', data: Partial<RigidBodyComponent>): RigidBodyComponent;
addComponent(type: 'screen', data: Partial<ScreenComponent>): ScreenComponent;
addComponent(type: 'script', data: Partial<ScriptComponent>): ScriptComponent;
addComponent(type: 'sound', data: Partial<SoundComponent>): SoundComponent;
addComponent(type: 'zone', data: Partial<ZoneComponent>): ZoneComponent;
addComponent<T extends Component>(type: ComponentType, data: Partial<T>): T;
addComponent(type: ComponentType, data: any): Component;
clone(): Entity;
destroy(): void;
findByGuid(guid: string): Entity;
removeComponent(type: string): void;
on(event: 'destroy', callback: (e: Entity) => any, scope?: Object): void;
}
interface Font extends Resource {
}
interface Frustum {
}
interface GamePads {
}
interface GraphicsDeviceOptions {
}
interface GraphicsDevice extends EventSupport {
readonly height: number;
readonly maxAnisotropy: number;
readonly maxCubeMapSize: number;
readonly maxTextureSize: number;
readonly maxVolumeSize: number;
readonly precision: string;
readonly width: number;
}
interface GraphNode {
children: GraphNode[];
enabled: boolean;
forward: Vec3;
name: string;
parent: GraphNode;
right: Vec3;
root: GraphNode;
tags: Tags;
up: Vec3;
addChild(node: GraphNode): void;
find(callback: (child: GraphNode) => boolean): GraphNode[];
find(attr: string, value: any): GraphNode[];
findByName(name: string): GraphNode;
findByPath(path: string): GraphNode;
findByTag(...query: [string[] | string][]): GraphNode[];
findOne(callback: (child: GraphNode) => boolean): GraphNode;
getEulerAngles(): Vec3;
getLocalEulerAngles(): Vec3;
getLocalPosition(): Vec3;
getLocalRotation(): Quat;
getLocalScale(): Vec3;
getLocalTransform(): Mat4;
getPath(): string;
getPosition(): Vec3;
getWorldTransform(): Mat4;
insertChild(node: GraphNode, index: number);
isAncestorOf(node: GraphNode): boolean;
isDescendantOf(node: GraphNode): boolean;
lookAt(target: Vec3, up?: Vec3);
lookAt(tx: number, ty: number, tz: number): void;
lookAt(tx: number, ty: number, tz: number, ux: number, uy: number, uz: number);
removeChild(node: GraphNode): void;
reparent(parent: GraphNode, index?: number);
rotate(ex: number, ey: number, ez: number): void;
rotate(rot: Vec3): void;
rotateLocal(ex: number, ey: number, ez: number): void;
rotateLocal(rot: Vec3): void;
setEulerAngles(ex: number, ey: number, ez: number): void;
setEulerAngles(angles: Vec3): void;
setLocalEulerAngles(x: number, y: number, z: number): void;
setLocalEulerAngles(e: Vec3): void;
setLocalPosition(x: number, y: number, z: number): void;
setLocalPosition(pos: Vec3): void;
setLocalRotation(x: number, y: number, z: number, w: number): void;
setLocalRotation(q: Quat): void;
setLocalScale(x: number, y: number, z: number): void;
setLocalScale(scale: Vec3): void;
setPosition(x: number, y: number, z: number): void;
setPosition(pos: Vec3): void;
setRotation(x: number, y: number, z: number, w: number): void;
setRotation(q: Quat): void;
setScale(x: number, y: number, z: number): void;
setScale(scale: Vec3): void;
syncHierarchy(): void;
translate(x: number, y: number, z: number): void;
translate(translation: Vec3): void;
translateLocal(x: number, y: number, z: number): void;
translateLocal(translation: Vec3): void;
}
interface Http {
}
interface IndexBuffer {
}
interface Keyboard extends EventSupport {
attach(element: Element): void;
detach(): void;
isPressed(key: KeyboardKeyType | number): boolean;
wasPressed(key: KeyboardKeyType | number): boolean;
wasReleased(key: KeyboardKeyType | number): boolean;
on(event: 'keydown', callback: (event: KeyboardEvent) => any, scope?: Object): void;
on(event: 'keyup', callback: (event: KeyboardEvent) => any, scope?: Object): void;
}
interface KeyboardEvent {
element: Element;
event: DomKeyboardEvent;
key: KeyboardKeyType;
}
interface LightComponent extends Component {
affectDynamic: boolean;
affectLightmapped: boolean;
bake: boolean;
bakeDir: boolean;
castShadows: boolean;
color: Color;
cookie: Texture;
cookieAngle: number;
cookieAsset: number;
/**
* Color channels of the projection texture to use. Can be "r", "g", "b", "a", "rgb" or any swizzled combination.
*/
cookieChanel: string;
cookieFalloff: boolean;
cookieIntensity: number;
cookieOffset: Vec2;
cookieScale: Vec2;
falloffMode: LightFalloffType;
innerConeAngle: number;
intensity: number;
isStatic: boolean;
mask: number;
normalOffsetBias: number;
outerConeAngle: number;
range: number;
shadowBias: number;
shadowDistance: number;
shadowResolution: number;
shadowType: ShadowUpdateType;
type: 'directional' | 'point' | 'spot';
vsmBlurMode: BlurType;
/**
* Number of samples used for blurring a variance shadow map. Only uneven numbers work, even are incremented. Minimum value is 1, maximum is 25.
*/
vsmBlurSize: number;
}
interface Lightmapper {
}
interface Listener {
}
interface Mat3 {
}
interface Mat4 {
}
interface Material extends Resource {
}
interface Mesh {
}
interface MeshInstance {
}
interface Model extends Resource {
graph: GraphNode;
meshInstances: MeshInstance[];
clone(): Model;
destroy(): void;
generateWireframe(): void;
}
interface ModelComponent extends Component{
asset: Asset;
castShadows: boolean;
castShadowsLightmap: boolean;
isStatic: boolean;
lightmapSizeMultiplier: number;
lightmapped: boolean;
mapping: {[key: number]: number};
materialAsset: number;
meshInstances: MeshInstance[];
model: Model;
receiveShadows: boolean;
type: 'asset' | 'box' | 'capsule' | 'cone' | 'cylinder' | 'sphere';
hide(): void;
show(): void;
}
interface ModelComponentSystem extends ComponentSystem {
}
interface ModelHandler {
}
interface Mouse extends EventSupport {
attach(element: Element): void;
detach(): void;
disableContextMenu(): void;
disablePointerLock(success?: () => void): void;
enableContextMenu(): void;
enablePointerLock(success?: () => void, error?: () => void): void;
isPressed(button: MouseButtonType | number): boolean;
update(dt: number): void;
wasPressed(button: MouseButtonType | number): boolean;
wasReleased(button: MouseButtonType | number): boolean;
on(event: 'mousedown', callback: (event: MouseEvent) => any, scope?: Object): void;
on(event: 'mousemove', callback: (event: MouseEvent) => any, scope?: Object): void;
on(event: 'mouseup', callback: (event: MouseEvent) => any, scope?: Object): void;
on(event: 'mousewheel', callback: (event: MouseEvent) => any, scope?: Object): void;
}
interface MouseEvent {
altKey: boolean;
button: MouseButtonType;
ctrlKey: boolean;
dx: number;
dy: number;
element: DomElement;
event: DomMouseEvent;
metaKey: boolean;
shiftKey: boolean;
/**
* A value representing the amount the mouse wheel has moved, only valid for mousemove events
*/
wheel: number;
x: number;
y: number;
}
interface Node {
}
interface OrientedBox {
}
interface ParticleSystemComponent extends Component {
}
interface ParticleSystemComponentSystem extends ComponentSystem{
}
interface Picker {
}
interface PostEffect {
}
interface PostEffectQueue {
}
interface Quat {
}
interface Ray {
}
interface RaycastResult {
}
interface RenderTarget {
}
interface ResourceLoader {
}
interface RigidBodyComponent extends Component {
}
interface RigidBodyComponentSystem extends ComponentSystem {
}
interface Scene extends EventSupport {
ambientLight: Color;
fog: FogType;
fogColor: Color;
fogDensity: number;
fogEnd: number;
fogStart: number;
gammaCorrection: number;
lightmapMaxResolution: number;
lightmapMode: BakeType;
lightmapSizeMultiplier: number;
skybox?: Texture;
skyboxIntensity: number;
skyboxMip: number;
toneMapping: TonemapType;
addModel(model: Model): void;
removeModel(model: Model): void;
update(): void;
}
interface ScreenComponent extends Component {
}
interface ScreenComponentSystem extends ComponentSystem {
}
type ScriptAttributeType = 'boolean'
| 'number'
| 'string'
| 'json'
| 'asset'
| 'entity'
| 'rgb'
| 'rgba'
| 'vec2'
| 'vec3'
| 'vec4'
| 'curve';
interface ScriptAttribute {
type: ScriptAttributeType;
default?: any;
title?: string;
description?: string;
placeholder?: string | string[];
array?: boolean;
size?: number;
min?: number;
max?: number;
precision?: number;
assetType?: AssetType | '*';
curves?: string[];
color?: string;
enum?: {[key: string]: any};
}
interface ScriptAttributes {
add(name: string, args: ScriptAttribute): void;
get(name: string): ScriptAttribute;
has(name: string): boolean;
remove(name: string): boolean;
}
interface ScriptComponent extends Component {
}
interface ScriptComponentSystem extends ComponentSystem {
}
interface ScriptHandler {
}
interface ScriptRegistry {
}
interface Shader extends Resource {
}
interface SingleContactResult {
}
interface Skeleton {
}
interface Skin {
}
interface SkinInstance {
}
interface Sound {
}
interface SoundComponent extends Component {
}
interface SoundComponentSystem extends ComponentSystem {
}
interface SoundInstance {
}
interface SoundInstance3d {
}
interface SoundManager {
}
interface SoundSlot {
}
interface StandardMaterial {
}
interface StencilParameters {
}
interface Tags {
}
interface Texture extends Resource {
}
interface Touch {
}
interface TouchDevice {
}
interface TouchEvent {
}
interface TransformFeedback {
}
interface Vec2 {
x: number;
y: number;
add(rhs: Vec2): Vec2;
add2(lhs: Vec2, rhs: Vec2): Vec2;
clone(): Vec2;
copy(rhs: Vec2): Vec2;
dot(rhs: Vec2): Vec2;
equals(rhs: Vec2): boolean;
length(): number;
lengthSq(): number;
lerp(lhs: Vec2, rhs: Vec2, alpha: number): Vec2;
mul(rhs: Vec2): Vec2;
mul2(lhs: Vec2, rhs: Vec2): Vec2;
normalize(): Vec2;
scale(scalar: number): Vec2;
set(x: number, y: number): Vec2;
sub(rhs: Vec2): Vec2;
sub2(lhs: Vec2, rhs: Vec2): Vec2;
toString(): string;
}
interface Vec3 {
x: number;
y: number;
z: number;
add(rhs: Vec3): Vec3;
add2(lhs: Vec3, rhs: Vec3): Vec3;
clone(): Vec3;
copy(rhs: Vec3): Vec3;
cross(lhs: Vec3, rhs: Vec3): Vec3;
dot(rhs: Vec3): Vec3;
equals(rhs: Vec3): boolean;
length(): number;
lengthSq(): number;
lerp(lhs: Vec3, rhs: Vec3, alpha: number): Vec3;
mul(rhs: Vec3): Vec3;
mul2(lhs: Vec3, rhs: Vec3): Vec3;
normalize(): Vec3;
project(rhs: Vec3): Vec3;
scale(scalar: number): Vec3;
set(x: number, y: number, z: number): Vec3;
sub(rhs: Vec3): Vec3;
sub2(lhs: Vec3, rhs: Vec3): Vec3;
toString(): string;
}
interface Vec4 {
x: number;
y: number;
z: number;
w: number;
add(rhs: Vec4): Vec4;
add2(lhs: Vec4, rhs: Vec4): Vec4;
clone(): Vec4;
copy(rhs: Vec4): Vec4;
dot(rhs: Vec4): Vec4;
equals(rhs: Vec4): boolean;
length(): number;
lengthSq(): number;
lerp(lhs: Vec4, rhs: Vec4, alpha: number): Vec4;
mul(rhs: Vec4): Vec4;
mul2(lhs: Vec4, rhs: Vec4): Vec4;
normalize(): Vec4;
scale(scalar: number): Vec4;
set(x: number, y: number, z: number): Vec4;
sub(rhs: Vec4): Vec4;
sub2(lhs: Vec4, rhs: Vec4): Vec4;
toString(): string;
}
interface VertexBuffer {
}
interface VertexFormat {
}
interface VertexIterator {
}
interface VrDisplay {
}
interface VrManager {
}
interface ZoneComponent extends Component {
}
interface ZoneComponentSystem extends ComponentSystem {
}
interface ScriptType extends EventSupport {
app: Application;
enabled: boolean;
entity: Entity;
initialize?(): void;
postInitialize?(): void;
update?(dt: number): void;
postUpdate?(): void;
swap?(): void;
/**
* attr:[name]
*/
on(event: string, callback: (value: ScriptAttribute, valueOld: ScriptAttribute) => any, scope?: Object): void;
on(event: 'attr', callback: (name: string, value: ScriptAttribute, valueOld: ScriptAttribute) => any, scope?: Object): void;
on(event: 'destroy', callback: () => any, scope?: Object): void;
on(event: 'disable', callback: () => any, scope?: Object): void;
on(event: 'enable', callback: () => any, scope?: Object): void;
on(event: 'error', callback: (err: Error, method: string) => any, scope?: Object): void;
on(event: 'state', callback: (enabled: boolean) => any, scope?: Object): void;
}
class BakeType extends Number { }
class BlurType extends Number { }
class FilleModeType extends String { }
class FogType extends String { }
class KeyboardKeyType extends Number { }
class LightFalloffType extends Number { }
class LineType extends Number { }
class MouseButtonType extends Number { }
class ProjectionType extends Number { }
class ResolutionModeType extends String { }
class ShadowUpdateType extends Number { }
class TonemapType extends Number { }
class ViewType extends Number { }
interface pc {
ADDRESS_CLAMP_TO_EDGE: any;
BAKE_COLOR: BakeType;
BAKE_COLORDIR: BakeType;
BLUR_BOX: BlurType;
BLUR_GAUSSIAN: BlurType;
FILLMODE_NONE: FilleModeType;
FILLMODE_FILL_WINDOW: FilleModeType;
FILLMODE_KEEP_ASPECT: FilleModeType;
FOG_NONE: FogType;
FOG_LINEAR: FogType;
FOG_EXP: FogType;
FOG_EXP2: FogType;
KEY_0: KeyboardKeyType;
KEY_1: KeyboardKeyType;
KEY_2: KeyboardKeyType;
KEY_3: KeyboardKeyType;
KEY_4: KeyboardKeyType;
KEY_5: KeyboardKeyType;
KEY_6: KeyboardKeyType;
KEY_7: KeyboardKeyType;
KEY_8: KeyboardKeyType;
KEY_9: KeyboardKeyType;
KEY_A: KeyboardKeyType;
KEY_ADD: KeyboardKeyType;
KEY_ALT: KeyboardKeyType;
KEY_B: KeyboardKeyType;
KEY_BACKSPACE: KeyboardKeyType;
KEY_BACK_SLASH: KeyboardKeyType;
KEY_C: KeyboardKeyType;
KEY_CAPS_LOCK: KeyboardKeyType;
KEY_CLOSE_BRACKET: KeyboardKeyType;
KEY_COMMA: KeyboardKeyType;
KEY_CONTEXT_MENU: KeyboardKeyType;
KEY_CONTROL: KeyboardKeyType;
KEY_D: KeyboardKeyType;
KEY_DECIMAL: KeyboardKeyType;
KEY_DELETE: KeyboardKeyType;
KEY_DIVIDE: KeyboardKeyType;
KEY_DOWN: KeyboardKeyType;
KEY_E: KeyboardKeyType;
KEY_END: KeyboardKeyType;
KEY_ENTER: KeyboardKeyType;
KEY_EQUAL: KeyboardKeyType;
KEY_ESCAPE: KeyboardKeyType;
KEY_F: KeyboardKeyType;
KEY_F1: KeyboardKeyType;
KEY_F10: KeyboardKeyType;
KEY_F11: KeyboardKeyType;
KEY_F12: KeyboardKeyType;
KEY_F2: KeyboardKeyType;
KEY_F3: KeyboardKeyType;
KEY_F4: KeyboardKeyType;
KEY_F5: KeyboardKeyType;
KEY_F6: KeyboardKeyType;
KEY_F7: KeyboardKeyType;
KEY_F8: KeyboardKeyType;
KEY_F9: KeyboardKeyType;
KEY_G: KeyboardKeyType;
KEY_H: KeyboardKeyType;
KEY_HOME: KeyboardKeyType;
KEY_I: KeyboardKeyType;
KEY_INSERT: KeyboardKeyType;
KEY_J: KeyboardKeyType;
KEY_K: KeyboardKeyType;
KEY_L: KeyboardKeyType;
KEY_LEFT: KeyboardKeyType;
KEY_M: KeyboardKeyType;
KEY_META: KeyboardKeyType;
KEY_MULTIPLY: KeyboardKeyType;
KEY_N: KeyboardKeyType;
KEY_NUMPAD_0: KeyboardKeyType;
KEY_NUMPAD_1: KeyboardKeyType;
KEY_NUMPAD_2: KeyboardKeyType;
KEY_NUMPAD_3: KeyboardKeyType;
KEY_NUMPAD_4: KeyboardKeyType;
KEY_NUMPAD_5: KeyboardKeyType;
KEY_NUMPAD_6: KeyboardKeyType;
KEY_NUMPAD_7: KeyboardKeyType;
KEY_NUMPAD_8: KeyboardKeyType;
KEY_NUMPAD_9: KeyboardKeyType;
KEY_O: KeyboardKeyType;
KEY_OPEN_BRACKET: KeyboardKeyType;
KEY_P: KeyboardKeyType;
KEY_PAGE_DOWN: KeyboardKeyType;
KEY_PAGE_UP: KeyboardKeyType;
KEY_PAUSE: KeyboardKeyType;
KEY_PERIOD: KeyboardKeyType;
KEY_PRINT_SCREEN: KeyboardKeyType;
KEY_Q: KeyboardKeyType;
KEY_R: KeyboardKeyType;
KEY_RETURN: KeyboardKeyType;
KEY_RIGHT: KeyboardKeyType;
KEY_S: KeyboardKeyType;
KEY_SEMICOLON: KeyboardKeyType;
KEY_SEPARATOR: KeyboardKeyType;
KEY_SHIFT: KeyboardKeyType;
KEY_SLASH: KeyboardKeyType;
KEY_SPACE: KeyboardKeyType;
KEY_SUBTRACT: KeyboardKeyType;
KEY_T: KeyboardKeyType;
KEY_TAB: KeyboardKeyType;
KEY_U: KeyboardKeyType;
KEY_UP: KeyboardKeyType;
KEY_V: KeyboardKeyType;
KEY_W: KeyboardKeyType;
KEY_WINDOWS: KeyboardKeyType;
KEY_X: KeyboardKeyType;
KEY_Y: KeyboardKeyType;
KEY_Z: KeyboardKeyType;
LINEBATCH_WORLD: LineType;
LINEBATCH_OVERLAY: LineType;
LINEBATCH_GIZMO: LineType;
LIGHTFALLOFF_LINEAR: LightFalloffType;
LIGHTFALLOFF_INVERSESQUARED: LightFalloffType;
MOUSEBUTTON_LEFT: MouseButtonType;
MOUSEBUTTON_MIDDLE: MouseButtonType;
MOUSEBUTTON_NONE: MouseButtonType;
MOUSEBUTTON_RIGHT: MouseButtonType;
PROJECTION_PERSPECTIVE: ProjectionType;
PROJECTION_ORTHOGRAPHIC: ProjectionType;
RESOLUTION_AUTO: ResolutionModeType;
RESOLUTION_FIXED: ResolutionModeType;
SHADOWUPDATE_NONE: ShadowUpdateType;
SHADOWUPDATE_THISFRAME: ShadowUpdateType;
SHADOWUPDATE_REALTIME: ShadowUpdateType;
TONEMAP_LINEAR: TonemapType;
TONEMAP_FILMIC: TonemapType;
TONEMAP_HEJL: TonemapType;
TONEMAP_ACES: TonemapType;
VIEW_CENTER: ViewType;
VIEW_LEFT: ViewType;
VIEW_RIGHT: ViewType;
/*
* START Hidden PC interface
*
* (TS detected these automatically)
*/
[x: string]: any;
version: string;
revision: string;
config: {
[x: string]: any;
};
common: {
[x: string]: any;
};
apps: {
[x: string]: any;
};
data: {
[x: string]: any;
};
unpack: () => void;
makeArray: (arr: any) => any[];
type: (obj: any) => any;
extend: (target: any, ex: any) => any;
isDefined: (o: any) => boolean;
/*
* END Hidden PC interface
*/
events: EventSupport & {
attach(target: Object): void;
};
guid: {
create(): string;
};
math: {
};
path: {
};
platform: {
};
script: {
};
string: {
};
calculateNormals(positions: number[], indices: number[]): number[];
calculateTangents(positions: number[], normals: number[], uvs: number[], indices: number[]): number[];
createBox(device: GraphicsDevice, opts?: { halfExtents?: Vec3, widthSegments?: number, lengthSegments?: number, heightSegments?: number }): Mesh;
createCapsule(device: GraphicsDevice, opts?: { radius: number, height: number, heightSegments: number, sides: number }): Mesh;
createCone(device: GraphicsDevice, opts?: { baseRadius?: number, peakRadius?: number, height?: number, heightSegments?: number, capSegments?: number }): Mesh;
createCylinder(device: GraphicsDevice, opts?: { radius?: number, height?: number, heightSegments?: number, capSegments?: number }): Mesh;
createMesh(device: GraphicsDevice, positions: number[], opts?: { normals?: number[], tangents?: number[], colors?: number[], uvs?: number[], uvs2?: number[], indices?: number[] }): Mesh;
createPlane(device: GraphicsDevice, opts?: { halfExtents?: Vec2, widthSegments?: number, lengthSegments?: number }): Mesh;
createScript(name: string, app?: Application): {
attributes: ScriptAttributes;
extend(methods: {[key: string]: Function });
prototype: ScriptType;
new(): ScriptType;
};
Animation: new() => Animation;
AnimationComponent: new(system: AnimationComponentSystem, entity: Entity) => AnimationComponent;
AnimationComponentSystem: new(app: Application) => AnimationComponentSystem;
Application: new(canvas: HTMLCanvasElement, options?: ApplicationOptions) => Application;
Asset: new(name: string, type: AssetType, file?: ResourceFile, data?: ResourceData) => Asset;
AssetRegistry: new(loader: ResourceLoader) => AssetRegistry;
AudioListenerComponent: new(system: AudioListenerComponentSystem, entity: Entity) => AudioListenerComponent;
AudioListenerComponentSystem: new () => AudioListenerComponentSystem;
AudioSourceComponent: new(system: AudioSourceComponentSystem, entity: Entity) => AudioSourceComponent;
AudioSourceComponentSystem: new (app: Application, manager: SoundManager) => AudioSourceComponentSystem;
BasicMaterial: new() => BasicMaterial;
BoundingBox: new(center?: Vec3, halfExtents?: Vec3) => BoundingBox;
BoundingSphere: new(center?: Vec3, radius?: number) => BoundingSphere;
CameraComponent: new(system: CameraComponentSystem, entity: Entity) => CameraComponent;
CameraComponentSystem: new(app: Application) => CameraComponentSystem;
CollisionComponent: new(system: CollisionComponentSystem, entity: Entity) => CollisionComponent;
CollisionComponentSystem: new(app: Application) => CollisionComponentSystem;
Color: {
new(r?: number, g?: number, b?: number, a?: number): Color;
new(rgba: number[]): Color;
};
Component: new(system: ComponentSystem, entity: Entity) => Component;
ComponentSystem: new(app: Application) => ComponentSystem;
ComponentSystemRegistry: new() => ComponentSystemRegistry;
ContactPoint: new(localPoint: Vec3, localPointOther: Vec3, point: Vec3, pointOther: Vec3, normal: Vec3) => ContactPoint;
ContactResult: new(other: Entity, contacts: ContactPoint[]) => ContactResult;
Controller: new(element: Element, options?: { keyboard?: Keyboard, mouse?: Mouse, gamepads?: GamePads }) => Controller;
Curve: new(data: [number, number]) => Curve;
CurveSet: new(curveKeys: [number, number][]) => CurveSet;
ElementComponent: new(system: ElementComponentSystem, entity: Entity) => ElementComponent;
ElementComponentSystem: new(app: Application) => ElementComponentSystem;
ElementInput: new(domElement: DomElement) => ElementInput;
ElementInputEvent: new(event: DomMouseEvent | DomTouchEvent) => ElementInputEvent;
ElementMouseEvent: new(event: DomMouseEvent, element: ElementComponent, x: number, y: number, lastX: number, lastY: number) => ElementMouseEvent;
ElementTouchEvent: new(event: DomTouchEvent, element: ElementComponent, input: ElementInput) => ElementTouchEvent;
Entity: new(name?: string, app?: Application) => Entity;
Font: Font;
Frustum: Frustum;
GamePads: GamePads;
GraphicsDevice: GraphicsDevice;
GraphNode: new(name?: string) => GraphNode;
Http: Http;
IndexBuffer: IndexBuffer;
Keyboard: new(element?: Window | Element, options?: { preventDefault?: boolean, stopPropagation?: boolean }) => Keyboard;
KeyboardEvent: new(keyboard: Keyboard, event: DomKeyboardEvent) => KeyboardEvent;
LightComponent: LightComponent;
Lightmapper: Lightmapper;
Listener: Listener;
Mat3: Mat3;
Mat4: Mat4;
Material: Material;
Mesh: Mesh;
MeshInstance: MeshInstance;
Model: new() => Model;
ModelComponent: new(system: ModelComponentSystem, entity: Entity) => ModelComponent;
ModelComponentSystem: ModelComponentSystem;
ModelHandler: ModelHandler;
Mouse: {
isPointerLocked(): boolean;
new(element?: Window | Element): Mouse;
};
MouseEvent: new(mouse: Mouse, event: DomMouseEvent) => MouseEvent;
Node: new() => Node;
OrientedBox: OrientedBox;
ParticleSystemComponent: ParticleSystemComponent;
ParticleSystemComponentSystem: ParticleSystemComponentSystem;
Picker: Picker;
PostEffect: PostEffect;
PostEffectQueue: PostEffectQueue;
Quat: Quat;
Ray: Ray;
RaycastResult: RaycastResult;
RenderTarget: RenderTarget;
ResourceLoader: ResourceLoader;
RigidBodyComponent: RigidBodyComponent;
RigidBodyComponentSystem: RigidBodyComponentSystem;
Scene: new() => Scene;
ScreenComponent: ScreenComponent;
ScreenComponentSystem: ScreenComponentSystem;
ScriptAttributes: new(scriptType: ScriptType)=> ScriptAttributes;
ScriptComponent: ScriptComponent;
ScriptComponentSystem: ScriptComponentSystem;
ScriptHandler: ScriptHandler;
ScriptRegistry: ScriptRegistry;
Shader: Shader;
SingleContactResult: SingleContactResult;
Skeleton: Skeleton;
Skin: Skin;
SkinInstance: SkinInstance;
Sound: Sound;
SoundComponent: SoundComponent;
SoundComponentSystem: SoundComponentSystem;
SoundInstance: SoundInstance;
SoundInstance3d: SoundInstance3d;
SoundManager: SoundManager;
SoundSlot: SoundSlot;
StandardMaterial: StandardMaterial;
StencilParameters: StencilParameters;
Tags: Tags;
Texture: Texture;
Touch: Touch;
TouchDevice: TouchDevice;
TouchEvent: TouchEvent;
TransformFeedback: TransformFeedback;
Vec2: {
ONE: Vec2;
RIGHT: Vec2;
UP: Vec2;
ZERO: Vec2;
new(x: number, y: number): Vec2;
new(xy?: number[]): Vec2;
}
Vec3: {
BACK: Vec3;
DOWN: Vec3;
FORWARD: Vec3;
LEFT: Vec3;
ONE: Vec3;
RIGHT: Vec3;
UP: Vec3;
ZERO: Vec3;
new(x: number, y: number, z: number): Vec3;
new(xyz?: number[]): Vec3;
};
Vec4: {
ONE: Vec4;
ZERO: Vec4;
new(x: number, y: number, z: number, w: number): Vec4;
new(xyzw?: number[]): Vec4;
};
VertexBuffer: VertexBuffer;
VertexFormat: VertexFormat;
VertexIterator: VertexIterator;
VrDisplay: VrDisplay;
VrManager: VrManager;
ZoneComponent: ZoneComponent;
ZoneComponentSystem: new(app: Application) => ZoneComponentSystem;
}
const pc: pc;
}
export = PlayCanvas;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment