Compare commits

...

2 Commits

Author SHA1 Message Date
veclavtalica
c694dfff82 use flatshading for space and skip setting irrelevant vertex color 2025-01-13 09:18:51 +03:00
veclavtalica
b6ca9bedb4 /apps/twnlua: don't use module tables 2025-01-13 08:57:21 +03:00
4 changed files with 13 additions and 18 deletions

View File

@ -164,15 +164,10 @@ print('\n'.join(bindings))
loader = "void bindgen_load_%s(lua_State *L) {\n" % api["name"]
modules = set(api["procedures"][procedure]["module"] for procedure in api["procedures"])
for module in modules:
loader += " bindgen_init();\n"
loader += " lua_createtable(L, 0, %i);\n" % len(api["procedures"])
for procedure, procedure_desc in api["procedures"].items():
if procedure_desc["module"] == module:
loader += " lua_pushcfunction(L, binding_%s);\n" % procedure
loader += " lua_setfield(L, -2, \"%s\");\n" % procedure_desc["symbol"]
loader += " lua_setglobal(L, \"%s\");\n" % module
loader += " bindgen_init();\n"
for procedure, procedure_desc in api["procedures"].items():
loader += " lua_pushcfunction(L, binding_%s);\n" % procedure
loader += " lua_setglobal(L, \"%s\");\n" % procedure
loader += "}\n"
print(loader)

View File

@ -4,17 +4,17 @@ offset = { x = 0, y = 0 }
angle = 0
function game_tick()
input.action {
input_action {
name = "press",
control = "A"
}
draw.rectangle {
draw_rectangle {
rect = { x = 0, y = 0, w = 640, h = 360 },
color = { r = 127, g = 0, b = 127, a = 255 },
}
draw.sprite {
draw_sprite {
texture = "/assets/title.png",
rect = {
x = 320 - (320 / 2),
@ -24,8 +24,8 @@ function game_tick()
},
}
if input.action_pressed { name = "press" } then
draw.text {
if input_action_pressed { name = "press" } then
draw_text {
string = "it never happened",
position = offset,
font = "/fonts/kenney-pixel.ttf",

View File

@ -108,11 +108,11 @@ void finally_draw_billboard_batch(struct MeshBatch const *batch,
}
struct ElementIndexedBillboard const payload = {
/* TODO: use the flat shading to not set two of the colors */
/* flat shading is assumed, so we can skip setting the duplicates */
.c0 = billboard.color,
.c1 = billboard.color,
// .c1 = billboard.color,
.c2 = billboard.color,
.c3 = billboard.color,
// .c3 = billboard.color,
.uv0 = uv0,
.uv1 = uv1,

View File

@ -48,7 +48,7 @@ void finally_use_space_pipeline(void) {
glNewList(list, GL_COMPILE); {
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glShadeModel(GL_SMOOTH);
glShadeModel(GL_FLAT);
if (GLAD_GL_ARB_depth_clamp)
glDisable(GL_DEPTH_CLAMP);