#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(argv[0]), to(argv[1]), to(argv[2]), to(argv[3])); } else noise = Rays::perlin(to(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(argv[0]), to(argv[1]), to(argv[2]), to(argv[3])); } else noise = Rays::simplex(to(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); }