glRotatef (angles[2], 1, 0, 0);
}
+// currently unused reflection effect texture
void makechrometexture(void)
{
int i;
=================
*/
void R_LightModel(entity_t *ent, int numverts, vec3_t center, vec3_t basecolor);
-void R_DrawAliasFrame (maliashdr_t *maliashdr, float alpha, vec3_t color, entity_t *ent, int shadow, vec3_t org, vec3_t angles, vec_t scale, frameblend_t *blend, rtexture_t **skin, int colormap, int effects, int flags)
+void R_DrawAliasFrame (model_t *model, maliashdr_t *maliashdr, float alpha, vec3_t color, entity_t *ent, int shadow, vec3_t org, vec3_t angles, vec_t scale, frameblend_t *blend, rtexture_t **skin, int colormap, int effects, int flags)
{
if (gl_transform.value)
{
glEnable(GL_BLEND);
glDepthMask(0);
}
- else if (alpha != 1.0)
+ else if (alpha != 1.0 || (model->flags2 & MODF_TRANSPARENT))
{
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
=================
*/
-void R_DrawQ2AliasFrame (md2mem_t *pheader, float alpha, vec3_t color, entity_t *ent, int shadow, vec3_t org, vec3_t angles, vec_t scale, frameblend_t *blend, rtexture_t *skin, int effects, int flags)
+void R_DrawQ2AliasFrame (model_t *model, md2mem_t *pheader, float alpha, vec3_t color, entity_t *ent, int shadow, vec3_t org, vec3_t angles, vec_t scale, frameblend_t *blend, rtexture_t *skin, int effects, int flags)
{
int *order, count;
md2frame_t *frame1, *frame2, *frame3, *frame4;
R_DrawZymoticFrame
=================
*/
-void R_DrawZymoticFrame (zymtype1header_t *m, float alpha, vec3_t color, entity_t *ent, int shadow, vec3_t org, vec3_t angles, vec_t scale, frameblend_t *blend, int skinblah, int effects, int flags)
+void R_DrawZymoticFrame (model_t *model, zymtype1header_t *m, float alpha, vec3_t color, entity_t *ent, int shadow, vec3_t org, vec3_t angles, vec_t scale, frameblend_t *blend, int skinblah, int effects, int flags)
{
ZymoticLerpBones(m->numbones, (zymbonematrix *)(m->lump_poses.start + (int) m), blend, (zymbone_t *)(m->lump_bones.start + (int) m), org, angles, scale);
ZymoticTransformVerts(m->numverts, (int *)(m->lump_vertbonecounts.start + (int) m), (zymvertex_t *)(m->lump_verts.start + (int) m));
c_alias_polys += clmodel->numtris;
if (clmodel->aliastype == ALIASTYPE_ZYM)
- R_DrawZymoticFrame (modelheader, alpha, color, ent, ent != &cl.viewent, org, angles, scale, blend, 0 , effects, flags);
+ R_DrawZymoticFrame (clmodel, modelheader, alpha, color, ent, ent != &cl.viewent, org, angles, scale, blend, 0 , effects, flags);
else if (clmodel->aliastype == ALIASTYPE_MD2)
- R_DrawQ2AliasFrame (modelheader, alpha, color, ent, ent != &cl.viewent, org, angles, scale, blend, skinset[0] , effects, flags);
+ R_DrawQ2AliasFrame (clmodel, modelheader, alpha, color, ent, ent != &cl.viewent, org, angles, scale, blend, skinset[0] , effects, flags);
else
- R_DrawAliasFrame (modelheader, alpha, color, ent, ent != &cl.viewent, org, angles, scale, blend, skinset , colormap, effects, flags);
+ R_DrawAliasFrame (clmodel, modelheader, alpha, color, ent, ent != &cl.viewent, org, angles, scale, blend, skinset , colormap, effects, flags);
}
void Mod_LoadSkin (maliashdr_t *mheader, char *basename, byte *skindata, byte *skintemp, int width, int height, rtexture_t **skintex)
{
-#if 0
- int skin_normal, skin_pants, skin_shirt, skin_glow, skin_body, temp;
- skin_normal = loadtextureimage(va("%s_normal", basename));
- skin_pants = loadtextureimage(va("%s_pants" , basename));
- skin_shirt = loadtextureimage(va("%s_shirt" , basename));
- skin_glow = loadtextureimage(va("%s_glow" , basename));
- skin_body = loadtextureimage(va("%s_body" , basename));
- if (!(skin_normal || skin_pants || skin_shirt || skin_glow || skin_body))
- skin_body = loadtextureimage(name);
- if (skin_normal || skin_pants || skin_shirt || skin_glow || skin_body)
- {
- skintexnum[0] = skin_normal;
- skintexnum[1] = skin_pants;
- skintexnum[2] = skin_shirt;
- skintexnum[3] = skin_glow;
- skintexnum[4] = skin_body;
- }
- else
- {
- Mod_FloodFillSkin(skin, width, height);
- skin_normal = GL_SkinCheck((byte *)pskintype, width, height, 0x3FBD);
- skin_pants = GL_SkinCheck((byte *)pskintype, width, height, 0x0040);
- skin_shirt = GL_SkinCheck((byte *)pskintype, width, height, 0x0002);
- skin_glow = GL_SkinCheck((byte *)pskintype, width, height, 0xC000);
- skin_body = GL_SkinCheck((byte *)pskintype, width, height, 0x3FFF);
- if (skin_pants || skin_shirt)
- {
- byte *saveskin;
- saveskin = Hunk_AllocName(width*height, va("%s skin", loadname));
- memcpy((saveskin, byte *)pskintype, width*height);
- temp = (int) saveskin - (int) mheader;
- skintexnum[0] = skin_normal ? -temp : 0;
- skintexnum[1] = skin_pants ? -temp : 0;
- skintexnum[2] = skin_shirt ? -temp : 0;
- skintexnum[3] = GL_SkinSplit((byte *)pskintype, skintemp, width, height, 0xC000, va("%s_glow", basename)); // glow
- skintexnum[4] = GL_SkinSplit((byte *)pskintype, skintemp, width, height, 0x3FFF, va("%s_body", basename)); // body (normal + pants + shirt, but not glow)
- }
- else
- {
- skintexnum[0] = 0;
- skintexnum[1] = 0;
- skintexnum[2] = 0;
- skintexnum[3] = GL_SkinSplit((byte *)pskintype, skintemp, width, height, 0xC000, va("%s_glow", basename)); // glow
- skintexnum[4] = GL_SkinSplit((byte *)pskintype, skintemp, width, height, 0x3FFF, va("%s_body", basename)); // body (normal + pants + shirt, but not glow)
- }
- }
-#else
skintex[0] = loadtextureimage(va("%s_normal", basename), 0, 0, false, r_mipskins.value, true);
skintex[1] = NULL;
skintex[2] = NULL;
skintex[0] = GL_SkinSplit(skindata, skintemp, width, height, 0x3FFF, va("%s_base", basename), true); // no special colors
}
}
-#endif
+ if (R_TextureHasAlpha(skintex[0]))
+ loadmodel->flags2 |= MODF_TRANSPARENT;
}
/*
skinrange = loadmodel->skinanimrange;
skintex = loadmodel->skinanim;
-// skinrange = Hunk_AllocName (sizeof(int) * (skinranges + skincount), loadname);
+// skinrange = Hunk_AllocName (sizeof(int) * (skinranges + skincount), loadname);
// skintexnum = skinrange + skinranges * 2;
// loadmodel->skinanimrange = (int) skinrange - (int) pheader;
// loadmodel->skinanim = (int) skintexnum - (int) pheader;
BOUNDI(skinwidth,0,4096);
skinheight = LittleLong (pinmodel->skinheight);
BOUNDI(skinheight,0,1024);
-
+
pskintype = (daliasskintype_t *)&pinmodel[1];
pinstverts = (stvert_t *)Mod_SkipAllSkins (numskins, pskintype, skinwidth * skinheight);
pintriangles = (dtriangle_t *)&pinstverts[numverts];
void *Mod_Extradata (model_t *mod)
{
void *r;
-
+
r = Cache_Check (&mod->cache);
if (r)
return r;
Mod_LoadModel (mod, true);
-
+
if (!mod->cache.data)
Host_Error ("Mod_Extradata: caching failed");
return mod->cache.data;
{
int i;
model_t *mod;
-
+
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
if (!mod->cachesize)
mod->needload = true;
{
int i;
model_t *mod;
-
+
if (!name[0])
Host_Error ("Mod_ForName: NULL name");
-
+
//
// search the currently loaded models
//
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
if (!strcmp (mod->name, name) )
break;
-
+
if (i == mod_numknown)
{
if (mod_numknown == MAX_MOD_KNOWN)
void Mod_TouchModel (char *name)
{
model_t *mod;
-
+
mod = Mod_FindName (name);
-
+
if (!mod->needload)
if (mod->cachesize)
Cache_Check (&mod->cache);
Host_Error ("Mod_NumForName: %s not found", mod->name); // LordHavoc: Sys_Error was *ANNOYING*
return NULL;
}
-
+
// allocate a new model
// COM_FileBase (mod->name, loadname);
strcpy(loadname, mod->name);
-
+
loadmodel = mod;
// call the apropriate loader
mod->needload = false;
-
+
+ // LordHavoc: clear some important stuff in the model_t structure
+ mod->flags = 0;
+ mod->flags2 = 0;
+
switch (LittleLong(*(unsigned *)buf))
{
case IDPOLYHEADER:
case (('O'<<24)+('M'<<16)+('Y'<<8)+'Z'):
Mod_LoadZymoticModel(mod, buf);
break;
-
+
case IDSPRITEHEADER:
Mod_LoadSpriteModel (mod, buf);
break;
#include "model_sprite.h"
#include "model_alias.h"
+#define MODF_TRANSPARENT 1
+
typedef struct model_s
{
char name[MAX_QPATH];
int fullbright; // LordHavoc: if true (normally only for sprites) the model/sprite/bmodel is always rendered fullbright
int numframes;
synctype_t synctype;
-
+
int flags;
+ int flags2; // engine calculated flags, ones that can not be set in the file
// volume occupied by the model graphics
vec3_t mins, maxs;
float radius;
-// solid volume for clipping
+// solid volume for clipping
qboolean clipbox;
vec3_t clipmins, clipmaxs;