To set up a perspective scene in JSL, send the Perspective command to a display list.
where angle is the viewing angle, near is the distance to the near plane, and far is the distance to the far plane, as illustrated in the drawing above. A couple of things need to be remembered when defining the viewing space.
•
|
Items outside the viewing space (for example, closer than the near plane or farther than the far plane) are not drawn. They are clipped off.
|
•
|
The ratio of far to near needs to be small so that the rendering engine can effectively determine which items should be drawn “on top of” other items, simulating closeness of items. The near argument must be greater than zero.
|
The viewing angle functions in the same way as a wide angle or telephoto lens on a camera. Small viewing angles zoom into a drawing, while wide angles zoom out. In other words, a small viewing angle maps the screen space onto a small portion of the scene, resulting in apparently larger scene elements. A large viewing angle maps the screen space onto a large portion of the scene, resulting in apparently small screen elements. The size of scene elements can therefore be manipulated using the angle argument of the Perspective function. The picture here shows the hello world script with perspective angles of 45 and 90 degrees.
图 13.6 Changing the Perspective
As an alternative to the Perspective command, you can define the actual viewing frustum with the Frustum command.
The frustum's viewing volume is defined by (left, bottom, near) and (right, top, near) which specify the (x, y, z) coordinates of the lower left and upper right corners of the near clipping plane; near and far give the distances from the viewpoint to the near and far clipping planes.