Skip to content

Commit

Permalink
Use DefineModule instead of CameraModule
Browse files Browse the repository at this point in the history
Former-commit-id: b7c066e
  • Loading branch information
sasha240100 committed Jun 22, 2017
1 parent 8b85613 commit b3397ca
Show file tree
Hide file tree
Showing 30 changed files with 58 additions and 58 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ You can find lots of examples at [showcases](https://whs-dev.surge.sh/examples/)
const app = new WHS.App([
new WHS.ElementModule(), // attach to DOM
new WHS.SceneModule(), // creates THREE.Scene instance
new WHS.CameraModule(), // creates PerspectiveCamera instance
new WHS.DefineModule('camera', new WHS.PerspectiveCamera()), // creates PerspectiveCamera instance
new WHS.RenderingModule() // creates WebGLRenderer instance
]);

Expand Down Expand Up @@ -185,9 +185,9 @@ Try on [**Codepen**](http://codepen.io/sasha240100/pen/JELBGX):
const app = new WHS.App([
new WHS.ElementModule(), // attach to DOM
new WHS.SceneModule(), // creates THREE.Scene instance
new WHS.CameraModule({
new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: new THREE.Vector3(0, 0, -10)
}), // creates PerspectiveCamera instance
})), // creates PerspectiveCamera instance
new WHS.RenderingModule(), // creates WebGLRenderer instance
new WHS.OrbitControlsModule() // orbit controls
]);
Expand Down Expand Up @@ -234,11 +234,11 @@ export class Application extends Component {
return (
<App modules={[
new WHS.SceneModule(),
new WHS.CameraModule({
new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: {
z: 20
}
}),
})),
new WHS.RenderingModule(),
new WHS.OrbitControlsModule()
]}>
Expand Down
4 changes: 2 additions & 2 deletions docs/data/Hello World!.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ const app = new WHS.App([
new WHS.ElementModule(),
new WHS.SceneModule(),

new WHS.CameraModule({
new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: new THREE.Vector3(0, 0, 50)
}),
})),

