Skip to content

Commit add5031

Browse files
authored
Merge pull request #95 from rdeits/rd/roll-back-threejs
Roll back three.js to fix camera animation issues
2 parents 9b63c6b + f6dc3a9 commit add5031

File tree

5 files changed

+32
-21
lines changed

5 files changed

+32
-21
lines changed

dist/main.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
"ccapture.js": "aceslowman/ccapture.js#npm-fix",
1414
"dat.gui": "^0.7.7",
1515
"msgpack-lite": "^0.1.26",
16-
"three": "^0.131.1",
17-
"three-wtm": "^1.0",
18-
"wwobjloader2": "^4.0"
16+
"three": "0.122"
1917
},
2018
"scripts": {
2119
"build": "webpack"

src/index.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ var THREE = require('three');
22
var msgpack = require('msgpack-lite');
33
var dat = require('dat.gui').default; // TODO: why is .default needed?
44
import {BufferGeometryUtils} from 'three/examples/jsm/utils/BufferGeometryUtils.js';
5-
import {OBJLoader2, MtlObjBridge} from 'wwobjloader2'
5+
import {OBJLoader2} from 'three/examples/jsm/loaders/OBJLoader2.js';
66
import {ColladaLoader} from 'three/examples/jsm/loaders/ColladaLoader.js';
77
import {MTLLoader} from 'three/examples/jsm/loaders/MTLLoader.js';
8+
import {MtlObjBridge} from 'three/examples/jsm/loaders/obj2/bridge/MtlObjBridge.js';
89
import {STLLoader} from 'three/examples/jsm/loaders/STLLoader.js';
910
import {OrbitControls} from 'three/examples/jsm/controls/OrbitControls.js';
1011
require('ccapture.js');
@@ -20,7 +21,7 @@ function merge_geometries(object, preserve_materials = false) {
2021
function collectGeometries(node, parent_transform) {
2122
let transform = parent_transform.clone().multiply(node.matrix);
2223
if (node.type==='Mesh') {
23-
node.geometry.applyMatrix4(transform);
24+
node.geometry.applyMatrix(transform);
2425
geometries.push(node.geometry);
2526
materials.push(node.material);
2627
}
@@ -175,7 +176,7 @@ class ExtensibleObjectLoader extends THREE.ObjectLoader {
175176
let mtl_loader = new MTLLoader(manager);
176177
let mtl_parse_result = mtl_loader.parse(json.mtl_library + "\n", "");
177178
let materials = MtlObjBridge.addMaterialsFromMtlLoader(mtl_parse_result);
178-
loader.setMaterials(materials);
179+
loader.addMaterials(materials);
179180
this.onTextureLoad();
180181
}
181182
let obj = loader.parse(json.data + "\n", path);
@@ -628,7 +629,8 @@ class Animator {
628629
this.progress = 0;
629630
for (let animation of animations) {
630631
let target = this.viewer.scene_tree.find(animation.path).object;
631-
let clip = Object.values(this.loader.parseAnimations([animation.clip]))[0];
632+
let animations = this.loader.parseAnimations([animation.clip]);
633+
let clip = Object.values(animations)[0];
632634
let action = this.mixer.clipAction(clip, target);
633635
action.clampWhenFinished = options.clampWhenFinished;
634636
action.setLoop(options.loopMode, options.repetitions);

test/animation.html

+21-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<div id="meshcat-pane">
99
</div>
1010

11-
<script src="main.min.js"></script>
11+
<script src="main.js"></script>
1212

1313
<script>
1414

@@ -37,7 +37,26 @@
3737
}]
3838
}]
3939
}
40-
},{
40+
},
41+
{
42+
path: "/Cameras/default/rotated/<object>",
43+
clip: {
44+
fps: 30,
45+
name: "default",
46+
tracks: [{
47+
name: ".zoom",
48+
type: "number",
49+
keys: [{
50+
time: 0,
51+
value: 1
52+
},{
53+
time: 80,
54+
value: 0.5
55+
}]
56+
}]
57+
}
58+
},
59+
{
4160
path: "/meshcat/boxes",
4261
clip: {
4362
fps: 30,

yarn.lock

+3-11
Original file line numberDiff line numberDiff line change
@@ -633,13 +633,9 @@ terser@^5.7.0:
633633
source-map "~0.7.2"
634634
source-map-support "~0.5.19"
635635

636-
three-wtm@^1.0:
637-
version "1.0.0"
638-
resolved "https://registry.yarnpkg.com/three-wtm/-/three-wtm-1.0.0.tgz#715d1317096de15b87313856befc719c176246d3"
639-
640-
three@^0.131.1:
641-
version "0.131.1"
642-
resolved "https://registry.yarnpkg.com/three/-/three-0.131.1.tgz#c7d35213a0ec5c3ee28316221ecdf2c18d1140a0"
636+
637+
version "0.122.0"
638+
resolved "https://registry.yarnpkg.com/three/-/three-0.122.0.tgz#bd9ed8a8820074856e8ba7b63fe0a65176e01aeb"
643639

644640
uri-js@^4.2.2:
645641
version "4.4.1"
@@ -725,10 +721,6 @@ wildcard@^2.0.0:
725721
version "2.0.0"
726722
resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec"
727723

728-
wwobjloader2@^4.0:
729-
version "4.0.0"
730-
resolved "https://registry.yarnpkg.com/wwobjloader2/-/wwobjloader2-4.0.0.tgz#61304b2e09db66094a813c156c444af5718e143f"
731-
732724
yocto-queue@^0.1.0:
733725
version "0.1.0"
734726
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"

0 commit comments

Comments
 (0)