From 2c8442b0b9cec2fbb88de77d9d729f216017986e Mon Sep 17 00:00:00 2001 From: Zane van Iperen Date: Tue, 1 Oct 2024 01:26:26 +0900 Subject: [PATCH] drivers/glrend/v1model: handle map width/height wrapping --- drivers/glrend/v1model.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/glrend/v1model.c b/drivers/glrend/v1model.c index 375fbc78..a8cf945f 100644 --- a/drivers/glrend/v1model.c +++ b/drivers/glrend/v1model.c @@ -264,6 +264,39 @@ static void apply_stored_properties(HVIDEO hVideo, state_stack *state, uint32_t if(GLAD_GL_ARB_texture_filter_anisotropic) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY, maxAnisotropy); + /* + * Apply wrapping. + */ + switch(state->prim.map_width_limit) { + case BRT_WRAP: + default: + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + break; + + case BRT_CLAMP: + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + break; + + case BRT_MIRROR: + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT); + break; + } + + switch(state->prim.map_height_limit) { + case BRT_WRAP: + default: + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + break; + + case BRT_CLAMP: + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + break; + + case BRT_MIRROR: + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT); + break; + } + // if(state->prim.colour_map) //{ // if(state->prim.colour_map->source)