提交 5964f03e 编写于 作者: J Jason Johnston

Move the default onBeforeRender/onAfterRender empty functions from each...

Move the default onBeforeRender/onAfterRender empty functions from each instance to the prototype, for constructor speed and retained memory improvement.

Measurements for 100K objects:
- constructor exec time: 1620ms -> 1500ms
- onBeforeRender/onAfterRender call time: 4.5ms -> 1.1ms
- retained size: 133MB -> 121MB
上级 d3decdea
......@@ -92,10 +92,6 @@ function Object3D() {
this.renderOrder = 0;
this.userData = {};
this.onBeforeRender = function () {};
this.onAfterRender = function () {};
}
Object3D.DefaultUp = new Vector3( 0, 1, 0 );
......@@ -105,6 +101,9 @@ Object.assign( Object3D.prototype, EventDispatcher.prototype, {
isObject3D: true,
onBeforeRender: function () {},
onAfterRender: function () {},
applyMatrix: function ( matrix ) {
this.matrix.multiplyMatrices( matrix, this.matrix );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册