Various cleanup.
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 25 Mar 2018 19:51:29 +0000 (19:51 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 25 Mar 2018 19:51:29 +0000 (19:51 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12354 d7cf8633-e32d-0410-b094-e92efae38249

cl_main.c
clvm_cmds.c
model_brush.h
model_shared.c
model_shared.h
render.h

index 50e36e4..44dc047 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -1810,12 +1810,7 @@ void CL_RelinkBeams(void)
                        entrender = CL_NewTempEntity (0);
                        if (!entrender)
                                return;
-                       //VectorCopy (org, ent->render.origin);
                        entrender->model = b->model;
-                       //ent->render.effects = EF_FULLBRIGHT;
-                       //ent->render.angles[0] = pitch;
-                       //ent->render.angles[1] = yaw;
-                       //ent->render.angles[2] = rand()%360;
                        Matrix4x4_CreateFromQuakeEntity(&entrender->matrix, org[0], org[1], org[2], -pitch, yaw, lhrandom(0, 360), 1);
                        CL_UpdateRenderEntity(entrender);
                        VectorMA(org, 30, dist, org);
@@ -1887,6 +1882,7 @@ void CSQC_RelinkAllEntities (int drawmask)
        CL_RelinkStaticEntities();
        CL_RelinkBeams();
        CL_RelinkEffects();
+       CL_RelinkLightFlashes();
 
        // link stuff
        if (drawmask & ENTMASK_ENGINE)
@@ -1947,7 +1943,6 @@ void CL_UpdateWorld(void)
                // update the engine-based viewmodel
                CL_UpdateViewModel();
 
-               CL_RelinkLightFlashes();
                CSQC_RelinkAllEntities(ENTMASK_ENGINE | ENTMASK_ENGINEVIEWMODELS);
 
                // decals, particles, and explosions will be updated during rneder
index 444c281..bff7c52 100644 (file)
@@ -758,7 +758,6 @@ static void VM_CL_R_AddEntities (prvm_prog_t *prog)
        VM_SAFEPARMCOUNT(1, VM_CL_R_AddEntities);
        drawmask = (int)PRVM_G_FLOAT(OFS_PARM0);
        CSQC_RelinkAllEntities(drawmask);
-       CL_RelinkLightFlashes();
 
        PRVM_clientglobalfloat(time) = cl.time;
        for(i=1;i<prog->num_edicts;i++)
index d1d51fa..98f114f 100644 (file)
@@ -70,65 +70,65 @@ mplane_t;
 //#define SURF_PLANEBACK 2
 
 // indicates that all triangles of the surface should be added to the BIH collision system
-#define MATERIALFLAG_MESHCOLLISIONS 1
+#define MATERIALFLAG_MESHCOLLISIONS 0x00000001
 // use alpha blend on this material
-#define MATERIALFLAG_ALPHA 2
+#define MATERIALFLAG_ALPHA 0x00000002
 // use additive blend on this material
-#define MATERIALFLAG_ADD 4
+#define MATERIALFLAG_ADD 0x00000004
 // turn off depth test on this material
-#define MATERIALFLAG_NODEPTHTEST 8
+#define MATERIALFLAG_NODEPTHTEST 0x00000008
 // multiply alpha by r_wateralpha cvar
-#define MATERIALFLAG_WATERALPHA 16
+#define MATERIALFLAG_WATERALPHA 0x00000010
 // draw with no lighting
-#define MATERIALFLAG_FULLBRIGHT 32
+#define MATERIALFLAG_FULLBRIGHT 0x00000020
 // drawn as a normal surface (alternative to SKY)
-#define MATERIALFLAG_WALL 64
+#define MATERIALFLAG_WALL 0x00000040
 // this surface shows the sky in its place, alternative to WALL
 // skipped if transparent
-#define MATERIALFLAG_SKY 128
+#define MATERIALFLAG_SKY 0x00000080
 // swirling water effect (used with MATERIALFLAG_WALL)
-#define MATERIALFLAG_WATERSCROLL 256
+#define MATERIALFLAG_WATERSCROLL 0x00000100
 // skips drawing the surface
-#define MATERIALFLAG_NODRAW 512
+#define MATERIALFLAG_NODRAW 0x00000200
 // probably used only on q1bsp water
-#define MATERIALFLAG_LIGHTBOTHSIDES 1024
+#define MATERIALFLAG_LIGHTBOTHSIDES 0x00000400
 // use alpha test on this material
-#define MATERIALFLAG_ALPHATEST 2048
+#define MATERIALFLAG_ALPHATEST 0x00000800
 // treat this material as a blended transparency (as opposed to an alpha test
 // transparency), this causes special fog behavior, and disables glDepthMask
-#define MATERIALFLAG_BLENDED 4096
+#define MATERIALFLAG_BLENDED 0x00001000
 // render using a custom blendfunc
-#define MATERIALFLAG_CUSTOMBLEND 8192
+#define MATERIALFLAG_CUSTOMBLEND 0x00002000
 // do not cast shadows from this material
-#define MATERIALFLAG_NOSHADOW 16384
+#define MATERIALFLAG_NOSHADOW 0x00004000
 // render using vertex alpha (q3bsp) as texture blend parameter between foreground (normal) skinframe and background skinframe
-#define MATERIALFLAG_VERTEXTEXTUREBLEND 32768
+#define MATERIALFLAG_VERTEXTEXTUREBLEND 0x00008000
 // disables GL_CULL_FACE on this texture (making it double sided)
-#define MATERIALFLAG_NOCULLFACE 65536
+#define MATERIALFLAG_NOCULLFACE 0x000100000
 // render with a very short depth range (like 10% of normal), this causes entities to appear infront of most of the scene
-#define MATERIALFLAG_SHORTDEPTHRANGE 131072
+#define MATERIALFLAG_SHORTDEPTHRANGE 0x00020000
 // render water, comprising refraction and reflection (note: this is always opaque, the shader does the alpha effect)
-#define MATERIALFLAG_WATERSHADER 262144
+#define MATERIALFLAG_WATERSHADER 0x00040000
 // render refraction (note: this is just a way to distort the background, otherwise useless)
-#define MATERIALFLAG_REFRACTION 524288
+#define MATERIALFLAG_REFRACTION 0x00080000
 // render reflection
-#define MATERIALFLAG_REFLECTION 1048576
+#define MATERIALFLAG_REFLECTION 0x00100000
 // use model lighting on this material (q1bsp lightmap sampling or q3bsp lightgrid, implies FULLBRIGHT is false)
-#define MATERIALFLAG_MODELLIGHT 4194304
+#define MATERIALFLAG_MODELLIGHT 0x00200000
 // add directional model lighting to this material (q3bsp lightgrid only)
-#define MATERIALFLAG_MODELLIGHT_DIRECTIONAL 8388608
+#define MATERIALFLAG_MODELLIGHT_DIRECTIONAL 0x00400000
 // causes RSurf_GetCurrentTexture to leave alone certain fields
-#define MATERIALFLAG_CUSTOMSURFACE 16777216
+#define MATERIALFLAG_CUSTOMSURFACE 0x00800000
 // causes MATERIALFLAG_BLENDED to render a depth pass before rendering, hiding backfaces and other hidden geometry
-#define MATERIALFLAG_TRANSDEPTH 33554432
+#define MATERIALFLAG_TRANSDEPTH 0x01000000
 // like refraction, but doesn't distort etc.
-#define MATERIALFLAG_CAMERA 67108864
+#define MATERIALFLAG_CAMERA 0x02000000
 // disable rtlight on surface, use R_LightPoint instead
-#define MATERIALFLAG_NORTLIGHT 134217728
+#define MATERIALFLAG_NORTLIGHT 0x04000000
 // alphagen vertex
-#define MATERIALFLAG_ALPHAGEN_VERTEX 268435456
+#define MATERIALFLAG_ALPHAGEN_VERTEX 0x08000000
 // use occlusion buffer for corona
-#define MATERIALFLAG_OCCLUDE 536870912
+#define MATERIALFLAG_OCCLUDE 0x10000000
 // combined mask of all attributes that require depth sorted rendering
 #define MATERIALFLAGMASK_DEPTHSORTED (MATERIALFLAG_BLENDED | MATERIALFLAG_NODEPTHTEST)
 // combined mask of all attributes that cause some sort of transparency
index dd5e06e..2de58bd 100644 (file)
@@ -2011,7 +2011,7 @@ void Mod_LoadQ3Shaders(void)
                                                        // multilayer terrain shader or similar
                                                        shader.textureblendalpha = true;
                                                        if (mod_q3shader_force_terrain_alphaflag.integer)
-                                                               shader.layers[0].texflags |= TEXF_ALPHA;
+                                                               shader.layers[0].dptexflags |= TEXF_ALPHA;
                                                }
                                        }
 
