提交 e62a722e 编写于 作者: M Mr.doob

Helpers: Replaced onBeforeRender usage with updateMatrixWorld. See #11638

上级 da94a7e9
......@@ -7,6 +7,7 @@ import { LineBasicMaterial } from '../materials/LineBasicMaterial';
import { BufferAttribute } from '../core/BufferAttribute';
import { Float32BufferAttribute } from '../core/BufferAttribute';
import { BufferGeometry } from '../core/BufferGeometry';
import { Object3D } from '../core/Object3D';
function Box3Helper( box, hex ) {
......@@ -30,14 +31,12 @@ function Box3Helper( box, hex ) {
this.geometry.computeBoundingSphere();
this.onBeforeRender();
}
Box3Helper.prototype = Object.create( LineSegments.prototype );
Box3Helper.prototype.constructor = Box3Helper;
Box3Helper.prototype.onBeforeRender = function () {
Box3Helper.prototype.updateMatrixWorld = function ( force ) {
var box = this.box;
......@@ -49,6 +48,8 @@ Box3Helper.prototype.onBeforeRender = function () {
this.scale.multiplyScalar( 0.5 );
Object3D.prototype.updateMatrixWorld.call( this, force );
};
export { Box3Helper };
......@@ -8,6 +8,7 @@ import { LineBasicMaterial } from '../materials/LineBasicMaterial';
import { MeshBasicMaterial } from '../materials/MeshBasicMaterial';
import { Float32BufferAttribute } from '../core/BufferAttribute';
import { BufferGeometry } from '../core/BufferGeometry';
import { Object3D } from '../core/Object3D';
function PlaneHelper( plane, size, hex ) {
......@@ -37,16 +38,12 @@ function PlaneHelper( plane, size, hex ) {
this.add( new Mesh( geometry2, new MeshBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false } ) ) );
//
this.onBeforeRender();
}
PlaneHelper.prototype = Object.create( Line.prototype );
PlaneHelper.prototype.constructor = PlaneHelper;
PlaneHelper.prototype.onBeforeRender = function () {
PlaneHelper.prototype.updateMatrixWorld = function ( force ) {
var scale = - this.plane.constant;
......@@ -56,7 +53,7 @@ PlaneHelper.prototype.onBeforeRender = function () {
this.lookAt( this.plane.normal );
this.updateMatrixWorld();
Object3D.prototype.updateMatrixWorld.call( this, force );
};
......
......@@ -14,6 +14,7 @@ import { Color } from '../math/Color';
import { Vector3 } from '../math/Vector3';
import { BufferGeometry } from '../core/BufferGeometry';
import { Float32BufferAttribute } from '../core/BufferAttribute';
import { Object3D } from '../core/Object3D';
function getBoneList( object ) {
......@@ -75,21 +76,19 @@ function SkeletonHelper( object ) {
this.matrix = object.matrixWorld;
this.matrixAutoUpdate = false;
this.onBeforeRender();
}
SkeletonHelper.prototype = Object.create( LineSegments.prototype );
SkeletonHelper.prototype.constructor = SkeletonHelper;
SkeletonHelper.prototype.onBeforeRender = function () {
SkeletonHelper.prototype.updateMatrixWorld = function () {
var vector = new Vector3();
var boneMatrix = new Matrix4();
var matrixWorldInv = new Matrix4();
return function onBeforeRender() {
return function updateMatrixWorld( force ) {
var bones = this.bones;
......@@ -120,6 +119,8 @@ SkeletonHelper.prototype.onBeforeRender = function () {
geometry.getAttribute( 'position' ).needsUpdate = true;
Object3D.prototype.updateMatrixWorld.call( this, force );
};
}();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册