home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / dirs / ttddd_420.lzh / TTDDD / Examples / Example.ttddd < prev    next >
Text File  |  1990-12-20  |  9KB  |  212 lines

  1. /* This file was written by Glenn M. Lewis - 2/8/90
  2.  * Update for ShareWare distribution on 8/18/90
  3.  */
  4.  
  5. /* This is an example TTDDD file.  It shows the basic layout of
  6.  * the "Textual Three-D Data Description" format.  This file is
  7.  * parsed by WriteTDDD.rexx, and creates a standard "TDDD" file,
  8.  * as defined by Impulse, Inc. for their rendering/animation
  9.  * software: Turbo Silver 3.0 and SV.  Please see the enclosed
  10.  * "TTDDD.doc" file for more information about this format.
  11.  */
  12.  
  13. /* Nested C-type comments /* are supported */ as well as TeX-style
  14.  * comments.  A TeX-style comment begins with the '%' character,
  15.  * and continues to the end of the line.  The '%' character loses
  16.  * its meaning within a pair of quotes, so you don't need a special
  17.  * escape mechanism, right?  Keyword parsing is case-insensitive,
  18.  * of course.  I hate parsers that are stupid, so this one isn't.  Blank
  19.  * lines are also ignored.  Spaces and tabs may be inserted anywhere,
  20.  * but parsing is performed one-line-at-a-time, which means that
  21.  * commands must not cross line boundaries.  I don't think this is
  22.  * much of a restriction, do you?  If you do, go ahead and make your
  23.  * own parser...
  24.  */
  25.  
  26. INFO Begin
  27.  
  28.     /* Note that the ordering within any Begin/End block is completely
  29.      * arbitrary, except for variable-length arrays.  These arrays must
  30.      * start with the "Count" field, saying how many entries there will
  31.      * be, and then must proceed in ascending order, starting with [0].
  32.      * If an element is missing (or is not in the correct order), its
  33.      * value will be set to its default.
  34.      */
  35.  
  36.     NAME "Gizmo"
  37.  
  38.     BRSH[0]="This is the IFF ILBM filename of Brush 0"
  39.     BRSH 1 ="Brush 1"               % Brackets are optional.
  40.  
  41.     STNC[0] "Stencil 0 filename"    % etc.
  42.  
  43.     TXTR[0] Texture                 % Quotes aren't necessary here.
  44.  
  45.     % Note that I have just shown several format methods for the
  46.     % above fields.  Basically, the brackets and equal signs are
  47.     % removed before parsing.  I will always try and show you various
  48.     % formats that are all legal.  If you don't see it here, it is probably
  49.     % not a legal format.  I have tried my utmost to have a flexible
  50.     % format here.  I hope that you find that it is.
  51.  
  52.     OBSV Camera X=5.0 Y=2.7 Z=5.3   % Default: -100 -100 100
  53.     OBSV Rotate Z=2.7 X=4.3         % In this case, Y=0.0
  54.     OBSV Focal  2.82
  55.  
  56.     OTRK "Object for Camera Tracking"   % If parameters are too long,
  57.                                         % they are simply truncated.
  58.  
  59.     OSTR Path "Path object name"
  60.     OSTR Translate  X=2.8 Y=7.3 Z=2.1   % Defaults to zero.
  61.     OSTR Rotate     Y=90                % Defaults to zero.
  62.     OSTR Scale 2.5  % I figure that the default here should be one :-)
  63.                     % Also, if one single number is given, and no
  64.                     % "X=" (etc.) appears, it applies to X,Y, *and* Z
  65.     OSTR Info ABS_TRA Z_ALIGN   % etc.  Keep all the flags on THIS LINE!
  66.  
  67.     FADE FadeAt 50.0
  68.     FADE FadeBy 500
  69.     FADE FadeTo 23 99 254   % Or "R=23 G=99 B=254", Defaults to 80 80 80
  70.  
  71.     SKYC Horizon R=12 B=30  % Defaults to zero.
  72.     SKYC Zenith  R=2 B=50
  73.  
  74.     AMBI 5 27 32    % Again, RGB - these are just examples, remember!
  75.                     % Colors always get parsed the same flexible way,
  76.                     % as do Vectors.
  77.  
  78.     GLB0[0] 5       % Edging    Default: 30
  79.     GLB0 1  2       % Perturb   Default: 0
  80.     GLB0[2] 255     % Sky_Blend Default: 0
  81.     GLB0[3] 2       % Lens      Default: 0
  82.     GLB0 4  1       % Fade      Default: 0
  83.     GLB0[5]=9       % Size      Default: 100
  84.     GLB0 6 =2       % Resolve   Default: 8
  85.     GLB0[7] 0       % Extra     Default: 0
  86.  
  87. /* The above information is all that can appear within this BEGIN/END Block. */
  88.  
  89. End INFO
  90.  
  91. /* The only thing that can follow the option INFO chunk is the OBJ chunk.
  92.  * One OBJ chunk is required for every object hierarchy.
  93.  */
  94.  
  95. OBJ Begin   % That wasn't so bad, was it!?!  Don't forget it, though!
  96.  
  97. /* Now, let's look at the DESC sub-chunk... */
  98.  
  99. DESC Begin
  100.  
  101.     NAME "Gizmo"    % Defaults to no name - please name your objects...
  102.                     % It's for your own good!  :-)
  103.  
  104.     SHAP Shape 2    % This must be supplied!
  105.     SHAP Lamp 0     % ditto
  106.  
  107.     POSI X=5.7 Y=200.9 Z=132.7  % Defaults to zero.
  108.  
  109.     AXIS XAxis X=1      % Defaults to 1 0 0
  110.     AXIS YAxis Y=1      % Defaults to 0 1 0
  111.     AXIS ZAxis Z=1      % Defaults to 0 0 1
  112.  
  113.     SIZE X=1 Y=1 Z=1    % Defaults to 32.0
  114.  
  115.     PNTS PCount 3       % This array *must* progress in ascending order!
  116.     PNTS Point[0] 12 27 52  % Brackets and "X=..." optional
  117.     PNTS Point 1  21 72 25  % ditto
  118.     PNTS Point[2] 72 25 21  % ditto
  119.  
  120.     EDGE ECount 3       % This array *must* progress in ascending order!
  121.     EDGE Edge[0] 0 1    % Edge is the connection between two points
  122.     EDGE Edge 1  1 2    % Brackets optional
  123.     EDGE Edge 2  2 0
  124.  
  125.     FACE TCount 1       % This array *must* progress in ascending order!
  126.     FACE Connect[0] 0 1 2   % List of 3 edges to make a triangle
  127.  
  128.     COLR 87 23 232          % RGB.  Defaults to 240 240 240
  129.     REFL G=12 R=240 B=97    % RGB.  Defaults to zero.
  130.     TRAN 25 72 53           % RGB.  Defaults to zero.
  131.  
  132.     CLST Count 1        % Must match TCount above.  Array must ascend.
  133.     CLST Color[0] 240 12 57 % RGB.  Defaults to 240 240 240
  134.  
  135.     RLST Count 1        % Must match TCount above.  Array must ascend.
  136.     RLST Color[0] 120 24 23 % RGB.  Defaults to zero.
  137.  
  138.     TLST Count 1        % Must match TCount above.  Array must ascend.
  139.     TLST Color[0] 255 92 87 % RGB.  Defaults to zero.
  140.  
  141.     TPAR[0] 42.73
  142.     TPAR[12]=72.67      % Defaults to zero.
  143.  
  144.     SURF[2]=0
  145.     SURF[4] 1           % Defaults to zero.
  146.  
  147.     MTTR Type 4         % Defaults to zero.
  148.     MTTR Index 2.972    % Defaults to 1.0.  Must satisfy: (1.00 <= Index <= 3.55)
  149.  
  150.     SPEC Specularity 28 % Defaults to zero.
  151.     SPEC Hardness 16    % Defaults to zero.
  152.  
  153.     PRP0[0] 100         % Blending factor.  Defaults to 255.
  154.     PRP0[1]=5           % Roughness factor.  Defaults to zero.
  155.     PRP0 2 =1           % Shading On/Off flag (1/0).  Defaults to 1
  156.     PRP0[3] 1           % Phong shading flag.  Defaults to 1
  157.     PRP0[4]=0           % Glossy flag.  Defaults to 0
  158.     PRP0 5  1           % Quickdraw flag.  Defaults to 1
  159.  
  160.     INTS 200            % Defaults to 300
  161.  
  162.     STRY Path "Path object name"
  163.     STRY Translate  2.8 7.3 2.1         % Defaults to zero.
  164.     STRY Rotate     Z=90                % Defaults to zero.
  165.     STRY Scale 3.5  % I figure that the default here should be one :-)
  166.                     % Also, if one single number is given, and no
  167.                     % "X=" (etc.) appears, it applies to X,Y, *and* Z
  168.     STRY Info ABS_TRA X_ALIGN   % etc.  Keep all the flags on THIS LINE!
  169.  
  170. End DESC
  171.  
  172. % Possible child (including external) objects go here to build object hierarchy.
  173.  
  174. /* Please remember that this example file is only to show you the format of
  175.  * this TTDDD file.  It should not produce any errors from "WriteTDDD.rexx",
  176.  * but it is completely bogus, so don't feed the results into Turbo Silver.
  177.  */
  178.  
  179. /* Let's look at the EXTR sub-chunk */
  180.  
  181. EXTR Begin
  182.  
  183.     MTRX Translate 34 72 56 %...Hike!  Defaults to zero.
  184.     MTRX Scale 1 5 9        % Defaults to 1.  If one number, it applies to all.
  185.     MTRX Rotate 1 0 0 0 1 0 0 0 1   % A Matrix MUST be in the proper order!
  186.  
  187.     LOAD "External file name"
  188.  
  189. End EXTR
  190.  
  191. TOBJ    % This ends a current object hierarchy.  You must read TDDD.doc to
  192.         % understand this concept.  If "Gizmo" (above) had a child called
  193.         % "GizGoober", then "GizGoober" would have been described in its
  194.         % own DESC/TOBJ block before this "TOBJ".  Got it?  Great!
  195.  
  196. End OBJ     % That wraps up the above object hierarchy.  Not that this file
  197.             % has only described a single object.  These files can get quite
  198.             % large, but who cares!?!  :-)  You can have as many objects as
  199.             % you want, and as many points/edges/faces as you want, but be
  200.             % warned that large objects tend to crash Turbo Silver's Object
  201.             % Editor!
  202.  
  203. /* Now, that wasn't too bad, was it?  Piece of cake, right?  Now you can
  204.  * write any program to create a text file in this format (which is quite
  205.  * unrestrictive, I might add) using the language of your choice.  You then
  206.  * simply let WriteTDDD chew on it for a while, and BLAMMO!  You have
  207.  * a Turbo Silver TDDD Object File!  Wow!  After I finish this, I am going
  208.  * to write a SuperQuadric generator [already done - 8/18/90] so that I can
  209.  * finally use my favorite objects in my favorite Amiga Rendering program!
  210.  */
  211.  
  212.