for (i = 0;skinfile;skinfile = skinfile->next, i++, skin += loadmodel->num_surfaces)
{
memset(skin, 0, sizeof(*skin));
+ Mod_BuildAliasSkinFromSkinFrame(skin, NULL);
+ // don't render unmentioned meshes
+ skin->basematerialflags = skin->currentmaterialflags = 0;
+ // see if a mesh
for (skinfileitem = skinfile->items;skinfileitem;skinfileitem = skinfileitem->next)
{
// leave the skin unitialized (nodraw) if the replacement is "common/nodraw" or "textures/common/nodraw"
if (!strcmp(skinfileitem->name, meshname) && strcmp(skinfileitem->replacement, "common/nodraw") && strcmp(skinfileitem->replacement, "textures/common/nodraw"))
{
- memset(&tempskinframe, 0, sizeof(tempskinframe));
- if (Mod_LoadSkinFrame(&tempskinframe, skinfileitem->replacement, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, true, true))
- Mod_BuildAliasSkinFromSkinFrame(skin, &tempskinframe);
- else
- {
+ if (!Mod_LoadSkinFrame(&tempskinframe, skinfileitem->replacement, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, true, true))
if (cls.state != ca_dedicated)
- Con_Printf("mesh \"%s\": failed to load skin #%i \"%s\", falling back to mesh's internal shader name \"%s\"\n", meshname, i, skinfileitem->replacement, shadername);
- if (Mod_LoadSkinFrame(&tempskinframe, shadername, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, true, true))
- Mod_BuildAliasSkinFromSkinFrame(skin, &tempskinframe);
- else
- {
- if (cls.state != ca_dedicated)
- Con_Printf("failed to load skin \"%s\"\n", shadername);
- Mod_BuildAliasSkinFromSkinFrame(skin, NULL);
- }
- }
+ Con_Printf("mesh \"%s\": failed to load skin #%i \"%s\"\n", meshname, i, skinfileitem->replacement);
+ Mod_BuildAliasSkinFromSkinFrame(skin, &tempskinframe);
+ break;
}
}
}
}
else
{
- memset(&tempskinframe, 0, sizeof(tempskinframe));
- if (Mod_LoadSkinFrame(&tempskinframe, shadername, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, true, true))
- Mod_BuildAliasSkinFromSkinFrame(skin, &tempskinframe);
- else
- {
+ if (!Mod_LoadSkinFrame(&tempskinframe, shadername, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, true, true))
if (cls.state != ca_dedicated)
Con_Printf("Can't find texture \"%s\" for mesh \"%s\", using grey checkerboard\n", shadername, meshname);
- Mod_BuildAliasSkinFromSkinFrame(skin, NULL);
- }
+ Mod_BuildAliasSkinFromSkinFrame(skin, &tempskinframe);
}
}
loadmodel->data_textures = (texture_t *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t));
for (i = 0;i < loadmodel->numskins;i++, inskin += MD2_SKINNAME)
{
- if (Mod_LoadSkinFrame(&tempskinframe, inskin, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, true, true))
- Mod_BuildAliasSkinFromSkinFrame(loadmodel->data_textures + i * loadmodel->num_surfaces, &tempskinframe);
- else
- {
+ if (!Mod_LoadSkinFrame(&tempskinframe, inskin, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, true, true))
Con_Printf("%s is missing skin \"%s\"\n", loadmodel->name, inskin);
- Mod_BuildAliasSkinFromSkinFrame(loadmodel->data_textures + i * loadmodel->num_surfaces, NULL);
- }
+ Mod_BuildAliasSkinFromSkinFrame(loadmodel->data_textures + i * loadmodel->num_surfaces, &tempskinframe);
}
}
else
sprintf (name, "%s_%i_%i", loadmodel->name, i, j);
else
sprintf (name, "%s_%i", loadmodel->name, i);
- Mod_LoadSkinFrame(&loadmodel->sprite.sprdata_frames[realframes].texture.skinframes[0], name, (r_mipsprites.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_CLAMP | TEXF_PRECACHE | TEXF_PICMIP, false, false);
-
- if (!loadmodel->sprite.sprdata_frames[realframes].texture.skinframes[0].base)
+ if (!Mod_LoadSkinFrame(&loadmodel->sprite.sprdata_frames[realframes].texture.skinframes[0], name, (r_mipsprites.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_CLAMP | TEXF_PRECACHE | TEXF_PICMIP, false, false))
{
if (groupframes > 1)
sprintf (fogname, "%s_%i_%ifog", loadmodel->name, i, j);
modelradius = x + y;
if (width > 0 && height > 0 && cls.state != ca_dedicated)
- {
- Mod_LoadSkinFrame(&sprframe->texture.skinframes[0], pinframe->name, (r_mipsprites.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_CLAMP | TEXF_PRECACHE | TEXF_PICMIP, false, false);
- // TODO: use a default texture if we can't load it?
- if (sprframe->texture.skinframes[0].base == NULL)
+ if (!Mod_LoadSkinFrame(&sprframe->texture.skinframes[0], pinframe->name, (r_mipsprites.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_CLAMP | TEXF_PRECACHE | TEXF_PICMIP, false, false))
Host_Error("Mod_IDS2_Load: failed to load %s", pinframe->name);
- }
Mod_SpriteSetupTexture(sprframe, fullbright, false);
}