Specular modification wasn't taking into account the neighbours, generating a regular sized image, and so ImageProcessor::calculate_specular() was trying to crop the new specular image to the size it already was. Apparently, the CImg default behaviour without adding a boundary_conditions flag to crop() in this situation is to fill the image in with black (???)
I changed ImageProcessor::modify_specular() to use the same process as the parallax generation, i.e. use TextureTypes::Neighbours image if tileable, else TextureTypes::SpecularBase. This generates the bigger image for tile mode that can be successfully cropped, which fixes the black output image, and also correctly fixes up the edges of the specular map for tiling.
Since the heightmap is regenerated when update_tileable is set to true by tile mode properties being changed, I added calculate_specular() alongside it so specular is also updated.
Fixes #96
Specular modification wasn't taking into account the neighbours, generating a regular sized image, and so
ImageProcessor::calculate_specular()
was trying to crop the new specular image to the size it already was. Apparently, the CImg default behaviour without adding aboundary_conditions
flag tocrop()
in this situation is to fill the image in with black (???)I changed
ImageProcessor::modify_specular()
to use the same process as the parallax generation, i.e. useTextureTypes::Neighbours
image iftileable
, elseTextureTypes::SpecularBase
. This generates the bigger image for tile mode that can be successfully cropped, which fixes the black output image, and also correctly fixes up the edges of the specular map for tiling.Since the heightmap is regenerated when
update_tileable
is set to true by tile mode properties being changed, I addedcalculate_specular()
alongside it so specular is also updated.