@@ -23,13 +23,19 @@ var gltf = null;
23
23
var mixer = null ;
24
24
var clock = new THREE . Clock ( ) ;
25
25
var axis ;
26
+ var hemispheric ;
26
27
var gui ;
28
+
27
29
var ROTATE = true ;
28
30
var AXIS = true ;
31
+ var LIGHTS = true ;
32
+ var SKYBOX = true ;
33
+
29
34
var scene ;
30
35
var camera ;
31
36
var renderer ;
32
37
var controls ;
38
+ var envMap ;
33
39
34
40
init ( ) ;
35
41
animate ( ) ;
@@ -48,7 +54,7 @@ function resize() {
48
54
function init ( ) {
49
55
scene = new THREE . Scene ( ) ;
50
56
51
- var hemispheric = new THREE . HemisphereLight ( 0xffffff , 0x222222 , 1.2 ) ;
57
+ hemispheric = new THREE . HemisphereLight ( 0xffffff , 0x222222 , 1.2 ) ;
52
58
scene . add ( hemispheric ) ;
53
59
/*
54
60
var ambient = new THREE.AmbientLight( 0xffffff, 0.3 );
@@ -104,7 +110,7 @@ function init() {
104
110
}
105
111
}
106
112
107
- var envMap = getEnvMap ( ) ;
113
+ envMap = getEnvMap ( ) ;
108
114
object . traverse ( function ( node ) {
109
115
if ( node . isMesh ) {
110
116
var materials = Array . isArray ( node . material ) ? node . material : [ node . material ] ;
@@ -143,13 +149,21 @@ function init() {
143
149
gui = new dat . GUI ( ) ;
144
150
var guiRotate = gui . add ( window , 'ROTATE' ) . name ( 'Rotate' ) ;
145
151
var guiAxis = gui . add ( window , 'AXIS' ) . name ( 'Axis' ) ;
152
+ var guiLights = gui . add ( window , 'LIGHTS' ) . name ( 'Lights' ) ;
153
+ var guiSkybox = gui . add ( window , 'SKYBOX' ) . name ( 'IBL' ) ;
146
154
147
155
guiRotate . onChange ( function ( value ) {
148
156
controls . autoRotate = value ;
149
157
} ) ;
150
158
guiAxis . onChange ( function ( value ) {
151
159
axis . visible = value ;
152
160
} ) ;
161
+ guiLights . onChange ( function ( value ) {
162
+ hemispheric . visible = value ;
163
+ } ) ;
164
+ guiSkybox . onChange ( function ( value ) {
165
+ scene . background = value ? envMap : null ;
166
+ } ) ;
153
167
154
168
document . body . appendChild ( renderer . domElement ) ;
155
169
0 commit comments