]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
EF_DYNAMICMODELLIGHT
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 31 Dec 2011 13:32:02 +0000 (13:32 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 31 Dec 2011 16:41:20 +0000 (17:41 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11628 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=da028866966d99b93c3a0f8049655ade5c5361a3

cl_main.c
csprogs.c
csprogs.h
dpdefs/dpextensions.qc
gl_rmain.c
protocol.h
svvm_cmds.c

index 327a2f7853c51bba602fe99d9b12255a13866582..94562c275b4e95bed839b2cee5f65f6ed03b8f31 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -1174,6 +1174,8 @@ static void CL_UpdateNetworkEntity(entity_t *e, int recursionlimit, qboolean int
                e->render.flags |= RENDER_ADDITIVE;
        if (e->render.effects & EF_DOUBLESIDED)
                e->render.flags |= RENDER_DOUBLESIDED;
+       if (e->render.effects & EF_DYNAMICMODELLIGHT)
+               e->render.flags |= RENDER_DYNAMICMODELLIGHT;
 
        // make the other useful stuff
        e->render.allowdecals = true;
index b93584188eee71a8e6947ef0e2fee934a110ad6f..7faa88772e0f86a74ed9a9de99b4acf2c224e3f4 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -373,6 +373,7 @@ qboolean CSQC_AddRenderEdict(prvm_edict_t *ed, int edictnum)
                if(renderflags & RF_WORLDOBJECT) entrender->flags |= RENDER_WORLDOBJECT;
                if(renderflags & RF_DEPTHHACK) entrender->flags |= RENDER_NODEPTHTEST;
                if(renderflags & RF_ADDITIVE) entrender->flags |= RENDER_ADDITIVE;
+               if(renderflags & RF_DYNAMICMODELLIGHT) entrender->flags |= RENDER_DYNAMICMODELLIGHT;
        }
 
        c = (int)PRVM_clientedictfloat(ed, colormap);
@@ -409,6 +410,8 @@ qboolean CSQC_AddRenderEdict(prvm_edict_t *ed, int edictnum)
                entrender->flags |= RENDER_ADDITIVE;
        if (entrender->effects & EF_DOUBLESIDED)
                entrender->flags |= RENDER_DOUBLESIDED;
+       if (entrender->effects & EF_DYNAMICMODELLIGHT)
+               entrender->flags |= RENDER_DYNAMICMODELLIGHT;
 
        // make the other useful stuff
        memcpy(entrender->framegroupblend, ed->priv.server->framegroupblend, sizeof(ed->priv.server->framegroupblend));
index 1bed1f62f3c86cc4667c1b1ef0c39705b051ec19..02fa972aee3dafde0fc7f519fbae610c770e6528 100644 (file)
--- a/csprogs.h
+++ b/csprogs.h
@@ -68,6 +68,7 @@
 #define RF_USETRANSPARENTOFFSET 64   // Allows QC to customize origin used for transparent sorting via transparent_origin global, helps to fix transparent sorting bugs on a very large entities
 #define RF_WORLDOBJECT          128  // for large outdoor entities that should not be culled
 #define RF_MODELLIGHT           4096 // CSQC-set model light
+#define RF_DYNAMICMODELLIGHT    8192 // origin-dependent model light
 
 #define RF_FULLBRIGHT                  256
 #define RF_NOSHADOW                            512
index b340bae85260d5686a769c3774946b381720f3cf..ece764cff548a5ff5d2888f62e0a8d3f625b2cb4 100644 (file)
@@ -113,6 +113,14 @@ float EF_DOUBLESIDED = 32768;
 //description:
 //render entity as double sided (backfaces are visible, I.E. you see the 'interior' of the model, rather than just the front), can be occasionally useful on transparent stuff.
 
+//DP_EF_DYNAMICMODELLIGHT
+//idea: C.Brutail, divVerent, maikmerten
+//darkplaces implementation: divVerent
+//effects bit:
+float   EF_DYNAMICMODELLIGHT     = 131072;
+//description:
+//force dynamic model light on the entity, even if it's a BSP model (or anything else with lightmaps or light colors)
+
 //DP_EF_FLAME
 //idea: LordHavoc
 //darkplaces implementation: LordHavoc
index cb376db7e6075e6850839b512537ce8bde1c4441..2166f06c85ed966d0c15f7a62c3f17fea9c20482 100644 (file)
@@ -4736,7 +4736,7 @@ static void R_View_UpdateEntityLighting (void)
                        continue;
 
                // skip bsp models
-               if (ent->model && (ent->model == cl.worldmodel || ent->model->brush.parentmodel == cl.worldmodel))
+               if (ent->model && ent->model == cl.worldmodel)
                {
                        // TODO: use modellight for r_ambient settings on world?
                        VectorSet(ent->modellight_ambient, 0, 0, 0);
@@ -7815,7 +7815,7 @@ texture_t *R_GetCurrentTexture(texture_t *t)
        {
                // no modellight if using fakelight for the map
        }
-       else if (rsurface.modeltexcoordlightmap2f == NULL && !(t->currentmaterialflags & MATERIALFLAG_FULLBRIGHT))
+       else if ((rsurface.modeltexcoordlightmap2f == NULL || (rsurface.ent_flags & (RENDER_DYNAMICMODELLIGHT | RENDER_CUSTOMIZEDMODELLIGHT))) && !(t->currentmaterialflags & MATERIALFLAG_FULLBRIGHT))
        {
                // pick a model lighting mode
                if (VectorLength2(rsurface.modellight_diffuse) >= (1.0f / 256.0f))
index 9d694f0f10eb397eb9c2e503a237e9c82ed8018f..18ca2567572dd2896fff5631572f8ac1c84262d3 100644 (file)
@@ -58,7 +58,7 @@ void Protocol_Names(char *buffer, size_t buffersize);
 #define EF_SELECTABLE                  16384           // LordHavoc: highlights when PRYDON_CLIENTCURSOR mouse is over it
 #define EF_DOUBLESIDED                 32768           //[515]: disable cull face for this entity
 #define EF_NOSELFSHADOW                        65536           // LordHavoc: does not cast a shadow on itself (or any other EF_NOSELFSHADOW entities)
-#define EF_UNUSED17                            131072
+#define EF_DYNAMICMODELLIGHT                   131072
 #define EF_UNUSED18                            262144
 #define EF_UNUSED19                            524288
 #define EF_RESTARTANIM_BIT             1048576     // div0: restart animation bit (like teleport bit, but lerps between end and start of the anim, and doesn't stop player lerping)
@@ -345,6 +345,7 @@ void Protocol_Names(char *buffer, size_t buffersize);
 #define RENDER_ADDITIVE 2097152
 #define RENDER_DOUBLESIDED 4194304
 #define RENDER_CUSTOMIZEDMODELLIGHT 4096
+#define RENDER_DYNAMICMODELLIGHT 8388608 // origin dependent model light
 
 #define MAX_FRAMEGROUPBLENDS 4
 typedef struct framegroupblend_s
index 043f2200a807fe8f9deb749cf80d8f6bb594b4e2..f899b295890a60091c7fd3f567d524a03e29fe00 100644 (file)
@@ -36,6 +36,7 @@ const char *vm_sv_extensions =
 "DP_EF_ADDITIVE "
 "DP_EF_BLUE "
 "DP_EF_DOUBLESIDED "
+"DP_EF_DYNAMICMODELLIGHT "
 "DP_EF_FLAME "
 "DP_EF_FULLBRIGHT "
 "DP_EF_NODEPTHTEST "