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

  1. /*
  2.     Copyright (c) 1991, 1992 by NeXT Computer, Inc as an unpublished work.
  3.     All rights reserved.
  4. */
  5.  
  6. #import <objc/Object.h>
  7. #import <ri/ri.h>
  8. #import <ri/slo.h>
  9. #import <appkit/graphics.h>
  10. #import "next3d.h"
  11.  
  12. @class N3DCamera;
  13.  
  14. typedef struct {
  15.     char    id[6];    /* self, encoded to 6 non-0 bytes */
  16.     char    name;    /* optional visible name */
  17. } N3DShapeName;
  18.  
  19. /* flags for CTM and inverse dirty bits */
  20. #define N3D_BOTH_CLEAN        0
  21. #define N3D_CTM_DIRTY        1
  22. #define N3D_CTM_INVERSE_DIRTY    2
  23. #define N3D_CTM_BOTH_DIRTY    3
  24.  
  25. @interface N3DShape : Object
  26. {
  27.     RtMatrix    transform; /* The matrix that's catenated at this node */
  28.     RtMatrix    compositeTransform; /* The CTM */
  29.     RtMatrix    inverseCompositeTransform; /* The CTM^-1 */
  30.     RtBound    boundingBox;    /* bounds in 3D */
  31.     N3DShapeName *shapeName;
  32.     N3DSurfaceType surfaceType;
  33.  
  34.     /* Pointers to each kind of shader available */
  35.     id        surfaceShader;
  36.     id        displacementShader;
  37.     id        lightShader;
  38.     id        imagerShader;
  39.     id@DlumeShader;
  40.     id        transformationShader;
  41.     
  42.  
  43.     struct {
  44.     unsigned int    selectable:1; /* can you select this N3DShape? */
  45.     unsigned int    visible:1; /* self and descendants are invisible */
  46.     unsigned int    ancestorChanged:1; /* need to update bounds, etc. */
  47.     unsigned int    compositeDirty:2; /* flags for CTM & inverse */
  48.     unsigned int    drawAsBox:1; /* draw the bbox */
  49.     unsigned int    isInstance:1; /* is this an instance of another? */
  50.     unsigned int    hasShader:1; /* are there any shaders? */
  51.     unsigned int    filler:26;
  52.     } shapeFlags;
  53.  
  54.     /* The following are links to other DAGNodes.  Really the DAG allows
  55.        traversal to a nextPeer or descendant; the prev and ancestor pointers
  56.        are here for back-linking.
  57.      */
  58.     id        nextPeer;
  59.     id        previousPeer;  /* back link */
  60.     id        descendant;
  61.     id        ancestor;  /* back link */
  62.     
  63.     id        renderDelegate; /* set if this Object is an instance */
  64.     
  65.     void    *_CTMRel;
  66.     char    *_rnm;
  67.     void    *_N3Dprivate;
  68. }
  69.  
  70. - init;
  71.  
  72. - linkPeer:aPeer;
  73. - nextPeer;
  74. - previousPeer;
  75. - firstPeer;
  76. - lastPeer;
  77.  
  78. - linkDescendant:aDescendant;
  79. - descendant;
  80. - lastDescendant;
  81.  
  82. - linkAncestor:anAncestor;
  83. - ancestor;
  84. - firstAncestor;
  85.  
  86. - unlink;
  87. - group:toShape;
  88. - ungroup;
  89.  
  90. - (BOOL)isWorld;
  91.  
  92. - setSurfaceType:(N3DSurfaceType)surfaceType andDescendants:(BOOL)flag;
  93. - (N3DSurfaceType)surfaceType;
  94.  
  95. - setShader:aShader;
  96. - shaderType:(SLO_TYPE)type;
  97.  
  98. - getBoundingBox:(RtBound *)bbox;
  99. - setDrawAsBox:(BOOL)flag;
  100. - (BOOL)doesDrawAsBox;
  101. - getBounds:(NXRect *)sRect inCamera:camera;
  102. - convertObjectPoints:(RtPoint *)points count:(int)n toCamera:camera;
  103. - convertPoints:(RtPoint *)points count:(int)n fromAncestor:(N3DShape *)aShape;
  104. - convertPoints:(RtPoint *)points count:(int)n toAncestor:(N3DShape *)aShape;
  105.  
  106. - setSelectable:(BOOL)flag;
  107. - (BOOL)isSelectable;
  108. - setVisible:(BOOL)flag;
  109. - (BOOL)isVisible;
  110.  
  111. - setShapeName:(const char *)aName;
  112. - (const char *)shapeName;
  113.  
  114. - setRenderDelegate:anObject;
  115. - removeRenderDelegate;
  116. - renderDelegate;
  117.  
  118. - setTransformMatrix:(RtMatrix)tm;
  119. - getTransformMatrix:(RtMatrix)tm;
  120. - concatTransformMatrix:(RtMatrix)ctm premultiply:(BOOL)flag;
  121. - getCompositeTransformMatrix:(RtMatrix)ctm
  122.     relativeToAncestor:(N3DShape *)aShape;
  123. - getInverseCompositeTransformMatrix:(RtMatrix)ictm
  124.     relativeToAncestor:(N3DShape *)aShape;
  125.  
  126. - rotateAngle:(float)ang axis:(RtPoint)anAxis;
  127. - preRotateAngle:@Eat)ang axis:(RtPoint)anAxis;
  128. - scale:(float)sx :(float)sy :(float)sz;
  129. - preScale:(float)sx :(float)sy :(float)sz;
  130. - scaleUniformly:(float)s;
  131. - preScaleUniformly:(float)s;
  132. - translate:(float)tx :(float)ty :(float)tz;
  133. - preTranslate:(float)tx :(float)ty :(float)tz;
  134.  
  135. - render:(N3DCamera *)camera;
  136. - renderSelf:(N3DCamera *)camera;
  137. - renderSelfAsBox:(N3DCamera *)camera;
  138.  
  139. - free;
  140. - freeAll;
  141.  
  142. - awake;
  143. - read:(NXTypedStream *)stream;
  144. - write:(NXTypedStream *)stream;
  145.  
  146. @end
  147.