Skip to content

Commit 47c7586

Browse files
committed
modify some demos
1 parent 2e38162 commit 47c7586

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ Examples
6262
// Create the 3D scene; find the HTML canvas and pass it
6363
// to Scene3D.
6464
var scene=new Scene3D(document.getElementById("canvas"));
65-
// Set the perspective view. Camera has a 45-degree field of view
66-
// and will see objects from 0.1 to 100 units away.
67-
scene.setPerspective(45,scene.getClientAspect(),0.1,100);
68-
// Move the camera back 40 units.
69-
scene.setLookAt([0,0,40]);
7065
// Create a box mesh 10 units in width, 20 units
7166
// in height, and 20 units in depth
7267
var mesh=Meshes.createBox(10,10,10);
@@ -80,6 +75,11 @@ Examples
8075
var timer={};
8176
// Set up the render loop
8277
GLUtil.renderLoop(function(time){
78+
// Set the perspective view. Camera has a 45-degree field of view
79+
// and will see objects from 0.1 to 100 units away.
80+
scene.setPerspective(45,scene.getClientAspect(),0.1,100);
81+
// Move the camera back 40 units.
82+
scene.setLookAt([0,0,40]);
8383
// Adjust x-rotation
8484
rotation[0]=360*GLUtil.getTimePosition(timer,time,6000);
8585
// Adjust y-rotation

demos/simple.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@
2222
// Create the 3D scene; find the HTML canvas and pass it
2323
// to Scene3D.
2424
var scene=new Scene3D(document.getElementById("canvas"));
25-
// Set the perspective view. Camera has a 45-degree field of view
26-
// and will see objects from 0.1 to 100 units away.
27-
scene.setPerspective(45,scene.getClientAspect(),0.1,100);
28-
// Move the camera back 40 units.
29-
scene.setLookAt([0,0,40]);
3025
// Create a box mesh 10 units in size
3126
var mesh=Meshes.createBox(10,20,20);
3227
// Create a shape based on the mesh and give it a red color
@@ -39,6 +34,11 @@
3934
var timer={};
4035
// Set up the render loop
4136
GLUtil.renderLoop(function(time){
37+
// Set the perspective view. Camera has a 45-degree field of view
38+
// and will see objects from 0.1 to 100 units away.
39+
scene.setPerspective(45,scene.getClientAspect(),0.1,100);
40+
// Move the camera back 40 units.
41+
scene.setLookAt([0,0,40]);
4242
// Adjust x-rotation
4343
rotation[0]=360*GLUtil.getTimePosition(timer,time,6000);
4444
// Adjust y-rotation

demos/starfield.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@
6565
.cullFace(Scene3D.BACK);
6666
var fc=new FrameCounterDiv(scene)
6767
var timer={};
68-
scene.setPerspective(45,scene.getClientAspect(),5,1000).setLookAt([0,0,500]);
6968
var group=starField(scene,1000)
7069
scene.addShape(group);
7170
GLUtil.renderLoop(function(time){
71+
scene.setPerspective(45,scene.getClientAspect(),5,1000).setLookAt([0,0,500]);
7272
moveStarField(group,1000,GLUtil.newFrames(timer,time))
7373
fc.update()
7474
scene.render();

demos/tris.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,10 @@
111111
// to Scene3D.
112112
var scene=new Scene3D(document.getElementById("canvas"));
113113
scene.disableLighting()
114-
// Set the perspective view. Camera has a 45-degree field of view
115-
// and will see objects from 0.1 to 100 units away.
116-
scene.setOrtho(0,scene.getWidth(),scene.getHeight(),0,-2,2);
117114
var tris=new TriangleParticles(scene,200);
118115
// Set up the render loop
119116
GLUtil.renderLoop(function(time){
117+
scene.setOrtho(0,scene.getWidth(),scene.getHeight(),0,-2,2);
120118
tris.update(time);
121119
// Render the scene
122120
scene.render();

tutorials/camera.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ orthographic projection, described below.
4444
A perspective projection gives the 3D scene a sense of depth. In this projection, closer objects
4545
look bigger than more distant objects with the same size.
4646

47+
The perspective projection is similar to how our eyes see the world.
48+
4749
![Two rows of spheres, and a drawing of a perspective view volume.](persp1.png)
4850

4951
![Two rows of spheres, and a side drawing of a perspective view volume.](persp2.png)

0 commit comments

Comments
 (0)