Skip to content

Commit 043a5c8

Browse files
committed
Improved LDrawLoader example.
1 parent 931cbbc commit 043a5c8

File tree

1 file changed

+20
-24
lines changed

1 file changed

+20
-24
lines changed

examples/webgl_loader_ldraw.html

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,23 @@
88
body {
99
font-family: Monospace;
1010
background-color: #000;
11-
color: #fff;
1211
margin: 0px;
1312
overflow: hidden;
1413
}
1514
#info {
16-
color: #fff;
15+
color: #888;
1716
position: absolute;
1817
top: 10px;
1918
width: 100%;
2019
text-align: center;
21-
z-index: 100;
2220
display:block;
2321
}
24-
#info a, .button { color: #f00; font-weight: bold; text-decoration: underline; cursor: pointer }
22+
#info a {
23+
color: #f00;
24+
font-weight: bold;
25+
text-decoration: underline;
26+
cursor: pointer
27+
}
2528
</style>
2629
</head>
2730

@@ -41,7 +44,7 @@
4144

4245
var container, stats, progressBar, progressBarDiv;
4346

44-
var camera, scene, renderer, pointLight, controls, gui, guiData;
47+
var camera, scene, renderer, controls, gui, guiData;
4548

4649
var modelFileList, model, textureCube;
4750

@@ -83,13 +86,14 @@
8386
// scene
8487

8588
scene = new THREE.Scene();
89+
scene.background = new THREE.Color( 0xdeebed );
8690

87-
var ambientLight = new THREE.AmbientLight( 0xcccccc, 0.4 );
91+
var ambientLight = new THREE.AmbientLight( 0xdeebed, 0.4 );
8892
scene.add( ambientLight );
8993

90-
pointLight = new THREE.PointLight( 0xffffff, 1 );
91-
pointLight.position.set( -1000, 1200, 1500 );
92-
scene.add( pointLight );
94+
var directionalLight = new THREE.DirectionalLight( 0xffffff, 1 );
95+
directionalLight.position.set( -1000, 1200, 1500 );
96+
scene.add( directionalLight );
9397

9498
//
9599

@@ -107,39 +111,33 @@
107111
envMapActivated: false
108112
};
109113

110-
gui = new dat.GUI( { width: 350 } );
111-
112-
var modelFolder = gui.addFolder( "Model" );
114+
gui = new dat.GUI();
113115

114-
modelFolder.add( guiData, 'modelFileName', modelFileList ).name( 'Model' ).onFinishChange( function () {
116+
gui.add( guiData, 'modelFileName', modelFileList ).name( 'Model' ).onFinishChange( function () {
115117

116118
reloadObject( true );
117119

118120
} );
119121

120-
modelFolder.open();
121-
122-
var graphicsFolder = gui.addFolder( "Graphics" );
123-
124-
graphicsFolder.add( guiData , 'envMapActivated' ).name( 'Env. map' ).onChange( function ( value ) {
122+
gui.add( guiData , 'envMapActivated' ).name( 'Env. map' ).onChange( function ( value ) {
125123

126124
envMapActivated = value;
127125

128126
reloadObject( false );
129127

130128
} );
131129

132-
graphicsFolder.open();
133-
134130
window.addEventListener( 'resize', onWindowResize, false );
135131

136132
progressBarDiv = document.createElement( 'div' );
137133
progressBarDiv.innerText = "Loading...";
138134
progressBarDiv.style.fontSize = "3em";
135+
progressBarDiv.style.color = "#888";
139136
progressBarDiv.style.display = "block";
140137
progressBarDiv.style.position = "absolute";
141138
progressBarDiv.style.top = "50%";
142-
progressBarDiv.style.left = "50%";
139+
progressBarDiv.style.width = "100%";
140+
progressBarDiv.style.textAlign = "center";
143141

144142

145143
// load materials and then the model
@@ -226,8 +224,6 @@
226224

227225
}
228226

229-
pointLight.position.normalize().multiplyScalar( radius * 3 );
230-
231227
hideProgressBar();
232228

233229
}, onProgress, onError );
@@ -299,7 +295,7 @@
299295
</script>
300296

301297
<!-- LDraw.org CC BY 2.0 Parts Library attribution -->
302-
<div style="display: block; position: absolute; bottom: 0px; right: 0px; width: 160px; padding: 2px; border: #838A92 1px solid; background-color: #F3F7F8;">
298+
<div style="display: block; position: absolute; bottom: 8px; right: 8px; width: 160px; padding: 10px; background-color: #F3F7F8;">
303299
<center>
304300
<a href="http://www.ldraw.org"><img style="width: 145px" src="files/ldraw_org_logo/Stamp145.png"></a>
305301
<br />

0 commit comments

Comments
 (0)