new WHS.RenderingModule({bgColor: 0x162129}),
new WHS.ResizeModule()
Expand Down
4 changes: 2 additions & 2 deletions docs/data/Welcome.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ const app = new WHS.App([
new WHS.ElementModule(), // Apply to DOM.
new WHS.SceneModule(), // Create a new THREE.Scene and set it to app.

new WHS.CameraModule({ // Apply a camera.
new WHS.DefineModule('camera', new WHS.PerspectiveCamera({ // Apply a camera.
position: new Vector3(0, 0, 50)
}),
})),

new WHS.RenderingModule({bgColor: 0x162129}), // Apply THREE.WebGLRenderer
new WHS.ResizeModule() // Make it resizable.
Expand Down
2 changes: 1 addition & 1 deletion examples/VRKit/basic/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const postprocessor = new WHS.PostProcessorModule();
const world = new WHS.App([
new WHS.ElementModule(),
new WHS.SceneModule(),
new WHS.CameraModule(UTILS.appDefaults.camera),
new WHS.DefineModule('camera', new WHS.PerspectiveCamera(UTILS.appDefaults.camera)),
new WHS.RenderingModule(UTILS.appDefaults.rendering, {
shadow: true
}),
Expand Down
2 changes: 1 addition & 1 deletion examples/VRKit/controls/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const postprocessor = new WHS.PostProcessorModule();
const app = new WHS.App([
new WHS.ElementModule(),
new WHS.SceneModule(),
new WHS.CameraModule(UTILS.appDefaults.camera),
new WHS.DefineModule('camera', new WHS.PerspectiveCamera(UTILS.appDefaults.camera)),
new WHS.RenderingModule(UTILS.appDefaults.rendering, {
shadow: true
}),
Expand Down
2 changes: 1 addition & 1 deletion examples/VRKit/post-processing/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const postprocessor = new WHS.PostProcessorModule();
const world = new WHS.App([
new WHS.ElementModule(),
new WHS.SceneModule(),
new WHS.CameraModule(UTILS.appDefaults.camera),
new WHS.DefineModule('camera', new WHS.PerspectiveCamera(UTILS.appDefaults.camera)),
new WHS.RenderingModule(UTILS.appDefaults.rendering, {
shadow: true
}),
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/embeded/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const world = new WHS.App([
container: document.getElementById('embed')
}),
new WHS.SceneModule(),
new WHS.CameraModule({
new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: new THREE.Vector3(0, 10, 50)
}),
})),
new WHS.RenderingModule({
bgColor: 0x162129,

Expand Down
4 changes: 2 additions & 2 deletions examples/basic/fogexp/script.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as UTILS from '../../globals';

const cameraModule = new WHS.CameraModule({
const cameraModule = new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: {
z: -30,
y: 20,
x: -20
},
far: 20000,
near: 1
});
}));

const controlsModule = new WHS.OrbitControlsModule();
const fogModule = new WHS.FogModule({color: 0xaaaaaa, near: 10, far: 200});
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/helloworld/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as UTILS from '../../globals';
const world = new WHS.App([
new WHS.ElementModule(),
new WHS.SceneModule(),
new WHS.CameraModule(UTILS.appDefaults.camera),
new WHS.DefineModule('camera', new WHS.PerspectiveCamera(UTILS.appDefaults.camera),
new WHS.RenderingModule(UTILS.appDefaults.rendering, {
shadow: true
}),
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/mouse/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const mouse = new WHS.VirtualMouseModule();
const world = new WHS.App([
new WHS.ElementModule(),
new WHS.SceneModule(),
new WHS.CameraModule({
new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: new THREE.Vector3(0, 10, 50)
}),
})),
new WHS.RenderingModule({
bgColor: 0x162129,

Expand Down
4 changes: 2 additions & 2 deletions examples/basic/threejs/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ mesh2.add(mesh3);
world.setScene(scene);

world
.module(new WHS.CameraModule({
.module(new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: new THREE.Vector3(0, 2, 12)
}))
})))
.module(new WHS.RenderingModule({
bgColor: 0x162129,

Expand Down
4 changes: 2 additions & 2 deletions examples/design/easter/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ const app = new WHS.App([
z: 0
},
}),
new WHS.CameraModule({
new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: new THREE.Vector3(-8, 5, 20),
fov: 45,
far: 2000
}),
})),
new WHS.RenderingModule({
bgColor: 0xffffff,

Expand Down
4 changes: 2 additions & 2 deletions examples/design/points/script.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const world = new WHS.App([
new WHS.ElementModule(),
new WHS.SceneModule(),
new WHS.CameraModule({
new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: new THREE.Vector3(-8, 5, 20),
far: 2000,
near: 1,
fov: 45
}),
})),
new WHS.RenderingModule({
bgColor: 0xffffff,

Expand Down
4 changes: 2 additions & 2 deletions examples/design/saturn/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ const colors = {
const world = new WHS.App([
new WHS.ElementModule(),
new WHS.SceneModule(),
new WHS.CameraModule({
new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: new THREE.Vector3(0, 100, 400),
far: 2000,
near: 1
}),
})),
new WHS.RenderingModule({
bgColor: 0x2a3340,

Expand Down
4 changes: 2 additions & 2 deletions examples/fps/shooter/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const sphere = new WHS.Sphere({ // Create sphere comonent.
const world = new WHS.App([
new WHS.ElementModule(),
new WHS.SceneModule(),
new WHS.CameraModule({
new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: new THREE.Vector3(0, 10, 50)
}),
})),
new WHS.RenderingModule({
bgColor: 0x162129,

Expand Down
4 changes: 2 additions & 2 deletions examples/lights/ambient/script.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as UTILS from '../../globals';

const cameraModule = new WHS.CameraModule({
const cameraModule = new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: {
z: -30,
y: 20,
x: -20
},
far: 20000,
near: 1
});
}));

const controlsModule = new WHS.OrbitControlsModule();

Expand Down
4 changes: 2 additions & 2 deletions examples/lights/area/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import * as UTILS from '../../globals';
const ad = UTILS.appDefaults;

const controlsModule = new WHS.OrbitControlsModule();
const cameraModule = new WHS.CameraModule({
const cameraModule = new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: {
z: 500,
y: 400
},
far: 30000,
near: 10
});
}));

const world = new WHS.App([
...UTILS.appModules({
Expand Down
4 changes: 2 additions & 2 deletions examples/lights/directional/script.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as UTILS from '../../globals';

const cameraModule = new WHS.CameraModule({
const cameraModule = new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: {
z: 50,
y: 60
},
far: 20000,
near: 1
});
}));

const controlsModule = new WHS.OrbitControlsModule();

Expand Down
4 changes: 2 additions & 2 deletions examples/lights/hemisphere/script.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as UTILS from '../../globals';

const cameraModule = new WHS.CameraModule({
const cameraModule = new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: {
z: -30,
y: 20,
x: -40
},
far: 5000,
near: 1
});
}));

const controlsModule = new WHS.OrbitControlsModule();

Expand Down
4 changes: 2 additions & 2 deletions examples/lights/point/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ const blue = 0x6666ff;
const white = 0xffffff;
const lightIntensity = 1;

const cameraModule = new WHS.CameraModule({
const cameraModule = new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: {
z: 30,
y: 40
},
far: 20000,
near: 1
});
}));

const controlsModule = new WHS.OrbitControlsModule();

Expand Down
4 changes: 2 additions & 2 deletions examples/lights/spot/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ const white = 0xffffff;
const lightIntensity = 1;
const lightDistance = 80;

const cameraModule = new WHS.CameraModule({
const cameraModule = new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: {
z: -30,
y: 20,
x: -20
},
far: 20000,
near: 1
});
}));

