]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
UNMERGE! Various cleanup.
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 25 Mar 2018 19:51:29 +0000 (19:51 +0000)
committerRudolf Polzer <divVerent@xonotic.org>
Wed, 4 Apr 2018 21:10:23 +0000 (14:10 -0700)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12354 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::unmerge=21d5a2cb164f12c5a56fbf1a4953306b7988071c

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

index ebde7dae978654ee2e576c4a951e77c8c3e0af65..519332bad1c96eafc41710cecb0524d313752f99 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -1813,7 +1813,12 @@ 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);
@@ -1885,7 +1890,6 @@ void CSQC_RelinkAllEntities (int drawmask)
        CL_RelinkStaticEntities();
        CL_RelinkBeams();
        CL_RelinkEffects();
-       CL_RelinkLightFlashes();
 
        // link stuff
        if (drawmask & ENTMASK_ENGINE)
@@ -1948,6 +1952,7 @@ 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 bff7c5201b4333175b8fc7b0a3d6ae3abb7b4a44..444c28187667ad049ee02b4cbdb69164f8050690 100644 (file)
@@ -758,6 +758,7 @@ 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 98f114f07279296da7038e06b28dc5b1546c9d90..d1d51fabd854e48edb53689763624e62bf071726 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 0x00000001
+#define MATERIALFLAG_MESHCOLLISIONS 1
 // use alpha blend on this material
-#define MATERIALFLAG_ALPHA 0x00000002
+#define MATERIALFLAG_ALPHA 2
 // use additive blend on this material
-#define MATERIALFLAG_ADD 0x00000004
+#define MATERIALFLAG_ADD 4
 // turn off depth test on this material
-#define MATERIALFLAG_NODEPTHTEST 0x00000008
+#define MATERIALFLAG_NODEPTHTEST 8
 // multiply alpha by r_wateralpha cvar
-#define MATERIALFLAG_WATERALPHA 0x00000010
+#define MATERIALFLAG_WATERALPHA 16
 // draw with no lighting
-#define MATERIALFLAG_FULLBRIGHT 0x00000020
+#define MATERIALFLAG_FULLBRIGHT 32
 // drawn as a normal surface (alternative to SKY)
-#define MATERIALFLAG_WALL 0x00000040
+#define MATERIALFLAG_WALL 64
 // this surface shows the sky in its place, alternative to WALL
 // skipped if transparent
-#define MATERIALFLAG_SKY 0x00000080
+#define MATERIALFLAG_SKY 128
 // swirling water effect (used with MATERIALFLAG_WALL)
-#define MATERIALFLAG_WATERSCROLL 0x00000100
+#define MATERIALFLAG_WATERSCROLL 256
 // skips drawing the surface
-#define MATERIALFLAG_NODRAW 0x00000200
+#define MATERIALFLAG_NODRAW 512
 // probably used only on q1bsp water
-#define MATERIALFLAG_LIGHTBOTHSIDES 0x00000400
+#define MATERIALFLAG_LIGHTBOTHSIDES 1024
 // use alpha test on this material
-#define MATERIALFLAG_ALPHATEST 0x00000800
+#define MATERIALFLAG_ALPHATEST 2048
 // 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 0x00001000
+#define MATERIALFLAG_BLENDED 4096
 // render using a custom blendfunc
-#define MATERIALFLAG_CUSTOMBLEND 0x00002000
+#define MATERIALFLAG_CUSTOMBLEND 8192
 // do not cast shadows from this material
-#define MATERIALFLAG_NOSHADOW 0x00004000
+#define MATERIALFLAG_NOSHADOW 16384
 // render using vertex alpha (q3bsp) as texture blend parameter between foreground (normal) skinframe and background skinframe
-#define MATERIALFLAG_VERTEXTEXTUREBLEND 0x00008000
+#define MATERIALFLAG_VERTEXTEXTUREBLEND 32768
 // disables GL_CULL_FACE on this texture (making it double sided)
-#define MATERIALFLAG_NOCULLFACE 0x000100000
+#define MATERIALFLAG_NOCULLFACE 65536
 // 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 0x00020000
+#define MATERIALFLAG_SHORTDEPTHRANGE 131072
 // render water, comprising refraction and reflection (note: this is always opaque, the shader does the alpha effect)
-#define MATERIALFLAG_WATERSHADER 0x00040000
+#define MATERIALFLAG_WATERSHADER 262144
 // render refraction (note: this is just a way to distort the background, otherwise useless)
-#define MATERIALFLAG_REFRACTION 0x00080000
+#define MATERIALFLAG_REFRACTION 524288
 // render reflection
-#define MATERIALFLAG_REFLECTION 0x00100000
+#define MATERIALFLAG_REFLECTION 1048576
 // use model lighting on this material (q1bsp lightmap sampling or q3bsp lightgrid, implies FULLBRIGHT is false)
-#define MATERIALFLAG_MODELLIGHT 0x00200000
+#define MATERIALFLAG_MODELLIGHT 4194304
 // add directional model lighting to this material (q3bsp lightgrid only)
-#define MATERIALFLAG_MODELLIGHT_DIRECTIONAL 0x00400000
+#define MATERIALFLAG_MODELLIGHT_DIRECTIONAL 8388608
 // causes RSurf_GetCurrentTexture to leave alone certain fields
