home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / formats / ttddd / spec / t3d_doc / example.ttd < prev    next >
Text File  |  1994-05-30  |  10KB  |  244 lines

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