}
}
+
for (i=0; i<4; i++)
{
for (j=0; j<16; j++)
{
- for (y=0; y<DISTORTRESOLUTION; y++)
+ mod_shared_distorttexture[i*16+j] = NULL;
+ if (gl_textureshader)
{
- for (x=0; x<DISTORTRESOLUTION; x++)
+ for (y=0; y<DISTORTRESOLUTION; y++)
{
- data[4][y][x][0] = Mod_MorphDistortTexture (data[(i-1)&3][y][x][0], data[i][y][x][0], data[(i+1)&3][y][x][0], data[(i+2)&3][y][x][0], 0.0625*j);
- data[4][y][x][1] = Mod_MorphDistortTexture (data[(i-1)&3][y][x][1], data[i][y][x][1], data[(i+1)&3][y][x][1], data[(i+2)&3][y][x][1], 0.0625*j);
+ for (x=0; x<DISTORTRESOLUTION; x++)
+ {
+ data[4][y][x][0] = Mod_MorphDistortTexture (data[(i-1)&3][y][x][0], data[i][y][x][0], data[(i+1)&3][y][x][0], data[(i+2)&3][y][x][0], 0.0625*j);
+ data[4][y][x][1] = Mod_MorphDistortTexture (data[(i-1)&3][y][x][1], data[i][y][x][1], data[(i+1)&3][y][x][1], data[(i+2)&3][y][x][1], 0.0625*j);
+ }
}
+ mod_shared_distorttexture[i*16+j] = R_LoadTexture2D(mod_shared_texturepool, va("distorttexture%i", i*16+j), DISTORTRESOLUTION, DISTORTRESOLUTION, &data[4][0][0][0], TEXTYPE_DSDT, TEXF_PRECACHE, NULL);
}
- mod_shared_distorttexture[i*16+j] = R_LoadTexture2D(mod_shared_texturepool, va("distorttexture%i", i*16+j), DISTORTRESOLUTION, DISTORTRESOLUTION, &data[4][0][0][0], TEXTYPE_DSDT, TEXF_PRECACHE, NULL);
}
}
Mod_Init
===============
*/
-static void Mod_Print (void);
+static void Mod_Print(void);
static void Mod_Precache (void);
void Mod_Init (void)
{
{
if (checkdisk)
{
- buf = FS_LoadFile (mod->name, false);
+ buf = FS_LoadFile (mod->name, tempmempool, false);
if (!buf)
{
if (crash)
if (!buf)
{
- buf = FS_LoadFile (mod->name, false);
+ buf = FS_LoadFile (mod->name, tempmempool, false);
if (!buf)
{
if (crash)
int i;
model_t *mod;
- Con_Printf ("Loaded models:\n");
+ Con_Print("Loaded models:\n");
for (i = 0, mod = mod_known;i < MAX_MOD_KNOWN;i++, mod++)
if (mod->name[0])
- Con_Printf ("%4iK %s\n", mod->mempool ? (mod->mempool->totalsize + 1023) / 1024 : 0, mod->name);
+ Con_Printf("%4iK %s\n", mod->mempool ? (mod->mempool->totalsize + 1023) / 1024 : 0, mod->name);
}
/*
if (Cmd_Argc() == 2)
Mod_ForName(Cmd_Argv(1), false, true, cl.worldmodel && !strcasecmp(Cmd_Argv(1), cl.worldmodel->name));
else
- Con_Printf("usage: modelprecache <filename>\n");
+ Con_Print("usage: modelprecache <filename>\n");
}
#if 1
f = -DotProduct(tvector3f, normal3f);
VectorMA(tvector3f, f, normal3f, tvector3f);
VectorNormalize(tvector3f);
- CrossProduct(normal3f, tvector3f, svector3f);
+ // note: can't be a CrossProduct as that sometimes flips the texture
+ svector3f[0] = ((tc1[1] - tc0[1]) * (v2[0] - v0[0]) - (tc2[1] - tc0[1]) * (v1[0] - v0[0]));
+ svector3f[1] = ((tc1[1] - tc0[1]) * (v2[1] - v0[1]) - (tc2[1] - tc0[1]) * (v1[1] - v0[1]));
+ svector3f[2] = ((tc1[1] - tc0[1]) * (v2[2] - v0[2]) - (tc2[1] - tc0[1]) * (v1[2] - v0[2]));
+ f = -DotProduct(svector3f, normal3f);
+ VectorMA(svector3f, f, normal3f, svector3f);
+ VectorNormalize(svector3f);
}
// warning: this is an expensive function!
mesh->numtriangles++;
}
-void Mod_ShadowMesh_AddMesh(mempool_t *mempool, shadowmesh_t *mesh, rtexture_t *map_diffuse, rtexture_t *map_specular, rtexture_t *map_normal, float *vertex3f, float *svector3f, float *tvector3f, float *normal3f, float *texcoord2f, int numtris, int *element3i)
+void Mod_ShadowMesh_AddMesh(mempool_t *mempool, shadowmesh_t *mesh, rtexture_t *map_diffuse, rtexture_t *map_specular, rtexture_t *map_normal, const float *vertex3f, const float *svector3f, const float *tvector3f, const float *normal3f, const float *texcoord2f, int numtris, const int *element3i)
{
int i, j, e;
float vbuf[3*14], *v;
*/
memset(tagsets, 0, sizeof(tagsets));
memset(word, 0, sizeof(word));
- for (i = 0;i < MAX_SKINS && (data = text = FS_LoadFile(va("%s_%i.skin", loadmodel->name, i), true));i++)
+ for (i = 0;i < MAX_SKINS && (data = text = FS_LoadFile(va("%s_%i.skin", loadmodel->name, i), tempmempool, true));i++)
{
numtags = 0;
skinfile = Mem_Alloc(tempmempool, sizeof(skinfile_t));