Misc fixes

This commit is contained in:
Sean Lilley 2017-07-25 12:32:24 -04:00
parent b8c5ebc8aa
commit 2a44e0d1a8
7 changed files with 7 additions and 454 deletions

3
.gitignore vendored
View File

@ -9,6 +9,7 @@ npm-debug.log
# Generate data # Generate data
.eslintcache .eslintcache
coverage coverage
doc
*.tgz *.tgz
.nyc_output .nyc_output
doc/*
!doc/cesium.png

View File

@ -1,6 +1,6 @@
/.idea /.idea
/coverage /coverage
/doc /doc/*
/specs /specs
/test /test
.editorconfig .editorconfig
@ -12,3 +12,4 @@
.travis.yml .travis.yml
gulpfile.js gulpfile.js
*.tgz *.tgz
!doc/cesium.png

BIN
doc/cesium.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -21,6 +21,7 @@ module.exports = createGltf;
* @param {Boolean} options.metallicRoughness The values in the mtl file are already metallic-roughness PBR values and no conversion step should be applied. Metallic is stored in the Ks and map_Ks slots and roughness is stored in the Ns and map_Ns slots. * @param {Boolean} options.metallicRoughness The values in the mtl file are already metallic-roughness PBR values and no conversion step should be applied. Metallic is stored in the Ks and map_Ks slots and roughness is stored in the Ns and map_Ns slots.
* @param {Boolean} options.specularGlossiness The values in the mtl file are already specular-glossiness PBR values and no conversion step should be applied. Specular is stored in the Ks and map_Ks slots and glossiness is stored in the Ns and map_Ns slots. The glTF will be saved with the KHR_materials_pbrSpecularGlossiness extension. * @param {Boolean} options.specularGlossiness The values in the mtl file are already specular-glossiness PBR values and no conversion step should be applied. Specular is stored in the Ks and map_Ks slots and glossiness is stored in the Ns and map_Ns slots. The glTF will be saved with the KHR_materials_pbrSpecularGlossiness extension.
* @param {Boolean} options.materialsCommon The glTF will be saved with the KHR_materials_common extension. * @param {Boolean} options.materialsCommon The glTF will be saved with the KHR_materials_common extension.
* @param {Object[]} options.overridingImages An array of images that override images in the .mtl file.
* @param {String} [options.metallicRoughnessOcclusionTexture] Path to the metallic-roughness-occlusion texture used by the model, where occlusion is stored in the red channel, roughness is stored in the green channel, and metallic is stored in the blue channel. This may be used instead of setting texture paths in the .mtl file. The model will be saved with a pbrMetallicRoughness material. * @param {String} [options.metallicRoughnessOcclusionTexture] Path to the metallic-roughness-occlusion texture used by the model, where occlusion is stored in the red channel, roughness is stored in the green channel, and metallic is stored in the blue channel. This may be used instead of setting texture paths in the .mtl file. The model will be saved with a pbrMetallicRoughness material.
* @param {String} [options.specularGlossinessTexture] Path to the specular-glossiness texture used by the model, where specular color is stored in the red, green, and blue channels and specular glossiness is stored in the alpha channel. This may be used instead of setting texture paths in the .mtl file. The model will be saved with a material using the KHR_materials_pbrSpecularGlossiness extension. * @param {String} [options.specularGlossinessTexture] Path to the specular-glossiness texture used by the model, where specular color is stored in the red, green, and blue channels and specular glossiness is stored in the alpha channel. This may be used instead of setting texture paths in the .mtl file. The model will be saved with a material using the KHR_materials_pbrSpecularGlossiness extension.
* @param {String} [options.occlusionTexture] Path to the occlusion texture used by the model. This may be used instead of setting texture paths in the .mtl file. Ignored if metallicRoughnessOcclusionTexture is also set. * @param {String} [options.occlusionTexture] Path to the occlusion texture used by the model. This may be used instead of setting texture paths in the .mtl file. Ignored if metallicRoughnessOcclusionTexture is also set.

View File

@ -1,440 +0,0 @@
{
"accessors": [
{
"name": "Blue_positions",
"bufferView": 0,
"byteOffset": 0,
"componentType": 5126,
"count": 24,
"min": [
-1,
-1,
-6
],
"max": [
1,
1,
-4
],
"type": "VEC3"
},
{
"name": "Blue_normals",
"bufferView": 0,
"byteOffset": 288,
"componentType": 5126,
"count": 24,
"min": [
-1,
-1,
-1
],
"max": [
1,
1,
1
],
"type": "VEC3"
},
{
"name": "Blue_texcoords",
"bufferView": 0,
"byteOffset": 576,
"componentType": 5126,
"count": 24,
"min": [
0,
0
],
"max": [
1,
1
],
"type": "VEC2"
},
{
"name": "Blue_0_indices",
"bufferView": 1,
"byteOffset": 0,
"componentType": 5123,
"count": 18,
"min": [
0
],
"max": [
11
],
"type": "SCALAR"
},
{
"name": "Blue_1_indices",
"bufferView": 1,
"byteOffset": 36,
"componentType": 5123,
"count": 18,
"min": [
12
],
"max": [
23
],
"type": "SCALAR"
},
{
"name": "Green_positions",
"bufferView": 0,
"byteOffset": 768,
"componentType": 5126,
"count": 24,
"min": [
4,
-1,
-1
],
"max": [
6,
1,
1
],
"type": "VEC3"
},
{
"name": "Green_normals",
"bufferView": 0,
"byteOffset": 1056,
"componentType": 5126,
"count": 24,
"min": [
-1,
-1,
-1
],
"max": [
1,
1,
1
],
"type": "VEC3"
},
{
"name": "Green_texcoords",
"bufferView": 0,
"byteOffset": 1344,
"componentType": 5126,
"count": 24,
"min": [
0,
0
],
"max": [
1,
1
],
"type": "VEC2"
},
{
"name": "Green_0_indices",
"bufferView": 1,
"byteOffset": 72,
"componentType": 5123,
"count": 18,
"min": [
0
],
"max": [
11
],
"type": "SCALAR"
},
{
"name": "Green_1_indices",
"bufferView": 1,
"byteOffset": 108,
"componentType": 5123,
"count": 18,
"min": [
12
],
"max": [
23
],
"type": "SCALAR"
},
{
"name": "Red_positions",
"bufferView": 0,
"byteOffset": 1536,
"componentType": 5126,
"count": 24,
"min": [
-1,
-1,
-1
],
"max": [
1,
1,
1
],
"type": "VEC3"
},
{
"name": "Red_normals",
"bufferView": 0,
"byteOffset": 1824,
"componentType": 5126,
"count": 24,
"min": [
-1,
-1,
-1
],
"max": [
1,
1,
1
],
"type": "VEC3"
},
{
"name": "Red_texcoords",
"bufferView": 0,
"byteOffset": 2112,
"componentType": 5126,
"count": 24,
"min": [
0,
0
],
"max": [
1,
1
],
"type": "VEC2"
},
{
"name": "Red_0_indices",
"bufferView": 1,
"byteOffset": 144,
"componentType": 5123,
"count": 18,
"min": [
0
],
"max": [
11
],
"type": "SCALAR"
},
{
"name": "Red_1_indices",
"bufferView": 1,
"byteOffset": 180,
"componentType": 5123,
"count": 18,
"min": [
12
],
"max": [
23
],
"type": "SCALAR"
}
],
"asset": {
"generator": "obj2gltf",
"version": "2.0"
},
"buffers": [
{
"name": "buffer",
"byteLength": 2520,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YABAAGAAcACAAJAAoACAAKAAsADAANAA4ADAAOAA8AEAARABIAEAASABMAFAAVABYAFAAWABcAAAABAAIAAAACAAMABAAFAAYABAAGAAcACAAJAAoACAAKAAsADAANAA4ADAAOAA8AEAARABIAEAASABMAFAAVABYAFAAWABcA"
}
],
"bufferViews": [
{
"name": "bufferView_vertex",
"buffer": 0,
"byteLength": 2304,
"byteOffset": 0,
"target": 34962
},
{
"name": "bufferView_index",
"buffer": 0,
"byteLength": 216,
"byteOffset": 2304,
"target": 34963
}
],
"materials": [
{
"name": "Blue",
"pbrMetallicRoughness": {
"baseColorFactor": [
0,
0,
0.64,
1
],
"metallicFactor": 0,
"roughnessFactor": 0.903921569
},
"emissiveFactor": [
0,
0,
0
],
"alphaMode": "OPAQUE",
"doubleSided": false
},
{
"name": "Green",
"pbrMetallicRoughness": {
"baseColorFactor": [
0,
0.64,
0,
1
],
"metallicFactor": 0,
"roughnessFactor": 0.903921569
},
"emissiveFactor": [
0,
0,
0
],
"alphaMode": "OPAQUE",
"doubleSided": false
},
{
"name": "Red",
"pbrMetallicRoughness": {
"baseColorFactor": [
0.64,
0,
0,
1
],
"metallicFactor": 0,
"roughnessFactor": 0.903921569
},
"emissiveFactor": [
0,
0,
0
],
"alphaMode": "OPAQUE",
"doubleSided": false
}
],
"meshes": [
{
"name": "Blue",
"primitives": [
{
"attributes": {
"POSITION": 0,
"NORMAL": 1,
"TEXCOORD_0": 2
},
"indices": 3,
"material": 0,
"mode": 4
},
{
"attributes": {
"POSITION": 0,
"NORMAL": 1,
"TEXCOORD_0": 2
},
"indices": 4,
"material": 1,
"mode": 4
}
]
},
{
"name": "Green",
"primitives": [
{
"attributes": {
"POSITION": 5,
"NORMAL": 6,
"TEXCOORD_0": 7
},
"indices": 8,
"material": 1,
"mode": 4
},
{
"attributes": {
"POSITION": 5,
"NORMAL": 6,
"TEXCOORD_0": 7
},
"indices": 9,
"material": 2,
"mode": 4
}
]
},
{
"name": "Red",
"primitives": [
{
"attributes": {
"POSITION": 10,
"NORMAL": 11,
"TEXCOORD_0": 12
},
"indices": 13,
"material": 2,
"mode": 4
},
{
"attributes": {
"POSITION": 10,
"NORMAL": 11,
"TEXCOORD_0": 12
},
"indices": 14,
"material": 0,
"mode": 4
}
]
}
],
"nodes": [
{
"name": "Cube",
"children": [
1,
2,
3
]
},
{
"name": "Blue",
"mesh": 0
},
{
"name": "Green",
"mesh": 1
},
{
"name": "Red",
"mesh": 2
}
],
"scene": 0,
"scenes": [
{
"nodes": [
0
]
}
]
}

View File

@ -20,7 +20,8 @@ var emissiveTextureUrl = 'specs/data/box-complex-material/emission.jpg';
var metallicTextureUrl = 'specs/data/box-complex-material/specular.jpeg'; var metallicTextureUrl = 'specs/data/box-complex-material/specular.jpeg';
var roughnessTextureUrl = 'specs/data/box-complex-material/shininess.png'; var roughnessTextureUrl = 'specs/data/box-complex-material/shininess.png';
var defaultOptions = obj2gltf.defaults; var defaultOptions = clone(obj2gltf.defaults);
defaultOptions.overridingImages = [];
var checkTransparencyOptions = clone(defaultOptions); var checkTransparencyOptions = clone(defaultOptions);
checkTransparencyOptions.checkTransparency = true; checkTransparencyOptions.checkTransparency = true;
var decodeOptions = clone(defaultOptions); var decodeOptions = clone(defaultOptions);

View File

@ -5,8 +5,6 @@ var path = require('path');
var Promise = require('bluebird'); var Promise = require('bluebird');
var obj2gltf = require('../../lib/obj2gltf'); var obj2gltf = require('../../lib/obj2gltf');
var RuntimeError = Cesium.RuntimeError;
var objPath = 'specs/data/box-textured/box-textured.obj'; var objPath = 'specs/data/box-textured/box-textured.obj';
var gltfPath = 'specs/data/box-textured/box-textured.gltf'; var gltfPath = 'specs/data/box-textured/box-textured.gltf';
var glbPath = 'specs/data/box-textured/box-textured.glb'; var glbPath = 'specs/data/box-textured/box-textured.glb';
@ -95,15 +93,6 @@ describe('obj2gltf', function() {
}).toThrowDeveloperError(); }).toThrowDeveloperError();
}); });
it('throws if occlusionTexture is defined and specularGlossinessTexture is undefined', function() {
var options = {
occlusionTexture : 'path/to/occlusion/texture'
};
expect(function() {
obj2gltf(objPath, gltfPath, options);
}).toThrowDeveloperError();
});
it('throws if metallicRoughnessOcclusionTexture and specularGlossinessTexture are both defined', function() { it('throws if metallicRoughnessOcclusionTexture and specularGlossinessTexture are both defined', function() {
var options = { var options = {
metallicRoughnessOcclusionTexture : 'path/to/metallic-roughness-occlusion/texture', metallicRoughnessOcclusionTexture : 'path/to/metallic-roughness-occlusion/texture',