diff --git a/source/engine/import/importergltf.js b/source/engine/import/importergltf.js index 322dce7..1a51e38 100644 --- a/source/engine/import/importergltf.js +++ b/source/engine/import/importergltf.js @@ -23,7 +23,7 @@ const GltfComponentType = SHORT : 5122, UNSIGNED_SHORT : 5123, UNSIGNED_INT : 5125, - FLOAT : 5126 + FLOAT : 5126 }; const GltfDataType = @@ -69,8 +69,10 @@ function GetGltfVertexColor (color, componentType) function GetColorComponent (component, componentType) { let normalized = component; - if (componentType !== GltfComponentType.FLOAT) { + if (componentType === GltfComponentType.UNSIGNED_BYTE) { normalized /= 255.0; + } else if (componentType === GltfComponentType.UNSIGNED_SHORT) { + normalized /= 65535.0; } return ColorComponentFromFloat (LinearToSRGB (normalized)); } diff --git a/source/engine/model/modelfinalization.js b/source/engine/model/modelfinalization.js index ea7c58a..6e8af1a 100644 --- a/source/engine/model/modelfinalization.js +++ b/source/engine/model/modelfinalization.js @@ -28,8 +28,7 @@ class ModelFinalizer FinalizeMaterials (model) { - let hasVertexColors = (model.VertexColorCount () > 0); - if (!hasVertexColors) { + if (model.VertexColorCount () === 0) { return; }