New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@loaders.gl/draco

Package Overview
Dependencies
Maintainers
9
Versions
339
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/draco - npm Package Compare versions

Comparing version 1.3.0-beta.1 to 1.3.0-beta.2

4

dist/es6/bundle.js

@@ -1,4 +0,4 @@

var moduleExports = require('./index');
const moduleExports = require('./index');
var _global = typeof window === 'undefined' ? global : window;
const _global = typeof window === 'undefined' ? global : window;

@@ -5,0 +5,0 @@ _global.loaders = _global.loaders || {};

@@ -7,5 +7,5 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

var draco3d = require('draco3d');
const draco3d = require('draco3d');
var GLTF_TO_DRACO_ATTRIBUTE_NAME_MAP = {
const GLTF_TO_DRACO_ATTRIBUTE_NAME_MAP = {
POSITION: 'POSITION',

@@ -20,7 +20,7 @@ NORMAL: 'NORMAL',

function dracoInt8ArrayToArrayBuffer(dracoData) {
var byteLength = dracoData.size();
var outputBuffer = new ArrayBuffer(byteLength);
var outputData = new Int8Array(outputBuffer);
const byteLength = dracoData.size();
const outputBuffer = new ArrayBuffer(byteLength);
const outputData = new Int8Array(outputBuffer);
for (var i = 0; i < byteLength; ++i) {
for (let i = 0; i < byteLength; ++i) {
outputData[i] = dracoData.GetValue(i);

@@ -33,4 +33,3 @@ }

export default class DracoBuilder {
constructor() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
constructor(options = {}) {
this.dracoEncoderModule = draco3d.createEncoderModule({});

@@ -63,3 +62,3 @@ this.dracoEncoder = new this.dracoEncoderModule.Encoder();

_getAttributesFromMesh(mesh) {
var attributes = _objectSpread({}, mesh, {}, mesh.attributes);
const attributes = _objectSpread({}, mesh, {}, mesh.attributes);

@@ -74,10 +73,10 @@ if (mesh.indices) {

_encodePointCloud(pointcloud) {
var attributes = this._getAttributesFromMesh(pointcloud);
const attributes = this._getAttributesFromMesh(pointcloud);
var dracoPointCloud = this._createDracoPointCloud(attributes);
const dracoPointCloud = this._createDracoPointCloud(attributes);
var dracoData = new this.dracoEncoderModule.DracoInt8Array();
const dracoData = new this.dracoEncoderModule.DracoInt8Array();
try {
var encodedLen = this.dracoEncoder.EncodePointCloudToDracoBuffer(dracoPointCloud, false, dracoData);
const encodedLen = this.dracoEncoder.EncodePointCloudToDracoBuffer(dracoPointCloud, false, dracoData);

@@ -97,10 +96,10 @@ if (!(encodedLen > 0)) {

_encodeMesh(mesh) {
var attributes = this._getAttributesFromMesh(mesh);
const attributes = this._getAttributesFromMesh(mesh);
var dracoMesh = this._createDracoMesh(attributes);
const dracoMesh = this._createDracoMesh(attributes);
var dracoData = new this.dracoEncoderModule.DracoInt8Array();
const dracoData = new this.dracoEncoderModule.DracoInt8Array();
try {
var encodedLen = this.dracoEncoder.EncodeMeshToDracoBuffer(dracoMesh, dracoData);
const encodedLen = this.dracoEncoder.EncodeMeshToDracoBuffer(dracoMesh, dracoData);

@@ -119,5 +118,3 @@ if (encodedLen <= 0) {

_setOptions() {
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_setOptions(opts = {}) {
if ('speed' in opts) {

@@ -128,3 +125,3 @@ this.dracoEncoder.SetSpeedOptions(...opts.speed);

if ('method' in opts) {
var dracoMethod = this.dracoEncoderModule[opts.method];
const dracoMethod = this.dracoEncoderModule[opts.method];
this.dracoEncoder.SetEncodingMethod(dracoMethod);

@@ -134,5 +131,5 @@ }

if ('quantization' in opts) {
for (var attribute in opts.quantization) {
var bits = opts.quantization[attribute];
var dracoPosition = this.dracoEncoderModule[attribute];
for (const attribute in opts.quantization) {
const bits = opts.quantization[attribute];
const dracoPosition = this.dracoEncoderModule[attribute];
this.dracoEncoder.SetAttributeQuantization(dracoPosition, bits);

@@ -144,6 +141,6 @@ }

_createDracoMesh(attributes) {
var dracoMesh = new this.dracoEncoderModule.Mesh();
const dracoMesh = new this.dracoEncoderModule.Mesh();
try {
var positions = this._getPositionAttribute(attributes);
const positions = this._getPositionAttribute(attributes);

@@ -154,6 +151,6 @@ if (!positions) {

var vertexCount = positions.length / 3;
const vertexCount = positions.length / 3;
for (var attributeName in attributes) {
var attribute = attributes[attributeName];
for (let attributeName in attributes) {
const attribute = attributes[attributeName];
attributeName = GLTF_TO_DRACO_ATTRIBUTE_NAME_MAP[attributeName] || attributeName;

@@ -172,6 +169,6 @@

_createDracoPointCloud(attributes) {
var dracoPointCloud = new this.dracoEncoderModule.PointCloud();
const dracoPointCloud = new this.dracoEncoderModule.PointCloud();
try {
var positions = this._getPositionAttribute(attributes);
const positions = this._getPositionAttribute(attributes);

@@ -182,6 +179,6 @@ if (!positions) {

var vertexCount = positions.length / 3;
const vertexCount = positions.length / 3;
for (var attributeName in attributes) {
var attribute = attributes[attributeName];
for (let attributeName in attributes) {
const attribute = attributes[attributeName];
attributeName = GLTF_TO_DRACO_ATTRIBUTE_NAME_MAP[attributeName] || attributeName;

@@ -204,8 +201,8 @@

var dracoAttributeType = this._getDracoAttributeType(attributeName, attribute);
const dracoAttributeType = this._getDracoAttributeType(attributeName, attribute);
var size = attribute.length / vertexCount;
const size = attribute.length / vertexCount;
if (dracoAttributeType === 'indices') {
var numFaces = attribute.length / 3;
const numFaces = attribute.length / 3;
this.log("Adding attribute ".concat(attributeName, ", size ").concat(numFaces));

@@ -278,6 +275,6 @@ this.dracoMeshBuilder.AddFacesToMesh(dracoMesh, numFaces, attribute);

_getPositionAttribute(attributes) {
for (var attributeName in attributes) {
var attribute = attributes[attributeName];
for (const attributeName in attributes) {
const attribute = attributes[attributeName];
var dracoType = this._getDracoAttributeType(attributeName, attribute);
const dracoType = this._getDracoAttributeType(attributeName, attribute);

@@ -284,0 +281,0 @@ if (dracoType === this.dracoEncoderModule.POSITION) {

import DracoParser from './draco-parser';
function parseSync(arrayBuffer, options) {
var dracoParser = new DracoParser();
const dracoParser = new DracoParser();

@@ -6,0 +6,0 @@ try {

@@ -1,8 +0,8 @@

var draco3d = require('draco3d');
const draco3d = require('draco3d');
var GEOMETRY_TYPE = {
const GEOMETRY_TYPE = {
TRIANGULAR_MESH: 0,
POINT_CLOUD: 1
};
var DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP = {
const DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP = {
POSITION: 'POSITION',

@@ -13,3 +13,3 @@ NORMAL: 'NORMAL',

};
var DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP = {
const DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP = {
1: Int8Array,

@@ -37,12 +37,12 @@ 2: Uint8Array,

parseSync(arrayBuffer) {
var buffer = new this.decoderModule.DecoderBuffer();
const buffer = new this.decoderModule.DecoderBuffer();
buffer.Init(new Int8Array(arrayBuffer), arrayBuffer.byteLength);
var decoder = new this.decoderModule.Decoder();
var data = {};
var dracoStatus;
var dracoGeometry;
var header;
const decoder = new this.decoderModule.Decoder();
const data = {};
let dracoStatus;
let dracoGeometry;
let header;
try {
var geometryType = decoder.GetEncodedGeometryType(buffer);
const geometryType = decoder.GetEncodedGeometryType(buffer);

@@ -76,3 +76,3 @@ switch (geometryType) {

if (!dracoStatus.ok() || !dracoGeometry.ptr) {
var message = "DRACO decompression failed: ".concat(dracoStatus.error_msg());
const message = "DRACO decompression failed: ".concat(dracoStatus.error_msg());

@@ -102,4 +102,4 @@ if (dracoGeometry) {

extractDRACOGeometry(decoder, dracoGeometry, geometryType, geometry) {
var attributes = this.getAttributes(decoder, dracoGeometry);
var positionAttribute = attributes.POSITION;
const attributes = this.getAttributes(decoder, dracoGeometry);
const positionAttribute = attributes.POSITION;

@@ -134,3 +134,3 @@ if (!positionAttribute) {

this.metadata.attributes = this.metadata.attributes || {};
var posTransform = new this.decoderModule.AttributeQuantizationTransform();
const posTransform = new this.decoderModule.AttributeQuantizationTransform();

@@ -143,3 +143,3 @@ if (posTransform.InitFromAttribute(positionAttribute)) {

for (var i = 0; i < 3; ++i) {
for (let i = 0; i < 3; ++i) {
this.metadata.attributes.position.minValues[i] = posTransform.min_value(i);

@@ -153,12 +153,12 @@ }

getAttributes(decoder, dracoGeometry) {
var attributes = {};
var numPoints = dracoGeometry.num_points();
const attributes = {};
const numPoints = dracoGeometry.num_points();
for (var attributeName in DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP) {
var attributeType = this.decoderModule[attributeName];
var attributeId = decoder.GetAttributeId(dracoGeometry, attributeType);
for (const attributeName in DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP) {
const attributeType = this.decoderModule[attributeName];
const attributeId = decoder.GetAttributeId(dracoGeometry, attributeType);
if (attributeId !== -1) {
var dracoAttribute = decoder.GetAttribute(dracoGeometry, attributeId);
var {
const dracoAttribute = decoder.GetAttribute(dracoGeometry, attributeId);
const {
typedArray

@@ -177,10 +177,10 @@ } = this.getAttributeTypedArray(decoder, dracoGeometry, dracoAttribute, attributeName);

getMeshFaceIndices(decoder, dracoGeometry) {
var numFaces = dracoGeometry.num_faces();
var numIndices = numFaces * 3;
var indices = new Uint32Array(numIndices);
var dracoArray = new this.decoderModule.DracoInt32Array();
const numFaces = dracoGeometry.num_faces();
const numIndices = numFaces * 3;
const indices = new Uint32Array(numIndices);
const dracoArray = new this.decoderModule.DracoInt32Array();
for (var i = 0; i < numFaces; ++i) {
for (let i = 0; i < numFaces; ++i) {
decoder.GetFaceFromMesh(dracoGeometry, i, dracoArray);
var index = i * 3;
const index = i * 3;
indices[index] = dracoArray.GetValue(0);

@@ -196,7 +196,7 @@ indices[index + 1] = dracoArray.GetValue(1);

getMeshStripIndices(decoder, dracoGeometry) {
var dracoArray = new this.decoderModule.DracoInt32Array();
const dracoArray = new this.decoderModule.DracoInt32Array();
decoder.GetTriangleStripsFromMesh(dracoGeometry, dracoArray);
var indices = new Uint32Array(dracoArray.size());
const indices = new Uint32Array(dracoArray.size());
for (var i = 0; i < dracoArray.size(); ++i) {
for (let i = 0; i < dracoArray.size(); ++i) {
indices[i] = dracoArray.GetValue(i);

@@ -211,12 +211,12 @@ }

if (dracoAttribute.ptr === 0) {
var message = "DRACO decode bad attribute ".concat(attributeName);
const message = "DRACO decode bad attribute ".concat(attributeName);
throw new Error(message);
}
var attributeType = DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP[dracoAttribute.data_type()];
var numComponents = dracoAttribute.num_components();
var numPoints = dracoGeometry.num_points();
var numValues = numPoints * numComponents;
var dracoArray;
var typedArray;
const attributeType = DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP[dracoAttribute.data_type()];
const numComponents = dracoAttribute.num_components();
const numPoints = dracoGeometry.num_points();
const numValues = numPoints * numComponents;
let dracoArray;
let typedArray;

@@ -267,7 +267,7 @@ switch (attributeType) {

default:
var errorMsg = 'DRACO decoder: unexpected attribute type.';
const errorMsg = 'DRACO decoder: unexpected attribute type.';
throw new Error(errorMsg);
}
for (var i = 0; i < numValues; i++) {
for (let i = 0; i < numValues; i++) {
typedArray[i] = dracoArray.GetValue(i);

@@ -274,0 +274,0 @@ }

import DRACOBuilder from './draco-builder';
function encodeSync(data, options) {
var dracoBuilder = new DRACOBuilder();
const dracoBuilder = new DRACOBuilder();

@@ -6,0 +6,0 @@ try {

{
"name": "@loaders.gl/draco",
"version": "1.3.0-beta.1",
"version": "1.3.0-beta.2",
"description": "Framework-independent loader and writer for Draco compressed meshes and point clouds",

@@ -41,6 +41,6 @@ "license": "MIT",

"@babel/runtime": "^7.3.1",
"@loaders.gl/loader-utils": "1.3.0-beta.1",
"@loaders.gl/loader-utils": "1.3.0-beta.2",
"draco3d": "^1.3.4"
},
"gitHead": "deabcc69303bc19eeadb1bb6cf9082ee94e74f3e"
"gitHead": "ea8078ed5fda7d06dfaae4aed02a46ca1c181bd3"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc