Graphics library for Mercury, including OpenGL bindings, TGA image reading, and X11, Win32, and SDL2 windowing and input.
Revisão | a62e13ca4f52ee7d43590a3833de166a9413a833 (tree) |
---|---|
Hora | 2023-06-27 04:11:09 |
Autor | AlaskanEmily <emily@alas...> |
Commiter | AlaskanEmily |
Add color-buffer masked draw typeclasses. I thought we already had this?
@@ -12,6 +12,7 @@ | ||
12 | 12 | |
13 | 13 | :- use_module array. |
14 | 14 | :- import_module list. |
15 | +:- import_module pair. | |
15 | 16 | :- use_module thread. |
16 | 17 | :- use_module thread.mvar. |
17 | 18 |
@@ -118,6 +119,21 @@ | ||
118 | 119 | |
119 | 120 | %-----------------------------------------------------------------------------% |
120 | 121 | |
122 | +:- typeclass draw(Ctx, Group, Buffer) | |
123 | + <= (draw(Ctx, Group), color_buffer(Ctx, Buffer), (Ctx -> Buffer)) where [ | |
124 | + | |
125 | + pred draw_color_mask(Ctx, Group, list.list(Buffer), io.io, io.io), | |
126 | + mode draw_color_mask(in, in, in, di, uo) is det | |
127 | +]. | |
128 | + | |
129 | +%-----------------------------------------------------------------------------% | |
130 | + | |
131 | +:- pred draw_color_mask(Ctx, pair(Group, list.list(Buffer)), io.io, io.io) | |
132 | + <= draw(Ctx, Group, Buffer). | |
133 | +:- mode draw_color_mask(in, in, di, uo) is det. | |
134 | + | |
135 | +%-----------------------------------------------------------------------------% | |
136 | + | |
121 | 137 | :- pred raise_matrix_stack_error is erroneous. |
122 | 138 | |
123 | 139 | %-----------------------------------------------------------------------------% |
@@ -192,6 +208,13 @@ top_matrix(transform_state(_, [Matrix|_])) = Matrix. | ||
192 | 208 | ) ) |
193 | 209 | ]. |
194 | 210 | |
211 | +%-----------------------------------------------------------------------------% | |
212 | + | |
213 | +draw_color_mask(Ctx, (Group - Buffers), !IO) :- | |
214 | + draw_color_mask(Ctx, Group, Buffers, !IO). | |
215 | + | |
216 | +%-----------------------------------------------------------------------------% | |
217 | + | |
195 | 218 | raise_matrix_stack_error :- |
196 | 219 | exception.throw(exception.software_error( |
197 | 220 | "Tried to pop from an empty transform stack.")). |