rays 0.1.46 → 0.1.48
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.
- checksums.yaml +4 -4
- data/.doc/ext/rays/bitmap.cpp +499 -0
- data/.doc/ext/rays/camera.cpp +2 -2
- data/.doc/ext/rays/defs.cpp +35 -11
- data/.doc/ext/rays/font.cpp +50 -2
- data/.doc/ext/rays/native.cpp +2 -4
- data/.doc/ext/rays/painter.cpp +111 -6
- data/.doc/ext/rays/polygon.cpp +152 -41
- data/.doc/ext/rays/polyline.cpp +89 -10
- data/.doc/ext/rays/rays.cpp +91 -11
- data/.doc/ext/rays/{noise.cpp → util.cpp} +2 -2
- data/.github/workflows/test.yml +0 -1
- data/ChangeLog.md +38 -0
- data/Rakefile +4 -4
- data/VERSION +1 -1
- data/ext/rays/bitmap.cpp +501 -0
- data/ext/rays/camera.cpp +2 -2
- data/ext/rays/defs.cpp +35 -11
- data/ext/rays/defs.h +56 -3
- data/ext/rays/font.cpp +56 -4
- data/ext/rays/native.cpp +2 -4
- data/ext/rays/painter.cpp +125 -11
- data/ext/rays/polygon.cpp +161 -41
- data/ext/rays/polyline.cpp +95 -9
- data/ext/rays/rays.cpp +91 -11
- data/ext/rays/{noise.cpp → util.cpp} +2 -2
- data/include/rays/defs.h +24 -0
- data/include/rays/font.h +17 -3
- data/include/rays/matrix.h +2 -0
- data/include/rays/painter.h +29 -1
- data/include/rays/polygon.h +57 -33
- data/include/rays/polyline.h +20 -1
- data/include/rays/ruby/polygon.h +0 -11
- data/include/rays/ruby/rays.h +4 -0
- data/include/rays/{noise.h → util.h} +2 -2
- data/lib/rays/color.rb +1 -1
- data/lib/rays/font.rb +1 -1
- data/lib/rays/image.rb +1 -1
- data/lib/rays/painter.rb +13 -2
- data/lib/rays/point.rb +1 -1
- data/lib/rays/polygon.rb +54 -16
- data/lib/rays/polyline.rb +54 -8
- data/lib/rays.rb +0 -1
- data/rays.gemspec +2 -2
- data/src/color_space.cpp +2 -2
- data/src/font.cpp +24 -2
- data/src/font.h +8 -1
- data/src/ios/font.mm +88 -27
- data/src/matrix.cpp +8 -0
- data/src/osx/font.mm +90 -28
- data/src/osx/helper.h +2 -2
- data/src/osx/helper.mm +2 -2
- data/src/painter.cpp +227 -90
- data/src/painter.h +11 -3
- data/src/polygon.cpp +588 -205
- data/src/polyline.cpp +154 -28
- data/src/polyline.h +3 -5
- data/src/shader.cpp +36 -4
- data/src/shader.h +1 -1
- data/src/texture.cpp +2 -2
- data/src/{noise.cpp → util.cpp} +1 -1
- data/src/win32/font.cpp +1 -1
- data/test/test_bitmap.rb +16 -2
- data/test/test_color.rb +4 -0
- data/test/test_font.rb +20 -2
- data/test/test_image.rb +18 -18
- data/test/test_point.rb +1 -1
- data/test/test_polygon.rb +52 -45
- data/test/test_polyline.rb +191 -72
- metadata +11 -17
- data/.doc/ext/rays/polygon_line.cpp +0 -97
- data/ext/rays/polygon_line.cpp +0 -100
- data/lib/rays/polygon_line.rb +0 -33
- data/test/test_polygon_line.rb +0 -164
data/test/test_polyline.rb
CHANGED
@@ -3,12 +3,6 @@ require_relative 'helper'
|
|
3
3
|
|
4
4
|
class TestPolyline < Test::Unit::TestCase
|
5
5
|
|
6
|
-
class Rays::Polyline
|
7
|
-
def dump()
|
8
|
-
map &:to_a
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
6
|
def polyline(*args, **kwargs)
|
13
7
|
Rays::Polyline.new(*args, **kwargs)
|
14
8
|
end
|
@@ -21,32 +15,101 @@ class TestPolyline < Test::Unit::TestCase
|
|
21
15
|
Rays::Bounds.new(*args)
|
22
16
|
end
|
23
17
|
|
24
|
-
def
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
assert_equal
|
34
|
-
assert_equal
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
18
|
+
def color(*args)
|
19
|
+
Rays::Color.new(*args)
|
20
|
+
end
|
21
|
+
|
22
|
+
def dump(pl, name = :points)
|
23
|
+
pl.send(name).map(&:to_a)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_initialize_points()
|
27
|
+
assert_equal [[1,2], [3,4]], dump(polyline( 1,2, 3,4 ))
|
28
|
+
assert_equal [[1,2], [3,4]], dump(polyline( [1,2], [3,4]))
|
29
|
+
assert_equal [[1,1], [2,2]], dump(polyline( [1], [2]))
|
30
|
+
assert_equal [[1,1], [2,2]], dump(polyline(point(1), point(2)))
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_initialize_colors()
|
34
|
+
assert_equal( [[1,2,3,1], [4,5,6,1]],
|
35
|
+
dump(polyline(1,2, 3,4, colors: [ 1,2,3, 4,5,6 ]), :colors))
|
36
|
+
assert_equal( [[1,2,3,1], [4,5,6,1]],
|
37
|
+
dump(polyline(1,2, 3,4, colors: [[1,2,3], [4,5,6] ]), :colors))
|
38
|
+
assert_equal( [[1,1,1,1], [2,2,2,1]],
|
39
|
+
dump(polyline(1,2, 3,4, colors: [[1], [2] ]), :colors))
|
40
|
+
assert_equal( [[1,1,1,1], [2,2,2,1]],
|
41
|
+
dump(polyline(1,2, 3,4, colors: [color(1), color(2) ]), :colors))
|
42
|
+
|
43
|
+
assert_raise(ArgumentError) {polyline([1,2, 3,4], colors: [[1,2,3]])}
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_initialize_texcoords()
|
47
|
+
assert_equal( [[1,2], [3,4]],
|
48
|
+
dump(polyline(1,2, 3,4, texcoords: [ 1,2, 3,4 ]), :texcoords))
|
49
|
+
assert_equal( [[1,2], [3,4]],
|
50
|
+
dump(polyline(1,2, 3,4, texcoords: [[1,2], [3,4]]), :texcoords))
|
51
|
+
assert_equal( [[1,1], [2,2]],
|
52
|
+
dump(polyline(1,2, 3,4, texcoords: [[1], [2] ]), :texcoords))
|
53
|
+
assert_equal( [[1,2], [3,4]],
|
54
|
+
dump(polyline(1,2, 3,4, texcoords: [point(1,2), point(3,4)]), :texcoords))
|
55
|
+
|
56
|
+
assert_raise(ArgumentError) {polyline([1,2, 3,4], texcoords: [[1,2]])}
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_initialize_loop_fill()
|
60
|
+
get = -> pl {[pl.loop?, pl.fill?]}
|
61
|
+
|
62
|
+
assert_equal [false, false], get[polyline(1,2, 3,4, 5,6)]
|
63
|
+
|
64
|
+
assert_equal [true, true], get[polyline(1,2, 3,4, 5,6, loop: true)]
|
65
|
+
assert_equal [false, false], get[polyline(1,2, 3,4, 5,6, loop: false)]
|
66
|
+
assert_equal [false, true], get[polyline(1,2, 3,4, 5,6, fill: true)]
|
67
|
+
assert_equal [false, false], get[polyline(1,2, 3,4, 5,6, fill: false)]
|
68
|
+
|
69
|
+
assert_equal [true, true], get[polyline(1,2, 3,4, 5,6, loop: true, fill: true)]
|
70
|
+
assert_equal [true, false], get[polyline(1,2, 3,4, 5,6, loop: true, fill: false)]
|
71
|
+
assert_equal [false, true], get[polyline(1,2, 3,4, 5,6, loop: false, fill: true)]
|
72
|
+
assert_equal [false, false], get[polyline(1,2, 3,4, 5,6, loop: false, fill: false)]
|
73
|
+
|
74
|
+
assert_equal [true, true], get[polyline( loop: true, fill: true)]
|
75
|
+
assert_equal [true, false], get[polyline( loop: true, fill: false)]
|
76
|
+
assert_equal [false, true], get[polyline( loop: false, fill: true)]
|
77
|
+
assert_equal [false, false], get[polyline( loop: false, fill: false)]
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_initialize_hole()
|
81
|
+
assert_false polyline(1,2, 3,4, 5,6, loop: true).hole?
|
82
|
+
|
83
|
+
assert_true polyline(1,2, 3,4, 5,6, loop: true, hole: true) .hole?
|
84
|
+
assert_false polyline(1,2, 3,4, 5,6, loop: true, hole: false).hole?
|
85
|
+
|
86
|
+
assert_true polyline( loop: true, hole: true) .hole?
|
87
|
+
assert_false polyline( loop: true, hole: false).hole?
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_initialize_errors()
|
91
|
+
assert_nothing_raised {polyline( loop: true, hole: true)}
|
92
|
+
assert_nothing_raised {polyline( loop: true, hole: false)}
|
93
|
+
assert_raise(ArgumentError) {polyline( loop: false, hole: true)}
|
94
|
+
assert_nothing_raised {polyline( loop: false, hole: false)}
|
95
|
+
assert_raise(ArgumentError) {polyline(1, loop: true)}
|
96
|
+
assert_raise(ArgumentError) {polyline(1, loop: false)}
|
97
|
+
assert_nothing_raised {polyline(1,2, loop: true, hole: true)}
|
98
|
+
assert_nothing_raised {polyline(1,2, loop: true, hole: false)}
|
99
|
+
assert_raise(ArgumentError) {polyline(1,2, loop: false, hole: true)}
|
100
|
+
assert_nothing_raised {polyline(1,2, loop: false, hole: false)}
|
101
|
+
assert_raise(ArgumentError) {polyline(1,2, 3, loop: true)}
|
102
|
+
assert_raise(ArgumentError) {polyline(1,2, 3, loop: false)}
|
103
|
+
assert_nothing_raised {polyline(1,2, 3,4, loop: true, hole: true)}
|
104
|
+
assert_nothing_raised {polyline(1,2, 3,4, loop: true, hole: false)}
|
105
|
+
assert_raise(ArgumentError) {polyline(1,2, 3,4, loop: false, hole: true)}
|
106
|
+
assert_nothing_raised {polyline(1,2, 3,4, loop: false, hole: false)}
|
107
|
+
assert_raise(ArgumentError) {polyline(1,2, 3,4, 5, loop: true)}
|
108
|
+
assert_raise(ArgumentError) {polyline(1,2, 3,4, 5, loop: false)}
|
109
|
+
assert_nothing_raised {polyline(1,2, 3,4, 5,6, loop: true, hole: true)}
|
110
|
+
assert_nothing_raised {polyline(1,2, 3,4, 5,6, loop: true, hole: false)}
|
111
|
+
assert_raise(ArgumentError) {polyline(1,2, 3,4, 5,6, loop: false, hole: true)}
|
112
|
+
assert_nothing_raised {polyline(1,2, 3,4, 5,6, loop: false, hole: false)}
|
50
113
|
end
|
51
114
|
|
52
115
|
def test_expand()
|
@@ -91,46 +154,74 @@ class TestPolyline < Test::Unit::TestCase
|
|
91
154
|
assert_raise(ArgumentError) {pl[].expand 1, 99}
|
92
155
|
end
|
93
156
|
|
94
|
-
def
|
95
|
-
|
96
|
-
polyline(
|
97
|
-
assert_equal [[110,210], [120,220]], o.dump
|
98
|
-
}
|
157
|
+
def test_with_points()
|
158
|
+
assert_equal polyline(5,6, 7,8), polyline(1,2, 3,4).with(points: [5,6, 7,8])
|
159
|
+
assert_equal polyline(5,6), polyline(1,2, 3,4).with(points: [5,6])
|
99
160
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
161
|
+
assert_raise(ArgumentError) do
|
162
|
+
polyline(1,2, 3,4, colors: [[1], [2]]).with(points: [1,2])
|
163
|
+
end
|
164
|
+
end
|
104
165
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
166
|
+
def test_with_loop_fill()
|
167
|
+
assert_equal(
|
168
|
+
polyline(1,2, 3,4, 5,6, loop: false, fill: false),
|
169
|
+
polyline(1,2, 3,4, 5,6))
|
170
|
+
assert_equal(
|
171
|
+
polyline(1,2, 3,4, 5,6, loop: true, fill: false),
|
172
|
+
polyline(1,2, 3,4, 5,6).with(loop: true))
|
173
|
+
assert_equal(
|
174
|
+
polyline(1,2, 3,4, 5,6, loop: false, fill: true),
|
175
|
+
polyline(1,2, 3,4, 5,6).with( fill: true))
|
109
176
|
end
|
110
177
|
|
111
|
-
def
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
178
|
+
def test_with_colors()
|
179
|
+
assert_equal(
|
180
|
+
polyline(1,2, 3,4, texcoords: [1,2, 3,4]),
|
181
|
+
polyline(1,2, 3,4).with(texcoords: [1,2, 3,4]))
|
182
|
+
assert_equal(
|
183
|
+
polyline(1,2, 3,4, texcoords: [5,6, 7,8]),
|
184
|
+
polyline(1,2, 3,4, texcoords: [1,2, 3,4]).with(texcoords: [5,6, 7,8]))
|
117
185
|
|
118
|
-
polyline(
|
119
|
-
|
120
|
-
}.tap {|o|
|
121
|
-
assert_equal [[10,10], [30,30]], o.dump
|
122
|
-
}
|
186
|
+
assert_raise(ArgumentError) {polyline(1,2, 3,4).with(colors: [[1]])}
|
187
|
+
end
|
123
188
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
189
|
+
def test_with_texcoords()
|
190
|
+
assert_equal(
|
191
|
+
polyline(1,2, 3,4, colors: [[1], [2]]),
|
192
|
+
polyline(1,2, 3,4).with(colors: [[1], [2]]))
|
193
|
+
assert_equal(
|
194
|
+
polyline(1,2, 3,4, colors: [[3], [4]]),
|
195
|
+
polyline(1,2, 3,4, colors: [[1], [2]]).with(colors: [[3], [4]]))
|
129
196
|
|
130
|
-
polyline(
|
131
|
-
|
132
|
-
|
133
|
-
|
197
|
+
assert_raise(ArgumentError) {polyline(1,2, 3,4).with(colors: [[1]])}
|
198
|
+
end
|
199
|
+
|
200
|
+
def test_with_hole()
|
201
|
+
assert_equal(
|
202
|
+
polyline(1,2, 3,4, 5,6, loop: true, hole: false),
|
203
|
+
polyline(1,2, 3,4, 5,6, loop: true))
|
204
|
+
assert_equal(
|
205
|
+
polyline(1,2, 3,4, 5,6, loop: true, hole: true),
|
206
|
+
polyline(1,2, 3,4, 5,6, loop: true).with(hole: true))
|
207
|
+
end
|
208
|
+
|
209
|
+
def test_equal()
|
210
|
+
assert_false polyline(1,2, 3,4) == polyline(1,2)
|
211
|
+
|
212
|
+
assert_true polyline(1,2, 3,4) == polyline(1,2, 3,4)
|
213
|
+
assert_false polyline(1,2, 3,4) == polyline(1,2, 3,9)
|
214
|
+
|
215
|
+
assert_true polyline(1,2, 3,4, loop: true, fill: true) == polyline(1,2, 3,4, loop: true, fill: true)
|
216
|
+
assert_true polyline(1,2, 3,4, loop: false, fill: false) == polyline(1,2, 3,4, loop: false, fill: false)
|
217
|
+
assert_false polyline(1,2, 3,4, loop: false, fill: false) == polyline(1,2, 3,4, loop: true, fill: false)
|
218
|
+
assert_false polyline(1,2, 3,4, loop: false, fill: false) == polyline(1,2, 3,4, loop: false, fill: true)
|
219
|
+
|
220
|
+
assert_true polyline(1,2, 3,4, colors: [[1], [2]]) == polyline(1,2, 3,4, colors: [[1], [2]])
|
221
|
+
assert_false polyline(1,2, 3,4, colors: [[1], [2]]) == polyline(1,2, 3,4, colors: [[1], [9]])
|
222
|
+
|
223
|
+
assert_true polyline(1,2, 3,4, texcoords: [1,2, 3,4]) == polyline(1,2, 3,4, texcoords: [1,2, 3,4])
|
224
|
+
assert_false polyline(1,2, 3,4, texcoords: [1,2, 3,4]) == polyline(1,2, 3,4, texcoords: [1,2, 3,9])
|
134
225
|
end
|
135
226
|
|
136
227
|
def test_bounds()
|
@@ -140,18 +231,34 @@ class TestPolyline < Test::Unit::TestCase
|
|
140
231
|
assert_not polyline() .bounds.valid?
|
141
232
|
end
|
142
233
|
|
234
|
+
def test_loop_fill()
|
235
|
+
get = -> pl {[pl.loop?, pl.fill?]}
|
236
|
+
|
237
|
+
assert_equal [false, false], get[polyline(1,2, 3,4)]
|
238
|
+
assert_equal [true, true], get[polyline(1,2, 3,4, loop: true)]
|
239
|
+
assert_equal [false, false], get[polyline(1,2, 3,4, loop: false)]
|
240
|
+
assert_equal [false, true], get[polyline(1,2, 3,4, fill: true)]
|
241
|
+
assert_equal [false, false], get[polyline(1,2, 3,4, fill: false)]
|
242
|
+
assert_equal [true, true], get[polyline(1,2, 3,4, loop: true, fill: true)]
|
243
|
+
assert_equal [false, false], get[polyline(1,2, 3,4, loop: false, fill: false)]
|
244
|
+
assert_equal [true, false], get[polyline(1,2, 3,4, loop: true, fill: false)]
|
245
|
+
assert_equal [false, true], get[polyline(1,2, 3,4, loop: false, fill: true)]
|
246
|
+
end
|
247
|
+
|
143
248
|
def test_size()
|
144
|
-
assert_equal
|
145
|
-
assert_equal
|
249
|
+
assert_equal 0, polyline() .size
|
250
|
+
assert_equal 1, polyline(1,2) .size
|
251
|
+
assert_equal 2, polyline(1,2, 3,4) .size
|
252
|
+
assert_equal 3, polyline(1,2, 3,4, 5,6).size
|
146
253
|
end
|
147
254
|
|
148
255
|
def test_empty?()
|
149
|
-
assert_equal true, polyline(
|
150
|
-
assert_equal false, polyline(1,
|
256
|
+
assert_equal true, polyline() .empty?
|
257
|
+
assert_equal false, polyline(1,2, 3,4).empty?
|
151
258
|
end
|
152
259
|
|
153
260
|
def test_index()
|
154
|
-
o = polyline 1,
|
261
|
+
o = polyline 1,2, 3,4, 5,6
|
155
262
|
assert_equal [1, 2], o[ 0].to_a
|
156
263
|
assert_equal [3, 4], o[ 1].to_a
|
157
264
|
assert_equal [5, 6], o[-1].to_a
|
@@ -161,8 +268,20 @@ class TestPolyline < Test::Unit::TestCase
|
|
161
268
|
|
162
269
|
def test_inspect()
|
163
270
|
assert_equal(
|
164
|
-
"#<Rays::Polyline [1.0,
|
165
|
-
polyline(1,
|
271
|
+
"#<Rays::Polyline [1.0,2.0, 3.0,4.0] loop:false fill:false hole:false colors:0 texcoords:0>",
|
272
|
+
polyline(1,2, 3,4).inspect)
|
273
|
+
assert_equal(
|
274
|
+
"#<Rays::Polyline [1.0,2.0, 3.0,4.0] loop:true fill:false hole:false colors:0 texcoords:0>",
|
275
|
+
polyline(1,2, 3,4, loop: true, fill: false).inspect)
|
276
|
+
assert_equal(
|
277
|
+
"#<Rays::Polyline [1.0,2.0, 3.0,4.0] loop:false fill:true hole:false colors:0 texcoords:0>",
|
278
|
+
polyline(1,2, 3,4, loop: false, fill: true).inspect)
|
279
|
+
assert_equal(
|
280
|
+
"#<Rays::Polyline [1.0,2.0, 3.0,4.0] loop:false fill:false hole:false colors:2 texcoords:0>",
|
281
|
+
polyline(1,2, 3,4, colors: [[1], [2]]).inspect)
|
282
|
+
assert_equal(
|
283
|
+
"#<Rays::Polyline [1.0,2.0, 3.0,4.0] loop:false fill:false hole:false colors:0 texcoords:2>",
|
284
|
+
polyline(1,2, 3,4, texcoords: [1,2, 3,4]).inspect)
|
166
285
|
end
|
167
286
|
|
168
287
|
end# TestPolyline
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rays
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.48
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xordog
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xot
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.
|
19
|
+
version: 0.1.41
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.
|
26
|
+
version: 0.1.41
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rucy
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.1.
|
33
|
+
version: 0.1.43
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.1.
|
40
|
+
version: 0.1.43
|
41
41
|
description: This library helps you to develop graphics application with OpenGL.
|
42
42
|
email: xordog@gmail.com
|
43
43
|
executables: []
|
@@ -55,14 +55,13 @@ extra_rdoc_files:
|
|
55
55
|
- ".doc/ext/rays/image.cpp"
|
56
56
|
- ".doc/ext/rays/matrix.cpp"
|
57
57
|
- ".doc/ext/rays/native.cpp"
|
58
|
-
- ".doc/ext/rays/noise.cpp"
|
59
58
|
- ".doc/ext/rays/painter.cpp"
|
60
59
|
- ".doc/ext/rays/point.cpp"
|
61
60
|
- ".doc/ext/rays/polygon.cpp"
|
62
|
-
- ".doc/ext/rays/polygon_line.cpp"
|
63
61
|
- ".doc/ext/rays/polyline.cpp"
|
64
62
|
- ".doc/ext/rays/rays.cpp"
|
65
63
|
- ".doc/ext/rays/shader.cpp"
|
64
|
+
- ".doc/ext/rays/util.cpp"
|
66
65
|
files:
|
67
66
|
- ".doc/ext/rays/bitmap.cpp"
|
68
67
|
- ".doc/ext/rays/bounds.cpp"
|
@@ -75,14 +74,13 @@ files:
|
|
75
74
|
- ".doc/ext/rays/image.cpp"
|
76
75
|
- ".doc/ext/rays/matrix.cpp"
|
77
76
|
- ".doc/ext/rays/native.cpp"
|
78
|
-
- ".doc/ext/rays/noise.cpp"
|
79
77
|
- ".doc/ext/rays/painter.cpp"
|
80
78
|
- ".doc/ext/rays/point.cpp"
|
81
79
|
- ".doc/ext/rays/polygon.cpp"
|
82
|
-
- ".doc/ext/rays/polygon_line.cpp"
|
83
80
|
- ".doc/ext/rays/polyline.cpp"
|
84
81
|
- ".doc/ext/rays/rays.cpp"
|
85
82
|
- ".doc/ext/rays/shader.cpp"
|
83
|
+
- ".doc/ext/rays/util.cpp"
|
86
84
|
- ".github/workflows/release-gem.yml"
|
87
85
|
- ".github/workflows/tag.yml"
|
88
86
|
- ".github/workflows/test.yml"
|
@@ -107,14 +105,13 @@ files:
|
|
107
105
|
- ext/rays/image.cpp
|
108
106
|
- ext/rays/matrix.cpp
|
109
107
|
- ext/rays/native.cpp
|
110
|
-
- ext/rays/noise.cpp
|
111
108
|
- ext/rays/painter.cpp
|
112
109
|
- ext/rays/point.cpp
|
113
110
|
- ext/rays/polygon.cpp
|
114
|
-
- ext/rays/polygon_line.cpp
|
115
111
|
- ext/rays/polyline.cpp
|
116
112
|
- ext/rays/rays.cpp
|
117
113
|
- ext/rays/shader.cpp
|
114
|
+
- ext/rays/util.cpp
|
118
115
|
- include/rays.h
|
119
116
|
- include/rays/bitmap.h
|
120
117
|
- include/rays/bounds.h
|
@@ -128,7 +125,6 @@ files:
|
|
128
125
|
- include/rays/font.h
|
129
126
|
- include/rays/image.h
|
130
127
|
- include/rays/matrix.h
|
131
|
-
- include/rays/noise.h
|
132
128
|
- include/rays/opengl.h
|
133
129
|
- include/rays/painter.h
|
134
130
|
- include/rays/point.h
|
@@ -153,6 +149,7 @@ files:
|
|
153
149
|
- include/rays/ruby/rays.h
|
154
150
|
- include/rays/ruby/shader.h
|
155
151
|
- include/rays/shader.h
|
152
|
+
- include/rays/util.h
|
156
153
|
- lib/rays.rb
|
157
154
|
- lib/rays/autoinit.rb
|
158
155
|
- lib/rays/bitmap.rb
|
@@ -168,7 +165,6 @@ files:
|
|
168
165
|
- lib/rays/painter.rb
|
169
166
|
- lib/rays/point.rb
|
170
167
|
- lib/rays/polygon.rb
|
171
|
-
- lib/rays/polygon_line.rb
|
172
168
|
- lib/rays/polyline.rb
|
173
169
|
- lib/rays/shader.rb
|
174
170
|
- rays.gemspec
|
@@ -196,7 +192,6 @@ files:
|
|
196
192
|
- src/ios/rays.mm
|
197
193
|
- src/matrix.cpp
|
198
194
|
- src/matrix.h
|
199
|
-
- src/noise.cpp
|
200
195
|
- src/opengl.cpp
|
201
196
|
- src/opengl.h
|
202
197
|
- src/osx/bitmap.h
|
@@ -224,6 +219,7 @@ files:
|
|
224
219
|
- src/shader_source.h
|
225
220
|
- src/texture.cpp
|
226
221
|
- src/texture.h
|
222
|
+
- src/util.cpp
|
227
223
|
- src/win32/bitmap.cpp
|
228
224
|
- src/win32/font.cpp
|
229
225
|
- src/win32/font.h
|
@@ -242,7 +238,6 @@ files:
|
|
242
238
|
- test/test_painter_shape.rb
|
243
239
|
- test/test_point.rb
|
244
240
|
- test/test_polygon.rb
|
245
|
-
- test/test_polygon_line.rb
|
246
241
|
- test/test_polyline.rb
|
247
242
|
- test/test_rays_init.rb
|
248
243
|
- test/test_shader.rb
|
@@ -282,7 +277,6 @@ test_files:
|
|
282
277
|
- test/test_painter_shape.rb
|
283
278
|
- test/test_point.rb
|
284
279
|
- test/test_polygon.rb
|
285
|
-
- test/test_polygon_line.rb
|
286
280
|
- test/test_polyline.rb
|
287
281
|
- test/test_rays_init.rb
|
288
282
|
- test/test_shader.rb
|
@@ -1,97 +0,0 @@
|
|
1
|
-
#include "rays/ruby/polygon.h"
|
2
|
-
|
3
|
-
|
4
|
-
#include <assert.h>
|
5
|
-
#include "rays/ruby/polyline.h"
|
6
|
-
#include "defs.h"
|
7
|
-
|
8
|
-
|
9
|
-
RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(Rays::Polygon::Line)
|
10
|
-
|
11
|
-
#define THIS to<Rays::Polygon::Line*>(self)
|
12
|
-
|
13
|
-
#define CHECK RUCY_CHECK_OBJECT(Rays::Polygon::Line, self)
|
14
|
-
|
15
|
-
|
16
|
-
static
|
17
|
-
VALUE alloc(VALUE klass)
|
18
|
-
{
|
19
|
-
return new_type<Rays::Polygon::Line>(klass);
|
20
|
-
}
|
21
|
-
|
22
|
-
static
|
23
|
-
VALUE setup(VALUE self, VALUE points, VALUE loop, VALUE hole)
|
24
|
-
{
|
25
|
-
CHECK;
|
26
|
-
|
27
|
-
std::vector<Rays::Point> array;
|
28
|
-
get_line_args(&array, points.size(), points.as_array());
|
29
|
-
*THIS = Rays::Polygon::Line(&array[0], array.size(), loop, hole);
|
30
|
-
}
|
31
|
-
|
32
|
-
static
|
33
|
-
VALUE hole(VALUE self)
|
34
|
-
{
|
35
|
-
CHECK;
|
36
|
-
return value(THIS->hole());
|
37
|
-
}
|
38
|
-
|
39
|
-
|
40
|
-
static Class cPolygonLine;
|
41
|
-
|
42
|
-
void
|
43
|
-
Init_rays_polygon_line ()
|
44
|
-
{
|
45
|
-
Module mRays = rb_define_module("Rays");
|
46
|
-
Class cPolygon = rb_define_class_under(mRays, "Polygon", rb_cObject);
|
47
|
-
|
48
|
-
cPolygonLine = cPolygon.define_class("Line", Rays::polyline_class());
|
49
|
-
rb_define_alloc_func(cPolygonLine, alloc);
|
50
|
-
rb_define_private_method(cPolygonLine, "setup", RUBY_METHOD_FUNC(setup), 3);
|
51
|
-
cPolygonLine.define_method("hole?", hole);
|
52
|
-
}
|
53
|
-
|
54
|
-
|
55
|
-
namespace Rucy
|
56
|
-
{
|
57
|
-
|
58
|
-
|
59
|
-
template <> Rays::Polygon::Line
|
60
|
-
value_to<Rays::Polygon::Line> (int argc, const Value* argv, bool convert)
|
61
|
-
{
|
62
|
-
assert(argc == 0 || (argc > 0 && argv));
|
63
|
-
|
64
|
-
if (convert)
|
65
|
-
{
|
66
|
-
if (argc <= 0)
|
67
|
-
return Rays::Polygon::Line();
|
68
|
-
else if (argv->is_num() || argv->is_array())
|
69
|
-
{
|
70
|
-
std::vector<Rays::Point> points;
|
71
|
-
get_line_args(&points, argc, argv);
|
72
|
-
return Rays::Polygon::Line(&points[0], points.size());
|
73
|
-
}
|
74
|
-
}
|
75
|
-
|
76
|
-
if (argc != 1)
|
77
|
-
argument_error(__FILE__, __LINE__);
|
78
|
-
|
79
|
-
return value_to<Rays::Polygon::Line&>(*argv, convert);
|
80
|
-
}
|
81
|
-
|
82
|
-
|
83
|
-
}// Rucy
|
84
|
-
|
85
|
-
|
86
|
-
namespace Rays
|
87
|
-
{
|
88
|
-
|
89
|
-
|
90
|
-
Class
|
91
|
-
polygon_line_class ()
|
92
|
-
{
|
93
|
-
return cPolygonLine;
|
94
|
-
}
|
95
|
-
|
96
|
-
|
97
|
-
}// Rays
|
data/ext/rays/polygon_line.cpp
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
#include "rays/ruby/polygon.h"
|
2
|
-
|
3
|
-
|
4
|
-
#include <assert.h>
|
5
|
-
#include "rays/ruby/polyline.h"
|
6
|
-
#include "defs.h"
|
7
|
-
|
8
|
-
|
9
|
-
RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(Rays::Polygon::Line)
|
10
|
-
|
11
|
-
#define THIS to<Rays::Polygon::Line*>(self)
|
12
|
-
|
13
|
-
#define CHECK RUCY_CHECK_OBJECT(Rays::Polygon::Line, self)
|
14
|
-
|
15
|
-
|
16
|
-
static
|
17
|
-
RUCY_DEF_ALLOC(alloc, klass)
|
18
|
-
{
|
19
|
-
return new_type<Rays::Polygon::Line>(klass);
|
20
|
-
}
|
21
|
-
RUCY_END
|
22
|
-
|
23
|
-
static
|
24
|
-
RUCY_DEF3(setup, points, loop, hole)
|
25
|
-
{
|
26
|
-
CHECK;
|
27
|
-
|
28
|
-
std::vector<Rays::Point> array;
|
29
|
-
get_line_args(&array, points.size(), points.as_array());
|
30
|
-
*THIS = Rays::Polygon::Line(&array[0], array.size(), loop, hole);
|
31
|
-
}
|
32
|
-
RUCY_END
|
33
|
-
|
34
|
-
static
|
35
|
-
RUCY_DEF0(hole)
|
36
|
-
{
|
37
|
-
CHECK;
|
38
|
-
return value(THIS->hole());
|
39
|
-
}
|
40
|
-
RUCY_END
|
41
|
-
|
42
|
-
|
43
|
-
static Class cPolygonLine;
|
44
|
-
|
45
|
-
void
|
46
|
-
Init_rays_polygon_line ()
|
47
|
-
{
|
48
|
-
Module mRays = define_module("Rays");
|
49
|
-
Class cPolygon = mRays.define_class("Polygon");
|
50
|
-
|
51
|
-
cPolygonLine = cPolygon.define_class("Line", Rays::polyline_class());
|
52
|
-
cPolygonLine.define_alloc_func(alloc);
|
53
|
-
cPolygonLine.define_private_method("setup", setup);
|
54
|
-
cPolygonLine.define_method("hole?", hole);
|
55
|
-
}
|
56
|
-
|
57
|
-
|
58
|
-
namespace Rucy
|
59
|
-
{
|
60
|
-
|
61
|
-
|
62
|
-
template <> Rays::Polygon::Line
|
63
|
-
value_to<Rays::Polygon::Line> (int argc, const Value* argv, bool convert)
|
64
|
-
{
|
65
|
-
assert(argc == 0 || (argc > 0 && argv));
|
66
|
-
|
67
|
-
if (convert)
|
68
|
-
{
|
69
|
-
if (argc <= 0)
|
70
|
-
return Rays::Polygon::Line();
|
71
|
-
else if (argv->is_num() || argv->is_array())
|
72
|
-
{
|
73
|
-
std::vector<Rays::Point> points;
|
74
|
-
get_line_args(&points, argc, argv);
|
75
|
-
return Rays::Polygon::Line(&points[0], points.size());
|
76
|
-
}
|
77
|
-
}
|
78
|
-
|
79
|
-
if (argc != 1)
|
80
|
-
argument_error(__FILE__, __LINE__);
|
81
|
-
|
82
|
-
return value_to<Rays::Polygon::Line&>(*argv, convert);
|
83
|
-
}
|
84
|
-
|
85
|
-
|
86
|
-
}// Rucy
|
87
|
-
|
88
|
-
|
89
|
-
namespace Rays
|
90
|
-
{
|
91
|
-
|
92
|
-
|
93
|
-
Class
|
94
|
-
polygon_line_class ()
|
95
|
-
{
|
96
|
-
return cPolygonLine;
|
97
|
-
}
|
98
|
-
|
99
|
-
|
100
|
-
}// Rays
|