basilisk-engine 0.2.6__cp311-cp311-win32.whl → 0.2.10__cp311-cp311-win32.whl
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.
- basilisk/basilisk/__init__.pyi +553 -0
- basilisk/basilisk/forces.pyi +90 -0
- basilisk/basilisk/key.pyi +277 -0
- basilisk/basilisk.cp311-win32.pyd +0 -0
- basilisk/basilisk.pyi +134 -1
- basilisk/shaders/include/blinn_phong.glsl +41 -0
- basilisk/shaders/include/light.glsl +72 -0
- basilisk/shaders/instance.frag +19 -8
- basilisk/shaders/instance.vert +2 -2
- basilisk/shaders/skybox.frag +10 -0
- basilisk/shaders/skybox.vert +14 -0
- basilisk/shaders/test.frag +8 -7
- basilisk/shaders/test.vert +2 -1
- {basilisk_engine-0.2.6.dist-info → basilisk_engine-0.2.10.dist-info}/METADATA +24 -2
- basilisk_engine-0.2.10.dist-info/RECORD +35 -0
- lib/glfw3.lib +0 -0
- lib/pkgconfig/glfw3.pc +3 -3
- basilisk_engine-0.2.6.dist-info/RECORD +0 -28
- {basilisk_engine-0.2.6.dist-info → basilisk_engine-0.2.10.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Keyboard key constants
|
|
3
|
+
"""
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
import typing
|
|
6
|
+
__all__: list[str] = ['K_0', 'K_1', 'K_2', 'K_3', 'K_4', 'K_5', 'K_6', 'K_7', 'K_8', 'K_9', 'K_A', 'K_B', 'K_BACKSPACE', 'K_C', 'K_CAPS_LOCK', 'K_D', 'K_E', 'K_ENTER', 'K_ESCAPE', 'K_F', 'K_F1', 'K_F10', 'K_F11', 'K_F12', 'K_F2', 'K_F3', 'K_F4', 'K_F5', 'K_F6', 'K_F7', 'K_F8', 'K_F9', 'K_G', 'K_H', 'K_I', 'K_J', 'K_K', 'K_L', 'K_LEFT_ALT', 'K_LEFT_CONTROL', 'K_LEFT_SHIFT', 'K_M', 'K_N', 'K_O', 'K_P', 'K_Q', 'K_R', 'K_RIGHT_ALT', 'K_RIGHT_CONTROL', 'K_RIGHT_SHIFT', 'K_S', 'K_SPACE', 'K_T', 'K_TAB', 'K_U', 'K_V', 'K_W', 'K_X', 'K_Y', 'K_Z', 'KeyCode']
|
|
7
|
+
class KeyCode:
|
|
8
|
+
"""
|
|
9
|
+
Members:
|
|
10
|
+
|
|
11
|
+
K_A
|
|
12
|
+
|
|
13
|
+
K_B
|
|
14
|
+
|
|
15
|
+
K_C
|
|
16
|
+
|
|
17
|
+
K_D
|
|
18
|
+
|
|
19
|
+
K_E
|
|
20
|
+
|
|
21
|
+
K_F
|
|
22
|
+
|
|
23
|
+
K_G
|
|
24
|
+
|
|
25
|
+
K_H
|
|
26
|
+
|
|
27
|
+
K_I
|
|
28
|
+
|
|
29
|
+
K_J
|
|
30
|
+
|
|
31
|
+
K_K
|
|
32
|
+
|
|
33
|
+
K_L
|
|
34
|
+
|
|
35
|
+
K_M
|
|
36
|
+
|
|
37
|
+
K_N
|
|
38
|
+
|
|
39
|
+
K_O
|
|
40
|
+
|
|
41
|
+
K_P
|
|
42
|
+
|
|
43
|
+
K_Q
|
|
44
|
+
|
|
45
|
+
K_R
|
|
46
|
+
|
|
47
|
+
K_S
|
|
48
|
+
|
|
49
|
+
K_T
|
|
50
|
+
|
|
51
|
+
K_U
|
|
52
|
+
|
|
53
|
+
K_V
|
|
54
|
+
|
|
55
|
+
K_W
|
|
56
|
+
|
|
57
|
+
K_X
|
|
58
|
+
|
|
59
|
+
K_Y
|
|
60
|
+
|
|
61
|
+
K_Z
|
|
62
|
+
|
|
63
|
+
K_0
|
|
64
|
+
|
|
65
|
+
K_1
|
|
66
|
+
|
|
67
|
+
K_2
|
|
68
|
+
|
|
69
|
+
K_3
|
|
70
|
+
|
|
71
|
+
K_4
|
|
72
|
+
|
|
73
|
+
K_5
|
|
74
|
+
|
|
75
|
+
K_6
|
|
76
|
+
|
|
77
|
+
K_7
|
|
78
|
+
|
|
79
|
+
K_8
|
|
80
|
+
|
|
81
|
+
K_9
|
|
82
|
+
|
|
83
|
+
K_F1
|
|
84
|
+
|
|
85
|
+
K_F2
|
|
86
|
+
|
|
87
|
+
K_F3
|
|
88
|
+
|
|
89
|
+
K_F4
|
|
90
|
+
|
|
91
|
+
K_F5
|
|
92
|
+
|
|
93
|
+
K_F6
|
|
94
|
+
|
|
95
|
+
K_F7
|
|
96
|
+
|
|
97
|
+
K_F8
|
|
98
|
+
|
|
99
|
+
K_F9
|
|
100
|
+
|
|
101
|
+
K_F10
|
|
102
|
+
|
|
103
|
+
K_F11
|
|
104
|
+
|
|
105
|
+
K_F12
|
|
106
|
+
|
|
107
|
+
K_BACKSPACE
|
|
108
|
+
|
|
109
|
+
K_TAB
|
|
110
|
+
|
|
111
|
+
K_ENTER
|
|
112
|
+
|
|
113
|
+
K_LEFT_SHIFT
|
|
114
|
+
|
|
115
|
+
K_RIGHT_SHIFT
|
|
116
|
+
|
|
117
|
+
K_LEFT_CONTROL
|
|
118
|
+
|
|
119
|
+
K_RIGHT_CONTROL
|
|
120
|
+
|
|
121
|
+
K_LEFT_ALT
|
|
122
|
+
|
|
123
|
+
K_RIGHT_ALT
|
|
124
|
+
|
|
125
|
+
K_CAPS_LOCK
|
|
126
|
+
|
|
127
|
+
K_ESCAPE
|
|
128
|
+
|
|
129
|
+
K_SPACE
|
|
130
|
+
"""
|
|
131
|
+
K_0: typing.ClassVar[KeyCode] # value = <KeyCode.K_0: 48>
|
|
132
|
+
K_1: typing.ClassVar[KeyCode] # value = <KeyCode.K_1: 49>
|
|
133
|
+
K_2: typing.ClassVar[KeyCode] # value = <KeyCode.K_2: 50>
|
|
134
|
+
K_3: typing.ClassVar[KeyCode] # value = <KeyCode.K_3: 51>
|
|
135
|
+
K_4: typing.ClassVar[KeyCode] # value = <KeyCode.K_4: 52>
|
|
136
|
+
K_5: typing.ClassVar[KeyCode] # value = <KeyCode.K_5: 53>
|
|
137
|
+
K_6: typing.ClassVar[KeyCode] # value = <KeyCode.K_6: 54>
|
|
138
|
+
K_7: typing.ClassVar[KeyCode] # value = <KeyCode.K_7: 55>
|
|
139
|
+
K_8: typing.ClassVar[KeyCode] # value = <KeyCode.K_8: 56>
|
|
140
|
+
K_9: typing.ClassVar[KeyCode] # value = <KeyCode.K_9: 57>
|
|
141
|
+
K_A: typing.ClassVar[KeyCode] # value = <KeyCode.K_A: 65>
|
|
142
|
+
K_B: typing.ClassVar[KeyCode] # value = <KeyCode.K_B: 66>
|
|
143
|
+
K_BACKSPACE: typing.ClassVar[KeyCode] # value = <KeyCode.K_BACKSPACE: 259>
|
|
144
|
+
K_C: typing.ClassVar[KeyCode] # value = <KeyCode.K_C: 67>
|
|
145
|
+
K_CAPS_LOCK: typing.ClassVar[KeyCode] # value = <KeyCode.K_CAPS_LOCK: 280>
|
|
146
|
+
K_D: typing.ClassVar[KeyCode] # value = <KeyCode.K_D: 68>
|
|
147
|
+
K_E: typing.ClassVar[KeyCode] # value = <KeyCode.K_E: 69>
|
|
148
|
+
K_ENTER: typing.ClassVar[KeyCode] # value = <KeyCode.K_ENTER: 257>
|
|
149
|
+
K_ESCAPE: typing.ClassVar[KeyCode] # value = <KeyCode.K_ESCAPE: 256>
|
|
150
|
+
K_F: typing.ClassVar[KeyCode] # value = <KeyCode.K_F: 70>
|
|
151
|
+
K_F1: typing.ClassVar[KeyCode] # value = <KeyCode.K_F1: 290>
|
|
152
|
+
K_F10: typing.ClassVar[KeyCode] # value = <KeyCode.K_F10: 299>
|
|
153
|
+
K_F11: typing.ClassVar[KeyCode] # value = <KeyCode.K_F11: 300>
|
|
154
|
+
K_F12: typing.ClassVar[KeyCode] # value = <KeyCode.K_F12: 301>
|
|
155
|
+
K_F2: typing.ClassVar[KeyCode] # value = <KeyCode.K_F2: 291>
|
|
156
|
+
K_F3: typing.ClassVar[KeyCode] # value = <KeyCode.K_F3: 292>
|
|
157
|
+
K_F4: typing.ClassVar[KeyCode] # value = <KeyCode.K_F4: 293>
|
|
158
|
+
K_F5: typing.ClassVar[KeyCode] # value = <KeyCode.K_F5: 294>
|
|
159
|
+
K_F6: typing.ClassVar[KeyCode] # value = <KeyCode.K_F6: 295>
|
|
160
|
+
K_F7: typing.ClassVar[KeyCode] # value = <KeyCode.K_F7: 296>
|
|
161
|
+
K_F8: typing.ClassVar[KeyCode] # value = <KeyCode.K_F8: 297>
|
|
162
|
+
K_F9: typing.ClassVar[KeyCode] # value = <KeyCode.K_F9: 298>
|
|
163
|
+
K_G: typing.ClassVar[KeyCode] # value = <KeyCode.K_G: 71>
|
|
164
|
+
K_H: typing.ClassVar[KeyCode] # value = <KeyCode.K_H: 72>
|
|
165
|
+
K_I: typing.ClassVar[KeyCode] # value = <KeyCode.K_I: 73>
|
|
166
|
+
K_J: typing.ClassVar[KeyCode] # value = <KeyCode.K_J: 74>
|
|
167
|
+
K_K: typing.ClassVar[KeyCode] # value = <KeyCode.K_K: 75>
|
|
168
|
+
K_L: typing.ClassVar[KeyCode] # value = <KeyCode.K_L: 76>
|
|
169
|
+
K_LEFT_ALT: typing.ClassVar[KeyCode] # value = <KeyCode.K_LEFT_ALT: 342>
|
|
170
|
+
K_LEFT_CONTROL: typing.ClassVar[KeyCode] # value = <KeyCode.K_LEFT_CONTROL: 341>
|
|
171
|
+
K_LEFT_SHIFT: typing.ClassVar[KeyCode] # value = <KeyCode.K_LEFT_SHIFT: 340>
|
|
172
|
+
K_M: typing.ClassVar[KeyCode] # value = <KeyCode.K_M: 77>
|
|
173
|
+
K_N: typing.ClassVar[KeyCode] # value = <KeyCode.K_N: 78>
|
|
174
|
+
K_O: typing.ClassVar[KeyCode] # value = <KeyCode.K_O: 79>
|
|
175
|
+
K_P: typing.ClassVar[KeyCode] # value = <KeyCode.K_P: 80>
|
|
176
|
+
K_Q: typing.ClassVar[KeyCode] # value = <KeyCode.K_Q: 81>
|
|
177
|
+
K_R: typing.ClassVar[KeyCode] # value = <KeyCode.K_R: 82>
|
|
178
|
+
K_RIGHT_ALT: typing.ClassVar[KeyCode] # value = <KeyCode.K_RIGHT_ALT: 346>
|
|
179
|
+
K_RIGHT_CONTROL: typing.ClassVar[KeyCode] # value = <KeyCode.K_RIGHT_CONTROL: 345>
|
|
180
|
+
K_RIGHT_SHIFT: typing.ClassVar[KeyCode] # value = <KeyCode.K_RIGHT_SHIFT: 344>
|
|
181
|
+
K_S: typing.ClassVar[KeyCode] # value = <KeyCode.K_S: 83>
|
|
182
|
+
K_SPACE: typing.ClassVar[KeyCode] # value = <KeyCode.K_SPACE: 32>
|
|
183
|
+
K_T: typing.ClassVar[KeyCode] # value = <KeyCode.K_T: 84>
|
|
184
|
+
K_TAB: typing.ClassVar[KeyCode] # value = <KeyCode.K_TAB: 258>
|
|
185
|
+
K_U: typing.ClassVar[KeyCode] # value = <KeyCode.K_U: 85>
|
|
186
|
+
K_V: typing.ClassVar[KeyCode] # value = <KeyCode.K_V: 86>
|
|
187
|
+
K_W: typing.ClassVar[KeyCode] # value = <KeyCode.K_W: 87>
|
|
188
|
+
K_X: typing.ClassVar[KeyCode] # value = <KeyCode.K_X: 88>
|
|
189
|
+
K_Y: typing.ClassVar[KeyCode] # value = <KeyCode.K_Y: 89>
|
|
190
|
+
K_Z: typing.ClassVar[KeyCode] # value = <KeyCode.K_Z: 90>
|
|
191
|
+
__members__: typing.ClassVar[dict[str, KeyCode]] # value = {'K_A': <KeyCode.K_A: 65>, 'K_B': <KeyCode.K_B: 66>, 'K_C': <KeyCode.K_C: 67>, 'K_D': <KeyCode.K_D: 68>, 'K_E': <KeyCode.K_E: 69>, 'K_F': <KeyCode.K_F: 70>, 'K_G': <KeyCode.K_G: 71>, 'K_H': <KeyCode.K_H: 72>, 'K_I': <KeyCode.K_I: 73>, 'K_J': <KeyCode.K_J: 74>, 'K_K': <KeyCode.K_K: 75>, 'K_L': <KeyCode.K_L: 76>, 'K_M': <KeyCode.K_M: 77>, 'K_N': <KeyCode.K_N: 78>, 'K_O': <KeyCode.K_O: 79>, 'K_P': <KeyCode.K_P: 80>, 'K_Q': <KeyCode.K_Q: 81>, 'K_R': <KeyCode.K_R: 82>, 'K_S': <KeyCode.K_S: 83>, 'K_T': <KeyCode.K_T: 84>, 'K_U': <KeyCode.K_U: 85>, 'K_V': <KeyCode.K_V: 86>, 'K_W': <KeyCode.K_W: 87>, 'K_X': <KeyCode.K_X: 88>, 'K_Y': <KeyCode.K_Y: 89>, 'K_Z': <KeyCode.K_Z: 90>, 'K_0': <KeyCode.K_0: 48>, 'K_1': <KeyCode.K_1: 49>, 'K_2': <KeyCode.K_2: 50>, 'K_3': <KeyCode.K_3: 51>, 'K_4': <KeyCode.K_4: 52>, 'K_5': <KeyCode.K_5: 53>, 'K_6': <KeyCode.K_6: 54>, 'K_7': <KeyCode.K_7: 55>, 'K_8': <KeyCode.K_8: 56>, 'K_9': <KeyCode.K_9: 57>, 'K_F1': <KeyCode.K_F1: 290>, 'K_F2': <KeyCode.K_F2: 291>, 'K_F3': <KeyCode.K_F3: 292>, 'K_F4': <KeyCode.K_F4: 293>, 'K_F5': <KeyCode.K_F5: 294>, 'K_F6': <KeyCode.K_F6: 295>, 'K_F7': <KeyCode.K_F7: 296>, 'K_F8': <KeyCode.K_F8: 297>, 'K_F9': <KeyCode.K_F9: 298>, 'K_F10': <KeyCode.K_F10: 299>, 'K_F11': <KeyCode.K_F11: 300>, 'K_F12': <KeyCode.K_F12: 301>, 'K_BACKSPACE': <KeyCode.K_BACKSPACE: 259>, 'K_TAB': <KeyCode.K_TAB: 258>, 'K_ENTER': <KeyCode.K_ENTER: 257>, 'K_LEFT_SHIFT': <KeyCode.K_LEFT_SHIFT: 340>, 'K_RIGHT_SHIFT': <KeyCode.K_RIGHT_SHIFT: 344>, 'K_LEFT_CONTROL': <KeyCode.K_LEFT_CONTROL: 341>, 'K_RIGHT_CONTROL': <KeyCode.K_RIGHT_CONTROL: 345>, 'K_LEFT_ALT': <KeyCode.K_LEFT_ALT: 342>, 'K_RIGHT_ALT': <KeyCode.K_RIGHT_ALT: 346>, 'K_CAPS_LOCK': <KeyCode.K_CAPS_LOCK: 280>, 'K_ESCAPE': <KeyCode.K_ESCAPE: 256>, 'K_SPACE': <KeyCode.K_SPACE: 32>}
|
|
192
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
193
|
+
...
|
|
194
|
+
def __getstate__(self) -> int:
|
|
195
|
+
...
|
|
196
|
+
def __hash__(self) -> int:
|
|
197
|
+
...
|
|
198
|
+
def __index__(self) -> int:
|
|
199
|
+
...
|
|
200
|
+
def __init__(self, value: typing.SupportsInt) -> None:
|
|
201
|
+
...
|
|
202
|
+
def __int__(self) -> int:
|
|
203
|
+
...
|
|
204
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
205
|
+
...
|
|
206
|
+
def __repr__(self) -> str:
|
|
207
|
+
...
|
|
208
|
+
def __setstate__(self, state: typing.SupportsInt) -> None:
|
|
209
|
+
...
|
|
210
|
+
def __str__(self) -> str:
|
|
211
|
+
...
|
|
212
|
+
@property
|
|
213
|
+
def name(self) -> str:
|
|
214
|
+
...
|
|
215
|
+
@property
|
|
216
|
+
def value(self) -> int:
|
|
217
|
+
...
|
|
218
|
+
K_0: KeyCode # value = <KeyCode.K_0: 48>
|
|
219
|
+
K_1: KeyCode # value = <KeyCode.K_1: 49>
|
|
220
|
+
K_2: KeyCode # value = <KeyCode.K_2: 50>
|
|
221
|
+
K_3: KeyCode # value = <KeyCode.K_3: 51>
|
|
222
|
+
K_4: KeyCode # value = <KeyCode.K_4: 52>
|
|
223
|
+
K_5: KeyCode # value = <KeyCode.K_5: 53>
|
|
224
|
+
K_6: KeyCode # value = <KeyCode.K_6: 54>
|
|
225
|
+
K_7: KeyCode # value = <KeyCode.K_7: 55>
|
|
226
|
+
K_8: KeyCode # value = <KeyCode.K_8: 56>
|
|
227
|
+
K_9: KeyCode # value = <KeyCode.K_9: 57>
|
|
228
|
+
K_A: KeyCode # value = <KeyCode.K_A: 65>
|
|
229
|
+
K_B: KeyCode # value = <KeyCode.K_B: 66>
|
|
230
|
+
K_BACKSPACE: KeyCode # value = <KeyCode.K_BACKSPACE: 259>
|
|
231
|
+
K_C: KeyCode # value = <KeyCode.K_C: 67>
|
|
232
|
+
K_CAPS_LOCK: KeyCode # value = <KeyCode.K_CAPS_LOCK: 280>
|
|
233
|
+
K_D: KeyCode # value = <KeyCode.K_D: 68>
|
|
234
|
+
K_E: KeyCode # value = <KeyCode.K_E: 69>
|
|
235
|
+
K_ENTER: KeyCode # value = <KeyCode.K_ENTER: 257>
|
|
236
|
+
K_ESCAPE: KeyCode # value = <KeyCode.K_ESCAPE: 256>
|
|
237
|
+
K_F: KeyCode # value = <KeyCode.K_F: 70>
|
|
238
|
+
K_F1: KeyCode # value = <KeyCode.K_F1: 290>
|
|
239
|
+
K_F10: KeyCode # value = <KeyCode.K_F10: 299>
|
|
240
|
+
K_F11: KeyCode # value = <KeyCode.K_F11: 300>
|
|
241
|
+
K_F12: KeyCode # value = <KeyCode.K_F12: 301>
|
|
242
|
+
K_F2: KeyCode # value = <KeyCode.K_F2: 291>
|
|
243
|
+
K_F3: KeyCode # value = <KeyCode.K_F3: 292>
|
|
244
|
+
K_F4: KeyCode # value = <KeyCode.K_F4: 293>
|
|
245
|
+
K_F5: KeyCode # value = <KeyCode.K_F5: 294>
|
|
246
|
+
K_F6: KeyCode # value = <KeyCode.K_F6: 295>
|
|
247
|
+
K_F7: KeyCode # value = <KeyCode.K_F7: 296>
|
|
248
|
+
K_F8: KeyCode # value = <KeyCode.K_F8: 297>
|
|
249
|
+
K_F9: KeyCode # value = <KeyCode.K_F9: 298>
|
|
250
|
+
K_G: KeyCode # value = <KeyCode.K_G: 71>
|
|
251
|
+
K_H: KeyCode # value = <KeyCode.K_H: 72>
|
|
252
|
+
K_I: KeyCode # value = <KeyCode.K_I: 73>
|
|
253
|
+
K_J: KeyCode # value = <KeyCode.K_J: 74>
|
|
254
|
+
K_K: KeyCode # value = <KeyCode.K_K: 75>
|
|
255
|
+
K_L: KeyCode # value = <KeyCode.K_L: 76>
|
|
256
|
+
K_LEFT_ALT: KeyCode # value = <KeyCode.K_LEFT_ALT: 342>
|
|
257
|
+
K_LEFT_CONTROL: KeyCode # value = <KeyCode.K_LEFT_CONTROL: 341>
|
|
258
|
+
K_LEFT_SHIFT: KeyCode # value = <KeyCode.K_LEFT_SHIFT: 340>
|
|
259
|
+
K_M: KeyCode # value = <KeyCode.K_M: 77>
|
|
260
|
+
K_N: KeyCode # value = <KeyCode.K_N: 78>
|
|
261
|
+
K_O: KeyCode # value = <KeyCode.K_O: 79>
|
|
262
|
+
K_P: KeyCode # value = <KeyCode.K_P: 80>
|
|
263
|
+
K_Q: KeyCode # value = <KeyCode.K_Q: 81>
|
|
264
|
+
K_R: KeyCode # value = <KeyCode.K_R: 82>
|
|
265
|
+
K_RIGHT_ALT: KeyCode # value = <KeyCode.K_RIGHT_ALT: 346>
|
|
266
|
+
K_RIGHT_CONTROL: KeyCode # value = <KeyCode.K_RIGHT_CONTROL: 345>
|
|
267
|
+
K_RIGHT_SHIFT: KeyCode # value = <KeyCode.K_RIGHT_SHIFT: 344>
|
|
268
|
+
K_S: KeyCode # value = <KeyCode.K_S: 83>
|
|
269
|
+
K_SPACE: KeyCode # value = <KeyCode.K_SPACE: 32>
|
|
270
|
+
K_T: KeyCode # value = <KeyCode.K_T: 84>
|
|
271
|
+
K_TAB: KeyCode # value = <KeyCode.K_TAB: 258>
|
|
272
|
+
K_U: KeyCode # value = <KeyCode.K_U: 85>
|
|
273
|
+
K_V: KeyCode # value = <KeyCode.K_V: 86>
|
|
274
|
+
K_W: KeyCode # value = <KeyCode.K_W: 87>
|
|
275
|
+
K_X: KeyCode # value = <KeyCode.K_X: 88>
|
|
276
|
+
K_Y: KeyCode # value = <KeyCode.K_Y: 89>
|
|
277
|
+
K_Z: KeyCode # value = <KeyCode.K_Z: 90>
|
|
Binary file
|
basilisk/basilisk.pyi
CHANGED
|
@@ -5,7 +5,8 @@ from __future__ import annotations
|
|
|
5
5
|
import collections.abc
|
|
6
6
|
import glm
|
|
7
7
|
import typing
|
|
8
|
-
|
|
8
|
+
import typing_extensions
|
|
9
|
+
__all__: list[str] = ['Collider', 'Contact', 'EBO', 'Edges', 'Engine', 'FBO', 'FeaturePair', 'Force', 'Frame', 'Image', 'Joint', 'Manifold', 'Material', 'Mesh', 'Motor', 'Node', 'Node2D', 'Rigid', 'Scene', 'Shader', 'Solver', 'Spring', 'VAO', 'VBO']
|
|
9
10
|
class Collider:
|
|
10
11
|
def __init__(self, solver: Solver, vertices: collections.abc.Sequence[glm.vec2]) -> None:
|
|
11
12
|
...
|
|
@@ -48,6 +49,17 @@ class Contact:
|
|
|
48
49
|
rA: glm.vec2
|
|
49
50
|
rB: glm.vec2
|
|
50
51
|
stick: bool
|
|
52
|
+
class EBO:
|
|
53
|
+
def __init__(self, data: collections.abc.Sequence[typing.SupportsInt], drawType: typing.SupportsInt = 35044) -> None:
|
|
54
|
+
...
|
|
55
|
+
def bind(self) -> None:
|
|
56
|
+
...
|
|
57
|
+
def getSize(self) -> int:
|
|
58
|
+
...
|
|
59
|
+
def unbind(self) -> None:
|
|
60
|
+
...
|
|
61
|
+
def write(self, data: typing_extensions.CapsuleType, size: typing.SupportsInt, offset: typing.SupportsInt) -> None:
|
|
62
|
+
...
|
|
51
63
|
class Edges:
|
|
52
64
|
inEdge1: str
|
|
53
65
|
inEdge2: str
|
|
@@ -76,6 +88,25 @@ class Engine:
|
|
|
76
88
|
...
|
|
77
89
|
def useContext(self) -> None:
|
|
78
90
|
...
|
|
91
|
+
class FBO:
|
|
92
|
+
def __init__(self, width: typing.SupportsInt, height: typing.SupportsInt, components: typing.SupportsInt) -> None:
|
|
93
|
+
...
|
|
94
|
+
def bind(self) -> None:
|
|
95
|
+
...
|
|
96
|
+
def clear(self, r: typing.SupportsFloat, g: typing.SupportsFloat, b: typing.SupportsFloat, a: typing.SupportsFloat) -> None:
|
|
97
|
+
...
|
|
98
|
+
def getDepthID(self) -> int:
|
|
99
|
+
...
|
|
100
|
+
def getHeight(self) -> int:
|
|
101
|
+
...
|
|
102
|
+
def getID(self) -> int:
|
|
103
|
+
...
|
|
104
|
+
def getTextureID(self) -> int:
|
|
105
|
+
...
|
|
106
|
+
def getWidth(self) -> int:
|
|
107
|
+
...
|
|
108
|
+
def unbind(self) -> None:
|
|
109
|
+
...
|
|
79
110
|
class FeaturePair:
|
|
80
111
|
e: ...
|
|
81
112
|
@property
|
|
@@ -123,6 +154,39 @@ class Force:
|
|
|
123
154
|
...
|
|
124
155
|
def getStiffness(self, arg0: typing.SupportsInt) -> float:
|
|
125
156
|
...
|
|
157
|
+
class Frame:
|
|
158
|
+
def __init__(self, engine: Engine, width: typing.SupportsInt, height: typing.SupportsInt) -> None:
|
|
159
|
+
...
|
|
160
|
+
def clear(self, r: typing.SupportsFloat, g: typing.SupportsFloat, b: typing.SupportsFloat, a: typing.SupportsFloat) -> None:
|
|
161
|
+
...
|
|
162
|
+
def getAspectRatio(self) -> float:
|
|
163
|
+
...
|
|
164
|
+
def getEBO(self) -> EBO:
|
|
165
|
+
...
|
|
166
|
+
def getFBO(self) -> FBO:
|
|
167
|
+
...
|
|
168
|
+
def getHeight(self) -> int:
|
|
169
|
+
...
|
|
170
|
+
def getRenderHeight(self) -> int:
|
|
171
|
+
...
|
|
172
|
+
def getRenderWidth(self) -> int:
|
|
173
|
+
...
|
|
174
|
+
def getShader(self) -> Shader:
|
|
175
|
+
...
|
|
176
|
+
def getVAO(self) -> VAO:
|
|
177
|
+
...
|
|
178
|
+
def getVBO(self) -> VBO:
|
|
179
|
+
...
|
|
180
|
+
def getWidth(self) -> int:
|
|
181
|
+
...
|
|
182
|
+
@typing.overload
|
|
183
|
+
def render(self) -> None:
|
|
184
|
+
...
|
|
185
|
+
@typing.overload
|
|
186
|
+
def render(self, x: typing.SupportsInt, y: typing.SupportsInt, width: typing.SupportsInt, height: typing.SupportsInt) -> None:
|
|
187
|
+
...
|
|
188
|
+
def use(self) -> None:
|
|
189
|
+
...
|
|
126
190
|
class Image:
|
|
127
191
|
def __init__(self, file: str) -> None:
|
|
128
192
|
...
|
|
@@ -338,6 +402,45 @@ class Scene:
|
|
|
338
402
|
...
|
|
339
403
|
def update(self) -> None:
|
|
340
404
|
...
|
|
405
|
+
class Shader:
|
|
406
|
+
@staticmethod
|
|
407
|
+
@typing.overload
|
|
408
|
+
def setUniform(*args, **kwargs) -> None:
|
|
409
|
+
...
|
|
410
|
+
def __init__(self, vertexPath: str, fragmentPath: str) -> None:
|
|
411
|
+
...
|
|
412
|
+
@typing.overload
|
|
413
|
+
def bind(self, name: str, texture: ..., slot: typing.SupportsInt) -> None:
|
|
414
|
+
...
|
|
415
|
+
@typing.overload
|
|
416
|
+
def bind(self, name: str, textureArray: ..., slot: typing.SupportsInt) -> None:
|
|
417
|
+
...
|
|
418
|
+
@typing.overload
|
|
419
|
+
def bind(self, name: str, tbo: ..., slot: typing.SupportsInt) -> None:
|
|
420
|
+
...
|
|
421
|
+
@typing.overload
|
|
422
|
+
def bind(self, name: str, fbo: ..., slot: typing.SupportsInt) -> None:
|
|
423
|
+
...
|
|
424
|
+
def getAttributes(self) -> ...:
|
|
425
|
+
...
|
|
426
|
+
def getStride(self) -> int:
|
|
427
|
+
...
|
|
428
|
+
def getUniformLocation(self, name: str) -> int:
|
|
429
|
+
...
|
|
430
|
+
@typing.overload
|
|
431
|
+
def setUniform(self, name: str, value: typing.SupportsFloat) -> None:
|
|
432
|
+
...
|
|
433
|
+
@typing.overload
|
|
434
|
+
def setUniform(self, name: str, value: typing.SupportsFloat) -> None:
|
|
435
|
+
...
|
|
436
|
+
@typing.overload
|
|
437
|
+
def setUniform(self, name: str, value: typing.SupportsInt) -> None:
|
|
438
|
+
...
|
|
439
|
+
@typing.overload
|
|
440
|
+
def setUniform(self, name: str, value: glm.vec3) -> None:
|
|
441
|
+
...
|
|
442
|
+
def use(self) -> None:
|
|
443
|
+
...
|
|
341
444
|
class Solver:
|
|
342
445
|
@staticmethod
|
|
343
446
|
def setGravity(*args, **kwargs) -> None:
|
|
@@ -401,3 +504,33 @@ class Spring(Force):
|
|
|
401
504
|
...
|
|
402
505
|
def setRest(self, arg0: typing.SupportsFloat) -> None:
|
|
403
506
|
...
|
|
507
|
+
class VAO:
|
|
508
|
+
def __init__(self, shader: Shader, vertices: VBO, indices: EBO) -> None:
|
|
509
|
+
...
|
|
510
|
+
def bind(self) -> None:
|
|
511
|
+
...
|
|
512
|
+
def bindAttribute(self, location: typing.SupportsInt, count: typing.SupportsInt, dataType: typing.SupportsInt, stride: typing.SupportsInt, offset: typing.SupportsInt, divisor: typing.SupportsInt) -> None:
|
|
513
|
+
...
|
|
514
|
+
def bindAttributes(self, attribs: ..., std: ..., std: ..., std: ..., std: ..., std: ..., divisor: typing.SupportsInt) -> None:
|
|
515
|
+
...
|
|
516
|
+
@typing.overload
|
|
517
|
+
def bindBuffer(self, buffer: VBO, attribs: ..., std: ..., std: ..., std: ..., std: ..., std: ..., divisor: typing.SupportsInt) -> None:
|
|
518
|
+
...
|
|
519
|
+
@typing.overload
|
|
520
|
+
def bindBuffer(self, buffer: VBO, indices: EBO, attribs: ..., std: ..., std: ..., std: ..., std: ..., std: ..., divisor: typing.SupportsInt) -> None:
|
|
521
|
+
...
|
|
522
|
+
def render(self, instanceCount: typing.SupportsInt) -> None:
|
|
523
|
+
...
|
|
524
|
+
class VBO:
|
|
525
|
+
@typing.overload
|
|
526
|
+
def __init__(self, data: typing_extensions.CapsuleType, size: typing.SupportsInt, drawType: typing.SupportsInt) -> None:
|
|
527
|
+
...
|
|
528
|
+
@typing.overload
|
|
529
|
+
def __init__(self, data: collections.abc.Sequence[typing.SupportsFloat], drawType: typing.SupportsInt = 35044) -> None:
|
|
530
|
+
...
|
|
531
|
+
def bind(self) -> None:
|
|
532
|
+
...
|
|
533
|
+
def getSize(self) -> int:
|
|
534
|
+
...
|
|
535
|
+
def unbind(self) -> None:
|
|
536
|
+
...
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#include "light.glsl"
|
|
2
|
+
|
|
3
|
+
float getAttenuation(float distance, float range) {
|
|
4
|
+
float q = 1.0 / (range * range);
|
|
5
|
+
float attenuation = 1.0 / (1.0 + q * distance * distance);
|
|
6
|
+
|
|
7
|
+
float fade = 1.0 - smoothstep(0.8 * range, range, distance);
|
|
8
|
+
// float fade = clamp((range - distance) / (0.2 * range), 0.0, 1.0);
|
|
9
|
+
return attenuation * fade;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
vec3 calculateDirectionalLight(DirectionalLight light, vec3 N, vec3 V) {
|
|
13
|
+
vec3 L = normalize(-light.direction);
|
|
14
|
+
vec3 H = normalize(L + V);
|
|
15
|
+
|
|
16
|
+
float diffuse = max(dot(N, L), 0.0);
|
|
17
|
+
float specular = pow(max(dot(N, H), 0.0), 64);
|
|
18
|
+
|
|
19
|
+
return light.color * light.intensity * (diffuse + specular);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
vec3 calculatePointLight(PointLight light, vec3 fragPosition, vec3 N, vec3 V) {
|
|
23
|
+
vec3 toLight = light.position - fragPosition;
|
|
24
|
+
|
|
25
|
+
float distSquared = dot(toLight, toLight);
|
|
26
|
+
float rangeSquared = light.range * light.range;
|
|
27
|
+
if (distSquared > rangeSquared) return vec3(0.0);
|
|
28
|
+
|
|
29
|
+
float distance = sqrt(distSquared);
|
|
30
|
+
vec3 L = toLight * inversesqrt(distSquared);
|
|
31
|
+
vec3 H = normalize(L + V);
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
float ndotl = dot(N, L);
|
|
35
|
+
if (ndotl <= 0.0) return vec3(0.0);
|
|
36
|
+
float diffuse = max(ndotl, 0.0);
|
|
37
|
+
float specular = pow(max(dot(N, H), 0.0), 64);
|
|
38
|
+
float attenuation = getAttenuation(distance, light.range);
|
|
39
|
+
|
|
40
|
+
return light.color * light.intensity * attenuation * (diffuse + specular);
|
|
41
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#define MAX_DIRECTIONAL_LIGHTS 5
|
|
2
|
+
#define TILE_SIZE 32
|
|
3
|
+
|
|
4
|
+
uniform int uDirectionalLightCount;
|
|
5
|
+
uniform int uPointLightCount;
|
|
6
|
+
uniform usamplerBuffer uLightTiles;
|
|
7
|
+
uniform usamplerBuffer uLightIndices;
|
|
8
|
+
uniform samplerBuffer uPointLights;
|
|
9
|
+
uniform vec3 uAmbientLight;
|
|
10
|
+
|
|
11
|
+
struct DirectionalLight {
|
|
12
|
+
vec3 color;
|
|
13
|
+
float intensity;
|
|
14
|
+
vec3 direction;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
struct PointLight {
|
|
18
|
+
vec3 color;
|
|
19
|
+
float intensity;
|
|
20
|
+
vec3 position;
|
|
21
|
+
float range;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
struct AmbientLight {
|
|
25
|
+
vec3 color;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
struct Tile {
|
|
29
|
+
uint offset;
|
|
30
|
+
uint count;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
layout (std140) uniform uDirectionalLights {
|
|
34
|
+
DirectionalLight directionalLights[MAX_DIRECTIONAL_LIGHTS];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
PointLight getPointLight(int index) {
|
|
38
|
+
vec4 t1 = texelFetch(uPointLights, 2 * index);
|
|
39
|
+
vec4 t2 = texelFetch(uPointLights, 2 * index + 1);
|
|
40
|
+
|
|
41
|
+
PointLight light;
|
|
42
|
+
light.color = t1.rgb;
|
|
43
|
+
light.intensity = t1.a;
|
|
44
|
+
light.position = t2.xyz;
|
|
45
|
+
light.range = t2.w;
|
|
46
|
+
|
|
47
|
+
return light;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
Tile getTile() {
|
|
51
|
+
int tilesX = int(ceil(800.0 / float(TILE_SIZE)));
|
|
52
|
+
|
|
53
|
+
ivec2 tileCoord = ivec2(gl_FragCoord.xy) / TILE_SIZE;
|
|
54
|
+
int tileIndex = tileCoord.y * tilesX + tileCoord.x;
|
|
55
|
+
|
|
56
|
+
uvec4 texelData = texelFetch(uLightTiles, tileIndex);
|
|
57
|
+
|
|
58
|
+
Tile tile;
|
|
59
|
+
tile.offset = texelData.x;
|
|
60
|
+
tile.count = texelData.y;
|
|
61
|
+
return tile;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
PointLight getLightByIndex(uint linearIndex) {
|
|
65
|
+
int texelIndex = int(linearIndex) / 4;
|
|
66
|
+
int component = int(linearIndex) % 4;
|
|
67
|
+
|
|
68
|
+
uvec4 texelData = texelFetch(uLightIndices, texelIndex);
|
|
69
|
+
uint lightIndex = texelData[component];
|
|
70
|
+
|
|
71
|
+
return getPointLight(int(lightIndex));
|
|
72
|
+
}
|
basilisk/shaders/instance.frag
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
#include "include/material.glsl"
|
|
4
4
|
#include "include/texture.glsl"
|
|
5
|
+
#include "include/light.glsl"
|
|
6
|
+
#include "include/blinn_phong.glsl"
|
|
5
7
|
|
|
6
8
|
in vec3 position;
|
|
7
9
|
in vec2 uv;
|
|
@@ -15,16 +17,25 @@ uniform vec3 uViewDirection;
|
|
|
15
17
|
out vec4 fragColor;
|
|
16
18
|
|
|
17
19
|
void main() {
|
|
20
|
+
Tile tile = getTile();
|
|
21
|
+
vec4 textureColor = getTextureValue(material, uv);
|
|
22
|
+
|
|
18
23
|
vec3 N = normalize(normal);
|
|
19
|
-
vec3 L = normalize(vec3(.5, 1.0, .25));
|
|
20
24
|
vec3 V = normalize(uCameraPosition - position);
|
|
21
|
-
vec3 H = normalize(L + V);
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
vec3 directionalLightColor = vec3(0.0, 0.0, 0.0);
|
|
27
|
+
for (int i = 0; i < uDirectionalLightCount; i++) {
|
|
28
|
+
DirectionalLight directionalLight = directionalLights[i];
|
|
29
|
+
directionalLightColor += calculateDirectionalLight(directionalLight, N, V);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
vec3 pointLightColor = vec3(0.0, 0.0, 0.0);
|
|
33
|
+
for (uint i = tile.offset; i < tile.offset + tile.count; i++) {
|
|
34
|
+
PointLight pointLight = getLightByIndex(i);
|
|
35
|
+
pointLightColor += calculatePointLight(pointLight, position, N, V);
|
|
36
|
+
}
|
|
27
37
|
|
|
28
|
-
|
|
29
|
-
|
|
38
|
+
vec3 ambientColor = uAmbientLight;
|
|
39
|
+
|
|
40
|
+
fragColor = vec4((directionalLightColor + pointLightColor + ambientColor) * textureColor.rgb, textureColor.a);
|
|
30
41
|
}
|
basilisk/shaders/instance.vert
CHANGED
|
@@ -18,9 +18,9 @@ out vec3 normal;
|
|
|
18
18
|
flat out Material material;
|
|
19
19
|
|
|
20
20
|
void main() {
|
|
21
|
-
position = vPosition;
|
|
21
|
+
position = (uModel * vec4(vPosition, 1.0)).xyz;
|
|
22
22
|
uv = vUV;
|
|
23
|
-
normal = vNormal;
|
|
23
|
+
normal = (uModel * vec4(vNormal, 0.0)).xyz;
|
|
24
24
|
material = getMaterial(uMaterialID);
|
|
25
25
|
|
|
26
26
|
gl_Position = uProjection * uView * uModel * vec4(vPosition, 1.0);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#version 330 core
|
|
2
|
+
|
|
3
|
+
layout (location = 0) in vec3 vPosition;
|
|
4
|
+
|
|
5
|
+
uniform mat4 uProjection;
|
|
6
|
+
uniform mat4 uView;
|
|
7
|
+
|
|
8
|
+
out vec3 uv;
|
|
9
|
+
|
|
10
|
+
void main() {
|
|
11
|
+
uv = vPosition;
|
|
12
|
+
gl_Position = uProjection * uView * vec4(vPosition, 1.0);
|
|
13
|
+
// gl_Position = pos.xyww;
|
|
14
|
+
}
|
basilisk/shaders/test.frag
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
#version 330 core
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
struct textArray {
|
|
6
|
-
sampler2DArray array;
|
|
3
|
+
struct Color {
|
|
4
|
+
vec4 value;
|
|
7
5
|
};
|
|
8
6
|
|
|
9
|
-
uniform
|
|
7
|
+
layout (std140) uniform testBlock {
|
|
8
|
+
Color colors[2];
|
|
9
|
+
};
|
|
10
10
|
|
|
11
|
+
in vec2 uv;
|
|
11
12
|
out vec4 fragColor;
|
|
12
13
|
|
|
13
14
|
void main() {
|
|
14
|
-
fragColor =
|
|
15
|
-
}
|
|
15
|
+
fragColor = vec4(vec3(1.0, uv), 1.0) * colors[1].value;
|
|
16
|
+
}
|