Subject:
|
Re: LDraw extended colors
|
Newsgroups:
|
lugnet.cad.dev
|
Date:
|
Mon, 20 Mar 2000 00:04:04 GMT
|
Viewed:
|
1717 times
|
| |
| |
In lugnet.cad.dev, Lars C. Hassing wrote:
> The LDraw colors are 0-15, 32-47, 256-511 (and of course 16 and 24).
> Paul Gyugyi defined some more colors for LDLite, 17-23, 25, 57
> and "Direct Colors" in the range 0x04000000-0x07FFFFFF.
>
> As MLCad supports these colors, I'm going to add support for them too.
>
> However, Gyugyi packed two RGB's (for dithering) into each Direct Color
> leaving only 12 bits to each RGB, e.g. 0x04RGBRGB.
> Some L3P and L3Lab users have asked for the possibility to specify
> "true colors" (24 bit RGB's), so I would like to define/reserve the range
> 0x02000000-0x03FFFFFF for this.
> 0x02RRGGBB for solid colors and 0x03RRGGBB for transparent.
>
> I will support, but not require, hex notation for colors (0x/0X prefix).
>
> I hope MLCad, LDLite and other tools will support the new range too.
During implementation of Gyugyi's Direct Colors, I browsed his LDLite code:
| if ((c >= 0x4000000) && (c <= 0x7ffffff))
| {
| /Numbers of 0x4000000 to 0x7ffffff are hard coded color values.
| zcp->r = 16 * ((c & 0x00000f00) >> 8);
| zcp->g = 16 * ((c & 0x000000f0) >> 4);
| zcp->b = 16 * ((c & 0x0000000f) >> 0);
| if (c & 0x1000000)
| zcp->a = 0x0;
| else
| zcp->a = 0xff;
| zcs->r = 16 * ((c & 0x00f00000) >> 20);
| zcs->g = 16 * ((c & 0x000f0000) >> 16);
| zcs->b = 16 * ((c & 0x0000f000) >> 12);
| if (c & 0x2000000)
| zcs->a = 0x0;
| else
| zcs->a = 0xff;
| }
and read his doc:
|3. Direct colors
|LDLITE defines the color values from 0x4000000 to 0x7ffffff. These
|represent two 12-bit colors which are dithered together, and cannot
|be redefined. They are intended to be used in converting meshes from
|other 3D formats. While you can use decimal numbers, the hex
|representation makes the structure clear. The edge color for all
|direct colors is pure black.
|
|The first (leftmost, most significant) hex digit defines whether the
|color will be transparent. "4" is an opaque color. "5" or "6" create
|transparent colors. "7" will create an invisible color which will not
|be drawn at all. You can interpret the two least significant bits
|of this digit as inverted alpha values.
|
|The second, third and fourth digits are the red, green and blue
|intensities of the first dithered color. These digits are ignored
|for colors in the ranges 0x5000000 to 0x5ffffff and 0x7000000 to 0x7ffffff.
|
|The fifth, sixth and seventh digits are the red, green and blue
|intensities of the second dithered color. For pure colors, set these
|to the same as the second, third and fourth digits. These digits are
|ignored for colors in the range 0x6000000 to 0x7ffffff.
The code and the doc doesn't match!
If the code is the "truth", then the hex ranges in the last two
paragraphs should be swapped:
|The second, third and fourth digits are the red, green and blue
|intensities of the first dithered color. These digits are ignored
|for colors in the range 0x6000000 to 0x7ffffff.
|
|The fifth, sixth and seventh digits are the red, green and blue
|intensities of the second dithered color. For pure colors, set these
|to the same as the second, third and fourth digits. These digits are
|ignored for colors in the ranges 0x5000000 to 0x5ffffff and
|0x7000000 to 0x7ffffff.
Please decide which to change, the code or the doc.
(FYI MLCad follows the code)
Also I would like to suggest that 16 is replaced with 17 (0x11):
| zcp->r = 17 * ((c & 0x00000f00) >> 8);
| zcp->g = 17 * ((c & 0x000000f0) >> 4);
| zcp->b = 17 * ((c & 0x0000000f) >> 0);
In this way the max color intensity of 15 (0xF) gets mapped to 255 (0xFF)
in stead of just 240 (0xF0).
/Lars
|
|
Message has 1 Reply:
Message is in Reply To:
| | LDraw extended colors
|
| The LDraw colors are 0-15, 32-47, 256-511 (and of course 16 and 24). Paul Gyugyi defined some more colors for LDLite, 17-23, 25, 57 and "Direct Colors" in the range 0x04000000-0x07FFFFFF. As MLCad supports these colors, I'm going to add support for (...) (25 years ago, 1-Mar-00, to lugnet.cad.dev)
|
6 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|