summaryrefslogtreecommitdiff
path: root/convmodel.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2025-01-02 15:42:05 +1100
committerquou <quou@disroot.org>2025-01-02 15:42:05 +1100
commitb03109dbb087bd441c0e3905753f3dd97d44d7b8 (patch)
tree9f4372b2aa643c29cdd338b8776c02d175b4a881 /convmodel.c
parent6d4b56258b89ba12bec5e329b81de62284c47ce1 (diff)
Simpler depth prepass shader
Diffstat (limited to 'convmodel.c')
-rw-r--r--convmodel.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/convmodel.c b/convmodel.c
index 4e7184b..7963881 100644
--- a/convmodel.c
+++ b/convmodel.c
@@ -12,6 +12,7 @@
typedef struct {
const char* shader;
+ const char* depth_shader;
const char* material;
} Node_Config;
@@ -85,6 +86,17 @@ void parse_node_cfg(const cgltf_node* n, Node_Config* cfg) {
}
i++;
}
+ if (tcmp(json, "depth_shader", t)) {
+ cfg->depth_shader = read_str(json, &t[1]);
+ if (string_len(cfg->depth_shader) > 27) {
+ print_err(
+ "depth_shader name %s too long (max 27 chars).\n",
+ cfg->depth_shader
+ );
+ pbreak(3478);
+ }
+ i++;
+ }
if (tcmp(json, "material", t)) {
cfg->material = read_str(json, &t[1]);
if (string_len(cfg->material) > 27) {
@@ -255,6 +267,9 @@ void parse_node_mesh(
string_copy(buf, cfg->shader);
fwrite(buf, 1, sizeof buf, outfile);
zero(buf, sizeof buf);
+ string_copy(buf, cfg->depth_shader);
+ fwrite(buf, 1, sizeof buf, outfile);
+ zero(buf, sizeof buf);
string_copy(buf, cfg->material);
fwrite(buf, 1, sizeof buf, outfile);
fwrite(&vertex_size, 4, 1, outfile);