|
|
Sample Programs from NeXSTEP 3.3
{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;\f1\fmodern Ohlfs;}
\paperw8240
\paperh12580
\margl120
\margr120
{\colortbl;\red0\green0\blue0;}
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b\i0\ulnone\fs36\fc0\cf0 Simple
\b0\fs24 \
by Bill Bumgarner\
\
\b Overview
\b0 \
\
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:\
\pard\tx200\tx540\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fi-920\li920\fc1\cf1 - Light Sources\
- ambient light\
- 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)\
- Surface Shader\
- 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)\
- Shaded surface rendering. Drops to wireframe when being manipulated by the mouse. \
- A simple scene w/a Torus (though the code to draw a teapot are included and commented out).\
- Use of the N3DRotator class to intuitively control 3D rotations via the mouse.\
- Saving of RIB code to a file (along with a custom "Display..." command)
\fi0\li0 \
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0\cf0 \
\b Classes defined within Simple
\b0 \
\b \
SimpleCamera\
\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.\
\
\b SimpleShape\
\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.
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.