babylonjs-serializers 5.48.0 → 5.48.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babylon.glTF2Serializer.js +9 -6
- package/babylon.glTF2Serializer.js.map +1 -1
- package/babylon.glTF2Serializer.min.js +1 -1
- package/babylon.glTF2Serializer.min.js.map +1 -1
- package/babylonjs.serializers.js +9 -6
- package/babylonjs.serializers.js.map +1 -1
- package/babylonjs.serializers.min.js +1 -1
- package/babylonjs.serializers.min.js.map +1 -1
- package/package.json +3 -3
|
@@ -3128,18 +3128,19 @@ var _Exporter = /** @class */ (function () {
|
|
|
3128
3128
|
var meshMaterial = babylonTransformNode.material;
|
|
3129
3129
|
var convertToLinear = meshMaterial ? meshMaterial.getClassName() === "StandardMaterial" : true;
|
|
3130
3130
|
var vertexData = stride === 3 ? new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color3() : new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color4();
|
|
3131
|
+
var useExactSrgbConversions = this._babylonScene.getEngine().useExactSrgbConversions;
|
|
3131
3132
|
for (var k = 0, length_5 = meshAttributeArray.length / stride; k < length_5; ++k) {
|
|
3132
3133
|
index = k * stride;
|
|
3133
3134
|
if (stride === 3) {
|
|
3134
3135
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color3.FromArrayToRef(meshAttributeArray, index, vertexData);
|
|
3135
3136
|
if (convertToLinear) {
|
|
3136
|
-
vertexData.toLinearSpaceToRef(vertexData);
|
|
3137
|
+
vertexData.toLinearSpaceToRef(vertexData, useExactSrgbConversions);
|
|
3137
3138
|
}
|
|
3138
3139
|
}
|
|
3139
3140
|
else {
|
|
3140
3141
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color4.FromArrayToRef(meshAttributeArray, index, vertexData);
|
|
3141
3142
|
if (convertToLinear) {
|
|
3142
|
-
vertexData.toLinearSpaceToRef(vertexData);
|
|
3143
|
+
vertexData.toLinearSpaceToRef(vertexData, useExactSrgbConversions);
|
|
3143
3144
|
}
|
|
3144
3145
|
}
|
|
3145
3146
|
vertexAttributes.push(vertexData.asArray());
|
|
@@ -4797,7 +4798,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
4797
4798
|
var t = Math.pow(specularPower / P3.x, 0.333333);
|
|
4798
4799
|
return cubicBezierCurve(t, P0.y, P1.y, P2.y, P3.y);
|
|
4799
4800
|
}
|
|
4800
|
-
var diffuse = babylonStandardMaterial.diffuseColor.toLinearSpace().scale(0.5);
|
|
4801
|
+
var diffuse = babylonStandardMaterial.diffuseColor.toLinearSpace(babylonStandardMaterial.getScene().getEngine().useExactSrgbConversions).scale(0.5);
|
|
4801
4802
|
var opacity = babylonStandardMaterial.alpha;
|
|
4802
4803
|
var specularPower = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Scalar.Clamp(babylonStandardMaterial.specularPower, 0, _GLTFMaterialExporter._MaxSpecularPower);
|
|
4803
4804
|
var roughness = solveForRoughness(specularPower);
|
|
@@ -5100,9 +5101,11 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5100
5101
|
for (h = 0; h < height; ++h) {
|
|
5101
5102
|
for (w = 0; w < width; ++w) {
|
|
5102
5103
|
offset = (width * h + w) * strideSize;
|
|
5103
|
-
diffuseColor = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color3(diffuseBuffer[offset], diffuseBuffer[offset + 1], diffuseBuffer[offset + 2])
|
|
5104
|
+
diffuseColor = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color3(diffuseBuffer[offset], diffuseBuffer[offset + 1], diffuseBuffer[offset + 2])
|
|
5105
|
+
.toLinearSpace(scene.getEngine().useExactSrgbConversions)
|
|
5106
|
+
.multiply(factors.diffuseColor);
|
|
5104
5107
|
specularColor = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color3(specularGlossinessBuffer[offset], specularGlossinessBuffer[offset + 1], specularGlossinessBuffer[offset + 2])
|
|
5105
|
-
.toLinearSpace()
|
|
5108
|
+
.toLinearSpace(scene.getEngine().useExactSrgbConversions)
|
|
5106
5109
|
.multiply(factors.specularColor);
|
|
5107
5110
|
glossiness = specularGlossinessBuffer[offset + 3] * factors.glossiness;
|
|
5108
5111
|
specularGlossiness = {
|
|
@@ -5140,7 +5143,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5140
5143
|
baseColorBuffer[destinationOffset + 1] /= metallicRoughnessFactors_1.baseColor.g > _GLTFMaterialExporter._Epsilon ? metallicRoughnessFactors_1.baseColor.g : 1;
|
|
5141
5144
|
baseColorBuffer[destinationOffset + 2] /= metallicRoughnessFactors_1.baseColor.b > _GLTFMaterialExporter._Epsilon ? metallicRoughnessFactors_1.baseColor.b : 1;
|
|
5142
5145
|
linearBaseColorPixel = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Color3.FromInts(baseColorBuffer[destinationOffset], baseColorBuffer[destinationOffset + 1], baseColorBuffer[destinationOffset + 2]);
|
|
5143
|
-
sRGBBaseColorPixel = linearBaseColorPixel.toGammaSpace();
|
|
5146
|
+
sRGBBaseColorPixel = linearBaseColorPixel.toGammaSpace(scene.getEngine().useExactSrgbConversions);
|
|
5144
5147
|
baseColorBuffer[destinationOffset] = sRGBBaseColorPixel.r * 255;
|
|
5145
5148
|
baseColorBuffer[destinationOffset + 1] = sRGBBaseColorPixel.g * 255;
|
|
5146
5149
|
baseColorBuffer[destinationOffset + 2] = sRGBBaseColorPixel.b * 255;
|