#include "rays/ruby/shader.h" #include #include "defs.h" using namespace Rucy; static Class cShader; RUCY_DEFINE_VALUE_FROM_TO(Rays::Shader, cShader) #define THIS to(self) #define CHECK RUCY_CHECK_OBJECT(Rays::Shader, cShader, self) static VALUE alloc(VALUE klass) { return new_type(klass); } static VALUE initialize(VALUE self, VALUE source) { RUCY_CHECK_OBJ(Rays::Shader, cShader, self); if (!source.is_s()) argument_error(__FILE__, __LINE__); *THIS = Rays::Shader(source.c_str()); return self; } void Init_shader () { Module mRays = rb_define_module("Rays"); cShader = rb_define_class_under(mRays, "Shader", rb_cObject); rb_define_alloc_func(cShader, alloc); rb_define_private_method(cShader, "initialize", RUBY_METHOD_FUNC(initialize), 1); } namespace Rays { Class shader_class () { return cShader; } }// Rays