Sha256: 5c65f2c349f37681ef10c7713ebf42b5ed0f3763e2a98ead1e50df1d3122f1ce

Contents?: true

Size: 945 Bytes

Versions: 5

Compression:

Stored size: 945 Bytes

Contents

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


static
RUCY_DEFN(perlin)
{
	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);
}
RUCY_END

static
RUCY_DEFN(simplex)
{
	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);
}
RUCY_END


void
Init_rays_util ()
{
	Module mRays = define_module("Rays");
	mRays.define_singleton_method("perlin", perlin);
	mRays.define_singleton_method("simplex", simplex);
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rays-0.3 ext/rays/util.cpp
rays-0.2.1 ext/rays/util.cpp
rays-0.2 ext/rays/util.cpp
rays-0.1.49 ext/rays/util.cpp
rays-0.1.48 ext/rays/util.cpp