-#define MATERIALFLAG_CUSTOMSURFACE 0x00800000
+#define MATERIALFLAG_CUSTOMSURFACE 16777216
 // causes MATERIALFLAG_BLENDED to render a depth pass before rendering, hiding backfaces and other hidden geometry
-#define MATERIALFLAG_TRANSDEPTH 0x01000000
+#define MATERIALFLAG_TRANSDEPTH 33554432
 // like refraction, but doesn't distort etc.
-#define MATERIALFLAG_CAMERA 0x02000000
+#define MATERIALFLAG_CAMERA 67108864
 // disable rtlight on surface, use R_LightPoint instead
-#define MATERIALFLAG_NORTLIGHT 0x04000000
+#define MATERIALFLAG_NORTLIGHT 134217728
 // alphagen vertex
-#define MATERIALFLAG_ALPHAGEN_VERTEX 0x08000000
+#define MATERIALFLAG_ALPHAGEN_VERTEX 268435456
 // use occlusion buffer for corona
-#define MATERIALFLAG_OCCLUDE 0x10000000
+#define MATERIALFLAG_OCCLUDE 536870912
 // 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 b6225fdcf0614a57f5ef2d9d8cc61fd76f94bfd0..97f3d392bd487d8b1f9ffd425d245a169e601f7e 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].dptexflags |= TEXF_ALPHA;
+                                                               shader.layers[0].texflags |= TEXF_ALPHA;
                                                }
                                        }
 
@@ -2023,29 +2023,29 @@ void Mod_LoadQ3Shaders(void)
                                                        layer->blendfunc[0] = GL_SRC_ALPHA;
                                        }
                                        
-                                       layer->dptexflags = 0;
+                                       layer->texflags = 0;
                                        if (layer->alphatest)
-                                               layer->dptexflags |= TEXF_ALPHA;
+                                               layer->texflags |= TEXF_ALPHA;
                                        switch(layer->blendfunc[0])
                                        {
                                                case GL_SRC_ALPHA:
                                                case GL_ONE_MINUS_SRC_ALPHA:
-                                                       layer->dptexflags |= TEXF_ALPHA;
+                                                       layer->texflags |= TEXF_ALPHA;
                                                        break;
                                        }
                                        switch(layer->blendfunc[1])
                                        {
                                                case GL_SRC_ALPHA:
                                                case GL_ONE_MINUS_SRC_ALPHA:
-                                                       layer->dptexflags |= TEXF_ALPHA;
+                                                       layer->texflags |= TEXF_ALPHA;
                                                        break;
                                        }
                                        if (!(shader.surfaceparms & Q3SURFACEPARM_NOMIPMAPS))
-                                               layer->dptexflags |= TEXF_MIPMAP;
+                                               layer->texflags |= TEXF_MIPMAP;
                                        if (!(shader.textureflags & Q3TEXTUREFLAG_NOPICMIP))
-                                               layer->dptexflags |= TEXF_PICMIP | TEXF_COMPRESS;
+                                               layer->texflags |= TEXF_PICMIP | TEXF_COMPRESS;
                                        if (layer->clampmap)
-                                               layer->dptexflags |= TEXF_CLAMP;
+                                               layer->texflags |= TEXF_CLAMP;
                                        continue;
                                }
                                numparameters = 0;
@@ -2467,7 +2467,6 @@ 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;
@@ -2494,6 +2493,9 @@ 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;
@@ -2644,19 +2646,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].dptexflags & texflagsmask) | texflagsor, texture->name);
+                               texture->materialshaderpass = texture->shaderpasses[shaderpassindex++] = Mod_CreateShaderPassFromQ3ShaderLayer(&shader->layers[materiallayer], materiallayer, (shader->layers[materiallayer].texflags & 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].dptexflags & texflagsmask) | texflagsor, texture->name);
+                               texture->backgroundshaderpass = texture->shaderpasses[shaderpassindex++] = Mod_CreateShaderPassFromQ3ShaderLayer(&shader->layers[terrainbackgroundlayer], terrainbackgroundlayer, (shader->layers[terrainbackgroundlayer].texflags & 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].dptexflags & texflagsmask) | texflagsor, texture->name);
+                               texture->shaderpasses[shaderpassindex++] = Mod_CreateShaderPassFromQ3ShaderLayer(&shader->layers[i], i, (shader->layers[i].texflags & 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].dptexflags & texflagsmask) | texflagsor, texture->name);
+                               texture->shaderpasses[shaderpassindex++] = Mod_CreateShaderPassFromQ3ShaderLayer(&shader->layers[i], i, (shader->layers[i].texflags & texflagsmask) | texflagsor, texture->name);
                        texture->startpostshaderpass = shaderpassindex;
                }
 
index f48a1bbd08d15bb89a7c145f0573f37256e779ec..1de0db23cc77db28c09b9579ef5c5b5a1c3c678a 100644 (file)
@@ -412,7 +412,7 @@ typedef struct q3shaderinfo_layer_s
        int clampmap;
        float framerate;
        int numframes;
-       int dptexflags;
+       int texflags;
        char** texturename;
        int blendfunc[2];
        q3shaderinfo_layer_rgbgen_t rgbgen;
@@ -633,6 +633,7 @@ 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 7fcadb3b49313cf3599171bd92157196cffac980..8cd510c07a025848e6b0766f22870adc763ac6a1 100644 (file)
--- a/render.h
+++ b/render.h
@@ -92,6 +92,7 @@ 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);