MAG Disk (Jan 1991) : TTDDD / Examples / Example.ttddd

/* This file was written by Glenn M. Lewis - 2/8/90
 * Update for ShareWare distribution on 8/18/90
 */

/* This is an example TTDDD file.  It shows the basic layout of
 * the "Textual Three-D Data Description" format.  This file is
 * parsed by WriteTDDD.rexx, and creates a standard "TDDD" file,
 * as defined by Impulse, Inc. for their rendering/animation
 * software: Turbo Silver 3.0 and SV.  Please see the enclosed
 * "TTDDD.doc" file for more information about this format.
 */

/* Nested C-type comments /* are supported */ as well as TeX-style
 * comments.  A TeX-style comment begins with the '%' character,
 * and continues to the end of the line.  The '%' character loses
 * its meaning within a pair of quotes, so you don't need a special
 * escape mechanism, right?  Keyword parsing is case-insensitive,
 * of course.  I hate parsers that are stupid, so this one isn't.  Blank
 * lines are also ignored.  Spaces and tabs may be inserted anywhere,
 * but parsing is performed one-line-at-a-time, which means that
 * commands must not cross line boundaries.  I don't think this is
 * much of a restriction, do you?  If you do, go ahead and make your
 * own parser...
 */

INFO Begin

    /* Note that the ordering within any Begin/End block is completely
     * arbitrary, except for variable-length arrays.  These arrays must
	 * start with the "Count" field, saying how many entries there will
	 * be, and then must proceed in ascending order, starting with [0].
	 * If an element is missing (or is not in the correct order), its
	 * value will be set to its default.
     */

    NAME "Gizmo"

    BRSH[0]="This is the IFF ILBM filename of Brush 0"
    BRSH 1 ="Brush 1"               % Brackets are optional.

    STNC[0] "Stencil 0 filename"    % etc.

    TXTR[0] Texture                 % Quotes aren't necessary here.

    % Note that I have just shown several format methods for the
    % above fields.  Basically, the brackets and equal signs are
    % removed before parsing.  I will always try and show you various
    % formats that are all legal.  If you don't see it here, it is probably
    % not a legal format.  I have tried my utmost to have a flexible
    % format here.  I hope that you find that it is.

    OBSV Camera X=5.0 Y=2.7 Z=5.3   % Default: -100 -100 100
    OBSV Rotate Z=2.7 X=4.3         % In this case, Y=0.0
    OBSV Focal  2.82

    OTRK "Object for Camera Tracking"   % If parameters are too long,
                                        % they are simply truncated.

    OSTR Path "Path object name"
    OSTR Translate  X=2.8 Y=7.3 Z=2.1   % Defaults to zero.
    OSTR Rotate     Y=90                % Defaults to zero.
    OSTR Scale 2.5  % I figure that the default here should be one :-)
                    % Also, if one single number is given, and no
                    % "X=" (etc.) appears, it applies to X,Y, *and* Z
    OSTR Info ABS_TRA Z_ALIGN   % etc.  Keep all the flags on THIS LINE!

    FADE FadeAt 50.0
    FADE FadeBy 500
    FADE FadeTo 23 99 254   % Or "R=23 G=99 B=254", Defaults to 80 80 80

    SKYC Horizon R=12 B=30  % Defaults to zero.
    SKYC Zenith  R=2 B=50

    AMBI 5 27 32    % Again, RGB - these are just examples, remember!
                    % Colors always get parsed the same flexible way,
                    % as do Vectors.

    GLB0[0] 5       % Edging    Default: 30
    GLB0 1  2       % Perturb   Default: 0
    GLB0[2] 255     % Sky_Blend Default: 0
    GLB0[3] 2       % Lens      Default: 0
    GLB0 4  1       % Fade      Default: 0
    GLB0[5]=9       % Size      Default: 100
    GLB0 6 =2       % Resolve   Default: 8
    GLB0[7] 0       % Extra     Default: 0

/* The above information is all that can appear within this BEGIN/END Block. */

End INFO

/* The only thing that can follow the option INFO chunk is the OBJ chunk.
 * One OBJ chunk is required for every object hierarchy.
 */

OBJ Begin   % That wasn't so bad, was it!?!  Don't forget it, though!

/* Now, let's look at the DESC sub-chunk... */

