Terraformer bugfix causes crash
by Mike Rowley · in Torque Game Engine Advanced · 06/06/2009 (4:26 pm) · 0 replies
After applying this bugfix (from the known issues thread) I get a crash while the main menu loads.
I have renamed this thread and added too it as the original error was my fault.
The fixed code:
Terrain terraformer flips imported heightmaps
First noted in: <= TGE 1.4.2
FIX:
In terraformer.cpp, replace bool Terraformer::loadGreyscale(U32, GBitmap*) with
This returns no errors. It just crashes when the main menu inits.
Any ideas what may have caused this and how I may fix it? I'm clueless.
What I am trying to fix is This problem where the heightmap doesn't line up. I was hoping this fix would fix it.
I have renamed this thread and added too it as the original error was my fault.
The fixed code:
Terrain terraformer flips imported heightmaps
First noted in: <= TGE 1.4.2
FIX:
In terraformer.cpp, replace bool Terraformer::loadGreyscale(U32, GBitmap*) with
bool Terraformer::loadGreyscale(U32 r, GBitmap *bmp)
{
Heightfield *dst = getRegister(r);
for( U32 yh = 0, yb = blockSize - 1; yh < blockSize; yh ++, yb -- )
for( U32 x = 0; x < blockSize; x ++ )
{
ColorI color;
bmp->getColor(x,yb,color);
// compute the luminance of each RGB
dst->val(x, yh) = ((F32)color[0]) * (0.299f/256.0f) +
((F32)color[1]) * (0.587f/256.0f) +
((F32)color[2]) * (0.114f/256.0f);
}
return true;
}This returns no errors. It just crashes when the main menu inits.
Any ideas what may have caused this and how I may fix it? I'm clueless.
What I am trying to fix is This problem where the heightmap doesn't line up. I was hoping this fix would fix it.