Skip to content

Commit a87516e

Browse files
authored
Merge pull request #246 from WhitestormJS/#242
#242 Update Three.js to r85
2 parents c329030 + 394f058 commit a87516e

File tree

7 files changed

+843
-829
lines changed

7 files changed

+843
-829
lines changed

examples/assets/vendor/three.min.js

Lines changed: 808 additions & 799 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/design/easter/script.js

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const world = new WHS.App([
2929
new WHS.ResizeModule()
3030
]);
3131

32-
3332
// world.$camera.lookAt(new THREE.Vector3(0, 0, 0));
3433

3534
// Start rendering.
@@ -48,7 +47,7 @@ new WHS.Box({
4847
],
4948

5049
material: new THREE.MeshPhongMaterial({
51-
color: 0xffffff,
50+
color: 0xffffff
5251
}),
5352

5453
position: {
@@ -58,14 +57,12 @@ new WHS.Box({
5857
}
5958
}).addTo(world);
6059

61-
const egg = new WHS.Model({
62-
geometry: {
63-
path: `${process.assetsPath}/models/easter/egg_light.json`,
64-
},
60+
const egg = new WHS.Importer({
61+
url: `${process.assetsPath}/models/easter/egg_light.json`,
6562

6663
modules: [
6764
new PHYSICS.ConvexModule({
68-
path: `${process.assetsPath}/models/easter/egg_low.json`,
65+
path: `${process.assetsPath}/models/easter/egg_low.json`
6966
}),
7067
new WHS.TextureModule({
7168
url: `${process.assetsPath}/textures/easter/egg1.jpg`
@@ -90,10 +87,8 @@ const egg = new WHS.Model({
9087
}
9188
});
9289

93-
const rabbit = new WHS.Model({
94-
geometry: {
95-
path: `${process.assetsPath}/models/easter/rabbit.json`
96-
},
90+
const rabbit = new WHS.Importer({
91+
url: `${process.assetsPath}/models/easter/rabbit.json`,
9792

9893
modules: [
9994
new PHYSICS.ConcaveModule({
@@ -102,11 +97,6 @@ const rabbit = new WHS.Model({
10297
})
10398
],
10499

105-
material: new THREE.MeshLambertMaterial({
106-
side: THREE.DoubleSide,
107-
shading: THREE.SmoothShading
108-
}),
109-
110100
position: {
111101
y: 5,
112102
x: -3
@@ -119,7 +109,7 @@ const rabbit = new WHS.Model({
119109
scale: [0.5, 0.5, 0.5]
120110
});
121111

122-
rabbit.addTo(world, 'wait');
112+
rabbit.addTo(world);
123113

124114
new WHS.SpotLight({
125115
light: {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"version": "gulp build --prod && git add .",
99
"test": "xo ./src/**/*.js && jest",
1010
"start": "webpack-dashboard -t WhitestormJS -- gulp dev",
11+
"start:physics": "webpack-dashboard -t WhitestormJS -- gulp dev --devPhysics 8001",
1112
"build": "gulp build & gulp examples:build",
1213
"deploy": "surge --project ./ --domain whs-dev.surge.sh"
1314
},

src/components/meshes/Importer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
Mesh,
3-
MultiMaterial,
43
JSONLoader
54
} from 'three';
65

@@ -21,7 +20,7 @@ class Importer extends MeshComponent {
2120
useCustomMaterial: false,
2221

2322
parser(geometry, materials) {
24-
return new Mesh(geometry, new MultiMaterial(materials));
23+
return new Mesh(geometry, materials);
2524
}
2625
};
2726

src/core/MeshComponent.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,21 @@ class MeshComponent extends Component {
8989

9090
wrap() {
9191
return new Promise(resolve => {
92-
this.defer(() => {
93-
const {position, rotation, scale, shadow} = this.params;
92+
// TODO: Fix defer with physics
93+
// this.defer(() => {
94+
const {position, rotation, scale, shadow} = this.params;
9495

95-
this.position.set(position.x, position.y, position.z);
96-
this.rotation.set(rotation.x, rotation.y, rotation.z);
97-
this.scale.set(scale.x, scale.y, scale.z);
96+
this.position.set(position.x, position.y, position.z);
97+
this.rotation.set(rotation.x, rotation.y, rotation.z);
98+
this.scale.set(scale.x, scale.y, scale.z);
9899

99-
this.native.castShadow = shadow.cast;
100-
this.native.receiveShadow = shadow.receive;
100+
this.native.castShadow = shadow.cast;
101+
this.native.receiveShadow = shadow.receive;
101102

102-
this.applyBridge({onWrap: 1});
103+
this.applyBridge({onWrap: 1});
103104

104-
resolve(this);
105-
});
105+
resolve(this);
106+
// });
106107
});
107108
}
108109

src/deprecation.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import {Importer} from './components/meshes/Importer';
2+
3+
export class Model extends Importer {
4+
constructor(params, ...additional) {
5+
console.warn('Model is deprecated. Use Importer instead.');
6+
7+
if (params.geometry) {
8+
params.url = params.geometry.path;
9+
params.loader = params.geometry.loader;
10+
}
11+
12+
super(params, ...additional);
13+
}
14+
}

src/modules/mesh/TextureModule.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const loader = new TextureLoader();
1111

1212
export class TextureModule {
1313
static load(url) {
14-
return new TextureModule({url}).texture;
14+
return new TextureModule({url}).textures[0][1];
1515
}
1616

1717
textures = [];

0 commit comments

Comments
 (0)