Sha256: 0466a0cd5a108923840f8c60afdb6697217007af885c8998c503c7de6c4e1e66

Contents?: true

Size: 996 Bytes

Versions: 8

Compression:

Stored size: 996 Bytes

Contents

#include "rays/util.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_rays_util ()
{
	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

8 entries across 8 versions & 1 rubygems

Version Path
rays-0.3.3 .doc/ext/rays/util.cpp
rays-0.3.2 .doc/ext/rays/util.cpp
rays-0.3.1 .doc/ext/rays/util.cpp
rays-0.3 .doc/ext/rays/util.cpp
rays-0.2.1 .doc/ext/rays/util.cpp
rays-0.2 .doc/ext/rays/util.cpp
rays-0.1.49 .doc/ext/rays/util.cpp
rays-0.1.48 .doc/ext/rays/util.cpp