pre-work for chunk stitching
parent
ffbb2c1333
commit
903bcc3afa
|
@ -5,7 +5,7 @@ Image texgen_build_block(uint32_t biome, uint32_t kind) {
|
||||||
// TODO(zaklaus):
|
// TODO(zaklaus):
|
||||||
(void)biome;
|
(void)biome;
|
||||||
(void)kind;
|
(void)kind;
|
||||||
return GenImageColor(WORLD_BLOCK_SIZE, WORLD_BLOCK_SIZE, RAYWHITE);
|
return GenImageWhiteNoise(WORLD_BLOCK_SIZE, WORLD_BLOCK_SIZE, 0.8f);
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture2D texgen_build_sprite(asset_id id) {
|
Texture2D texgen_build_sprite(asset_id id) {
|
||||||
|
|
|
@ -27,7 +27,6 @@ uint64_t player_spawn(char *name) {
|
||||||
ecs_set(world_ecs(), e, Input, {0});
|
ecs_set(world_ecs(), e, Input, {0});
|
||||||
ecs_add(world_ecs(), e, Player);
|
ecs_add(world_ecs(), e, Player);
|
||||||
Position *pos = ecs_get_mut(world_ecs(), e, Position, NULL);
|
Position *pos = ecs_get_mut(world_ecs(), e, Position, NULL);
|
||||||
uint16_t half_world_dim = world_dim() / 2;
|
|
||||||
pos->x=rand() % world_dim();
|
pos->x=rand() % world_dim();
|
||||||
pos->y=rand() % world_dim();
|
pos->y=rand() % world_dim();
|
||||||
|
|
||||||
|
|
|
@ -144,6 +144,13 @@ int32_t world_init(int32_t seed, uint16_t chunk_size, uint16_t chunk_amount) {
|
||||||
librg_entity_track(world.tracker, e);
|
librg_entity_track(world.tracker, e);
|
||||||
librg_entity_chunk_set(world.tracker, e, i);
|
librg_entity_chunk_set(world.tracker, e, i);
|
||||||
librg_chunk_to_chunkpos(world.tracker, i, &chunk->x, &chunk->y, NULL);
|
librg_chunk_to_chunkpos(world.tracker, i, &chunk->x, &chunk->y, NULL);
|
||||||
|
chunk->blocks = NULL;
|
||||||
|
|
||||||
|
// TODO(zaklaus): populate chunks from worldgen
|
||||||
|
for (int j = 0; j < world.chunk_size * world.chunk_size; j += 1) {
|
||||||
|
uint8_t *c = ecs_vector_add(&chunk->blocks, uint8_t);
|
||||||
|
*c = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
zpl_printf("[INFO] Created a new server world\n");
|
zpl_printf("[INFO] Created a new server world\n");
|
||||||
|
|
|
@ -18,7 +18,7 @@ void MoveWalk(ecs_iter_t *it) {
|
||||||
|
|
||||||
void HandleCollisions(ecs_iter_t *it) {
|
void HandleCollisions(ecs_iter_t *it) {
|
||||||
Position *p = ecs_column(it, Position, 1);
|
Position *p = ecs_column(it, Position, 1);
|
||||||
Velocity *v = ecs_column(it, Velocity, 2);
|
//Velocity *v = ecs_column(it, Velocity, 2);
|
||||||
|
|
||||||
for (int i = 0; i < it->count; i++) {
|
for (int i = 0; i < it->count; i++) {
|
||||||
// NOTE(zaklaus): world bounds
|
// NOTE(zaklaus): world bounds
|
||||||
|
|
Loading…
Reference in New Issue