mirror of
https://github.com/yquake2/ref_vk.git
synced 2024-11-10 06:41:45 +00:00
parent
de9b099995
commit
518ada7ea6
4 changed files with 60 additions and 27 deletions
1
Makefile
1
Makefile
|
@ -350,6 +350,7 @@ REFVK_OBJS_ := \
|
|||
src/vk/vk_warp.o \
|
||||
src/vk/vk_util.o \
|
||||
src/vk/volk/volk.o \
|
||||
src/files/surf.o \
|
||||
src/files/models.o \
|
||||
src/files/pcx.o \
|
||||
src/files/stb.o \
|
||||
|
|
|
@ -208,5 +208,6 @@ extern void Mod_LoadSurfedges (const char *name, int **surfedges, int *numsurfed
|
|||
const byte *mod_base, const lump_t *l, int extra);
|
||||
extern int Mod_CalcLumpHunkSize(const lump_t *l, int inSize, int outSize, int extra);
|
||||
extern mleaf_t *Mod_PointInLeaf(const vec3_t p, mnode_t *node);
|
||||
extern struct image_s *R_TextureAnimation(const entity_t *currententity, const mtexinfo_t *tex);
|
||||
|
||||
#endif /* SRC_CLIENT_REFRESH_REF_SHARED_H_ */
|
||||
|
|
55
src/files/surf.c
Normal file
55
src/files/surf.c
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* =======================================================================
|
||||
*
|
||||
* Surface logic
|
||||
*
|
||||
* =======================================================================
|
||||
*/
|
||||
|
||||
#include "../common/header/ref_shared.h"
|
||||
|
||||
/*
|
||||
===============
|
||||
R_TextureAnimation
|
||||
|
||||
Returns the proper texture for a given time and base texture
|
||||
===============
|
||||
*/
|
||||
struct image_s *
|
||||
R_TextureAnimation(const entity_t *currententity, const mtexinfo_t *tex)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (!tex->next)
|
||||
return tex->image;
|
||||
|
||||
if (!currententity)
|
||||
return tex->image;
|
||||
|
||||
c = currententity->frame % tex->numframes;
|
||||
while (c && tex)
|
||||
{
|
||||
tex = tex->next;
|
||||
c--;
|
||||
}
|
||||
|
||||
return tex->image;
|
||||
}
|
|
@ -66,30 +66,6 @@ static qboolean LM_AllocBlock (int w, int h, int *x, int *y);
|
|||
=============================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
===============
|
||||
R_TextureAnimation
|
||||
|
||||
Returns the proper texture for a given time and base texture
|
||||
===============
|
||||
*/
|
||||
static image_t *R_TextureAnimation (mtexinfo_t *tex, entity_t *currententity)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (!tex->next)
|
||||
return tex->image;
|
||||
|
||||
c = currententity->frame % tex->numframes;
|
||||
while (c)
|
||||
{
|
||||
tex = tex->next;
|
||||
c--;
|
||||
}
|
||||
|
||||
return tex->image;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
DrawVkPoly
|
||||
|
@ -281,7 +257,7 @@ static void R_RenderBrushPoly (msurface_t *fa, float *modelMatrix, float alpha,
|
|||
float color[4] = { 1.f, 1.f, 1.f, alpha };
|
||||
c_brush_polys++;
|
||||
|
||||
image = R_TextureAnimation(fa->texinfo, currententity);
|
||||
image = R_TextureAnimation(currententity, fa->texinfo);
|
||||
|
||||
if (fa->flags & SURF_DRAWTURB)
|
||||
{
|
||||
|
@ -447,7 +423,7 @@ static void Vk_RenderLightmappedPoly( msurface_t *surf, float *modelMatrix, floa
|
|||
int i, nv = surf->polys->numverts;
|
||||
int map;
|
||||
float *v;
|
||||
image_t *image = R_TextureAnimation(surf->texinfo, currententity);
|
||||
image_t *image = R_TextureAnimation(currententity, surf->texinfo);
|
||||
qboolean is_dynamic = false;
|
||||
unsigned lmtex = surf->lightmaptexturenum;
|
||||
vkpoly_t *p;
|
||||
|
@ -919,7 +895,7 @@ static void R_RecursiveWorldNode (mnode_t *node, entity_t *currententity)
|
|||
// the polygon is visible, so add it to the texture
|
||||
// sorted chain
|
||||
// FIXME: this is a hack for animation
|
||||
image = R_TextureAnimation(surf->texinfo, currententity);
|
||||
image = R_TextureAnimation(currententity, surf->texinfo);
|
||||
surf->texturechain = image->texturechain;
|
||||
image->texturechain = surf;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue