mirror of
https://github.com/CesiumGS/obj2gltf.git
synced 2024-11-23 08:34:14 -05:00
Revert some changes from diffuse-alpha-same
This commit is contained in:
parent
72f09e2b1e
commit
080f5debf7
@ -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;
|
||||
|
@ -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);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user