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

Editor: More userData dependency clean up.

上级 4dbb482f
......@@ -160,7 +160,7 @@ Menubar.Add = function ( signals ) {
} );
options.add( option );
// add torus
// add torus knot
var option = new UI.Panel();
option.setClass( 'option' );
......@@ -224,9 +224,7 @@ Menubar.Add = function ( signals ) {
var light = new THREE.SpotLight( color, intensity, distance, angle, exponent );
light.name = 'SpotLight ' + light.id;
light.target.name = 'SpotLight ' + light.id + ' target';
light.target.userData.targetInverse = light;
light.target.name = 'SpotLight ' + light.id + ' Target';
light.position.set( 0, 1, 0 ).multiplyScalar( 200 );
......@@ -247,9 +245,7 @@ Menubar.Add = function ( signals ) {
var light = new THREE.DirectionalLight( color, intensity );
light.name = 'DirectionalLight ' + light.id;
light.target.name = 'DirectionalLight ' + light.id + ' target';
light.target.userData.targetInverse = light;
light.target.name = 'DirectionalLight ' + light.id + ' Target';
light.position.set( 1, 1, 1 ).multiplyScalar( 200 );
......
......@@ -361,7 +361,7 @@ var Viewport = function ( signals ) {
var helper = objectsToHelpers[ selected.id ];
objects.splice( objects.indexOf( helper ), 1 );
objects.splice( objects.indexOf( helper.lightSphere ), 1 );
helper.parent.remove( helper );
selected.parent.remove( selected );
......@@ -371,6 +371,13 @@ var Viewport = function ( signals ) {
updateMaterials( scene );
if ( selected instanceof THREE.DirectionalLight ||
selected instanceof THREE.SpotLight ) {
selected.target.parent.remove( selected.target );
}
} else {
selected.traverse( function ( object ) {
......@@ -389,6 +396,7 @@ var Viewport = function ( signals ) {
}
signals.sceneChanged.dispatch( scene );
signals.objectSelected.dispatch( null );
} );
......
......@@ -20,8 +20,8 @@ THREE.DirectionalLightHelper = function ( light, sphereSize ) {
this.add( this.lightSphere );
var lineGeometry = new THREE.Geometry();
lineGeometry.vertices.push( this.light.position.clone() );
lineGeometry.vertices.push( new THREE.Vector3() );
lineGeometry.vertices.push( this.light.position );
lineGeometry.vertices.push( this.light.target.position );
lineGeometry.computeLineDistances();
var lineMaterial = new THREE.LineDashedMaterial( { dashSize: 4, gapSize: 4, opacity: 0.75, transparent: true, fog: false } );
......@@ -52,7 +52,6 @@ THREE.DirectionalLightHelper.prototype.update = function () {
this.lightSphere.position.copy( this.light.position );
this.lightSphere.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
this.targetLine.geometry.vertices[ 0 ].copy( this.light.position );
this.targetLine.geometry.computeLineDistances();
this.targetLine.geometry.verticesNeedUpdate = true;
this.targetLine.material.color.copy( this.lightSphere.material.color );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册