This commit is contained in:
Radonchnk 2025-04-20 10:20:35 +01:00
parent 77e1080c24
commit 54780baed3

View file

@ -78,13 +78,29 @@ pub fn main() !void {
//}
raylib.SetShaderValue(shader, raylib.GetShaderLocation(shader, "textureTiling"), &.{ @as(f32, @floatFromInt(tile_columns)), @as(f32, @floatFromInt(tile_rows)) }, raylib.SHADER_UNIFORM_VEC2);
// genegate chunk
var chunk = try generation.generate_world(a7r, 413445, 3445, 0.1);
var list_models = std.ArrayList(raylib.ChunkModel).init(a7r);
defer list_models.deinit();
var i: usize = 0;
while (i < 1000) : (i += 1) {
// generate chunk
const randInt: i32 = @intCast(i * 145343 % 4539);
const chunk = try generation.generate_world(a7r, randInt, @divTrunc(randInt, 2), 0.1);
defer chunk.deinit();
// generate chunk model for just created chunk
// generate model
const model = try render.chunk_to_model(chunk, texture, shader, tile_rows, tile_columns);
defer raylib.UnloadChunkModel(model);
// store model
try list_models.append(model);
}
// if (benchmark_chunk_meshing) {
@ -136,7 +152,7 @@ pub fn main() !void {
const chunk_pos_x: u64 = @intCast(x);
const chunk_pos_y: u64 = @intCast(y);
const chunk_pos_z: u64 = @intCast(z);
try render.draw_model(model, camera, shader, chunk_pos_x, chunk_pos_y, chunk_pos_z);
try render.draw_model(list_models.items[chunk_pos_x * 100 + chunk_pos_y * 10 + chunk_pos_z], camera, shader, chunk_pos_x * 2, chunk_pos_y * 2, chunk_pos_z * 2);
};
raylib.DrawFPS(10, 10);