167 if (surface_dimension.width == 0 || surface_dimension.height == 0) { |
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); |
168 asc_wprintf("Tried to calculate UV scale for texture %u with zero dimensions.", tex->tex_id); |
169 return factors; |
169 return factors; |
170 } |
170 } |
171 asc_vec2f uv_scale = factors; |
171 asc_vec2f uv_scale = factors; |
172 uv_scale.u *= (float) tex->width; |
172 uv_scale.u *= (float) surface_dimension.width; |
173 uv_scale.u /= (float) surface_dimension.width; |
173 uv_scale.u /= (float) tex->width; |
174 uv_scale.v *= (float) tex->height; |
174 uv_scale.v *= (float) surface_dimension.height; |
175 uv_scale.v /= (float) surface_dimension.height; |
175 uv_scale.v /= (float) tex->height; |
176 return uv_scale; |
176 return uv_scale; |
177 } |
177 } |