Sha256: 5acffcec1d045a83ee10f0450bc497df9d64f9da4c6189fffa17405c50d56fe4

Contents?: true

Size: 993 Bytes

Versions: 17

Compression:

Stored size: 993 Bytes

Contents

#include "rays/noise.h"
#include "rays/ruby/point.h"
#include "defs.h"


static
VALUE perlin(VALUE self)
{
	check_arg_count(__FILE__, __LINE__, "Rays.perlin", argc, 1, 2, 3, 4);

	coord noise = 0;
	if (argc == 4)
	{
		noise = Rays::perlin(
			to<coord>(argv[0]),
			to<coord>(argv[1]),
			to<coord>(argv[2]),
			to<coord>(argv[3]));
	}
	else
		noise = Rays::perlin(to<Rays::Point>(argc, argv));

	return value(noise);
}

static
VALUE simplex(VALUE self)
{
	check_arg_count(__FILE__, __LINE__, "Rays.simplex", argc, 1, 2, 3, 4);

	coord noise = 0;
	if (argc == 4)
	{
		noise = Rays::simplex(
			to<coord>(argv[0]),
			to<coord>(argv[1]),
			to<coord>(argv[2]),
			to<coord>(argv[3]));
	}
	else
		noise = Rays::simplex(to<Rays::Point>(argc, argv));

	return value(noise);
}


void
Init_noise ()
{
	Module mRays = rb_define_module("Rays");
	rb_define_singleton_method(mRays, "perlin", RUBY_METHOD_FUNC(perlin), -1);
	rb_define_singleton_method(mRays, "simplex", RUBY_METHOD_FUNC(simplex), -1);
}

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rays-0.1.29 .doc/ext/rays/noise.cpp
rays-0.1.28 .doc/ext/rays/noise.cpp
rays-0.1.27 .doc/ext/rays/noise.cpp
rays-0.1.26 .doc/ext/rays/noise.cpp
rays-0.1.25 .doc/ext/rays/noise.cpp
rays-0.1.24 .doc/ext/rays/noise.cpp
rays-0.1.23 .doc/ext/rays/noise.cpp
rays-0.1.22 .doc/ext/rays/noise.cpp
rays-0.1.21 .doc/ext/rays/noise.cpp
rays-0.1.20 .doc/ext/rays/noise.cpp
rays-0.1.19 .doc/ext/rays/noise.cpp
rays-0.1.18 .doc/ext/rays/noise.cpp
rays-0.1.17 .doc/ext/rays/noise.cpp
rays-0.1.16 .doc/ext/rays/noise.cpp
rays-0.1.15 .doc/ext/rays/noise.cpp
rays-0.1.14 .doc/ext/rays/noise.cpp
rays-0.1.13 .doc/ext/rays/noise.cpp