Skip to content

Commit 41aa5e3

Browse files
committed
Updated HemisphereLightHelper using new MeshFaceMaterial.
1 parent 6f8eec6 commit 41aa5e3

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

build/three.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32217,9 +32217,6 @@ THREE.HemisphereLightHelper = function ( light, sphereSize, arrowLength, domeSiz
3221732217
var bulbSkyMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false } );
3221832218
var bulbGroundMaterial = new THREE.MeshBasicMaterial( { color: hexColorGround, fog: false } );
3221932219

32220-
bulbGeometry.materials[ 0 ] = bulbSkyMaterial;
32221-
bulbGroundGeometry.materials[ 0 ] = bulbGroundMaterial;
32222-
3222332220
for ( var i = 0, il = bulbGeometry.faces.length; i < il; i ++ ) {
3222432221

3222532222
bulbGeometry.faces[ i ].materialIndex = 0;
@@ -32228,13 +32225,13 @@ THREE.HemisphereLightHelper = function ( light, sphereSize, arrowLength, domeSiz
3222832225

3222932226
for ( var i = 0, il = bulbGroundGeometry.faces.length; i < il; i ++ ) {
3223032227

32231-
bulbGroundGeometry.faces[ i ].materialIndex = 0;
32228+
bulbGroundGeometry.faces[ i ].materialIndex = 1;
3223232229

3223332230
}
3223432231

3223532232
THREE.GeometryUtils.merge( bulbGeometry, bulbGroundGeometry );
3223632233

32237-
this.lightSphere = new THREE.Mesh( bulbGeometry, new THREE.MeshFaceMaterial() );
32234+
this.lightSphere = new THREE.Mesh( bulbGeometry, new THREE.MeshFaceMaterial( [ bulbSkyMaterial, bulbGroundMaterial ] ) );
3223832235

3223932236
// arrows for sky and ground light directions
3224032237

@@ -32288,8 +32285,8 @@ THREE.HemisphereLightHelper.prototype.update = function () {
3228832285
this.groundColor.g *= intensity;
3228932286
this.groundColor.b *= intensity;
3229032287

32291-
this.lightSphere.geometry.materials[ 0 ].color.copy( this.color );
32292-
this.lightSphere.geometry.materials[ 1 ].color.copy( this.groundColor );
32288+
this.lightSphere.material.materials[ 0 ].color.copy( this.color );
32289+
this.lightSphere.material.materials[ 1 ].color.copy( this.groundColor );
3229332290

3229432291
this.lightArrow.setColor( this.color.getHex() );
3229532292
this.lightArrowGround.setColor( this.groundColor.getHex() );

build/three.min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/extras/helpers/HemisphereLightHelper.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ THREE.HemisphereLightHelper = function ( light, sphereSize, arrowLength, domeSiz
4646
var bulbSkyMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false } );
4747
var bulbGroundMaterial = new THREE.MeshBasicMaterial( { color: hexColorGround, fog: false } );
4848

49-
bulbGeometry.materials[ 0 ] = bulbSkyMaterial;
50-
bulbGroundGeometry.materials[ 0 ] = bulbGroundMaterial;
51-
5249
for ( var i = 0, il = bulbGeometry.faces.length; i < il; i ++ ) {
5350

5451
bulbGeometry.faces[ i ].materialIndex = 0;
@@ -57,13 +54,13 @@ THREE.HemisphereLightHelper = function ( light, sphereSize, arrowLength, domeSiz
5754

5855
for ( var i = 0, il = bulbGroundGeometry.faces.length; i < il; i ++ ) {
5956

60-
bulbGroundGeometry.faces[ i ].materialIndex = 0;
57+
bulbGroundGeometry.faces[ i ].materialIndex = 1;
6158

6259
}
6360

6461
THREE.GeometryUtils.merge( bulbGeometry, bulbGroundGeometry );
6562

66-
this.lightSphere = new THREE.Mesh( bulbGeometry, new THREE.MeshFaceMaterial() );
63+
this.lightSphere = new THREE.Mesh( bulbGeometry, new THREE.MeshFaceMaterial( [ bulbSkyMaterial, bulbGroundMaterial ] ) );
6764

6865
// arrows for sky and ground light directions
6966

@@ -117,8 +114,8 @@ THREE.HemisphereLightHelper.prototype.update = function () {
117114
this.groundColor.g *= intensity;
118115
this.groundColor.b *= intensity;
119116

120-
this.lightSphere.geometry.materials[ 0 ].color.copy( this.color );
121-
this.lightSphere.geometry.materials[ 1 ].color.copy( this.groundColor );
117+
this.lightSphere.material.materials[ 0 ].color.copy( this.color );
118+
this.lightSphere.material.materials[ 1 ].color.copy( this.groundColor );
122119

123120
this.lightArrow.setColor( this.color.getHex() );
124121
this.lightArrowGround.setColor( this.groundColor.getHex() );

0 commit comments

Comments
 (0)