Skip to content
Permalink
Browse files

dont remove texture if texture coords are not present

  • Loading branch information...
TrevorDev committed May 22, 2019
1 parent d6ab54c commit d910164cb82e401c49676511517050a49e652679
Showing with 0 additions and 11 deletions.
  1. +0 −11 serializers/src/glTF/2.0/glTFExporter.ts
@@ -1067,7 +1067,6 @@ export class _Exporter {
let promises: Promise<IMeshPrimitive>[] = [];
let bufferMesh: Nullable<Mesh> = null;
let bufferView: IBufferView;
let uvCoordsPresent: boolean;
let minMax: { min: Nullable<number[]>, max: Nullable<number[]> };

if (babylonTransformNode instanceof Mesh) {
@@ -1123,7 +1122,6 @@ export class _Exporter {
if (bufferMesh.subMeshes) {
// go through all mesh primitives (submeshes)
for (const submesh of bufferMesh.subMeshes) {
uvCoordsPresent = false;
let babylonMaterial = submesh.getMaterial() || bufferMesh.getScene().defaultMaterial;

let materialIndex: Nullable<number> = null;
@@ -1179,9 +1177,6 @@ export class _Exporter {
const accessor = _GLTFUtilities._CreateAccessor(bufferViewIndex, attributeKind + " - " + babylonTransformNode.name, attribute.accessorType, AccessorComponentType.FLOAT, vertexData.length / stride, 0, minMax.min, minMax.max);
this._accessors.push(accessor);
this.setAttributeKind(meshPrimitive, attributeKind);
if (meshPrimitive.attributes.TEXCOORD_0 != null || meshPrimitive.attributes.TEXCOORD_1 != null) {
uvCoordsPresent = true;
}
}
}
}
@@ -1220,12 +1215,6 @@ export class _Exporter {
}
}

if (!uvCoordsPresent && this._glTFMaterialExporter._hasTexturesPresent(this._materials[materialIndex])) {
const newMat = this._glTFMaterialExporter._stripTexturesFromMaterial(this._materials[materialIndex]);
this._materials.push(newMat);
materialIndex = this._materials.length - 1;
}

meshPrimitive.material = materialIndex;

}

0 comments on commit d910164

Please sign in to comment.
You can’t perform that action at this time.