• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-cqtcocoa誰得pythonphprubygameguibathyscaphec翻訳計画中(planning stage)omegatframeworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Graphics library for Mercury, including OpenGL bindings, TGA image reading, and X11, Win32, and SDL2 windowing and input.


コミットメタ情報

リビジョン7a859e0ff44c4e07263dd5422aeacebbd64b132a (tree)
日時2022-04-18 04:20:49
作者AlaskanEmily <emily@alas...>
コミッターAlaskanEmily

ログメッセージ

Update mmath

変更サマリ

差分

--- a/demo/saffron_cube_demo.m
+++ b/demo/saffron_cube_demo.m
@@ -38,10 +38,11 @@
3838 :- use_module maybe.
3939 :- use_module time.
4040
41-:- use_module matrix.
42-:- use_module vector.
43-:- import_module vector.vector3.
44-:- import_module vector.vector4.
41+:- use_module mmath.
42+:- use_module mmath.matrix.
43+:- use_module mmath.vector.
44+:- import_module mmath.vector.vector3.
45+:- import_module mmath.vector.vector4.
4546
4647 :- use_module saffron.
4748 :- use_module saffron.draw.
@@ -124,10 +125,10 @@ run(Ctx, Win, Group, !IO) :-
124125 SpinT = Seconds, % / 0.23,
125126 Angle = Seconds * 0.87,
126127 RotateVector =
127- vector.normalize(vector(math.sin(SpinT), 1.0, math.cos(SpinT))),
128+ mmath.vector.normalize(vector(math.sin(SpinT), 1.0, math.cos(SpinT))),
128129 % In general, you should always normalize vectors being used to build
129130 % transformation matrices.
130- Matrix = matrix.rotate(Angle, RotateVector),
131+ Matrix = mmath.matrix.rotate(Angle, RotateVector),
131132
132133 % Here we will push the ortho matrix set in main/2 and then transform
133134 % it by our rotation. Then, after drawing, we pop the transformed
@@ -290,10 +291,10 @@ main(!IO) :-
290291 % Set the ortho mode
291292 AR = float(W) / float(H),
292293
293- Matrix = matrix.ortho(-AR, AR, 1.0, -1.0, -1000.0, 1000.0),
294+ Matrix = mmath.matrix.ortho(-AR, AR, 1.0, -1.0, -1000.0, 1000.0),
294295 saffron.draw.set_matrix(Ctx, Matrix, !IO),
295296
296- saffron.draw.transform(Ctx, matrix.scale(0.4, 0.4, 0.4), !IO),
297+ saffron.draw.transform(Ctx, mmath.matrix.scale(0.4, 0.4, 0.4), !IO),
297298
298299 % Upload the image to create a texture.
299300 saffron.gl.create_texture_from_bitmap(Ctx, BMP, TexW, TexH, Texture, !IO),
--- a/mmath
+++ b/mmath
@@ -1 +1 @@
1-Subproject commit d803d6f195accd635e33c76a2ad3eb7e027cd016
1+Subproject commit 41d171250634ca20db35cab679afc6c030af30ae
--- a/saffron.draw.m
+++ b/saffron.draw.m
@@ -15,8 +15,9 @@
1515 :- use_module thread.
1616 :- use_module thread.mvar.
1717
18-:- use_module vector.
19-:- use_module matrix.
18+:- use_module mmath.
19+:- use_module mmath.vector.
20+:- use_module mmath.matrix.
2021
2122 %-----------------------------------------------------------------------------%
2223
@@ -33,7 +34,7 @@
3334 %-----------------------------------------------------------------------------%
3435
3536 :- typeclass basic_transform(Ctx) where [
36- pred set_matrix(Ctx::in, matrix.matrix::in, io.io::di, io.io::uo) is det
37+ pred set_matrix(Ctx::in, mmath.matrix.matrix::in, io.io::di, io.io::uo) is det
3738 ].
3839
3940 %-----------------------------------------------------------------------------%
@@ -41,7 +42,7 @@
4142 % It will often be handled fully in software, where only set_matrix is actually
4243 % used, but for GL2 we can just implement this with the GL2 calls.
4344 :- typeclass transform_stack(Ctx) where [
44- pred transform(Ctx::in, matrix.matrix::in, io.io::di, io.io::uo) is det,
45+ pred transform(Ctx::in, mmath.matrix.matrix::in, io.io::di, io.io::uo) is det,
4546 pred identity(Ctx::in, io.io::di, io.io::uo) is det,
4647 pred push_matrix(Ctx::in, io.io::di, io.io::uo) is det,
4748 % Should throw exception if the matrix stack is empty.
@@ -57,8 +58,8 @@
5758 % Use a type here just to make it structurally required that there is always
5859 % one matrix.
5960 :- type transform_state ---> transform_state(
60- matrix.matrix,
61- stack::list.list(matrix.matrix)).
61+ mmath.matrix.matrix,
62+ stack::list.list(mmath.matrix.matrix)).
6263
6364 %-----------------------------------------------------------------------------%
6465 % Used to implement transform wiht a stack of matrices and basic_transform.
@@ -68,11 +69,11 @@
6869
6970 %-----------------------------------------------------------------------------%
7071
71-:- func top_matrix(transform_state) = matrix.matrix.
72+:- func top_matrix(transform_state) = mmath.matrix.matrix.
7273
7374 %-----------------------------------------------------------------------------%
7475
75-:- func 'top_matrix :='(transform_state, matrix.matrix) = transform_state.
76+:- func 'top_matrix :='(transform_state, mmath.matrix.matrix) = transform_state.
7677
7778 %-----------------------------------------------------------------------------%
7879
@@ -146,13 +147,13 @@ top_matrix(transform_state(_, [Matrix|_])) = Matrix.
146147 (transform(Ctx, Matrix, !IO) :-
147148 MVar = Ctx ^ transform_state,
148149 thread.mvar.take(MVar, State, !IO),
149- NewMatrix = matrix.multiply(State ^ top_matrix, Matrix),
150+ NewMatrix = mmath.matrix.multiply(State ^ top_matrix, Matrix),
150151 thread.mvar.put(MVar, State ^ top_matrix := NewMatrix, !IO) ),
151152
152153 (identity(Ctx, !IO) :-
153154 MVar = Ctx ^ transform_state,
154155 thread.mvar.take(MVar, State, !IO),
155- thread.mvar.put(MVar, State ^ top_matrix := matrix.identity, !IO) ),
156+ thread.mvar.put(MVar, State ^ top_matrix := mmath.matrix.identity, !IO) ),
156157
157158 (push_matrix(Ctx, !IO) :-
158159 MVar = Ctx ^ transform_state,
--- a/saffron.geometry.m
+++ b/saffron.geometry.m
@@ -13,15 +13,16 @@
1313 :- use_module array.
1414 :- use_module list.
1515
16-:- use_module vector.
16+:- use_module mmath.
17+:- use_module mmath.vector.
1718
1819 :- use_module saffron.texture.
1920
2021 %-----------------------------------------------------------------------------%
2122
2223 :- type vertex(Vec) ---> vertex(vec::Vec, u::float, v::float).
23-:- type vertex2d == vertex(vector.vector2).
24-:- type vertex3d == vertex(vector.vector3).
24+:- type vertex2d == vertex(mmath.vector.vector2).
25+:- type vertex3d == vertex(mmath.vector.vector3).
2526
2627 %-----------------------------------------------------------------------------%
2728 % This is intended to be used as if it was a functor for vertex, to construct
@@ -187,8 +188,8 @@
187188 :- implementation.
188189 %=============================================================================%
189190
190-:- use_module vector.vector2.
191-:- use_module vector.vector3.
191+:- use_module mmath.vector.vector2.
192+:- use_module mmath.vector.vector3.
192193
193194 %-----------------------------------------------------------------------------%
194195
@@ -216,13 +217,13 @@
216217
217218 %-----------------------------------------------------------------------------%
218219
219-vertex(X, Y, U, V) = vertex(vector.vector2.vector(X, Y), U, V).
220-vertex(X, Y, U, V, vertex(vector.vector2.vector(X, Y), U, V)).
220+vertex(X, Y, U, V) = vertex(mmath.vector.vector2.vector(X, Y), U, V).
221+vertex(X, Y, U, V, vertex(mmath.vector.vector2.vector(X, Y), U, V)).
221222
222223 %-----------------------------------------------------------------------------%
223224
224-vertex(X, Y, Z, U, V) = vertex(vector.vector3.vector(X, Y, Z), U, V).
225-vertex(X, Y, Z, U, V, vertex(vector.vector3.vector(X, Y, Z), U, V)).
225+vertex(X, Y, Z, U, V) = vertex(mmath.vector.vector3.vector(X, Y, Z), U, V).
226+vertex(X, Y, Z, U, V, vertex(mmath.vector.vector3.vector(X, Y, Z), U, V)).
226227
227228 %-----------------------------------------------------------------------------%
228229
--- a/saffron.gl.buffer.m
+++ b/saffron.gl.buffer.m
@@ -102,9 +102,10 @@
102102 :- implementation.
103103 %=============================================================================%
104104
105-:- use_module vector.
106-:- use_module vector.vector2.
107-:- use_module vector.vector3.
105+:- use_module mmath.
106+:- use_module mmath.vector.
107+:- use_module mmath.vector.vector2.
108+:- use_module mmath.vector.vector3.
108109
109110 :- pragma foreign_import_module("C", saffron.gl).
110111 :- pragma foreign_import_module("C", saffron.geometry).
--- a/saffron.gl2.m
+++ b/saffron.gl2.m
@@ -15,7 +15,8 @@
1515 :- interface.
1616 %=============================================================================%
1717
18-:- use_module vector.
18+:- use_module mmath.
19+:- use_module mmath.vector.
1920
2021 :- use_module saffron.draw.
2122 :- use_module saffron.geometry.
@@ -79,14 +80,14 @@
7980 %-----------------------------------------------------------------------------%
8081
8182 :- type vertex(Vec) == saffron.geometry.vertex(Vec).
82-:- type vertex2d == vertex(vector.vector2).
83-:- type vertex3d == vertex(vector.vector3).
83+:- type vertex2d == vertex(mmath.vector.vector2).
84+:- type vertex3d == vertex(mmath.vector.vector3).
8485
8586 %-----------------------------------------------------------------------------%
8687
8788 :- type buffer(Vec) == saffron.soft.buffer(vertex(Vec)).
88-:- type buffer2d ---> buffer(buffer(vector.vector2)).
89-:- type buffer3d ---> buffer(buffer(vector.vector3)).
89+:- type buffer2d ---> buffer(buffer(mmath.vector.vector2)).
90+:- type buffer3d ---> buffer(buffer(mmath.vector.vector3)).
9091
9192 %-----------------------------------------------------------------------------%
9293
@@ -100,12 +101,12 @@
100101
101102 %-----------------------------------------------------------------------------%
102103
103-:- instance saffron.geometry.buffer(context(Ctx), buffer2d, vector.vector2)
104+:- instance saffron.geometry.buffer(context(Ctx), buffer2d, mmath.vector.vector2)
104105 <= saffron.gl.context(Ctx).
105106
106107 %-----------------------------------------------------------------------------%
107108
108-:- instance saffron.geometry.buffer(context(Ctx), buffer3d, vector.vector3)
109+:- instance saffron.geometry.buffer(context(Ctx), buffer3d, mmath.vector.vector3)
109110 <= saffron.gl.context(Ctx).
110111
111112 %-----------------------------------------------------------------------------%
@@ -125,8 +126,8 @@
125126 %-----------------------------------------------------------------------------%
126127
127128 :- type shape(Vec) == saffron.soft.shape(Vec, texture).
128-:- type shape2d ---> shape(shape(vector.vector2)).
129-:- type shape3d ---> shape(shape(vector.vector3)).
129+:- type shape2d ---> shape(shape(mmath.vector.vector2)).
130+:- type shape3d ---> shape(shape(mmath.vector.vector3)).
130131
131132 %-----------------------------------------------------------------------------%
132133
@@ -151,8 +152,8 @@
151152 %-----------------------------------------------------------------------------%
152153
153154 :- type group(Vec) == saffron.soft.group(Vec, texture).
154-:- type group2d ---> group(group(vector.vector2)).
155-:- type group3d ---> group(group(vector.vector3)).
155+:- type group2d ---> group(group(mmath.vector.vector2)).
156+:- type group3d ---> group(group(mmath.vector.vector3)).
156157
157158 %-----------------------------------------------------------------------------%
158159
@@ -197,9 +198,9 @@
197198 :- use_module array.
198199 :- use_module list.
199200
200-:- use_module matrix.
201-:- import_module vector.vector2.
202-:- import_module vector.vector3.
201+:- use_module mmath.matrix.
202+:- import_module mmath.vector.vector2.
203+:- import_module mmath.vector.vector3.
203204
204205 %-----------------------------------------------------------------------------%
205206
@@ -385,10 +386,10 @@ supports_extension(_, _) :- false.
385386
386387 %-----------------------------------------------------------------------------%
387388
388-:- pred transform(matrix.matrix::in, io.io::di, io.io::uo) is det.
389+:- pred transform(mmath.matrix.matrix::in, io.io::di, io.io::uo) is det.
389390
390391 transform(Matrix, !IO) :-
391- matrix.destructure_matrix(Matrix,
392+ mmath.matrix.destructure_matrix(Matrix,
392393 V0, V1, V2, V3,
393394 V4, V5, V6, V7,
394395 V8, V9, V10, V11,
@@ -443,7 +444,7 @@ transform(Matrix, !IO) :-
443444 <= saffron.gl.context(Ctx) where [
444445
445446 (saffron.draw.set_matrix(_, Matrix, !IO) :-
446- matrix.destructure_matrix(Matrix,
447+ mmath.matrix.destructure_matrix(Matrix,
447448 V0, V1, V2, V3,
448449 V4, V5, V6, V7,
449450 V8, V9, V10, V11,
@@ -506,7 +507,7 @@ transform(Matrix, !IO) :-
506507
507508 %-----------------------------------------------------------------------------%
508509
509-:- instance saffron.geometry.buffer(context(Ctx), buffer2d, vector.vector2)
510+:- instance saffron.geometry.buffer(context(Ctx), buffer2d, mmath.vector.vector2)
510511 <= saffron.gl.context(Ctx) where [
511512
512513 create_buffer_list(_, Vertices, buffer(array.from_list(Vertices)), !IO),
@@ -515,7 +516,7 @@ transform(Matrix, !IO) :-
515516
516517 %-----------------------------------------------------------------------------%
517518
518-:- instance saffron.geometry.buffer(context(Ctx), buffer3d, vector.vector3)
519+:- instance saffron.geometry.buffer(context(Ctx), buffer3d, mmath.vector.vector3)
519520 <= saffron.gl.context(Ctx) where [
520521
521522 create_buffer_list(_, Vertices, buffer(array.from_list(Vertices)), !IO),
@@ -600,12 +601,12 @@ transform(Matrix, !IO) :-
600601
601602 %-----------------------------------------------------------------------------%
602603
603-:- func get_shape2d(shape2d) = shape(vector.vector2).
604+:- func get_shape2d(shape2d) = shape(mmath.vector.vector2).
604605 get_shape2d(shape(Shape)) = Shape.
605606
606607 %-----------------------------------------------------------------------------%
607608
608-:- func get_shape3d(shape3d) = shape(vector.vector3).
609+:- func get_shape3d(shape3d) = shape(mmath.vector.vector3).
609610 get_shape3d(shape(Shape)) = Shape.
610611
611612 %-----------------------------------------------------------------------------%
@@ -746,7 +747,7 @@ draw_vertex3d(saffron.geometry.vertex(vector(X, Y, Z), U, V), C, !IO) :-
746747
747748 %-----------------------------------------------------------------------------%
748749
749-:- pred draw_shape2d(shape(vector.vector2)::in, io.io::di, io.io::uo) is det.
750+:- pred draw_shape2d(shape(mmath.vector.vector2)::in, io.io::di, io.io::uo) is det.
750751 draw_shape2d(Shape, !IO) :-
751752 saffron.gl.bind_texture(Shape ^ saffron.soft.texture, !IO),
752753 saffron.gl.primitive_type(Shape ^ saffron.soft.primitive_type, Type),
@@ -756,7 +757,7 @@ draw_shape2d(Shape, !IO) :-
756757
757758 %-----------------------------------------------------------------------------%
758759
759-:- pred draw_shape3d(shape(vector.vector3)::in, io.io::di, io.io::uo) is det.
760+:- pred draw_shape3d(shape(mmath.vector.vector3)::in, io.io::di, io.io::uo) is det.
760761 draw_shape3d(Shape, !IO) :-
761762 saffron.gl.bind_texture(Shape ^ saffron.soft.texture, !IO),
762763 saffron.gl.primitive_type(Shape ^ saffron.soft.primitive_type, Type),