const controlsModule = new WHS.OrbitControlsModule();

Expand Down
4 changes: 2 additions & 2 deletions examples/performance/softbodies/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import * as UTILS from '../../globals';
const world = new WHS.App([
new WHS.ElementModule(),
new WHS.SceneModule(),
new WHS.CameraModule({
new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: new THREE.Vector3(0, 6, 18),
far: 10000
}),
})),
new WHS.RenderingModule({
bgColor: 0x162129,

Expand Down
4 changes: 2 additions & 2 deletions examples/softbody/cloth/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import * as UTILS from '../../globals';
const world = new WHS.App([
new WHS.ElementModule(),
new WHS.SceneModule(),
new WHS.CameraModule({
new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: new THREE.Vector3(0, 60, 120),
far: 10000
}),
})),
new WHS.RenderingModule({
bgColor: 0x162129,

Expand Down
4 changes: 2 additions & 2 deletions examples/softbody/cloth2/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import * as UTILS from '../../globals';
const world = new WHS.App([
new WHS.ElementModule(),
new WHS.SceneModule(),
new WHS.CameraModule({
new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: new THREE.Vector3(0, 60, 120),
far: 10000
}),
})),
new WHS.RenderingModule({
bgColor: 0x162129,

Expand Down
4 changes: 2 additions & 2 deletions examples/softbody/cloth3/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ const mouse = new WHS.VirtualMouseModule();
const world = new WHS.App([
new WHS.ElementModule(),
new WHS.SceneModule(),
new WHS.CameraModule({
new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: new THREE.Vector3(0, 60, 120),
far: 10000
}),
})),
new WHS.RenderingModule({
bgColor: 0x162129,

Expand Down
4 changes: 2 additions & 2 deletions examples/softbody/ropes/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ const mouse = new WHS.VirtualMouseModule();
const world = new WHS.App([
new WHS.ElementModule(),
new WHS.SceneModule(),
new WHS.CameraModule({
new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: new THREE.Vector3(0, 15, 60),
far: 10000
}),
})),
new WHS.RenderingModule({
bgColor: 0x162129,

Expand Down
4 changes: 2 additions & 2 deletions examples/softbody/sphere/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import * as UTILS from '../../globals';
const world = new WHS.App([
new WHS.ElementModule(),
new WHS.SceneModule(),
new WHS.CameraModule({
new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: new THREE.Vector3(0, 10, 50)
}),
})),
new WHS.RenderingModule({
bgColor: 0x162129,

Expand Down
4 changes: 2 additions & 2 deletions examples/whs-module-audio/positional/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import * as UTILS from '../../globals';

const controlsModule = new WHS.OrbitControlsModule();

const cameraModule = new WHS.CameraModule({
const cameraModule = new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
position: {
z: 250,
y: 100
},

far: 30000,
near: 1
});
}));

const world = new WHS.App([
...UTILS.appModules({
Expand Down
Loading

0 comments on commit b3397ca

Please sign in to comment.