From e85b83b16a39af73f7ee2bd98bfbcbc1ae1debe0 Mon Sep 17 00:00:00 2001 From: laurielabs Date: Tue, 7 Mar 2017 08:32:29 -0800 Subject: [PATCH] fixed threejs example vertex color normal (#74) * fixed threejs example vertex color normal --- javascript/example/DRACOLoader.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/javascript/example/DRACOLoader.js b/javascript/example/DRACOLoader.js index 06a0f8f..3fdaed1 100644 --- a/javascript/example/DRACOLoader.js +++ b/javascript/example/DRACOLoader.js @@ -177,10 +177,11 @@ THREE.DRACOLoader.prototype = { geometryBuffer.vertices[i + 1] = posAttributeData.GetValue(i + 1); geometryBuffer.vertices[i + 2] = posAttributeData.GetValue(i + 2); // Add color. + // ThreeJS vertex colors need to be normalized to properly display if (colorAttId != -1) { - geometryBuffer.colors[i] = colAttributeData.GetValue(i); - geometryBuffer.colors[i + 1] = colAttributeData.GetValue(i + 1); - geometryBuffer.colors[i + 2] = colAttributeData.GetValue(i + 2); + geometryBuffer.colors[i] = colAttributeData.GetValue(i) / 255; + geometryBuffer.colors[i + 1] = colAttributeData.GetValue(i + 1) / 255; + geometryBuffer.colors[i + 2] = colAttributeData.GetValue(i + 2) / 255; } else { // Default is white. This is faster than TypedArray.fill(). geometryBuffer.colors[i] = 1.0;