rays 0.1.22 → 0.1.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a5b43fa2ac1f3b56d89da34aa5d6bd36e3d6711888357602e161e63a2bbbebc
4
- data.tar.gz: a98432edc8510d81fa8e941995102b33ad0438d40281b30c52af3cfbf8c89b2d
3
+ metadata.gz: 040c0f759c8eb840cb1404ef8d4b784a2e8c65a0b4c45069dfc710ce4d82ea11
4
+ data.tar.gz: 5d23a768599e7f41c56e626077cc194e6160c9e9ce4d29755e52a7ed9125ab2a
5
5
  SHA512:
6
- metadata.gz: 8a8a50e771070c66bdb4a58dad84ad4f10b29cfa53d7f4a2257e161cbc4708f9ebbe6def647f5fb888035be1ed69aeb2f522856e1ca87eaf76319391643a0b64
7
- data.tar.gz: 5e6fbf805d49667fb567c8439c7356a52dee00819db6f1779b7b111649381df0f5bbf3c72af390a1b15332c1a7fe25505dde8a09e74677571e9bc76d58fe63c2
6
+ metadata.gz: 3a073787bd50fa263eb8ea3a773a28a82bc4e5169f61957ac1497529b6a7ce7c31a18b2b65b4914c4f210e97290de286fb4a7293e52ce2aa8a89d14807f8e4a0
7
+ data.tar.gz: 4d3635baaa03a28cbc06461a0af483a757a117fe2d7cd0e56efd30070f215966ebd80242b97de661dcdf7615ebbfbdb66b5d14158f9808ad9485ae7077f0ec5f
@@ -127,9 +127,10 @@ void get_ellipse_args (
127
127
  assert(x && y && w && h && hole_size && from && to_ && nseg && argv);
128
128
 
129
129
  if (argc <= 0)
130
- argument_error(__FILE__, __LINE__);
131
-
132
- if (argv[0].is_kind_of(Rays::bounds_class()))
130
+ {
131
+ *x = *y = *w = *h = 0;
132
+ }
133
+ else if (argv[0].is_kind_of(Rays::bounds_class()))
133
134
  {
134
135
  const Rays::Bounds& b = to<Rays::Bounds&>(argv[0]);
135
136
  *x = b.x;
@@ -162,13 +163,6 @@ void get_ellipse_args (
162
163
  *h = argc >= 4 ? to<coord>(argv[3]) : *w;
163
164
  }
164
165
 
165
- if (center)
166
- {
167
- Rays::Point p = to<Rays::Point>(center);
168
- *x = p.x;
169
- *y = p.y;
170
- }
171
-
172
166
  if (radius)
173
167
  {
174
168
  Rays::Point p = to<Rays::Point>(radius);
@@ -176,6 +170,13 @@ void get_ellipse_args (
176
170
  *h = p.y * 2;
177
171
  }
178
172
 
173
+ if (center)
174
+ {
175
+ Rays::Point p = to<Rays::Point>(center);
176
+ *x = p.x - *w / 2;
177
+ *y = p.y - *h / 2;
178
+ }
179
+
179
180
  *hole_size = hole ? to<Rays::Point>(hole) : 0;
180
181
  *from = angle_from ? to<float>(angle_from) : 0;
181
182
  *to_ = angle_to ? to<float>(angle_to) : 360;
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.22
1
+ 0.1.23
data/ext/rays/defs.cpp CHANGED
@@ -127,9 +127,10 @@ void get_ellipse_args (
127
127
  assert(x && y && w && h && hole_size && from && to_ && nseg && argv);
128
128
 
129
129
  if (argc <= 0)
130
- argument_error(__FILE__, __LINE__);
131
-
132
- if (argv[0].is_kind_of(Rays::bounds_class()))
130
+ {
131
+ *x = *y = *w = *h = 0;
132
+ }
133
+ else if (argv[0].is_kind_of(Rays::bounds_class()))
133
134
  {
134
135
  const Rays::Bounds& b = to<Rays::Bounds&>(argv[0]);
135
136
  *x = b.x;
@@ -162,13 +163,6 @@ void get_ellipse_args (
162
163
  *h = argc >= 4 ? to<coord>(argv[3]) : *w;
163
164
  }
164
165
 
165
- if (center)
166
- {
167
- Rays::Point p = to<Rays::Point>(center);
168
- *x = p.x;
169
- *y = p.y;
170
- }
171
-
172
166
  if (radius)
173
167
  {
174
168
  Rays::Point p = to<Rays::Point>(radius);
@@ -176,6 +170,13 @@ void get_ellipse_args (
176
170
  *h = p.y * 2;
177
171
  }
178
172
 
173
+ if (center)
174
+ {
175
+ Rays::Point p = to<Rays::Point>(center);
176
+ *x = p.x - *w / 2;
177
+ *y = p.y - *h / 2;
178
+ }
179
+
179
180
  *hole_size = hole ? to<Rays::Point>(hole) : 0;
180
181
  *from = angle_from ? to<float>(angle_from) : 0;
181
182
  *to_ = angle_to ? to<float>(angle_to) : 360;
data/rays.gemspec CHANGED
@@ -26,10 +26,10 @@ Gem::Specification.new do |s|
26
26
  s.homepage = "https://github.com/xord/rays"
27
27
 
28
28
  s.platform = Gem::Platform::RUBY
29
- s.required_ruby_version = '~> 2'
29
+ s.required_ruby_version = '>= 2.6.0'
30
30
 
31
- s.add_runtime_dependency 'xot', '~> 0.1.22'
32
- s.add_runtime_dependency 'rucy', '~> 0.1.22'
31
+ s.add_runtime_dependency 'xot', '~> 0.1.23'
32
+ s.add_runtime_dependency 'rucy', '~> 0.1.23'
33
33
 
34
34
  s.files = `git ls-files`.split $/
35
35
  s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
data/src/painter.cpp CHANGED
@@ -129,7 +129,7 @@ namespace Rays
129
129
  GLint scissor_box[4];
130
130
 
131
131
  GLboolean blend;
132
- GLint blend_src_factor, blend_dst_factor;
132
+ GLint blend_src_rgb, blend_src_alpha, blend_dst_rgb, blend_dst_alpha;
133
133
 
134
134
  GLint framebuffer_binding;
135
135
 
@@ -143,8 +143,10 @@ namespace Rays
143
143
  glGetIntegerv(GL_SCISSOR_BOX, scissor_box);
144
144
 
145
145
  glGetBooleanv(GL_BLEND, &blend);
146
- glGetIntegerv(GL_BLEND_SRC_ALPHA, &blend_src_factor);
147
- glGetIntegerv(GL_BLEND_DST_ALPHA, &blend_dst_factor);
146
+ glGetIntegerv(GL_BLEND_SRC_RGB, &blend_src_rgb);
147
+ glGetIntegerv(GL_BLEND_SRC_ALPHA, &blend_src_alpha);
148
+ glGetIntegerv(GL_BLEND_DST_RGB, &blend_dst_rgb);
149
+ glGetIntegerv(GL_BLEND_DST_ALPHA, &blend_dst_alpha);
148
150
 
149
151
  glGetIntegerv(GL_FRAMEBUFFER_BINDING, &framebuffer_binding);
150
152
  }
@@ -160,7 +162,8 @@ namespace Rays
160
162
  glScissor(scissor_box[0], scissor_box[1], scissor_box[2], scissor_box[3]);
161
163
 
162
164
  enable(GL_BLEND, blend);
163
- glBlendFunc(blend_src_factor, blend_dst_factor);
165
+ glBlendFuncSeparate(
166
+ blend_src_rgb, blend_dst_rgb, blend_src_alpha, blend_dst_alpha);
164
167
 
165
168
  glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_binding);
166
169
  }
@@ -230,7 +233,7 @@ namespace Rays
230
233
  }
231
234
 
232
235
  static const Shader&
233
- get_default_shader_for_color_texture ()
236
+ get_default_shader_for_texture ()
234
237
  {
235
238
  static const Shader SHADER(
236
239
  "varying vec4 " VARYING_TEXCOORD ";"
@@ -244,21 +247,6 @@ namespace Rays
244
247
  return SHADER;
245
248
  }
246
249
 
247
- static const Shader&
248
- get_default_shader_for_alpha_texture ()
249
- {
250
- static const Shader SHADER(
251
- "varying vec4 " VARYING_TEXCOORD ";"
252
- "varying vec4 " VARYING_COLOR ";"
253
- "vec4 sampleTexture(vec2);"
254
- "void main ()"
255
- "{"
256
- " vec4 color = sampleTexture(" VARYING_TEXCOORD ".xy);"
257
- " gl_FragColor = vec4(v_Color.rgb, color.a);"
258
- "}");
259
- return SHADER;
260
- }
261
-
262
250
 
263
251
  struct Painter::Data
264
252
  {
@@ -943,7 +931,7 @@ namespace Rays
943
931
  TextureInfo texinfo(texture, src_x, src_y, src_x + src_w, src_y + src_h);
944
932
 
945
933
  if (!shader)
946
- shader = &get_default_shader_for_color_texture();
934
+ shader = &get_default_shader_for_texture();
947
935
 
948
936
  draw_polygon(
949
937
  painter, MODES, 0, 0, false, nostroke, points, 4, NULL, 0, texcoords,
@@ -1100,7 +1088,7 @@ namespace Rays
1100
1088
  {
1101
1089
  int bmp_w = std::max(texture.width(), tex_w);
1102
1090
  int bmp_h = std::max(texture.height(), tex_h);
1103
- self->text_image = Image(Bitmap(bmp_w, bmp_h, ALPHA), density);
1091
+ self->text_image = Image(Bitmap(bmp_w, bmp_h), density);
1104
1092
  }
1105
1093
 
1106
1094
  if (!self->text_image)
@@ -1120,7 +1108,7 @@ namespace Rays
1120
1108
  painter, self->text_image,
1121
1109
  0, 0, str_w, str_h,
1122
1110
  x, y, str_w, str_h,
1123
- true, &get_default_shader_for_alpha_texture());
1111
+ true, &get_default_shader_for_texture());
1124
1112
 
1125
1113
  debug_draw_text(painter, font, x, y, str_w / density, str_h / density);
1126
1114
  }
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.22
4
+ version: 0.1.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-13 00:00:00.000000000 Z
11
+ date: 2021-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xot
@@ -16,52 +16,52 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.22
19
+ version: 0.1.23
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.22
26
+ version: 0.1.23
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.22
33
+ version: 0.1.23
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.22
40
+ version: 0.1.23
41
41
  description: This library helps you to develop graphics application with OpenGL.
42
42
  email: xordog@gmail.com
43
43
  executables: []
44
44
  extensions:
45
45
  - Rakefile
46
46
  extra_rdoc_files:
47
- - ".doc/ext/rays/defs.cpp"
48
- - ".doc/ext/rays/image.cpp"
49
47
  - ".doc/ext/rays/bitmap.cpp"
48
+ - ".doc/ext/rays/bounds.cpp"
50
49
  - ".doc/ext/rays/camera.cpp"
51
- - ".doc/ext/rays/rays.cpp"
52
- - ".doc/ext/rays/font.cpp"
53
- - ".doc/ext/rays/color_space.cpp"
54
- - ".doc/ext/rays/polygon_line.cpp"
55
- - ".doc/ext/rays/painter.cpp"
56
- - ".doc/ext/rays/noise.cpp"
57
50
  - ".doc/ext/rays/color.cpp"
58
- - ".doc/ext/rays/shader.cpp"
51
+ - ".doc/ext/rays/color_space.cpp"
52
+ - ".doc/ext/rays/defs.cpp"
53
+ - ".doc/ext/rays/font.cpp"
54
+ - ".doc/ext/rays/image.cpp"
55
+ - ".doc/ext/rays/matrix.cpp"
59
56
  - ".doc/ext/rays/native.cpp"
57
+ - ".doc/ext/rays/noise.cpp"
58
+ - ".doc/ext/rays/painter.cpp"
60
59
  - ".doc/ext/rays/point.cpp"
61
- - ".doc/ext/rays/matrix.cpp"
62
60
  - ".doc/ext/rays/polygon.cpp"
61
+ - ".doc/ext/rays/polygon_line.cpp"
63
62
  - ".doc/ext/rays/polyline.cpp"
64
- - ".doc/ext/rays/bounds.cpp"
63
+ - ".doc/ext/rays/rays.cpp"
64
+ - ".doc/ext/rays/shader.cpp"
65
65
  files:
66
66
  - ".doc/ext/rays/bitmap.cpp"
67
67
  - ".doc/ext/rays/bounds.cpp"
@@ -243,16 +243,16 @@ require_paths:
243
243
  - lib
244
244
  required_ruby_version: !ruby/object:Gem::Requirement
245
245
  requirements:
246
- - - "~>"
246
+ - - ">="
247
247
  - !ruby/object:Gem::Version
248
- version: '2'
248
+ version: 2.6.0
249
249
  required_rubygems_version: !ruby/object:Gem::Requirement
250
250
  requirements:
251
251
  - - ">="
252
252
  - !ruby/object:Gem::Version
253
253
  version: '0'
254
254
  requirements: []
255
- rubygems_version: 3.0.3
255
+ rubygems_version: 3.2.22
256
256
  signing_key:
257
257
  specification_version: 4
258
258
  summary: A Drawing Engine using OpenGL.