webglmusti 0.0.0
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.
- package/.gitattributes +2 -0
- package/idea_list.txt +13 -0
- package/index.html +17 -0
- package/package.json +20 -0
- package/public/apple.png +0 -0
- package/public/base.png +0 -0
- package/public/car.png +0 -0
- package/public/drop.png +0 -0
- package/public/font16-Sheet.png +0 -0
- package/public/font16-Sheet.txt +52 -0
- package/public/letters-Sheet.png +0 -0
- package/public/letters-Sheet.txt +27 -0
- package/public/letters_Sheet.png +0 -0
- package/public/letters_Sheet.txt +4 -0
- package/public/vite.svg +1 -0
- package/src/App/ResourceSim/car.ts +172 -0
- package/src/App/ResourceSim/grid.ts +993 -0
- package/src/App/ResourceSim/grid_app.ts +1326 -0
- package/src/App/ResourceSim/grid_test.test.ts +18 -0
- package/src/App/ResourceSim/node_graph.ts +293 -0
- package/src/App/ResourceSim/nodes.ts +151 -0
- package/src/App/ResourceSim/resource.ts +8 -0
- package/src/App/ResourceSim/texts.ts +6 -0
- package/src/App/card/card.test.ts +22 -0
- package/src/App/card/card.ts +763 -0
- package/src/App/puzzle_box/app.ts +10 -0
- package/src/App/puzzle_box/engine.ts +374 -0
- package/src/App/puzzle_box/renderer.ts +102 -0
- package/src/App/puzzle_box/test.test.ts +49 -0
- package/src/App/water/water.ts +206 -0
- package/src/Interface/button.ts +345 -0
- package/src/Interface/interface_element.ts +30 -0
- package/src/Interface/internal_window.ts +100 -0
- package/src/Interface/options.ts +332 -0
- package/src/Interface/text_input.ts +183 -0
- package/src/WebGL/Matrix/matrix.test.ts +30 -0
- package/src/WebGL/Matrix/matrix.ts +293 -0
- package/src/WebGL/Shaders/Fragment/Program/circle.ts +49 -0
- package/src/WebGL/Shaders/Fragment/Program/circle_only.ts +47 -0
- package/src/WebGL/Shaders/Fragment/Program/circle_outline.ts +54 -0
- package/src/WebGL/Shaders/Fragment/Program/colour.ts +39 -0
- package/src/WebGL/Shaders/Fragment/Program/colour_alpha.ts +37 -0
- package/src/WebGL/Shaders/Fragment/Program/line.ts +39 -0
- package/src/WebGL/Shaders/Fragment/Program/multi_colour_centre_circle_path.ts +69 -0
- package/src/WebGL/Shaders/Fragment/Program/multi_colour_path.ts +69 -0
- package/src/WebGL/Shaders/Fragment/Program/path_centre_circle.ts +69 -0
- package/src/WebGL/Shaders/Fragment/Program/rect_outline.ts +39 -0
- package/src/WebGL/Shaders/Fragment/Program/solid_path.ts +64 -0
- package/src/WebGL/Shaders/Fragment/Program/sprite_sheet.ts +54 -0
- package/src/WebGL/Shaders/Fragment/Program/sprite_sheet_colour.ts +62 -0
- package/src/WebGL/Shaders/Fragment/Program/texture.ts +34 -0
- package/src/WebGL/Shaders/Fragment/Source/circle.frag +19 -0
- package/src/WebGL/Shaders/Fragment/Source/circle_only.frag +15 -0
- package/src/WebGL/Shaders/Fragment/Source/circle_outline.frag +23 -0
- package/src/WebGL/Shaders/Fragment/Source/colour.frag +9 -0
- package/src/WebGL/Shaders/Fragment/Source/colour_alpha.frag +7 -0
- package/src/WebGL/Shaders/Fragment/Source/fragment.frag +5 -0
- package/src/WebGL/Shaders/Fragment/Source/fragment_source.ts +15 -0
- package/src/WebGL/Shaders/Fragment/Source/line.frag +12 -0
- package/src/WebGL/Shaders/Fragment/Source/multi_colour_centre_circle_path.frag +36 -0
- package/src/WebGL/Shaders/Fragment/Source/multi_colour_path.frag +34 -0
- package/src/WebGL/Shaders/Fragment/Source/path_centre_circle.frag +29 -0
- package/src/WebGL/Shaders/Fragment/Source/rect_outline.frag +20 -0
- package/src/WebGL/Shaders/Fragment/Source/solid_path.frag +24 -0
- package/src/WebGL/Shaders/Fragment/Source/sprite_sheet.frag +17 -0
- package/src/WebGL/Shaders/Fragment/Source/sprite_sheet_colour.frag +19 -0
- package/src/WebGL/Shaders/Fragment/Source/texture.frag +11 -0
- package/src/WebGL/Shaders/Fragment/fragment.ts +43 -0
- package/src/WebGL/Shaders/Fragment/fragment_old.ts +261 -0
- package/src/WebGL/Shaders/Vertex/Program/mvp2d.ts +41 -0
- package/src/WebGL/Shaders/Vertex/Program/transform2d.ts +39 -0
- package/src/WebGL/Shaders/Vertex/Source/mvp2d.vert +17 -0
- package/src/WebGL/Shaders/Vertex/Source/mvp_i_2d.vert +18 -0
- package/src/WebGL/Shaders/Vertex/Source/simple.vert +9 -0
- package/src/WebGL/Shaders/Vertex/Source/transform2d.vert +13 -0
- package/src/WebGL/Shaders/Vertex/Source/transform2d_rel.vert +16 -0
- package/src/WebGL/Shaders/Vertex/Source/translate2d.vert +7 -0
- package/src/WebGL/Shaders/Vertex/Source/vertex_source.ts +13 -0
- package/src/WebGL/Shaders/Vertex/vertex.ts +10 -0
- package/src/WebGL/Shaders/Vertex/vertex_old.ts +289 -0
- package/src/WebGL/Shaders/custom.ts +129 -0
- package/src/WebGL/Shaders/shader.ts +197 -0
- package/src/WebGL/Shapes/Line.ts +29 -0
- package/src/WebGL/Shapes/Shapes.ts +189 -0
- package/src/WebGL/Texture/texture.ts +214 -0
- package/src/WebGL/Util/file.ts +24 -0
- package/src/WebGL/app.ts +150 -0
- package/src/WebGL/colour.ts +71 -0
- package/src/WebGL/globals.ts +353 -0
- package/src/WebGL/index.ts +3 -0
- package/src/WebGL/mixin.ts +2 -0
- package/src/global.d.ts +13 -0
- package/src/index.ts +4 -0
- package/src/main.ts +139 -0
- package/src/utils/array.ts +154 -0
- package/src/utils/assert.ts +8 -0
- package/src/utils/file.ts +0 -0
- package/src/utils/mixin.ts +22 -0
- package/src/utils/numbers.ts +11 -0
- package/src/utils/utils.test.ts +23 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.json +25 -0
|
@@ -0,0 +1,763 @@
|
|
|
1
|
+
import WebGL from "../../WebGL/globals"
|
|
2
|
+
import * as App from "./../../WebGL/app"
|
|
3
|
+
import * as Shader from "../../WebGL/Shaders/custom"
|
|
4
|
+
import * as Texture from "../../WebGL/Texture/texture"
|
|
5
|
+
import * as Matrix from "../../WebGL/Matrix/matrix"
|
|
6
|
+
import * as Shapes from "../../WebGL/Shapes/Shapes"
|
|
7
|
+
import * as WebGLGlobals from "../../WebGL/globals"
|
|
8
|
+
import { colour } from "../../WebGL/Shaders/Fragment/Source/fragment_source"
|
|
9
|
+
import { DirectionUtil } from "../ResourceSim/grid"
|
|
10
|
+
import * as Grid from "../ResourceSim/grid";
|
|
11
|
+
|
|
12
|
+
type Int32 = number;
|
|
13
|
+
type Float = number;
|
|
14
|
+
|
|
15
|
+
type VoidFunction = () => void;
|
|
16
|
+
const EmptyFunction: VoidFunction = () => {};
|
|
17
|
+
|
|
18
|
+
const CardSuitEnum = {
|
|
19
|
+
Spade: 0,
|
|
20
|
+
Heart: 1,
|
|
21
|
+
Club: 2,
|
|
22
|
+
Diamond: 3
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
25
|
+
type CardSuit = (typeof CardSuitEnum)[keyof typeof CardSuitEnum];
|
|
26
|
+
|
|
27
|
+
const CardNumberEnum = {
|
|
28
|
+
Ace: 0,
|
|
29
|
+
King: 1,
|
|
30
|
+
Queen: 2,
|
|
31
|
+
Jack: 3,
|
|
32
|
+
Ten: 4,
|
|
33
|
+
Nine: 5,
|
|
34
|
+
Eight: 6,
|
|
35
|
+
Seven: 7,
|
|
36
|
+
Six: 8,
|
|
37
|
+
Five: 9,
|
|
38
|
+
Four: 10,
|
|
39
|
+
Three: 11,
|
|
40
|
+
Two: 12
|
|
41
|
+
} as const;
|
|
42
|
+
|
|
43
|
+
type CardNumber = (typeof CardNumberEnum)[keyof typeof CardNumberEnum];
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
const ButtonStateEnum = {
|
|
47
|
+
Off: 0,
|
|
48
|
+
Disabled: 1,
|
|
49
|
+
Hovered: 2,
|
|
50
|
+
Pressed: 3,
|
|
51
|
+
PressedHovered: 4,
|
|
52
|
+
Selected: 5,
|
|
53
|
+
} as const;
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
type ButtonState = (typeof ButtonStateEnum)[keyof typeof ButtonStateEnum];
|
|
58
|
+
|
|
59
|
+
class BasicButton{
|
|
60
|
+
x: Int32;
|
|
61
|
+
y: Int32;
|
|
62
|
+
text: string;
|
|
63
|
+
width: Int32;
|
|
64
|
+
height: Int32;
|
|
65
|
+
text_size: Int32;
|
|
66
|
+
|
|
67
|
+
state: ButtonState;
|
|
68
|
+
|
|
69
|
+
colours: Map<ButtonState, WebGLGlobals.Colour.ColourRGB>;
|
|
70
|
+
text_colour: WebGLGlobals.Colour.ColourRGB;
|
|
71
|
+
onHoveredOver: VoidFunction;
|
|
72
|
+
onHoveredOut: VoidFunction;
|
|
73
|
+
onPressed: VoidFunction;
|
|
74
|
+
onPressedOut: VoidFunction;
|
|
75
|
+
|
|
76
|
+
constructor(x: Int32, y: Int32, w: Int32, h: Int32){
|
|
77
|
+
this.text = "";
|
|
78
|
+
this.x = x;
|
|
79
|
+
this.y = y;
|
|
80
|
+
this.width = w;
|
|
81
|
+
this.height = h;
|
|
82
|
+
this.text_size = 13;
|
|
83
|
+
this.state = ButtonStateEnum.Off;
|
|
84
|
+
this.colours = new Map();
|
|
85
|
+
this.colours.set(ButtonStateEnum.Off, WebGLGlobals.Colour.ColourUtils.blue());
|
|
86
|
+
this.colours.set(ButtonStateEnum.Hovered, WebGLGlobals.Colour.ColourUtils.red());
|
|
87
|
+
this.colours.set(ButtonStateEnum.Pressed, WebGLGlobals.Colour.ColourUtils.green());
|
|
88
|
+
this.colours.set(ButtonStateEnum.PressedHovered, WebGLGlobals.Colour.ColourUtils.cyan());
|
|
89
|
+
this.text_colour = WebGLGlobals.Colour.ColourUtils.white();
|
|
90
|
+
this.onHoveredOver = EmptyFunction;
|
|
91
|
+
this.onHoveredOut = EmptyFunction;
|
|
92
|
+
this.onPressed = EmptyFunction;
|
|
93
|
+
this.onPressedOut = EmptyFunction;
|
|
94
|
+
}
|
|
95
|
+
private isInside(x: Int32, y: Int32): boolean{
|
|
96
|
+
const sx = x - this.x;
|
|
97
|
+
const sy = y - this.y;
|
|
98
|
+
return 0 < sx && sx < this.width && 0 < sy && sy < this.height;
|
|
99
|
+
}
|
|
100
|
+
mouseDown(){
|
|
101
|
+
if(this.state == ButtonStateEnum.Hovered){
|
|
102
|
+
this.state = ButtonStateEnum.PressedHovered;
|
|
103
|
+
this.onPressed();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
mouseUp(){
|
|
107
|
+
if(this.state === ButtonStateEnum.Pressed){
|
|
108
|
+
this.state = ButtonStateEnum.Off;
|
|
109
|
+
this.onPressedOut();
|
|
110
|
+
}else if(this.state === ButtonStateEnum.PressedHovered){
|
|
111
|
+
this.state = ButtonStateEnum.Hovered;
|
|
112
|
+
this.onPressedOut();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
updateMouse(point: Point){
|
|
116
|
+
if(this.isInside(point.x, point.y)){
|
|
117
|
+
if(this.state == ButtonStateEnum.Off){
|
|
118
|
+
this.state = ButtonStateEnum.Hovered;
|
|
119
|
+
}else if(this.state == ButtonStateEnum.Pressed){
|
|
120
|
+
this.state = ButtonStateEnum.PressedHovered;
|
|
121
|
+
}
|
|
122
|
+
this.onHoveredOver();
|
|
123
|
+
}else{
|
|
124
|
+
if(this.state === ButtonStateEnum.Hovered){
|
|
125
|
+
this.state = ButtonStateEnum.Off;
|
|
126
|
+
}else if(this.state === ButtonStateEnum.PressedHovered){
|
|
127
|
+
this.state = ButtonStateEnum.Pressed;
|
|
128
|
+
}
|
|
129
|
+
this.onHoveredOut();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
draw(vp: Matrix.TransformationMatrix3x3, colour_shader: Shader.MVPColourProgram, text_drawer: WebGLGlobals.TextDrawer){
|
|
133
|
+
colour_shader.use();
|
|
134
|
+
const transformation = WebGLGlobals.WebGL.rectangleModel(this.x, this.y, this.width, this.height);
|
|
135
|
+
colour_shader.setMvp(vp.multiplyCopy(transformation));
|
|
136
|
+
if(this.colours.has(this.state)){
|
|
137
|
+
colour_shader.setColourFromColourRGB(this.colours.get(this.state)!);
|
|
138
|
+
}
|
|
139
|
+
Shapes.Quad.draw();
|
|
140
|
+
|
|
141
|
+
if(this.text.length > 0){
|
|
142
|
+
const text_width = this.text_size*this.text.length;
|
|
143
|
+
const tx = this.x + (this.width/2) - (text_width/2);
|
|
144
|
+
const ty = this.y + (this.height/2) - (this.text_size/2);
|
|
145
|
+
text_drawer.drawTextColour(vp, tx, ty, this.text, this.text_size, this.text_colour);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
class ButtonSet{
|
|
151
|
+
buttons: BasicButton[];
|
|
152
|
+
constructor(){
|
|
153
|
+
this.buttons = [];
|
|
154
|
+
}
|
|
155
|
+
addButton(b: BasicButton){
|
|
156
|
+
this.buttons.push(b);
|
|
157
|
+
}
|
|
158
|
+
updateMouse(pt: Point){
|
|
159
|
+
for(const button of this.buttons){
|
|
160
|
+
button.updateMouse(pt);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
mouseDown(){
|
|
164
|
+
for(const button of this.buttons){
|
|
165
|
+
button.mouseDown();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
mouseUp(){
|
|
169
|
+
for(const button of this.buttons){
|
|
170
|
+
button.mouseUp();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
draw(vp: Matrix.TransformationMatrix3x3, colour_shader: Shader.MVPColourProgram, text_drawer: WebGLGlobals.TextDrawer){
|
|
174
|
+
for(const button of this.buttons){
|
|
175
|
+
button.draw(vp, colour_shader, text_drawer);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
export class List<T>{
|
|
182
|
+
head: ListItem<T> | undefined;
|
|
183
|
+
constructor(){
|
|
184
|
+
//this.head.
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export type ListItem<T> = {
|
|
189
|
+
item: T;
|
|
190
|
+
next?: ListItem<T>;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export class Deck{
|
|
194
|
+
cards: VirtualCard[];
|
|
195
|
+
constructor(){
|
|
196
|
+
this.cards = [];
|
|
197
|
+
}
|
|
198
|
+
static regularDeck(): Deck{
|
|
199
|
+
const deck = new Deck();
|
|
200
|
+
for(const n of Object.values(CardNumberEnum)){
|
|
201
|
+
for(const s of Object.values(CardSuitEnum)){
|
|
202
|
+
deck.addCard(s, n);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return deck;
|
|
206
|
+
}
|
|
207
|
+
addCard(suit: CardSuit, number: CardNumber){
|
|
208
|
+
this.cards.push(new VirtualCard(suit, number));
|
|
209
|
+
}
|
|
210
|
+
addRandomCard(){
|
|
211
|
+
const random_card = VirtualCard.randomCard();
|
|
212
|
+
this.cards.push(random_card);
|
|
213
|
+
}
|
|
214
|
+
private createList(){
|
|
215
|
+
let list: List<VirtualCard> = {head: undefined};
|
|
216
|
+
let last: ListItem<VirtualCard> | undefined = undefined;
|
|
217
|
+
for(const card of this.cards){
|
|
218
|
+
if(last == undefined){
|
|
219
|
+
last = {item: card, next: undefined};
|
|
220
|
+
list = {head: last};
|
|
221
|
+
}else{
|
|
222
|
+
last.next = {item: card, next: undefined};
|
|
223
|
+
last = last.next;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return list;
|
|
227
|
+
}
|
|
228
|
+
shuffle(){
|
|
229
|
+
const n_cards = this.cards.length;
|
|
230
|
+
const new_cards = Array.from({length: n_cards}, () => {
|
|
231
|
+
return new VirtualCard();
|
|
232
|
+
});
|
|
233
|
+
let n = 0;
|
|
234
|
+
for(let i = n_cards-1; i > 0; i--){
|
|
235
|
+
const j = Math.floor(Math.random()*(i+1));
|
|
236
|
+
//new_cards[n] = this.cards[j];
|
|
237
|
+
|
|
238
|
+
[this.cards[j], this.cards[i]] = [this.cards[i], this.cards[j]];
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
//this.cards = new_cards;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
class SimpleCardModel{
|
|
246
|
+
text_matrix: WebGLGlobals.Matrix.TransformationMatrix3x3;
|
|
247
|
+
card_matrix: WebGLGlobals.Matrix.TransformationMatrix3x3;
|
|
248
|
+
card_colour: WebGLGlobals.Colour.ColourRGB;
|
|
249
|
+
width: Int32;
|
|
250
|
+
height: Int32;
|
|
251
|
+
constructor(width: Int32, height: Int32, text_size: Int32=16){
|
|
252
|
+
this.text_matrix = WebGLGlobals.Matrix.TransformationMatrix3x3.translate(-text_size, -text_size/2);
|
|
253
|
+
this.text_matrix = this.text_matrix.multiplyCopy(WebGLGlobals.Matrix.TransformationMatrix3x3.scale(text_size, text_size));
|
|
254
|
+
|
|
255
|
+
this.card_colour = WebGLGlobals.Colour.ColourUtils.red();
|
|
256
|
+
|
|
257
|
+
this.card_matrix = WebGLGlobals.Matrix.TransformationMatrix3x3.scale(width, height);
|
|
258
|
+
this.width = width;
|
|
259
|
+
this.height = height;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
draw(card: VirtualCard, colour_shader: Shader.MVPColourProgram,
|
|
263
|
+
text_drawer: WebGLGlobals.TextDrawer,
|
|
264
|
+
vp: WebGLGlobals.Matrix.TransformationMatrix3x3,
|
|
265
|
+
model_matrix: WebGLGlobals.Matrix.TransformationMatrix3x3, bg_colour:WebGLGlobals.Colour.ColourRGB=this.card_colour)
|
|
266
|
+
{
|
|
267
|
+
colour_shader.use();
|
|
268
|
+
colour_shader.setColourFromColourRGB(bg_colour);
|
|
269
|
+
const card_model = model_matrix.multiplyCopy(this.card_matrix);
|
|
270
|
+
const card_matrix = vp.multiplyCopy(card_model);
|
|
271
|
+
colour_shader.setMvp(card_matrix);
|
|
272
|
+
Shapes.CenterQuad.drawRelative();
|
|
273
|
+
|
|
274
|
+
const text_model = model_matrix.multiplyCopy(this.text_matrix);
|
|
275
|
+
const text_matrix = vp.multiplyCopy(text_model);
|
|
276
|
+
text_drawer.drawTextModelColour(text_matrix, card.toString(), 1, WebGLGlobals.Colour.ColourUtils.yellow());
|
|
277
|
+
}
|
|
278
|
+
isInside(x: Float, y: Float): boolean{
|
|
279
|
+
const half_width = this.width*0.5;
|
|
280
|
+
const half_height = this.height*0.5;
|
|
281
|
+
return -half_width < x && x < half_width && -half_height < y && y < half_height;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
class VisualCard{
|
|
286
|
+
transformation_matrix: WebGLGlobals.Matrix.TransformationMatrix3x3;
|
|
287
|
+
card_model: SimpleCardModel;
|
|
288
|
+
card: VirtualCard;
|
|
289
|
+
colour: WebGLGlobals.Colour.ColourRGB;
|
|
290
|
+
constructor(model: SimpleCardModel, card: VirtualCard){
|
|
291
|
+
this.card_model = model;
|
|
292
|
+
this.transformation_matrix = WebGLGlobals.Matrix.TransformationMatrix3x3.identity();
|
|
293
|
+
this.card = card;
|
|
294
|
+
this.colour = WebGLGlobals.Colour.ColourUtils.blue();
|
|
295
|
+
}
|
|
296
|
+
translate(x: Int32, y: Int32){
|
|
297
|
+
this.transformation_matrix.translate(x, y);
|
|
298
|
+
}
|
|
299
|
+
checkMouse(mouse_point: WebGLGlobals.Matrix.Point2D){
|
|
300
|
+
const inverse = this.transformation_matrix.copy();
|
|
301
|
+
inverse.invert();
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
const pt = inverse.transformPoint(mouse_point);
|
|
306
|
+
if(this.card_model.isInside(pt.x, pt.y)){
|
|
307
|
+
this.colour = WebGLGlobals.Colour.ColourUtils.blue();
|
|
308
|
+
}else{
|
|
309
|
+
this.colour = WebGLGlobals.Colour.ColourUtils.red();
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export class VirtualCard{
|
|
315
|
+
suit: CardSuit;
|
|
316
|
+
number: CardNumber;
|
|
317
|
+
constructor(suit: CardSuit=CardSuitEnum.Spade, number: CardNumber=CardNumberEnum.Ace){
|
|
318
|
+
this.suit = suit;
|
|
319
|
+
this.number = number;
|
|
320
|
+
}
|
|
321
|
+
toString(): string{
|
|
322
|
+
return VirtualCard.toNumberChar(this.number)+VirtualCard.toSuitChar(this.suit);
|
|
323
|
+
}
|
|
324
|
+
static randomCard(): VirtualCard{
|
|
325
|
+
const card = new VirtualCard(VirtualCard.randomSuit(), VirtualCard.randomNumber());
|
|
326
|
+
return card;
|
|
327
|
+
}
|
|
328
|
+
static randomSuit(): CardSuit{
|
|
329
|
+
const r = Math.random();
|
|
330
|
+
const i = Math.floor(Object.keys(CardSuitEnum).length*r);
|
|
331
|
+
return i as CardSuit;
|
|
332
|
+
}
|
|
333
|
+
static randomNumber(): CardNumber{
|
|
334
|
+
const r = Math.random();
|
|
335
|
+
const i = Math.floor(Object.keys(CardNumberEnum).length*r);
|
|
336
|
+
return i as CardNumber;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
static toNumberChar(n: CardNumber): string{
|
|
340
|
+
switch(n){
|
|
341
|
+
case CardNumberEnum.Ace:
|
|
342
|
+
return "A";
|
|
343
|
+
case CardNumberEnum.King:
|
|
344
|
+
return "K";
|
|
345
|
+
case CardNumberEnum.Queen:
|
|
346
|
+
return "Q";
|
|
347
|
+
case CardNumberEnum.Jack:
|
|
348
|
+
return "J";
|
|
349
|
+
case CardNumberEnum.Ten:
|
|
350
|
+
return "10";
|
|
351
|
+
case CardNumberEnum.Nine:
|
|
352
|
+
return "9";
|
|
353
|
+
case CardNumberEnum.Eight:
|
|
354
|
+
return "8";
|
|
355
|
+
case CardNumberEnum.Seven:
|
|
356
|
+
return "7";
|
|
357
|
+
case CardNumberEnum.Six:
|
|
358
|
+
return "6";
|
|
359
|
+
case CardNumberEnum.Five:
|
|
360
|
+
return "5";
|
|
361
|
+
case CardNumberEnum.Four:
|
|
362
|
+
return "4";
|
|
363
|
+
case CardNumberEnum.Three:
|
|
364
|
+
return "3";
|
|
365
|
+
case CardNumberEnum.Two:
|
|
366
|
+
return "2";
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
static toNumberString(n: CardNumber): string{
|
|
371
|
+
switch(n){
|
|
372
|
+
case CardNumberEnum.Ace:
|
|
373
|
+
return "Ace";
|
|
374
|
+
case CardNumberEnum.King:
|
|
375
|
+
return "King";
|
|
376
|
+
case CardNumberEnum.Queen:
|
|
377
|
+
return "Queen";
|
|
378
|
+
case CardNumberEnum.Jack:
|
|
379
|
+
return "Jack";
|
|
380
|
+
case CardNumberEnum.Ten:
|
|
381
|
+
return "Ten";
|
|
382
|
+
case CardNumberEnum.Nine:
|
|
383
|
+
return "Nine";
|
|
384
|
+
case CardNumberEnum.Eight:
|
|
385
|
+
return "Eight";
|
|
386
|
+
case CardNumberEnum.Seven:
|
|
387
|
+
return "Seven";
|
|
388
|
+
case CardNumberEnum.Six:
|
|
389
|
+
return "Six";
|
|
390
|
+
case CardNumberEnum.Five:
|
|
391
|
+
return "Five";
|
|
392
|
+
case CardNumberEnum.Four:
|
|
393
|
+
return "Four";
|
|
394
|
+
case CardNumberEnum.Three:
|
|
395
|
+
return "Three";
|
|
396
|
+
case CardNumberEnum.Two:
|
|
397
|
+
return "Two";
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
static toSuitString(s: CardSuit): string{
|
|
402
|
+
switch(s){
|
|
403
|
+
case CardSuitEnum.Spade:
|
|
404
|
+
return "Spade";
|
|
405
|
+
case CardSuitEnum.Heart:
|
|
406
|
+
return "Heart";
|
|
407
|
+
case CardSuitEnum.Club:
|
|
408
|
+
return "Club";
|
|
409
|
+
case CardSuitEnum.Diamond:
|
|
410
|
+
return "Diamond";
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
static toSuitChar(s: CardSuit): string{
|
|
415
|
+
switch(s){
|
|
416
|
+
case CardSuitEnum.Spade:
|
|
417
|
+
return "S";
|
|
418
|
+
case CardSuitEnum.Heart:
|
|
419
|
+
return "H";
|
|
420
|
+
case CardSuitEnum.Club:
|
|
421
|
+
return "C";
|
|
422
|
+
case CardSuitEnum.Diamond:
|
|
423
|
+
return "D";
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
interface Point{
|
|
429
|
+
x: Int32;
|
|
430
|
+
y: Int32;
|
|
431
|
+
equals:(p:Point) => boolean;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
export class CardEngine extends App.BaseEngine{
|
|
435
|
+
cards: VirtualCard[];
|
|
436
|
+
base_card_model: SimpleCardModel;
|
|
437
|
+
vis_card: VisualCard;
|
|
438
|
+
|
|
439
|
+
deck: Deck;
|
|
440
|
+
deck_visuals: VisualCard[];
|
|
441
|
+
|
|
442
|
+
card_model: WebGLGlobals.Matrix.TransformationMatrix3x3;
|
|
443
|
+
button1: BasicButton;
|
|
444
|
+
button2: BasicButton;
|
|
445
|
+
button3: BasicButton;
|
|
446
|
+
|
|
447
|
+
buttons: ButtonSet;
|
|
448
|
+
|
|
449
|
+
mouse_point: Point;
|
|
450
|
+
updated_mouse: boolean;
|
|
451
|
+
|
|
452
|
+
rotation: Float;
|
|
453
|
+
turn_speed: Float;
|
|
454
|
+
turn_target: Grid.GridDirection;
|
|
455
|
+
|
|
456
|
+
vp: Matrix.TransformationMatrix3x3;
|
|
457
|
+
|
|
458
|
+
constructor(w: Int32, h: Int32){
|
|
459
|
+
super();
|
|
460
|
+
this.cards = [new VirtualCard()];
|
|
461
|
+
this.base_card_model = new SimpleCardModel(50, 80);
|
|
462
|
+
this.vis_card = new VisualCard(this.base_card_model, new VirtualCard());
|
|
463
|
+
this.vis_card.translate(300, 300);
|
|
464
|
+
//this.vis_card.transformation_matrix.rotate(DirectionUtil.turnDirectionToRadians(Grid.DirectionEnum.Right));
|
|
465
|
+
this.card_model = Matrix.TransformationMatrix3x3.translate(300, 300);
|
|
466
|
+
this.deck = new Deck();
|
|
467
|
+
this.button1 = new BasicButton(20, 20, 100, 50);
|
|
468
|
+
this.button1.text = "Add";
|
|
469
|
+
this.button1.onPressed = () => {
|
|
470
|
+
//this.deck.addRandomCard();
|
|
471
|
+
this.deck = Deck.regularDeck();
|
|
472
|
+
console.log(this.deck.cards);
|
|
473
|
+
this.turn_target = Grid.DirectionEnum.Left;
|
|
474
|
+
console.log(this.rotation);
|
|
475
|
+
//console.log(VirtualCard.toSuitString(VirtualCard.randomSuit()));
|
|
476
|
+
//console.log(VirtualCard.toNumberString(VirtualCard.randomNumber()));
|
|
477
|
+
};
|
|
478
|
+
this.button2 = new BasicButton(140, 20, 100, 50);
|
|
479
|
+
this.button2.text = "Shuffle";
|
|
480
|
+
this.button2.onPressed = () => {
|
|
481
|
+
this.deck.shuffle();
|
|
482
|
+
console.log(this.deck.cards);
|
|
483
|
+
this.turn_target = Grid.DirectionEnum.Up;
|
|
484
|
+
console.log(this.rotation);
|
|
485
|
+
};
|
|
486
|
+
this.button3 = new BasicButton(260, 20, 100, 50);
|
|
487
|
+
this.button3.text = "Update";
|
|
488
|
+
this.button3.onPressed = () => {
|
|
489
|
+
this.createDeckVisuals();
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
this.buttons = new ButtonSet();
|
|
493
|
+
const left = new BasicButton(20, 80, 80, 40);
|
|
494
|
+
left.text = "left";
|
|
495
|
+
left.onPressed = () => {
|
|
496
|
+
this.turn_target = Grid.DirectionEnum.Left;
|
|
497
|
+
}
|
|
498
|
+
this.buttons.addButton(left);
|
|
499
|
+
|
|
500
|
+
const down = new BasicButton(120, 80, 80, 40);
|
|
501
|
+
down.text = "down";
|
|
502
|
+
down.onPressed = () => {
|
|
503
|
+
this.turn_target = Grid.DirectionEnum.Down;
|
|
504
|
+
}
|
|
505
|
+
this.buttons.addButton(down);
|
|
506
|
+
|
|
507
|
+
const right = new BasicButton(220, 80, 80, 40);
|
|
508
|
+
right.text = "right";
|
|
509
|
+
right.onPressed = () => {
|
|
510
|
+
this.turn_target = Grid.DirectionEnum.Right;
|
|
511
|
+
}
|
|
512
|
+
this.buttons.addButton(right);
|
|
513
|
+
|
|
514
|
+
const up = new BasicButton(320, 80, 80, 40);
|
|
515
|
+
up.text = "up";
|
|
516
|
+
up.onPressed = () => {
|
|
517
|
+
this.turn_target = Grid.DirectionEnum.Up;
|
|
518
|
+
}
|
|
519
|
+
this.buttons.addButton(up);
|
|
520
|
+
|
|
521
|
+
this.mouse_point = new Matrix.Point2D();
|
|
522
|
+
this.updated_mouse = false;
|
|
523
|
+
this.deck_visuals = [];
|
|
524
|
+
|
|
525
|
+
this.rotation = 0;
|
|
526
|
+
this.turn_speed = 0.05;
|
|
527
|
+
this.turn_target = Grid.DirectionEnum.Up;
|
|
528
|
+
|
|
529
|
+
this.vp = Matrix.TransformationMatrix3x3.orthographic(0, w, h, 0);
|
|
530
|
+
//this.card_model
|
|
531
|
+
//this.card_model = this.card_model.multiplyCopy(Matrix.TransformationMatrix3x3.scale(2, 2));
|
|
532
|
+
}
|
|
533
|
+
resize(w: Int32, h:Int32){
|
|
534
|
+
console.log("resizing engine");
|
|
535
|
+
//this.vp = Matrix.TransformationMatrix3x3.orthographic(0, w, h, 0);
|
|
536
|
+
console.log(this.vp);
|
|
537
|
+
}
|
|
538
|
+
update(t: Float){
|
|
539
|
+
this.updateTurn();
|
|
540
|
+
}
|
|
541
|
+
updateTurn(){
|
|
542
|
+
const turn_dir = Grid.DirectionUtil.getTurnDirection(this.turn_target, this.rotation);
|
|
543
|
+
//console.log(this.turn_target);
|
|
544
|
+
//console.log(this.rotation);
|
|
545
|
+
let target_radians = DirectionUtil.turnDirectionToRadians(this.turn_target);
|
|
546
|
+
if(turn_dir === Grid.TurnDirectionEnum.Straight){
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
if(turn_dir === Grid.TurnDirectionEnum.AntiClockwise){
|
|
550
|
+
if(this.rotation - this.turn_speed < target_radians && this.rotation > target_radians){
|
|
551
|
+
this.vis_card.transformation_matrix.rotate(target_radians - this.rotation);
|
|
552
|
+
this.rotation = target_radians;
|
|
553
|
+
console.log("end anti");
|
|
554
|
+
}else{
|
|
555
|
+
this.vis_card.transformation_matrix.rotate(-this.turn_speed);
|
|
556
|
+
this.rotation -= this.turn_speed;
|
|
557
|
+
}
|
|
558
|
+
}else{
|
|
559
|
+
//target_radians += Math.PI*2;
|
|
560
|
+
if(this.rotation + this.turn_speed > target_radians && this.rotation < target_radians){
|
|
561
|
+
this.vis_card.transformation_matrix.rotate(target_radians - this.rotation);
|
|
562
|
+
this.rotation = target_radians;
|
|
563
|
+
console.log("end clock");
|
|
564
|
+
}else{
|
|
565
|
+
this.vis_card.transformation_matrix.rotate(this.turn_speed);
|
|
566
|
+
this.rotation += this.turn_speed;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
this.rotation %= (Math.PI*2);
|
|
570
|
+
if(this.rotation < 0){
|
|
571
|
+
this.rotation += Math.PI*2;
|
|
572
|
+
}
|
|
573
|
+
//console.log(this.rotation);
|
|
574
|
+
}
|
|
575
|
+
step(){
|
|
576
|
+
this.vis_card.transformation_matrix.rotate(0.02);
|
|
577
|
+
}
|
|
578
|
+
protected override handleMouseDown(ev: MouseEvent): void {
|
|
579
|
+
this.button1.mouseDown();
|
|
580
|
+
this.button2.mouseDown();
|
|
581
|
+
this.button3.mouseDown();
|
|
582
|
+
this.buttons.mouseDown();
|
|
583
|
+
}
|
|
584
|
+
protected override handleMouseUp(ev: MouseEvent): void{
|
|
585
|
+
this.button1.mouseUp();
|
|
586
|
+
this.button2.mouseUp();
|
|
587
|
+
this.button3.mouseUp();
|
|
588
|
+
this.buttons.mouseUp();
|
|
589
|
+
}
|
|
590
|
+
protected override handleMouseMove(ev: MouseEvent): void {
|
|
591
|
+
const mouse_point = new Matrix.Point2D(ev.offsetX, ev.offsetY);
|
|
592
|
+
if(!this.mouse_point.equals(mouse_point)){
|
|
593
|
+
this.updated_mouse = true;
|
|
594
|
+
this.button1.updateMouse(mouse_point);
|
|
595
|
+
this.button2.updateMouse(mouse_point);
|
|
596
|
+
this.button3.updateMouse(mouse_point);
|
|
597
|
+
this.buttons.updateMouse(mouse_point);
|
|
598
|
+
|
|
599
|
+
this.updateMouse(mouse_point);
|
|
600
|
+
}
|
|
601
|
+
this.mouse_point = mouse_point;
|
|
602
|
+
|
|
603
|
+
const inverse = this.vp.copy();
|
|
604
|
+
//inverse.invert();
|
|
605
|
+
const pt = inverse.transformPoint(this.mouse_point);
|
|
606
|
+
console.log(pt);
|
|
607
|
+
}
|
|
608
|
+
createDeckVisuals(){
|
|
609
|
+
this.deck_visuals = [];
|
|
610
|
+
for(let i = 0; i < this.deck.cards.length; i++){
|
|
611
|
+
const vis = new VisualCard(this.base_card_model, this.deck.cards[i]);
|
|
612
|
+
vis.translate(100+(this.base_card_model.width+10)*i, 100);
|
|
613
|
+
this.deck_visuals.push(vis);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
updateMouse(mp: Matrix.Point2D){
|
|
617
|
+
this.vis_card.checkMouse(mp);
|
|
618
|
+
|
|
619
|
+
for(const card of this.deck_visuals){
|
|
620
|
+
card.checkMouse(mp);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
export class CardRenderer implements App.IEngineRenderer<CardEngine>{
|
|
626
|
+
solid_shader: Shader.MVPColourProgram;
|
|
627
|
+
sprite_sheet_shader: Shader.MVPSpriteSheetProgram;
|
|
628
|
+
texture_shader: Shader.MVPTextureProgram;
|
|
629
|
+
|
|
630
|
+
//font: Texture.CustomFont;
|
|
631
|
+
fonts: WebGLGlobals.FontLoader;
|
|
632
|
+
|
|
633
|
+
text_drawer: WebGLGlobals.TextDrawer;
|
|
634
|
+
|
|
635
|
+
width: Int32;
|
|
636
|
+
height: Int32;
|
|
637
|
+
vp: Matrix.TransformationMatrix3x3;
|
|
638
|
+
|
|
639
|
+
rotation: Float;
|
|
640
|
+
constructor(w: Int32, h: Int32){
|
|
641
|
+
this.solid_shader = new Shader.MVPColourProgram();
|
|
642
|
+
this.sprite_sheet_shader = new Shader.MVPSpriteSheetProgram();
|
|
643
|
+
this.texture_shader = new Shader.MVPTextureProgram();
|
|
644
|
+
|
|
645
|
+
this.width = w;
|
|
646
|
+
this.height = h;
|
|
647
|
+
|
|
648
|
+
/*
|
|
649
|
+
this.font = new Texture.CustomFont("letters-Sheet.png");
|
|
650
|
+
this.font.load();
|
|
651
|
+
this.font.active(0);*/
|
|
652
|
+
|
|
653
|
+
this.vp = Matrix.TransformationMatrix3x3.orthographic(0, this.width, this.height, 0);
|
|
654
|
+
this.fonts = new WebGLGlobals.FontLoader();
|
|
655
|
+
this.text_drawer = new WebGLGlobals.TextDrawer();
|
|
656
|
+
this.rotation = 0;
|
|
657
|
+
}
|
|
658
|
+
testProj(p: Matrix.Point2D){
|
|
659
|
+
|
|
660
|
+
}
|
|
661
|
+
resize(w: Int32, h: Int32){
|
|
662
|
+
//console.log("sizing")
|
|
663
|
+
//console.log(`${w} ${h}`);
|
|
664
|
+
this.vp = Matrix.TransformationMatrix3x3.orthographic(0, w, h, 0);
|
|
665
|
+
}
|
|
666
|
+
loadTextures(onLoad: VoidFunction=EmptyFunction){
|
|
667
|
+
console.log("loading textures");
|
|
668
|
+
const font_name = "letters-Sheet.png";
|
|
669
|
+
const not_font = "asdf";
|
|
670
|
+
this.fonts.addFont(font_name);
|
|
671
|
+
this.fonts.addFont(not_font);
|
|
672
|
+
this.fonts.loadFonts(() => {
|
|
673
|
+
this.text_drawer.setFont(this.fonts.getFont(font_name)!);
|
|
674
|
+
this.text_drawer.loadFont();
|
|
675
|
+
console.log("finished loading");
|
|
676
|
+
if(onLoad) onLoad();
|
|
677
|
+
});
|
|
678
|
+
//this.text_drawer.loadFont();
|
|
679
|
+
}
|
|
680
|
+
loadResources(onLoad:VoidFunction=EmptyFunction){
|
|
681
|
+
onLoad();
|
|
682
|
+
//this.loader.load(onLoad);
|
|
683
|
+
//this.text_drawer.loadFont();
|
|
684
|
+
}
|
|
685
|
+
drawCard(card: VirtualCard, x: Int32, y: Int32){
|
|
686
|
+
const sc = Matrix.TransformationMatrix3x3.scale(50, 90);
|
|
687
|
+
|
|
688
|
+
const tr = Matrix.TransformationMatrix3x3.translate(x, y);
|
|
689
|
+
let m = Matrix.TransformationMatrix3x3.identity();
|
|
690
|
+
m.multiply(tr);
|
|
691
|
+
m.multiply(sc);
|
|
692
|
+
this.solid_shader.use();
|
|
693
|
+
this.solid_shader.setColour(0.2, 0.8, 1.0);
|
|
694
|
+
this.solid_shader.setMvp(this.vp.multiplyCopy(m));
|
|
695
|
+
Shapes.CenterQuad.drawRelative();
|
|
696
|
+
|
|
697
|
+
const cs = card.toString();
|
|
698
|
+
//const trs = Matrix.TransformationMatrix3x3.translate(x+25, y+45);
|
|
699
|
+
const fs = 15;
|
|
700
|
+
this.text_drawer.drawText(this.vp, x-fs, y-(fs/2), cs, fs);
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
}
|
|
704
|
+
render(engine: CardEngine){
|
|
705
|
+
this.solid_shader.use();
|
|
706
|
+
const model = WebGL.rectangleModel(200, 200, 80, 120);
|
|
707
|
+
this.solid_shader.setMvp(this.vp.multiplyCopy(model));
|
|
708
|
+
this.solid_shader.setColour(0.8, 0.5, 0.75);
|
|
709
|
+
Shapes.Quad.drawRelative();
|
|
710
|
+
|
|
711
|
+
//engine.step();
|
|
712
|
+
this.rotation += 0.01;
|
|
713
|
+
//console.log("rendering card engine");
|
|
714
|
+
this.text_drawer.drawText(this.vp, 0, 0, "hi there", 15);
|
|
715
|
+
//const c1 = engine.cards[0];
|
|
716
|
+
/*
|
|
717
|
+
this.solid_shader.use();
|
|
718
|
+
const model = WebGL.rectangleModel(100, 100, 80, 120);
|
|
719
|
+
this.solid_shader.setMvp(this.vp.multiplyCopy(model));
|
|
720
|
+
this.solid_shader.setColour(0.25, 0.5, 0.75);
|
|
721
|
+
Shapes.Quad.drawRelative();*/
|
|
722
|
+
//console.log(this.vp);
|
|
723
|
+
this.text_drawer.drawText(this.vp, 50, 50, "hi there", 15);
|
|
724
|
+
|
|
725
|
+
/*
|
|
726
|
+
this.solid_shader.use();
|
|
727
|
+
|
|
728
|
+
const cm = new SimpleCardModel(60, 100);
|
|
729
|
+
let c_mat = Matrix.TransformationMatrix3x3.translate(150, 100);
|
|
730
|
+
const tr2 = Matrix.TransformationMatrix3x3.translate(0, 120);
|
|
731
|
+
for(let rp = 0; rp >= -0.8; rp-=0.2){
|
|
732
|
+
const rot = Matrix.TransformationMatrix3x3.rotate(this.rotation+rp);
|
|
733
|
+
let m = Matrix.TransformationMatrix3x3.identity();
|
|
734
|
+
//m.multiply(Matrix.TransformationMatrix3x3.rotate(Math.PI));
|
|
735
|
+
//m.multiply(Matrix.TransformationMatrix3x3.rotate(Math.PI/2));
|
|
736
|
+
m.multiply(c_mat);
|
|
737
|
+
//m.multiply(Matrix.TransformationMatrix3x3.rotate(Math.PI/2));
|
|
738
|
+
m.multiply(rot);
|
|
739
|
+
m.multiply(tr2);
|
|
740
|
+
m.multiply(Matrix.TransformationMatrix3x3.rotate(Math.PI));
|
|
741
|
+
cm.draw(new VirtualCard(), this.solid_shader, this.text_drawer, this.vp, m);
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
const mx = engine.card_model;
|
|
745
|
+
//cm.draw(new VirtualCard(), this.solid_shader, this.text_drawer, this.vp, mx);
|
|
746
|
+
*/
|
|
747
|
+
|
|
748
|
+
for(const v of engine.deck_visuals){
|
|
749
|
+
engine.base_card_model.draw(v.card, this.solid_shader, this.text_drawer, this.vp, v.transformation_matrix, v.colour);
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
engine.button1.draw(this.vp, this.solid_shader, this.text_drawer);
|
|
753
|
+
engine.button2.draw(this.vp, this.solid_shader, this.text_drawer);
|
|
754
|
+
engine.button3.draw(this.vp, this.solid_shader, this.text_drawer);
|
|
755
|
+
engine.buttons.draw(this.vp, this.solid_shader, this.text_drawer);
|
|
756
|
+
|
|
757
|
+
this.solid_shader.use();
|
|
758
|
+
engine.base_card_model.draw(new VirtualCard(), this.solid_shader, this.text_drawer, this.vp, engine.vis_card.transformation_matrix, engine.vis_card.colour);
|
|
759
|
+
|
|
760
|
+
//requestAnimationFrame((t) => this.render(engine));
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
}
|