urdf-loader
Advanced tools
Comparing version 0.10.2 to 0.10.3
{ | ||
"name": "urdf-loader", | ||
"version": "0.10.2", | ||
"version": "0.10.3", | ||
"description": "URDF Loader for THREE.js and webcomponent viewer", | ||
@@ -8,13 +8,12 @@ "main": "src/URDFLoader.js", | ||
"scripts": { | ||
"start": "concurrently --kill-others \"rollup -c -w\" \"cd .. && static-server\"", | ||
"start": "concurrently \"parcel watch ./example/*.html --out-dir ./example/dev-bundle/ --public-url . --no-cache\" \"cd .. && static-server\"", | ||
"build": "rollup -c", | ||
"build-examples": "parcel build ./example/*.html --out-dir ./example/bundle/ --public-url . --no-cache --no-source-maps --no-content-hash", | ||
"test": "jest", | ||
"lint": "eslint \"./src/*.js\" \"./test/*.js\" && tsc -p tsconfig.json --noEmit" | ||
"lint": "eslint \"./src/*.js\" \"./test/*.js\" && tsc -p tsconfig.json --noEmit", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"files": [ | ||
"src/*", | ||
"umd/*", | ||
"example/index.js", | ||
"example/dragAndDrop.js", | ||
"example/styles.css" | ||
"umd/*" | ||
], | ||
@@ -46,19 +45,19 @@ "license": "Apache-2.0", | ||
"@babel/preset-env": "^7.11.5", | ||
"@rollup/plugin-node-resolve": "^8.4.0", | ||
"@webcomponents/webcomponentsjs": "^2.4.4", | ||
"babel-jest": "^25.4.0", | ||
"concurrently": "^4.1.2", | ||
"concurrently": "^6.2.1", | ||
"eslint": "^7.10.0", | ||
"eslint-plugin-jest": "^24.1.0", | ||
"jest": "^25.4.0", | ||
"jest-cli": "^25.4.0", | ||
"jsdom": "^16.4.0", | ||
"node-fetch": "^2.6.1", | ||
"nyc": "^13.3.0", | ||
"rollup": "^2.29.0", | ||
"jest": "^27.1.1", | ||
"jest-cli": "^27.1.1", | ||
"jsdom": "^17.0.0", | ||
"node-fetch": "^3.0.0", | ||
"nyc": "^15.1.0", | ||
"parcel-bundler": "^1.12.5", | ||
"static-server": "^3.0.0", | ||
"three": "^0.119.0", | ||
"typescript": "^3.9.7" | ||
"three": "^0.135.0", | ||
"typescript": "^3.9.7", | ||
"rollup": "^2.29.0" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -9,7 +9,7 @@ # urdf-loader | ||
[Basic loader example here!](https://gkjohnson.github.io/urdf-loaders/javascript/example/simple.html) | ||
[Basic loader example here!](https://gkjohnson.github.io/urdf-loaders/javascript/example/bundle/simple.html) | ||
[VR example here!](https://gkjohnson.github.io/urdf-loaders/javascript/example/vr.html) | ||
[VR example here!](https://gkjohnson.github.io/urdf-loaders/javascript/example/bundle/vr.html) | ||
[Drag and drop web component tool here!](https://gkjohnson.github.io/urdf-loaders/javascript/example/index.html) | ||
[Drag and drop web component tool here!](https://gkjohnson.github.io/urdf-loaders/javascript/example/bundle/index.html) | ||
@@ -148,3 +148,3 @@ ![Example](/javascript/docs/javascript-example.gif) | ||
manager : LoadingManager, | ||
onComplete : ( obj : Object3D ) => void | ||
onComplete : ( obj : Object3D, err ?: Error ) => void | ||
) => void | ||
@@ -570,3 +570,3 @@ ``` | ||
Visit `localhost:9080/javascript/example/` to view the page. | ||
Visit `localhost:9080/javascript/example/dev-bundle/` to view the page. | ||
@@ -573,0 +573,0 @@ # LICENSE |
@@ -0,0 +0,0 @@ import * as THREE from 'three'; |
@@ -5,3 +5,3 @@ import { LoadingManager, Object3D } from 'three'; | ||
interface MeshLoadDoneFunc { | ||
(mesh: Object3D): void; | ||
(mesh: Object3D, err?: Error): void; | ||
} | ||
@@ -8,0 +8,0 @@ |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('three'), require('./urdf-viewer-element.js')) : | ||
typeof define === 'function' && define.amd ? define(['three', './urdf-viewer-element.js'], factory) : | ||
typeof define === 'function' && define.amd ? define(['three', './urdf-viewer-element'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.URDFManipulator = factory(global.THREE, global.URDFViewer)); | ||
@@ -9,2 +9,23 @@ }(this, (function (THREE, URDFViewer) { 'use strict'; | ||
function _interopNamespace(e) { | ||
if (e && e.__esModule) return e; | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { | ||
return e[k]; | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
n['default'] = e; | ||
return Object.freeze(n); | ||
} | ||
var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE); | ||
var URDFViewer__default = /*#__PURE__*/_interopDefaultLegacy(URDFViewer); | ||
@@ -368,3 +389,3 @@ | ||
this.highlightMaterial = | ||
new THREE.MeshPhongMaterial({ | ||
new THREE__namespace.MeshPhongMaterial({ | ||
shininess: 10, | ||
@@ -371,0 +392,0 @@ color: this.highlightColor, |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('three'), require('three/examples/jsm/controls/OrbitControls.js'), require('./URDFLoader.js')) : | ||
typeof define === 'function' && define.amd ? define(['three', 'three/examples/jsm/controls/OrbitControls.js', './URDFLoader.js'], factory) : | ||
typeof define === 'function' && define.amd ? define(['three', 'three/examples/jsm/controls/OrbitControls.js', './URDFLoader'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.URDFViewer = factory(global.THREE, global.THREE, global.URDFLoader)); | ||
@@ -9,5 +9,26 @@ }(this, (function (THREE, OrbitControls_js, URDFLoader) { 'use strict'; | ||
function _interopNamespace(e) { | ||
if (e && e.__esModule) return e; | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { | ||
return e[k]; | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
n['default'] = e; | ||
return Object.freeze(n); | ||
} | ||
var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE); | ||
var URDFLoader__default = /*#__PURE__*/_interopDefaultLegacy(URDFLoader); | ||
const tempVec2 = new THREE.Vector2(); | ||
const tempVec2 = new THREE__namespace.Vector2(); | ||
@@ -98,5 +119,5 @@ // urdf-viewer element | ||
// Scene setup | ||
const scene = new THREE.Scene(); | ||
const scene = new THREE__namespace.Scene(); | ||
const ambientLight = new THREE.HemisphereLight(this.ambientColor, '#000'); | ||
const ambientLight = new THREE__namespace.HemisphereLight(this.ambientColor, '#000'); | ||
ambientLight.groundColor.lerp(ambientLight.color, 0.5); | ||
@@ -108,3 +129,3 @@ ambientLight.intensity = 0.5; | ||
// Light setup | ||
const dirLight = new THREE.DirectionalLight(0xffffff); | ||
const dirLight = new THREE__namespace.DirectionalLight(0xffffff); | ||
dirLight.position.set(4, 10, 1); | ||
@@ -119,20 +140,20 @@ dirLight.shadow.mapSize.width = 2048; | ||
// Renderer setup | ||
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); | ||
const renderer = new THREE__namespace.WebGLRenderer({ antialias: true, alpha: true }); | ||
renderer.setClearColor(0xffffff); | ||
renderer.setClearAlpha(0); | ||
renderer.shadowMap.enabled = true; | ||
renderer.shadowMap.type = THREE.PCFSoftShadowMap; | ||
renderer.outputEncoding = THREE.sRGBEncoding; | ||
renderer.shadowMap.type = THREE__namespace.PCFSoftShadowMap; | ||
renderer.outputEncoding = THREE__namespace.sRGBEncoding; | ||
// Camera setup | ||
const camera = new THREE.PerspectiveCamera(75, 1, 0.1, 1000); | ||
const camera = new THREE__namespace.PerspectiveCamera(75, 1, 0.1, 1000); | ||
camera.position.z = -10; | ||
// World setup | ||
const world = new THREE.Object3D(); | ||
const world = new THREE__namespace.Object3D(); | ||
scene.add(world); | ||
const plane = new THREE.Mesh( | ||
new THREE.PlaneBufferGeometry(40, 40), | ||
new THREE.ShadowMaterial({ side: THREE.DoubleSide, transparent: true, opacity: 0.5 }), | ||
const plane = new THREE__namespace.Mesh( | ||
new THREE__namespace.PlaneBufferGeometry(40, 40), | ||
new THREE__namespace.ShadowMaterial({ side: THREE__namespace.DoubleSide, transparent: true, opacity: 0.5 }), | ||
); | ||
@@ -341,6 +362,6 @@ plane.rotation.x = -Math.PI / 2; | ||
const bbox = new THREE.Box3(); | ||
const bbox = new THREE__namespace.Box3(); | ||
bbox.setFromObject(this.robot); | ||
const center = bbox.getCenter(new THREE.Vector3()); | ||
const center = bbox.getCenter(new THREE__namespace.Vector3()); | ||
this.controls.target.y = center.y; | ||
@@ -357,3 +378,3 @@ this.plane.position.y = bbox.min.y - 1e-3; | ||
// simplicity -- this could be a tighter fit. | ||
const sphere = bbox.getBoundingSphere(new THREE.Sphere()); | ||
const sphere = bbox.getBoundingSphere(new THREE__namespace.Sphere()); | ||
const minmax = sphere.radius; | ||
@@ -434,5 +455,5 @@ const cam = dirLight.shadow.camera; | ||
if (m instanceof THREE.MeshBasicMaterial) { | ||
if (m instanceof THREE__namespace.MeshBasicMaterial) { | ||
m = new THREE.MeshPhongMaterial(); | ||
m = new THREE__namespace.MeshPhongMaterial(); | ||
@@ -443,3 +464,3 @@ } | ||
m.map.encoding = THREE.GammaEncoding; | ||
m.map.encoding = THREE__namespace.GammaEncoding; | ||
@@ -481,3 +502,3 @@ } | ||
let robot = null; | ||
const manager = new THREE.LoadingManager(); | ||
const manager = new THREE__namespace.LoadingManager(); | ||
manager.onLoad = () => { | ||
@@ -484,0 +505,0 @@ |
@@ -7,2 +7,24 @@ (function (global, factory) { | ||
function _interopNamespace(e) { | ||
if (e && e.__esModule) return e; | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { | ||
return e[k]; | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
n['default'] = e; | ||
return Object.freeze(n); | ||
} | ||
var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE); | ||
class URDFBase extends THREE.Object3D { | ||
@@ -429,4 +451,4 @@ | ||
const tempQuaternion = new THREE.Quaternion(); | ||
const tempEuler = new THREE.Euler(); | ||
const tempQuaternion = new THREE__namespace.Quaternion(); | ||
const tempEuler = new THREE__namespace.Euler(); | ||
@@ -462,3 +484,3 @@ // take a vector "x y z" and process it into | ||
this.manager = manager || THREE.DefaultLoadingManager; | ||
this.manager = manager || THREE__namespace.DefaultLoadingManager; | ||
this.loadMeshCb = this.defaultMeshLoader.bind(this); | ||
@@ -491,3 +513,3 @@ this.parseVisual = true; | ||
const manager = this.manager; | ||
const workingPath = THREE.LoaderUtils.extractUrlBase(urdf); | ||
const workingPath = THREE__namespace.LoaderUtils.extractUrlBase(urdf); | ||
const urdfPath = this.manager.resolveURL(urdf); | ||
@@ -793,3 +815,3 @@ | ||
const axisXYZ = axisNode.getAttribute('xyz').split(/\s+/g).map(num => parseFloat(num)); | ||
obj.axis = new THREE.Vector3(axisXYZ[0], axisXYZ[1], axisXYZ[2]); | ||
obj.axis = new THREE__namespace.Vector3(axisXYZ[0], axisXYZ[1], axisXYZ[2]); | ||
obj.axis.normalize(); | ||
@@ -866,3 +888,3 @@ | ||
const matNodes = [ ...node.children ]; | ||
const material = new THREE.MeshPhongMaterial(); | ||
const material = new THREE__namespace.MeshPhongMaterial(); | ||
@@ -893,3 +915,3 @@ material.name = node.getAttribute('name') || ''; | ||
const loader = new THREE.TextureLoader(manager); | ||
const loader = new THREE__namespace.TextureLoader(manager); | ||
const filePath = resolvePath(filename); | ||
@@ -931,3 +953,3 @@ material.map = loader.load(filePath); | ||
material = new THREE.MeshPhongMaterial(); | ||
material = new THREE__namespace.MeshPhongMaterial(); | ||
@@ -969,3 +991,3 @@ } | ||
if (obj instanceof THREE.Mesh) { | ||
if (obj instanceof THREE__namespace.Mesh) { | ||
@@ -991,4 +1013,4 @@ obj.material = material; | ||
const primitiveModel = new THREE.Mesh(); | ||
primitiveModel.geometry = new THREE.BoxBufferGeometry(1, 1, 1); | ||
const primitiveModel = new THREE__namespace.Mesh(); | ||
primitiveModel.geometry = new THREE__namespace.BoxBufferGeometry(1, 1, 1); | ||
primitiveModel.material = material; | ||
@@ -1003,4 +1025,4 @@ | ||
const primitiveModel = new THREE.Mesh(); | ||
primitiveModel.geometry = new THREE.SphereBufferGeometry(1, 30, 30); | ||
const primitiveModel = new THREE__namespace.Mesh(); | ||
primitiveModel.geometry = new THREE__namespace.SphereBufferGeometry(1, 30, 30); | ||
primitiveModel.material = material; | ||
@@ -1015,4 +1037,4 @@ | ||
const primitiveModel = new THREE.Mesh(); | ||
primitiveModel.geometry = new THREE.CylinderBufferGeometry(1, 1, 1, 30); | ||
const primitiveModel = new THREE__namespace.Mesh(); | ||
primitiveModel.geometry = new THREE__namespace.CylinderBufferGeometry(1, 1, 1, 30); | ||
primitiveModel.material = material; | ||
@@ -1057,3 +1079,3 @@ | ||
loader.load(path, geom => { | ||
const mesh = new THREE.Mesh(geom, new THREE.MeshPhongMaterial()); | ||
const mesh = new THREE__namespace.Mesh(geom, new THREE__namespace.MeshPhongMaterial()); | ||
done(mesh); | ||
@@ -1060,0 +1082,0 @@ }); |
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
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
262270
15
2833