@loaders.gl/draco
Advanced tools
Comparing version 1.0.0-alpha.4 to 1.0.0
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
@@ -45,3 +45,3 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
(0, _classCallCheck2.default)(this, DracoBuilder); | ||
(0, _classCallCheck2["default"])(this, DracoBuilder); | ||
this.dracoEncoderModule = draco3d.createEncoderModule({}); | ||
@@ -53,3 +53,3 @@ this.dracoEncoder = new this.dracoEncoderModule.Encoder(); | ||
(0, _createClass2.default)(DracoBuilder, [{ | ||
(0, _createClass2["default"])(DracoBuilder, [{ | ||
key: "destroy", | ||
@@ -80,3 +80,3 @@ value: function destroy() { | ||
value: function _getAttributesFromMesh(mesh) { | ||
var attributes = (0, _objectSpread2.default)({}, mesh, mesh.attributes); | ||
var attributes = (0, _objectSpread2["default"])({}, mesh, mesh.attributes); | ||
@@ -143,3 +143,3 @@ if (mesh.indices) { | ||
(_this$dracoEncoder = this.dracoEncoder).SetSpeedOptions.apply(_this$dracoEncoder, (0, _toConsumableArray2.default)(opts.speed)); | ||
(_this$dracoEncoder = this.dracoEncoder).SetSpeedOptions.apply(_this$dracoEncoder, (0, _toConsumableArray2["default"])(opts.speed)); | ||
} | ||
@@ -312,3 +312,3 @@ | ||
exports.default = DracoBuilder; | ||
exports["default"] = DracoBuilder; | ||
//# sourceMappingURL=draco-builder.js.map |
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
@@ -14,3 +14,3 @@ var _dracoParser = _interopRequireDefault(require("./draco-parser")); | ||
function parseSync(arrayBuffer, options) { | ||
var dracoParser = new _dracoParser.default(); | ||
var dracoParser = new _dracoParser["default"](); | ||
@@ -29,3 +29,3 @@ try { | ||
}; | ||
exports.default = _default; | ||
exports["default"] = _default; | ||
//# sourceMappingURL=draco-loader.js.map |
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
@@ -15,4 +15,2 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _gltfAttributeUtils = require("./gltf-attribute-utils"); | ||
var draco3d = require('draco3d'); | ||
@@ -42,7 +40,7 @@ | ||
function DracoParser() { | ||
(0, _classCallCheck2.default)(this, DracoParser); | ||
(0, _classCallCheck2["default"])(this, DracoParser); | ||
this.decoderModule = draco3d.createDecoderModule({}); | ||
} | ||
(0, _createClass2.default)(DracoParser, [{ | ||
(0, _createClass2["default"])(DracoParser, [{ | ||
key: "destroy", | ||
@@ -97,9 +95,2 @@ value: function destroy() {} | ||
data.header = { | ||
vertexCount: header.vertexCount | ||
}; | ||
data.loaderData = { | ||
header: header | ||
}; | ||
if (!dracoStatus.ok() || !dracoGeometry.ptr) { | ||
@@ -115,3 +106,9 @@ var message = "DRACO decompression failed: ".concat(dracoStatus.error_msg()); | ||
this.extractDRACOGeometry(decoder, dracoGeometry, data, geometryType); | ||
data.header = { | ||
vertexCount: header.vertexCount | ||
}; | ||
data.loaderData = { | ||
header: header | ||
}; | ||
this.extractDRACOGeometry(decoder, dracoGeometry, geometryType, data); | ||
} finally { | ||
@@ -126,3 +123,3 @@ this.decoderModule.destroy(decoder); | ||
key: "extractDRACOGeometry", | ||
value: function extractDRACOGeometry(decoder, dracoGeometry, geometry, geometryType) { | ||
value: function extractDRACOGeometry(decoder, dracoGeometry, geometryType, geometry) { | ||
var attributes = this.getAttributes(decoder, dracoGeometry); | ||
@@ -144,4 +141,11 @@ var positionAttribute = attributes.POSITION; | ||
geometry.indices = (0, _gltfAttributeUtils.getGLTFIndices)(attributes); | ||
geometry.attributes = (0, _gltfAttributeUtils.getGLTFAccessors)(attributes); | ||
if (attributes.indices) { | ||
geometry.indices = { | ||
value: attributes.indices, | ||
size: 1 | ||
}; | ||
delete attributes.indices; | ||
} | ||
geometry.attributes = attributes; | ||
return geometry; | ||
@@ -309,3 +313,3 @@ } | ||
exports.default = DracoParser; | ||
exports["default"] = DracoParser; | ||
//# sourceMappingURL=draco-parser.js.map |
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
@@ -14,3 +14,3 @@ var _dracoBuilder = _interopRequireDefault(require("./draco-builder")); | ||
function encodeSync(data, options) { | ||
var dracoBuilder = new _dracoBuilder.default(); | ||
var dracoBuilder = new _dracoBuilder["default"](); | ||
@@ -32,3 +32,3 @@ try { | ||
}; | ||
exports.default = _default; | ||
exports["default"] = _default; | ||
//# sourceMappingURL=draco-writer.js.map |
@@ -11,3 +11,3 @@ "use strict"; | ||
get: function get() { | ||
return _dracoLoader.default; | ||
return _dracoLoader["default"]; | ||
} | ||
@@ -18,3 +18,3 @@ }); | ||
get: function get() { | ||
return _dracoWorkerLoader.default; | ||
return _dracoWorkerLoader["default"]; | ||
} | ||
@@ -25,3 +25,3 @@ }); | ||
get: function get() { | ||
return _dracoWriter.default; | ||
return _dracoWriter["default"]; | ||
} | ||
@@ -32,3 +32,3 @@ }); | ||
get: function get() { | ||
return _dracoParser.default; | ||
return _dracoParser["default"]; | ||
} | ||
@@ -39,3 +39,3 @@ }); | ||
get: function get() { | ||
return _dracoBuilder.default; | ||
return _dracoBuilder["default"]; | ||
} | ||
@@ -42,0 +42,0 @@ }); |
@@ -79,4 +79,3 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread"; | ||
this.log(`DRACO encoded ${dracoPointCloud.num_points()} points | ||
with ${dracoPointCloud.num_attributes()} attributes into ${encodedLen} bytes`); | ||
this.log("DRACO encoded ".concat(dracoPointCloud.num_points(), " points\n with ").concat(dracoPointCloud.num_attributes(), " attributes into ").concat(encodedLen, " bytes")); | ||
return dracoInt8ArrayToArrayBuffer(dracoData); | ||
@@ -103,4 +102,3 @@ } finally { | ||
this.log(`DRACO encoded ${dracoMesh.num_points()} points | ||
with ${dracoMesh.num_attributes()} attributes into ${encodedLen} bytes`); | ||
this.log("DRACO encoded ".concat(dracoMesh.num_points(), " points\n with ").concat(dracoMesh.num_attributes(), " attributes into ").concat(encodedLen, " bytes")); | ||
return dracoInt8ArrayToArrayBuffer(dracoData); | ||
@@ -197,3 +195,3 @@ } finally { | ||
const numFaces = attribute.length / 3; | ||
this.log(`Adding attribute ${attributeName}, size ${numFaces}`); | ||
this.log("Adding attribute ".concat(attributeName, ", size ").concat(numFaces)); | ||
this.dracoMeshBuilder.AddFacesToMesh(dracoMesh, numFaces, attribute); | ||
@@ -203,3 +201,3 @@ return; | ||
this.log(`Adding attribute ${attributeName}, size ${size}`); | ||
this.log("Adding attribute ".concat(attributeName, ", size ").concat(size)); | ||
@@ -206,0 +204,0 @@ switch (attribute.constructor.name) { |
@@ -1,3 +0,1 @@ | ||
import { getGLTFAccessors, getGLTFIndices } from './gltf-attribute-utils'; | ||
const draco3d = require('draco3d'); | ||
@@ -75,11 +73,4 @@ | ||
data.header = { | ||
vertexCount: header.vertexCount | ||
}; | ||
data.loaderData = { | ||
header | ||
}; | ||
if (!dracoStatus.ok() || !dracoGeometry.ptr) { | ||
const message = `DRACO decompression failed: ${dracoStatus.error_msg()}`; | ||
const message = "DRACO decompression failed: ".concat(dracoStatus.error_msg()); | ||
@@ -93,3 +84,9 @@ if (dracoGeometry) { | ||
this.extractDRACOGeometry(decoder, dracoGeometry, data, geometryType); | ||
data.header = { | ||
vertexCount: header.vertexCount | ||
}; | ||
data.loaderData = { | ||
header | ||
}; | ||
this.extractDRACOGeometry(decoder, dracoGeometry, geometryType, data); | ||
} finally { | ||
@@ -103,3 +100,3 @@ this.decoderModule.destroy(decoder); | ||
extractDRACOGeometry(decoder, dracoGeometry, geometry, geometryType) { | ||
extractDRACOGeometry(decoder, dracoGeometry, geometryType, geometry) { | ||
const attributes = this.getAttributes(decoder, dracoGeometry); | ||
@@ -121,4 +118,11 @@ const positionAttribute = attributes.POSITION; | ||
geometry.indices = getGLTFIndices(attributes); | ||
geometry.attributes = getGLTFAccessors(attributes); | ||
if (attributes.indices) { | ||
geometry.indices = { | ||
value: attributes.indices, | ||
size: 1 | ||
}; | ||
delete attributes.indices; | ||
} | ||
geometry.attributes = attributes; | ||
return geometry; | ||
@@ -203,3 +207,3 @@ } | ||
if (dracoAttribute.ptr === 0) { | ||
const message = `DRACO decode bad attribute ${attributeName}`; | ||
const message = "DRACO decode bad attribute ".concat(attributeName); | ||
throw new Error(message); | ||
@@ -206,0 +210,0 @@ } |
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
import _createClass from "@babel/runtime/helpers/esm/createClass"; | ||
import { getGLTFAccessors, getGLTFIndices } from './gltf-attribute-utils'; | ||
@@ -84,9 +83,2 @@ var draco3d = require('draco3d'); | ||
data.header = { | ||
vertexCount: header.vertexCount | ||
}; | ||
data.loaderData = { | ||
header: header | ||
}; | ||
if (!dracoStatus.ok() || !dracoGeometry.ptr) { | ||
@@ -102,3 +94,9 @@ var message = "DRACO decompression failed: ".concat(dracoStatus.error_msg()); | ||
this.extractDRACOGeometry(decoder, dracoGeometry, data, geometryType); | ||
data.header = { | ||
vertexCount: header.vertexCount | ||
}; | ||
data.loaderData = { | ||
header: header | ||
}; | ||
this.extractDRACOGeometry(decoder, dracoGeometry, geometryType, data); | ||
} finally { | ||
@@ -113,3 +111,3 @@ this.decoderModule.destroy(decoder); | ||
key: "extractDRACOGeometry", | ||
value: function extractDRACOGeometry(decoder, dracoGeometry, geometry, geometryType) { | ||
value: function extractDRACOGeometry(decoder, dracoGeometry, geometryType, geometry) { | ||
var attributes = this.getAttributes(decoder, dracoGeometry); | ||
@@ -131,4 +129,11 @@ var positionAttribute = attributes.POSITION; | ||
geometry.indices = getGLTFIndices(attributes); | ||
geometry.attributes = getGLTFAccessors(attributes); | ||
if (attributes.indices) { | ||
geometry.indices = { | ||
value: attributes.indices, | ||
size: 1 | ||
}; | ||
delete attributes.indices; | ||
} | ||
geometry.attributes = attributes; | ||
return geometry; | ||
@@ -135,0 +140,0 @@ } |
{ | ||
"name": "@loaders.gl/draco", | ||
"version": "1.0.0-alpha.4", | ||
"version": "1.0.0", | ||
"description": "Framework-independent loader and writer for Draco compressed meshes and point clouds", | ||
@@ -24,2 +24,6 @@ "license": "MIT", | ||
"esnext": "dist/es6/index.js", | ||
"sideEffects": false, | ||
"browser": { | ||
"fs": false | ||
}, | ||
"files": [ | ||
@@ -30,15 +34,13 @@ "src", | ||
], | ||
"browser": { | ||
"fs": false | ||
}, | ||
"scripts": { | ||
"pre-build": "npm run build-worker", | ||
"pre-build-disabled": "npm run build-worker && npm run build-bundle && npm run build-bundle -- --env.dev", | ||
"build-bundle": "webpack --display=minimal --config ../../scripts/bundle.config.js", | ||
"build-worker": "webpack --entry ./src/draco-loader.worker.js --output ./dist/draco-loader.worker.js --config ../../scripts/worker-webpack-config.js" | ||
}, | ||
"sideEffects": false, | ||
"dependencies": { | ||
"@babel/runtime": "^7.3.1", | ||
"@loaders.gl/core": "1.0.0-alpha.4", | ||
"@loaders.gl/core": "1.0.0", | ||
"draco3d": "^1.3.4" | ||
} | ||
} |
@@ -1,6 +0,2 @@ | ||
// DRACO decompressor | ||
import {getGLTFAccessors, getGLTFIndices} from './gltf-attribute-utils'; | ||
const draco3d = require('draco3d'); | ||
// const assert = require('assert'); | ||
@@ -85,7 +81,2 @@ const GEOMETRY_TYPE = { | ||
data.header = { | ||
vertexCount: header.vertexCount | ||
}; | ||
data.loaderData = {header}; | ||
if (!dracoStatus.ok() || !dracoGeometry.ptr) { | ||
@@ -100,3 +91,8 @@ const message = `DRACO decompression failed: ${dracoStatus.error_msg()}`; | ||
this.extractDRACOGeometry(decoder, dracoGeometry, data, geometryType); | ||
data.header = { | ||
vertexCount: header.vertexCount | ||
}; | ||
data.loaderData = {header}; | ||
this.extractDRACOGeometry(decoder, dracoGeometry, geometryType, data); | ||
} finally { | ||
@@ -110,3 +106,3 @@ this.decoderModule.destroy(decoder); | ||
extractDRACOGeometry(decoder, dracoGeometry, geometry, geometryType) { | ||
extractDRACOGeometry(decoder, dracoGeometry, geometryType, geometry) { | ||
// const numPoints = dracoGeometry.num_points(); | ||
@@ -139,4 +135,7 @@ // const numAttributes = dracoGeometry.num_attributes(); | ||
geometry.indices = getGLTFIndices(attributes); | ||
geometry.attributes = getGLTFAccessors(attributes); | ||
if (attributes.indices) { | ||
geometry.indices = {value: attributes.indices, size: 1}; | ||
delete attributes.indices; | ||
} | ||
geometry.attributes = attributes; | ||
@@ -143,0 +142,0 @@ return geometry; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
6731985
53
21198
+ Added@loaders.gl/core@1.0.0(transitive)
- Removed@loaders.gl/core@1.0.0-alpha.4(transitive)
- Removedtext-encoding@0.6.4(transitive)
Updated@loaders.gl/core@1.0.0