Jump to content


Photo

Skarik's Perlin Noise DLL - Extention


  • Please log in to reply
2 replies to this topic

#1 Brawl

Brawl

    Magnitude Games

  • Retired Staff
  • 583 posts
  • Version:GM:Studio

Posted 28 April 2012 - 02:54 AM

I have taken the time (seriously about 15 minutes) to turn Skarik's Perlin Noise DLL into an extension because actual functions are much easier and cleaner than having scripts for everything the DLL should do.

http://dl.dropbox.com/u/9659696/Game%20Maker%20Resources/Perlin%20Noise%20Extension.gex

Yeah. That's about it. I require no credit. If anyone should get credit, it's Skarik, although he doesn't seem to require credit either. Of course, it is much appreciated! :)

MOD EDIT:

Sharik's original Perlin Noise topic:
http://gmc.yoyogames.com/index.php?showtopic=450698

EDIT: Ah, thank you Xot. Should have put that in there. :)

Edited by Brawl, 28 April 2012 - 05:30 PM.

  • 0

#2 Zesterer

Zesterer

    Professor of Articul

  • GMC Member
  • 1022 posts
  • Version:GM8

Posted 12 August 2012 - 10:35 PM

um

I try importing this into my project, and I cant seem to get it to work. All the functions just return 0.

Any ideas?
  • 0

#3 le-mec

le-mec

    GMC Member

  • GMC Member
  • 75 posts
  • Version:GM:Studio

Posted 14 January 2013 - 12:24 PM

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.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users