]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
merged q3mtexture_t into texture_t, note that only the name and skin fields are share...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 6 Mar 2005 19:47:29 +0000 (19:47 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 6 Mar 2005 19:47:29 +0000 (19:47 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5046 d7cf8633-e32d-0410-b094-e92efae38249

gl_rsurf.c
model_brush.c
model_brush.h
model_shared.h

index 12916e6ec18a03ff98ae8c80f8564ee11ea42b4e..f66297ef15f0403d157c7ae033b71392b49b62a0 100644 (file)
@@ -868,9 +868,9 @@ void R_UpdateTextureInfo(entity_render_t *ent)
 
        alttextures = ent->frame != 0;
        texframe = (int)(r_refdef.time * 5.0f);
-       for (i = 0;i < ent->model->brushq1.numtextures;i++)
+       for (i = 0;i < ent->model->brush.num_textures;i++)
        {
-               t = ent->model->brushq1.textures + i;
+               t = ent->model->brush.data_textures + i;
                t->currentalpha = ent->alpha;
                if (t->flags & SURF_WATERALPHA)
                        t->currentalpha *= r_wateralpha.value;
@@ -1709,7 +1709,7 @@ void R_Q3BSP_DrawFace_TransparentCallback(const void *voident, int facenumber)
                qglEnable(GL_CULL_FACE);
 }
 
-void R_Q3BSP_DrawFaceList(entity_render_t *ent, q3mtexture_t *t, int texturenumfaces, q3msurface_t **texturefacelist)
+void R_Q3BSP_DrawFaceList(entity_render_t *ent, texture_t *t, int texturenumfaces, q3msurface_t **texturefacelist)
 {
        int i, texturefaceindex;
        qboolean dolightmap;
@@ -2048,7 +2048,7 @@ void R_Q3BSP_DrawFaces(entity_render_t *ent, int skyfaces)
        int i, j, f, flagsmask, flags;
        q3msurface_t *face;
        model_t *model = ent->model;
-       q3mtexture_t *t;
+       texture_t *t;
        const int maxfaces = 1024;
        int numfaces = 0;
        q3msurface_t *facelist[1024];
index 1c59cf953c1d4805bcb609feeb184899ee26ad6d..f3693fff6ada489f06a11529fcaa7c4b13bf9fe1 100644 (file)
@@ -966,31 +966,31 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l)
        qbyte *data, *mtdata;
        char name[256];
 
-       loadmodel->brushq1.textures = NULL;
+       loadmodel->brush.data_textures = NULL;
 
        // add two slots for notexture walls and notexture liquids
        if (l->filelen)
        {
                m = (dmiptexlump_t *)(mod_base + l->fileofs);
                m->nummiptex = LittleLong (m->nummiptex);
-               loadmodel->brushq1.numtextures = m->nummiptex + 2;
+               loadmodel->brush.num_textures = m->nummiptex + 2;
        }
        else
        {
                m = NULL;
-               loadmodel->brushq1.numtextures = 2;
+               loadmodel->brush.num_textures = 2;
        }
 
-       loadmodel->brushq1.textures = Mem_Alloc(loadmodel->mempool, loadmodel->brushq1.numtextures * sizeof(texture_t));
+       loadmodel->brush.data_textures = Mem_Alloc(loadmodel->mempool, loadmodel->brush.num_textures * sizeof(texture_t));
 
        // fill out all slots with notexture
-       for (i = 0, tx = loadmodel->brushq1.textures;i < loadmodel->brushq1.numtextures;i++, tx++)
+       for (i = 0, tx = loadmodel->brush.data_textures;i < loadmodel->brush.num_textures;i++, tx++)
        {
                strcpy(tx->name, "NO TEXTURE FOUND");
                tx->width = 16;
                tx->height = 16;
                tx->skin.base = r_notexture;
-               if (i == loadmodel->brushq1.numtextures - 1)
+               if (i == loadmodel->brush.num_textures - 1)
                        tx->flags = SURF_DRAWTURB | SURF_LIGHTBOTHSIDES;
                else
                        tx->flags = SURF_LIGHTMAP | SURF_SOLIDCLIP;
@@ -1038,7 +1038,7 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l)
                        if (name[j] >= 'A' && name[j] <= 'Z')
                                name[j] += 'a' - 'A';
 
-               tx = loadmodel->brushq1.textures + i;
+               tx = loadmodel->brush.data_textures + i;
                strcpy(tx->name, name);
                tx->width = mtwidth;
                tx->height = mtheight;
@@ -1136,7 +1136,7 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l)
        // sequence the animations
        for (i = 0;i < m->nummiptex;i++)
        {
-               tx = loadmodel->brushq1.textures + i;
+               tx = loadmodel->brush.data_textures + i;
                if (!tx || tx->name[0] != '+' || tx->name[1] == 0 || tx->name[2] == 0)
                        continue;
                if (tx->anim_total[0] || tx->anim_total[1])
@@ -1148,7 +1148,7 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l)
 
                for (j = i;j < m->nummiptex;j++)
                {
-                       tx2 = loadmodel->brushq1.textures + j;
+                       tx2 = loadmodel->brush.data_textures + j;
                        if (!tx2 || tx2->name[0] != '+' || strcmp(tx2->name+2, tx->name+2))
                                continue;
 
@@ -1546,25 +1546,25 @@ static void Mod_Q1BSP_LoadTexinfo(lump_t *l)
                out->flags = LittleLong(in->flags);
 
                out->texture = NULL;
-               if (loadmodel->brushq1.textures)
+               if (loadmodel->brush.data_textures)
                {
-                       if ((unsigned int) miptex >= (unsigned int) loadmodel->brushq1.numtextures)
-                               Con_Printf("error in model \"%s\": invalid miptex index %i(of %i)\n", loadmodel->name, miptex, loadmodel->brushq1.numtextures);
+                       if ((unsigned int) miptex >= (unsigned int) loadmodel->brush.num_textures)
+                               Con_Printf("error in model \"%s\": invalid miptex index %i(of %i)\n", loadmodel->name, miptex, loadmodel->brush.num_textures);
                        else
-                               out->texture = loadmodel->brushq1.textures + miptex;
+                               out->texture = loadmodel->brush.data_textures + miptex;
                }
                if (out->flags & TEX_SPECIAL)
                {
                        // if texture chosen is NULL or the shader needs a lightmap,
                        // force to notexture water shader
                        if (out->texture == NULL || out->texture->flags & SURF_LIGHTMAP)
-                               out->texture = loadmodel->brushq1.textures + (loadmodel->brushq1.numtextures - 1);
+                               out->texture = loadmodel->brush.data_textures + (loadmodel->brush.num_textures - 1);
                }
                else
                {
                        // if texture chosen is NULL, force to notexture
                        if (out->texture == NULL)
-                               out->texture = loadmodel->brushq1.textures + (loadmodel->brushq1.numtextures - 2);
+                               out->texture = loadmodel->brush.data_textures + (loadmodel->brush.num_textures - 2);
                }
        }
 }