@@ -2023,29 +2023,29 @@ void Mod_LoadQ3Shaders(void)
                                                        layer->blendfunc[0] = GL_SRC_ALPHA;
                                        }
                                        
-                                       layer->texflags = 0;
+                                       layer->dptexflags = 0;
                                        if (layer->alphatest)
-                                               layer->texflags |= TEXF_ALPHA;
+                                               layer->dptexflags |= TEXF_ALPHA;
                                        switch(layer->blendfunc[0])
                                        {
                                                case GL_SRC_ALPHA:
                                                case GL_ONE_MINUS_SRC_ALPHA:
-                                                       layer->texflags |= TEXF_ALPHA;
+                                                       layer->dptexflags |= TEXF_ALPHA;
                                                        break;
                                        }
                                        switch(layer->blendfunc[1])
                                        {
                                                case GL_SRC_ALPHA:
                                                case GL_ONE_MINUS_SRC_ALPHA:
-                                                       layer->texflags |= TEXF_ALPHA;
+                                                       layer->dptexflags |= TEXF_ALPHA;
                                                        break;
                                        }
                                        if (!(shader.surfaceparms & Q3SURFACEPARM_NOMIPMAPS))
-                                               layer->texflags |= TEXF_MIPMAP;
+                                               layer->dptexflags |= TEXF_MIPMAP;
                                        if (!(shader.textureflags & Q3TEXTUREFLAG_NOPICMIP))
