fix: char reserved word
This commit is contained in:
+1
-1
Submodule forge-steel updated: dcd35af4f1...01cba36eaa
+1
-1
@@ -277,7 +277,7 @@ vec4 fx_9(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, v
|
||||
+ reframe(previous, uv2 + vec2(1., 1.) * inv_k * .125).xyz * .2
|
||||
+ reframe(previous, uv2 + vec2(0., 1.) * inv_k * .125).xyz * .2
|
||||
+ reframe(previous, uv2 + vec2(.5, .5) * inv_k * .125).xyz * .2;
|
||||
c = char(mod(uv1 * k1, 1.), code) ? c : vec3(0.);
|
||||
c = chr(mod(uv1 * k1, 1.), code) ? c : vec3(0.);
|
||||
|
||||
return fx_master(c0, c, seed, m0);
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ vec4 src_7(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2
|
||||
ivec2 uv2i = ivec2(uv2);
|
||||
int code = ((charset_ctrl.y < 1. || (uv2i.x % 2 ^ uv2i.y % 2) > 0) ? 1 : 0) * (start_char + int((rand(uv2i) + char_delta) * char_span) % char_span);
|
||||
uv2 = mod(uv2, 1.);
|
||||
float f = char(uv2, code) ? 1. : 0.;
|
||||
float f = chr(uv2, code) ? 1. : 0.;
|
||||
|
||||
return vec4(f);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,23 @@ CP437_FILE = PROJECT_PATH / "project" / "inc_cp437.glsl"
|
||||
SENTENCES_FILE = PROJECT_PATH / "sentences.txt"
|
||||
BACKUP_SENTENCES_FILE = PROJECT_PATH / "sentences.example.txt"
|
||||
|
||||
FILE_CONTENT = """
|
||||
#ifndef INC_SENTENCES
|
||||
#define INC_SENTENCES
|
||||
|
||||
#define SENTENCE_COUNT {0}
|
||||
#define SENTENCE_MAX_LENGTH {1}
|
||||
|
||||
const int sentences[] = int[SENTENCE_COUNT * SENTENCE_MAX_LENGTH](
|
||||
{2}
|
||||
);
|
||||
|
||||
const int lengths[] = int[SENTENCE_COUNT](
|
||||
{3}
|
||||
);
|
||||
#endif
|
||||
"""
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
def read_mapping() -> dict[str, str]:
|
||||
@@ -44,25 +61,18 @@ def main():
|
||||
|
||||
max_len = max(len(sentence) for sentence in sentences)
|
||||
|
||||
with TARGET_FILE.open("w") as file:
|
||||
file.write("#ifndef INC_SENTENCES\n")
|
||||
file.write("#define INC_SENTENCES\n\n")
|
||||
file.write(f"#define SENTENCE_COUNT {len(sentences)}\n")
|
||||
file.write(f"#define SENTENCE_MAX_LENGTH {max_len}\n\n")
|
||||
file.write(
|
||||
"const int sentences[] = int[SENTENCE_COUNT * SENTENCE_MAX_LENGTH](\n"
|
||||
)
|
||||
file.writelines(
|
||||
" " + convert(sentence, mapping, max_len) + ("," if i < len(sentences) - 1 else " ") + f" // {sentence}\n"
|
||||
for i, sentence in enumerate(sentences)
|
||||
)
|
||||
file.write(");\n\n")
|
||||
file.write("const int lengths[] = int[SENTENCE_COUNT](\n")
|
||||
file.write(
|
||||
TARGET_FILE.write_text(
|
||||
FILE_CONTENT.format(
|
||||
len(sentences),
|
||||
max_len,
|
||||
"".join(
|
||||
" " + convert(sentence, mapping, max_len) + ("," if i < len(sentences) - 1 else " ") + f" // {sentence}\n"
|
||||
for i, sentence in enumerate(sentences)
|
||||
),
|
||||
" " + ", ".join(str(len(sentence)) for sentence in sentences) + "\n"
|
||||
)
|
||||
file.write(");\n")
|
||||
file.write("#endif")
|
||||
)
|
||||
log.info(f"Wrote {len(sentences)} sentences to {TARGET_FILE}")
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user