David Catuhe 11 年之前
父节点
当前提交
be8fb360d1

+ 18 - 1
Babylon/Mesh/babylon.mesh.js

@@ -23,7 +23,8 @@ var BABYLON;
             // Members
             this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NONE;
             this.instances = new Array();
-            this._onBeforeRenderCallbacks = [];
+            this._onBeforeRenderCallbacks = new Array();
+            this._onAfterRenderCallbacks = new Array();
             this._visibleInstances = {};
             this._renderIdForInstances = new Array();
             this._batchCache = new _InstancesBatch();
@@ -269,6 +270,18 @@ var BABYLON;
             }
         };
 
+        Mesh.prototype.registerAfterRender = function (func) {
+            this._onAfterRenderCallbacks.push(func);
+        };
+
+        Mesh.prototype.unregisterAfterRender = function (func) {
+            var index = this._onAfterRenderCallbacks.indexOf(func);
+
+            if (index > -1) {
+                this._onAfterRenderCallbacks.splice(index, 1);
+            }
+        };
+
         Mesh.prototype._getInstancesRenderList = function (subMeshId) {
             var scene = this.getScene();
             this._batchCache.mustReturn = false;
@@ -418,6 +431,10 @@ var BABYLON;
 
             // Unbind
             effectiveMaterial.unbind();
+
+            for (callbackIndex = 0; callbackIndex < this._onAfterRenderCallbacks.length; callbackIndex++) {
+                this._onAfterRenderCallbacks[callbackIndex]();
+            }
         };
 
         Mesh.prototype.getEmittedParticleSystems = function () {

+ 18 - 1
Babylon/Mesh/babylon.mesh.ts

@@ -13,7 +13,8 @@
 
         // Private
         public _geometry: Geometry;
-        private _onBeforeRenderCallbacks = [];
+        private _onBeforeRenderCallbacks = new Array<()=> void >();
+        private _onAfterRenderCallbacks = new Array<() => void>();
         public _delayInfo; //ANY
         public _delayLoadingFunction: (any, Mesh) => void;
         public _visibleInstances: any = {};
@@ -273,6 +274,18 @@
             }
         }
 
+        public registerAfterRender(func: () => void): void {
+            this._onAfterRenderCallbacks.push(func);
+        }
+
+        public unregisterAfterRender(func: () => void): void {
+            var index = this._onAfterRenderCallbacks.indexOf(func);
+
+            if (index > -1) {
+                this._onAfterRenderCallbacks.splice(index, 1);
+            }
+        }
+
         public _getInstancesRenderList(subMeshId: number): _InstancesBatch {
             var scene = this.getScene();
             this._batchCache.mustReturn = false;
@@ -422,6 +435,10 @@
             }
             // Unbind
             effectiveMaterial.unbind();
+
+            for (callbackIndex = 0; callbackIndex < this._onAfterRenderCallbacks.length; callbackIndex++) {
+                this._onAfterRenderCallbacks[callbackIndex]();
+            }
         }
 
         public getEmittedParticleSystems(): ParticleSystem[] {

+ 1 - 1
Babylon/Physics/Plugins/babylon.oimoJSPlugin.js

@@ -1,4 +1,4 @@
-var BABYLON;
+var BABYLON;
 (function (BABYLON) {
     var OimoJSPlugin = (function () {
         function OimoJSPlugin() {

文件差异内容过多而无法显示
+ 0 - 28
babylon.1.13-beta-debug.js


文件差异内容过多而无法显示
+ 5 - 5
babylon.1.13-beta.js


+ 27 - 0
what's new.md

@@ -1,5 +1,32 @@
 Changes list
 ============
+- 1.13.0:
+ - **Major updates**
+ - TypeScript port finished ([davrous](http://www.github.com/davrous) & [deltakosh](http://www.github.com/deltakosh)) 
+ - Physics engine: new OIMO plugin ([temechon](http://www.github.com/temechon))
+ - new demo: [V8 engine](http://www.babylonjs.com/index.html?V8)
+ - **Updates**
+ - Fixed ray creation when the devicePixelRatio is not equals to 1 ([demonixis](http://www.github.com/demonixis))
+ - New ```mesh.registerAfterRender``` and ```mesh.unregisterAfterRender``` functions ([deltakosh](http://www.github.com/deltakosh)) 
+ - New ```fragmentElement``` parameter to define custom shader for ```BABYLON.ParticleSystem``` constructor ([deltakosh](http://www.github.com/deltakosh)) 
+ - New ```OnKeyDown``` and ```OnKeyUp``` triggers. See [actions wiki](https://github.com/BabylonJS/Babylon.js/wiki/How-to-use-Actions) for more info ([deltakosh](http://www.github.com/deltakosh)) 
+ - ArcRotateCamera can now check collisions [wiki](https://github.com/BabylonJS/Babylon.js/wiki/09-Cameras-collisions) ([deltakosh](http://www.github.com/deltakosh)) 
+ - New ```Engine.Version``` property which returns a string with the current version ([deltakosh](http://www.github.com/deltakosh)) 
+ - New "Export and Run" feature for Max2Babylon ([deltakosh](http://www.github.com/deltakosh)) 
+ - Animations delta time is now capped between Scene.MinDeltaTime and Scene.MaxDeltaTime ([deltakosh](http://www.github.com/deltakosh)) 
+ - Non-squared DDS are now supported ([deltakosh](http://www.github.com/deltakosh)) 
+ - New triggers: ```BABYLON.ActionManager.OnIntersectionEnterTrigger```, ```BABYLON.ActionManager.OnIntersectionExitTrigger```. [Documentation](https://github.com/BabylonJS/Babylon.js/wiki/How-to-use-Actions) updated ([deltakosh](http://www.github.com/deltakosh)) 
+ - New mesh type: ```BABYLON.LinesMesh```. You can find a [demo here](http://www.babylonjs.com/?LINES) ([deltakosh](http://www.github.com/deltakosh)) 
+ - New ```mesh.moveWithCollisions``` function. Used with ```mesh.ellipsoid``` and '''mesh.ellipsoidOffset```, this function can be used to move a mesh and use an ellipsoid around it to [check collisions](https://github.com/BabylonJS/Babylon.js/wiki/09-Collisions-by-gravity) ([deltakosh](http://www.github.com/deltakosh)) 
+ - New feature demo: [How to do drag'n'drop](http://www.babylonjs.com/playground/?18) ([deltakosh](http://www.github.com/deltakosh)) 
+ - New ```BABYLON.PickingInfo.getTextureCoordinates()``` function ([deltakosh](http://www.github.com/deltakosh)) 
+ - New ```BABYLON.Scene.cameraToUseForPointers``` property that defines this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position ([deltakosh](http://www.github.com/deltakosh)) 
+ - ```BABYLON.OculusOrientedCamera``` was replaced by ```BABYLON.OculusCamera``` for better integration into camera system ([deltakosh](http://www.github.com/deltakosh)) 
+ - New ```Mesh.CreateTiledGround()``` function ([kostar111](https://github.com/kostar111)) 
+ - Shadow Poisson Sampling ([clementlevasseur](https://github.com/clementlevasseur)) 
+ - **Bugfixes**
+ - Fixing a bug when instances are used with a mesh with submeshes.length > 1 ([deltakosh](http://www.github.com/deltakosh)) 
+ - CreateCylinder() : add subdivisions parameter and fix normals bug ([kostar111](https://github.com/kostar111)) 
 - 1.12.0:
  - **Major updates**
  - Babylon.js is now entirely developed using TypeScript ([deltakosh](http://www.github.com/deltakosh), [davrous](http://www.github.com/davrous))