Skip to content

Commit

Permalink
Merge pull request #77 from jroblak/typescriptUpdate
Browse files Browse the repository at this point in the history
Typescript update

Former-commit-id: ac23727
  • Loading branch information
deltakosh committed Oct 9, 2013
2 parents f0fb9c7 + a4429ba commit ce3f1bb
Show file tree
Hide file tree
Showing 51 changed files with 1,712 additions and 584 deletions.
19 changes: 19 additions & 0 deletions Typescript/Animations/babylon.animatable.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/// <reference path="../babylon.d.ts" />

declare module BABYLON {
class _Animatable {
target: Object;
fromFrame: number;
toFrame: number;
loopAnimation: boolean;
animationStartDate: Date;
speedRatio: number;
onAnimationEnd: Function;

constructor(target: Object, from: number, to: number, loop: boolean, speedRatio: number, onAnimationEnd: Function);

animationStarted: boolean;

_animate(delay: number): boolean;
}
}
19 changes: 5 additions & 14 deletions Typescript/Animations/babylon.animation.d.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,28 @@
/// <reference path="../babylon.d.ts" />

declare module BABYLON {
class _Animatable {
target: Object;
fromFrame: number;
toFrame: number;
loopAnimation: bool;
animationStartDate: Date;
speedRatio: number;

constructor(target: Object, from: number, to: number, loop: bool, speedRatio?: number);

_animate(): bool;
}

class Animation {
name: string;
targetProperty: string;
targetPropertyPath: string[];
framePerSecond: number;
dataType: string;
loopMode: number;
_keys: number[];
_offsetCache: Object;
_highLimitsCache: Object;

constructor(name: string, targetProperty: string, framePerSecond: number, dataType: string, loopMode: number);

clone(): Animation;
setKeys(values: number[]);
_interpolate(currentFrame: number, repeatCount: number, loopMode: number, offsetValue: number, highLimitValue: number);
animate(target: Object, delay: number, from: number, to: number, loop: bool, speedRatio: number): bool;
animate(target: Object, delay: number, from: number, to: number, loop: boolean, speedRatio: number): boolean;

static ANIMATIONTYPE_FLOAT: number;
static ANIMATIONTYPE_VECTOR3: number;
static ANIMATIONTYPE_QUATERNION: number;
static ANIMATIONTYPE_MATRIX: number;

static ANIMATIONLOOPMODE_RELATIVE: number;
static ANIMATIONLOOPMODE_CYCLE: number;
Expand Down
24 changes: 24 additions & 0 deletions Typescript/Bones/babylon.bone.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/// <reference path="../babylon.d.ts" />

declare module BABYLON {
class Bone {
name: string;
_skeleton: Skeleton;
_matrix: Matrix;
_baseMatrix: Matrix;
_worldTransform: Matrix;
_absoluteTransform: Matrix;
_invertedAbsoluteTransform: Matrix;
children: Bone[];
animation: Animation[];

constructor(name: string, skeleton: Skeleton, parentBone: Bone, matrix: Matrix);

getParent(): Bone;
getLocalMatrix: Matrix;
getAbsoluteMatrix: Matrix;
_updateDifferenceMatrix(): void ;
updateMatrix(matrix: Matrix): void;
markAsDirty(): void;
}
}
18 changes: 18 additions & 0 deletions Typescript/Bones/babylon.skeleton.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/// <reference path="../babylon.d.ts" />

declare module BABYLON {
class Skeleton {
id: number;
name: string;
bones: Bone[];
_scene: Scene;
_isDirty: boolean;

constructor(name: string, id: number, scene: Scene);

getTransformMatrices(): Matrix[];
prepare(): void;
getAnimatables(): Animation[];
clone(name: string, id: number): Skeleton;
}
}
29 changes: 29 additions & 0 deletions Typescript/Cameras/babylon.arcRotateCamera.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/// <reference path="../babylon.d.ts" />

declare module BABYLON {
class ArcRotateCamera extends Camera {
alpha: number;
beta: number;
radius: number;
target: Vector3;

_keys: number[];
keysUp: number[];
keysDown: number[];
keysLeft: number[];
keysRight: number[];
_viewMatrix: Matrix;

constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene);

inertialAlphaOffset: number;
interialBetaOffset: number;
lowerAlphaLimit: number;
upperAlphaLimit: number;
lowerBetaLimit: number;
upperBetaLimit: number;
lowerRadiusLimit: number;
upperRadiusLimit: number;
setPosition(position: Vector3): void;
}
}
56 changes: 8 additions & 48 deletions Typescript/Cameras/babylon.camera.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,63 +9,23 @@ declare module BABYLON {

constructor(name: string, position: Vector3, scene: Scene);

static PERSPECTIVE_CAMERA: number;
static ORTHOGRAPHIC_CAMERA: number;

fov: number;
orthoLeft: number;
orthoRight: number;
orthoBottom: number;
orthoTop: number;
minZ: number;
maxZ: number;
intertia: number;
mode: number;

attachControl(canvas: HTMLCanvasElement): void;
detachControl(canvas: HTMLCanvasElement): void;
_update();
getViewMatrix(): Matrix;
getProjectionMatrix(): Matrix;
}

class FreeCamera extends Camera {
cameraDirection: Vector3;
cameraRotation: Vector2;
rotation: Vector3;
ellipsoid: Vector3;
_keys: number[];
keysUp: number[];
keysDown: number[];
keysLeft: number[];
keysRight: number[];
_collider: Collider;
_needsMoveForGravity: bool;
animations: Animation[];

constructor(name: string, position: Vector3, scene: Scene);

speed: number;
checkCollisions: bool;
applyGravity: bool;

_computeLocalCameraSpeed(): number;
setTarget(target: Vector3): void;
_collideWithWorld(velocity: Vector3): void;
_checkInputs();
}

class TouchCamera extends FreeCamera {
_offsetX: number;
_offsetY: number;
_pointerCount: number;
_pointerPressed: number[];

constructor(name: string, position: Vector3, scene: Scene);
}

class ArcRotateCamera extends Camera {
alpha: number;
beta: number;
radius: number;
target: Vector3;

constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene);

inertialAlphaOffset: number;
interialBetaOffset: number;
setPosition(position: Vector3): void;
}
}
17 changes: 17 additions & 0 deletions Typescript/Cameras/babylon.deviceOrientationCamera.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/// <reference path="../babylon.d.ts" />

