|
|
1.1 ! root 1: {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;\f1\fmodern Ohlfs;} ! 2: \paperw8240 ! 3: \paperh12580 ! 4: \margl120 ! 5: \margr120 ! 6: {\colortbl;\red0\green0\blue0;} ! 7: \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b\i0\ulnone\fs36\fc0\cf0 Simple ! 8: \b0\fs24 \ ! 9: by Bill Bumgarner\ ! 10: \ ! 11: ! 12: \b Overview ! 13: \b0 \ ! 14: \ ! 15: This example demonstrates how to take advantage of many of the features provided by the 3Dkit. It does this through a subclass of N3DCamera called SimpleCamera. This class controls a very simple 3D environment featuring:\ ! 16: ! 17: \pard\tx200\tx540\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fi-920\li920\fc1\cf1 - Light Sources\ ! 18: - ambient light\ ! 19: - point light (close to the surface being lit with an intensity less than or equal to 1.0-- though light sources do accept intensities over 1.0, Pixar strongly recommends against intensity values over 1.0)\ ! 20: - Surface Shader\ ! 21: - simple matte surface, color turned off by default so that it tracks quickly on a B&W machine (the code to turn on color is included, but commented out)\ ! 22: - Shaded surface rendering. Drops to wireframe when being manipulated by the mouse. \ ! 23: - A simple scene w/a Torus (though the code to draw a teapot are included and commented out).\ ! 24: - Use of the N3DRotator class to intuitively control 3D rotations via the mouse.\ ! 25: - Saving of RIB code to a file (along with a custom "Display..." command) ! 26: \fi0\li0 \ ! 27: ! 28: \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0\cf0 \ ! 29: ! 30: \b Classes defined within Simple ! 31: \b0 \ ! 32: ! 33: \b \ ! 34: SimpleCamera\ ! 35: ! 36: \b0 The SimpleCamera is a subclass of N3DCamera (which is a subclass of the View class). SimpleCamera creates the scene, including the shader, the light sources, and the N3DRotator instance within its initFrame: method. It also specifies what surface type should be used. SimpleCamera also supports saving of RIB code to a file via that dumpRib: method that is the target of a menu item in InterfaceBuilder. SimpleCamera implements a custom mouseDown: method that tracks the mouse in a modal loop and rotates the scene via a modal loop. When tracking the mouse, SimpleCamera specifies that surfaces should be rendered as wireframe to make the mouse tracking more responsive.\ ! 37: \ ! 38: ! 39: \b SimpleShape\ ! 40: ! 41: \b0 SimpleShape is a subclass of N3DShape that implements a single method; renderSelf:, that calls RiTorus. The code needed to generate the classic teapot is also included. ! 42: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.