|
@@ -2385,11 +2385,6 @@ var BABYLON;
|
|
|
/**
|
|
|
* Enums
|
|
|
*/
|
|
|
- var EBufferViewTarget;
|
|
|
- (function (EBufferViewTarget) {
|
|
|
- EBufferViewTarget[EBufferViewTarget["ARRAY_BUFFER"] = 34962] = "ARRAY_BUFFER";
|
|
|
- EBufferViewTarget[EBufferViewTarget["ELEMENT_ARRAY_BUFFER"] = 34963] = "ELEMENT_ARRAY_BUFFER";
|
|
|
- })(EBufferViewTarget = GLTF2.EBufferViewTarget || (GLTF2.EBufferViewTarget = {}));
|
|
|
var EComponentType;
|
|
|
(function (EComponentType) {
|
|
|
EComponentType[EComponentType["BYTE"] = 5120] = "BYTE";
|
|
@@ -2409,30 +2404,6 @@ var BABYLON;
|
|
|
EMeshPrimitiveMode[EMeshPrimitiveMode["TRIANGLE_STRIP"] = 5] = "TRIANGLE_STRIP";
|
|
|
EMeshPrimitiveMode[EMeshPrimitiveMode["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN";
|
|
|
})(EMeshPrimitiveMode = GLTF2.EMeshPrimitiveMode || (GLTF2.EMeshPrimitiveMode = {}));
|
|
|
- var EParameterType;
|
|
|
- (function (EParameterType) {
|
|
|
- EParameterType[EParameterType["BYTE"] = 5120] = "BYTE";
|
|
|
- EParameterType[EParameterType["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE";
|
|
|
- EParameterType[EParameterType["SHORT"] = 5122] = "SHORT";
|
|
|
- EParameterType[EParameterType["UNSIGNED_SHORT"] = 5123] = "UNSIGNED_SHORT";
|
|
|
- EParameterType[EParameterType["INT"] = 5124] = "INT";
|
|
|
- EParameterType[EParameterType["UNSIGNED_INT"] = 5125] = "UNSIGNED_INT";
|
|
|
- EParameterType[EParameterType["FLOAT"] = 5126] = "FLOAT";
|
|
|
- EParameterType[EParameterType["FLOAT_VEC2"] = 35664] = "FLOAT_VEC2";
|
|
|
- EParameterType[EParameterType["FLOAT_VEC3"] = 35665] = "FLOAT_VEC3";
|
|
|
- EParameterType[EParameterType["FLOAT_VEC4"] = 35666] = "FLOAT_VEC4";
|
|
|
- EParameterType[EParameterType["INT_VEC2"] = 35667] = "INT_VEC2";
|
|
|
- EParameterType[EParameterType["INT_VEC3"] = 35668] = "INT_VEC3";
|
|
|
- EParameterType[EParameterType["INT_VEC4"] = 35669] = "INT_VEC4";
|
|
|
- EParameterType[EParameterType["BOOL"] = 35670] = "BOOL";
|
|
|
- EParameterType[EParameterType["BOOL_VEC2"] = 35671] = "BOOL_VEC2";
|
|
|
- EParameterType[EParameterType["BOOL_VEC3"] = 35672] = "BOOL_VEC3";
|
|
|
- EParameterType[EParameterType["BOOL_VEC4"] = 35673] = "BOOL_VEC4";
|
|
|
- EParameterType[EParameterType["FLOAT_MAT2"] = 35674] = "FLOAT_MAT2";
|
|
|
- EParameterType[EParameterType["FLOAT_MAT3"] = 35675] = "FLOAT_MAT3";
|
|
|
- EParameterType[EParameterType["FLOAT_MAT4"] = 35676] = "FLOAT_MAT4";
|
|
|
- EParameterType[EParameterType["SAMPLER_2D"] = 35678] = "SAMPLER_2D";
|
|
|
- })(EParameterType = GLTF2.EParameterType || (GLTF2.EParameterType = {}));
|
|
|
var ETextureMagFilter;
|
|
|
(function (ETextureMagFilter) {
|
|
|
ETextureMagFilter[ETextureMagFilter["NEAREST"] = 9728] = "NEAREST";
|
|
@@ -2447,25 +2418,6 @@ var BABYLON;
|
|
|
ETextureMinFilter[ETextureMinFilter["NEAREST_MIPMAP_LINEAR"] = 9986] = "NEAREST_MIPMAP_LINEAR";
|
|
|
ETextureMinFilter[ETextureMinFilter["LINEAR_MIPMAP_LINEAR"] = 9987] = "LINEAR_MIPMAP_LINEAR";
|
|
|
})(ETextureMinFilter = GLTF2.ETextureMinFilter || (GLTF2.ETextureMinFilter = {}));
|
|
|
- var ETextureFormat;
|
|
|
- (function (ETextureFormat) {
|
|
|
- ETextureFormat[ETextureFormat["ALPHA"] = 6406] = "ALPHA";
|
|
|
- ETextureFormat[ETextureFormat["RGB"] = 6407] = "RGB";
|
|
|
- ETextureFormat[ETextureFormat["RGBA"] = 6408] = "RGBA";
|
|
|
- ETextureFormat[ETextureFormat["LUMINANCE"] = 6409] = "LUMINANCE";
|
|
|
- ETextureFormat[ETextureFormat["LUMINANCE_ALPHA"] = 6410] = "LUMINANCE_ALPHA";
|
|
|
- })(ETextureFormat = GLTF2.ETextureFormat || (GLTF2.ETextureFormat = {}));
|
|
|
- var ETextureTarget;
|
|
|
- (function (ETextureTarget) {
|
|
|
- ETextureTarget[ETextureTarget["TEXTURE_2D"] = 3553] = "TEXTURE_2D";
|
|
|
- })(ETextureTarget = GLTF2.ETextureTarget || (GLTF2.ETextureTarget = {}));
|
|
|
- var ETextureType;
|
|
|
- (function (ETextureType) {
|
|
|
- ETextureType[ETextureType["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE";
|
|
|
- ETextureType[ETextureType["UNSIGNED_SHORT_5_6_5"] = 33635] = "UNSIGNED_SHORT_5_6_5";
|
|
|
- ETextureType[ETextureType["UNSIGNED_SHORT_4_4_4_4"] = 32819] = "UNSIGNED_SHORT_4_4_4_4";
|
|
|
- ETextureType[ETextureType["UNSIGNED_SHORT_5_5_5_1"] = 32820] = "UNSIGNED_SHORT_5_5_5_1";
|
|
|
- })(ETextureType = GLTF2.ETextureType || (GLTF2.ETextureType = {}));
|
|
|
var ETextureWrapMode;
|
|
|
(function (ETextureWrapMode) {
|
|
|
ETextureWrapMode[ETextureWrapMode["CLAMP_TO_EDGE"] = 33071] = "CLAMP_TO_EDGE";
|
|
@@ -3431,9 +3383,9 @@ var BABYLON;
|
|
|
GLTFLoader._createTextureAsync(runtime, texture, texCoord, sourceURL, onSuccess, onError);
|
|
|
};
|
|
|
GLTFLoader._createTextureAsync = function (runtime, texture, texCoord, url, onSuccess, onError) {
|
|
|
- var sampler = texture.sampler ? runtime.gltf.samplers[texture.sampler] : {};
|
|
|
+ var sampler = (texture.sampler === undefined ? {} : runtime.gltf.samplers[texture.sampler]);
|
|
|
var noMipMaps = (sampler.minFilter === GLTF2.ETextureMinFilter.NEAREST || sampler.minFilter === GLTF2.ETextureMinFilter.LINEAR);
|
|
|
- var samplingMode = BABYLON.Texture.BILINEAR_SAMPLINGMODE;
|
|
|
+ var samplingMode = GLTF2.GLTFUtils.GetTextureFilterMode(sampler.minFilter);
|
|
|
var babylonTexture = new BABYLON.Texture(url, runtime.babylonScene, noMipMaps, true, samplingMode, function () {
|
|
|
onSuccess(babylonTexture);
|
|
|
}, onError);
|
|
@@ -3675,7 +3627,7 @@ var BABYLON;
|
|
|
}
|
|
|
};
|
|
|
GLTFUtils.GetBufferFromBufferView = function (runtime, bufferView, byteOffset, byteLength, componentType) {
|
|
|
- var byteOffset = bufferView.byteOffset + byteOffset;
|
|
|
+ byteOffset += (bufferView.byteOffset || 0);
|
|
|
var loadedBufferView = runtime.gltf.buffers[bufferView.buffer].loadedBufferView;
|
|
|
if (byteOffset + byteLength > loadedBufferView.byteLength) {
|
|
|
throw new Error("Buffer access is out of range");
|
|
@@ -3698,8 +3650,9 @@ var BABYLON;
|
|
|
*/
|
|
|
GLTFUtils.GetBufferFromAccessor = function (runtime, accessor) {
|
|
|
var bufferView = runtime.gltf.bufferViews[accessor.bufferView];
|
|
|
+ var byteOffset = accessor.byteOffset || 0;
|
|
|
var byteLength = accessor.count * GLTFUtils.GetByteStrideFromType(accessor);
|
|
|
- return GLTFUtils.GetBufferFromBufferView(runtime, bufferView, accessor.byteOffset, byteLength, accessor.componentType);
|
|
|
+ return GLTFUtils.GetBufferFromBufferView(runtime, bufferView, byteOffset, byteLength, accessor.componentType);
|
|
|
};
|
|
|
/**
|
|
|
* Decodes a buffer view into a string
|