Skip to content

Commit 693295b

Browse files
binpersonhujiulong
authored andcommitted
fix: fix props check
* judge the value is 0 or not * Change 0 to hexadecimal
1 parent 48a44d3 commit 693295b

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/model-mixin.vue

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -377,18 +377,18 @@ export default {
377377
let light = null;
378378
379379
if ( type === 'ambient' || type === 'ambientlight' ) {
380-
381-
const color = item.color || 0x404040;
382-
const intensity = item.intensity || 1;
380+
381+
const color = item.color === 0x000000 ? item.color : item.color || 0x404040;
382+
const intensity = item.intensity === 0 ? item.intensity : item.intensity || 1;
383383
384384
light = new AmbientLight( color, intensity );
385385
386386
} else if ( type === 'point' || type === 'pointlight' ) {
387387
388-
const color = item.color || 0xffffff;
389-
const intensity = item.intensity || 1;
388+
const color = item.color === 0x000000 ? item.color : item.color || 0xffffff;
389+
const intensity = item.intensity === 0 ? item.intensity : item.intensity || 1;
390390
const distance = item.distance || 0;
391-
const decay = item.decay || 1;
391+
const decay = item.decay === 0 ? item.decay : item.decay || 1;
392392
393393
light = new PointLight( color, intensity, distance, decay );
394394
@@ -398,8 +398,8 @@ export default {
398398
399399
} else if ( type === 'directional' || type === 'directionallight' ) {
400400
401-
const color = item.color || 0xffffff;
402-
const intensity = item.intensity || 1;
401+
const color = item.color === 0x000000 ? item.color : item.color || 0xffffff;
402+
const intensity = item.intensity === 0 ? item.intensity : item.intensity || 1;
403403
404404
light = new DirectionalLight( color, intensity );
405405
@@ -413,9 +413,9 @@ export default {
413413
414414
} else if ( type === 'hemisphere' || type === 'hemispherelight' ) {
415415
416-
const skyColor = item.skyColor || 0xffffff;
417-
const groundColor = item.groundColor || 0xffffff;
418-
const intensity = item.intensity || 1;
416+
const skyColor = item.skyColor === 0x000000 ? item.skyColor : item.skyColor || 0xffffff;
417+
const groundColor = item.groundColor === 0x000000 ? item.groundColor : item.groundColor || 0xffffff;
418+
const intensity = item.intensity === 0 ? item.intensity : item.intensity || 1;
419419
420420
light = new HemisphereLight( skyColor, groundColor, intensity );
421421

0 commit comments

Comments
 (0)