Exposing a ”calculateHeight(r,g,b)” in ImageBasedHeightMap

Hi guys,

I wanted to ask whether one of the developers could add to the ImageBasedHeightMap class a calculateHeight(r,g,b) method. I once talked with @Sploreg about it but it somehow got lost and it was commented out afterwards and I dont know why :(.

Right now, if I want my own inherited heightmap class that calculates the heights differently I also have to write down the whole load()-functionality which is very uncomfortable. At the moment the code


float grayscale = (float) ((0.299 * red + 0.587 * green + 0.114 * blue) * dampen);

heightData[index++] = grayscale;

//heightData[index++] = calculateHeight(red,green,blue);


are found at lines 225, 239, 258,272.

Just remove the “//” tags, the two lines before that and add the following method to the class:


public float calculateHeight(float red, float green, float blue)


return (float) ((0.299 * red + 0.587 * green + 0.114 * blue) * dampen);


Because if now one inherits the class one only has to override this one method to accomplish a different height calculation. Would be really great if someone would do me this favor :slight_smile:

Cheers and thx

Done and in SVN.

Sorry for the late response, apparently I’m not getting email notifications for @mention tags …

Thanks Dodikles

Yay, thx :slight_smile: