@@ -45,37 +45,30 @@ RectAreaLightHelper.prototype.dispose = function () {
45
45
46
46
RectAreaLightHelper . prototype . update = function ( ) {
47
47
48
- var vector1 = new Vector3 ( ) ;
49
- var vector2 = new Vector3 ( ) ;
48
+ var line = this . children [ 0 ] ;
50
49
51
- return function update ( ) {
50
+ // update material
52
51
53
- var line = this . children [ 0 ] ;
52
+ line . material . color . copy ( this . light . color ) ;
54
53
55
- // update material
54
+ // calculate new dimensions of the helper
56
55
57
- line . material . color . copy ( this . light . color ) ;
56
+ var hx = this . light . width * 0.5 ;
57
+ var hy = this . light . height * 0.5 ;
58
58
59
- // calculate new dimensions of the helper
59
+ var position = line . geometry . attributes . position ;
60
+ var array = position . array ;
60
61
61
- var hx = this . light . width * 0.5 ;
62
- var hy = this . light . height * 0.5 ;
62
+ // update vertices
63
63
64
- var position = line . geometry . attributes . position ;
65
- var array = position . array ;
64
+ array [ 0 ] = hx ; array [ 1 ] = - hy ; array [ 2 ] = 0 ;
65
+ array [ 3 ] = hx ; array [ 4 ] = hy ; array [ 5 ] = 0 ;
66
+ array [ 6 ] = - hx ; array [ 7 ] = hy ; array [ 8 ] = 0 ;
67
+ array [ 9 ] = - hx ; array [ 10 ] = - hy ; array [ 11 ] = 0 ;
68
+ array [ 12 ] = hx ; array [ 13 ] = - hy ; array [ 14 ] = 0 ;
66
69
67
- // update vertices
70
+ position . needsUpdate = true ;
68
71
69
- array [ 0 ] = hx ; array [ 1 ] = - hy ; array [ 2 ] = 0 ;
70
- array [ 3 ] = hx ; array [ 4 ] = hy ; array [ 5 ] = 0 ;
71
- array [ 6 ] = - hx ; array [ 7 ] = hy ; array [ 8 ] = 0 ;
72
- array [ 9 ] = - hx ; array [ 10 ] = - hy ; array [ 11 ] = 0 ;
73
- array [ 12 ] = hx ; array [ 13 ] = - hy ; array [ 14 ] = 0 ;
74
-
75
- position . needsUpdate = true ;
76
-
77
- } ;
78
-
79
- } ( ) ;
72
+ } ;
80
73
81
74
export { RectAreaLightHelper } ;
0 commit comments