Skip to content

Commit dce251d

Browse files
authored
Merge pull request #85 from nicoabie/zig-14
Updating to Zig 0.14
2 parents 36b839d + 7533a1e commit dce251d

202 files changed

Lines changed: 18161 additions & 3899 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ zig-cache
22
.zig-cache
33
zig-out
44
.DS_Store
5+
tools/sokol-shdc

.zigversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.13.0
1+
0.14.0

3rdparty/cimgui/build.zig

Lines changed: 0 additions & 66 deletions
This file was deleted.

3rdparty/cimgui/build.zig.zon

Lines changed: 0 additions & 18 deletions
This file was deleted.

3rdparty/system-sdk/build.zig.zon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.{
2-
.name = "system-sdk",
2+
.name = .system_sdk,
33
.version = "0.1.0",
44
.paths = .{
55
"build.zig",

3rdparty/zaudio/build.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub fn build(b: *std.Build) void {
3737

3838
miniaudio.addCSourceFile(.{
3939
.file = b.path("src/zaudio.c"),
40-
.flags = &.{if (target.result.isWasm()) "-std=gnu99" else "-std=c99"}, // DELVE FRAMEWORK EDIT: Need gnu99 for web audio
40+
.flags = &.{if (target.result.cpu.arch.isWasm()) "-std=gnu99" else "-std=c99"}, // DELVE FRAMEWORK EDIT: Need gnu99 for web audio
4141
});
4242
miniaudio.addCSourceFile(.{
4343
.file = b.path("libs/miniaudio/miniaudio.c"),
@@ -48,7 +48,7 @@ pub fn build(b: *std.Build) void {
4848
"-DMA_NO_JACK",
4949
"-DMA_NO_DSOUND",
5050
"-DMA_NO_WINMM",
51-
if (target.result.isWasm()) "-std=gnu99" else "-std=c99", // DELVE FRAMEWORK EDIT: Need gnu99 for web audio
51+
if (target.result.cpu.arch.isWasm()) "-std=gnu99" else "-std=c99", // DELVE FRAMEWORK EDIT: Need gnu99 for web audio
5252
"-fno-sanitize=undefined",
5353
if (target.result.os.tag == .macos) "-DMA_NO_RUNTIME_LINKING" else "",
5454
},

3rdparty/zmesh/build.zig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,17 @@ pub fn build(b: *std.Build) void {
3232
});
3333

3434
const zmesh_lib = if (options.shared) blk: {
35+
// TODO addLibrary
3536
const lib = b.addSharedLibrary(.{
3637
.name = "zmesh",
3738
.target = target,
3839
.optimize = optimize,
3940
});
4041

4142
if (target.result.os.tag == .windows) {
42-
lib.defineCMacro("CGLTF_API", "__declspec(dllexport)");
43-
lib.defineCMacro("MESHOPTIMIZER_API", "__declspec(dllexport)");
44-
lib.defineCMacro("ZMESH_API", "__declspec(dllexport)");
43+
lib.root_module.addCMacro("CGLTF_API", "__declspec(dllexport)");
44+
lib.root_module.addCMacro("MESHOPTIMIZER_API", "__declspec(dllexport)");
45+
lib.root_module.addCMacro("ZMESH_API", "__declspec(dllexport)");
4546
}
4647

4748
break :blk lib;

3rdparty/zmesh/src/zcgltf.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ pub const BufferView = extern struct {
211211
size: usize,
212212
stride: usize, // 0 == automatically determined by accessor
213213
view_type: BufferViewType,
214-
data: ?*anyopaque, // overrides buffer.data if present, filled by extensions
214+
override_data: ?*anyopaque, // overrides buffer.data if present, filled by extensions
215215
has_meshopt_compression: Bool32,
216216
meshopt_compression: MeshoptCompression,
217217
extras: Extras,

assets/shaders/basic-lighting.glsl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#pragma sokol @ctype mat4 m.Mat4
99

1010
#pragma sokol @vs vs
11-
uniform vs_params {
11+
layout(binding=0) uniform vs_params {
1212
mat4 u_projViewMatrix;
1313
mat4 u_modelMatrix;
1414
vec4 u_color;
@@ -40,11 +40,11 @@ void main() {
4040
#pragma sokol @end
4141

4242
#pragma sokol @fs fs
43-
uniform texture2D tex;
44-
uniform texture2D tex_emissive;
45-
uniform sampler smp;
43+
layout(binding=0) uniform texture2D tex;
44+
layout(binding=1) uniform texture2D tex_emissive;
45+
layout(binding=0) uniform sampler smp;
4646

47-
uniform fs_params {
47+
layout(binding=1) uniform fs_params {
4848
vec4 u_cameraPos;
4949
vec4 u_color_override;
5050
float u_alpha_cutoff;
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#version 300 es
2+
precision mediump float;
3+
precision highp int;
4+
5+
uniform highp vec4 fs_params[41];
6+
uniform highp sampler2D tex_smp;
7+
uniform highp sampler2D tex_emissive_smp;
8+
9+
in highp vec2 uv;
10+
in highp vec4 color;
11+
in highp vec4 position;
12+
in highp vec3 normal;
13+
layout(location = 0) out highp vec4 frag_color;
14+
in highp vec4 tangent;
15+
16+
highp float sqr(highp float x)
17+
{
18+
return x * x;
19+
}
20+
21+
highp float attenuate_light(highp float _distance, highp float radius, highp float max_intensity, highp float falloff)
22+
{
23+
highp float _30 = _distance / radius;
24+
if (_30 >= 1.0)
25+
{
26+
return 0.0;
27+
}
28+
highp float param = _30;
29+
highp float param_1 = 1.0 - sqr(param);
30+
return (max_intensity * sqr(param_1)) / (falloff * _30 + 1.0);
31+
}
32+
33+
highp float calcFogFactor(highp float distance_to_eye)
34+
{
35+
return clamp(((distance_to_eye - fs_params[39].x) / (fs_params[39].y - fs_params[39].x)) * fs_params[40].w, 0.0, 1.0);
36+
}
37+
38+
void main()
39+
{
40+
highp vec4 _113 = texture(tex_smp, uv) * color;
41+
highp vec4 c = _113;
42+
highp vec4 lit_color = fs_params[3];
43+
if (_113.w <= fs_params[2].x)
44+
{
45+
discard;
46+
}
47+
for (int i = 0; i < int(fs_params[6].x); i++)
48+
{
49+
int _145 = i * 2;
50+
highp vec3 _168 = fs_params[_145 * 1 + 7].xyz - position.xyz;
51+
highp float param = length(_168);
52+
highp float param_1 = fs_params[_145 * 1 + 7].w;
53+
highp float param_2 = 1.0;
54+
highp float param_3 = 1.0;
55+
highp vec4 _198 = lit_color;
56+
highp vec3 _200 = _198.xyz + ((fs_params[(_145 + 1) * 1 + 7].xyz * max(dot(normalize(_168), normal), 0.0)) * attenuate_light(param, param_1, param_2, param_3));
57+
highp vec4 _329 = _198;
58+
_329.x = _200.x;
59+
_329.y = _200.y;
60+
_329.z = _200.z;
61+
lit_color = _329;
62+
}
63+
highp vec4 _239 = lit_color;
64+
highp vec3 _241 = _239.xyz + (fs_params[5].xyz * (max(dot(vec4(fs_params[4].x, fs_params[4].y, fs_params[4].z, 0.0), vec4(normal, 0.0)), 0.0) * fs_params[4].w));
65+
highp vec4 _335 = _239;
66+
_335.x = _241.x;
67+
_335.y = _241.y;
68+
_335.z = _241.z;
69+
lit_color = _335;
70+
highp vec4 _250 = c * _335;
71+
highp vec4 _257 = texture(tex_emissive_smp, uv);
72+
highp vec3 _275 = (_250.xyz * (1.0 - min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz;
73+
highp vec4 _344 = _250;
74+
_344.x = _275.x;
75+
_344.y = _275.y;
76+
_344.z = _275.z;
77+
highp vec3 _296 = (_344.xyz * (1.0 - fs_params[1].w)) + (fs_params[1].xyz * fs_params[1].w);
78+
highp vec4 _350 = _344;
79+
_350.x = _296.x;
80+
_350.y = _296.y;
81+
_350.z = _296.z;
82+
c = _350;
83+
highp float param_4 = length(fs_params[0] - position);
84+
frag_color = vec4(mix(c.xyz, fs_params[40].xyz, vec3(calcFogFactor(param_4))), 1.0);
85+
}
86+

0 commit comments

Comments
 (0)