Skip to content

Commit 5cb517a

Browse files
author
Farhad Ghayour
committed
Fix: Update Mesh glossiness tests
1 parent 121642f commit 5cb517a

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

webgl-renderables/Mesh.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function Mesh (node, options) {
5757
positionOffset: null,
5858
normals: null,
5959
glossiness: {
60-
factor: null,
60+
strength: null,
6161
color: [0, 0, 0]
6262
}
6363
};
@@ -304,18 +304,18 @@ Mesh.prototype.setGlossiness = function setGlossiness(glossiness, specularColor)
304304
var hasSpecularColor = specularColor && specularColor.getNormalizedRGB;
305305

306306
if (isMaterial) {
307-
this.value.glossiness.factor = null;
307+
this.value.glossiness.strength = null;
308308
this.value.expressions.glossiness = glossiness;
309309
}
310310
else {
311311
this.value.expressions.glossiness = null;
312-
this.value.glossiness.factor = glossiness;
312+
this.value.glossiness.strength = glossiness;
313313
var glossinessValue = this.value.glossiness.color;
314314
if (hasSpecularColor) {
315315
this.value.glossiness.color = specularColor;
316316
glossinessValue = this.value.glossiness.color.getNormalizedRGB();
317317
}
318-
glossinessValue.push(this.value.glossiness.factor);
318+
glossinessValue.push(this.value.glossiness.strength);
319319
glossiness = glossinessValue;
320320
}
321321

@@ -334,7 +334,7 @@ Mesh.prototype.setGlossiness = function setGlossiness(glossiness, specularColor)
334334
*
335335
* @method
336336
*
337-
* @returns {MaterialExpress|Number} MaterialExpress or Number
337+
* @returns {MaterialExpress|Object} MaterialExpression or Glossiness
338338
*/
339339
Mesh.prototype.getGlossiness = function getGlossiness() {
340340
return this.value.expressions.glossiness || this.value.glossiness;
@@ -457,7 +457,7 @@ Mesh.prototype.onUpdate = function onUpdate() {
457457
this._node.sendDrawCommand('GL_UNIFORMS');
458458
this._node.sendDrawCommand('u_glossiness');
459459
var glossiness = this.value.glossiness.color.getNormalizedRGB();
460-
glossiness.push(this.value.glossiness.factor);
460+
glossiness.push(this.value.glossiness.strength);
461461
this._node.sendDrawCommand(glossiness);
462462
this._node.requestUpdateOnNextTick(this._id);
463463
}
@@ -657,7 +657,7 @@ Mesh.prototype.draw = function draw () {
657657

658658
if (value.geometry != null) this.setGeometry(value.geometry);
659659
if (value.color != null) this.setBaseColor(value.color);
660-
if (value.glossiness.factor != null) this.setGlossiness.apply(this, value.glossiness.factor);
660+
if (value.glossiness.strength != null) this.setGlossiness.apply(this, value.glossiness.strength);
661661
if (value.drawOptions != null) this.setDrawOptions(value.drawOptions);
662662
if (value.flatShading != null) this.setFlatShading(value.flatShading);
663663

webgl-renderables/test/Mesh.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,11 @@ test('Mesh', function(t) {
385385
'should be able to return the glossiness expression');
386386

387387
var x = new MockColor();
388-
mesh.setGlossiness(x, 10);
389-
t.equal(mesh.getGlossiness()[0], x,
390-
'should be able to return the glossiness value');
388+
mesh.setGlossiness(10, x);
389+
t.equal(mesh.getGlossiness().strength, 10,
390+
'should be able to return the glossiness strength');
391+
t.equal(mesh.getGlossiness().color, x,
392+
'should be able to return the glossiness color');
391393

392394
t.end();
393395
});

0 commit comments

Comments
 (0)