@gltf-transform/core
Advanced tools
Comparing version 0.0.12 to 0.0.13
@@ -106,11 +106,21 @@ 'use strict'; | ||
var start = (bufferView.byteOffset || 0) + (accessor.byteOffset || 0); | ||
var elementSize; | ||
var data; | ||
switch (accessor.componentType) { | ||
case AccessorComponentType.FLOAT: | ||
return new Float32Array(resource, start, accessor.count * valueSize); | ||
elementSize = Float32Array.BYTES_PER_ELEMENT; | ||
data = resource.slice(start, start + accessor.count * valueSize * elementSize); | ||
return new Float32Array(data); | ||
case AccessorComponentType.UNSIGNED_INT: | ||
return new Uint32Array(resource, start, accessor.count * valueSize); | ||
elementSize = Uint32Array.BYTES_PER_ELEMENT; | ||
data = resource.slice(start, start + accessor.count * valueSize * elementSize); | ||
return new Uint32Array(data); | ||
case AccessorComponentType.UNSIGNED_SHORT: | ||
return new Uint16Array(resource, start, accessor.count * valueSize); | ||
elementSize = Uint16Array.BYTES_PER_ELEMENT; | ||
data = resource.slice(start, start + accessor.count * valueSize * elementSize); | ||
return new Uint16Array(data); | ||
case AccessorComponentType.UNSIGNED_BYTE: | ||
return new Uint8Array(resource, start, accessor.count * valueSize); | ||
elementSize = Uint8Array.BYTES_PER_ELEMENT; | ||
data = resource.slice(start, start + accessor.count * valueSize * elementSize); | ||
return new Uint8Array(data); | ||
default: | ||
@@ -155,3 +165,3 @@ throw new Error("Accessor componentType " + accessor.componentType + " not implemented."); | ||
Logger.prototype.info = function (text) { | ||
if (this.verbosity <= exports.LoggerVerbosity.INFO) { | ||
if (this.verbosity >= exports.LoggerVerbosity.INFO) { | ||
console.log(this.name + ": " + text); | ||
@@ -165,3 +175,3 @@ } | ||
Logger.prototype.warn = function (text) { | ||
if (this.verbosity <= exports.LoggerVerbosity.WARNING) { | ||
if (this.verbosity >= exports.LoggerVerbosity.WARNING) { | ||
console.warn(this.name + ": " + text); | ||
@@ -175,3 +185,3 @@ } | ||
Logger.prototype.error = function (text) { | ||
if (this.verbosity <= exports.LoggerVerbosity.ERROR) { | ||
if (this.verbosity >= exports.LoggerVerbosity.ERROR) { | ||
console.error(this.name + ": " + text); | ||
@@ -178,0 +188,0 @@ } |
@@ -102,11 +102,21 @@ var AccessorType = { | ||
var start = (bufferView.byteOffset || 0) + (accessor.byteOffset || 0); | ||
var elementSize; | ||
var data; | ||
switch (accessor.componentType) { | ||
case AccessorComponentType.FLOAT: | ||
return new Float32Array(resource, start, accessor.count * valueSize); | ||
elementSize = Float32Array.BYTES_PER_ELEMENT; | ||
data = resource.slice(start, start + accessor.count * valueSize * elementSize); | ||
return new Float32Array(data); | ||
case AccessorComponentType.UNSIGNED_INT: | ||
return new Uint32Array(resource, start, accessor.count * valueSize); | ||
elementSize = Uint32Array.BYTES_PER_ELEMENT; | ||
data = resource.slice(start, start + accessor.count * valueSize * elementSize); | ||
return new Uint32Array(data); | ||
case AccessorComponentType.UNSIGNED_SHORT: | ||
return new Uint16Array(resource, start, accessor.count * valueSize); | ||
elementSize = Uint16Array.BYTES_PER_ELEMENT; | ||
data = resource.slice(start, start + accessor.count * valueSize * elementSize); | ||
return new Uint16Array(data); | ||
case AccessorComponentType.UNSIGNED_BYTE: | ||
return new Uint8Array(resource, start, accessor.count * valueSize); | ||
elementSize = Uint8Array.BYTES_PER_ELEMENT; | ||
data = resource.slice(start, start + accessor.count * valueSize * elementSize); | ||
return new Uint8Array(data); | ||
default: | ||
@@ -152,3 +162,3 @@ throw new Error("Accessor componentType " + accessor.componentType + " not implemented."); | ||
Logger.prototype.info = function (text) { | ||
if (this.verbosity <= LoggerVerbosity.INFO) { | ||
if (this.verbosity >= LoggerVerbosity.INFO) { | ||
console.log(this.name + ": " + text); | ||
@@ -162,3 +172,3 @@ } | ||
Logger.prototype.warn = function (text) { | ||
if (this.verbosity <= LoggerVerbosity.WARNING) { | ||
if (this.verbosity >= LoggerVerbosity.WARNING) { | ||
console.warn(this.name + ": " + text); | ||
@@ -172,3 +182,3 @@ } | ||
Logger.prototype.error = function (text) { | ||
if (this.verbosity <= LoggerVerbosity.ERROR) { | ||
if (this.verbosity >= LoggerVerbosity.ERROR) { | ||
console.error(this.name + ": " + text); | ||
@@ -175,0 +185,0 @@ } |
@@ -108,11 +108,21 @@ (function (global, factory) { | ||
var start = (bufferView.byteOffset || 0) + (accessor.byteOffset || 0); | ||
var elementSize; | ||
var data; | ||
switch (accessor.componentType) { | ||
case AccessorComponentType.FLOAT: | ||
return new Float32Array(resource, start, accessor.count * valueSize); | ||
elementSize = Float32Array.BYTES_PER_ELEMENT; | ||
data = resource.slice(start, start + accessor.count * valueSize * elementSize); | ||
return new Float32Array(data); | ||
case AccessorComponentType.UNSIGNED_INT: | ||
return new Uint32Array(resource, start, accessor.count * valueSize); | ||
elementSize = Uint32Array.BYTES_PER_ELEMENT; | ||
data = resource.slice(start, start + accessor.count * valueSize * elementSize); | ||
return new Uint32Array(data); | ||
case AccessorComponentType.UNSIGNED_SHORT: | ||
return new Uint16Array(resource, start, accessor.count * valueSize); | ||
elementSize = Uint16Array.BYTES_PER_ELEMENT; | ||
data = resource.slice(start, start + accessor.count * valueSize * elementSize); | ||
return new Uint16Array(data); | ||
case AccessorComponentType.UNSIGNED_BYTE: | ||
return new Uint8Array(resource, start, accessor.count * valueSize); | ||
elementSize = Uint8Array.BYTES_PER_ELEMENT; | ||
data = resource.slice(start, start + accessor.count * valueSize * elementSize); | ||
return new Uint8Array(data); | ||
default: | ||
@@ -157,3 +167,3 @@ throw new Error("Accessor componentType " + accessor.componentType + " not implemented."); | ||
Logger.prototype.info = function (text) { | ||
if (this.verbosity <= exports.LoggerVerbosity.INFO) { | ||
if (this.verbosity >= exports.LoggerVerbosity.INFO) { | ||
console.log(this.name + ": " + text); | ||
@@ -167,3 +177,3 @@ } | ||
Logger.prototype.warn = function (text) { | ||
if (this.verbosity <= exports.LoggerVerbosity.WARNING) { | ||
if (this.verbosity >= exports.LoggerVerbosity.WARNING) { | ||
console.warn(this.name + ": " + text); | ||
@@ -177,3 +187,3 @@ } | ||
Logger.prototype.error = function (text) { | ||
if (this.verbosity <= exports.LoggerVerbosity.ERROR) { | ||
if (this.verbosity >= exports.LoggerVerbosity.ERROR) { | ||
console.error(this.name + ": " + text); | ||
@@ -180,0 +190,0 @@ } |
{ | ||
"name": "@gltf-transform/core", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"repository": "github:donmccurdy/glTF-Transform", | ||
@@ -28,3 +28,3 @@ "description": "JavaScript and TypeScript utilities for processing glTF 3D models", | ||
], | ||
"gitHead": "b5e5cae4c31f011ea5b6776762611ca2b54004ba" | ||
"gitHead": "307e9d15746e9125f4377ad65433619e44448429" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
157898
3791
24