Special:
|
[DAT] (requires LDraw-compatible viewer)
|
Subject:
|
wood4.dat, an example of LDLite syntax
|
Newsgroups:
|
lugnet.cad.dat
|
Followup-To:
|
lugnet.cad
|
Date:
|
Sat, 27 Mar 1999 23:10:25 GMT
|
Viewed:
|
869 times
|
| |
| |
1 16 0 0 0 0.001 0 0 0 0.001 0 0 0 0.001 3001.dat
0 The preivous line was inserted to make LUGNET accept this post.
0 Here is my "woodpecker" model, an engineering combat ship
0 designed to clear roads and runways with a planar laser
0 array.
0 It also serves as a tutorial on LDLite extensions to the .dat
0 syntax, such as "0 ROTATE", variable names,
0 and the commands to set or redefine color values.
0
0 Name: wood3.dat
0 97 pieces, give or take a few
0 Oblique view 180% at 800x600
0 Oblique view 140% at 640x480
0 (c) 1999, Paul Gyugyi
0
0 This file uses the LDLITE "*.LDL" syntax,
0 which is a superset of the LDRAW "*.dat" syntax.
0 It tries to be somewhat of a tutorial for the
0 new language features.
0
0 The colors such as "Gray" and "Black" are already
0 defined by LDLITE. Let's pretend I prefer to spell
0 grey the right way. :) I can define a new name for "Grey".
0 Now I can use either Grey or Gray without worrying.
0 COLORNAME Grey 7
0
0 I define the main colors of my model here,
0 so it is easy to try out new colors.
0 COLORNAME accent_color Grey
0 COLORNAME main_color Black
0
0 Let's redefine Blue to use black edges
0 The syntax of a color definition is:
0 0 COLOR index name edge_color r g b alpha d_r d_g d_b d_alpha
0 The index is an index into the color palette. Ldlite allows
0 you to use the numbers 0 to 255. By default, the numbers
0 from 0 to 64 are defined to match LDRAW's, the rest are
0 currently undefined.
0 LDRAW used the numbers from 256 to 511 to represent dithered
0 combinations of the first 16 palette entries. You can still
0 use the numbers from 256 to 511 in your models, but to make
0 life easier, LDLITE allows you to set palette entries to
0 dithered combinations directly. The COLOR command expects
0 two sets of rgb values which it will dither.
0 For solid colors, set both r,g,b,a and d_r,d_g,d_b,d_a to the
0 same values and no dithering will occur.
0 Alpha should be 255 (or 0xff) for opaque colors.
0 For transparent colors, set d_alpha (i.e. on the dithered color) to 0.
0 If you set alpha to zero on both colors, nothing will be drawn at all.
0 I'm re-using the default r,g,b values for blue, which can be
0 found in the ldlite source file "stub.c" near the top.
0 COLOR 1 Blue 0 0x00 0x33 0xb2 0xff 0x00 0x33 0xb2 0xff
0 0 COLOR 1 Blue 0 255 153 0 0 255 153 0 255
0
0 Actually, I've changed my mind. The standard color "Black" in
0 palette index 0 is sort of a really dark grey. I want the
0 edges on blue to be pure black, so I'll use the new "immediate"
0 form of a color, which is seven hexadecimal digits.
0 The first digit is a 4 for opaque colors, or 6 for transparents.
0 The next three digits are the red, green, and blue values
0 ranging from 0 to f. The last three digits are for a
0 dithered color. If you want a solid color, just use the
0 same values you used for the first three digits. Since I
0 want a pure black, the color will be 0x4000000. (I could also
0 use the decimal number 117440512 if I wanted.)
0 Note that the immediate rgb colors have only 1/16th the possible
0 values a palette entry has. If you need precise colors,
0 redefine an unused palette entry.
0 COLOR 1 Blue 0x4000000 0x00 0x33 0xb2 0xff 0x00 0x33 0xb2 0xff
0
0 One trick I use in testing models is to make some parts invisible.
0 Here I set a pair of colors to be inverses of each other, to
0 make sure no edges get drawn.
0 COLOR 255 Invisible 254 0 0 0 0 0 0 0 0
0 COLOR 254 Invisible-Edge 255 0 0 0 0 0 0 0 0
0
0 In LDLITE, you can define points for later use. Here, I define
0 a shorthand for the z axis, so that my later use of
0 the ROTATE command is easier to read.
0 POINT z_axis 0 0 1
0
0 I find transform matricies to be tedious. So I
0 define some shortcut names for the ones I use.
0 MATRIX m_default 1 0 0 0 1 0 0 0 1
0 MATRIX m_rotate90y 0 0 -1 0 1 0 1 0 0
0 MATRIX m_rotaten90z 0 -1 0 1 0 0 0 0 1
0 MATRIX m_rotaten90y 0 0 1 0 1 0 -1 0 0
0 The following transforms are not physically possible,
0 and I should find an equivalent, physical one.
0 MATRIX m_flipz 1 0 0 0 1 0 0 0 -1
0 MATRIX m_flipxz -1 0 0 0 1 0 0 0 -1
0 MATRIX m_swapxz 0 0 1 0 1 0 1 0 0
0
0 Now I being defining my model.
0 landing skids
1 accent_color -60 -8 -90 m_default 3023.dat
1 accent_color -60 -8 90 m_default 3023.dat
1 main_color 80 -8 -50 m_default 3023.dat
1 main_color 80 -8 50 m_default 3023.dat
1 accent_color 90 -32 50 m_rotate90y 4287.dat
1 accent_color 90 -32 -50 m_rotate90y 4287.dat
1 main_color 70 -32 50 m_flipz 3665.dat
1 main_color 70 -32 -50 m_default 3665.dat
0 STEP
0 rear stealth engines
1 main_color -30 -32 -80 m_swapxz 4856.dat
1 36 -70 -24 -70 m_default 4073.dat
1 36 -70 -24 -90 m_default 4073.dat
1 36 -70 -32 -70 m_default 4073.dat
1 36 -70 -32 -90 m_default 4073.dat
1 main_color -30 -32 80 m_swapxz 4856.dat
1 36 -70 -24 70 m_default 4073.dat
1 36 -70 -24 90 m_default 4073.dat
1 36 -70 -32 70 m_default 4073.dat
1 36 -70 -32 90 m_default 4073.dat
0 STEP
0 floating bricks
1 main_color -40 -16 0 m_swapxz 3020.dat
1 main_color 50 -32 0 m_swapxz 3666.dat
0 STEP
0 unitron docking mount
1 Blue -50 -40 -30 m_swapxz 3040.dat
1 Blue -50 -40 30 m_swapxz 3040.dat
1 accent_color -50 -40 0 m_swapxz 3700.dat
1 Blue -30 -40 0 m_swapxz 3010.dat
0 STEP
0 wing surfaces
1 main_color -70 -40 80 m_swapxz 3710.dat
1 main_color -70 -40 -80 m_swapxz 3710.dat
1 main_color 80 -40 80 m_rotate90y 3933.dat
1 main_color 80 -40 -80 m_rotate90y 3934.dat
1 accent_color -20 -40 -120 m_default 3936.dat
1 accent_color -20 -40 120 m_flipxz 3935.dat
1 main_color 40 -40 0 m_swapxz 3020.dat
1 main_color -70 -48 80 m_swapxz 2419.dat
1 main_color -70 -48 -80 m_swapxz 2419.dat
0 STEP
0 shield generators
1 Trans-Light-Green -50 -56 130 m_default 4073.dat
1 Trans-Light-Green -50 -56 -130 m_default 4073.dat
1 Trans-Blue -50 -64 130 m_default 4740.dat
1 Trans-Blue -50 -64 -130 m_default 4740.dat
1 Trans-Light-Green -50 -72 130 m_default 4073.dat
1 Trans-Light-Green -50 -72 -130 m_default 4073.dat
0 STEP
0 cockpit
1 main_color 0 -48 0 m_default 4212.dat
1 accent_color -50 -48 0 m_swapxz 3023.dat
0 STEP
0 engine intake
1 accent_color 30 -64 -70 m_rotate90y 4286.dat
1 accent_color 10 -56 -70 m_default 3024.dat
1 main_color 10 -64 -70 m_default 3024.dat
1 Blue 20 -72 -70 m_default 2412.dat
1 accent_color 30 -64 70 m_rotate90y 4286.dat
1 accent_color 10 -56 70 m_default 3024.dat
1 main_color 10 -64 70 m_default 3024.dat
1 Blue 20 -72 70 m_default 2412.dat
0 STEP
0 This next assembly is several stacks of 1x1 round plates
0 turned sideways and stuck onto a 1x2-1x4 bracket.
0 I make extensive use of the TRANSLATE and ROTATE
0 commands.
0 There are also SCALE and TRANSFORM commands. One cute
0 trick is to surround a set of lines with "0 SCALE 0"
0 and "0 SCALE END" lines. The bricks will not be drawn,
0 which can be helpful when "debugging" your model files.
1 main_color 50 -48 -30 m_default 3024.dat
1 main_color 50 -48 30 m_default 3024.dat
1 main_color 50 -48 0 m_rotate90y 2436.dat
0 Align with the bracket
0 TRANSLATE 72 -38 0
0 Turn stacks on the side
0 ROTATE 90 z_axis
0 Four stacks of 1x1 round plates
0 TRANSLATE 0 0 30
1 Trans-Light-Green 0 0 0 m_default 4073.dat
1 Trans-Blue 0 -8 0 m_default 4073.dat
1 Trans-White 0 -16 0 m_default 4073.dat
0 TRANSLATE END
0 TRANSLATE 0 0 10
1 Trans-Light-Green 0 0 0 m_default 4073.dat
1 Trans-Blue 0 -8 0 m_default 4073.dat
1 Trans-White 0 -16 0 m_default 4073.dat
0 TRANSLATE END
0 TRANSLATE 0 0 -10
1 Trans-Light-Green 0 0 0 m_default 4073.dat
1 Trans-Blue 0 -8 0 m_default 4073.dat
1 Trans-White 0 -16 0 m_default 4073.dat
0 TRANSLATE END
0 TRANSLATE 0 0 -30
1 Trans-Light-Green 0 0 0 m_default 4073.dat
1 Trans-Blue 0 -8 0 m_default 4073.dat
1 Trans-White 0 -16 0 m_default 4073.dat
0 TRANSLATE END
0 ROTATE END
0 TRANSLATE END
0 front planar laser array
0 STEP
0 streamlining, port
1 main_color -40 -72 50 m_flipz 3297.dat
1 main_color 40 -72 50 m_default 2744.dat
1 main_color -60 -80 50 m_default 3023.dat
1 main_color 0 -80 50 m_default 2431.dat
0 STEP
0 streamlining, starboard
1 main_color -40 -72 -50 m_default 3297.dat
1 main_color 40 -72 -50 m_default 2744.dat
1 main_color -60 -80 -50 m_default 3023.dat
1 main_color 0 -80 -50 m_default 2431.dat
0 STEP
0 rear
1 Blue -50 -56 0 m_swapxz 3710.dat
1 main_color -50 -80 0 m_swapxz 3010.dat
1 main_color -60 -104 0 m_swapxz 3001.dat
1 accent_color -60 -104 -50 m_default 3298.dat
1 accent_color -60 -104 50 m_flipz 3298.dat
1 main_color -70 -112 50 m_swapxz 2450.dat
1 main_color -70 -112 -50 m_rotaten90y 2450.dat
1 main_color -60 -112 0 m_rotaten90y 3022.dat
1 accent_color -60 -120 20 m_default 4032.dat
1 accent_color -60 -120 -20 m_default 4032.dat
1 main_color -60 -128 10 m_default 2412.dat
1 main_color -60 -128 -10 m_default 2412.dat
0 STEP
0 windshield
1 main_color 50 -56 -20 m_default 3021.dat
1 main_color 50 -56 20 m_default 3021.dat
1 main_color 40 -64 30 m_default 3023.dat
1 main_color 40 -64 -30 m_default 3023.dat
1 main_color 30 -72 30 m_default 3024.dat
1 main_color 30 -72 -30 m_default 3024.dat
1 accent_color 30 -64 0 m_swapxz 3069p05.dat
1 main_color 60 -64 0 m_default 3022.dat
1 main_color 50 -72 10 m_default 2420.dat
1 main_color 50 -72 -10 m_flipz 2420.dat
1 33 0 -96 0 m_rotate90y 6238.dat
0 STEP
0
1 main_color 10 -104 20 m_swapxz 2412.dat
1 main_color 10 -104 -20 m_swapxz 2412.dat
0 STEP
0 (c) 1999, Paul Gyugyi
|
|
1 Message in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|