Skip to content

Commit

Permalink
Merge pull request #6006 from sebavan/master
Browse files Browse the repository at this point in the history
4.0.0-alpha.32

Former-commit-id: 793c5ce22d7e0a749f637755d24d60a55a0fcb64
  • Loading branch information
sebavan authored Mar 6, 2019
2 parents be1671f + 25b84d1 commit 6bf0698
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 16 deletions.
64 changes: 54 additions & 10 deletions Playground/babylon.d.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19218,6 +19218,7 @@ declare module BABYLON {
getBodyPositionIterations?(impostor: PhysicsImpostor): number;
setBodyPositionIterations?(impostor: PhysicsImpostor, positionIterations: number): void;
appendAnchor?(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, width: number, height: number, influence: number, noCollisionBetweenLinkedBodies: boolean): void;
appendHook?(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, length: number, influence: number, noCollisionBetweenLinkedBodies: boolean): void;
sleepBody(impostor: PhysicsImpostor): void;
wakeUpBody(impostor: PhysicsImpostor): void;
raycast(from: Vector3, to: Vector3): PhysicsRaycastResult;
Expand Down Expand Up @@ -19386,6 +19387,14 @@ declare module BABYLON {
* The collision margin around a soft object
*/
damping?: number;
/**
* The path for a rope based on an extrusion
*/
path?: any;
/**
* The shape of an extrusion used for a rope based on an extrusion
*/
shape?: any;
}
/**
* Interface for a physics-enabled object
Expand Down Expand Up @@ -19524,6 +19533,7 @@ declare module BABYLON {
private _deltaPosition;
private _deltaRotation;
private _deltaRotationConjugated;
/** hidden */isFromLine: boolean;
private _parent;
private _isDisposed;
private static _tmpVecs;
Expand Down Expand Up @@ -19790,15 +19800,24 @@ declare module BABYLON {
*/
addJoint(otherImpostor: PhysicsImpostor, joint: PhysicsJoint): PhysicsImpostor;
/**
* Add an anchor to a soft impostor
* @param otherImpostor rigid impostor as the anchor
* Add an anchor to a cloth impostor
* @param otherImpostor rigid impostor to anchor to
* @param width ratio across width from 0 to 1
* @param height ratio up height from 0 to 1
* @param influence the elasticity between soft impostor and anchor from 0, very stretchy to 1, no strech
* @param noCollisionBetweenLinkedBodies when true collisions between soft impostor and anchor are ignored; default false
* @param influence the elasticity between cloth impostor and anchor from 0, very stretchy to 1, little strech
* @param noCollisionBetweenLinkedBodies when true collisions between cloth impostor and anchor are ignored; default false
* @returns impostor the soft imposter
*/
addAnchor(otherImpostor: PhysicsImpostor, width: number, height: number, influence: number, noCollisionBetweenLinkedBodies: boolean): PhysicsImpostor;
/**
* Add a hook to a rope impostor
* @param otherImpostor rigid impostor to anchor to
* @param length ratio across rope from 0 to 1
* @param influence the elasticity between rope impostor and anchor from 0, very stretchy to 1, little strech
* @param noCollisionBetweenLinkedBodies when true collisions between soft impostor and anchor are ignored; default false
* @returns impostor the rope imposter
*/
addHook(otherImpostor: PhysicsImpostor, length: number, influence: number, noCollisionBetweenLinkedBodies: boolean): PhysicsImpostor;
/**
* Will keep this body still, in a sleep mode.
* @returns the physics imposter
Expand Down Expand Up @@ -29299,6 +29318,7 @@ declare module BABYLON {
export function serializeAsColor4(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
export function serializeAsImageProcessingConfiguration(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
export function serializeAsQuaternion(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
export function serializeAsMatrix(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
/**
* Decorator used to define property that can be serialized as reference to a camera
* @param sourceName defines the name of the property to decorate
Expand Down Expand Up @@ -50085,10 +50105,20 @@ declare module BABYLON {
*/
executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
/**
* Update babylon mesh vertices vertices to match physics world object
* Update babylon mesh to match physics world object
* @param impostor imposter to match
*/
private _afterSoftStep;
/**
* Update babylon mesh vertices vertices to match physics world softbody or cloth
* @param impostor imposter to match
*/
afterSoftStep(impostor: PhysicsImpostor): void;
private _ropeStep;
/**
* Update babylon mesh vertices vertices to match physics world softbody or cloth
* @param impostor imposter to match
*/
private _softbodyOrClothStep;
private _tmpVector;
private _tmpMatrix;
/**
Expand Down Expand Up @@ -50143,6 +50173,11 @@ declare module BABYLON {
* @param impostor to create the softbody for
*/
private _createCloth;
/**
* Create rope for an impostor
* @param impostor to create the softbody for
*/
private _createRope;
private _addHullVerts;
private _createShape;
/**
Expand Down Expand Up @@ -50272,15 +50307,24 @@ declare module BABYLON {
*/
setBodyPositionIterations(impostor: PhysicsImpostor, positionIterations: number): void;
/**
* Append an anchor to a soft object
* @param impostor soft impostor to add anchor to
* @param otherImpostor rigid impostor as the anchor
* Append an anchor to a cloth object
* @param impostor is the cloth impostor to add anchor to
* @param otherImpostor is the rigid impostor to anchor to
* @param width ratio across width from 0 to 1
* @param height ratio up height from 0 to 1
* @param influence the elasticity between soft impostor and anchor from 0, very stretchy to 1, no strech
* @param influence the elasticity between cloth impostor and anchor from 0, very stretchy to 1, little strech
* @param noCollisionBetweenLinkedBodies when true collisions between soft impostor and anchor are ignored; default false
*/
appendAnchor(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, width: number, height: number, influence?: number, noCollisionBetweenLinkedBodies?: boolean): void;
/**
* Append an hook to a rope object
* @param impostor is the rope impostor to add hook to
* @param otherImpostor is the rigid impostor to hook to
* @param length ratio along the rope from 0 to 1
* @param influence the elasticity between soft impostor and anchor from 0, very stretchy to 1, little strech
* @param noCollisionBetweenLinkedBodies when true collisions between soft impostor and anchor are ignored; default false
*/
appendHook(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, length: number, influence?: number, noCollisionBetweenLinkedBodies?: boolean): void;
/**
* Sleeps the physics body and stops it from being active
* @param impostor impostor to sleep
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],
"name": "babylonjs",
"description": "Babylon.js is a JavaScript 3D engine based on webgl.",
"version": "4.0.0-alpha.31",
"version": "4.0.0-alpha.32",
"repository": {
"type": "git",
"url": "https://github.com/BabylonJS/Babylon.js.git"
Expand Down
4 changes: 2 additions & 2 deletions src/Engines/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,14 +495,14 @@ export class Engine {
*/
// Not mixed with Version for tooling purpose.
public static get NpmPackage(): string {
return "babylonjs@4.0.0-alpha.31";
return "babylonjs@4.0.0-alpha.32";
}

/**
* Returns the current version of the framework
*/
public static get Version(): string {
return "4.0.0-alpha.31";
return "4.0.0-alpha.32";
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Materials/Textures/cubeTexture.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { serialize, SerializationHelper } from "../../Misc/decorators";
import { serialize, serializeAsMatrix, SerializationHelper } from "../../Misc/decorators";
import { Tools } from "../../Misc/tools";
import { Nullable } from "../../types";
import { Scene } from "../../scene";
Expand Down Expand Up @@ -82,7 +82,7 @@ export class CubeTexture extends BaseTexture {
private _files: string[];
private _extensions: string[];

@serialize("textureMatrix")
@serializeAsMatrix("textureMatrix")
private _textureMatrix: Matrix;

private _format: number;
Expand Down
11 changes: 10 additions & 1 deletion src/Misc/decorators.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Tags } from "../Misc/tags";
import { Nullable } from "../types";
import { Color4, Quaternion, Color3, Vector2, Vector3 } from "../Maths/math";
import { Color4, Quaternion, Color3, Vector2, Vector3, Matrix } from "../Maths/math";
import { _DevTools } from './devTools';

declare type Scene = import("../scene").Scene;
Expand Down Expand Up @@ -47,6 +47,7 @@ var _copySource = function <T>(creationFunction: () => T, source: T, instanciate
case 5: // Vector3
case 7: // Color Curves
case 10: // Quaternion
case 12: // Matrix
(<any>destination)[property] = instanciate ? sourceProperty : sourceProperty.clone();
break;
}
Expand Down Expand Up @@ -196,6 +197,10 @@ export function serializeAsQuaternion(sourceName?: string) {
return generateSerializableMember(10, sourceName); // quaternion member
}

export function serializeAsMatrix(sourceName?: string) {
return generateSerializableMember(12, sourceName); // matrix member
}

/**
* Decorator used to define property that can be serialized as reference to a camera
* @param sourceName defines the name of the property to decorate
Expand Down Expand Up @@ -306,6 +311,8 @@ export class SerializationHelper {
break;
case 11: // Camera reference
serializationObject[targetPropertyName] = (<Camera>sourceProperty).id;
case 12: // Matrix
serializationObject[targetPropertyName] = (<Matrix>sourceProperty).asArray();
break;
}
}
Expand Down Expand Up @@ -386,6 +393,8 @@ export class SerializationHelper {
if (scene) {
dest[property] = scene.getCameraByID(sourceProperty);
}
case 12: // Matrix
dest[property] = Matrix.FromArray(sourceProperty);
break;
}
}
Expand Down

0 comments on commit 6bf0698

Please sign in to comment.