basilisk-engine 0.2.7__cp310-cp310-macosx_11_0_arm64.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.

Potentially problematic release.


This version of basilisk-engine might be problematic. Click here for more details.

basilisk/__init__.py ADDED
@@ -0,0 +1 @@
1
+ from .basilisk import *
Binary file
basilisk/basilisk.pyi ADDED
@@ -0,0 +1,536 @@
1
+ """
2
+ pybind11 example plugin
3
+ """
4
+ from __future__ import annotations
5
+ import collections.abc
6
+ import glm
7
+ import typing
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']
10
+ class Collider:
11
+ def __init__(self, solver: Solver, vertices: collections.abc.Sequence[glm.vec2]) -> None:
12
+ ...
13
+ def getArea(self) -> float:
14
+ ...
15
+ def getBaseMoment(self) -> float:
16
+ ...
17
+ def getBaseRadius(self) -> float:
18
+ ...
19
+ def getCOM(self) -> glm.vec2:
20
+ ...
21
+ def getGC(self) -> glm.vec2:
22
+ ...
23
+ def getHalfDim(self) -> glm.vec2:
24
+ ...
25
+ def getMass(self, arg0: glm.vec2, arg1: typing.SupportsFloat) -> float:
26
+ ...
27
+ def getMoment(self, arg0: glm.vec2, arg1: typing.SupportsFloat) -> float:
28
+ ...
29
+ def getRadius(self, arg0: glm.vec2) -> float:
30
+ ...
31
+ def getVertices(self) -> list[glm.vec2]:
32
+ ...
33
+ def setArea(self, arg0: typing.SupportsFloat) -> None:
34
+ ...
35
+ def setBaseMoment(self, arg0: typing.SupportsFloat) -> None:
36
+ ...
37
+ def setCOM(self, arg0: glm.vec2) -> None:
38
+ ...
39
+ def setGC(self, arg0: glm.vec2) -> None:
40
+ ...
41
+ def setHalfDim(self, arg0: glm.vec2) -> None:
42
+ ...
43
+ def setVertices(self, arg0: collections.abc.Sequence[glm.vec2]) -> None:
44
+ ...
45
+ class Contact:
46
+ C0: glm.vec2
47
+ feature: ...
48
+ normal: glm.vec2
49
+ rA: glm.vec2
50
+ rB: glm.vec2
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
+ ...
63
+ class Edges:
64
+ inEdge1: str
65
+ inEdge2: str
66
+ outEdge1: str
67
+ outEdge2: str
68
+ class Engine:
69
+ def __init__(self, width: typing.SupportsInt, height: typing.SupportsInt, title: str, autoMouseGrab: bool = True) -> None:
70
+ ...
71
+ def getFrame(self) -> ...:
72
+ ...
73
+ def getKeyboard(self) -> ...:
74
+ ...
75
+ def getMouse(self) -> ...:
76
+ ...
77
+ def getResourceServer(self) -> ...:
78
+ ...
79
+ def getWindow(self) -> ...:
80
+ ...
81
+ def isRunning(self) -> bool:
82
+ ...
83
+ def render(self) -> None:
84
+ ...
85
+ def setResolution(self, width: typing.SupportsInt, height: typing.SupportsInt) -> None:
86
+ ...
87
+ def update(self) -> None:
88
+ ...
89
+ def useContext(self) -> None:
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
+ ...
110
+ class FeaturePair:
111
+ e: ...
112
+ @property
113
+ def value(self) -> int:
114
+ ...
115
+ @value.setter
116
+ def value(self, arg0: typing.SupportsInt) -> None:
117
+ ...
118
+ class Force:
119
+ def disable(self) -> None:
120
+ ...
121
+ def getBodyA(self) -> Rigid:
122
+ ...
123
+ def getBodyB(self) -> Rigid:
124
+ ...
125
+ def getC(self, arg0: typing.SupportsInt) -> float:
126
+ ...
127
+ def getFmax(self, arg0: typing.SupportsInt) -> float:
128
+ ...
129
+ def getFmin(self, arg0: typing.SupportsInt) -> float:
130
+ ...
131
+ def getFracture(self, arg0: typing.SupportsInt) -> float:
132
+ ...
133
+ def getH(self, arg0: typing.SupportsInt, arg1: Rigid) -> ...:
134
+ ...
135
+ def getJ(self, arg0: typing.SupportsInt, arg1: Rigid) -> glm.vec3:
136
+ ...
137
+ def getLambda(self, arg0: typing.SupportsInt) -> float:
138
+ ...
139
+ def getNext(self) -> Force:
140
+ ...
141
+ def getNextA(self) -> Force:
142
+ ...
143
+ def getNextB(self) -> Force:
144
+ ...
145
+ def getPenalty(self, arg0: typing.SupportsInt) -> float:
146
+ ...
147
+ def getPrev(self) -> Force:
148
+ ...
149
+ def getPrevA(self) -> Force:
150
+ ...
151
+ def getPrevB(self) -> Force:
152
+ ...
153
+ def getSolver(self) -> Solver:
154
+ ...
155
+ def getStiffness(self, arg0: typing.SupportsInt) -> float:
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
+ ...
190
+ class Image:
191
+ def __init__(self, file: str) -> None:
192
+ ...
193
+ def getData(self) -> int:
194
+ ...
195
+ def getHeight(self) -> int:
196
+ ...
197
+ def getWidth(self) -> int:
198
+ ...
199
+ class Joint(Force):
200
+ def __init__(self, solver: Solver, bodyA: Rigid, bodyB: Rigid, rA: glm.vec2, rB: glm.vec2, stiffness: glm.vec3 = ..., fracture: typing.SupportsFloat = ...) -> None:
201
+ ...
202
+ def getC0(self) -> glm.vec3:
203
+ ...
204
+ def getRA(self) -> glm.vec2:
205
+ ...
206
+ def getRB(self) -> glm.vec2:
207
+ ...
208
+ def getRestAngle(self) -> float:
209
+ ...
210
+ def getTorqueArm(self) -> float:
211
+ ...
212
+ def setC0(self, arg0: glm.vec3) -> None:
213
+ ...
214
+ def setRA(self, arg0: glm.vec2) -> None:
215
+ ...
216
+ def setRB(self, arg0: glm.vec2) -> None:
217
+ ...
218
+ def setRestAngle(self, arg0: typing.SupportsFloat) -> None:
219
+ ...
220
+ def setTorqueArm(self, arg0: typing.SupportsFloat) -> None:
221
+ ...
222
+ class Manifold(Force):
223
+ @staticmethod
224
+ def collide(bodyA: Rigid, bodyB: Rigid, contacts: Contact) -> int:
225
+ ...
226
+ def __init__(self, solver: Solver, bodyA: Rigid, bodyB: Rigid) -> None:
227
+ ...
228
+ def getContact(self, arg0: typing.SupportsInt) -> Contact:
229
+ ...
230
+ def getContactRef(self, arg0: typing.SupportsInt) -> Contact:
231
+ ...
232
+ def getFriction(self) -> float:
233
+ ...
234
+ def getNumContacts(self) -> int:
235
+ ...
236
+ class Material:
237
+ def __init__(self, color: glm.vec3 = ..., albedo: Image = None, normal: Image = None) -> None:
238
+ ...
239
+ def getAlbedo(self) -> Image:
240
+ ...
241
+ def getColor(self) -> glm.vec3:
242
+ ...
243
+ def getNormal(self) -> Image:
244
+ ...
245
+ class Mesh:
246
+ def __init__(self, modelPath: str, generateUV: bool = False, generateNormals: bool = False) -> None:
247
+ ...
248
+ def get_indices(self) -> list[int]:
249
+ ...
250
+ def get_vertices(self) -> list[float]:
251
+ ...
252
+ class Motor(Force):
253
+ def __init__(self, solver: Solver, bodyA: Rigid, bodyB: Rigid, speed: typing.SupportsFloat, maxTorque: typing.SupportsFloat) -> None:
254
+ ...
255
+ def getSpeed(self) -> float:
256
+ ...
257
+ def setSpeed(self, arg0: typing.SupportsFloat) -> None:
258
+ ...
259
+ class Node:
260
+ @typing.overload
261
+ def __init__(self, scene: Scene, mesh: ... = None, material: ... = None, position: glm.vec3 = ..., rotation: glm.quat = ..., scale: glm.vec3 = ...) -> None:
262
+ ...
263
+ @typing.overload
264
+ def __init__(self, parent: Node, mesh: ... = None, material: ... = None, position: glm.vec3 = ..., rotation: glm.quat = ..., scale: glm.vec3 = ...) -> None:
265
+ ...
266
+ @typing.overload
267
+ def __init__(self, scene: Scene, parent: Node) -> None:
268
+ ...
269
+ def setPosition(self, position: glm.vec3) -> None:
270
+ ...
271
+ def setRotation(self, rotation: glm.quat) -> None:
272
+ ...
273
+ def setScale(self, scale: glm.vec3) -> None:
274
+ ...
275
+ class Node2D:
276
+ @typing.overload
277
+ def __init__(self, scene: ..., mesh: Mesh, material: Material, position: glm.vec2, rotation: typing.SupportsFloat, scale: glm.vec2, velocity: glm.vec3, collider: ..., density: typing.SupportsFloat, friction: typing.SupportsFloat) -> None:
278
+ ...
279
+ @typing.overload
280
+ def __init__(self, parent: Node2D, mesh: Mesh, material: Material, position: glm.vec2, rotation: typing.SupportsFloat, scale: glm.vec2, velocity: glm.vec3, collider: ..., density: typing.SupportsFloat, friction: typing.SupportsFloat) -> None:
281
+ ...
282
+ @typing.overload
283
+ def __init__(self, arg0: ..., arg1: Node2D) -> None:
284
+ ...
285
+ @typing.overload
286
+ def setPosition(self, arg0: glm.vec2) -> None:
287
+ ...
288
+ @typing.overload
289
+ def setPosition(self, arg0: glm.vec3) -> None:
290
+ ...
291
+ def setRotation(self, arg0: typing.SupportsFloat) -> None:
292
+ ...
293
+ def setScale(self, arg0: glm.vec2) -> None:
294
+ ...
295
+ def setVelocity(self, arg0: glm.vec3) -> None:
296
+ ...
297
+ class Rigid:
298
+ def __init__(self, solver: Solver, node: Node2D, collider: Collider, position: glm.vec3, size: glm.vec2, density: typing.SupportsFloat, friction: typing.SupportsFloat, velocity: glm.vec3) -> None:
299
+ ...
300
+ def constrainedTo(self, arg0: Rigid) -> bool:
301
+ ...
302
+ def getAABB(self) -> tuple[glm.vec2, glm.vec2]:
303
+ ...
304
+ def getCollider(self) -> Collider:
305
+ ...
306
+ def getColor(self) -> int:
307
+ ...
308
+ def getDegree(self) -> int:
309
+ ...
310
+ def getDensity(self) -> float:
311
+ ...
312
+ def getForces(self) -> ...:
313
+ ...
314
+ def getFriction(self) -> float:
315
+ ...
316
+ def getIndex(self) -> int:
317
+ ...
318
+ def getInertial(self) -> glm.vec3:
319
+ ...
320
+ def getInitial(self) -> glm.vec3:
321
+ ...
322
+ def getMass(self) -> float:
323
+ ...
324
+ def getMoment(self) -> float:
325
+ ...
326
+ def getNext(self) -> Rigid:
327
+ ...
328
+ def getNextUnusedColor(self) -> int:
329
+ ...
330
+ def getNode(self) -> Node2D:
331
+ ...
332
+ def getPosition(self) -> glm.vec3:
333
+ ...
334
+ def getPrev(self) -> Rigid:
335
+ ...
336
+ def getPrevVelocity(self) -> glm.vec3:
337
+ ...
338
+ def getRadius(self) -> float:
339
+ ...
340
+ def getSatur(self) -> int:
341
+ ...
342
+ def getSize(self) -> glm.vec2:
343
+ ...
344
+ def getSolver(self) -> Solver:
345
+ ...
346
+ def getVel(self) -> glm.vec3:
347
+ ...
348
+ def getVelocity(self) -> glm.vec3:
349
+ ...
350
+ def incrSatur(self) -> None:
351
+ ...
352
+ def insert(self, arg0: ...) -> None:
353
+ ...
354
+ def isColorUsed(self, arg0: typing.SupportsInt) -> bool:
355
+ ...
356
+ def isColored(self) -> bool:
357
+ ...
358
+ def remove(self, arg0: ...) -> None:
359
+ ...
360
+ def reserveColors(self, arg0: typing.SupportsInt) -> None:
361
+ ...
362
+ def resetColoring(self) -> None:
363
+ ...
364
+ def setCollider(self, arg0: Collider) -> None:
365
+ ...
366
+ def setFriction(self, arg0: typing.SupportsFloat) -> None:
367
+ ...
368
+ def setInertial(self, arg0: glm.vec3) -> None:
369
+ ...
370
+ def setInitial(self, arg0: glm.vec3) -> None:
371
+ ...
372
+ def setMass(self, arg0: typing.SupportsFloat) -> None:
373
+ ...
374
+ def setMoment(self, arg0: typing.SupportsFloat) -> None:
375
+ ...
376
+ def setNode(self, arg0: Node2D) -> None:
377
+ ...
378
+ def setPosition(self, arg0: glm.vec3) -> None:
379
+ ...
380
+ def setPrevVelocity(self, arg0: glm.vec3) -> None:
381
+ ...
382
+ def setRadius(self, arg0: typing.SupportsFloat) -> None:
383
+ ...
384
+ def setScale(self, arg0: glm.vec2) -> None:
385
+ ...
386
+ def setVelocity(self, arg0: glm.vec3) -> None:
387
+ ...
388
+ def useColor(self, arg0: typing.SupportsInt) -> None:
389
+ ...
390
+ def verifyColoring(self) -> bool:
391
+ ...
392
+ class Scene:
393
+ def __init__(self, engine: Engine) -> None:
394
+ ...
395
+ def getCamera(self) -> ...:
396
+ ...
397
+ def getShader(self) -> ...:
398
+ ...
399
+ def render(self) -> None:
400
+ ...
401
+ def setCamera(self, camera: ...) -> None:
402
+ ...
403
+ def update(self) -> None:
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
+ ...
444
+ class Solver:
445
+ @staticmethod
446
+ def setGravity(*args, **kwargs) -> None:
447
+ ...
448
+ def __init__(self) -> None:
449
+ ...
450
+ def getAlpha(self) -> float:
451
+ ...
452
+ def getBeta(self) -> float:
453
+ ...
454
+ def getDt(self) -> float:
455
+ ...
456
+ def getGamma(self) -> float:
457
+ ...
458
+ def getGravity(self) -> ...:
459
+ ...
460
+ def getIterations(self) -> int:
461
+ ...
462
+ def getNumForces(self) -> int:
463
+ ...
464
+ def getNumRigids(self) -> int:
465
+ ...
466
+ def getPostStabilize(self) -> bool:
467
+ ...
468
+ @typing.overload
469
+ def insert(self, arg0: ...) -> None:
470
+ ...
471
+ @typing.overload
472
+ def insert(self, arg0: ...) -> None:
473
+ ...
474
+ @typing.overload
475
+ def remove(self, arg0: ...) -> None:
476
+ ...
477
+ @typing.overload
478
+ def remove(self, arg0: ...) -> None:
479
+ ...
480
+ def setAlpha(self, arg0: typing.SupportsFloat) -> None:
481
+ ...
482
+ def setBeta(self, arg0: typing.SupportsFloat) -> None:
483
+ ...
484
+ def setDt(self, arg0: typing.SupportsFloat) -> None:
485
+ ...
486
+ def setGamma(self, arg0: typing.SupportsFloat) -> None:
487
+ ...
488
+ def setIterations(self, arg0: typing.SupportsInt) -> None:
489
+ ...
490
+ def setPostStabilize(self, arg0: bool) -> None:
491
+ ...
492
+ class Spring(Force):
493
+ def __init__(self, solver: Solver, bodyA: Rigid, bodyB: Rigid, rA: glm.vec2, rB: glm.vec2, stiffness: typing.SupportsFloat, rest: typing.SupportsFloat = -1.0) -> None:
494
+ ...
495
+ def getRA(self) -> glm.vec2:
496
+ ...
497
+ def getRB(self) -> glm.vec2:
498
+ ...
499
+ def getRest(self) -> float:
500
+ ...
501
+ def setRA(self, arg0: glm.vec2) -> None:
502
+ ...
503
+ def setRB(self, arg0: glm.vec2) -> None:
504
+ ...
505
+ def setRest(self, arg0: typing.SupportsFloat) -> None:
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,15 @@
1
+ #version 330 core
2
+
3
+ in vec3 normal;
4
+ in vec2 uv;
5
+
6
+ uniform sampler2D uTexture;
7
+
8
+ out vec4 fragColor;
9
+
10
+ void main() {
11
+ vec3 globalLight = normalize(vec3(.5, 1, .25));
12
+ float brightness = (dot(normal, globalLight) + 1) / 2;
13
+
14
+ fragColor = brightness * texture(uTexture, uv);
15
+ }
@@ -0,0 +1,19 @@
1
+ #version 330 core
2
+
3
+ layout (location = 0) in vec3 vPosition;
4
+ layout (location = 1) in vec2 vUV;
5
+ layout (location = 2) in vec3 vNormal;
6
+
7
+ uniform mat4 uModel;
8
+ uniform mat4 uView;
9
+ uniform mat4 uProjection;
10
+
11
+ out vec2 uv;
12
+ out vec3 normal;
13
+
14
+ void main() {
15
+ normal = vNormal;
16
+ uv = vUV;
17
+
18
+ gl_Position = uProjection * uView * uModel * vec4(vPosition, 1.0);
19
+ }
@@ -0,0 +1,11 @@
1
+ #version 330 core
2
+
3
+ in vec2 uv;
4
+
5
+ uniform sampler2D uTexture;
6
+
7
+ out vec4 fragColor;
8
+
9
+ void main() {
10
+ fragColor = texture(uTexture, uv);
11
+ }
@@ -0,0 +1,16 @@
1
+ #version 330 core
2
+
3
+ layout (location = 0) in vec3 vPosition;
4
+ layout (location = 1) in vec2 vUV;
5
+
6
+
7
+ uniform mat4 uModel;
8
+ uniform mat4 uView;
9
+ uniform mat4 uProjection;
10
+
11
+ out vec2 uv;
12
+
13
+ void main() {
14
+ uv = vUV;
15
+ gl_Position = uProjection * uView * uModel * vec4(vPosition, 1.0);
16
+ }
@@ -0,0 +1,11 @@
1
+ #version 330 core
2
+
3
+ in vec2 uv;
4
+
5
+ uniform sampler2D uTexture;
6
+
7
+ out vec4 fragColor;
8
+
9
+ void main() {
10
+ fragColor = texture(uTexture, uv);
11
+ }
@@ -0,0 +1,11 @@
1
+ #version 330 core
2
+
3
+ layout (location = 0) in vec2 vPosition;
4
+ layout (location = 1) in vec2 vUV;
5
+
6
+ out vec2 uv;
7
+
8
+ void main() {
9
+ uv = vUV;
10
+ gl_Position = vec4(vPosition, 0.0, 1.0);
11
+ }
@@ -0,0 +1,52 @@
1
+ #version 330
2
+
3
+ uniform samplerBuffer materials;
4
+
5
+ struct Material {
6
+ vec3 color;
7
+
8
+ uint albedoArray;
9
+ uint albedoIndex;
10
+ uint normalArray;
11
+ uint normalIndex;
12
+
13
+ float roughness;
14
+ float subsurface;
15
+ float sheen;
16
+ float sheenTint;
17
+ float anisotropic;
18
+ float specular;
19
+ float metallicness;
20
+ float clearcoat;
21
+ float clearcoatGloss;
22
+ };
23
+
24
+ Material getMaterial(int index) {
25
+ Material m;
26
+
27
+ int N = 4; // N = (number of floats per material / 4)
28
+ int base = index * N;
29
+
30
+ vec4 v0 = texelFetch(materials, base + 0);
31
+ vec4 v1 = texelFetch(materials, base + 1);
32
+ vec4 v2 = texelFetch(materials, base + 2);
33
+ vec4 v3 = texelFetch(materials, base + 3);
34
+
35
+ // Unpack to struct fields:
36
+ m.color = v0.rgb;
37
+ m.albedoArray = floatBitsToUint(v0.a);
38
+ m.albedoIndex = floatBitsToUint(v1.x);
39
+ m.normalArray = floatBitsToUint(v1.y);
40
+ m.normalIndex = floatBitsToUint(v1.z);
41
+ m.roughness = v1.w;
42
+ m.subsurface = v2.x;
43
+ m.sheen = v2.y;
44
+ m.sheenTint = v2.z;
45
+ m.anisotropic = v2.w;
46
+ m.specular = v3.x;
47
+ m.metallicness = v3.y;
48
+ m.clearcoat = v3.z;
49
+ m.clearcoatGloss= v3.w;
50
+
51
+ return m;
52
+ }
@@ -0,0 +1,11 @@
1
+ #include "material.glsl"
2
+
3
+ struct textArray {
4
+ sampler2DArray array;
5
+ };
6
+
7
+ uniform textArray textureArrays[4];
8
+
9
+ vec4 getTextureValue(Material material, vec2 uv) {
10
+ return texture(textureArrays[material.albedoArray].array, vec3(uv, material.albedoIndex));
11
+ }