mirror of https://github.com/CesiumGS/obj2gltf.git
Tests from #109
This commit is contained in:
parent
99806cc4a7
commit
e538ded771
|
@ -17,6 +17,7 @@ Change Log
|
|||
### 1.3.3 2018-09-19
|
||||
|
||||
* Fixed handling of objs with mismatching attribute layouts. [#154](https://github.com/AnalyticalGraphicsInc/obj2gltf/pull/154)
|
||||
* Fixed parsing mtl textures that contain texture map options. [#151](https://github.com/AnalyticalGraphicsInc/obj2gltf/pull/151)
|
||||
|
||||
### 1.3.2 2018-06-07
|
||||
* Fixed greyscale images loading as alpha instead of luminance. [#144](https://github.com/AnalyticalGraphicsInc/obj2gltf/pull/144)
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
|
@ -0,0 +1,19 @@
|
|||
# Blender MTL File: 'box.blend'
|
||||
# Material Count: 1
|
||||
|
||||
newmtl Material
|
||||
Ns 96.078431
|
||||
Ka 0.200000 0.200000 0.200000
|
||||
Kd 0.640000 0.640000 0.640000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.100000 0.100000 0.100000
|
||||
Ni 1.000000
|
||||
d 0.900000
|
||||
Tr 0.100000
|
||||
map_Ka -s 1.0 1.0 1.0 -o 0.0 0.0 0.0 ambient.gif
|
||||
map_Ke -s 1.0 1.0 1.0 -o 0.0 0.0 0.0 emission.jpg
|
||||
map_Kd -s 1.0 1.0 1.0 -o 0.0 0.0 0.0 diffuse.png
|
||||
map_Ks -s 1.0 1.0 1.0 -o 0.0 0.0 0.0 specular.jpeg
|
||||
map_Ns -s 1.0 1.0 1.0 -o 0.0 0.0 0.0 shininess.png
|
||||
map_Bump -bm 0.2 bump.png
|
||||
illum 2
|
|
@ -0,0 +1,46 @@
|
|||
# Blender v2.78 (sub 0) OBJ File: 'box.blend'
|
||||
# www.blender.org
|
||||
mtllib box-texture-options.mtl
|
||||
o Cube
|
||||
v -1.000000 -1.000000 1.000000
|
||||
v -1.000000 1.000000 1.000000
|
||||
v -1.000000 -1.000000 -1.000000
|
||||
v -1.000000 1.000000 -1.000000
|
||||
v 1.000000 -1.000000 1.000000
|
||||
v 1.000000 1.000000 1.000000
|
||||
v 1.000000 -1.000000 -1.000000
|
||||
v 1.000000 1.000000 -1.000000
|
||||
vt 0.0000 0.0000
|
||||
vt 1.0000 0.0000
|
||||
vt 1.0000 1.0000
|
||||
vt 0.0000 1.0000
|
||||
vt 0.0000 0.0000
|
||||
vt 1.0000 0.0000
|
||||
vt 1.0000 1.0000
|
||||
vt 0.0000 1.0000
|
||||
vt 0.0000 0.0000
|
||||
vt 1.0000 0.0000
|
||||
vt 1.0000 1.0000
|
||||
vt 0.0000 1.0000
|
||||
vt 0.0000 0.0000
|
||||
vt 1.0000 0.0000
|
||||
vt 1.0000 1.0000
|
||||
vt 0.0000 1.0000
|
||||
vt 1.0000 0.0000
|
||||
vt 1.0000 1.0000
|
||||
vt 0.0000 0.0000
|
||||
vt 0.0000 1.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 1.0000
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
usemtl Material
|
||||
s off
|
||||
f 1/1/1 2/2/1 4/3/1 3/4/1
|
||||
f 3/5/2 4/6/2 8/7/2 7/8/2
|
||||
f 7/9/3 8/10/3 6/11/3 5/12/3
|
||||
f 5/13/4 6/14/4 2/15/4 1/16/4
|
||||
f 3/5/5 7/17/5 5/18/5 1/16/5
|
||||
f 8/19/6 4/6/6 2/15/6 6/20/6
|
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
|
@ -4,6 +4,7 @@ var loadMtl = require('../../lib/loadMtl');
|
|||
|
||||
var complexMaterialUrl = 'specs/data/box-complex-material/box-complex-material.mtl';
|
||||
var multipleMaterialsUrl = 'specs/data/box-multiple-materials/box-multiple-materials.mtl';
|
||||
var texturedWithOptionsMaterialUrl = 'specs/data/box-texture-options/box-texture-options.mtl';
|
||||
|
||||
function getImagePath(objPath, relativePath) {
|
||||
return path.normalize(path.join(path.dirname(objPath), relativePath));
|
||||
|
@ -40,4 +41,26 @@ describe('loadMtl', function() {
|
|||
expect(materials.Blue.diffuseColor).toEqual([0.0, 0.0, 0.64, 1.0]);
|
||||
}), done).toResolve();
|
||||
});
|
||||
|
||||
it('loads mtl with textures having options', function(done) {
|
||||
options.metallicRoughness = true;
|
||||
expect(loadMtl(texturedWithOptionsMaterialUrl)
|
||||
.then(function(materials) {
|
||||
expect(materials.length).toBe(1);
|
||||
var material = materials[0];
|
||||
var pbr = material.pbrMetallicRoughness;
|
||||
expect(pbr.baseColorTexture).toBeDefined();
|
||||
expect(pbr.metallicRoughnessTexture).toBeDefined();
|
||||
expect(pbr.baseColorFactor).toEqual([1.0, 1.0, 1.0, 0.9]);
|
||||
expect(pbr.metallicFactor).toBe(1.0);
|
||||
expect(pbr.roughnessFactor).toBe(1.0);
|
||||
expect(material.name).toBe('Material');
|
||||
expect(material.emissiveTexture).toBeDefined();
|
||||
expect(material.normalTexture).toBeDefined();
|
||||
expect(material.occlusionTexture).toBeDefined();
|
||||
expect(material.emissiveFactor).toEqual([1.0, 1.0, 1.0]);
|
||||
expect(material.alphaMode).toBe('BLEND');
|
||||
expect(material.doubleSided).toBe(true);
|
||||
}), done).toResolve();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue