diff options
Diffstat (limited to 'src/world.c')
| -rw-r--r-- | src/world.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/world.c b/src/world.c index fced57d..0096dbe 100644 --- a/src/world.c +++ b/src/world.c @@ -562,11 +562,16 @@ Seed generateWorldItems(World* world, Seed seed, int start, int end) Texture generateGroundTexture() { +#ifdef USE_WORLD_DEBUG_TEXTURE + Image image = GenImageChecked(WORLD_IMAGE_WIDTH, WORLD_IMAGE_HEIGHT, 1.0, + 1.0, BLACK, WHITE); +#else Image image = GenImageWhiteNoise(WORLD_IMAGE_WIDTH, WORLD_IMAGE_HEIGHT, WORLD_GROUND_IMAGE_NOISE); ImageBlurGaussian(&image, WORLD_GROUND_BLUR); ImageColorContrast(&image, WORLD_GROUND_CONTRAST); ImageColorTint(&image, WORLD_GROUND_COLOR); +#endif Texture texture = LoadTextureFromImage(image); UnloadImage(image); @@ -741,8 +746,9 @@ void generateWorldSamanthasPlace(World* world, const Assets* assets, Seed generateWorldJohnsShop(World* world, Color* colors, Seed seed, WorldUID* placeId, WorldUID* id) { + // Add John's shop entity. Vector3 position = Vector3Scale(world->size, 0.5); - position.x += 30.0; + position.x += 60.0; Entity johnsShop = createEntity(JOHNS_STORE, position); world->entities[*id] = johnsShop; world->places[*placeId] = *id; @@ -750,6 +756,25 @@ Seed generateWorldJohnsShop(World* world, Color* colors, Seed seed, *id = *id + 1; *placeId = *placeId + 1; + // Flatten out area. + float width = 8.0; + float height = 8.0; + + Vector2 pixelPosition = worldPositionToPixel(world, position.x, position.z); + /* pixelPosition.x -= width / 2.0; */ + /* pixelPosition.y -= height / 2.0; */ + pixelPosition.x -= 2.0; + pixelPosition.y -= 2.0; + + Rectangle area = (Rectangle){ + pixelPosition.x, + pixelPosition.y, + width, + height + }; + + averageOutAreaWorld(world, colors, area); + return seed; } @@ -796,13 +821,7 @@ World createWorld(Seed seed, const Assets* assets) seed = generateWorldPlaces(&world, assets, colors, seed, &id); // Heightmap model. - image = (Image){ - .data = colors, - .width = WORLD_IMAGE_WIDTH, - .height = WORLD_IMAGE_HEIGHT, - .format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, - .mipmaps = 1 - }; + image = colorsToImage(colors, WORLD_IMAGE_WIDTH, WORLD_IMAGE_HEIGHT); Mesh mesh = GenMeshHeightmap(image, world.size); world.heightmap = LoadModelFromMesh(mesh); |