@@ -3672,7 +3672,7 @@ static void Mod_Q3BSP_LoadEntities(lump_t *l)
 static void Mod_Q3BSP_LoadTextures(lump_t *l)
 {
        q3dtexture_t *in;
-       q3mtexture_t *out;
+       texture_t *out;
        int i, count;
        int j, c;
        fssearch_t *search;
@@ -3690,8 +3690,8 @@ static void Mod_Q3BSP_LoadTextures(lump_t *l)
        count = l->filelen / sizeof(*in);
        out = Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
 
-       loadmodel->brushq3.data_textures = out;
-       loadmodel->brushq3.num_textures = count;
+       loadmodel->brush.data_textures = out;
+       loadmodel->brush.num_textures = count;
 
        for (i = 0;i < count;i++, in++, out++)
        {
@@ -3886,7 +3886,7 @@ static void Mod_Q3BSP_LoadTextures(lump_t *l)
                                                        flags |= Q3SURFACEPARM_TRANS;
                                                // add shader to list (shadername and flags)
                                                // actually here we just poke into the texture settings
-                                               for (j = 0, out = loadmodel->brushq3.data_textures;j < loadmodel->brushq3.num_textures;j++, out++)
+                                               for (j = 0, out = loadmodel->brush.data_textures;j < loadmodel->brush.num_textures;j++, out++)
                                                {
                                                        if (!strcasecmp(out->name, shadername))
                                                        {
@@ -3914,7 +3914,7 @@ parseerror:
        }
 
        c = 0;
-       for (j = 0, out = loadmodel->brushq3.data_textures;j < loadmodel->brushq3.num_textures;j++, out++)
+       for (j = 0, out = loadmodel->brush.data_textures;j < loadmodel->brush.num_textures;j++, out++)
        {
                if (out->surfaceparms == -1)
                {
@@ -3985,9 +3985,9 @@ static void Mod_Q3BSP_LoadBrushSides(lump_t *l)
                        Host_Error("Mod_Q3BSP_LoadBrushSides: invalid planeindex %i (%i planes)\n", n, loadmodel->brush.num_planes);
                out->plane = loadmodel->brush.data_planes + n;
                n = LittleLong(in->textureindex);
-               if (n < 0 || n >= loadmodel->brushq3.num_textures)
-                       Host_Error("Mod_Q3BSP_LoadBrushSides: invalid textureindex %i (%i textures)\n", n, loadmodel->brushq3.num_textures);
-               out->texture = loadmodel->brushq3.data_textures + n;
+               if (n < 0 || n >= loadmodel->brush.num_textures)
+                       Host_Error("Mod_Q3BSP_LoadBrushSides: invalid textureindex %i (%i textures)\n", n, loadmodel->brush.num_textures);
+               out->texture = loadmodel->brush.data_textures + n;
        }
 }
 
@@ -4019,9 +4019,9 @@ static void Mod_Q3BSP_LoadBrushes(lump_t *l)
                out->firstbrushside = loadmodel->brushq3.data_brushsides + n;
                out->numbrushsides = c;
                n = LittleLong(in->textureindex);
-               if (n < 0 || n >= loadmodel->brushq3.num_textures)
-                       Host_Error("Mod_Q3BSP_LoadBrushes: invalid textureindex %i (%i textures)\n", n, loadmodel->brushq3.num_textures);
-               out->texture = loadmodel->brushq3.data_textures + n;
+               if (n < 0 || n >= loadmodel->brush.num_textures)
+                       Host_Error("Mod_Q3BSP_LoadBrushes: invalid textureindex %i (%i textures)\n", n, loadmodel->brush.num_textures);
+               out->texture = loadmodel->brush.data_textures + n;
 
                // make a list of mplane_t structs to construct a colbrush from
                if (maxplanes < out->numbrushsides)
@@ -4195,12 +4195,12 @@ static void Mod_Q3BSP_LoadFaces(lump_t *l)
                        }
 
                        n = LittleLong(in->textureindex);
-                       if (n < 0 || n >= loadmodel->brushq3.num_textures)
+                       if (n < 0 || n >= loadmodel->brush.num_textures)
                        {
-                               Con_DPrintf("Mod_Q3BSP_LoadFaces: face #%i: invalid textureindex %i (%i textures)\n", i, n, loadmodel->brushq3.num_textures);
+                               Con_DPrintf("Mod_Q3BSP_LoadFaces: face #%i: invalid textureindex %i (%i textures)\n", i, n, loadmodel->brush.num_textures);
                                continue;
                        }
-                       out->texture = loadmodel->brushq3.data_textures + n;
+                       out->texture = loadmodel->brush.data_textures + n;
                        n = LittleLong(in->effectindex);
                        if (n < -1 || n >= loadmodel->brushq3.num_effects)
                        {
index 535676822fdd0a341154b360c99b852311fc2095..d69cf2de2a226414aa85214dc05161db9003c6ff 100644 (file)
@@ -29,6 +29,8 @@ BRUSH MODELS
 ==============================================================================
 */
 
+#define Q3PATHLENGTH 64
+
 
 //
 // in memory representation
@@ -79,8 +81,9 @@ struct msurface_s;
 
 typedef struct texture_s
 {
+       // q1bsp
        // name
-       char name[16];
+       //char name[16];
        // size
        unsigned int width, height;
        // SURF_ flags
@@ -104,6 +107,16 @@ typedef struct texture_s
        struct texture_s *currentframe;
        // current alpha of the texture
        float currentalpha;
+
+       // q3bsp
+       char name[Q3PATHLENGTH];
+       char firstpasstexturename[Q3PATHLENGTH]; // used only during loading
+       int surfaceflags;
+       int supercontents;
+       int surfaceparms;
+       int textureflags;
+
+       //skinframe_t skin;
 }
 texture_t;
 
@@ -514,8 +527,6 @@ typedef struct
 #define        Q3LUMP_PVS                      16 // potentially visible set; bit[clusters][clusters] (used by rendering)
 #define        Q3HEADER_LUMPS          17
 
-#define Q3PATHLENGTH 64
-
 typedef struct
 {
        int                     ident;
@@ -772,18 +783,6 @@ q3dpvs_t;
 #define Q3TEXTUREFLAG_ALPHATEST 64
 
 struct q3msurface_s;
-typedef struct q3mtexture_s
-{
-       char name[Q3PATHLENGTH];
-       char firstpasstexturename[Q3PATHLENGTH];
-       int surfaceflags;
-       int supercontents;
-       int surfaceparms;
-       int textureflags;
-
-       skinframe_t skin;
-}
-q3mtexture_t;
 
 typedef struct q3mmodel_s
 {
@@ -801,14 +800,14 @@ typedef struct q3mbrush_s
        struct colbrushf_s *colbrushf;
        int numbrushsides;
        struct q3mbrushside_s *firstbrushside;
-       struct q3mtexture_s *texture;
+       struct texture_s *texture;
 }
 q3mbrush_t;
 
 typedef struct q3mbrushside_s
 {
        struct mplane_s *plane;
-       struct q3mtexture_s *texture;
+       struct texture_s *texture;
 }
 q3mbrushside_t;
 
@@ -825,7 +824,7 @@ typedef struct q3msurface_s
        // FIXME: collisionmarkframe should be kept in a separate array
        // FIXME: shadowmark should be kept in a separate array
 
-       struct q3mtexture_s *texture;
+       struct texture_s *texture;
        struct q3meffect_s *effect;
        rtexture_t *lightmaptexture;
        int collisionmarkframe; // don't collide twice in one trace
index 964622fb9067b885b59f3057a8bb4bcd2ff73f2f..a025db8e87768a7e28e4288bf407e25dd877a6be 100644 (file)
@@ -210,6 +210,9 @@ typedef struct model_brush_s
        int num_portalpoints;
        mvertex_t *data_portalpoints;
 
+       int num_textures;
+       texture_t *data_textures;
+
        // pvs
        int num_pvsclusters;
        int num_pvsclusterbytes;
@@ -268,9 +271,6 @@ typedef struct model_brushq1_s
 
        hull_t                  hulls[MAX_MAP_HULLS];
 
-       int                             numtextures;
-       texture_t               *textures;
-
        int                             num_compressedpvs;
        qbyte                   *data_compressedpvs;
 
@@ -300,9 +300,6 @@ model_brushq2_t;
 
 typedef struct model_brushq3_s
 {
-       int num_textures;
-       q3mtexture_t *data_textures;
-
        int num_models;
        q3mmodel_t *data_models;