Skip to content

Commit

Permalink
fixed issue #2, appears I should have been using RFLOAT_VALUE(obj) in…
Browse files Browse the repository at this point in the history
…stead of RFLOAT(obj)->value for compatibility across rubies. also added a small fix by nilclass from awhile back
  • Loading branch information
boj committed Oct 31, 2011
1 parent 00b6b35 commit 05e8bee
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions perlin.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The main initialize function which recieves the inputs persistence and octave.
*/
VALUE Perlin_init(VALUE self, VALUE seed_value, VALUE persistence, VALUE octave)
{
persistence = rb_funcall(persistence, rb_intern("to_f"), 0);
rb_iv_set(self, "@persistence", persistence);
rb_iv_set(self, "@octave", NUM2INT(octave));

Expand Down Expand Up @@ -147,7 +148,7 @@ Takes points (x, y) and returns a height (n)
*/
VALUE perlin_run(VALUE self, const VALUE x, const VALUE y)
{
const float p = RFLOAT(rb_iv_get(self, "@persistence"))->value;
const float p = RFLOAT_VALUE(rb_iv_get(self, "@persistence"));
const int n = rb_iv_get(self, "@octave");
float total = 0.;
float frequency = 1., amplitude = 1.;
Expand All @@ -167,7 +168,7 @@ Takes points (x, y, z) and returns a height (n)
*/
VALUE perlin_run3d(VALUE self, const VALUE x, const VALUE y, const VALUE z)
{
const float p = RFLOAT(rb_iv_get(self, "@persistence"))->value;
const float p = RFLOAT_VALUE(rb_iv_get(self, "@persistence"));
const int n = rb_iv_get(self, "@octave");
float total = 0.;
float frequency = 1., amplitude = 1.;
Expand Down

0 comments on commit 05e8bee

Please sign in to comment.