mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-06-04 11:25:44 +08:00
fixed threejs example vertex color normal (#74)
* fixed threejs example vertex color normal
This commit is contained in:
parent
0a9c9c7b8b
commit
e85b83b16a
@ -177,10 +177,11 @@ THREE.DRACOLoader.prototype = {
|
|||||||
geometryBuffer.vertices[i + 1] = posAttributeData.GetValue(i + 1);
|
geometryBuffer.vertices[i + 1] = posAttributeData.GetValue(i + 1);
|
||||||
geometryBuffer.vertices[i + 2] = posAttributeData.GetValue(i + 2);
|
geometryBuffer.vertices[i + 2] = posAttributeData.GetValue(i + 2);
|
||||||
// Add color.
|
// Add color.
|
||||||
|
// ThreeJS vertex colors need to be normalized to properly display
|
||||||
if (colorAttId != -1) {
|
if (colorAttId != -1) {
|
||||||
geometryBuffer.colors[i] = colAttributeData.GetValue(i);
|
geometryBuffer.colors[i] = colAttributeData.GetValue(i) / 255;
|
||||||
geometryBuffer.colors[i + 1] = colAttributeData.GetValue(i + 1);
|
geometryBuffer.colors[i + 1] = colAttributeData.GetValue(i + 1) / 255;
|
||||||
geometryBuffer.colors[i + 2] = colAttributeData.GetValue(i + 2);
|
geometryBuffer.colors[i + 2] = colAttributeData.GetValue(i + 2) / 255;
|
||||||
} else {
|
} else {
|
||||||
// Default is white. This is faster than TypedArray.fill().
|
// Default is white. This is faster than TypedArray.fill().
|
||||||
geometryBuffer.colors[i] = 1.0;
|
geometryBuffer.colors[i] = 1.0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user