rays 0.1.11 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.doc/ext/rays/bitmap.cpp +22 -76
- data/.doc/ext/rays/bounds.cpp +95 -125
- data/.doc/ext/rays/camera.cpp +88 -0
- data/.doc/ext/rays/color.cpp +223 -45
- data/.doc/ext/rays/color_space.cpp +146 -46
- data/.doc/ext/rays/defs.cpp +183 -0
- data/.doc/ext/rays/font.cpp +69 -21
- data/.doc/ext/rays/image.cpp +26 -37
- data/.doc/ext/rays/matrix.cpp +186 -29
- data/.doc/ext/rays/native.cpp +14 -8
- data/.doc/ext/rays/noise.cpp +53 -0
- data/.doc/ext/rays/painter.cpp +187 -292
- data/.doc/ext/rays/point.cpp +96 -77
- data/.doc/ext/rays/polygon.cpp +313 -0
- data/.doc/ext/rays/polygon_line.cpp +96 -0
- data/.doc/ext/rays/polyline.cpp +167 -0
- data/.doc/ext/rays/rays.cpp +103 -12
- data/.doc/ext/rays/shader.cpp +83 -9
- data/LICENSE +21 -0
- data/README.md +1 -1
- data/Rakefile +24 -9
- data/VERSION +1 -1
- data/ext/rays/bitmap.cpp +22 -80
- data/ext/rays/bounds.cpp +100 -128
- data/ext/rays/camera.cpp +94 -0
- data/ext/rays/color.cpp +231 -51
- data/ext/rays/color_space.cpp +149 -47
- data/ext/rays/defs.cpp +183 -0
- data/ext/rays/defs.h +26 -2
- data/ext/rays/extconf.rb +2 -3
- data/ext/rays/font.cpp +74 -24
- data/ext/rays/image.cpp +28 -40
- data/ext/rays/matrix.cpp +198 -30
- data/ext/rays/native.cpp +14 -8
- data/ext/rays/noise.cpp +55 -0
- data/ext/rays/painter.cpp +203 -298
- data/ext/rays/point.cpp +105 -81
- data/ext/rays/polygon.cpp +329 -0
- data/ext/rays/polygon_line.cpp +99 -0
- data/ext/rays/polyline.cpp +176 -0
- data/ext/rays/rays.cpp +103 -13
- data/ext/rays/shader.cpp +84 -9
- data/include/rays.h +10 -2
- data/include/rays/bitmap.h +14 -26
- data/include/rays/bounds.h +21 -4
- data/include/rays/camera.h +49 -0
- data/include/rays/color.h +25 -14
- data/include/rays/color_space.h +15 -10
- data/include/rays/coord.h +114 -0
- data/include/rays/debug.h +22 -0
- data/include/rays/defs.h +36 -0
- data/include/rays/exception.h +6 -2
- data/include/rays/font.h +4 -4
- data/include/rays/image.h +12 -18
- data/include/rays/matrix.h +50 -24
- data/include/rays/noise.h +42 -0
- data/include/rays/opengl.h +2 -50
- data/include/rays/painter.h +89 -93
- data/include/rays/point.h +44 -51
- data/include/rays/polygon.h +198 -0
- data/include/rays/polyline.h +71 -0
- data/include/rays/rays.h +3 -0
- data/include/rays/ruby.h +7 -1
- data/include/rays/ruby/bounds.h +1 -1
- data/include/rays/ruby/camera.h +41 -0
- data/include/rays/ruby/color.h +1 -1
- data/include/rays/ruby/color_space.h +1 -1
- data/include/rays/ruby/font.h +1 -1
- data/include/rays/ruby/matrix.h +1 -1
- data/include/rays/ruby/point.h +1 -1
- data/include/rays/ruby/polygon.h +52 -0
- data/include/rays/ruby/polyline.h +41 -0
- data/include/rays/ruby/rays.h +8 -0
- data/include/rays/ruby/shader.h +1 -1
- data/include/rays/shader.h +36 -8
- data/lib/rays.rb +7 -2
- data/lib/rays/bitmap.rb +0 -15
- data/lib/rays/bounds.rb +17 -23
- data/lib/rays/camera.rb +21 -0
- data/lib/rays/color.rb +20 -47
- data/lib/rays/color_space.rb +13 -13
- data/lib/rays/image.rb +3 -7
- data/lib/rays/matrix.rb +28 -0
- data/lib/rays/module.rb +4 -19
- data/lib/rays/painter.rb +78 -93
- data/lib/rays/point.rb +13 -21
- data/lib/rays/polygon.rb +58 -0
- data/lib/rays/polygon_line.rb +36 -0
- data/lib/rays/polyline.rb +32 -0
- data/lib/rays/shader.rb +20 -1
- data/rays.gemspec +5 -7
- data/src/bitmap.h +36 -0
- data/src/bounds.cpp +74 -11
- data/src/color.cpp +58 -23
- data/src/color_space.cpp +52 -34
- data/src/color_space.h +22 -0
- data/src/coord.cpp +170 -0
- data/src/coord.h +35 -0
- data/src/font.cpp +118 -0
- data/src/font.h +64 -0
- data/src/frame_buffer.cpp +37 -71
- data/src/frame_buffer.h +4 -4
- data/src/image.cpp +172 -98
- data/src/image.h +25 -0
- data/src/ios/bitmap.h +21 -0
- data/src/ios/bitmap.mm +129 -110
- data/src/ios/camera.mm +236 -0
- data/src/ios/font.mm +50 -62
- data/src/ios/helper.h +2 -2
- data/src/ios/opengl.mm +19 -4
- data/src/ios/rays.mm +3 -0
- data/src/matrix.cpp +111 -26
- data/src/matrix.h +30 -0
- data/src/noise.cpp +74 -0
- data/src/opengl.cpp +9 -27
- data/src/opengl.h +37 -0
- data/src/osx/bitmap.h +21 -0
- data/src/osx/bitmap.mm +129 -110
- data/src/osx/camera.mm +236 -0
- data/src/osx/font.mm +49 -62
- data/src/osx/helper.h +2 -2
- data/src/osx/opengl.mm +19 -83
- data/src/osx/rays.mm +3 -0
- data/src/painter.cpp +845 -671
- data/src/painter.h +24 -0
- data/src/point.cpp +140 -119
- data/src/polygon.cpp +1266 -0
- data/src/polygon.h +32 -0
- data/src/polyline.cpp +160 -0
- data/src/polyline.h +69 -0
- data/src/render_buffer.cpp +11 -4
- data/src/render_buffer.h +2 -2
- data/src/shader.cpp +163 -106
- data/src/shader.h +38 -0
- data/src/shader_program.cpp +533 -0
- data/src/{program.h → shader_program.h} +28 -16
- data/src/shader_source.cpp +140 -0
- data/src/shader_source.h +52 -0
- data/src/texture.cpp +136 -160
- data/src/texture.h +65 -0
- data/src/win32/bitmap.cpp +62 -52
- data/src/win32/font.cpp +11 -13
- data/src/win32/font.h +24 -0
- data/src/win32/gdi.h +6 -6
- data/test/helper.rb +0 -3
- data/test/test_bitmap.rb +31 -7
- data/test/test_bounds.rb +36 -0
- data/test/test_color.rb +59 -19
- data/test/test_color_space.rb +95 -0
- data/test/test_font.rb +5 -0
- data/test/test_image.rb +24 -20
- data/test/test_matrix.rb +106 -0
- data/test/test_painter.rb +157 -51
- data/test/test_painter_shape.rb +102 -0
- data/test/test_point.rb +29 -0
- data/test/test_polygon.rb +234 -0
- data/test/test_polygon_line.rb +167 -0
- data/test/test_polyline.rb +171 -0
- data/test/test_shader.rb +9 -9
- metadata +102 -70
- data/.doc/ext/rays/texture.cpp +0 -138
- data/ext/rays/texture.cpp +0 -149
- data/include/rays/ruby/texture.h +0 -41
- data/include/rays/texture.h +0 -71
- data/lib/rays/texture.rb +0 -24
- data/src/program.cpp +0 -648
- data/test/test_texture.rb +0 -27
data/src/ios/font.mm
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
// -*- objc -*-
|
2
|
-
#include "
|
2
|
+
#include "../font.h"
|
3
3
|
|
4
4
|
|
5
|
+
#import <CoreGraphics/CGContext.h>
|
5
6
|
#import <CoreText/CoreText.h>
|
6
7
|
#include "rays/exception.h"
|
7
8
|
#include "helper.h"
|
@@ -11,7 +12,7 @@ namespace Rays
|
|
11
12
|
{
|
12
13
|
|
13
14
|
|
14
|
-
struct
|
15
|
+
struct RawFont::Data
|
15
16
|
{
|
16
17
|
|
17
18
|
CTFontRef font;
|
@@ -30,7 +31,7 @@ namespace Rays
|
|
30
31
|
}
|
31
32
|
}
|
32
33
|
|
33
|
-
};//
|
34
|
+
};// RawFont::Data
|
34
35
|
|
35
36
|
|
36
37
|
static CTLineRef
|
@@ -64,29 +65,61 @@ namespace Rays
|
|
64
65
|
}
|
65
66
|
|
66
67
|
|
67
|
-
|
68
|
+
RawFont::RawFont ()
|
68
69
|
{
|
69
70
|
}
|
70
71
|
|
71
|
-
|
72
|
+
RawFont::RawFont (const char* name, coord size)
|
72
73
|
{
|
73
74
|
self->font = name
|
74
|
-
?
|
75
|
-
:
|
75
|
+
? CTFontCreateWithName(cfstring(name).get(), size, NULL)
|
76
|
+
: CTFontCreateUIFontForLanguage(kCTFontSystemFontType, size, NULL);
|
76
77
|
}
|
77
78
|
|
78
|
-
|
79
|
+
RawFont::~RawFont ()
|
79
80
|
{
|
80
81
|
}
|
81
82
|
|
82
|
-
|
83
|
-
|
83
|
+
void
|
84
|
+
RawFont::draw_string (
|
85
|
+
void* context_, coord context_height,
|
86
|
+
const char* str, coord x, coord y) const
|
84
87
|
{
|
85
|
-
|
88
|
+
CGContextRef context = (CGContextRef) context_;
|
89
|
+
|
90
|
+
if (!*this || !context || !str)
|
91
|
+
argument_error(__FILE__, __LINE__);
|
92
|
+
|
93
|
+
if (*str == '\0') return;
|
94
|
+
|
95
|
+
CTLineRef line = make_line(self->font, str);
|
96
|
+
if (!line)
|
97
|
+
rays_error(__FILE__, __LINE__, "creating CTLineRef failed.");
|
98
|
+
|
99
|
+
coord width = 0, height = 0, ascent = 0;
|
100
|
+
width = get_width(str);
|
101
|
+
height = get_height(&ascent);
|
102
|
+
|
103
|
+
height = ceil(height);
|
104
|
+
ascent = floor(ascent);
|
105
|
+
|
106
|
+
CGRect rect = CGRectMake(x, context_height - height - y, width, height);
|
107
|
+
CGContextClearRect(context, rect);
|
108
|
+
//CGContextSetRGBFillColor(context, 0, 0, 0, 1);
|
109
|
+
//CGContextFillRect(context, rect);
|
110
|
+
CGContextSetRGBFillColor(context, 1, 1, 1, 1);
|
111
|
+
|
112
|
+
CGContextSaveGState(context);
|
113
|
+
CGContextSetTextMatrix(context, CGAffineTransformIdentity);
|
114
|
+
CGContextSetTextPosition(context, x, context_height - ascent - y);
|
115
|
+
CTLineDraw(line, context);
|
116
|
+
CGContextRestoreGState(context);
|
117
|
+
|
118
|
+
CFRelease(line);
|
86
119
|
}
|
87
120
|
|
88
121
|
String
|
89
|
-
|
122
|
+
RawFont::name () const
|
90
123
|
{
|
91
124
|
if (!*this) return "";
|
92
125
|
|
@@ -102,14 +135,14 @@ namespace Rays
|
|
102
135
|
}
|
103
136
|
|
104
137
|
coord
|
105
|
-
|
138
|
+
RawFont::size () const
|
106
139
|
{
|
107
140
|
if (!*this) return 0;
|
108
141
|
return CTFontGetSize(self->font);
|
109
142
|
}
|
110
143
|
|
111
144
|
coord
|
112
|
-
|
145
|
+
RawFont::get_width (const char* str) const
|
113
146
|
{
|
114
147
|
if (!str)
|
115
148
|
argument_error(__FILE__, __LINE__);
|
@@ -130,7 +163,7 @@ namespace Rays
|
|
130
163
|
}
|
131
164
|
|
132
165
|
coord
|
133
|
-
|
166
|
+
RawFont::get_height (coord* ascent, coord* descent, coord* leading) const
|
134
167
|
{
|
135
168
|
if (!*this)
|
136
169
|
invalid_state_error(__FILE__, __LINE__);
|
@@ -146,61 +179,16 @@ namespace Rays
|
|
146
179
|
return asc + desc + lead;
|
147
180
|
}
|
148
181
|
|
149
|
-
|
182
|
+
RawFont::operator bool () const
|
150
183
|
{
|
151
184
|
return !!self->font;
|
152
185
|
}
|
153
186
|
|
154
187
|
bool
|
155
|
-
|
188
|
+
RawFont::operator ! () const
|
156
189
|
{
|
157
190
|
return !operator bool();
|
158
191
|
}
|
159
192
|
|
160
193
|
|
161
|
-
const Font&
|
162
|
-
default_font ()
|
163
|
-
{
|
164
|
-
static const Font FONT(NULL);
|
165
|
-
return FONT;
|
166
|
-
}
|
167
|
-
|
168
|
-
|
169
|
-
void
|
170
|
-
draw_string (
|
171
|
-
CGContextRef context, coord context_height,
|
172
|
-
const char* str, coord x, coord y, const Font& font)
|
173
|
-
{
|
174
|
-
if (!context || !str || !font)
|
175
|
-
argument_error(__FILE__, __LINE__);
|
176
|
-
|
177
|
-
if (*str == '\0') return;
|
178
|
-
|
179
|
-
CTLineRef line = make_line(font.self->font, str);
|
180
|
-
if (!line)
|
181
|
-
rays_error(__FILE__, __LINE__, "creating CTLineRef failed.");
|
182
|
-
|
183
|
-
coord width = 0, height = 0, ascent = 0;
|
184
|
-
width = font.get_width(str);
|
185
|
-
height = font.get_height(&ascent);
|
186
|
-
|
187
|
-
height = ceil(height);
|
188
|
-
ascent = floor(ascent);
|
189
|
-
|
190
|
-
CGRect rect = CGRectMake(x, context_height - height - y, width, height);
|
191
|
-
CGContextClearRect(context, rect);
|
192
|
-
//CGContextSetRGBFillColor(context, 0, 0, 0, 1);
|
193
|
-
//CGContextFillRect(context, rect);
|
194
|
-
CGContextSetRGBFillColor(context, 1, 1, 1, 1);
|
195
|
-
|
196
|
-
CGContextSaveGState(context);
|
197
|
-
CGContextSetTextMatrix(context, CGAffineTransformIdentity);
|
198
|
-
CGContextSetTextPosition(context, x, context_height - ascent - y);
|
199
|
-
CTLineDraw(line, context);
|
200
|
-
CGContextRestoreGState(context);
|
201
|
-
|
202
|
-
CFRelease(line);
|
203
|
-
}
|
204
|
-
|
205
|
-
|
206
194
|
}// Rays
|
data/src/ios/helper.h
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
#define __RAYS_SRC_OSX_HELPER_H__
|
5
5
|
|
6
6
|
|
7
|
-
#include <
|
7
|
+
#include <memory>
|
8
8
|
#include <CoreFoundation/CoreFoundation.h>
|
9
9
|
|
10
10
|
|
@@ -15,7 +15,7 @@ namespace Rays
|
|
15
15
|
void safe_cfrelease (CFTypeRef ref);
|
16
16
|
|
17
17
|
|
18
|
-
typedef
|
18
|
+
typedef std::shared_ptr<const __CFString> CFString;
|
19
19
|
|
20
20
|
CFString cfstring (const char* str);
|
21
21
|
|
data/src/ios/opengl.mm
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// -*- objc -*-
|
2
|
-
#include "
|
2
|
+
#include "../opengl.h"
|
3
3
|
|
4
4
|
|
5
5
|
#include <vector>
|
@@ -11,10 +11,25 @@ namespace Rays
|
|
11
11
|
|
12
12
|
|
13
13
|
void
|
14
|
-
|
14
|
+
OpenGL_set_context (Context context)
|
15
15
|
{
|
16
|
-
EAGLContext
|
17
|
-
|
16
|
+
[EAGLContext setCurrentContext: (EAGLContext*) context];
|
17
|
+
}
|
18
|
+
|
19
|
+
Context
|
20
|
+
OpenGL_get_context ()
|
21
|
+
{
|
22
|
+
return [EAGLContext currentContext];
|
23
|
+
}
|
24
|
+
|
25
|
+
|
26
|
+
Context
|
27
|
+
get_offscreen_context ()
|
28
|
+
{
|
29
|
+
static Context context = NULL;
|
30
|
+
if (!context)
|
31
|
+
context = [[EAGLContext alloc] initWithAPI: kEAGLRenderingAPIOpenGLES3];
|
32
|
+
return context;
|
18
33
|
}
|
19
34
|
|
20
35
|
|
data/src/ios/rays.mm
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
#import <Foundation/Foundation.h>
|
6
6
|
#include "rays/exception.h"
|
7
|
+
#include "../opengl.h"
|
7
8
|
|
8
9
|
|
9
10
|
namespace Rays
|
@@ -27,6 +28,8 @@ namespace Rays
|
|
27
28
|
rays_error(__FILE__, __LINE__, "Rays::init(): already initialized.");
|
28
29
|
|
29
30
|
global::pool = [[NSAutoreleasePool alloc] init];
|
31
|
+
|
32
|
+
OpenGL_set_context(get_offscreen_context());
|
30
33
|
}
|
31
34
|
|
32
35
|
void
|
data/src/matrix.cpp
CHANGED
@@ -1,25 +1,33 @@
|
|
1
|
-
#include "
|
1
|
+
#include "matrix.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include <glm/mat4x4.hpp>
|
5
|
+
#include <glm/gtc/matrix_transform.hpp>
|
6
|
+
#include "xot/util.h"
|
7
|
+
#include "rays/exception.h"
|
8
|
+
#include "rays/point.h"
|
9
|
+
#include "coord.h"
|
2
10
|
|
3
11
|
|
4
12
|
namespace Rays
|
5
13
|
{
|
6
14
|
|
7
15
|
|
8
|
-
Matrix::Matrix (
|
16
|
+
Matrix::Matrix (coord value)
|
9
17
|
{
|
10
18
|
reset(value);
|
11
19
|
}
|
12
20
|
|
13
21
|
Matrix::Matrix (
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
22
|
+
coord x0, coord x1, coord x2, coord x3,
|
23
|
+
coord y0, coord y1, coord y2, coord y3,
|
24
|
+
coord z0, coord z1, coord z2, coord z3,
|
25
|
+
coord w0, coord w1, coord w2, coord w3)
|
18
26
|
{
|
19
|
-
reset(
|
27
|
+
reset(x0, x1, x2, x3, y0, y1, y2, y3, z0, z1, z2, z3, w0, w1, w2, w3);
|
20
28
|
}
|
21
29
|
|
22
|
-
Matrix::Matrix (const
|
30
|
+
Matrix::Matrix (const coord* elements, size_t size)
|
23
31
|
{
|
24
32
|
reset(elements, size);
|
25
33
|
}
|
@@ -31,7 +39,7 @@ namespace Rays
|
|
31
39
|
}
|
32
40
|
|
33
41
|
Matrix&
|
34
|
-
Matrix::reset (
|
42
|
+
Matrix::reset (coord value)
|
35
43
|
{
|
36
44
|
return reset(
|
37
45
|
value, 0, 0, 0,
|
@@ -42,50 +50,127 @@ namespace Rays
|
|
42
50
|
|
43
51
|
Matrix&
|
44
52
|
Matrix::reset (
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
{
|
50
|
-
this->
|
51
|
-
this->
|
52
|
-
this->
|
53
|
-
this->
|
53
|
+
coord x0, coord x1, coord x2, coord x3,
|
54
|
+
coord y0, coord y1, coord y2, coord y3,
|
55
|
+
coord z0, coord z1, coord z2, coord z3,
|
56
|
+
coord w0, coord w1, coord w2, coord w3)
|
57
|
+
{
|
58
|
+
this->x0 = x0; this->x1 = x1; this->x2 = x2; this->x3 = x3;
|
59
|
+
this->y0 = y0; this->y1 = y1; this->y2 = y2; this->y3 = y3;
|
60
|
+
this->z0 = z0; this->z1 = z1; this->z2 = z2; this->z3 = z3;
|
61
|
+
this->w0 = w0; this->w1 = w1; this->w2 = w2; this->w3 = w3;
|
62
|
+
return *this;
|
63
|
+
}
|
64
|
+
|
65
|
+
Matrix&
|
66
|
+
Matrix::reset (const coord* elements, size_t size)
|
67
|
+
{
|
68
|
+
if (size != 16)
|
69
|
+
argument_error(__FILE__, __LINE__);
|
70
|
+
|
71
|
+
const coord* e = elements;
|
72
|
+
x0 = e[ 0]; x1 = e[ 1]; x2 = e[ 2]; x3 = e[ 3];
|
73
|
+
y0 = e[ 4]; y1 = e[ 5]; y2 = e[ 6]; y3 = e[ 7];
|
74
|
+
z0 = e[ 8]; z1 = e[ 9]; z2 = e[10]; z3 = e[11];
|
75
|
+
w0 = e[12]; w1 = e[13]; w2 = e[14]; w3 = e[15];
|
76
|
+
return *this;
|
77
|
+
}
|
78
|
+
|
79
|
+
Matrix&
|
80
|
+
Matrix::translate (coord x, coord y, coord z)
|
81
|
+
{
|
82
|
+
to_glm(*this) = glm::translate(to_glm(*this), Vec3(x, y, z));
|
83
|
+
return *this;
|
84
|
+
}
|
85
|
+
|
86
|
+
Matrix&
|
87
|
+
Matrix::translate (const Coord3& translate)
|
88
|
+
{
|
89
|
+
to_glm(*this) = glm::translate(to_glm(*this), to_glm(translate));
|
90
|
+
return *this;
|
91
|
+
}
|
92
|
+
|
93
|
+
Matrix&
|
94
|
+
Matrix::scale (coord x, coord y, coord z)
|
95
|
+
{
|
96
|
+
to_glm(*this) = glm::scale(to_glm(*this), Vec3(x, y, z));
|
97
|
+
return *this;
|
98
|
+
}
|
99
|
+
|
100
|
+
Matrix&
|
101
|
+
Matrix::scale (const Coord3& scale)
|
102
|
+
{
|
103
|
+
to_glm(*this) = glm::scale(to_glm(*this), to_glm(scale));
|
104
|
+
return *this;
|
105
|
+
}
|
106
|
+
|
107
|
+
Matrix&
|
108
|
+
Matrix::rotate (float degree, coord x, coord y, coord z)
|
109
|
+
{
|
110
|
+
to_glm(*this) = glm::rotate(
|
111
|
+
to_glm(*this), (float) Xot::deg2rad(degree), Vec3(x, y, z));
|
54
112
|
return *this;
|
55
113
|
}
|
56
114
|
|
57
115
|
Matrix&
|
58
|
-
Matrix::
|
116
|
+
Matrix::rotate (float degree, const Coord3& axis)
|
59
117
|
{
|
60
|
-
|
61
|
-
|
62
|
-
for (int i = 0; i < 16; ++i) *e++ = *elements++;
|
118
|
+
to_glm(*this) = glm::rotate(
|
119
|
+
to_glm(*this), (float) Xot::deg2rad(degree), to_glm(axis));
|
63
120
|
return *this;
|
64
121
|
}
|
65
122
|
|
66
|
-
|
123
|
+
coord&
|
67
124
|
Matrix::at (int row, int column)
|
68
125
|
{
|
69
126
|
return array[column * 4 + row];
|
70
127
|
}
|
71
128
|
|
72
|
-
|
129
|
+
coord
|
73
130
|
Matrix::at (int row, int column) const
|
74
131
|
{
|
75
132
|
return const_cast<Matrix*>(this)->at(row, column);
|
76
133
|
}
|
77
134
|
|
78
|
-
|
135
|
+
String
|
136
|
+
Matrix::inspect () const
|
137
|
+
{
|
138
|
+
return Xot::stringf(
|
139
|
+
"%f %f %f %f, %f %f %f %f, %f %f %f %f, %f %f %f %f",
|
140
|
+
x0, x1, x2, x3, y0, y1, y2, y3, z0, z1, z2, z3, w0, w1, w2, w3);
|
141
|
+
}
|
142
|
+
|
143
|
+
coord&
|
79
144
|
Matrix::operator [] (int index)
|
80
145
|
{
|
81
146
|
return array[index];
|
82
147
|
}
|
83
148
|
|
84
|
-
|
149
|
+
coord
|
85
150
|
Matrix::operator [] (int index) const
|
86
151
|
{
|
87
152
|
return const_cast<Matrix*>(this)->operator[](index);
|
88
153
|
}
|
89
154
|
|
155
|
+
Matrix&
|
156
|
+
Matrix::operator *= (const Matrix& rhs)
|
157
|
+
{
|
158
|
+
to_glm(*this) *= to_glm(rhs);
|
159
|
+
return *this;
|
160
|
+
}
|
161
|
+
|
162
|
+
Point
|
163
|
+
Matrix::operator * (const Point& rhs) const
|
164
|
+
{
|
165
|
+
Vec4 v = to_glm(*this) * Vec4(rhs.x, rhs.y, rhs.z, 1);
|
166
|
+
return to_rays<Point>(Vec3(v));
|
167
|
+
}
|
168
|
+
|
169
|
+
Matrix
|
170
|
+
Matrix::operator * (const Matrix& rhs) const
|
171
|
+
{
|
172
|
+
return to_rays(to_glm(*this) * to_glm(rhs));
|
173
|
+
}
|
174
|
+
|
90
175
|
|
91
176
|
}// Rays
|