DESC Begin

    NAME "Gizmo"    % Defaults to no name - please name your objects...
                    % It's for your own good!  :-)

    SHAP Shape 2    % This must be supplied!
    SHAP Lamp 0     % ditto

    POSI X=5.7 Y=200.9 Z=132.7  % Defaults to zero.

    AXIS XAxis X=1      % Defaults to 1 0 0
    AXIS YAxis Y=1      % Defaults to 0 1 0
    AXIS ZAxis Z=1      % Defaults to 0 0 1

    SIZE X=1 Y=1 Z=1    % Defaults to 32.0

    PNTS PCount 3       % This array *must* progress in ascending order!
    PNTS Point[0] 12 27 52  % Brackets and "X=..." optional
    PNTS Point 1  21 72 25  % ditto
    PNTS Point[2] 72 25 21  % ditto

    EDGE ECount 3       % This array *must* progress in ascending order!
    EDGE Edge[0] 0 1    % Edge is the connection between two points
    EDGE Edge 1  1 2    % Brackets optional
    EDGE Edge 2  2 0

    FACE TCount 1       % This array *must* progress in ascending order!
    FACE Connect[0] 0 1 2   % List of 3 edges to make a triangle

    COLR 87 23 232          % RGB.  Defaults to 240 240 240
    REFL G=12 R=240 B=97    % RGB.  Defaults to zero.
    TRAN 25 72 53           % RGB.  Defaults to zero.

    CLST Count 1        % Must match TCount above.  Array must ascend.
    CLST Color[0] 240 12 57 % RGB.  Defaults to 240 240 240

    RLST Count 1        % Must match TCount above.  Array must ascend.
    RLST Color[0] 120 24 23 % RGB.  Defaults to zero.

    TLST Count 1        % Must match TCount above.  Array must ascend.
    TLST Color[0] 255 92 87 % RGB.  Defaults to zero.

    TPAR[0] 42.73
    TPAR[12]=72.67      % Defaults to zero.

    SURF[2]=0
    SURF[4] 1           % Defaults to zero.

    MTTR Type 4         % Defaults to zero.
    MTTR Index 2.972    % Defaults to 1.0.  Must satisfy: (1.00 <= Index <= 3.55)

    SPEC Specularity 28 % Defaults to zero.
    SPEC Hardness 16    % Defaults to zero.

    PRP0[0] 100         % Blending factor.  Defaults to 255.
    PRP0[1]=5           % Roughness factor.  Defaults to zero.
    PRP0 2 =1           % Shading On/Off flag (1/0).  Defaults to 1
    PRP0[3] 1           % Phong shading flag.  Defaults to 1
    PRP0[4]=0           % Glossy flag.  Defaults to 0
    PRP0 5  1           % Quickdraw flag.  Defaults to 1

    INTS 200            % Defaults to 300

    STRY Path "Path object name"
    STRY Translate  2.8 7.3 2.1         % Defaults to zero.
    STRY Rotate     Z=90                % Defaults to zero.
    STRY Scale 3.5  % I figure that the default here should be one :-)
                    % Also, if one single number is given, and no
                    % "X=" (etc.) appears, it applies to X,Y, *and* Z
    STRY Info ABS_TRA X_ALIGN   % etc.  Keep all the flags on THIS LINE!

End DESC

% Possible child (including external) objects go here to build object hierarchy.

/* Please remember that this example file is only to show you the format of
 * this TTDDD file.  It should not produce any errors from "WriteTDDD.rexx",
 * but it is completely bogus, so don't feed the results into Turbo Silver.
 */

/* Let's look at the EXTR sub-chunk */

EXTR Begin

    MTRX Translate 34 72 56 %...Hike!  Defaults to zero.
    MTRX Scale 1 5 9        % Defaults to 1.  If one number, it applies to all.
    MTRX Rotate 1 0 0 0 1 0 0 0 1   % A Matrix MUST be in the proper order!

    LOAD "External file name"

End EXTR

TOBJ    % This ends a current object hierarchy.  You must read TDDD.doc to
        % understand this concept.  If "Gizmo" (above) had a child called
        % "GizGoober", then "GizGoober" would have been described in its
        % own DESC/TOBJ block before this "TOBJ".  Got it?  Great!

End OBJ     % That wraps up the above object hierarchy.  Not that this file
            % has only described a single object.  These files can get quite
            % large, but who cares!?!  :-)  You can have as many objects as
            % you want, and as many points/edges/faces as you want, but be
            % warned that large objects tend to crash Turbo Silver's Object
            % Editor!

/* Now, that wasn't too bad, was it?  Piece of cake, right?  Now you can
 * write any program to create a text file in this format (which is quite
 * unrestrictive, I might add) using the language of your choice.  You then
 * simply let WriteTDDD chew on it for a while, and BLAMMO!  You have
 * a Turbo Silver TDDD Object File!  Wow!  After I finish this, I am going
 * to write a SuperQuadric generator [already done - 8/18/90] so that I can
 * finally use my favorite objects in my favorite Amiga Rendering program!
 */