Game Development Reference
In-Depth Information
want to keep the value of the alpha channel and apply it towards our final color), the al-
phachannel'svaluewillrangefrom{0..255} whichisconvenientifyourememberthatour
color_lut class holds a 256 value array with color information. We will use the value of the
alpha channel to index into the color_lut and retrieve the color we wish to use for that par-
ticular height. None of the colors in the color_lut have any alpha information of their own
(or if they do in the source texture, we will ignore it), the line:
finalColor = ( (*m_colorLUT)[a] & 0x00ffffff) | ( a << 24 );
Translates to clear out only the first 8 bits, then add in the alpha value shifted into those
first 8 bits. Having our final color value as a 32-bit value, we build a color entity and we
assign it to our source pixel reference variable.
NOTE: The color is converted to a 32-bit ABGR to conform to the DDS file format used,
this may vary depending on the platform used.
And that's it, the heatmap has been generated and colorized and is ready to be rendered
and/or saved to file.
Figure 77 - 3,000 points on a 256x256 heatmap with an 8x8 radial gradient.
Search WWH ::

Custom Search