|
1 | 1 | ## The "Camera" and the Projection and View Transforms |
2 | 2 |
|
3 | | -The `Scene3D` class has a concept of a "projection transform" and a "view transform". If we use the concept of a "camera", the projection is like setting the camera's focus and lens, and the view transform is like setting its position and orientation. `Scene3D` has methods for setting all these attributes of this abstract "camera". Two of them are `setPerspective()` and `setLookAt(), which are shown in the example below. |
| 3 | +The `Scene3D` class has a concept of a "projection transform" and a "view transform". If we use the concept of a "camera", the projection is like setting the camera's focus and lens, and the view transform is like setting its position and orientation. `Scene3D` has methods for setting all these attributes of this abstract "camera". Two of them are `setPerspective()` and `setLookAt()`, which are shown in the example below. |
4 | 4 |
|
5 | | - // Set the perspective view. Camera has a 45-degree field of view |
6 | | - // and will see objects from 0.1 to 100 units away. |
7 | | - scene.setPerspective(45,scene.getAspect(),0.1,100); |
8 | | - // Move the camera back 40 units. |
9 | | - scene.setLookAt([0,0,40]); |
10 | | - // Move the camera back 30 units instead, and turn it so it |
11 | | - // points at (0, 2, 0), that is, up 2 units. |
12 | | - scene.setLookAt([0,0,30], [0,2,0]); |
| 5 | + // Set the perspective view. Camera has a 45-degree field of view |
| 6 | + // and will see objects from 0.1 to 100 units away. |
| 7 | + scene.setPerspective(45,scene.getAspect(),0.1,100); |
| 8 | + // Move the camera back 40 units. |
| 9 | + scene.setLookAt([0,0,40]); |
| 10 | + // Move the camera back 30 units instead, and turn it so it |
| 11 | + // points at (0, 2, 0), that is, up 2 units. |
| 12 | + scene.setLookAt([0,0,30], [0,2,0]); |
13 | 13 |
|
14 | 14 | In 3D graphics, the two most commonly used projections are the perspective projection and the orthographic projection. Both are described in detail below. |
15 | 15 |
|
|
0 commit comments