home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / 3Dkit / next3d.h < prev   
Text File  |  1992-07-18  |  3KB  |  104 lines

  1. /*
  2.  *  Copyright (c) 1991, 1992 by NeXT Computer, Inc as an unpublished work.
  3.  *  All rights reserved.
  4.  *
  5.  */
  6.  
  7. #ifndef _next3dh_
  8. #define _next3dh_
  9.  
  10. #import <ri/ri.h>
  11. #import <objc/hashtable.h>
  12.  
  13. typedef enum {
  14.     N3D_Perspective,
  15.     N3D_Orthographic
  16. } N3DProjectionType;
  17.  
  18. typedef enum {
  19.     N3D_AmbientLight,
  20.     N3D_PointLight,
  21.     N3D_DistantLight,
  22.     N3D_SpotLight
  23. } N3DLightType;
  24.     
  25. typedef enum {
  26.     N3D_AllAxes,
  27.     N3D_XAxis,
  28.     N3D_YAxis,
  29.     N3D_ZAxis,
  30.     N3D_XYAxes,
  31.     N3D_XZAxes,
  32.     N3D_YZAxes
  33. } N3DAxis;
  34.  
  35. typedef enum {
  36.     N3D_HiddenRendering = 0, 
  37.     N3D_InOrderRendering, 
  38.     N3D_NoRendering
  39. } N3DHider;
  40.  
  41. typedef enum {
  42.     N3D_PointCloud = 0, 
  43.     N3D_WireFrame, 
  44.     N3D_ShadedWireFrame, 
  45.     N3D_FacetedSolids, 
  46.     N3D_SmoothSolids
  47. } N3DSurfaceType;
  48.  
  49. /*
  50.  *  Macros for quick structure copies.  Turns into small code when
  51.  *  compiled with -O.
  52.  */
  53.  
  54. #define N3D_CopyMatrix( s_, d_ )  do { \
  55.             struct _cms { RtMatrix _m; }; \
  56.             *((struct _cms *)(d_)) = *((struct _cms *)(s_)); \
  57.             } while (0)
  58. #define N3D_CopyPoint( s_, d_ )  do { \
  59.             struct _cps { RtPoint _p; }; \
  60.             *((struct _cps *)(d_)) = *((struct _cps *)(s_)); \
  61.             } while (0)
  62. #define N3D_CopyBound( s_, d_ )  do { \
  63.             struct _cps { RtBound _b; }; \
  64.             *((struct _cps *)(d_)) = *((struct _cps *)(s_)); \
  65.             } while (0)
  66. #define N3D_ConvertBoundToPoints( b_, p_ )    do { \
  67.             (p_)[0][0] = (b_)[0]; \
  68.             (p_)[0][1] = (b_)[2]; \
  69.             (p_)[0][2] = (b_)[4]; \
  70.             (p_)[1][0] = (b_)[1]; \
  71.             (p_)[1][1] = (b_)[3]; \
  72.             (p_)[1][2] = (b_)[5]; \
  73.             } while (0)
  74. #define N3D_ConvertPointsToBound( p_, b_ )    do { \
  75.             (b_)[0] = (p_)[0][0]; \
  76.             (b_)[1] = (p_)[1][0]; \
  77.             (b_)[2] = (p_)[0][1]; \
  78.             (b_)[3] = (p_)[1][1]; \
  79.             (b_)[4] = (p_)[0][2]; \
  80.             (b_)[5] = (p_)[1][2]; \
  81.             } while (0)
  82. /*
  83.  *  Single-value macros for accessing point coords.
  84.  */
  85. #define N3D_XComp( _p )    ((_p)[0])
  86. #define N3D_YComp( _p )    ((_p)[1])
  87. #define N3D_ZComp( _p )    ((_p)[2])
  88. #define N3D_WComp( _p )    ((_p)[3])
  89.  
  90. void N3DMult3DPoint( RtPoint p, RtMatrix m, RtPoint result );
  91. void N3DMult3DPoints( RtPoint *p, int count, RtMatrix m, RtPoint *result );
  92. void N3DIntersectLinePlane( RtPoint *L, RtPoint pnorm, RtPoint ppoint,
  93.             RtPoint *psect );
  94. void N3DMultiplyMatrix( RtMatrix a, RtMatrix b, RtMatrix result );
  95. float N3DInvertMatrix( RtMatrix m, RtMatrix inverse_m );
  96.  
  97. /* Various and sundry useful globals */
  98. extern NXAtom N3DRIBPboardType;
  99. extern const RtPoint N3DOrigin;
  100. extern const RtMatrix N3DIdentityMatrix;
  101.  
  102.  
  103. #endif _next3dh_
  104.