mirror of
https://github.com/CesiumGS/obj2gltf.git
synced 2025-02-11 21:24:05 -05:00
Last few tweaks
This commit is contained in:
parent
68582967ac
commit
dc1a1976db
@ -15,7 +15,8 @@ var convert = obj2gltf.convert;
|
||||
var options = {
|
||||
embedImage : false // Don't embed image in the converted glTF
|
||||
}
|
||||
convert('model.obj', 'model.gltf', options, function() {
|
||||
convert('model.obj', 'model.gltf', options)
|
||||
.then(function() {
|
||||
console.log('Converted model');
|
||||
});
|
||||
```
|
||||
|
@ -37,7 +37,7 @@ function convert(objFile, outputPath, options) {
|
||||
extension = binary ? '.glb' : '.gltf';
|
||||
var gltfFile = path.join(outputPath, modelName + extension);
|
||||
|
||||
parseObj(objFile, inputPath)
|
||||
return parseObj(objFile, inputPath)
|
||||
.then(function(data) {
|
||||
return createGltf(data, inputPath, modelName);
|
||||
})
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
var Cesium = require('cesium');
|
||||
var Promise = require('bluebird');
|
||||
var async = require('async');
|
||||
var byline = require('byline');
|
||||
var fs = require('fs-extra');
|
||||
var path = require('path');
|
||||
@ -28,7 +27,8 @@ function parseObj(objFile, inputPath) {
|
||||
});
|
||||
}
|
||||
|
||||
function processObj(objFile, info, materials, images, done) {
|
||||
function processObj(objFile, info, materials, images) {
|
||||
return new Promise(function(resolve) {
|
||||
// A vertex is specified by indexes into each of the attribute arrays,
|
||||
// but these indexes may be different. This maps the separate indexes to a single index.
|
||||
var vertexCache = {};
|
||||
@ -232,7 +232,7 @@ function processObj(objFile, info, materials, images, done) {
|
||||
});
|
||||
|
||||
stream.on('end', function () {
|
||||
done({
|
||||
resolve({
|
||||
vertexCount: vertexCount,
|
||||
vertexArray: vertexArray,
|
||||
positionMin: positionMin,
|
||||
@ -244,6 +244,7 @@ function processObj(objFile, info, materials, images, done) {
|
||||
images: images
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getImages(inputPath, materials) {
|
||||
|
@ -10,7 +10,7 @@ var gltfFile = './specs/data/BoxTextured/BoxTextured.gltf';
|
||||
|
||||
describe('convert', function() {
|
||||
it('converts an obj to gltf', function(done) {
|
||||
var spy = spyOn(gltfPipeline, 'processJSONToDisk').and.callFake(function() {
|
||||
var spy = spyOn(gltfPipeline, 'processJSONToDisk').and.callFake(function(gltf, outputPath, options, callback) {
|
||||
return;
|
||||
});
|
||||
expect(convert(objFile, gltfFile, {})
|
||||
|
Loading…
x
Reference in New Issue
Block a user