basilisk-engine 0.1.34__py3-none-any.whl → 0.1.36__py3-none-any.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 +26 -26
- basilisk/audio/sound.py +27 -27
- basilisk/bsk_assets/cube.obj +48 -48
- basilisk/collisions/broad/broad_aabb.py +102 -102
- basilisk/collisions/broad/broad_bvh.py +137 -137
- basilisk/collisions/collider.py +95 -95
- basilisk/collisions/collider_handler.py +225 -224
- basilisk/collisions/narrow/contact_manifold.py +95 -95
- basilisk/collisions/narrow/dataclasses.py +34 -34
- basilisk/collisions/narrow/deprecated.py +46 -46
- basilisk/collisions/narrow/epa.py +91 -91
- basilisk/collisions/narrow/gjk.py +66 -66
- basilisk/collisions/narrow/graham_scan.py +24 -24
- basilisk/collisions/narrow/helper.py +29 -29
- basilisk/collisions/narrow/line_intersections.py +106 -106
- basilisk/collisions/narrow/sutherland_hodgman.py +75 -75
- basilisk/config.py +54 -4
- basilisk/draw/draw.py +100 -100
- basilisk/draw/draw_handler.py +175 -175
- basilisk/draw/font_renderer.py +28 -28
- basilisk/engine.py +165 -165
- basilisk/generic/abstract_bvh.py +15 -15
- basilisk/generic/abstract_custom.py +133 -133
- basilisk/generic/collisions.py +70 -70
- basilisk/generic/input_validation.py +82 -74
- basilisk/generic/math.py +6 -6
- basilisk/generic/matrices.py +35 -35
- basilisk/generic/meshes.py +72 -72
- basilisk/generic/quat.py +142 -142
- basilisk/generic/quat_methods.py +7 -7
- basilisk/generic/raycast_result.py +26 -26
- basilisk/generic/vec3.py +143 -143
- basilisk/input_output/IO_handler.py +91 -91
- basilisk/input_output/clock.py +49 -49
- basilisk/input_output/keys.py +43 -43
- basilisk/input_output/mouse.py +90 -89
- basilisk/input_output/path.py +14 -14
- basilisk/mesh/cube.py +33 -33
- basilisk/mesh/mesh.py +233 -233
- basilisk/mesh/mesh_from_data.py +150 -150
- basilisk/mesh/model.py +271 -271
- basilisk/mesh/narrow_aabb.py +89 -89
- basilisk/mesh/narrow_bvh.py +91 -91
- basilisk/mesh/narrow_primative.py +23 -23
- basilisk/nodes/helper.py +28 -28
- basilisk/nodes/node.py +704 -695
- basilisk/nodes/node_handler.py +97 -97
- basilisk/particles/particle_handler.py +64 -64
- basilisk/particles/particle_renderer.py +92 -92
- basilisk/physics/impulse.py +112 -112
- basilisk/physics/physics_body.py +43 -43
- basilisk/physics/physics_engine.py +35 -35
- basilisk/render/batch.py +103 -103
- basilisk/render/bloom.py +108 -0
- basilisk/render/camera.py +260 -260
- basilisk/render/chunk.py +108 -106
- basilisk/render/chunk_handler.py +167 -165
- basilisk/render/frame.py +107 -95
- basilisk/render/framebuffer.py +203 -192
- basilisk/render/image.py +120 -120
- basilisk/render/image_handler.py +120 -120
- basilisk/render/light.py +96 -96
- basilisk/render/light_handler.py +58 -58
- basilisk/render/material.py +232 -221
- basilisk/render/material_handler.py +133 -133
- basilisk/render/post_process.py +139 -139
- basilisk/render/shader.py +134 -134
- basilisk/render/shader_handler.py +85 -83
- basilisk/render/sky.py +120 -120
- basilisk/scene.py +289 -289
- basilisk/shaders/batch.frag +289 -276
- basilisk/shaders/batch.vert +117 -115
- basilisk/shaders/bloom_downsample.frag +43 -0
- basilisk/shaders/bloom_frame.frag +25 -0
- basilisk/shaders/bloom_upsample.frag +34 -0
- basilisk/shaders/crt.frag +31 -31
- basilisk/shaders/draw.frag +25 -22
- basilisk/shaders/draw.vert +25 -25
- basilisk/shaders/filter.frag +22 -22
- basilisk/shaders/frame.frag +12 -12
- basilisk/shaders/frame.vert +13 -13
- basilisk/shaders/geometry.frag +8 -8
- basilisk/shaders/geometry.vert +41 -41
- basilisk/shaders/normal.frag +59 -59
- basilisk/shaders/normal.vert +96 -96
- basilisk/shaders/particle.frag +71 -71
- basilisk/shaders/particle.vert +84 -84
- basilisk/shaders/sky.frag +23 -9
- basilisk/shaders/sky.vert +13 -13
- basilisk_engine-0.1.36.dist-info/METADATA +89 -0
- basilisk_engine-0.1.36.dist-info/RECORD +110 -0
- {basilisk_engine-0.1.34.dist-info → basilisk_engine-0.1.36.dist-info}/WHEEL +1 -1
- basilisk/input/__init__.py +0 -0
- basilisk/input/mouse.py +0 -62
- basilisk/input/path.py +0 -14
- basilisk_engine-0.1.34.dist-info/METADATA +0 -45
- basilisk_engine-0.1.34.dist-info/RECORD +0 -109
- {basilisk_engine-0.1.34.dist-info → basilisk_engine-0.1.36.dist-info}/top_level.txt +0 -0
basilisk/shaders/batch.vert
CHANGED
|
@@ -1,116 +1,118 @@
|
|
|
1
|
-
#version 330 core
|
|
2
|
-
|
|
3
|
-
layout (location = 0) in vec3 in_position;
|
|
4
|
-
layout (location = 1) in vec2 in_uv;
|
|
5
|
-
layout (location = 2) in vec3 in_normal;
|
|
6
|
-
layout (location = 3) in vec3 in_tangent;
|
|
7
|
-
layout (location = 4) in vec3 in_bitangent;
|
|
8
|
-
|
|
9
|
-
layout (location = 5) in vec3 obj_position;
|
|
10
|
-
layout (location = 6) in vec4 obj_rotation;
|
|
11
|
-
layout (location = 7) in vec3 obj_scale;
|
|
12
|
-
layout (location = 8) in float obj_material;
|
|
13
|
-
|
|
14
|
-
// Variables passed on to the fragment shader
|
|
15
|
-
out vec2 uv;
|
|
16
|
-
out vec3 position;
|
|
17
|
-
out mat3 TBN;
|
|
18
|
-
|
|
19
|
-
// Material struct sent to fragment shader
|
|
20
|
-
struct Material {
|
|
21
|
-
vec3 color;
|
|
22
|
-
|
|
23
|
-
float
|
|
24
|
-
float
|
|
25
|
-
float
|
|
26
|
-
float
|
|
27
|
-
float
|
|
28
|
-
float
|
|
29
|
-
float
|
|
30
|
-
float
|
|
31
|
-
float
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
uniform mat4
|
|
47
|
-
uniform
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
0 ,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
2 * (rot.
|
|
60
|
-
2 * (rot.y * rot.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
0 ,
|
|
67
|
-
0 , 0 , 0
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
vec3
|
|
76
|
-
vec3
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
int
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
mtl.
|
|
95
|
-
mtl.
|
|
96
|
-
mtl.
|
|
97
|
-
mtl.
|
|
98
|
-
mtl.
|
|
99
|
-
mtl.
|
|
100
|
-
mtl.
|
|
101
|
-
mtl.
|
|
102
|
-
mtl.
|
|
103
|
-
mtl.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
mtl.
|
|
107
|
-
mtl.
|
|
108
|
-
mtl.
|
|
109
|
-
mtl.
|
|
110
|
-
mtl.
|
|
111
|
-
mtl.
|
|
112
|
-
mtl.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
1
|
+
#version 330 core
|
|
2
|
+
|
|
3
|
+
layout (location = 0) in vec3 in_position;
|
|
4
|
+
layout (location = 1) in vec2 in_uv;
|
|
5
|
+
layout (location = 2) in vec3 in_normal;
|
|
6
|
+
layout (location = 3) in vec3 in_tangent;
|
|
7
|
+
layout (location = 4) in vec3 in_bitangent;
|
|
8
|
+
|
|
9
|
+
layout (location = 5) in vec3 obj_position;
|
|
10
|
+
layout (location = 6) in vec4 obj_rotation;
|
|
11
|
+
layout (location = 7) in vec3 obj_scale;
|
|
12
|
+
layout (location = 8) in float obj_material;
|
|
13
|
+
|
|
14
|
+
// Variables passed on to the fragment shader
|
|
15
|
+
out vec2 uv;
|
|
16
|
+
out vec3 position;
|
|
17
|
+
out mat3 TBN;
|
|
18
|
+
|
|
19
|
+
// Material struct sent to fragment shader
|
|
20
|
+
struct Material {
|
|
21
|
+
vec3 color;
|
|
22
|
+
vec3 emissiveColor;
|
|
23
|
+
float roughness;
|
|
24
|
+
float subsurface;
|
|
25
|
+
float sheen;
|
|
26
|
+
float sheenTint;
|
|
27
|
+
float anisotropic;
|
|
28
|
+
float specular;
|
|
29
|
+
float metallicness;
|
|
30
|
+
float specularTint;
|
|
31
|
+
float clearcoat;
|
|
32
|
+
float clearcoatGloss;
|
|
33
|
+
|
|
34
|
+
int hasAlbedoMap;
|
|
35
|
+
vec2 albedoMap;
|
|
36
|
+
int hasNormalMap;
|
|
37
|
+
vec2 normalMap;
|
|
38
|
+
int hasRoughnessMap;
|
|
39
|
+
vec2 roughnessMap;
|
|
40
|
+
int hasAoMap;
|
|
41
|
+
vec2 aoMap;
|
|
42
|
+
};
|
|
43
|
+
flat out Material mtl;
|
|
44
|
+
|
|
45
|
+
// Uniforms
|
|
46
|
+
uniform mat4 projectionMatrix;
|
|
47
|
+
uniform mat4 viewMatrix;
|
|
48
|
+
uniform sampler2D materialsTexture;
|
|
49
|
+
|
|
50
|
+
// Function to get the model matrix from node position, rotation, and scale
|
|
51
|
+
mat4 getModelMatrix(vec3 pos, vec4 rot, vec3 scl) {
|
|
52
|
+
mat4 translation = mat4(
|
|
53
|
+
1 , 0 , 0 , 0,
|
|
54
|
+
0 , 1 , 0 , 0,
|
|
55
|
+
0 , 0 , 1 , 0,
|
|
56
|
+
pos.x, pos.y, pos.z, 1
|
|
57
|
+
);
|
|
58
|
+
mat4 rotation = mat4(
|
|
59
|
+
1 - 2 * (rot.z * rot.z + rot.w * rot.w), 2 * (rot.y * rot.z - rot.w * rot.x), 2 * (rot.y * rot.w + rot.z * rot.x), 0,
|
|
60
|
+
2 * (rot.y * rot.z + rot.w * rot.x), 1 - 2 * (rot.y * rot.y + rot.w * rot.w), 2 * (rot.z * rot.w - rot.y * rot.x), 0,
|
|
61
|
+
2 * (rot.y * rot.w - rot.z * rot.x), 2 * (rot.z * rot.w + rot.y * rot.x), 1 - 2 * (rot.y * rot.y + rot.z * rot.z), 0,
|
|
62
|
+
0, 0, 0, 1
|
|
63
|
+
);
|
|
64
|
+
mat4 scale = mat4(
|
|
65
|
+
scl.x, 0 , 0 , 0,
|
|
66
|
+
0 , scl.y, 0 , 0,
|
|
67
|
+
0 , 0 , scl.z, 0,
|
|
68
|
+
0 , 0 , 0 , 1
|
|
69
|
+
);
|
|
70
|
+
return translation * rotation * scale;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Function to get the TBN matrix for normal mapping
|
|
74
|
+
mat3 getTBN(mat4 modelMatrix, vec3 normal, vec3 tangent, vec3 bitangent){
|
|
75
|
+
vec3 T = normalize(vec3(modelMatrix * vec4(tangent, 0.0)));
|
|
76
|
+
vec3 B = normalize(vec3(modelMatrix * vec4(bitangent, 0.0)));
|
|
77
|
+
vec3 N = normalize(vec3(modelMatrix * vec4(normal, 0.0)));
|
|
78
|
+
return mat3(T, B, N);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
void main() {
|
|
82
|
+
// Set the model matrix
|
|
83
|
+
mat4 modelMatrix = getModelMatrix(obj_position, obj_rotation, obj_scale);
|
|
84
|
+
|
|
85
|
+
// Set out variables
|
|
86
|
+
position = (modelMatrix * vec4(in_position, 1.0)).xyz;
|
|
87
|
+
TBN = getTBN(modelMatrix, in_normal, in_tangent, in_bitangent);
|
|
88
|
+
uv = in_uv;
|
|
89
|
+
|
|
90
|
+
// Get the material
|
|
91
|
+
int mtl_size = 28;
|
|
92
|
+
int materialID = int(obj_material);
|
|
93
|
+
|
|
94
|
+
mtl.color = vec3(texelFetch(materialsTexture, ivec2(0, 0 + materialID * mtl_size), 0).r, texelFetch(materialsTexture, ivec2(0, 1 + materialID * mtl_size), 0).r, texelFetch(materialsTexture, ivec2(0, 2 + materialID * mtl_size), 0).r);
|
|
95
|
+
mtl.roughness = texelFetch(materialsTexture, ivec2(0, 3 + materialID * mtl_size), 0).r;
|
|
96
|
+
mtl.subsurface = texelFetch(materialsTexture, ivec2(0, 4 + materialID * mtl_size), 0).r;
|
|
97
|
+
mtl.sheen = texelFetch(materialsTexture, ivec2(0, 5 + materialID * mtl_size), 0).r;
|
|
98
|
+
mtl.sheenTint = texelFetch(materialsTexture, ivec2(0, 6 + materialID * mtl_size), 0).r;
|
|
99
|
+
mtl.anisotropic = texelFetch(materialsTexture, ivec2(0, 7 + materialID * mtl_size), 0).r;
|
|
100
|
+
mtl.specular = texelFetch(materialsTexture, ivec2(0, 8 + materialID * mtl_size), 0).r;
|
|
101
|
+
mtl.metallicness = texelFetch(materialsTexture, ivec2(0, 9 + materialID * mtl_size), 0).r;
|
|
102
|
+
mtl.specularTint = texelFetch(materialsTexture, ivec2(0, 10 + materialID * mtl_size), 0).r;
|
|
103
|
+
mtl.clearcoat = texelFetch(materialsTexture, ivec2(0, 11 + materialID * mtl_size), 0).r;
|
|
104
|
+
mtl.clearcoatGloss = texelFetch(materialsTexture, ivec2(0, 12 + materialID * mtl_size), 0).r;
|
|
105
|
+
|
|
106
|
+
mtl.hasAlbedoMap = int(texelFetch(materialsTexture, ivec2(0, 13 + materialID * mtl_size), 0).r);
|
|
107
|
+
mtl.albedoMap = vec2(texelFetch(materialsTexture, ivec2(0, 14 + materialID * mtl_size), 0).r, texelFetch(materialsTexture, ivec2(0, 15 + materialID * mtl_size), 0).r);
|
|
108
|
+
mtl.hasNormalMap = int(texelFetch(materialsTexture, ivec2(0, 16 + materialID * mtl_size), 0).r);
|
|
109
|
+
mtl.normalMap = vec2(texelFetch(materialsTexture, ivec2(0, 17 + materialID * mtl_size), 0).r, texelFetch(materialsTexture, ivec2(0, 18 + materialID * mtl_size), 0).r);
|
|
110
|
+
mtl.hasRoughnessMap = int(texelFetch(materialsTexture, ivec2(0, 19 + materialID * mtl_size), 0).r);
|
|
111
|
+
mtl.roughnessMap = vec2(texelFetch(materialsTexture, ivec2(0, 20 + materialID * mtl_size), 0).r, texelFetch(materialsTexture, ivec2(0, 21 + materialID * mtl_size), 0).r);
|
|
112
|
+
mtl.hasAoMap = int(texelFetch(materialsTexture, ivec2(0, 22 + materialID * mtl_size), 0).r);
|
|
113
|
+
mtl.aoMap = vec2(texelFetch(materialsTexture, ivec2(0, 23 + materialID * mtl_size), 0).r, texelFetch(materialsTexture, ivec2(0, 24 + materialID * mtl_size), 0).r);
|
|
114
|
+
mtl.emissiveColor = vec3(texelFetch(materialsTexture, ivec2(0, 25 + materialID * mtl_size), 0).r, texelFetch(materialsTexture, ivec2(0, 26 + materialID * mtl_size), 0).r, texelFetch(materialsTexture, ivec2(0, 27 + materialID * mtl_size), 0).r);
|
|
115
|
+
|
|
116
|
+
// Set the fragment position
|
|
117
|
+
gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(in_position, 1.0);
|
|
116
118
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#version 330 core
|
|
2
|
+
|
|
3
|
+
out vec4 fragColor;
|
|
4
|
+
|
|
5
|
+
in vec2 uv;
|
|
6
|
+
|
|
7
|
+
uniform sampler2D screenTexture;
|
|
8
|
+
uniform ivec2 textureSize;
|
|
9
|
+
|
|
10
|
+
void main()
|
|
11
|
+
{
|
|
12
|
+
|
|
13
|
+
vec2 texelSize = 1.0 / textureSize;
|
|
14
|
+
|
|
15
|
+
vec4 color = vec4(0.0);
|
|
16
|
+
|
|
17
|
+
// Basic 2x2 downsampling (averaging)
|
|
18
|
+
color += texture(screenTexture, clamp(uv + vec2(-texelSize.x, -texelSize.y), 0.0, 0.9999));
|
|
19
|
+
color += texture(screenTexture, clamp(uv + vec2( texelSize.x, -texelSize.y), 0.0, 0.9999));
|
|
20
|
+
color += texture(screenTexture, clamp(uv + vec2(-texelSize.x, texelSize.y), 0.0, 0.9999));
|
|
21
|
+
color += texture(screenTexture, clamp(uv + vec2( texelSize.x, texelSize.y), 0.0, 0.9999));
|
|
22
|
+
|
|
23
|
+
fragColor = color / 4.0; // Average the four samples
|
|
24
|
+
|
|
25
|
+
// vec2 texelSize = 1.0 / textureSize;
|
|
26
|
+
|
|
27
|
+
// vec4 color = vec4(0.0);
|
|
28
|
+
|
|
29
|
+
// // Basic 2x2 upsample (averaging)
|
|
30
|
+
// color += texture(screenTexture, uv + vec2(1, 1) * texelSize);
|
|
31
|
+
// color += texture(screenTexture, uv + vec2(1, 0) * texelSize) * 2.0;
|
|
32
|
+
// color += texture(screenTexture, uv + vec2(1, -1) * texelSize);
|
|
33
|
+
|
|
34
|
+
// color += texture(screenTexture, uv + vec2(0, 1) * texelSize) * 2.0;
|
|
35
|
+
// color += texture(screenTexture, uv + vec2(0, 0) * texelSize) * 4.0;
|
|
36
|
+
// color += texture(screenTexture, uv + vec2(0, -1) * texelSize) * 2.0;
|
|
37
|
+
|
|
38
|
+
// color += texture(screenTexture, uv + vec2(-1, 1) * texelSize);
|
|
39
|
+
// color += texture(screenTexture, uv + vec2(-1, 0) * texelSize) * 2.0;
|
|
40
|
+
// color += texture(screenTexture, uv + vec2(-1, -1) * texelSize);
|
|
41
|
+
|
|
42
|
+
// fragColor = color / 16.0; // Average the four samples
|
|
43
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#version 330 core
|
|
2
|
+
|
|
3
|
+
out vec4 fragColor;
|
|
4
|
+
|
|
5
|
+
in vec2 uv;
|
|
6
|
+
|
|
7
|
+
uniform sampler2D screenTexture;
|
|
8
|
+
uniform sampler2D bloomTexture;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
void main()
|
|
13
|
+
{
|
|
14
|
+
const float gamma = 2.2;
|
|
15
|
+
const float exposure = 1.2;
|
|
16
|
+
vec3 hdrColor = texture(screenTexture, uv).rgb + texture(bloomTexture, uv).rgb / 2;
|
|
17
|
+
|
|
18
|
+
// exposure tone mapping
|
|
19
|
+
vec3 mapped = vec3(1.0) - exp(-hdrColor * exposure);
|
|
20
|
+
// gamma correction
|
|
21
|
+
mapped = pow(mapped, vec3(1.0 / gamma));
|
|
22
|
+
|
|
23
|
+
fragColor = vec4(mapped, 1.0);
|
|
24
|
+
//fragColor = texture(screenTexture, uv) + texture(bloomTexture, uv) / 20000.0;
|
|
25
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#version 330 core
|
|
2
|
+
|
|
3
|
+
out vec4 fragColor;
|
|
4
|
+
|
|
5
|
+
in vec2 uv;
|
|
6
|
+
|
|
7
|
+
uniform sampler2D highTexture;
|
|
8
|
+
uniform sampler2D lowTexture;
|
|
9
|
+
|
|
10
|
+
uniform ivec2 textureSize;
|
|
11
|
+
|
|
12
|
+
void main()
|
|
13
|
+
{
|
|
14
|
+
|
|
15
|
+
vec2 texelSize = 1.0 / textureSize;
|
|
16
|
+
|
|
17
|
+
vec4 color = vec4(0.0);
|
|
18
|
+
|
|
19
|
+
// Basic 2x2 upsample (averaging)
|
|
20
|
+
color += texture(lowTexture, clamp(uv + vec2( 1, 1) * texelSize, 0.0, 0.9999));
|
|
21
|
+
color += texture(lowTexture, clamp(uv + vec2( 1, 0) * texelSize, 0.0, 0.9999)) * 2.0;
|
|
22
|
+
color += texture(lowTexture, clamp(uv + vec2( 1, -1) * texelSize, 0.0, 0.9999));
|
|
23
|
+
|
|
24
|
+
color += texture(lowTexture, clamp(uv + vec2( 0, 1) * texelSize, 0.0, 0.9999)) * 2.0;
|
|
25
|
+
color += texture(lowTexture, clamp(uv + vec2( 0, 0) * texelSize, 0.0, 0.9999)) * 4.0;
|
|
26
|
+
color += texture(lowTexture, clamp(uv + vec2( 0, -1) * texelSize, 0.0, 0.9999)) * 2.0;
|
|
27
|
+
|
|
28
|
+
color += texture(lowTexture, clamp(uv + vec2(-1, 1) * texelSize, 0.0, 0.9999));
|
|
29
|
+
color += texture(lowTexture, clamp(uv + vec2(-1, 0) * texelSize, 0.0, 0.9999)) * 2.0;
|
|
30
|
+
color += texture(lowTexture, clamp(uv + vec2(-1, -1) * texelSize, 0.0, 0.9999));
|
|
31
|
+
|
|
32
|
+
fragColor = texture(highTexture, uv) + color / 16.0; // Average the four samples
|
|
33
|
+
|
|
34
|
+
}
|
basilisk/shaders/crt.frag
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
#version 330 core
|
|
2
|
-
|
|
3
|
-
out vec4 fragColor;
|
|
4
|
-
|
|
5
|
-
in vec2 uv;
|
|
6
|
-
|
|
7
|
-
uniform sampler2D screenTexture;
|
|
8
|
-
|
|
9
|
-
float warp = 0.75; // simulate curvature of CRT monitor
|
|
10
|
-
float scan = 0.75; // simulate darkness between scanlines
|
|
11
|
-
|
|
12
|
-
void main(){
|
|
13
|
-
// squared distance from center
|
|
14
|
-
vec2 crt_uv = uv;
|
|
15
|
-
vec2 dc = abs(0.5-uv);
|
|
16
|
-
dc *= dc;
|
|
17
|
-
|
|
18
|
-
// warp the fragment coordinates
|
|
19
|
-
crt_uv.x -= 0.5; crt_uv.x *= 1.0+(dc.y*(0.3*warp)); crt_uv.x += 0.5;
|
|
20
|
-
crt_uv.y -= 0.5; crt_uv.y *= 1.0+(dc.x*(0.4*warp)); crt_uv.y += 0.5;
|
|
21
|
-
|
|
22
|
-
// sample inside boundaries, otherwise set to black
|
|
23
|
-
if (crt_uv.y > 1.0 || crt_uv.x < 0.0 || crt_uv.x > 1.0 || crt_uv.y < 0.0) {
|
|
24
|
-
fragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
// determine if we are drawing in a scanline
|
|
28
|
-
float apply = abs(sin(crt_uv.y * 300)*0.5*scan);
|
|
29
|
-
//sample the texture
|
|
30
|
-
fragColor = vec4(mix(texture(screenTexture, crt_uv).rgb,vec3(0.0), apply), 1.0);
|
|
31
|
-
}
|
|
1
|
+
#version 330 core
|
|
2
|
+
|
|
3
|
+
out vec4 fragColor;
|
|
4
|
+
|
|
5
|
+
in vec2 uv;
|
|
6
|
+
|
|
7
|
+
uniform sampler2D screenTexture;
|
|
8
|
+
|
|
9
|
+
float warp = 0.75; // simulate curvature of CRT monitor
|
|
10
|
+
float scan = 0.75; // simulate darkness between scanlines
|
|
11
|
+
|
|
12
|
+
void main(){
|
|
13
|
+
// squared distance from center
|
|
14
|
+
vec2 crt_uv = uv;
|
|
15
|
+
vec2 dc = abs(0.5-uv);
|
|
16
|
+
dc *= dc;
|
|
17
|
+
|
|
18
|
+
// warp the fragment coordinates
|
|
19
|
+
crt_uv.x -= 0.5; crt_uv.x *= 1.0+(dc.y*(0.3*warp)); crt_uv.x += 0.5;
|
|
20
|
+
crt_uv.y -= 0.5; crt_uv.y *= 1.0+(dc.x*(0.4*warp)); crt_uv.y += 0.5;
|
|
21
|
+
|
|
22
|
+
// sample inside boundaries, otherwise set to black
|
|
23
|
+
if (crt_uv.y > 1.0 || crt_uv.x < 0.0 || crt_uv.x > 1.0 || crt_uv.y < 0.0) {
|
|
24
|
+
fragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
// determine if we are drawing in a scanline
|
|
28
|
+
float apply = abs(sin(crt_uv.y * 300)*0.5*scan);
|
|
29
|
+
//sample the texture
|
|
30
|
+
fragColor = vec4(mix(texture(screenTexture, crt_uv).rgb,vec3(0.0), apply), 1.0);
|
|
31
|
+
}
|
|
32
32
|
}
|
basilisk/shaders/draw.frag
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
#version 330 core
|
|
2
|
-
|
|
3
|
-
layout (location = 0) out vec4 fragColor;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
in
|
|
8
|
-
in
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
#version 330 core
|
|
2
|
+
|
|
3
|
+
layout (location = 0) out vec4 fragColor;
|
|
4
|
+
layout (location = 1) out vec4 bloomColor;
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
in vec4 color;
|
|
8
|
+
in vec2 imageIndex;
|
|
9
|
+
in vec2 uv;
|
|
10
|
+
in float alpha;
|
|
11
|
+
flat in int usesImage;
|
|
12
|
+
|
|
13
|
+
struct textArray {
|
|
14
|
+
sampler2DArray array;
|
|
15
|
+
};
|
|
16
|
+
uniform textArray textureArrays[5];
|
|
17
|
+
|
|
18
|
+
void main() {
|
|
19
|
+
if (bool(usesImage)) {
|
|
20
|
+
fragColor = texture(textureArrays[int(round(imageIndex.x))].array, vec3(uv, round(imageIndex.y))) * alpha;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
fragColor = color;
|
|
24
|
+
}
|
|
25
|
+
bloomColor = vec4(0.0);
|
|
23
26
|
}
|
basilisk/shaders/draw.vert
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
#version 330 core
|
|
2
|
-
|
|
3
|
-
layout (location = 0) in vec2 in_position;
|
|
4
|
-
layout (location = 1) in vec4 in_color;
|
|
5
|
-
layout (location = 2) in int in_uses_image;
|
|
6
|
-
layout (location = 3) in float in_alpha;
|
|
7
|
-
|
|
8
|
-
out vec4 color;
|
|
9
|
-
out vec2 imageIndex;
|
|
10
|
-
out float alpha;
|
|
11
|
-
out vec2 uv;
|
|
12
|
-
flat out int usesImage;
|
|
13
|
-
|
|
14
|
-
void main() {
|
|
15
|
-
usesImage = in_uses_image;
|
|
16
|
-
if (bool(in_uses_image)) {
|
|
17
|
-
imageIndex = in_color.xy;
|
|
18
|
-
uv = in_color.zw;
|
|
19
|
-
alpha = in_alpha;
|
|
20
|
-
}
|
|
21
|
-
else{
|
|
22
|
-
color = in_color;
|
|
23
|
-
alpha = 1.0;
|
|
24
|
-
}
|
|
25
|
-
gl_Position = vec4(in_position.x, -in_position.y, 0.0, 1.0);
|
|
1
|
+
#version 330 core
|
|
2
|
+
|
|
3
|
+
layout (location = 0) in vec2 in_position;
|
|
4
|
+
layout (location = 1) in vec4 in_color;
|
|
5
|
+
layout (location = 2) in int in_uses_image;
|
|
6
|
+
layout (location = 3) in float in_alpha;
|
|
7
|
+
|
|
8
|
+
out vec4 color;
|
|
9
|
+
out vec2 imageIndex;
|
|
10
|
+
out float alpha;
|
|
11
|
+
out vec2 uv;
|
|
12
|
+
flat out int usesImage;
|
|
13
|
+
|
|
14
|
+
void main() {
|
|
15
|
+
usesImage = in_uses_image;
|
|
16
|
+
if (bool(in_uses_image)) {
|
|
17
|
+
imageIndex = in_color.xy;
|
|
18
|
+
uv = in_color.zw;
|
|
19
|
+
alpha = in_alpha;
|
|
20
|
+
}
|
|
21
|
+
else{
|
|
22
|
+
color = in_color;
|
|
23
|
+
alpha = 1.0;
|
|
24
|
+
}
|
|
25
|
+
gl_Position = vec4(in_position.x, -in_position.y, 0.0, 1.0);
|
|
26
26
|
}
|
basilisk/shaders/filter.frag
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
#version 330 core
|
|
2
|
-
|
|
3
|
-
out vec4 fragColor;
|
|
4
|
-
|
|
5
|
-
in vec2 uv;
|
|
6
|
-
|
|
7
|
-
uniform sampler2D screenTexture;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
void main()
|
|
11
|
-
{
|
|
12
|
-
vec2 direction = normalize(vec2(1.0, 1.0));
|
|
13
|
-
float magnitude = 0.6;
|
|
14
|
-
float redOffset = 0.009 * magnitude;
|
|
15
|
-
float greenOffset = 0.006 * magnitude;
|
|
16
|
-
float blueOffset = -0.006 * magnitude;
|
|
17
|
-
|
|
18
|
-
float r = texture(screenTexture, uv + direction * redOffset).r;
|
|
19
|
-
float g = texture(screenTexture, uv + direction * greenOffset).g;
|
|
20
|
-
float b = texture(screenTexture, uv + direction * blueOffset).b;
|
|
21
|
-
|
|
22
|
-
fragColor = vec4(r, g, b, 1.0);
|
|
1
|
+
#version 330 core
|
|
2
|
+
|
|
3
|
+
out vec4 fragColor;
|
|
4
|
+
|
|
5
|
+
in vec2 uv;
|
|
6
|
+
|
|
7
|
+
uniform sampler2D screenTexture;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
void main()
|
|
11
|
+
{
|
|
12
|
+
vec2 direction = normalize(vec2(1.0, 1.0));
|
|
13
|
+
float magnitude = 0.6;
|
|
14
|
+
float redOffset = 0.009 * magnitude;
|
|
15
|
+
float greenOffset = 0.006 * magnitude;
|
|
16
|
+
float blueOffset = -0.006 * magnitude;
|
|
17
|
+
|
|
18
|
+
float r = texture(screenTexture, uv + direction * redOffset).r;
|
|
19
|
+
float g = texture(screenTexture, uv + direction * greenOffset).g;
|
|
20
|
+
float b = texture(screenTexture, uv + direction * blueOffset).b;
|
|
21
|
+
|
|
22
|
+
fragColor = vec4(r, g, b, 1.0);
|
|
23
23
|
}
|
basilisk/shaders/frame.frag
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
#version 330 core
|
|
2
|
-
|
|
3
|
-
out vec4 fragColor;
|
|
4
|
-
|
|
5
|
-
in vec2 uv;
|
|
6
|
-
|
|
7
|
-
uniform sampler2D screenTexture;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
void main()
|
|
11
|
-
{
|
|
12
|
-
fragColor = texture(screenTexture, uv);
|
|
1
|
+
#version 330 core
|
|
2
|
+
|
|
3
|
+
out vec4 fragColor;
|
|
4
|
+
|
|
5
|
+
in vec2 uv;
|
|
6
|
+
|
|
7
|
+
uniform sampler2D screenTexture;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
void main()
|
|
11
|
+
{
|
|
12
|
+
fragColor = texture(screenTexture, uv);
|
|
13
13
|
}
|
basilisk/shaders/frame.vert
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
#version 330 core
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
layout (location = 0) in vec3 in_position;
|
|
5
|
-
layout (location = 1) in vec2 in_uv;
|
|
6
|
-
|
|
7
|
-
out vec2 uv;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
void main()
|
|
11
|
-
{
|
|
12
|
-
gl_Position = vec4(in_position.x, in_position.y, 0.0, 1.0);
|
|
13
|
-
uv = in_uv;
|
|
1
|
+
#version 330 core
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
layout (location = 0) in vec3 in_position;
|
|
5
|
+
layout (location = 1) in vec2 in_uv;
|
|
6
|
+
|
|
7
|
+
out vec2 uv;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
void main()
|
|
11
|
+
{
|
|
12
|
+
gl_Position = vec4(in_position.x, in_position.y, 0.0, 1.0);
|
|
13
|
+
uv = in_uv;
|
|
14
14
|
}
|
basilisk/shaders/geometry.frag
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#version 330 core
|
|
2
|
-
|
|
3
|
-
layout (location = 0) out vec4 fragColor;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
void main() {
|
|
7
|
-
// Output fragment color
|
|
8
|
-
fragColor = vec4(1.0, 1.0, 1.0, 1.0);
|
|
1
|
+
#version 330 core
|
|
2
|
+
|
|
3
|
+
layout (location = 0) out vec4 fragColor;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
void main() {
|
|
7
|
+
// Output fragment color
|
|
8
|
+
fragColor = vec4(1.0, 1.0, 1.0, 1.0);
|
|
9
9
|
}
|