Obviously depending on the application, generating the noise maps can take quite some time. Could you add the ability to register a function pointer with libnoise that will be called to pass progress information to like how much has been processed versus how much is total so that progress can optionally be fed back to the user or application that is using it?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'll add methods to the noiseutils library that allows you to pass in a callback function. For simplicity, the callback function will have only one int as a parameter; this will be the current scanline being processed.
-- jas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry if I wasn't clear. The noiseutils library calculates the height map values one horizontal line at a time. This callback function will pass the number of horizontal lines it has already calculated. Using this number, it'll be easy to determine the completion percentage.
For example, if your height map is 2,000 pixels high and it's currently calculating the 40th line of the height map, it'll pass the value 40 to the callback function. It's easy to see that the creation of this height map is 2% (40/2000) done.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the noise map builder classes, there's a method called SetCallback(). It takes a function pointer of the format:
void someFunction (int)
This callback function is called by the Build() method each time it has completed generating a row. The int parameter specifies the number of rows completed.
Let me know if this works.
-- jas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Obviously depending on the application, generating the noise maps can take quite some time. Could you add the ability to register a function pointer with libnoise that will be called to pass progress information to like how much has been processed versus how much is total so that progress can optionally be fed back to the user or application that is using it?
Hi Jeremy,
I'll add methods to the noiseutils library that allows you to pass in a callback function. For simplicity, the callback function will have only one int as a parameter; this will be the current scanline being processed.
-- jas
Can you clarify what you mean by scanline? Would that value be usable to calculate a rough % done estimate?
Hi Jeremy,
Sorry if I wasn't clear. The noiseutils library calculates the height map values one horizontal line at a time. This callback function will pass the number of horizontal lines it has already calculated. Using this number, it'll be easy to determine the completion percentage.
For example, if your height map is 2,000 pixels high and it's currently calculating the 40th line of the height map, it'll pass the value 40 to the callback function. It's easy to see that the creation of this height map is 2% (40/2000) done.
excellent thanks.
OK, it's done. Go and download the noiseutils library again.
http://libnoise.sourceforge.net/downloads/noiseutils.zip
In the noise map builder classes, there's a method called SetCallback(). It takes a function pointer of the format:
void someFunction (int)
This callback function is called by the Build() method each time it has completed generating a row. The int parameter specifies the number of rows completed.
Let me know if this works.
-- jas