fixing d3/q4 maps.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4430 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
30c332a451
commit
28303fb5f3
2 changed files with 23 additions and 8 deletions
|
@ -42,7 +42,7 @@ qboolean Mod_LoadMap_Proc(model_t *model, char *data)
|
|||
else if (!strcmp(token, "model"))
|
||||
{
|
||||
batch_t *b;
|
||||
mesh_t *m;
|
||||
mesh_t *m, **ml;
|
||||
model_t *sub;
|
||||
float f;
|
||||
int numsurfs, surf;
|
||||
|
@ -61,12 +61,20 @@ qboolean Mod_LoadMap_Proc(model_t *model, char *data)
|
|||
numsurfs = atoi(token);
|
||||
if (numsurfs < 0 || numsurfs > 10000)
|
||||
return false;
|
||||
b = ZG_Malloc(&model->memgroup, sizeof(*b) * numsurfs);
|
||||
m = ZG_Malloc(&model->memgroup, sizeof(*m) * numsurfs);
|
||||
if (numsurfs)
|
||||
{
|
||||
b = ZG_Malloc(&model->memgroup, sizeof(*b) * numsurfs);
|
||||
m = ZG_Malloc(&model->memgroup, sizeof(*m) * numsurfs);
|
||||
ml = ZG_Malloc(&model->memgroup, sizeof(*ml) * numsurfs);
|
||||
}
|
||||
else
|
||||
{
|
||||
b = NULL;
|
||||
m = NULL;
|
||||
ml = NULL;
|
||||
}
|
||||
sub->numsurfaces = numsurfs;
|
||||
|
||||
sub->batches[0] = b;
|
||||
|
||||
//ver4 may have a 'sky' field here
|
||||
vdata = COM_ParseOut(data, token, sizeof(token));
|
||||
if (strcmp(token, "{") && strcmp(token, "}"))
|
||||
|
@ -88,8 +96,9 @@ qboolean Mod_LoadMap_Proc(model_t *model, char *data)
|
|||
break;
|
||||
if (!data)
|
||||
return false;
|
||||
b[surf].meshes = 1;
|
||||
b[surf].mesh = (mesh_t**)&m[surf];
|
||||
b[surf].maxmeshes = 1;
|
||||
b[surf].mesh = &ml[surf];
|
||||
ml[surf] = &m[surf];
|
||||
b[surf].lightmap[0] = -1;
|
||||
b[surf].lightmap[1] = -1;
|
||||
b[surf].lightmap[2] = -1;
|
||||
|
@ -102,6 +111,9 @@ qboolean Mod_LoadMap_Proc(model_t *model, char *data)
|
|||
data = COM_ParseOut(data, token, sizeof(token));
|
||||
numindicies = atoi(token);
|
||||
|
||||
b[surf].next = sub->batches[b[surf].shader->sort];
|
||||
sub->batches[b[surf].shader->sort] = &b[surf];
|
||||
|
||||
m[surf].numvertexes = numverts;
|
||||
m[surf].numindexes = numindicies;
|
||||
vdata = ZG_Malloc(&model->memgroup, numverts * (sizeof(vecV_t) + sizeof(vec2_t) + sizeof(vec3_t) + sizeof(vec4_t)) + numindicies * sizeof(index_t));
|
||||
|
@ -181,6 +193,8 @@ qboolean Mod_LoadMap_Proc(model_t *model, char *data)
|
|||
sub->needload = false;
|
||||
sub->fromgame = fg_doom3;
|
||||
sub->type = mod_brush;
|
||||
|
||||
BE_GenBrushModelVBO(sub);
|
||||
}
|
||||
else if (!strcmp(token, "shadowModel"))
|
||||
{
|
||||
|
|
|
@ -2159,7 +2159,8 @@ void Surf_GenBrushBatches(batch_t **batches, entity_t *ent)
|
|||
if (!b)
|
||||
continue;
|
||||
*b = *ob;
|
||||
b->shader = R_TextureAnimation(ent->framestate.g[FS_REG].frame[0], b->texture)->shader;
|
||||
if (b->texture)
|
||||
b->shader = R_TextureAnimation(ent->framestate.g[FS_REG].frame[0], b->texture)->shader;
|
||||
b->meshes = b->maxmeshes;
|
||||
b->ent = ent;
|
||||
b->flags = bef;
|
||||
|
|
Loading…
Reference in a new issue