Just tried using this - it crashes on runtime on a new scene, create a blank object with the following code in the Create event:
perlin_create(1, 1, 1, 1);
EDIT: Went through the extension and changed all DLL calls from STDCALL to CDECL - crashes have stopped.
However, just getting 0 from perlin_get.
As a check to make sure that it was actually running the DLL's functions, I removed my perlin_create function and performed a perlin_get, and got the built in error messages that say that no perlin objects were created -- so I know it's doing SOMETHING.
EDIT: SOLVED!
GM_EXPORT double Init( void )
{
// CREATE
perlinVector = new std::vector < Perlin * > ; // LIST OF PERLINS
indexVector = new std::vector < unsigned int * > ; // LIST OF PERLIN INDEXES
iCurrentIndex = new unsigned int; // LAZY MAN's INDEX
*iCurrentIndex = 0; // You forgot to initialize that variable!
return TRUE;
}
I stepped through the source code (throwing in message boxes all the way) and discovered that you cannot feed perlin_get integer coordinates for x and y or the value will always be 0. They have to be floating-point values.
So if you're using integer values, you have to use something like: perlin_get(x/10000, y/10000) and boost the frequency on the perlin_create.
Edited by le-mec, 15 January 2013 - 03:47 AM.