Revert some changes from diffuse-alpha-same

This commit is contained in:
Sean Lilley 2019-07-22 18:39:30 -04:00
parent 72f09e2b1e
commit 080f5debf7
2 changed files with 13 additions and 17 deletions

View File

@ -387,7 +387,7 @@ function createDiffuseAlphaTexture(diffuseTexture, alphaTexture, options) {
return diffuseTexture;
}
if (diffuseTexture.path === alphaTexture.path) {
if (diffuseTexture === alphaTexture) {
return diffuseTexture;
}
@ -590,7 +590,7 @@ function createSpecularGlossinessMaterial(material, options) {
emissiveFactor = [1.0, 1.0, 1.0];
}
if (defined(diffuseAlphaTexture)) {
if (defined(diffuseTexture)) {
diffuseFactor = [1.0, 1.0, 1.0, 1.0];
}
@ -611,8 +611,8 @@ function createSpecularGlossinessMaterial(material, options) {
transparent = alpha < 1.0;
}
if (defined(diffuseAlphaTexture)) {
transparent = transparent || diffuseAlphaTexture.transparent;
if (defined(diffuseTexture)) {
transparent = transparent || diffuseTexture.transparent;
}
const doubleSided = transparent;
@ -662,7 +662,7 @@ function createMetallicRoughnessMaterial(material, options) {
emissiveFactor = [1.0, 1.0, 1.0];
}
if (defined(diffuseAlphaTexture)) {
if (defined(baseColorTexture)) {
baseColorFactor = [1.0, 1.0, 1.0, 1.0];
}
@ -683,8 +683,8 @@ function createMetallicRoughnessMaterial(material, options) {
transparent = alpha < 1.0;
}
if (defined(diffuseAlphaTexture)) {
transparent = transparent || diffuseAlphaTexture.transparent;
if (defined(baseColorTexture)) {
transparent = transparent || baseColorTexture.transparent;
}
const doubleSided = transparent;

View File

@ -322,18 +322,16 @@ describe('loadMtl', () => {
expect(material.doubleSided).toBe(true);
});
it('uses diffuse texture if diffuse and alpha are the same', async () => {
it('uses diffuse texture if diffuse and alpha are the same', () => {
options.metallicRoughness = true;
// The transparent property will be modified so make a copy
const diffuseTextureCopy = await loadTexture(diffuseTexturePath, decodeOptions);
const material = loadMtl._createMaterial({
diffuseTexture : diffuseTextureCopy,
diffuseTexture : diffuseTexture,
alphaTexture : diffuseTexture
}, options);
const pbr = material.pbrMetallicRoughness;
expect(pbr.baseColorTexture).toBe(diffuseTextureCopy);
expect(pbr.baseColorTexture).toBe(diffuseTexture);
expect(material.alphaMode).toBe('BLEND');
expect(material.doubleSided).toBe(true);
});
@ -433,18 +431,16 @@ describe('loadMtl', () => {
expect(material.doubleSided).toBe(true);
});
it('uses diffuse texture if diffuse and alpha are the same', async () => {
it('uses diffuse texture if diffuse and alpha are the same', () => {
options.specularGlossiness = true;
// The transparent property will be modified so make a copy
const diffuseTextureCopy = await loadTexture(diffuseTexturePath, decodeOptions);
const material = loadMtl._createMaterial({
diffuseTexture : diffuseTextureCopy,
diffuseTexture : diffuseTexture,
alphaTexture : diffuseTexture
}, options);
const pbr = material.extensions.KHR_materials_pbrSpecularGlossiness;
expect(pbr.diffuseTexture).toEqual(diffuseTextureCopy);
expect(pbr.diffuseTexture).toEqual(diffuseTexture);
expect(material.alphaMode).toBe('BLEND');
expect(material.doubleSided).toBe(true);
});