rays 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.doc/ext/rays/bitmap.cpp +76 -53
- data/.doc/ext/rays/font.cpp +31 -27
- data/.doc/ext/rays/image.cpp +44 -37
- data/.doc/ext/rays/native.cpp +6 -0
- data/.doc/ext/rays/painter.cpp +276 -160
- data/.doc/ext/rays/rays.cpp +8 -9
- data/.doc/ext/rays/texture.cpp +50 -28
- data/.gitignore +14 -0
- data/Rakefile +5 -30
- data/VERSION +1 -1
- data/ext/rays/bitmap.cpp +77 -53
- data/ext/rays/bounds.cpp +426 -0
- data/ext/rays/color.cpp +199 -0
- data/ext/rays/defs.h +1 -18
- data/ext/rays/extconf.rb +10 -8
- data/ext/rays/font.cpp +31 -27
- data/ext/rays/image.cpp +44 -37
- data/ext/rays/matrix.cpp +154 -0
- data/ext/rays/native.cpp +6 -0
- data/ext/rays/painter.cpp +288 -163
- data/ext/rays/point.cpp +175 -0
- data/ext/rays/rays.cpp +8 -9
- data/ext/rays/texture.cpp +52 -28
- data/include/rays.h +1 -2
- data/include/rays/bitmap.h +5 -3
- data/include/rays/bounds.h +94 -0
- data/include/rays/color.h +53 -0
- data/include/rays/colorspace.h +2 -2
- data/include/rays/exception.h +1 -1
- data/include/rays/font.h +7 -3
- data/include/rays/image.h +6 -2
- data/include/rays/matrix.h +63 -0
- data/include/rays/opengl.h +1 -1
- data/include/rays/painter.h +138 -39
- data/include/rays/point.h +39 -0
- data/include/rays/ruby.h +3 -0
- data/include/rays/ruby/bitmap.h +5 -3
- data/include/rays/ruby/bounds.h +41 -0
- data/include/rays/ruby/color.h +41 -0
- data/include/rays/ruby/font.h +5 -3
- data/include/rays/ruby/image.h +5 -3
- data/include/rays/ruby/matrix.h +41 -0
- data/include/rays/ruby/painter.h +5 -3
- data/include/rays/ruby/point.h +41 -0
- data/include/rays/ruby/texture.h +5 -3
- data/include/rays/texture.h +6 -2
- data/lib/rays.rb +3 -0
- data/lib/rays/autoinit.rb +1 -1
- data/lib/rays/bitmap.rb +15 -1
- data/lib/rays/bounds.rb +138 -0
- data/lib/rays/color.rb +52 -0
- data/lib/rays/ext.rb +4 -0
- data/lib/rays/image.rb +1 -1
- data/lib/rays/module.rb +9 -2
- data/lib/rays/painter.rb +40 -41
- data/lib/rays/point.rb +82 -0
- data/lib/rays/texture.rb +1 -1
- data/rays.gemspec +16 -37
- data/src/bounds.cpp +234 -0
- data/src/cocoa/bitmap.mm +4 -4
- data/src/cocoa/font.mm +35 -30
- data/src/cocoa/rays.mm +2 -0
- data/src/color.cpp +77 -0
- data/src/colorspace.cpp +3 -3
- data/src/exception.cpp +3 -18
- data/src/image.cpp +9 -2
- data/src/matrix.cpp +103 -0
- data/src/painter.cpp +475 -224
- data/src/point.cpp +52 -0
- data/src/texture.cpp +14 -2
- data/src/win32/bitmap.cpp +2 -2
- data/src/win32/gdi.cpp +22 -13
- data/src/win32/gdi.h +7 -7
- data/test/helpers.rb +1 -5
- data/test/test_bitmap.rb +9 -0
- data/test/test_bounds.rb +246 -0
- data/test/test_color.rb +88 -0
- data/test/test_font.rb +28 -0
- data/test/test_image.rb +9 -0
- data/test/test_painter.rb +1 -3
- data/test/test_point.rb +121 -0
- data/test/test_rays.rb +2 -3
- data/test/test_texture.rb +1 -3
- metadata +146 -75
- data/include/rays/helpers.h +0 -37
- data/include/rays/transform.h +0 -35
- data/src/helpers.cpp +0 -22
- data/src/transform.cpp +0 -88
data/ext/rays/defs.h
CHANGED
@@ -7,24 +7,7 @@
|
|
7
7
|
#include <rays/exception.h>
|
8
8
|
|
9
9
|
|
10
|
-
using Rays::
|
11
|
-
|
12
|
-
|
13
|
-
#define CHECK_OBJ(obj, type, klass) \
|
14
|
-
do \
|
15
|
-
{ \
|
16
|
-
type* p = Rucy::get_type<type>(obj, klass); \
|
17
|
-
if (!p) Rucy::invalid_object_error(); \
|
18
|
-
} \
|
19
|
-
while(0)
|
20
|
-
|
21
|
-
#define CHECK_OBJECT(obj, type, klass) \
|
22
|
-
do \
|
23
|
-
{ \
|
24
|
-
type* p = Rucy::get_type<type>(obj, klass); \
|
25
|
-
if (!p || !*p) Rucy::invalid_object_error(); \
|
26
|
-
} \
|
27
|
-
while(0)
|
10
|
+
using Rays::rays_error;
|
28
11
|
|
29
12
|
|
30
13
|
#endif//EOH
|
data/ext/rays/extconf.rb
CHANGED
@@ -1,11 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
|
4
|
-
|
5
|
-
$: << File.expand_path(File.join File.dirname(__FILE__), *path.split('/'))
|
6
|
-
end
|
7
|
-
|
8
|
-
require 'rubygems'
|
4
|
+
require 'bundler/setup'
|
9
5
|
require 'mkmf'
|
10
6
|
require 'xot/rake/helpers'
|
11
7
|
require 'xot/module'
|
@@ -15,7 +11,8 @@ require 'rays/module'
|
|
15
11
|
include Xot::Rake
|
16
12
|
|
17
13
|
|
18
|
-
|
14
|
+
debug = env :DEBUG, false
|
15
|
+
|
19
16
|
|
20
17
|
DEFS = []
|
21
18
|
INCDIRS = %w[
|
@@ -40,7 +37,8 @@ LIBS = %w[
|
|
40
37
|
FRAMEWORKS = []
|
41
38
|
|
42
39
|
|
43
|
-
DEFS << '_DEBUG' if
|
40
|
+
DEFS << '_DEBUG' if debug
|
41
|
+
DEFS << 'NDEBUG' unless debug
|
44
42
|
DEFS << $~[0].upcase if RUBY_PLATFORM =~ /mswin|ming|cygwin|darwin/i
|
45
43
|
if win32?
|
46
44
|
DEFS << 'WINDOWS' << 'WIN32'
|
@@ -54,9 +52,13 @@ $CPPFLAGS << DEFS.map {|s| " -D#{s}"}.join
|
|
54
52
|
$CPPFLAGS << INCDIRS.map {|s| " -I#{s}"}.join
|
55
53
|
$LDFLAGS << LIBDIRS.map {|s| " -L#{s}"}.join
|
56
54
|
$LDFLAGS << FRAMEWORKS.map {|s| " -framework #{s}"}.join
|
55
|
+
$LDFLAGS << ' -Wl,--out-implib=native.dll.a' if cygwin?
|
56
|
+
$CFLAGS << ' --stdlib=libc++' if clang?
|
57
57
|
$LOCAL_LIBS << ' -lrucy'
|
58
58
|
|
59
|
-
|
59
|
+
RbConfig::CONFIG.each do |key, val|
|
60
|
+
{'gcc' => 'g++', 'clang' => 'clang++'}.each {|from, to| val.gsub! from, to}
|
61
|
+
end
|
60
62
|
|
61
63
|
|
62
64
|
dir_config 'boost'
|
data/ext/rays/font.cpp
CHANGED
@@ -10,12 +10,13 @@ using namespace Rucy;
|
|
10
10
|
using Rays::coord;
|
11
11
|
|
12
12
|
|
13
|
+
static Class cFont;
|
14
|
+
|
15
|
+
|
13
16
|
namespace Rays
|
14
17
|
{
|
15
18
|
|
16
19
|
|
17
|
-
static Class cFont;
|
18
|
-
|
19
20
|
Class
|
20
21
|
font_class ()
|
21
22
|
{
|
@@ -31,38 +32,43 @@ namespace Rucy
|
|
31
32
|
|
32
33
|
|
33
34
|
Value
|
34
|
-
value (const Rays::Font&
|
35
|
+
value (const Rays::Font& obj)
|
35
36
|
{
|
36
|
-
return new_type
|
37
|
-
|
37
|
+
return new_type(cFont, new Rays::Font(obj));
|
38
|
+
}
|
39
|
+
|
40
|
+
Value
|
41
|
+
value (const Rays::Font* obj)
|
42
|
+
{
|
43
|
+
return obj ? value(*obj) : nil();
|
38
44
|
}
|
39
45
|
|
40
46
|
|
41
47
|
}// Rucy
|
42
48
|
|
43
49
|
|
44
|
-
#define
|
50
|
+
#define THIS to<Rays::Font*>(self)
|
45
51
|
|
46
|
-
#define CHECK
|
52
|
+
#define CHECK RUCY_CHECK_OBJECT(self, Rays::Font, cFont)
|
47
53
|
|
48
54
|
|
49
55
|
static
|
50
56
|
RUBY_DEF_ALLOC(alloc, klass)
|
51
57
|
{
|
52
|
-
return new_type<Rays::Font>(klass
|
58
|
+
return new_type<Rays::Font>(klass);
|
53
59
|
}
|
54
60
|
RUBY_END
|
55
61
|
|
56
62
|
static
|
57
63
|
RUBY_DEFN(initialize)
|
58
64
|
{
|
59
|
-
|
65
|
+
RUCY_CHECK_OBJ(self, Rays::Font, cFont);
|
60
66
|
if (argc < 0 || 2 < argc)
|
61
67
|
arg_count_error("Font#initialize", argc, 0, 1, 2);
|
62
68
|
|
63
69
|
const char* name = (argc >= 1) ? argv[0].c_str() : NULL;
|
64
70
|
float size = (argc >= 2) ? to<float>(argv[1]) : 0;
|
65
|
-
*
|
71
|
+
*THIS = Rays::Font(name, size);
|
66
72
|
|
67
73
|
return self;
|
68
74
|
}
|
@@ -73,7 +79,7 @@ RUBY_DEF0(name)
|
|
73
79
|
{
|
74
80
|
CHECK;
|
75
81
|
|
76
|
-
return value(
|
82
|
+
return value(THIS->name().c_str());
|
77
83
|
}
|
78
84
|
RUBY_END
|
79
85
|
|
@@ -82,7 +88,7 @@ RUBY_DEF0(size)
|
|
82
88
|
{
|
83
89
|
CHECK;
|
84
90
|
|
85
|
-
return value(
|
91
|
+
return value(THIS->size());
|
86
92
|
}
|
87
93
|
RUBY_END
|
88
94
|
|
@@ -92,8 +98,8 @@ RUBY_DEF1(width, str)
|
|
92
98
|
CHECK;
|
93
99
|
|
94
100
|
coord width = 0;
|
95
|
-
if (!
|
96
|
-
|
101
|
+
if (!THIS->get_width(&width, str.c_str()))
|
102
|
+
rays_error("Font#width(%s) failed.", str.inspect().c_str());
|
97
103
|
|
98
104
|
return value(width);
|
99
105
|
}
|
@@ -105,8 +111,8 @@ RUBY_DEF0(height)
|
|
105
111
|
CHECK;
|
106
112
|
|
107
113
|
coord height = 0;
|
108
|
-
if (!
|
109
|
-
|
114
|
+
if (!THIS->get_height(&height))
|
115
|
+
rays_error("Font#height() failed.");
|
110
116
|
|
111
117
|
return value(height);
|
112
118
|
}
|
@@ -116,15 +122,13 @@ RUBY_END
|
|
116
122
|
void
|
117
123
|
Init_font ()
|
118
124
|
{
|
119
|
-
Module
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
c.define_method("width", width);
|
129
|
-
c.define_method("height", height);
|
125
|
+
Module mRays = define_module("Rays");
|
126
|
+
|
127
|
+
cFont = mRays.define_class("Font");
|
128
|
+
cFont.define_alloc_func(alloc);
|
129
|
+
cFont.define_private_method("initialize", initialize);
|
130
|
+
cFont.define_method("name", name);
|
131
|
+
cFont.define_method("size", size);
|
132
|
+
cFont.define_method("width", width);
|
133
|
+
cFont.define_method("height", height);
|
130
134
|
}
|
data/ext/rays/image.cpp
CHANGED
@@ -12,12 +12,13 @@ using namespace Rucy;
|
|
12
12
|
using Rays::coord;
|
13
13
|
|
14
14
|
|
15
|
+
static Class cImage;
|
16
|
+
|
17
|
+
|
15
18
|
namespace Rays
|
16
19
|
{
|
17
20
|
|
18
21
|
|
19
|
-
static Class cImage;
|
20
|
-
|
21
22
|
Class
|
22
23
|
image_class ()
|
23
24
|
{
|
@@ -33,52 +34,60 @@ namespace Rucy
|
|
33
34
|
|
34
35
|
|
35
36
|
Value
|
36
|
-
value (const Rays::Image&
|
37
|
+
value (const Rays::Image& obj)
|
37
38
|
{
|
38
|
-
return new_type
|
39
|
-
|
39
|
+
return new_type(cImage, new Rays::Image(obj));
|
40
|
+
}
|
41
|
+
|
42
|
+
Value
|
43
|
+
value (const Rays::Image* obj)
|
44
|
+
{
|
45
|
+
return obj ? value(*obj) : nil();
|
40
46
|
}
|
41
47
|
|
42
48
|
|
43
49
|
}// Rucy
|
44
50
|
|
45
51
|
|
46
|
-
#define
|
52
|
+
#define THIS to<Rays::Image*>(self)
|
47
53
|
|
48
|
-
#define CHECK
|
54
|
+
#define CHECK RUCY_CHECK_OBJECT(self, Rays::Image, cImage)
|
49
55
|
|
50
56
|
|
51
57
|
static
|
52
58
|
RUBY_DEF_ALLOC(alloc, klass)
|
53
59
|
{
|
54
|
-
return new_type<Rays::Image>(klass
|
60
|
+
return new_type<Rays::Image>(klass);
|
55
61
|
}
|
56
62
|
RUBY_END
|
57
63
|
|
58
64
|
static
|
59
65
|
RUBY_DEFN(initialize)
|
60
66
|
{
|
61
|
-
|
62
|
-
|
63
|
-
|
67
|
+
RUCY_CHECK_OBJ(self, Rays::Image, cImage);
|
68
|
+
|
69
|
+
if (argc < 1 || 3 < argc)
|
70
|
+
arg_count_error("Image#initialize", argc, 1, 2, 3);
|
64
71
|
|
65
72
|
if (argc == 0) return self;
|
66
73
|
|
67
|
-
if (argv[
|
74
|
+
if (argv[0].is_kind_of(Rays::bitmap_class()))
|
68
75
|
{
|
69
|
-
if (argc
|
70
|
-
arg_count_error("Image#initialize", argc,
|
76
|
+
if (argc < 1 || 2 < argc)
|
77
|
+
arg_count_error("Image#initialize", argc, 1, 2);
|
78
|
+
|
79
|
+
const Rays::Bitmap* bitmap = to<Rays::Bitmap*>(argv[0]);
|
80
|
+
if (!bitmap) argument_error();
|
71
81
|
|
72
|
-
|
73
|
-
|
74
|
-
*this = Rays::Image(bitmap, alphaonly);
|
82
|
+
bool alphaonly = (argc == 2) ? to<bool>(argv[1]) : false;
|
83
|
+
*THIS = Rays::Image(*bitmap, alphaonly);
|
75
84
|
}
|
76
85
|
else
|
77
86
|
{
|
78
87
|
int width = to<int>(argv[0]);
|
79
88
|
int height = to<int>(argv[1]);
|
80
89
|
uint colorspace = (argc == 3) ? to<uint>(argv[2]) : (uint) Rays::RGBA;
|
81
|
-
*
|
90
|
+
*THIS = Rays::Image(width, height, (Rays::ColorSpaceType) colorspace);
|
82
91
|
}
|
83
92
|
|
84
93
|
return self;
|
@@ -90,7 +99,7 @@ RUBY_DEF0(width)
|
|
90
99
|
{
|
91
100
|
CHECK;
|
92
101
|
|
93
|
-
return value(
|
102
|
+
return value(THIS->width());
|
94
103
|
}
|
95
104
|
RUBY_END
|
96
105
|
|
@@ -99,7 +108,7 @@ RUBY_DEF0(height)
|
|
99
108
|
{
|
100
109
|
CHECK;
|
101
110
|
|
102
|
-
return value(
|
111
|
+
return value(THIS->height());
|
103
112
|
}
|
104
113
|
RUBY_END
|
105
114
|
|
@@ -108,7 +117,7 @@ RUBY_DEF0(color_space)
|
|
108
117
|
{
|
109
118
|
CHECK;
|
110
119
|
|
111
|
-
return value(
|
120
|
+
return value(THIS->color_space().type());
|
112
121
|
}
|
113
122
|
RUBY_END
|
114
123
|
|
@@ -117,7 +126,7 @@ RUBY_DEF0(bitmap)
|
|
117
126
|
{
|
118
127
|
CHECK;
|
119
128
|
|
120
|
-
return value(
|
129
|
+
return value(THIS->bitmap());
|
121
130
|
}
|
122
131
|
RUBY_END
|
123
132
|
|
@@ -126,7 +135,7 @@ RUBY_DEF0(texture)
|
|
126
135
|
{
|
127
136
|
CHECK;
|
128
137
|
|
129
|
-
return value(
|
138
|
+
return value(THIS->texture());
|
130
139
|
}
|
131
140
|
RUBY_END
|
132
141
|
|
@@ -142,7 +151,7 @@ RUBY_DEFN(load)
|
|
142
151
|
Rays::Image img;
|
143
152
|
if (!Rays::load_image(&img, path.c_str(), alphaonly))
|
144
153
|
{
|
145
|
-
|
154
|
+
rays_error(
|
146
155
|
"Image.load('%s', %s) failed.",
|
147
156
|
path.c_str(), alphaonly ? "true" : "false");
|
148
157
|
}
|
@@ -155,17 +164,15 @@ RUBY_END
|
|
155
164
|
void
|
156
165
|
Init_image ()
|
157
166
|
{
|
158
|
-
Module
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
c.define_method("texture", texture);
|
170
|
-
c.define_function("load", load);
|
167
|
+
Module mRays = define_module("Rays");
|
168
|
+
|
169
|
+
cImage = mRays.define_class("Image");
|
170
|
+
cImage.define_alloc_func(alloc);
|
171
|
+
cImage.define_private_method("initialize", initialize);
|
172
|
+
cImage.define_method("width", width);
|
173
|
+
cImage.define_method("height", height);
|
174
|
+
cImage.define_method("color_space", color_space);
|
175
|
+
cImage.define_method("bitmap", bitmap);
|
176
|
+
cImage.define_method("texture", texture);
|
177
|
+
cImage.define_function("load", load);
|
171
178
|
}
|
data/ext/rays/matrix.cpp
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
#include "rays/ruby/matrix.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include <rucy.h>
|
5
|
+
#include "defs.h"
|
6
|
+
|
7
|
+
|
8
|
+
using namespace Rucy;
|
9
|
+
|
10
|
+
|
11
|
+
static Class cMatrix;
|
12
|
+
|
13
|
+
|
14
|
+
namespace Rays
|
15
|
+
{
|
16
|
+
|
17
|
+
|
18
|
+
Class
|
19
|
+
matrix_class ()
|
20
|
+
{
|
21
|
+
return cMatrix;
|
22
|
+
}
|
23
|
+
|
24
|
+
|
25
|
+
}// Rays
|
26
|
+
|
27
|
+
|
28
|
+
namespace Rucy
|
29
|
+
{
|
30
|
+
|
31
|
+
|
32
|
+
Value
|
33
|
+
value (const Rays::Matrix& obj)
|
34
|
+
{
|
35
|
+
return new_type(cMatrix, new Rays::Matrix(obj));
|
36
|
+
}
|
37
|
+
|
38
|
+
Value
|
39
|
+
value (const Rays::Matrix* obj)
|
40
|
+
{
|
41
|
+
return obj ? value(*obj) : nil();
|
42
|
+
}
|
43
|
+
|
44
|
+
|
45
|
+
}// Rucy
|
46
|
+
|
47
|
+
|
48
|
+
#define THIS to<Rays::Matrix*>(self)
|
49
|
+
|
50
|
+
#define CHECK RUCY_CHECK_OBJ(self, Rays::Matrix, cMatrix)
|
51
|
+
|
52
|
+
|
53
|
+
static
|
54
|
+
RUBY_DEF_ALLOC(alloc, klass)
|
55
|
+
{
|
56
|
+
return new_type<Rays::Matrix>(klass);
|
57
|
+
}
|
58
|
+
RUBY_END
|
59
|
+
|
60
|
+
static
|
61
|
+
RUBY_DEFN(initialize)
|
62
|
+
{
|
63
|
+
RUCY_CHECK_OBJ(self, Rays::Matrix, cMatrix);
|
64
|
+
|
65
|
+
if (argc != 0 && argc != 1 && argc != 16)
|
66
|
+
arg_count_error("Matrix#initialize", argc, 0, 1, 16);
|
67
|
+
|
68
|
+
if (argc == 0) return self;
|
69
|
+
|
70
|
+
switch (argc)
|
71
|
+
{
|
72
|
+
case 1:
|
73
|
+
*THIS = Rays::Matrix(to<float>(argv[0]));
|
74
|
+
break;
|
75
|
+
|
76
|
+
case 16:
|
77
|
+
*THIS = Rays::Matrix(
|
78
|
+
to<float>(argv[0]), to<float>(argv[1]), to<float>(argv[2]), to<float>(argv[3]),
|
79
|
+
to<float>(argv[4]), to<float>(argv[5]), to<float>(argv[6]), to<float>(argv[7]),
|
80
|
+
to<float>(argv[8]), to<float>(argv[9]), to<float>(argv[10]), to<float>(argv[11]),
|
81
|
+
to<float>(argv[12]), to<float>(argv[13]), to<float>(argv[14]), to<float>(argv[15]));
|
82
|
+
break;
|
83
|
+
}
|
84
|
+
|
85
|
+
return self;
|
86
|
+
}
|
87
|
+
RUBY_END
|
88
|
+
|
89
|
+
static
|
90
|
+
RUBY_DEF1(initialize_copy, obj)
|
91
|
+
{
|
92
|
+
RUCY_CHECK_OBJ(self, Rays::Matrix, cMatrix);
|
93
|
+
|
94
|
+
Rays::Matrix* matrix = to<Rays::Matrix*>(obj);
|
95
|
+
if (!matrix) argument_error();
|
96
|
+
|
97
|
+
*THIS = *matrix;
|
98
|
+
return self;
|
99
|
+
}
|
100
|
+
RUBY_END
|
101
|
+
|
102
|
+
static
|
103
|
+
RUBY_DEFN(set)
|
104
|
+
{
|
105
|
+
CHECK;
|
106
|
+
|
107
|
+
if (argc != 0 && argc != 1 && argc != 16)
|
108
|
+
arg_count_error("Matrix#initialize", argc, 0, 1, 16);
|
109
|
+
|
110
|
+
switch (argc)
|
111
|
+
{
|
112
|
+
case 0:
|
113
|
+
*THIS = Rays::Matrix();
|
114
|
+
break;
|
115
|
+
|
116
|
+
case 1:
|
117
|
+
*THIS = Rays::Matrix(to<float>(argv[0]));
|
118
|
+
break;
|
119
|
+
|
120
|
+
case 16:
|
121
|
+
*THIS = Rays::Matrix(
|
122
|
+
to<float>(argv[0]), to<float>(argv[1]), to<float>(argv[2]), to<float>(argv[3]),
|
123
|
+
to<float>(argv[4]), to<float>(argv[5]), to<float>(argv[6]), to<float>(argv[7]),
|
124
|
+
to<float>(argv[8]), to<float>(argv[9]), to<float>(argv[10]), to<float>(argv[11]),
|
125
|
+
to<float>(argv[12]), to<float>(argv[13]), to<float>(argv[14]), to<float>(argv[15]));
|
126
|
+
break;
|
127
|
+
}
|
128
|
+
|
129
|
+
return self;
|
130
|
+
}
|
131
|
+
RUBY_END
|
132
|
+
|
133
|
+
static
|
134
|
+
RUBY_DEF2(at, row, column)
|
135
|
+
{
|
136
|
+
CHECK;
|
137
|
+
|
138
|
+
return value(THIS->at(row.as_i(), column.as_i()));
|
139
|
+
}
|
140
|
+
RUBY_END
|
141
|
+
|
142
|
+
|
143
|
+
void
|
144
|
+
Init_matrix ()
|
145
|
+
{
|
146
|
+
Module mRays = define_module("Rays");
|
147
|
+
|
148
|
+
cMatrix = mRays.define_class("Matrix");
|
149
|
+
cMatrix.define_alloc_func(alloc);
|
150
|
+
cMatrix.define_private_method("initialize", initialize);
|
151
|
+
cMatrix.define_private_method("initialize_copy", initialize_copy);
|
152
|
+
cMatrix.define_method("set", set);
|
153
|
+
cMatrix.define_method("at", at);
|
154
|
+
}
|