This commit is contained in:
jacob 2026-01-10 07:44:34 -06:00
parent bfbc7cf865
commit 3945008984
9 changed files with 23 additions and 22 deletions

BIN
src/pp/pp_res/sprite/tiles.ase (Stored with Git LFS)

Binary file not shown.

BIN
src/pp/pp_res/sprite/tiles_real.ase (Stored with Git LFS)

Binary file not shown.

BIN
src/pp/pp_res/tile/Carpet.ase (Stored with Git LFS) Normal file

Binary file not shown.

BIN
src/pp/pp_res/tile/Tile.ase (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -3,7 +3,9 @@
i32 S_TileIdxFromTilePos(Vec2 p)
{
i32 result = ClampI32(FloorF32(p.x) + (FloorF32(p.y) * S_TilesPitch), 0, S_TilesCount);
i32 x = ClampI32(FloorF32(p.x), 0, S_TilesPitch - 1);
i32 y = ClampI32(FloorF32(p.y), 0, S_TilesPitch - 1);
i32 result = x + (y * S_TilesPitch);
return result;
}

View File

@ -11,7 +11,8 @@
#define S_TilesXMacro(X) \
X(Empty) \
X(Floor) \
X(Tile) \
X(Carpet) \
X(Wall) \
/* -------------------- */

View File

@ -3171,6 +3171,8 @@ void V_TickForever(WaveLaneCtx *lane)
params.target_ro = draw_target_ro;
params.target_rw = draw_target_rw;
params.xf = frame->xf;
params.tick = frame->tick;
params.seed = RandU64FromState(&frame->rand);
params.pt_wrap_sampler = G_BasicPointWrapSampler();
@ -3205,12 +3207,13 @@ void V_TickForever(WaveLaneCtx *lane)
// Fill tile textures
{
ResourceKey sheet_resource = ResourceKeyFromStore(&P_Resources, Lit("sprite/tiles.ase"));
for (S_TileKind tile_kind = 0; tile_kind < S_TileKind_COUNT; ++tile_kind)
{
String tile_name = S_TileNameFromKind(tile_kind);
String sheet_name = StringF(frame->arena, "sprite/%F.ase", FmtString(tile_name));
ResourceKey sheet_resource = ResourceKeyFromStore(&P_Resources, sheet_name);
SPR_SheetKey sheet = SPR_SheetKeyFromResource(sheet_resource);
SPR_Slice tile_slice = SPR_SliceFromSheet(sheet, tile_name);
SPR_Slice tile_slice = SPR_SliceFromSheet(sheet, Lit(""));
params.tile_slices[tile_kind] = tile_slice;
}
}

View File

@ -79,7 +79,7 @@ ComputeShader2D(V_BackdropCS, 8, 8)
{
Vec4 result = Vec4(0.025, 0.025, 0.025, 1);
Vec2 world_pos = mul(params.xf.ui_to_world, Vec3(ui_pos, 1));
Vec2 cell_pos = floor(mul(params.xf.world_to_cell, Vec3(world_pos, 1)));
Vec2 tile_pos = mul(params.xf.world_to_tile, Vec3(world_pos, 1));
S_TileKind tile = tiles.Load(Vec3(tile_pos, 0));
@ -149,22 +149,17 @@ ComputeShader2D(V_BackdropCS, 8, 8)
{
Vec4 outer = LinearFromSrgb(Vec4(0.05, 0.05, 0.05, 1));
Vec4 inner = LinearFromSrgb(Vec4(0.10, 0.10, 0.10, 1));
// result = lerp(outer, inner, smoothstep(0, 1, tile_edge_dist / 0.375));
result = lerp(outer, inner, smoothstep(0, 1, tile_edge_dist / 0.5));
result = lerp(outer, inner, smoothstep(0, 1, tile_edge_dist / 0.375));
// result = lerp(outer, inner, smoothstep(0, 1, tile_edge_dist / 0.5));
}
else if (tile != S_TileKind_Empty)
{
SamplerState wrap_sampler = G_Dereference(params.pt_wrap_sampler);
SPR_Slice slice = params.tile_slices[tile];
Texture2D<Vec4> tile_tex = G_Dereference<Vec4>(slice.tex);
Vec4 floor_col = tile_tex.Sample(wrap_sampler, world_pos);
Vec4 tile_col = tile_tex.Sample(wrap_sampler, world_pos);
// if (edge_tile == S_TileKind_Wall && tile_edge_dist < 0.05)
// {
// // floor_col.rgb *= 0.25;
// }
result = floor_col;
result = tile_col;
}
// switch (tile)
@ -195,8 +190,6 @@ ComputeShader2D(V_BackdropCS, 8, 8)
RWTexture2D<Vec4> cells = G_Dereference<Vec4>(params.cells);
RWTexture2D<f32> drynesses = G_Dereference<f32>(params.drynesses);
Vec2 cell_pos = floor(mul(params.xf.world_to_cell, Vec3(world_pos, 1)));
Vec4 stain = stains.Load(cell_pos);
Vec4 cell = cells.Load(cell_pos);
f32 dryness = drynesses[cell_pos];

View File

@ -64,6 +64,8 @@ Struct(V_GpuParams)
G_Texture2DRef target_ro;
G_RWTexture2DRef target_rw;
V_Xforms xf;
u64 tick;
u64 seed;
G_SamplerStateRef pt_wrap_sampler;