push as is, half baked broken twn_models.c

This commit is contained in:
veclavtalica
2025-02-14 19:51:34 +03:00
parent 0df0a9226f
commit f81c583319
10 changed files with 460 additions and 49 deletions

View File

@ -191,6 +191,7 @@ static SDL_Surface *create_surface(int width, int height) {
/* adds a new, blank atlas surface to the cache */
static void add_new_atlas(TextureCache *cache) {
/* TODO: create a PBO surface if possible, reducing duplication */
SDL_Surface *new_atlas = create_surface((int)ctx.texture_atlas_size, (int)ctx.texture_atlas_size);
arrput(cache->atlas_surfaces, new_atlas);
arrput(cache->atlas_textures, create_gpu_texture(TEXTURE_FILTER_NEAREAST, true, 4, (int)ctx.texture_atlas_size, (int)ctx.texture_atlas_size));
@ -630,6 +631,7 @@ void textures_bind(const TextureCache *cache, TextureKey key) {
/* TODO: alternative schemes, such as: array texture, fragment shader and geometry division */
/* TODO: a way to trigger upload before it's used */
void textures_bind_repeating(const TextureCache *cache, TextureKey key) {
if (m_texture_key_is_valid(key)) {
if (cache->hash[key.id].value.loner_texture == 0) {
@ -650,6 +652,7 @@ void textures_bind_repeating(const TextureCache *cache, TextureKey key) {
SDL_LockSurface(texture.data);
/* TODO: optional glCopyImageSubData support, abstracted as copy_gpu_texture() */
upload_gpu_texture(repeating_texture,
texture.data->pixels,
texture.data->format->BytesPerPixel,