home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Headers / 3Dkit / N3DCamera.h < prev    next >
Text File  |  1992-07-18  |  5KB  |  160 lines

  1.  
  2. /*
  3.     Copyright (c) 1991, 1992 by NeXT Computer, Inc as an unpublished work.
  4.     All rights reserved.
  5.  
  6. */
  7.  
  8. #import "N3DShape.h"
  9. #import "next3d.h"
  10. #import <appkit/View.h>
  11. #import <appkit/color.h>
  12. #import <objc/List.h>
  13. #import <ri/ri.h>
  14.  
  15. @interface N3DCamera : View
  16. {
  17.     unsigned int    globalWindowNum; /* the server global window number */
  18.     RtToken        windowResource;  /* the resource ID of our window */
  19.     N3DProjectionType    projectionType;     /* perpective or orthographic */
  20.     RtToken        contextToken;     /* the RMan name for the context */
  21.     id            worldShape;     /* top of shape hierarchy */
  22.     List        *lightList;     /* list of global N3DLights */
  23.     id            delegate;     /* get called when frames are done */
  24.     NXColor        backgroundColor; /* color of rectangle under RIB */
  25.     N3DHider        hider;
  26.  
  27.     struct _cameraFlags {
  28.     unsigned int degenerate : 1;  /* view is 0 width or height */
  29.     unsigned int windowChange@71;     /* the window changed */
  30.     unsigned int needsWindow : 1;
  31.     unsigned int basisChanged : 1;    /* basis changed w.r.t. world coords */
  32.     unsigned int canRender : 1;  /* rendering legal */
  33.     unsigned int usePreTM : 1;  /* pre-multiply the ct */
  34.     unsigned int doFlush : 1;  /* Flush at FrameEnd? */
  35.     unsigned int inWorldBlock : 1; /* inside a World{Begin,End} block ? */
  36.     unsigned int drawBackground : 1; /* draw bkgnd each drawSelf? */
  37.     
  38.     /* private flags */
  39.     unsigned int _computeAspect : 1; /* user-supplied aspect? */
  40.     unsigned int _computeSWindow : 1; /* user-supplied aspect? */
  41.     unsigned int _reserved : 21;
  42.     } cameraFlags;
  43.  
  44.     struct _projectionRectangle {
  45.     float l, r, t, b;
  46.     } projectionRectangle;
  47.     
  48.     RtPoint        eyePoint, viewPoint;  /* view vector */
  49.     float        rollAngle;  /* neg. rot. about uBasis */
  50.     float        fov;
  51.     float        pixelAspectRatio;
  52.     float        nearPlane, farPlane;
  53.     RtPoint        sBasis, tBasis, uBasis;  /* basis w.r.t. world space */
  54.     
  55.     RtMatrix        preTransform;    /* pre-multiply the camera matrix by
  56.                     this matrix, if desired (cache for
  57.                     above object) */
  58.     RtMatrix        transform; /* world-to-eye transformation:
  59.                     ct = Te . R, Te translates eye
  60.                     point to origin, R rotates view
  61.                     vector, V = view - eye, such
  62.                     that it is parallel with the
  63.                     z-axis, and rotates the resulting
  64.                     vector about the z-axis by
  65.                     -rollAngle. */
  66.  
  67.     char         *_printribfile;  // rib file generated during printing
  68.     id            _contextManager; // context manager for the app
  69.     List        *_selList;
  70.     void        *_N3Dprivate;
  71. }
  72.  
  73. - init;
  74. - initFrame:(const NXRect *)fRect;
  75. - free;
  76.  
  77. /* frame and view management methods */
  78. - (BOOL)lockFocus;
  79. - unlockFocus;
  80. - setFlushRIB:(BOOL)flag;
  81. - (BOOL)doesFlushRIB;
  82. - flushRIB;
  83.  
  84. - drawPS:(NXRect *)rects :(int)nRects;
  85. - drawSelf:(const NXRect *)rects :(int)nRects;
  86. - render;
  87. - renderSelf:(RtToken)context;
  88. - worldBegin:(RtToken)context;
  89. - worldEnd:(RtToken)context;
  90. - copyRIBCode:(NXStream *)stream;
  91. - setBackgroundColor:(NXColor)c;
  92. - (NXColor)backgroundColor;
  93. - setDrawBackgroundColor:(BOOL)flag;
  94. - (BOOL)doesDrawBackgroundColor;
  95. - setFrame:(const NXRect *)fRect;
  96. - moveTo:(NXCoord)x :(NXCoord)y;
  97. - moveBy:(NXCoord)deltaX :(NXCoord)deltaY;
  98. - sizeTo:(NXCoord)width :(NXCoord)height;
  99. - sizeBy:(NXCoord)deltaWidth :(NXCoord)deltaHeight;
  100. - rotateTo:(NXCoord)a@8;
  101. - rotateBy:(NXCoord)deltaAngle;
  102. - setWorldShape:a3DObject;
  103. - worldShape;
  104. - addLight:aLight;
  105. - removeLight:aLight;
  106. - lightList;
  107. - setHider:(N3DHider)hider;
  108. - (N3DHider)hider;
  109. - setSurfaceTypeForAll:(N3DSurfaceType)surfaceType chooseHider:(BOOL)flag;
  110.  
  111. /* Picking */
  112. - selectShapesIn:(const NXRect *)selectionRect;
  113.  
  114. /* eye vector and viewing frustum manipulation methods */
  115. - setProjectionRectangle:(float)l :(float)r :(float)t :(float)b;
  116. - getProjectionRectangle:(float *)lp :(float *)rp :(float *)tp :(float *)bp;
  117. - setProjection:(N3DProjectionType)aProjectionType;
  118. - (N3DProjectionType)projectionType;
  119. - setPreTransformMatrix:(RtMatrix)newPreTM;
  120. - getPreTransformMatrix:(RtMatrix)preTM;
  121. - setUsePreTransformMatrix:(BOOL)flag;
  122. - (BOOL)usesPreTransformMatrix;
  123. - setEyeAt:(RtPoint)fromPoint toward:(RtPoint)toPoint roll:(float)aRollAngle;
  124. - getEyeAt:(RtPoint *)anEyePoint toward:(RtPoint *)aViewPoint
  125.         roll:(float *)aRollAngle;
  126. - setClipPlanesNear:(float)aNearPlane far:(float)aFarPlane;
  127. - getClipPlanesNear:(float *)aNearPlane far:(float *)aFarPlane;
  128. - setFieldOfViewByAngle:(float)aFieldOfView;
  129. - setFieldOfViewByFocalLength:(float)aFocalLength;
  130. - (float)fieldOfView;
  131. - setPixelAspectRatio:(float)pixAspect;
  132. - (float)pixelAspectRatio;
  133.  
  134. - convertPoints:(NXPoint *)mcoords count:(int)npts toWorld:(RtPoint *)wcoords;
  135. - convertPoints:(RtPoint *)points count:(int)n fromSpace:aShape;
  136.      
  137. - moveEyeBy:(float)ds :(float)dt :(float)du;
  138. - rotateEyeBy:(float)dElev :(float)dAzim about:(RtPoint)pivotPtr;
  139.  
  140. - (int)numCropWindows;
  141. - cropInRects:(NXRect *)rects nRects:(int)n;
  142. - (int)frameNumber;
  143. - (BOOL)canPrintRIB;
  144.  
  145. - awake;
  146. - read:(NXTypedStream *)stream;
  147. - write:(NXTypedStream *)stream;
  148.  
  149. - (int)renderAsTIFF;
  150. - (int)renderAsEPS;
  151. - setDelegate:sender;
  152. - delegate;
  153. @end
  154.  
  155.  
  156. @interface Object(N3DCameraDelegate)
  157. - camera:sender didRenderStream:(NXStream *)s tag:(int)atag frameNumber:(int)n;
  158. @end
  159.  
  160.