-                                               layer->texflags |= TEXF_PICMIP | TEXF_COMPRESS;
+                                               layer->dptexflags |= TEXF_PICMIP | TEXF_COMPRESS;
                                        if (layer->clampmap)
-                                               layer->texflags |= TEXF_CLAMP;
+                                               layer->dptexflags |= TEXF_CLAMP;
                                        continue;
                                }
                                numparameters = 0;
@@ -2467,6 +2467,7 @@ qboolean Mod_LoadTextureFromQ3Shader(texture_t *texture, const char *name, qbool
        texture->basealpha = 1.0f;
        shader = name[0] ? Mod_LookupQ3Shader(name) : NULL;
 
+       // allow disabling of picmip or compression by defaulttexflags
        texflagsmask = ~0;
        if(!(defaulttexflags & TEXF_PICMIP))
                texflagsmask &= ~TEXF_PICMIP;
@@ -2493,9 +2494,6 @@ qboolean Mod_LoadTextureFromQ3Shader(texture_t *texture, const char *name, qbool
                if (developer_loading.integer)
                        Con_Printf("%s: loaded shader for %s\n", loadmodel->name, name);
 
-               // allow disabling of picmip or compression by defaulttexflags
-               texture->textureflags = (shader->textureflags & texflagsmask) | texflagsor;
-
                if (shader->surfaceparms & Q3SURFACEPARM_SKY)
                {
                        texture->basematerialflags = MATERIALFLAG_SKY;
@@ -2646,19 +2644,19 @@ nothing                GL_ZERO GL_ONE
                        // convert the main material layer
                        // FIXME: if alphagenspecularlayer is used, we should pass a specular texture name to R_SkinFrame_LoadExternal and have it load that texture instead of the assumed name for _gloss texture
                        if (materiallayer >= 0)
-                               texture->materialshaderpass = texture->shaderpasses[shaderpassindex++] = Mod_CreateShaderPassFromQ3ShaderLayer(&shader->layers[materiallayer], materiallayer, (shader->layers[materiallayer].texflags & texflagsmask) | texflagsor, texture->name);
+                               texture->materialshaderpass = texture->shaderpasses[shaderpassindex++] = Mod_CreateShaderPassFromQ3ShaderLayer(&shader->layers[materiallayer], materiallayer, (shader->layers[materiallayer].dptexflags & texflagsmask) | texflagsor, texture->name);
                        // convert the terrain background blend layer (if any)
                        if (terrainbackgroundlayer >= 0)
-                               texture->backgroundshaderpass = texture->shaderpasses[shaderpassindex++] = Mod_CreateShaderPassFromQ3ShaderLayer(&shader->layers[terrainbackgroundlayer], terrainbackgroundlayer, (shader->layers[terrainbackgroundlayer].texflags & texflagsmask) | texflagsor, texture->name);
+                               texture->backgroundshaderpass = texture->shaderpasses[shaderpassindex++] = Mod_CreateShaderPassFromQ3ShaderLayer(&shader->layers[terrainbackgroundlayer], terrainbackgroundlayer, (shader->layers[terrainbackgroundlayer].dptexflags & texflagsmask) | texflagsor, texture->name);
                        // convert the prepass layers (if any)
                        texture->startpreshaderpass = shaderpassindex;
                        for (i = 0; i < endofprelayers; i++)
-                               texture->shaderpasses[shaderpassindex++] = Mod_CreateShaderPassFromQ3ShaderLayer(&shader->layers[i], i, (shader->layers[i].texflags & texflagsmask) | texflagsor, texture->name);
+                               texture->shaderpasses[shaderpassindex++] = Mod_CreateShaderPassFromQ3ShaderLayer(&shader->layers[i], i, (shader->layers[i].dptexflags & texflagsmask) | texflagsor, texture->name);
                        texture->endpreshaderpass = shaderpassindex;
                        texture->startpostshaderpass = shaderpassindex;
                        // convert the postpass layers (if any)
                        for (i = firstpostlayer; i < shader->numlayers; i++)
-                               texture->shaderpasses[shaderpassindex++] = Mod_CreateShaderPassFromQ3ShaderLayer(&shader->layers[i], i, (shader->layers[i].texflags & texflagsmask) | texflagsor, texture->name);
+                               texture->shaderpasses[shaderpassindex++] = Mod_CreateShaderPassFromQ3ShaderLayer(&shader->layers[i], i, (shader->layers[i].dptexflags & texflagsmask) | texflagsor, texture->name);
                        texture->startpostshaderpass = shaderpassindex;
                }
 
index f8d3db4..94957c4 100644 (file)
@@ -406,7 +406,7 @@ typedef struct q3shaderinfo_layer_s
        int clampmap;
        float framerate;
        int numframes;
-       int texflags;
+       int dptexflags;
        char** texturename;
        int blendfunc[2];
        q3shaderinfo_layer_rgbgen_t rgbgen;
@@ -627,7 +627,6 @@ typedef struct texture_s
        char name[64];
        int surfaceflags;
        int supercontents;
-       int textureflags;
 
        // q2bsp
        // we have to load the texture multiple times when Q2SURF_ flags differ,
index cba8059..82761cb 100644 (file)
--- a/render.h
+++ b/render.h
@@ -92,7 +92,6 @@ rmesh_t;
 // useful functions for rendering
 void R_ModulateColors(float *in, float *out, int verts, float r, float g, float b);
 void R_FillColors(float *out, int verts, float r, float g, float b, float a);
-int R_Mesh_AddVertex3f(rmesh_t *mesh, const float *v);
 void R_Mesh_AddPolygon3f(rmesh_t *mesh, int numvertices, float *vertex3f);
 void R_Mesh_AddBrushMeshFromPlanes(rmesh_t *mesh, int numplanes, mplane_t *planes);