1
0
Fork 0
forked from fte/fteqw

resize the modelviewer's texture display if it would have gone offscreen.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5915 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2021-06-25 18:50:15 +00:00
parent 36f750ba23
commit 9bd8625d90

View file

@ -3964,9 +3964,18 @@ static void M_ModelViewerDraw(int x, int y, struct menucustom_s *c, struct emenu
}
if (shader->defaulttextures->base)
{
Draw_FunString(0, y, va("%s: %s (%s)", t, shader->defaulttextures->base->ident, shader->defaulttextures->base->subpath?shader->defaulttextures->base->subpath:""));
float w, h;
Draw_FunString(0, y, va("%s: %s (%s), %s %u*%u*%u",
t, shader->defaulttextures->base->ident, shader->defaulttextures->base->subpath?shader->defaulttextures->base->subpath:"",
Image_FormatName(shader->defaulttextures->base->format), shader->defaulttextures->base->width, shader->defaulttextures->base->height, shader->defaulttextures->base->depth));
y+=8;
R2D_Image(0, y, shader->defaulttextures->base->width, shader->defaulttextures->base->height, 0, 0, 1, 1, shader);
w = (float)vid.width / shader->defaulttextures->base->width;
h = (float)(vid.height-y) / shader->defaulttextures->base->height;
h = min(min(w,h), 1);
w = h*shader->defaulttextures->base->width;
h = h*shader->defaulttextures->base->height;
R2D_Image(0, y, w, h, 0, 0, 1, 1, shader);
}
else
Draw_FunString(0, y, va("%s: <NO TEXTURE>", t));