Possible Color.h Bug
by Michael Gesner · in Torque Game Engine · 11/05/2003 (11:25 am) · 3 replies
In color.h, two functions are defined for ColorI for endian color usage.
It appears both functions return the same value. Upon changing the functions to reflect what they are supposed to be returning, the resultant rendered image is miscolored.
This should be:
This assumes that the endian functions are as follows:
Although logic shows that the second method of returning data is correct, the rendered image is clearly different than expected. Does this bug go deeper than color.h ? Or is the function naming convention simply not logically tied to the return value ?
It appears both functions return the same value. Upon changing the functions to reflect what they are supposed to be returning, the resultant rendered image is miscolored.
inline U32 ColorI::getARGBPack() const
{
return (U32(alpha) << 24) |
(U32(red) << 16) |
(U32(green) << 8) |
(U32(blue) << 0);
}
...
inline U32 ColorI::getABGRPack() const
{
return (U32(alpha) << 24) |
(U32(red) << 16) |
(U32(green) << 8) |
(U32(blue) << 0);
}This should be:
inline U32 ColorI::getARGBPack() const
{
return (U32(alpha) << 24) |
(U32(red) << 16) |
(U32(green) << 8) |
(U32(blue) << 0);
}
...
inline U32 ColorI::getABGRPack() const
{
return (U32(alpha) << 24) |
(U32(blue) << 16) |
(U32(green) << 8) |
(U32(red) << 0);
}This assumes that the endian functions are as follows:
inline U32 ColorI::getRGBEndian() const
{
#if defined(TORQUE_OS_MAC)
return(getRGBPack());
#else
return(getBGRPack());
#endif
}
inline U32 ColorI::getARGBEndian() const
{
#if defined(TORQUE_OS_MAC)
return(getABGRPack());
#else
return(getARGBPack());
#endif
}Although logic shows that the second method of returning data is correct, the rendered image is clearly different than expected. Does this bug go deeper than color.h ? Or is the function naming convention simply not logically tied to the return value ?
#2
Thus, the only platforms that are going to be affected are big endian systems.
I made certain to leave the PC as it was, as it was not having problems. This bug is related to the fog rendering problem on the mac, and is where I uncovered the function definition problem.
11/06/2003 (12:00 pm)
Well... unless I've missed something, the mac doesn't have any ASM files that I am aware of. I suppose I should have quantified that. I have not changed any of the code that affects the pc.Thus, the only platforms that are going to be affected are big endian systems.
I made certain to leave the PC as it was, as it was not having problems. This bug is related to the fog rendering problem on the mac, and is where I uncovered the function definition problem.
#3
Unless I'm missing something, I havent seen any further fog color endian issues after the change to color.h. But hey, I miss plenty of stuff. I'm not sure what to look for. My two platforms appear to be the same.
12/15/2003 (6:13 am)
Michael, post a screenshot of the prob you are seeing?Unless I'm missing something, I havent seen any further fog color endian issues after the change to color.h. But hey, I miss plenty of stuff. I'm not sure what to look for. My two platforms appear to be the same.
Torque 3D Owner Robert Blanchet Jr.