urdf-loader
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -94,30 +94,30 @@ /* eslint-disable */ | ||
// of files | ||
const fileNames = Object.keys(files) | ||
viewer.loadingManager.setURLModifier(url => { | ||
// TODO: This won't work for paths that traverse up | ||
// and down (/example/../path/model.ply) | ||
url = url.replace(viewer.package, '') | ||
url = url.replace(/^[\.\\\/]*/, '') | ||
// keep trying a shorter path to see if it matches because the | ||
// mesh URLs in the URDF assume file structure that we don't | ||
// have access to here | ||
const split = url.split('/') | ||
while (split.length) { | ||
// find the matching file given the requested url | ||
const fileName = fileNames | ||
.filter(name => { | ||
const newurl = '/' + split.join('/') | ||
if (newurl in files) { | ||
// check if the end of file and url are the same | ||
const len = Math.min(name.length, url.length) | ||
return url.substr(url.length - len) === name.substr(name.length - len) | ||
// revoke the url after it's been used | ||
const bloburl = URL.createObjectURL(files[newurl]) | ||
requestAnimationFrame(() => URL.revokeObjectURL(bloburl)) | ||
}).pop() | ||
return bloburl | ||
} | ||
if (fileName !== undefined) { | ||
split.shift() | ||
// revoke the url after it's been used | ||
const bloburl = URL.createObjectURL(files[fileName]) | ||
requestAnimationFrame(() => URL.revokeObjectURL(bloburl)) | ||
return bloburl | ||
} | ||
return url | ||
}) | ||
@@ -124,0 +124,0 @@ |
@@ -44,3 +44,2 @@ /*eslint-disable*/ | ||
const ratio = Math.sin(time) / 2 + 0.5 | ||
} | ||
@@ -47,0 +46,0 @@ |
{ | ||
"name": "urdf-loader", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "URDF Loader for THREE.js and webcomponent viewer", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -110,2 +110,6 @@ # javascript urdf-loader [![npm version](https://badge.fury.io/js/urdf-loader.svg)](https://www.npmjs.com/package/urdf-loader) | ||
#### auto-redraw | ||
Automatically redraw the model every frame instead of waiting to be dirtied. | ||
### Properties | ||
@@ -166,13 +170,13 @@ | ||
Copyright © 2018 California Institute of Technology. ALL RIGHTS | ||
RESERVED. United States Government Sponsorship Acknowledged. Any | ||
commercial use must be negotiated with with Office of Technology | ||
Transfer at the California Institute of Technology. This software may | ||
be subject to U.S. export control laws. By accepting this software, | ||
the user agrees to comply with all applicable U.S. export laws and | ||
regulations. User has the responsibility to obtain export licenses, | ||
or other export authority as may be required before exporting such | ||
information to foreign countries or providing access to foreign | ||
RESERVED. United States Government Sponsorship Acknowledged. Any | ||
commercial use must be negotiated with with Office of Technology | ||
Transfer at the California Institute of Technology. This software may | ||
be subject to U.S. export control laws. By accepting this software, | ||
the user agrees to comply with all applicable U.S. export laws and | ||
regulations. User has the responsibility to obtain export licenses, | ||
or other export authority as may be required before exporting such | ||
information to foreign countries or providing access to foreign | ||
persons. Neither the name of Caltech nor its operating division, the | ||
Jet Propulsion Laboratory, nor the names of its contributors may be | ||
used to endorse or promote products derived from this software | ||
used to endorse or promote products derived from this software | ||
without specific prior written permission. |
@@ -41,2 +41,7 @@ // urdf-viewer element | ||
get autoRedraw() { return this.hasAttribute('auto-redraw') || false } | ||
set autoRedraw(val) { | ||
val ? this.setAttribute('auto-redraw', true) : this.removeAttribute('auto-redraw') | ||
} | ||
get angles() { | ||
@@ -126,7 +131,7 @@ const angles = {} | ||
const _do = () => { | ||
const _renderLoop = () => { | ||
if(this.parentNode) { | ||
this.updateSize() | ||
if (this._dirty) { | ||
if (this._dirty || this.autoRedraw) { | ||
this._updateEnvironment() | ||
@@ -139,3 +144,3 @@ } | ||
if (this._dirty) { | ||
if (this._dirty || this.autoRedraw) { | ||
this.renderer.render(scene, camera) | ||
@@ -145,5 +150,5 @@ this._dirty = false | ||
} | ||
this._renderLoopId = requestAnimationFrame(_do) | ||
this._renderLoopId = requestAnimationFrame(_renderLoop) | ||
} | ||
_do() | ||
_renderLoop() | ||
@@ -150,0 +155,0 @@ } |
Sorry, the diff of this file is too big to display
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
2544058
6482
181