-
Notifications
You must be signed in to change notification settings - Fork 13
Color
- Draw color is based on 8bit (0-255) RGBA: color_r, color_g, color_b and color_a.
- RGB values are updated when the user changes either: palette_id & color_id.
- RGBA values also effect Texture Maps.
- RGB color (auto) set using 'color_id' when color_r/g/b are all zero's.
- Black requires a valid ID pair, (ie: palette_id=0, color_id=19).
- Press '-' or '+' key to change color_id.
- Press ALT+'-' or ALT+'+' to change palette_id.
- Press '9' or '0' key to change (alpha) color_a.
- Use the 'Color' tool to set a custom RGBA value using a (3D) mouse, ball, 6DoF stylus, etc.
- Custom colors are NOT based on palette ID's and will be lost if the user changes the color index.
- Note that the (color_a) alpha Transparency level is NOT effected when switching the color index.
When the user changes the geometry to a custom 3D model, the RGB color is automatically set to full white (for texture mapping to appear in it's natural color). Also note that the color & palette ID's will be left unchanged. When switching the node back to the set of hard-coded (geo) primitives, the color will return to its original values.
There are several hard-coded palettes:
- palette_id = 0 is a distinct set of 20 colors.
- palette_id = 1 is same as palette '0' but inverted.
- palette_id = 2 'Rainbow Heatmap' (a composite of gradients).
- palette_id = 3 'Rainbow Heatmap' inverted.
- palette_id's 4-25 are gradients with 256 color_id's each (0-255).
- Odd palette_id's are inverted colors (mirrors) of their Even numbered predecessor.
- Most palette's are linear gradients between two colors (ie: blue to green).
We plan to add more hard-coded and custom palettes in the future (ie: NWS heatmaps).
Function npSetIndexColor() in 'npcolor.c' sets the RGBA color based on palette_id and color_id.
switch( paletteID )
{
case 0 : // use indexed color array above
case 1 : // odd cases are inverted after switch statement
color->r = colorPalette[colorID][0];
color->g = colorPalette[colorID][1];
color->b = colorPalette[colorID][2];
break;
case 2 : ///< rainbow heatmap
case 3 : ///< rainbow heatmap inverted
if( colorID < 16 ) // light-pink to purple
{
color->r = 255 - colorID * 8;
color->g = 127 - colorID * 8;
color->b = 255 - colorID * 8;
}
else if( colorID < 32 ) // purple to blue-green
{
color->r = 255 - colorID * 8;
color->g = (colorID - 16) * 8;
color->b = (colorID - 16) * 8 + 127;
}
else if( colorID < 48 ) // blue-green to green
{
color->r = 0;
color->g = 127 + (colorID - 32) * 8;
color->b = 255 - (colorID - 32) * 16;
}
else if( colorID < 64 ) // green to yellow
{
color->r = (colorID - 48) * 16;
color->g = 255;
color->b = 0;
}
else if( colorID < 80 ) // yellow to orange
{
color->r = 255;
color->g = 255 - (colorID - 64) * 8;
color->b = 0;
}
else if( colorID < 96 ) // orange to red
{
color->r = 255;
color->g = 127 - (colorID - 80) * 8;
color->b = 0;
}
else if( colorID < 112 ) // red to dark-red
{
color->r = 255 - (colorID - 96) * 8;
color->g = 0;
color->b = 0;
}
else if( colorID < 128 ) // dark-red to light-pink
{
color->r = 127 + (colorID - 112) * 8;
color->g = (colorID - 112) * 8;
color->b = (colorID - 112) * 16;
}
break;
case 4 : // blue to green
case 5 : // inverted
color->r = 0;
color->g = colorID * 2;
color->b = 255 - colorID * 2;
break;
case 6 : // green to red
case 7 : // inverted
color->r = colorID * 2;
color->g = 255 - colorID * 2;
color->b = 0;
break;
case 8 : // blue to red
case 9 : // ...
color->r = colorID * 2;
color->g = 0;
color->b = 255 - colorID * 2;
break;
case 10 : // purple to yellow
case 11 :
color->r = 255;
color->g = colorID * 2;
color->b = 255 - colorID * 2;
break;
case 12 : // black to red
case 13 :
color->r = colorID * 2;
color->g = 0;
color->b = 0;
break;
case 14 : // black to green
case 15 :
color->r = 0;
color->g = colorID * 2;
color->b = 0;
break;
case 16 : // black to blue
case 17 :
color->r = 0;
color->g = 0;
color->b = colorID * 2;
break;
case 18 : // white to red
case 19 :
color->r = 255;
color->g = 255 - colorID * 2;
color->b = 255 - colorID * 2;
break;
case 20 : // white to green
case 21 :
color->r = 255 - colorID * 2;
color->g = 255;
color->b = 255 - colorID * 2;
break;
case 22 : // white to blue
case 23 :
color->r = 255 - colorID * 2;
color->g = 255 - colorID * 2;
color->b = 255;
break;
case 24 : // black to white greyscale
case 25 :
color->r = colorID * 2;
color->g = colorID * 2;
color->b = colorID * 2;
break;
default :
color->r = colorPalette[colorID][0];
color->g = colorPalette[colorID][1];
color->b = colorPalette[colorID][2];
break;
}
/// if odd numbered paletteID then invert the color
if( paletteID & 1)
{
color->r = 255 - color->r;
color->g = 255 - color->g;
color->b = 255 - color->b;
}
© 2024 Shane Saxon. All rights reserved.
Saxon Digital™, Neuralphysics™, Neural Physics Engine™, NPE™, PODmind™, 7viz™, FileViz™, GaiaVizⓇ, CoderViz™, Csync™, lazyC™, Xr™, Xreality™, ANTz+Fx™, ANTz+™, OpenANTz™, ANTz+Xr™ and the ANTz+Xr™ logo, the Saxon Digital slogans, and the Saxon Digital product names are trademarks of Saxon Digital in the U.S. and/or other countries. All other product names, trademarks, and/or company names are used solely for identification and belong to their respective owners.
Maintained by: OpenANTz.com