ATTD ASCIItoTDDD V1.2 by Robert Eddings ----------------------------------- This program is distributed as ShareWare. If you find this program useful, send ten dollars to the address below and you will be put on a mailing list so that information on updates and other programs may be sent to you. If you send fifteen dollars or more, you will be sent a disk that contains object conversion programs, the latest ASCIItoTDDD upgrade and other goodies. Send ShareWare registration fee to: Robert Eddings 1502 35th Street Sheffield, AL 35660 USA What is it? ASCIItoTDDD is a program that converts a standard ASCII text file to an Imagine TDDD object file. In case you were wondering, ASCII stands for "American Standard Code for Information Interchange" and TDDD stands for "3D Data Description". I'll tell you what that "ATTD" thing is a little later. What is it good for? While the Imagine object editors are fine for doing so many contortions to form objects, sometimes the mere volume of options can can be a little daunting. At other times the need for a particular type of object may be beyond the scope of Imagine, such as those neat fractal trees. This is when ASCIItoTDDD can come in real handy. If you can think in 3D and type fast, it may be quicker for you to build some objects by "hand". Also, if your hobby is to test out physics theories by making 3D objects crash into each other (do what?) then it would be easier to write a program (with The Director, CanDo or whatever) that will do the hard work and write the files for you. All I am saying is that this program is sure to have more uses than I could ever think of so if it helps you out in any way, great. Hey, this looks familiar. Yeah, me too. I have seen a couple of other programs out there that do similar things but this is the only one that uses the new options from Imagine 2.0. It is also way easy to use. How to use ASCIItoTDDD ---------------------- First you write the ASCII file for the object(s) as described below. Then, from the CLI, type: ASCIItoTDDD . The is of course the file path to the formatted ASCII file. The is the path to the new TDDD object file. Both parameters must be provided and they should not be the same. If you type ASCIItoTDDD with no parameters, you will be given usage information. If you type "ASCIItoTDDD ?" you will be given version and author information. The reason this is a "CLI only" program instead of having a bunch of gadgets is so that it will be easier for your own programs to use. Note: The mathtrans.library must be in your LIBS: directory. The ATTD text format -------------------- ATTD stands for "ASCII To 3D". This file can be created with any text editor as long as it can save standard ASCII with no special control characters used by the editor. The file consists of a series of definition segments. Each segment begins with a four letter identification label (all caps). Additionally, there may be a series of data lines following the label. Rules: 1. Comments may be placed anywhere BETWEEN the definition segments. Comments are any lines that begin with a space or a return character. Tabs are not allowed. That means this whole file is legal to convert. Note: Excess comments slows the conversion slightly. 2. Do not add extra spaces at the end of label or data lines. 3. Definition segments that are not required may be omitted. 4. Write definition segments in the order given for consistency. Definition segments ------------------- ATTD Required - Must be first line of file. This tells ASCIItoTDDD that this file is of the required type. Note: A space was added before this example definition segment so that the converter will ignore it. TDDD 0 Required - This starts a new object. The data line is set to "0" if the object has no children and "1" if it does. Read "ATTD notes" at the end of this file to learn about object heirarchies. NAME Testname This segment gives a name to the object. It is not required that you name the object but it helps you keep track of it in Imagine. SHAP 1,0,0,0,0 Required - This segment gives information on the object type #1 = "0" if Sphere, "1" if Custom (has points/triangles), "2" if Ground #2 = "0" if not Bright, "1" if Bright #3 = "0" if not a Lamp, "1" if like sunlight, "2" if diminish intensity #4 = "0" if non-shadow-casting light, "1" if shadow-casting light #5 = "0" if Spherical light, "1" if Cylindrical, "2" if Conical If #3 is set to "0", #4 and #5 will be ignored. POSI 0,0,0 This segment gives the X, Y, and Z coordinates of the object's axis position. If the SHAP segment defines the object as Ground, the Z coordinate sets its height. AXIS 0,0,0 This segment gives the X, Y, and Z direction vectors in degrees for the object's local coordinate system. This works the same as setting the axis alignment in the Imagine transformation requester. SIZE 60,20,60 This segment gives the X, Y, and Z size values for the object axes. If the SHAP segment defines the object as a Sphere, the X size value sets its radius. If the PRP1 segment defines the Quickdraw flag as "1", then the size values are used for the rectangular solid that is drawn rather than the points and edges. The default size is "32 32 32". PNTS 4 -60,0,60 60,0,60 60,0,-60 -60,0,-60 Required only if EDGE segment exists. The first data line gives the number of points that will be defined. The following lines are the X, Y, and Z coordinates for each point. Coordinates may be listed without a decimal point or up to seven digits past the decimal point. EDGE 5 0,1 1,3 3,0 1,2 2,3 Required only if SHARP or FACE segments exist. The first data line gives the number of edges that will be defined. The following lines are the two point numbers that make up the edge. The first point defined in the PNTS segment is "0". The order of the points in the edge is not important. Try to omit any redundant edges. EFLG 2 3 4 For Imagine version 2.0 only. This segment defines which edges are to be considered sharp. The first data line gives the number of sharp edges. The following lines are the edge numbers. The edges need not be listed in order. See example object Group.ATTD. FACE 2 0,1,2 3,4,1 Required only if the SGRP segment exists. The first data line gives the number of faces that will be defined. The following lines are the three edge numbers that make up the face. FGRP 1 FirstSub 0 For Imagine version 2.0 only. This segment defines a subgroup of faces so that they may be selected within Imagine easily. The first data line is the number of faces in the subgroup. The second is the name given to the subgroup. The following lines are the face numbers. A new SGRP segment must be written for each subgroup. See example object Group.ATTD. INT1 255,255,255 This segment gives the RGB value between 0 and 255 for light source objects with 255 being full intensity. TXT2 0 -62,-5,-62 0,0,0 124,10,124 16,6,150,20,20,0,0,0 0,0,0,0,0,0,0,0 FirstSub Im_Textures/Dots For Imagine version 2.0 only. This segment defines a texture for the object. Line #1 = "1" if texture is to be applied to child objects, "0" if not. Line #2 = texture position Line #3 = texture axes alignment Line #4 = texture size Line #5 = the first eight texture parameters Line #6 = the last eight texture parameters Line #7 = the subgroup name that the texture is to be applied to or "NONE" if texture is for entire object Line #8 = the full path name of the texture to be used Note: Correct the texture path if you wish to convert this file. BRS3 2 0,0,0,0,1,0,0 -62,-5,-62 0,0,0 124,10,124 255,0 FirstSub Pics/Checker.br For Imagine version 2.0 only. This segment defines brush wrapping for the object. Line #1 = brush type: "0"-Color, "1"-Reflection, "2"-Filter, "3"-Altitude Line #2 = brush flags (1=ON 0=OFF): Wrap X, Wrap Z, Apply to Children, Repeat, Mirror, Inverse Video, and Use Genlock Line #3 = brush position Line #4 = brush axes alignment Line #5 = brush size Line #6 = brush parameters: Full Scale Value, Max. Sequence Number Line #7 = the subgroup name that the brush is to be applied to or "NONE" (all caps) if brush is for entire object Line #8 = the full path name of the brush to be used Note: Correct the brush path to the supplied "Checker.br" if you wish to convert this file. COLR 255,255,255 REFL 0,0,0 TRAN 0,0,0 SPC1 0,0,0 These segments are for the main object RGB Color, Reflection, Transmission and Specularity. The default values for each segment are given as examples. Transmission means filter. Note: If these segments are omitted, the default values for each will appear in the attributes requester while the faces of the object may have different values. CLST 1 255,255,255 0,0,255 RLST 0 0,0,0 TLST 0 0,0,0 Required only if FACE segment exists. These sections are for the RGB Color, Reflection and Transmission for each face of the object. The first data line is set to "0" if only one RGB value will be given to use for all the faces and to "1" if a RGB value will be given for each face of the object. The face order is from the FACE segment. PRP1 255,0,0,0,1.0,0,1,0 This segment gives 8 more object properties to the main object. The first four ( Dither, Hardness, Roughness, Shininess ) are all values between 0 and 255. The fifth ( Index of refraction ) is a whole number between 1.0 and 3.55. The last three ( Quickdraw object, Phong shading, Genlock ) are flags that 1=ON and 0=OFF. The default values for each are given as examples. ANID 0 0,0,0 0,45,0 60,20,60 This segment is used to create "Cycle" objects. The first data line is the "Key" cell number. The second line is the object position. The third is the object axes. The last is the object size. A new segment is written for each "Key" cell but the first cell number must be zero. The cell number sequences of each child object must match the head object. Read the ATTD notes for more information. See example object Cycle.ATTD. ENDO Required - This segment tells ASCIItoTDDD to stop reading object definitions and to close the TDDD object file. ATTD notes ---------- Now I will say a few words about object heirarchies. (If you have no use for grouped objects, you can skip this) At the top of the chain, there is a head object. The head can have children, that can have children, that have children, and so on. The first object defined is the head object and those that follow are children or children of children until the chain is stopped by an ENDO label. For example, if the head object has two children that each have a child of their own, you would create the ATTD file like this. The head object would be written with the TDDD segment set to "1" because it has children. Then a child of the head would be written with the TDDD segment set to "1" because it also has a child. Then the child of the child would be written with TDDD set to "0" because it has no children. After that you would write the other child of the head with TDDD set to "1" and the child of that child with TDDD set to "0". Get the picture? If you are a little lost, just study the examples and you should catch on. NOTE: Group.ATTD is an example of proper object grouping. The ability to create "Cycle" objects with ASCIItoTDDD adds a new level of power to your object building, but you must contend with the added complexity if you use this ability. If you think you are ready to give it a shot, then here it goes. Objects must be prepared for the cycle editor, just like you prepare them in the detail editor. The same rules apply; the objects must be correctly grouped, the axes must be at the bottom of the objects, and the Z axes must extend to the top of the objects. Also, when you set the position of the object for the next "Key" cell, you must calculate the axes direction to maintain proper alignment. There is no single formula for this because you may wish to pivot, twist, or move the object. Some experimentation may be needed but the results are well worth it. NOTE: Dont be alarmed that cycle objects take a little longer to convert. Just be patient and the object will be ready in a few seconds. Cycle.ATTD is an example of cycle object creation. I have done all I could to make this program easy to use and understand. If you have any problems or suggestions, just drop me a line and I will try to give a response as quickly as possible.