From: divverent Date: Sat, 31 Dec 2011 13:32:02 +0000 (+0000) Subject: EF_DYNAMICMODELLIGHT X-Git-Tag: xonotic-v0.6.0~86^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=da028866966d99b93c3a0f8049655ade5c5361a3;p=xonotic%2Fdarkplaces.git EF_DYNAMICMODELLIGHT git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11628 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_main.c b/cl_main.c index 327a2f78..94562c27 100644 --- 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; diff --git a/csprogs.c b/csprogs.c index b9358418..7faa8877 100644 --- 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)); diff --git a/csprogs.h b/csprogs.h index 1bed1f62..02fa972a 100644 --- 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 diff --git a/dpdefs/dpextensions.qc b/dpdefs/dpextensions.qc index c2340125..0acf262b 100644 --- a/dpdefs/dpextensions.qc +++ b/dpdefs/dpextensions.qc @@ -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 diff --git a/gl_rmain.c b/gl_rmain.c index cb376db7..2166f06c 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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)) diff --git a/protocol.h b/protocol.h index 9d694f0f..18ca2567 100644 --- a/protocol.h +++ b/protocol.h @@ -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 diff --git a/svvm_cmds.c b/svvm_cmds.c index 043f2200..f899b295 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -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 "