rays 0.1.27 → 0.1.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.doc/ext/rays/exception.cpp +45 -0
- data/.doc/ext/rays/native.cpp +2 -0
- data/.doc/ext/rays/painter.cpp +7 -2
- data/.doc/ext/rays/shader.cpp +100 -6
- data/VERSION +1 -1
- data/ext/rays/defs.h +1 -0
- data/ext/rays/exception.cpp +45 -0
- data/ext/rays/native.cpp +2 -0
- data/ext/rays/painter.cpp +7 -2
- data/ext/rays/shader.cpp +101 -5
- data/include/rays/exception.h +11 -0
- data/include/rays/ruby/bitmap.h +0 -1
- data/include/rays/ruby/bounds.h +0 -2
- data/include/rays/ruby/camera.h +0 -1
- data/include/rays/ruby/color.h +0 -2
- data/include/rays/ruby/color_space.h +0 -1
- data/include/rays/ruby/defs.h +30 -0
- data/include/rays/ruby/exception.h +28 -0
- data/include/rays/ruby/font.h +0 -1
- data/include/rays/ruby/image.h +0 -1
- data/include/rays/ruby/matrix.h +0 -1
- data/include/rays/ruby/painter.h +0 -1
- data/include/rays/ruby/point.h +0 -2
- data/include/rays/ruby/polygon.h +0 -1
- data/include/rays/ruby/polyline.h +0 -1
- data/include/rays/ruby/rays.h +0 -1
- data/include/rays/ruby/shader.h +0 -1
- data/include/rays/ruby.h +2 -0
- data/include/rays/shader.h +48 -1
- data/lib/rays/painter.rb +6 -5
- data/lib/rays/point.rb +1 -0
- data/lib/rays/shader.rb +18 -5
- data/rays.gemspec +2 -2
- data/src/exception.cpp +13 -0
- data/src/image.cpp +6 -4
- data/src/ios/bitmap.mm +18 -1
- data/src/opengl.cpp +21 -7
- data/src/opengl.h +5 -3
- data/src/osx/bitmap.mm +18 -1
- data/src/osx/font.mm +0 -2
- data/src/osx/opengl.mm +17 -2
- data/src/painter.cpp +196 -125
- data/src/shader.cpp +333 -53
- data/src/shader.h +53 -14
- data/src/shader_program.cpp +53 -27
- data/src/shader_program.h +8 -1
- data/src/shader_source.cpp +2 -2
- data/src/texture.cpp +75 -63
- data/test/test_image.rb +45 -10
- data/test/test_painter.rb +26 -4
- data/test/test_point.rb +6 -5
- data/test/test_rays.rb +2 -2
- data/test/test_shader.rb +151 -14
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d598cf8c5059a425c7f26881d6a5f411969ed3ad46f07c331372d398f17bf9e6
|
4
|
+
data.tar.gz: 7f87f57fbaf8deee511e248ce2d8fea4b1e445cda91ec324fd85b9f3959a8e16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e82501e4410fdb429f04cc8acd33a56eeff585ba918a9bfed05ef59db5db61997e279557ec5c3f7e329af285a439f5c49d94be4a4cf7de909f299926e584d2a
|
7
|
+
data.tar.gz: 8f27df0f080dc97f0f22bbc45abd6a0355d39190a3ff6d48a53abe0c947ca6bc92a5304a214680c7c9871dfa7fde426ef65acc361de594fb113e9ed0c19615fe
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#include "rays/ruby/exception.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include "defs.h"
|
5
|
+
|
6
|
+
|
7
|
+
static Class cRaysError;
|
8
|
+
static Class cOpenGLError;
|
9
|
+
static Class cShaderError;
|
10
|
+
|
11
|
+
void
|
12
|
+
Init_exception ()
|
13
|
+
{
|
14
|
+
Module mRays = rb_define_module("Rays");
|
15
|
+
|
16
|
+
cRaysError = rb_define_class_under(mRays, "RaysError", rb_eRuntimeError);
|
17
|
+
cOpenGLError = rb_define_class_under(mRays, "OpenGLError", cRaysError);
|
18
|
+
cShaderError = rb_define_class_under(mRays, "ShaderError", cOpenGLError);
|
19
|
+
}
|
20
|
+
|
21
|
+
|
22
|
+
namespace Rays
|
23
|
+
{
|
24
|
+
|
25
|
+
|
26
|
+
Class
|
27
|
+
rays_error_class ()
|
28
|
+
{
|
29
|
+
return cRaysError;
|
30
|
+
}
|
31
|
+
|
32
|
+
Class
|
33
|
+
opengl_error_class ()
|
34
|
+
{
|
35
|
+
return cOpenGLError;
|
36
|
+
}
|
37
|
+
|
38
|
+
Class
|
39
|
+
shader_error_class ()
|
40
|
+
{
|
41
|
+
return cShaderError;
|
42
|
+
}
|
43
|
+
|
44
|
+
|
45
|
+
}// Rays
|
data/.doc/ext/rays/native.cpp
CHANGED
data/.doc/ext/rays/painter.cpp
CHANGED
@@ -479,7 +479,10 @@ VALUE set_shader(VALUE self)
|
|
479
479
|
CHECK;
|
480
480
|
check_arg_count(__FILE__, __LINE__, "Painter#set_shader", argc, 1);
|
481
481
|
|
482
|
-
|
482
|
+
if (argc >= 1 && !argv[0])
|
483
|
+
THIS->no_shader();
|
484
|
+
else
|
485
|
+
THIS->set_shader(to<Rays::Shader>(argc, argv));
|
483
486
|
return self;
|
484
487
|
}
|
485
488
|
|
@@ -487,7 +490,9 @@ static
|
|
487
490
|
VALUE get_shader(VALUE self)
|
488
491
|
{
|
489
492
|
CHECK;
|
490
|
-
|
493
|
+
|
494
|
+
const Rays::Shader& shader = THIS->shader();
|
495
|
+
return shader ? value(shader) : nil();
|
491
496
|
}
|
492
497
|
|
493
498
|
static
|
data/.doc/ext/rays/shader.cpp
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#include "rays/ruby/shader.h"
|
2
2
|
|
3
3
|
|
4
|
+
#include "rays/ruby/image.h"
|
4
5
|
#include "defs.h"
|
5
6
|
|
6
7
|
|
@@ -17,12 +18,83 @@ VALUE alloc(VALUE klass)
|
|
17
18
|
return new_type<Rays::Shader>(klass);
|
18
19
|
}
|
19
20
|
|
21
|
+
static const char*
|
22
|
+
to_name (const Value& names, size_t index)
|
23
|
+
{
|
24
|
+
if (!names || !names.is_array() || index >= names.size())
|
25
|
+
return NULL;
|
26
|
+
|
27
|
+
const auto& name = names[index];
|
28
|
+
if (!name) return NULL;
|
29
|
+
|
30
|
+
return name.c_str();
|
31
|
+
}
|
32
|
+
|
33
|
+
static Rays::ShaderEnv::NameList
|
34
|
+
to_name_list (const Value& names, size_t index)
|
35
|
+
{
|
36
|
+
if (!names || !names.is_array() || index >= names.size())
|
37
|
+
return {};
|
38
|
+
|
39
|
+
const auto& name_or_array = names[index];
|
40
|
+
if (name_or_array.is_array())
|
41
|
+
{
|
42
|
+
Rays::ShaderEnv::NameList list;
|
43
|
+
for (size_t i = 0; i < name_or_array.size(); ++i)
|
44
|
+
list.emplace_back(name_or_array[i].c_str());
|
45
|
+
return list;
|
46
|
+
}
|
47
|
+
else if (name_or_array.is_s() || name_or_array.is_sym())
|
48
|
+
return {Xot::String(name_or_array.c_str())};
|
49
|
+
else
|
50
|
+
return {};
|
51
|
+
}
|
52
|
+
|
53
|
+
static std::shared_ptr<Rays::ShaderEnv>
|
54
|
+
make_env (const Value& names, const Value& ignore_no_uniform_location_error)
|
55
|
+
{
|
56
|
+
bool has_names = names && names.is_array() && !names.empty();
|
57
|
+
if (!has_names && !ignore_no_uniform_location_error)
|
58
|
+
return NULL;
|
59
|
+
|
60
|
+
uint flags = 0;
|
61
|
+
if (ignore_no_uniform_location_error)
|
62
|
+
flags |= Rays::ShaderEnv::IGNORE_NO_UNIFORM_LOCATION_ERROR;
|
63
|
+
|
64
|
+
return std::make_shared<Rays::ShaderEnv>(
|
65
|
+
to_name_list(names, 0),
|
66
|
+
to_name_list(names, 1),
|
67
|
+
to_name_list(names, 2),
|
68
|
+
to_name( names, 3),
|
69
|
+
to_name( names, 4),
|
70
|
+
to_name( names, 5),
|
71
|
+
to_name_list(names, 6),
|
72
|
+
to_name_list(names, 7),
|
73
|
+
to_name_list(names, 8),
|
74
|
+
to_name_list(names, 9),
|
75
|
+
to_name_list(names, 10),
|
76
|
+
to_name_list(names, 11),
|
77
|
+
flags);
|
78
|
+
}
|
79
|
+
|
20
80
|
static
|
21
|
-
VALUE setup(VALUE self, VALUE
|
81
|
+
VALUE setup(VALUE self, VALUE
|
82
|
+
fragment_shader_source, VALUE vertex_shader_source, VALUE
|
83
|
+
builtin_variable_names, VALUE ignore_no_uniform_location_error)
|
22
84
|
{
|
23
85
|
RUCY_CHECK_OBJ(Rays::Shader, self);
|
24
86
|
|
25
|
-
|
87
|
+
if (fragment_shader_source.is_nil())
|
88
|
+
argument_error(__FILE__, __LINE__);
|
89
|
+
|
90
|
+
const char* fs = fragment_shader_source.c_str();
|
91
|
+
const char* vs = vertex_shader_source ? vertex_shader_source.c_str() : NULL;
|
92
|
+
|
93
|
+
auto env = make_env(builtin_variable_names, ignore_no_uniform_location_error);
|
94
|
+
if (env)
|
95
|
+
*THIS = Rays::Shader(fs, vs, *env);
|
96
|
+
else
|
97
|
+
*THIS = Rays::Shader(fs, vs);
|
26
98
|
}
|
27
99
|
|
28
100
|
static
|
@@ -31,9 +103,6 @@ VALUE set_uniform(VALUE self)
|
|
31
103
|
CHECK;
|
32
104
|
check_arg_count(__FILE__, __LINE__, "Painter#set_uniform", argc, 2, 3, 4, 5);
|
33
105
|
|
34
|
-
#define Ai(n) (argv[n].as_i())
|
35
|
-
#define Af(n) ((float) argv[n].as_f())
|
36
|
-
|
37
106
|
const char* name = argv[0].c_str();
|
38
107
|
if (argv[1].is_array())
|
39
108
|
{
|
@@ -46,6 +115,9 @@ VALUE set_uniform(VALUE self)
|
|
46
115
|
argv += 1;
|
47
116
|
}
|
48
117
|
|
118
|
+
#define Ai(n) (argv[n].as_i())
|
119
|
+
#define Af(n) ((float) argv[n].as_f())
|
120
|
+
|
49
121
|
if (argv[0].is_i())
|
50
122
|
{
|
51
123
|
switch (argc)
|
@@ -66,6 +138,8 @@ VALUE set_uniform(VALUE self)
|
|
66
138
|
case 4: THIS->set_uniform(name, Af(0), Af(1), Af(2), Af(3)); break;
|
67
139
|
}
|
68
140
|
}
|
141
|
+
else if (argv[0].is_kind_of(Rays::image_class()))
|
142
|
+
THIS->set_uniform(name, to<Rays::Image&>(argv[0]));
|
69
143
|
else
|
70
144
|
argument_error(__FILE__, __LINE__);
|
71
145
|
|
@@ -75,6 +149,24 @@ VALUE set_uniform(VALUE self)
|
|
75
149
|
return self;
|
76
150
|
}
|
77
151
|
|
152
|
+
static
|
153
|
+
VALUE get_vertex_shader_source(VALUE self)
|
154
|
+
{
|
155
|
+
CHECK;
|
156
|
+
|
157
|
+
const char* source = THIS->vertex_shader_source();
|
158
|
+
return source ? value(source) : nil();
|
159
|
+
}
|
160
|
+
|
161
|
+
static
|
162
|
+
VALUE get_fragment_shader_source(VALUE self)
|
163
|
+
{
|
164
|
+
CHECK;
|
165
|
+
|
166
|
+
const char* source = THIS->fragment_shader_source();
|
167
|
+
return source ? value(source) : nil();
|
168
|
+
}
|
169
|
+
|
78
170
|
|
79
171
|
static Class cShader;
|
80
172
|
|
@@ -85,8 +177,10 @@ Init_shader ()
|
|
85
177
|
|
86
178
|
cShader = rb_define_class_under(mRays, "Shader", rb_cObject);
|
87
179
|
rb_define_alloc_func(cShader, alloc);
|
88
|
-
rb_define_private_method(cShader, "setup", RUBY_METHOD_FUNC(setup),
|
180
|
+
rb_define_private_method(cShader, "setup", RUBY_METHOD_FUNC(setup), 4);
|
89
181
|
rb_define_private_method(cShader, "set_uniform", RUBY_METHOD_FUNC(set_uniform), -1);
|
182
|
+
rb_define_method(cShader, "vertex_shader_source", RUBY_METHOD_FUNC(get_vertex_shader_source), 0);
|
183
|
+
rb_define_method(cShader, "fragment_shader_source", RUBY_METHOD_FUNC(get_fragment_shader_source), 0);
|
90
184
|
}
|
91
185
|
|
92
186
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.29
|
data/ext/rays/defs.h
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
#include "rays/ruby/exception.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include "defs.h"
|
5
|
+
|
6
|
+
|
7
|
+
static Class cRaysError;
|
8
|
+
static Class cOpenGLError;
|
9
|
+
static Class cShaderError;
|
10
|
+
|
11
|
+
void
|
12
|
+
Init_exception ()
|
13
|
+
{
|
14
|
+
Module mRays = define_module("Rays");
|
15
|
+
|
16
|
+
cRaysError = mRays.define_class("RaysError", rb_eRuntimeError);
|
17
|
+
cOpenGLError = mRays.define_class("OpenGLError", cRaysError);
|
18
|
+
cShaderError = mRays.define_class("ShaderError", cOpenGLError);
|
19
|
+
}
|
20
|
+
|
21
|
+
|
22
|
+
namespace Rays
|
23
|
+
{
|
24
|
+
|
25
|
+
|
26
|
+
Class
|
27
|
+
rays_error_class ()
|
28
|
+
{
|
29
|
+
return cRaysError;
|
30
|
+
}
|
31
|
+
|
32
|
+
Class
|
33
|
+
opengl_error_class ()
|
34
|
+
{
|
35
|
+
return cOpenGLError;
|
36
|
+
}
|
37
|
+
|
38
|
+
Class
|
39
|
+
shader_error_class ()
|
40
|
+
{
|
41
|
+
return cShaderError;
|
42
|
+
}
|
43
|
+
|
44
|
+
|
45
|
+
}// Rays
|
data/ext/rays/native.cpp
CHANGED
data/ext/rays/painter.cpp
CHANGED
@@ -521,7 +521,10 @@ RUCY_DEFN(set_shader)
|
|
521
521
|
CHECK;
|
522
522
|
check_arg_count(__FILE__, __LINE__, "Painter#set_shader", argc, 1);
|
523
523
|
|
524
|
-
|
524
|
+
if (argc >= 1 && !argv[0])
|
525
|
+
THIS->no_shader();
|
526
|
+
else
|
527
|
+
THIS->set_shader(to<Rays::Shader>(argc, argv));
|
525
528
|
return self;
|
526
529
|
}
|
527
530
|
RUCY_END
|
@@ -530,7 +533,9 @@ static
|
|
530
533
|
RUCY_DEF0(get_shader)
|
531
534
|
{
|
532
535
|
CHECK;
|
533
|
-
|
536
|
+
|
537
|
+
const Rays::Shader& shader = THIS->shader();
|
538
|
+
return shader ? value(shader) : nil();
|
534
539
|
}
|
535
540
|
RUCY_END
|
536
541
|
|
data/ext/rays/shader.cpp
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#include "rays/ruby/shader.h"
|
2
2
|
|
3
3
|
|
4
|
+
#include "rays/ruby/image.h"
|
4
5
|
#include "defs.h"
|
5
6
|
|
6
7
|
|
@@ -18,12 +19,83 @@ RUCY_DEF_ALLOC(alloc, klass)
|
|
18
19
|
}
|
19
20
|
RUCY_END
|
20
21
|
|
22
|
+
static const char*
|
23
|
+
to_name (const Value& names, size_t index)
|
24
|
+
{
|
25
|
+
if (!names || !names.is_array() || index >= names.size())
|
26
|
+
return NULL;
|
27
|
+
|
28
|
+
const auto& name = names[index];
|
29
|
+
if (!name) return NULL;
|
30
|
+
|
31
|
+
return name.c_str();
|
32
|
+
}
|
33
|
+
|
34
|
+
static Rays::ShaderEnv::NameList
|
35
|
+
to_name_list (const Value& names, size_t index)
|
36
|
+
{
|
37
|
+
if (!names || !names.is_array() || index >= names.size())
|
38
|
+
return {};
|
39
|
+
|
40
|
+
const auto& name_or_array = names[index];
|
41
|
+
if (name_or_array.is_array())
|
42
|
+
{
|
43
|
+
Rays::ShaderEnv::NameList list;
|
44
|
+
for (size_t i = 0; i < name_or_array.size(); ++i)
|
45
|
+
list.emplace_back(name_or_array[i].c_str());
|
46
|
+
return list;
|
47
|
+
}
|
48
|
+
else if (name_or_array.is_s() || name_or_array.is_sym())
|
49
|
+
return {Xot::String(name_or_array.c_str())};
|
50
|
+
else
|
51
|
+
return {};
|
52
|
+
}
|
53
|
+
|
54
|
+
static std::shared_ptr<Rays::ShaderEnv>
|
55
|
+
make_env (const Value& names, const Value& ignore_no_uniform_location_error)
|
56
|
+
{
|
57
|
+
bool has_names = names && names.is_array() && !names.empty();
|
58
|
+
if (!has_names && !ignore_no_uniform_location_error)
|
59
|
+
return NULL;
|
60
|
+
|
61
|
+
uint flags = 0;
|
62
|
+
if (ignore_no_uniform_location_error)
|
63
|
+
flags |= Rays::ShaderEnv::IGNORE_NO_UNIFORM_LOCATION_ERROR;
|
64
|
+
|
65
|
+
return std::make_shared<Rays::ShaderEnv>(
|
66
|
+
to_name_list(names, 0),
|
67
|
+
to_name_list(names, 1),
|
68
|
+
to_name_list(names, 2),
|
69
|
+
to_name( names, 3),
|
70
|
+
to_name( names, 4),
|
71
|
+
to_name( names, 5),
|
72
|
+
to_name_list(names, 6),
|
73
|
+
to_name_list(names, 7),
|
74
|
+
to_name_list(names, 8),
|
75
|
+
to_name_list(names, 9),
|
76
|
+
to_name_list(names, 10),
|
77
|
+
to_name_list(names, 11),
|
78
|
+
flags);
|
79
|
+
}
|
80
|
+
|
21
81
|
static
|
22
|
-
|
82
|
+
RUCY_DEF4(setup,
|
83
|
+
fragment_shader_source, vertex_shader_source,
|
84
|
+
builtin_variable_names, ignore_no_uniform_location_error)
|
23
85
|
{
|
24
86
|
RUCY_CHECK_OBJ(Rays::Shader, self);
|
25
87
|
|
26
|
-
|
88
|
+
if (fragment_shader_source.is_nil())
|
89
|
+
argument_error(__FILE__, __LINE__);
|
90
|
+
|
91
|
+
const char* fs = fragment_shader_source.c_str();
|
92
|
+
const char* vs = vertex_shader_source ? vertex_shader_source.c_str() : NULL;
|
93
|
+
|
94
|
+
auto env = make_env(builtin_variable_names, ignore_no_uniform_location_error);
|
95
|
+
if (env)
|
96
|
+
*THIS = Rays::Shader(fs, vs, *env);
|
97
|
+
else
|
98
|
+
*THIS = Rays::Shader(fs, vs);
|
27
99
|
}
|
28
100
|
RUCY_END
|
29
101
|
|
@@ -33,9 +105,6 @@ RUCY_DEFN(set_uniform)
|
|
33
105
|
CHECK;
|
34
106
|
check_arg_count(__FILE__, __LINE__, "Painter#set_uniform", argc, 2, 3, 4, 5);
|
35
107
|
|
36
|
-
#define Ai(n) (argv[n].as_i())
|
37
|
-
#define Af(n) ((float) argv[n].as_f())
|
38
|
-
|
39
108
|
const char* name = argv[0].c_str();
|
40
109
|
if (argv[1].is_array())
|
41
110
|
{
|
@@ -48,6 +117,9 @@ RUCY_DEFN(set_uniform)
|
|
48
117
|
argv += 1;
|
49
118
|
}
|
50
119
|
|
120
|
+
#define Ai(n) (argv[n].as_i())
|
121
|
+
#define Af(n) ((float) argv[n].as_f())
|
122
|
+
|
51
123
|
if (argv[0].is_i())
|
52
124
|
{
|
53
125
|
switch (argc)
|
@@ -68,6 +140,8 @@ RUCY_DEFN(set_uniform)
|
|
68
140
|
case 4: THIS->set_uniform(name, Af(0), Af(1), Af(2), Af(3)); break;
|
69
141
|
}
|
70
142
|
}
|
143
|
+
else if (argv[0].is_kind_of(Rays::image_class()))
|
144
|
+
THIS->set_uniform(name, to<Rays::Image&>(argv[0]));
|
71
145
|
else
|
72
146
|
argument_error(__FILE__, __LINE__);
|
73
147
|
|
@@ -78,6 +152,26 @@ RUCY_DEFN(set_uniform)
|
|
78
152
|
}
|
79
153
|
RUCY_END
|
80
154
|
|
155
|
+
static
|
156
|
+
RUCY_DEF0(get_vertex_shader_source)
|
157
|
+
{
|
158
|
+
CHECK;
|
159
|
+
|
160
|
+
const char* source = THIS->vertex_shader_source();
|
161
|
+
return source ? value(source) : nil();
|
162
|
+
}
|
163
|
+
RUCY_END
|
164
|
+
|
165
|
+
static
|
166
|
+
RUCY_DEF0(get_fragment_shader_source)
|
167
|
+
{
|
168
|
+
CHECK;
|
169
|
+
|
170
|
+
const char* source = THIS->fragment_shader_source();
|
171
|
+
return source ? value(source) : nil();
|
172
|
+
}
|
173
|
+
RUCY_END
|
174
|
+
|
81
175
|
|
82
176
|
static Class cShader;
|
83
177
|
|
@@ -90,6 +184,8 @@ Init_shader ()
|
|
90
184
|
cShader.define_alloc_func(alloc);
|
91
185
|
cShader.define_private_method("setup", setup);
|
92
186
|
cShader.define_private_method("set_uniform", set_uniform);
|
187
|
+
cShader.define_method( "vertex_shader_source", get_vertex_shader_source);
|
188
|
+
cShader.define_method("fragment_shader_source", get_fragment_shader_source);
|
93
189
|
}
|
94
190
|
|
95
191
|
|
data/include/rays/exception.h
CHANGED
@@ -26,6 +26,13 @@ namespace Rays
|
|
26
26
|
};
|
27
27
|
|
28
28
|
|
29
|
+
class ShaderError : public OpenGLError
|
30
|
+
{
|
31
|
+
typedef OpenGLError Super;
|
32
|
+
public: ShaderError (const char* str = NULL);
|
33
|
+
};
|
34
|
+
|
35
|
+
|
29
36
|
namespace ErrorFunctions
|
30
37
|
{
|
31
38
|
|
@@ -39,6 +46,10 @@ namespace Rays
|
|
39
46
|
void opengl_error (
|
40
47
|
const char* file, int line, const char* format = NULL, ...);
|
41
48
|
|
49
|
+
[[noreturn]]
|
50
|
+
void shader_error (
|
51
|
+
const char* file, int line, const char* format = NULL, ...);
|
52
|
+
|
42
53
|
}// ErrorFunctions
|
43
54
|
|
44
55
|
|
data/include/rays/ruby/bitmap.h
CHANGED
data/include/rays/ruby/bounds.h
CHANGED
data/include/rays/ruby/camera.h
CHANGED
data/include/rays/ruby/color.h
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
#pragma once
|
3
|
+
#ifndef __RAYS_RUBY_DEFS_H__
|
4
|
+
#define __RAYS_RUBY_DEFS_H__
|
5
|
+
|
6
|
+
|
7
|
+
#include <rucy/extension.h>
|
8
|
+
#include <rays/ruby/exception.h>
|
9
|
+
|
10
|
+
|
11
|
+
#define RAYS_CATCH \
|
12
|
+
} \
|
13
|
+
catch (const Rays::ShaderError& e) \
|
14
|
+
{ \
|
15
|
+
RUCY_RAISE(Rays::shader_error_class(), e.what()); \
|
16
|
+
} \
|
17
|
+
catch (const Rays::OpenGLError& e) \
|
18
|
+
{ \
|
19
|
+
RUCY_RAISE(Rays::opengl_error_class(), e.what()); \
|
20
|
+
} \
|
21
|
+
catch (const Rays::RaysError& e) \
|
22
|
+
{ \
|
23
|
+
RUCY_RAISE(Rays::rays_error_class(), e.what());
|
24
|
+
|
25
|
+
#define RUCY_END \
|
26
|
+
RAYS_CATCH \
|
27
|
+
RUCY_DEF_END
|
28
|
+
|
29
|
+
|
30
|
+
#endif//EOH
|
@@ -0,0 +1,28 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
#pragma once
|
3
|
+
#ifndef __RAYS_RUBY_EXCEPTION_H__
|
4
|
+
#define __RAYS_RUBY_EXCEPTION_H__
|
5
|
+
|
6
|
+
|
7
|
+
#include <rucy/class.h>
|
8
|
+
#include <rays/exception.h>
|
9
|
+
|
10
|
+
|
11
|
+
namespace Rays
|
12
|
+
{
|
13
|
+
|
14
|
+
|
15
|
+
Rucy::Class rays_error_class ();
|
16
|
+
// class Rays::RaysError
|
17
|
+
|
18
|
+
Rucy::Class opengl_error_class ();
|
19
|
+
// class Rays::OpenGLError
|
20
|
+
|
21
|
+
Rucy::Class shader_error_class ();
|
22
|
+
// class Rays::ShaderError
|
23
|
+
|
24
|
+
|
25
|
+
}// Rays
|
26
|
+
|
27
|
+
|
28
|
+
#endif//EOH
|
data/include/rays/ruby/font.h
CHANGED
data/include/rays/ruby/image.h
CHANGED
data/include/rays/ruby/matrix.h
CHANGED
data/include/rays/ruby/painter.h
CHANGED