Skip to content

Commit

Permalink
Allowing array entry characters to be on their own line
Browse files Browse the repository at this point in the history
  • Loading branch information
Interrupt committed Sep 9, 2024
1 parent 8ac6a6a commit 30ceef7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 12 deletions.
36 changes: 24 additions & 12 deletions resources/shader.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
shaders:
- slang: glsl430
programs:
- name: default
-
name: default
vs:
path: /Users/ccuddigan/Github/delve-framework/assets/shaders/built/default/default_default_glsl430_vs.glsl
is_binary: false
entry_point: main
inputs:
- slot: 0
-
slot: 0
name: pos
sem_name: TEXCOORD
sem_index: 0
- slot: 1
-
slot: 1
name: color0
sem_name: TEXCOORD
sem_index: 1
- slot: 2
-
slot: 2
name: texcoord0
sem_name: TEXCOORD
sem_index: 2
outputs:
- slot: 0
-
slot: 0
name: color
sem_name: TEXCOORD
sem_index: 0
- slot: 1
-
slot: 1
name: uv
sem_name: TEXCOORD
sem_index: 1
Expand All @@ -43,7 +49,8 @@ shaders:
is_binary: false
entry_point: main
inputs:
- slot: 0
-
slot: 0
name: color
sem_name: TEXCOORD
sem_index: 0
Expand Down Expand Up @@ -81,23 +88,28 @@ shaders:
name: tex_smp
image_name: tex
sampler_name: smp
- slang: glsl300es
-
slang: glsl300es
programs:
- name: default
-
name: default
vs:
path: /Users/ccuddigan/Github/delve-framework/assets/shaders/built/default/default_default_glsl300es_vs.glsl
is_binary: false
entry_point: main
inputs:
- slot: 0
-
slot: 0
name: pos
sem_name: TEXCOORD
sem_index: 0
- slot: 1
-
slot: 1
name: color0
sem_name: TEXCOORD
sem_index: 1
- slot: 2
-
slot: 2
name: texcoord0
sem_name: TEXCOORD
sem_index: 2
Expand Down
12 changes: 12 additions & 0 deletions src/root.zig
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,13 @@ pub fn Ymlz(comptime Destination: type) type {
return null;
}

fn isArrayEntryOnlyChar(raw_line: []const u8) bool {
// Trim whitespace to see if this is only the array start char
var trimmed_line = std.mem.trimLeft(u8, raw_line, " ");
trimmed_line = std.mem.trimRight(u8, trimmed_line, " ");
return std.mem.eql(u8, trimmed_line, "-");
}

fn isNewExpression(self: *Self, raw_value_line: []const u8, depth: usize) bool {
const indent_depth = self.getIndentDepth(depth);

Expand Down Expand Up @@ -344,6 +351,11 @@ pub fn Ymlz(comptime Destination: type) type {
while (true) {
const raw_value_line = try self.readLine() orelse break;

// If this is only the array entry char '-', just eat this line
if (isArrayEntryOnlyChar(raw_value_line)) {
continue;
}

try self.suspense.set(raw_value_line);

if (self.isNewExpression(raw_value_line, depth)) {
Expand Down

0 comments on commit 30ceef7

Please sign in to comment.