geojson2obj
Advanced tools
Comparing version 1.0.0 to 1.1.0
17
index.js
@@ -41,7 +41,8 @@ var extend = require('extend'), | ||
var flatPolyCoords = [].concat.apply([], vs), | ||
holeIndices = coordinates.slice(2).reduce(function(holeIndices, ring, i, arr) { | ||
holeIndices.push(arr[i - 1].length); | ||
holeIndices = coordinates.slice(2).reduce(function(holeIndices, ring, i) { | ||
var prevHoleIndex = holeIndices[holeIndices.length - 1]; | ||
holeIndices.push(prevHoleIndex + coordinates[i + 1].length * 2); | ||
return holeIndices; | ||
}, [coordinates[0].length]), | ||
triIndices = earcut(flatPolyCoords, holeIndices); | ||
}, [coordinates[0].length * 2]); | ||
var triIndices = earcut(flatPolyCoords, holeIndices); | ||
[].concat.apply(faces, triIndices); | ||
@@ -60,3 +61,2 @@ } | ||
geom = transform ? transform(f, options).geometry : f.geometry; | ||
if (transform) console.log(geom); | ||
@@ -67,5 +67,8 @@ var baseZ = options.featureBase(f), | ||
vertices = verticesFunc[geom.type](geom.coordinates).map(options.coordToPoint), | ||
surfaces = surfacesFunc[geom.type](geom.coordinates, vertices, nIndices); | ||
surfaces = surfacesFunc[geom.type](geom.coordinates, vertices, nIndices), | ||
name = options.featureName(f); | ||
stream.write('g ' + options.featureName(f) + '\n'); | ||
if (name) { | ||
stream.write('g ' + name + '\n'); | ||
} | ||
@@ -72,0 +75,0 @@ if (materialName) { |
{ | ||
"name": "geojson2obj", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Convert GeoJSON into Wavefront OBJ format", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
37528581
16000