Menu

Progress listener

2005-02-28
2013-04-30
  • Jeremy Swigart

    Jeremy Swigart - 2005-02-28

    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?

     
    • Jason Bevins

      Jason Bevins - 2005-03-01

      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

       
    • Jeremy Swigart

      Jeremy Swigart - 2005-03-02

      Can you clarify what you mean by scanline? Would that value be usable to calculate a rough % done estimate?

       
      • Jason Bevins

        Jason Bevins - 2005-03-02

        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.

         
    • Jeremy Swigart

      Jeremy Swigart - 2005-03-02

      excellent thanks.

       
    • Jason Bevins

      Jason Bevins - 2005-03-04

      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

       

Log in to post a comment.