home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / IBPalettes / WW3DKit / RIBQuadric.m < prev    next >
Encoding:
Text File  |  1995-03-22  |  1.9 KB  |  98 lines

  1. // copyright 1993 Michael B. Johnson; some portions copyright 1994, MIT
  2. // see COPYRIGHT for reuse legalities
  3. //
  4.  
  5. #import "RIBQuadric.h"
  6. #import <stdio.h>
  7.  
  8.  
  9. @implementation RIBQuadric
  10.  
  11. + initialize { return [RIBQuadric setVersion:1], self; }
  12.  
  13. - (BOOL)isGeometry { return YES; }
  14.  
  15. - init
  16. {
  17.   thetaMax = 360.0;
  18.  
  19.   [super init];
  20.  
  21.   return self;
  22. }
  23.  
  24. - setThetaMax:(RtFloat)newThetaMax 
  25.      n:(int)newN tokens:(RtToken *)newTokens parms:(RtPointer *)newParms archiveVector:(char **)newArchiveVector 
  26.      printfTypeVector:(int *)newPrintfTypeVector printfNVector:(int *)newPrintfNVector
  27. {  
  28.    thetaMax = newThetaMax;
  29.    [self setN:newN tokens:newTokens parms:newParms archiveVector:newArchiveVector printfTypeVector:newPrintfTypeVector printfNVector:newPrintfNVector];
  30.  
  31.    dirtyBoundingBox = TRUE;
  32.  
  33.    return self;
  34. }
  35.  
  36. - setThetaMax:(RtFloat)newThetaMax { thetaMax = newThetaMax; dirtyBoundingBox = TRUE; return self; }
  37.  
  38. - (RtFloat)thetaMax { return thetaMax; }
  39.  
  40. - (BOOL)hasboundingBox { return YES; }
  41.  
  42.  
  43. - (BOOL)isMoot
  44. {
  45.   if (!thetaMax) { return YES; }
  46.   return NO;
  47. }
  48.  
  49. - (BOOL)theSameAs:otherRIBCommand
  50. {
  51.   if (thetaMax != [otherRIBCommand thetaMax])
  52.   {  return NO;
  53.   }
  54.  
  55.   return [super theSameAs:otherRIBCommand];
  56. }
  57.  
  58.  
  59.  
  60. - (BOOL)isMotionBlurrable { return YES; }
  61.  
  62. #define typeVector "f"
  63. #define typeValues &thetaMax
  64.  
  65. - read:(NXTypedStream*)stream 
  66. {
  67.   int  version;
  68.  
  69.  
  70.   [super read:stream];
  71.  
  72. NX_DURING
  73.   version = NXTypedStreamClassVersion(stream,"RIBQuadric");
  74.   if (version == 0) NXReadTypes(stream,"i",&version), version=1;
  75.   if (version == 1)
  76.   {  NXReadTypes(stream,typeVector,typeValues);
  77.   } 
  78. NX_HANDLER
  79.    NXLogError("in read: %s, exception [%d] raised.\n", 
  80.                  [[self class] name], NXLocalHandler.code);
  81.    return nil;
  82. NX_ENDHANDLER
  83.  
  84.   return self; 
  85. }
  86.  
  87. - write:(NXTypedStream*)stream 
  88. {
  89.   [super write:stream];
  90.  
  91.   NXWriteTypes(stream,typeVector, typeValues);
  92.  
  93.   return self;
  94. }
  95.  
  96.  
  97. @end
  98.