/apps/demos/crawl: facing textures

This commit is contained in:
veclavtalica
2025-02-21 02:00:00 +03:00
parent b6347996f9
commit a020b92824
4 changed files with 37 additions and 0 deletions

View File

@ -54,6 +54,33 @@ function render_dungeon(dungeon)
texture_region = { w = 128, h = 128 },
}
end
if dungeon.grid[y][x].face_texture ~= nil then
if dungeon.grid[y][x].face == "horizon" then
draw_quad {
texture = dungeon.grid[y][x].face_texture,
v3 = { x = y * 2, y = 2, z = x * 2 + 1 },
v2 = { x = y * 2, y = 0, z = x * 2 + 1 },
v1 = { x = y * 2 + 2, y = 0, z = x * 2 + 1 },
v0 = { x = y * 2 + 2, y = 2, z = x * 2 + 1 },
texture_region = { w = 64, h = 96 },
}
draw_quad {
texture = dungeon.grid[y][x].face_texture,
v3 = { x = y * 2 + 2, y = 2, z = x * 2 + 1 },
v2 = { x = y * 2 + 2, y = 0, z = x * 2 + 1 },
v1 = { x = y * 2, y = 0, z = x * 2 + 1 },
v0 = { x = y * 2, y = 2, z = x * 2 + 1 },
texture_region = { w = 64, h = 96 },
}
elseif dungeon.grid[y][x].face == "observer" then
draw_billboard {
texture = dungeon.grid[y][x].face_texture,
position = { x = y * 2 + 1, y = 1, z = x * 2 + 1 },
size = { x = 1, y = 1 },
}
end
end
end
end
end