rays 0.3.10 → 0.3.12
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/image.cpp +10 -0
- data/.doc/ext/rays/painter.cpp +49 -1
- data/.doc/ext/rays/polygon.cpp +1 -1
- data/.doc/ext/rays/shader.cpp +8 -6
- data/.github/workflows/release-gem.yml +4 -1
- data/.github/workflows/test.yml +4 -4
- data/.github/workflows/utils.rb +88 -17
- data/ChangeLog.md +24 -0
- data/Gemfile.lock +6 -5
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/ext/rays/extconf.rb +3 -4
- data/ext/rays/image.cpp +11 -0
- data/ext/rays/painter.cpp +53 -1
- data/ext/rays/polygon.cpp +1 -1
- data/ext/rays/shader.cpp +8 -6
- data/include/rays/coord.h +6 -6
- data/include/rays/defs.h +2 -0
- data/include/rays/image.h +11 -1
- data/include/rays/painter.h +19 -0
- data/include/rays/ruby.h +2 -2
- data/include/rays/shader.h +5 -3
- data/include/rays.h +2 -2
- data/lib/rays/extension.rb +8 -2
- data/lib/rays/image.rb +2 -1
- data/lib/rays/shader.rb +13 -4
- data/rays.gemspec +3 -4
- data/src/bitmap.h +4 -0
- data/src/color_space.cpp +2 -42
- data/src/coord.h +10 -0
- data/src/font.cpp +1 -1
- data/src/image.cpp +85 -11
- data/src/ios/bitmap.mm +5 -32
- data/src/ios/rays.mm +3 -3
- data/src/opengl/bitmap.cpp +41 -0
- data/src/opengl/color_space.cpp +51 -0
- data/src/{color_space.h → opengl/color_space.h} +2 -2
- data/src/{frame_buffer.cpp → opengl/frame_buffer.cpp} +1 -1
- data/src/{frame_buffer.h → opengl/frame_buffer.h} +2 -2
- data/src/{ios → opengl/ios}/opengl.mm +3 -3
- data/src/{opengl.h → opengl/opengl.h} +2 -6
- data/src/{osx → opengl/osx}/opengl.mm +3 -3
- data/src/opengl/painter.cpp +1020 -0
- data/src/{render_buffer.cpp → opengl/render_buffer.cpp} +1 -1
- data/src/{render_buffer.h → opengl/render_buffer.h} +2 -2
- data/src/{sdl → opengl/sdl}/opengl.cpp +10 -3
- data/src/{shader.cpp → opengl/shader.cpp} +69 -53
- data/src/{shader.h → opengl/shader.h} +12 -8
- data/src/{shader_program.cpp → opengl/shader_program.cpp} +24 -10
- data/src/{shader_program.h → opengl/shader_program.h} +4 -3
- data/src/{shader_source.cpp → opengl/shader_source.cpp} +2 -4
- data/src/{shader_source.h → opengl/shader_source.h} +2 -2
- data/src/{texture.cpp → opengl/texture.cpp} +18 -7
- data/src/opengl/texture.h +21 -0
- data/src/{win32 → opengl/win32}/opengl.cpp +4 -3
- data/src/osx/bitmap.mm +6 -34
- data/src/osx/rays.mm +3 -3
- data/src/painter.cpp +96 -925
- data/src/painter.h +223 -11
- data/src/polygon.cpp +38 -13
- data/src/renderer.h +22 -0
- data/src/sdl/bitmap.cpp +5 -33
- data/src/sdl/font.cpp +358 -9
- data/src/sdl/rays.cpp +8 -3
- data/src/texture.h +6 -3
- data/src/win32/bitmap.cpp +6 -34
- data/src/win32/rays.cpp +3 -3
- data/test/test_painter.rb +36 -25
- data/test/test_painter_batch.rb +254 -0
- metadata +31 -24
- /data/src/{opengl.cpp → opengl/opengl.cpp} +0 -0
data/src/osx/bitmap.mm
CHANGED
|
@@ -5,10 +5,8 @@
|
|
|
5
5
|
#import <Cocoa/Cocoa.h>
|
|
6
6
|
#include <xot/util.h>
|
|
7
7
|
#include "rays/exception.h"
|
|
8
|
-
#include "../color_space.h"
|
|
9
8
|
#include "../font.h"
|
|
10
9
|
#include "../texture.h"
|
|
11
|
-
#include "../frame_buffer.h"
|
|
12
10
|
|
|
13
11
|
|
|
14
12
|
namespace Rays
|
|
@@ -130,11 +128,10 @@ namespace Rays
|
|
|
130
128
|
};// Bitmap::Data
|
|
131
129
|
|
|
132
130
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
Bitmap* bitmap,
|
|
136
|
-
|
|
137
|
-
const void* pixels = NULL, bool clear_pixels = true)
|
|
131
|
+
void
|
|
132
|
+
Bitmap_setup (
|
|
133
|
+
Bitmap* bitmap, int w, int h, const ColorSpace& cs,
|
|
134
|
+
const void* pixels, bool clear_pixels)
|
|
138
135
|
{
|
|
139
136
|
if (w <= 0)
|
|
140
137
|
argument_error(__FILE__, __LINE__);
|
|
@@ -161,31 +158,6 @@ namespace Rays
|
|
|
161
158
|
memset(self->pixels, 0, size);
|
|
162
159
|
}
|
|
163
160
|
|
|
164
|
-
Bitmap
|
|
165
|
-
Bitmap_from (const Texture& tex)
|
|
166
|
-
{
|
|
167
|
-
if (!tex)
|
|
168
|
-
argument_error(__FILE__, __LINE__);
|
|
169
|
-
|
|
170
|
-
Bitmap bmp;
|
|
171
|
-
setup_bitmap(
|
|
172
|
-
&bmp, tex.width(), tex.height(), tex.color_space(), NULL, false);
|
|
173
|
-
|
|
174
|
-
GLenum format, type;
|
|
175
|
-
ColorSpace_get_gl_format_and_type(&format, &type, tex.color_space());
|
|
176
|
-
|
|
177
|
-
FrameBuffer fb(tex);
|
|
178
|
-
FrameBufferBinder binder(fb.id());
|
|
179
|
-
|
|
180
|
-
for (int y = 0; y < bmp.height(); ++y)
|
|
181
|
-
{
|
|
182
|
-
GLvoid* ptr = (GLvoid*) bmp.at<uchar>(0, y);
|
|
183
|
-
glReadPixels(0, y, bmp.width(), 1, format, type, ptr);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return bmp;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
161
|
void
|
|
190
162
|
Bitmap_draw_image (
|
|
191
163
|
Bitmap* bitmap, CGImageRef image,
|
|
@@ -291,7 +263,7 @@ namespace Rays
|
|
|
291
263
|
|
|
292
264
|
NSString* path = [NSString stringWithUTF8String: path_];
|
|
293
265
|
NSBitmapImageRep* imagerep =
|
|
294
|
-
[NSBitmapImageRep imageRepWithContentsOfFile: path];
|
|
266
|
+
(NSBitmapImageRep*) [NSBitmapImageRep imageRepWithContentsOfFile: path];
|
|
295
267
|
if (!imagerep)
|
|
296
268
|
rays_error(__FILE__, __LINE__, "[NSBitmapImageRep imageRepWithContentsOfFile] failed.");
|
|
297
269
|
|
|
@@ -318,7 +290,7 @@ namespace Rays
|
|
|
318
290
|
Bitmap::Bitmap (
|
|
319
291
|
int width, int height, const ColorSpace& color_space, const void* pixels)
|
|
320
292
|
{
|
|
321
|
-
|
|
293
|
+
Bitmap_setup(this, width, height, color_space, pixels);
|
|
322
294
|
}
|
|
323
295
|
|
|
324
296
|
Bitmap::~Bitmap ()
|
data/src/osx/rays.mm
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
#import <Foundation/Foundation.h>
|
|
6
6
|
#include "rays/exception.h"
|
|
7
|
-
#include "../
|
|
7
|
+
#include "../renderer.h"
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
namespace Rays
|
|
@@ -29,7 +29,7 @@ namespace Rays
|
|
|
29
29
|
|
|
30
30
|
global::pool = [[NSAutoreleasePool alloc] init];
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Renderer_init();
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
void
|
|
@@ -38,7 +38,7 @@ namespace Rays
|
|
|
38
38
|
if (!global::pool)
|
|
39
39
|
rays_error(__FILE__, __LINE__, "not initialized.");
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
Renderer_fin();
|
|
42
42
|
|
|
43
43
|
[global::pool release];
|
|
44
44
|
global::pool = nil;
|