Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ zig-cache
.zig-cache
zig-out
.DS_Store
tools/sokol-shdc
2 changes: 1 addition & 1 deletion .zigversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.13.0
0.14.0
66 changes: 0 additions & 66 deletions 3rdparty/cimgui/build.zig

This file was deleted.

18 changes: 0 additions & 18 deletions 3rdparty/cimgui/build.zig.zon

This file was deleted.

2 changes: 1 addition & 1 deletion 3rdparty/system-sdk/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.{
.name = "system-sdk",
.name = .system_sdk,
.version = "0.1.0",
.paths = .{
"build.zig",
Expand Down
4 changes: 2 additions & 2 deletions 3rdparty/zaudio/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub fn build(b: *std.Build) void {

miniaudio.addCSourceFile(.{
.file = b.path("src/zaudio.c"),
.flags = &.{if (target.result.isWasm()) "-std=gnu99" else "-std=c99"}, // DELVE FRAMEWORK EDIT: Need gnu99 for web audio
.flags = &.{if (target.result.cpu.arch.isWasm()) "-std=gnu99" else "-std=c99"}, // DELVE FRAMEWORK EDIT: Need gnu99 for web audio
});
miniaudio.addCSourceFile(.{
.file = b.path("libs/miniaudio/miniaudio.c"),
Expand All @@ -48,7 +48,7 @@ pub fn build(b: *std.Build) void {
"-DMA_NO_JACK",
"-DMA_NO_DSOUND",
"-DMA_NO_WINMM",
if (target.result.isWasm()) "-std=gnu99" else "-std=c99", // DELVE FRAMEWORK EDIT: Need gnu99 for web audio
if (target.result.cpu.arch.isWasm()) "-std=gnu99" else "-std=c99", // DELVE FRAMEWORK EDIT: Need gnu99 for web audio
"-fno-sanitize=undefined",
if (target.result.os.tag == .macos) "-DMA_NO_RUNTIME_LINKING" else "",
},
Expand Down
7 changes: 4 additions & 3 deletions 3rdparty/zmesh/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ pub fn build(b: *std.Build) void {
});

const zmesh_lib = if (options.shared) blk: {
// TODO addLibrary
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addSharedLibrary is deprecated

const lib = b.addSharedLibrary(.{
.name = "zmesh",
.target = target,
.optimize = optimize,
});

if (target.result.os.tag == .windows) {
lib.defineCMacro("CGLTF_API", "__declspec(dllexport)");
lib.defineCMacro("MESHOPTIMIZER_API", "__declspec(dllexport)");
lib.defineCMacro("ZMESH_API", "__declspec(dllexport)");
lib.root_module.addCMacro("CGLTF_API", "__declspec(dllexport)");
lib.root_module.addCMacro("MESHOPTIMIZER_API", "__declspec(dllexport)");
lib.root_module.addCMacro("ZMESH_API", "__declspec(dllexport)");
}

break :blk lib;
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/zmesh/src/zcgltf.zig
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ pub const BufferView = extern struct {
size: usize,
stride: usize, // 0 == automatically determined by accessor
view_type: BufferViewType,
data: ?*anyopaque, // overrides buffer.data if present, filled by extensions
override_data: ?*anyopaque, // overrides buffer.data if present, filled by extensions
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new zig v0.14 didn't like that variable and function having the same name

has_meshopt_compression: Bool32,
meshopt_compression: MeshoptCompression,
extras: Extras,
Expand Down
10 changes: 5 additions & 5 deletions assets/shaders/basic-lighting.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#pragma sokol @ctype mat4 m.Mat4

#pragma sokol @vs vs
uniform vs_params {
layout(binding=0) uniform vs_params {
mat4 u_projViewMatrix;
mat4 u_modelMatrix;
vec4 u_color;
Expand Down Expand Up @@ -40,11 +40,11 @@ void main() {
#pragma sokol @end

#pragma sokol @fs fs
uniform texture2D tex;
uniform texture2D tex_emissive;
uniform sampler smp;
layout(binding=0) uniform texture2D tex;
layout(binding=1) uniform texture2D tex_emissive;
layout(binding=0) uniform sampler smp;

uniform fs_params {
layout(binding=1) uniform fs_params {
vec4 u_cameraPos;
vec4 u_color_override;
float u_alpha_cutoff;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#version 300 es
precision mediump float;
precision highp int;

uniform highp vec4 fs_params[41];
uniform highp sampler2D tex_smp;
uniform highp sampler2D tex_emissive_smp;

in highp vec2 uv;
in highp vec4 color;
in highp vec4 position;
in highp vec3 normal;
layout(location = 0) out highp vec4 frag_color;
in highp vec4 tangent;

highp float sqr(highp float x)
{
return x * x;
}

highp float attenuate_light(highp float _distance, highp float radius, highp float max_intensity, highp float falloff)
{
highp float _30 = _distance / radius;
if (_30 >= 1.0)
{
return 0.0;
}
highp float param = _30;
highp float param_1 = 1.0 - sqr(param);
return (max_intensity * sqr(param_1)) / (falloff * _30 + 1.0);
}

highp float calcFogFactor(highp float distance_to_eye)
{
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);
}

void main()
{
highp vec4 _113 = texture(tex_smp, uv) * color;
highp vec4 c = _113;
highp vec4 lit_color = fs_params[3];
if (_113.w <= fs_params[2].x)
{
discard;
}
for (int i = 0; i < int(fs_params[6].x); i++)
{
int _145 = i * 2;
highp vec3 _168 = fs_params[_145 * 1 + 7].xyz - position.xyz;
highp float param = length(_168);
highp float param_1 = fs_params[_145 * 1 + 7].w;
highp float param_2 = 1.0;
highp float param_3 = 1.0;
highp vec4 _198 = lit_color;
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));
highp vec4 _329 = _198;
_329.x = _200.x;
_329.y = _200.y;
_329.z = _200.z;
lit_color = _329;
}
highp vec4 _239 = lit_color;
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));
highp vec4 _335 = _239;
_335.x = _241.x;
_335.y = _241.y;
_335.z = _241.z;
lit_color = _335;
highp vec4 _250 = c * _335;
highp vec4 _257 = texture(tex_emissive_smp, uv);
highp vec3 _275 = (_250.xyz * (1.0 - min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz;
highp vec4 _344 = _250;
_344.x = _275.x;
_344.y = _275.y;
_344.z = _275.z;
highp vec3 _296 = (_344.xyz * (1.0 - fs_params[1].w)) + (fs_params[1].xyz * fs_params[1].w);
highp vec4 _350 = _344;
_350.x = _296.x;
_350.y = _296.y;
_350.z = _296.z;
c = _350;
highp float param_4 = length(fs_params[0] - position);
frag_color = vec4(mix(c.xyz, fs_params[40].xyz, vec3(calcFogFactor(param_4))), 1.0);
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#version 300 es
precision mediump float;
precision highp int;

uniform highp vec4 fs_params[41];
uniform highp sampler2D tex_smp;
uniform highp sampler2D tex_emissive_smp;

in highp vec2 uv;
in highp vec4 color;
in highp vec4 position;
in highp vec3 normal;
layout(location = 0) out highp vec4 frag_color;
in highp vec4 tangent;

highp float sqr(highp float x)
{
return x * x;
}

highp float attenuate_light(highp float _distance, highp float radius, highp float max_intensity, highp float falloff)
{
highp float _30 = _distance / radius;
if (_30 >= 1.0)
{
return 0.0;
}
highp float param = _30;
highp float param_1 = 1.0 - sqr(param);
return (max_intensity * sqr(param_1)) / (falloff * _30 + 1.0);
}

highp float calcFogFactor(highp float distance_to_eye)
{
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);
}

void main()
{
highp vec4 _113 = texture(tex_smp, uv) * color;
highp vec4 c = _113;
highp vec4 lit_color = fs_params[3];
if (_113.w <= fs_params[2].x)
{
discard;
}
for (int i = 0; i < int(fs_params[6].x); i++)
{
int _145 = i * 2;
highp vec3 _168 = fs_params[_145 * 1 + 7].xyz - position.xyz;
highp float param = length(_168);
highp float param_1 = fs_params[_145 * 1 + 7].w;
highp float param_2 = 1.0;
highp float param_3 = 1.0;
highp vec4 _198 = lit_color;
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));
highp vec4 _329 = _198;
_329.x = _200.x;
_329.y = _200.y;
_329.z = _200.z;
lit_color = _329;
}
highp vec4 _239 = lit_color;
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));
highp vec4 _335 = _239;
_335.x = _241.x;
_335.y = _241.y;
_335.z = _241.z;
lit_color = _335;
highp vec4 _250 = c * _335;
highp vec4 _257 = texture(tex_emissive_smp, uv);
highp vec3 _275 = (_250.xyz * (1.0 - min((_257.x + _257.y) + _257.z, 1.0))) + _257.xyz;
highp vec4 _344 = _250;
_344.x = _275.x;
_344.y = _275.y;
_344.z = _275.z;
highp vec3 _296 = (_344.xyz * (1.0 - fs_params[1].w)) + (fs_params[1].xyz * fs_params[1].w);
highp vec4 _350 = _344;
_350.x = _296.x;
_350.y = _296.y;
_350.z = _296.z;
c = _350;
highp float param_4 = length(fs_params[0] - position);
frag_color = vec4(mix(c.xyz, fs_params[40].xyz, vec3(calcFogFactor(param_4))), 1.0);
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#version 300 es

uniform vec4 vs_params[10];
out vec4 color;
layout(location = 1) in vec4 color0;
out vec2 uv;
layout(location = 2) in vec2 texcoord0;
out vec3 normal;
layout(location = 3) in vec3 normals;
out vec4 tangent;
layout(location = 4) in vec4 tangents;
out vec4 position;
layout(location = 0) in vec4 pos;

void main()
{
color = color0 * vs_params[8];
uv = texcoord0 + vs_params[9].xy;
mat4 _40 = mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7]);
normal = normalize(_40 * vec4(normals, 0.0)).xyz;
tangent = tangents;
position = _40 * pos;
gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * position;
}

Loading