160 textures[i] = tex[i].tex_id; |
160 textures[i] = tex[i].tex_id; |
161 memset(&tex[i], 0, sizeof(AscTexture)); |
161 memset(&tex[i], 0, sizeof(AscTexture)); |
162 } |
162 } |
163 glDeleteTextures(count, textures); |
163 glDeleteTextures(count, textures); |
164 } |
164 } |
|
165 |
|
166 asc_vec2f asc_texture_calculate_uv_scale(const AscTexture *tex, asc_vec2u surface_dimension, asc_vec2f factors) { |
|
167 if (surface_dimension.width == 0 || surface_dimension.height == 0) { |
|
168 asc_wprintf("Tried to calculate UV scale for texture %u with zero dimensions.", tex->tex_id); |
|
169 return factors; |
|
170 } |
|
171 asc_vec2f uv_scale = factors; |
|
172 uv_scale.u *= (float) tex->width; |
|
173 uv_scale.u /= (float) surface_dimension.width; |
|
174 uv_scale.v *= (float) tex->height; |
|
175 uv_scale.v /= (float) surface_dimension.height; |
|
176 return uv_scale; |
|
177 } |