declare module BABYLON {
class DeviceOrientationCamera extends FreeCamera {
angularSensibility: number;
moveSensibility: number;

constructor(name: string, position: Vector3, scene: Scene);

_offsetX: number;
_offsetY: number;
_orientationGamma: number;
_orientationBeta: number;
_initialOrientationGamma: number;
_initialOrientationBeta: number;
}
}
29 changes: 29 additions & 0 deletions Typescript/Cameras/babylon.freeCamera.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/// <reference path="../babylon.d.ts" />

declare module BABYLON {
class FreeCamera extends Camera {
cameraDirection: Vector3;
cameraRotation: Vector2;
rotation: Vector3;
ellipsoid: Vector3;
_keys: number[];
keysUp: number[];
keysDown: number[];
keysLeft: number[];
keysRight: number[];
_collider: Collider;
_needsMoveForGravity: boolean;
animations: Animation[];

constructor(name: string, position: Vector3, scene: Scene);

speed: number;
checkCollisions: boolean;
applyGravity: boolean;

_computeLocalCameraSpeed(): number;
setTarget(target: Vector3): void;
_collideWithWorld(velocity: Vector3): void;
_checkInputs();
}
}
14 changes: 14 additions & 0 deletions Typescript/Cameras/babylon.touchCamera.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/// <reference path="../babylon.d.ts" />

declare module BABYLON {
class TouchCamera extends FreeCamera {
_offsetX: number;
_offsetY: number;
_pointerCount: number;
_pointerPressed: number[];
angularSensibility: number;
moveSensibility: number;

constructor(name: string, position: Vector3, scene: Scene);
}
}
22 changes: 8 additions & 14 deletions Typescript/Collisions/babylon.collider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,19 @@ declare module BABYLON {
radius: Vector3;
retry: number;

basePointWorld: Vector3;
velocityWorld: Vector3;
normalizedVelocity: Vector3;

constructor();

_initialize(source: Vector3, dir: Vector3, e: number): void;
_canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): bool;
_checkPontInTriangle(point: Vector3, pa: Vector3, pb: Vector3, pc: Vector3, n: Vector3): boolean;
intersectBoxAASphere(boxMin: Vector3, boxMax: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean;
getLowestRoot(a: number, b: number, c: number, maxR: number): Object;
_canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean;
_testTriangle(subMesh: SubMesh, p1: Vector3, p2: Vector3, p3: Vector3): void;
_collide(subMesh: SubMesh, pts: VertexBuffer, indices: IndexBuffer, indexStart: number, indexEnd: number, decal: number);
_getResponse(pos: Vector3, vel: Vector3): CollisionResponse;
}

class CollisionPlane {
normal: Vector3;
origin: Vector3;
equation: number[];

constructor(origin: Vector3, normal: Vector3);

isFrontFactingTo(direction: Vector3, epsilon: number): bool;
signedDistanceTo(point: Vector3): number;

static CreateFromPoints(p1: Vector3, p2: Vector3, p3: Vector3): CollisionPlane;
}
}
16 changes: 16 additions & 0 deletions Typescript/Collisions/babylon.collisionPlane.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference path="../babylon.d.ts" />

declare module BABYLON {
class CollisionPlane {
normal: Vector3;
origin: Vector3;
equation: number[];

constructor(origin: Vector3, normal: Vector3);

isFrontFactingTo(direction: Vector3, epsilon: number): boolean;
signedDistanceTo(point: Vector3): number;

static CreateFromPoints(p1: Vector3, p2: Vector3, p3: Vector3): CollisionPlane;
}
}
17 changes: 17 additions & 0 deletions Typescript/Culling/Octrees/babylon.octree.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/// <reference path="../../babylon.d.ts" />

declare module BABYLON {
class Octree {
blocks: OctreeBlock[];
_maxBlockCapacity: number;
_selection: Tools.SmartArray;

constructor(maxBlockCapacity: number);

update(worldMin: Vector3, worldMax: Vector3, meshes: Mesh[]): void;
addMesh(mesh: Mesh): void;
select(frustrumPlanes: Plane[]): void;

static _CreateBlocks(worldMin: Vector3, worldMax: Vector3, meshes: Mesh[], maxBlockCapacity: number, target: OctreeBlock): void;
}
}
18 changes: 18 additions & 0 deletions Typescript/Culling/Octrees/babylon.octreeBlock.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/// <reference path="../../babylon.d.ts" />

declare module BABYLON {
class OctreeBlock {
subMeshes: Mesh[];
meshes: Mesh[];
_capacity: number;
_minPoint: Vector3;
_maxPoint: Vector3;
_boundingVector: Vector3[];

constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number)

addMesh(mesh: Mesh): void;
addEntries(meshes: Mesh[]): void;
select(frustrumPlanes: Plane[], selection: Tools.SmartArray): void;
}
}
Loading

0 comments on commit ce3f1bb

Please sign in to comment.