Skip to content

Commit

Permalink
Add lights to duck example for good measure.
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy committed Jun 10, 2017
1 parent 17a7749 commit cace414
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/js/loaders/GLTF2Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,7 @@ THREE.GLTF2Loader = ( function () {
var light = lights[ lightId ];
var lightNode;

var lightParams = light[ light.type ];
var color = new THREE.Color().fromArray( lightParams.color );
var color = new THREE.Color().fromArray( light.color );

switch ( light.type ) {

Expand All @@ -337,6 +336,7 @@ THREE.GLTF2Loader = ( function () {

if ( lightNode ) {

lightNode.name = light.name || ( 'light_' + lightId );
this.lights[ lightId ] = lightNode;

}
Expand Down
85 changes: 80 additions & 5 deletions examples/models/gltf/Duck/glTF-MaterialsCommon/Duck.gltf
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,47 @@
"type" : "perspective"
}
],
"extensions" : {
"KHR_lights" : {
"lights" : [
{
"color" : [
1.0,
1.0,
1.0
],
"name" : "directionalLightShape1",
"type" : "directional"
},
{
"color" : [
1.0,
1.0,
1.0
],
"name" : "Lamp",
"quadraticAttenuation" : 0.03333335240683057,
"type" : "point"
},
{
"color" : [
0.0,
0.0,
0.0
],
"name" : "Ambient_Scene",
"type" : "ambient"
}
]
}
},
"extensionsRequired" : [
"KHR_materials_common"
"KHR_materials_common",
"KHR_lights"
],
"extensionsUsed" : [
"KHR_materials_common"
"KHR_materials_common",
"KHR_lights"
],
"images" : [
{
Expand Down Expand Up @@ -266,6 +302,23 @@
]
},
{
"extensions" : {
"KHR_lights" : {
"light" : 0
}
},
"name" : "Correction_directionalLight1",
"rotation" : [
-0.7071067690849304,
-0.0,
0.0,
0.7071067690849304
]
},
{
"children" : [
4
],
"name" : "directionalLight1",
"rotation" : [
0.14142043888568878,
Expand All @@ -285,6 +338,23 @@
]
},
{
"extensions" : {
"KHR_lights" : {
"light" : 1
}
},
"name" : "Correction_Lamp",
"rotation" : [
-0.7071067690849304,
-0.0,
0.0,
0.7071067690849304
]
},
{
"children" : [
6
],
"name" : "Lamp",
"rotation" : [
0.16907575726509094,
Expand Down Expand Up @@ -325,12 +395,17 @@
"scene" : 0,
"scenes" : [
{
"extensions" : {
"KHR_lights" : {
"light" : 2
}
},
"name" : "Scene",
"nodes" : [
4,
3,
6,
5,
3,
8,
7,
1
]
}
Expand Down
4 changes: 2 additions & 2 deletions examples/webgl_loader_gltf2.html
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,8 @@
addLights:true,
addGround:true,
shadows:true,
// TODO: 'glTF-MaterialsCommon', 'glTF-techniqueWebGL'
extensions: ['glTF', 'glTF-Embedded', 'glTF-pbrSpecularGlossiness', 'glTF-Binary']
// TODO: 'glTF-techniqueWebGL'
extensions: ['glTF', 'glTF-Embedded', 'glTF-MaterialsCommon', 'glTF-pbrSpecularGlossiness', 'glTF-Binary']
},
{
name : "Monster", url : "./models/gltf/Monster/%s/Monster.gltf",
Expand Down

0 comments on commit cace414

Please sign in to comment.