home *** CD-ROM | disk | FTP | other *** search
-
- /*
- Copyright (c) 1991, 1992 by NeXT Computer, Inc as an unpublished work.
- All rights reserved.
-
- */
-
- #import "N3DShape.h"
- #import "next3d.h"
- #import <appkit/View.h>
- #import <appkit/color.h>
- #import <objc/List.h>
- #import <ri/ri.h>
-
- @interface N3DCamera : View
- {
- unsigned int globalWindowNum; /* the server global window number */
- RtToken windowResource; /* the resource ID of our window */
- N3DProjectionType projectionType; /* perpective or orthographic */
- RtToken contextToken; /* the RMan name for the context */
- id worldShape; /* top of shape hierarchy */
- List *lightList; /* list of global N3DLights */
- id delegate; /* get called when frames are done */
- NXColor backgroundColor; /* color of rectangle under RIB */
- N3DHider hider;
-
- struct _cameraFlags {
- unsigned int degenerate : 1; /* view is 0 width or height */
- unsigned int windowChanged : 1; /* the window changed */
- unsigned int needsWindow : 1;
- unsigned int basisChanged : 1; /* basis changed w.r.t. world coords */
- unsigned int canRender : 1; /* rendering legal */
- unsigned int usePreTM : 1; /* pre-multiply the ct */
- unsigned int doFlush : 1; /* Flush at FrameEnd? */
- unsigned int inWorldBlock : 1; /* inside a World{Begin,End} block ? */
- unsigned int drawBackground : 1; /* draw bkgnd each drawSelf? */
-
- /* private flags */
- unsigned int _computeAspect : 1; /* user-supplied aspect? */
- unsigned int _computeSWindow : 1; /* user-supplied aspect? */
- unsigned int _reserved : 21;
- } cameraFlags;
-
- struct _projectionRectangle {
- float l, r, t, b;
- } projectionRectangle;
-
- RtPoint eyePoint, viewPoint; /* view vector */
- float rollAngle; /* neg. rot. about uBasis */
- float fov;
- float pixelAspectRatio;
- float nearPlane, farPlane;
- RtPoint sBasis, tBasis, uBasis; /* basis w.r.t. world space */
-
- RtMatrix preTransform; /* pre-multiply the camera matrix by
- this matrix, if desired (cache for
- above object) */
- RtMatrix transform; /* world-to-eye transformation:
- ct = Te . R, Te translates eye
- point to origin, R rotates view
- vector, V = view - eye, such
- that it is parallel with the
- z-axis, and rotates the resulting
- vector about the z-axis by
- -rollAngle. */
-
- char *_printribfile; // rib file generated during printing
- id _contextManager; // context manager for the app
- List *_selList;
- void *_N3Dprivate;
- }
-
- - init;
- - initFrame:(const NXRect *)fRect;
- - free;
-
- /* frame and view management methods */
- - (BOOL)lockFocus;
- - unlockFocus;
- - setFlushRIB:(BOOL)flag;
- - (BOOL)doesFlushRIB;
- - flushRIB;
-
- - drawPS:(NXRect *)rects :(int)nRects;
- - drawSelf:(const NXRect *)rects :(int)nRects;
- - render;
- - renderSelf:(RtToken)context;
- - worldBegin:(RtToken)context;
- - worldEnd:(RtToken)context;
- - copyRIBCode:(NXStream *)stream;
- - setBackgroundColor:(NXColor)c;
- - (NXColor)backgroundColor;
- - setDrawBackgroundColor:(BOOL)flag;
- - (BOOL)doesDrawBackgroundColor;
- - setFrame:(const NXRect *)fRect;
- - moveTo:(NXCoord)x :(NXCoord)y;
- - moveBy:(NXCoord)deltaX :(NXCoord)deltaY;
- - sizeTo:(NXCoord)width :(NXCoord)height;
- - sizeBy:(NXCoord)deltaWidth :(NXCoord)deltaHeight;
- - rotateTo:(NXCoord)angle;
- - rotateBy:(NXCoord)deltaAngle;
- - setWorldShape:a3DObject;
- - worldShape;
- - addLight:aLight;
- - removeLight:aLight;
- - lightList;
- - setHider:(N3DHider)hider;
- - (N3DHider)hider;
- - setSurfaceTypeForAll:(N3DSurfaceType)surfaceType chooseHider:(BOOL)flag;
-
- /* Picking */
- - selectShapesIn:(const NXRect *)selectionRect;
-
- /* eye vector and viewing frustum manipulation methods */
- - setProjectionRectangle:(float)l :(float)r :(float)t :(float)b;
- - getProjectionRectangle:(float *)lp :(float *)rp :(float *)tp :(float *)bp;
- - setProjection:(N3DProjectionType)aProjectionType;
- - (N3DProjectionType)projectionType;
- - setPreTransformMatrix:(RtMatrix)newPreTM;
- - getPreTransformMatrix:(RtMatrix)preTM;
- - setUsePreTransformMatrix:(BOOL)flag;
- - (BOOL)usesPreTransformMatrix;
- - setEyeAt:(RtPoint)fromPoint toward:(RtPoint)toPoint roll:(float)aRollAngle;
- - getEyeAt:(RtPoint *)anEyePoint toward:(RtPoint *)aViewPoint
- roll:(float *)aRollAngle;
- - setClipPlanesNear:(float)aNearPlane far:(float)aFarPlane;
- - getClipPlanesNear:(float *)aNearPlane far:(float *)aFarPlane;
- - setFieldOfViewByAngle:(float)aFieldOfView;
- - setFieldOfViewByFocalLength:(float)aFocalLength;
- - (float)fieldOfView;
- - setPixelAspectRatio:(float)pixAspect;
- - (float)pixelAspectRatio;
-
- - convertPoints:(NXPoint *)mcoords count:(int)npts toWorld:(RtPoint *)wcoords;
- - convertPoints:(RtPoint *)points count:(int)n fromSpace:aShape;
-
- - moveEyeBy:(float)ds :(float)dt :(float)du;
- - rotateEyeBy:(float)dElev :(float)dAzim about:(RtPoint)pivotPtr;
-
- - (int)numCropWindows;
- - cropInRects:(NXRect *)rects nRects:(int)n;
- - (int)frameNumber;
- - (BOOL)canPrintRIB;
-
- - awake;
- - read:(NXTypedStream *)stream;
- - write:(NXTypedStream *)stream;
-
- - (int)renderAsTIFF;
- - (int)renderAsEPS;
- - setDelegate:sender;
- - delegate;
- @end
-
-
- @interface Object(N3DCameraDelegate)
- - camera:sender didRenderStream:(NXStream *)s tag:(int)atag frameNumber:(int)n;
- @end
-
-