if (renderflags & RF_USETRANSPARENTOFFSET)
entrender->transparent_offset = PRVM_clientglobalfloat(transparent_offset);
+ // model light
+ if (renderflags & RF_MODELLIGHT)
+ {
+ if(PRVM_clientedictvector(ed, modellight_ambient)) VectorCopy(PRVM_clientedictvector(ed, modellight_ambient), entrender->modellight_ambient);
+ if(PRVM_clientedictvector(ed, modellight_diffuse)) VectorCopy(PRVM_clientedictvector(ed, modellight_diffuse), entrender->modellight_diffuse);
+ if(PRVM_clientedictvector(ed, modellight_dir)) VectorCopy(PRVM_clientedictvector(ed, modellight_dir), entrender->modellight_lightdir);
+ entrender->flags |= RENDER_CUSTOMIZEDMODELLIGHT;
+ }
+
if(renderflags)
{
- if(renderflags & RF_VIEWMODEL) entrender->flags |= RENDER_VIEWMODEL | RENDER_NODEPTHTEST;
- if(renderflags & RF_EXTERNALMODEL)entrender->flags |= RENDER_EXTERIORMODEL;
- if(renderflags & RF_NOCULL) entrender->flags |= RENDER_NOCULL;
- if(renderflags & RF_DEPTHHACK) entrender->flags |= RENDER_NODEPTHTEST;
- if(renderflags & RF_ADDITIVE) entrender->flags |= RENDER_ADDITIVE;
+ if(renderflags & RF_VIEWMODEL) entrender->flags |= RENDER_VIEWMODEL | RENDER_NODEPTHTEST;
+ if(renderflags & RF_EXTERNALMODEL) entrender->flags |= RENDER_EXTERIORMODEL;
+ if(renderflags & RF_WORLDOBJECT) entrender->flags |= RENDER_WORLDOBJECT;
+ if(renderflags & RF_DEPTHHACK) entrender->flags |= RENDER_NODEPTHTEST;
+ if(renderflags & RF_ADDITIVE) entrender->flags |= RENDER_ADDITIVE;
}
c = (int)PRVM_clientedictfloat(ed, colormap);
#define RF_USEAXIS 16 // When set, the entity will use the v_forward, v_right and v_up globals instead of it's angles field for orientation. Angles will be ignored compleatly.
// Note that to use this properly, you'll NEED to use the predraw function to set the globals.
//#define RF_DOUBLESIDED 32
-#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_NOCULL 128 // do not cull this entity using r_cullentities, for large outdoor entities (asteroids on the sky. etc)
+#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_FULLBRIGHT 256
#define RF_NOSHADOW 512
// example: transparent_offset = 1000000; // entity always appear on background of other transparents
// note: offset is done in view forward axis
-// DP_CSQC_ENTITYNOCULL
+// DP_CSQC_ENTITYWORLDOBJECT
// idea: VorteX
// darkplaces implementation: VorteX
-const float RF_NOCULL = 128;
+const float RF_WORLDOBJECT = 128;
// description: when renderflag is set, engine will not use culling methods for this entity, e.g. it will always be drawn
-// useful for large outdoor objects (like asteriods on sky horizont or sky models)
-// also useful when culling is done at CSQC side
+// useful for large outdoor objects (like asteroids on sky horizon or sky models)
+
+// DP_CSQC_ENTITYMODELLIGHT
+// idea: VorteX
+// darkplaces implementation: VorteX
+const float RF_MODELLIGHT = 4096;
+.vector modellight_ambient;
+.vector modellight_diffuse;
+.vector modellight_dir;
+// description: allows CSQC to override directional model lightning on entity
// DP_CSQC_SETPAUSE
// idea: VorteX
//builtin definitions: (CSQC)
float(string url, float id, string content_type, string delim, float buf, float keyid) crypto_uri_postbuf = #513;
//description:
-//use -1 as buffer handle to justs end delim as postdata
+//use -1 as buffer handle to justs end delim as postdata
\ No newline at end of file
{
ent = r_refdef.scene.entities[i];
- // skip unseen models
- if (!r_refdef.viewcache.entityvisible[i] && skipunseen)
+ // skip unseen models and models that updated by CSQC
+ if ((!r_refdef.viewcache.entityvisible[i] && skipunseen) || ent->flags & RENDER_CUSTOMIZEDMODELLIGHT)
continue;
// skip bsp models
ent = r_refdef.scene.entities[i];
if (!(ent->flags & renderimask))
if (!R_CullBox(ent->mins, ent->maxs) || (ent->model && ent->model->type == mod_sprite && (ent->model->sprite.sprnum_type == SPR_LABEL || ent->model->sprite.sprnum_type == SPR_LABEL_SCALE)))
- if ((ent->flags & (RENDER_NODEPTHTEST | RENDER_VIEWMODEL)) || r_refdef.scene.worldmodel->brush.BoxTouchingVisibleLeafs(r_refdef.scene.worldmodel, r_refdef.viewcache.world_leafvisible, ent->mins, ent->maxs))
+ if ((ent->flags & (RENDER_NODEPTHTEST | RENDER_WORLDOBJECT | RENDER_VIEWMODEL)) || r_refdef.scene.worldmodel->brush.BoxTouchingVisibleLeafs(r_refdef.scene.worldmodel, r_refdef.viewcache.world_leafvisible, ent->mins, ent->maxs))
r_refdef.viewcache.entityvisible[i] = true;
}
}
if (!r_refdef.viewcache.entityvisible[i])
continue;
ent = r_refdef.scene.entities[i];
- if(!(ent->flags & (RENDER_VIEWMODEL | RENDER_NOCULL | RENDER_NODEPTHTEST)) && !(ent->model && (ent->model->name[0] == '*')))
+ if(!(ent->flags & (RENDER_VIEWMODEL | RENDER_WORLDOBJECT | RENDER_NODEPTHTEST)) && !(ent->model && (ent->model->name[0] == '*')))
{
samples = ent->entitynumber ? r_cullentities_trace_samples.integer : r_cullentities_trace_tempentitysamples.integer;
if (samples < 0)
Matrix4x4_CreateTranslate(&matrix, 0, 0, 0);
break;
case Q3TCMOD_ROTATE:
+ f = tcmod->parms[0] * rsurface.shadertime;
Matrix4x4_CreateTranslate(&matrix, 0.5, 0.5, 0);
- Matrix4x4_ConcatRotate(&matrix, tcmod->parms[0] * rsurface.shadertime, 0, 0, 1);
+ Matrix4x4_ConcatRotate(&matrix, (f / 360 - floor(f / 360)) * 360, 0, 0, 1);
Matrix4x4_ConcatTranslate(&matrix, -0.5, -0.5, 0);
break;
case Q3TCMOD_SCALE:
Matrix4x4_CreateTranslate(&matrix, (idx % w) / tcmod->parms[0], (idx / w) / tcmod->parms[1], 0);
break;
case Q3TCMOD_STRETCH:
- f = 1.0f / R_EvaluateQ3WaveFunc(tcmod->wavefunc, tcmod->waveparms);
+ f = 1.0f / R_EvaluateQ3WaveFunc(tcmod->wavefunc, tcmod->waveparms);ClientTime
Matrix4x4_CreateFromQuakeEntity(&matrix, 0.5f * (1 - f), 0.5 * (1 - f), 0, 0, 0, 0, f);
break;
case Q3TCMOD_TRANSFORM:
mq->ent = ent;
mq->surfacenumber = surfacenumber;
mq->rtlight = rtlight;
- mq->dist = DotProduct(center, r_refdef.view.forward) - mqt_viewplanedist;
+ if (ent && (ent->flags & RENDER_WORLDOBJECT))
+ mq->dist = mqt_viewmaxdist;
+ else
+ mq->dist = DotProduct(center, r_refdef.view.forward) - mqt_viewplanedist;
mq->next = NULL;
mqt_viewmaxdist = max(mqt_viewmaxdist, mq->dist);
}
#define RENDER_EXTERIORMODEL 8
#define RENDER_LOWPRECISION 16 // send as low precision coordinates to save bandwidth
#define RENDER_COLORMAPPED 32
-#define RENDER_NOCULL 64 // do not cull this entity with r_cullentities
+#define RENDER_WORLDOBJECT 64 // do not cull this entity with r_cullentities
#define RENDER_COMPLEXANIMATION 128
#define RENDER_SHADOW 65536 // cast shadow
#define RENDER_NODEPTHTEST 1048576
#define RENDER_ADDITIVE 2097152
#define RENDER_DOUBLESIDED 4194304
+#define RENDER_CUSTOMIZEDMODELLIGHT 4096
#define MAX_FRAMEGROUPBLENDS 4
typedef struct framegroupblend_s
PRVM_DECLARE_clientfieldvector(origin)
PRVM_DECLARE_clientfieldvector(size)
PRVM_DECLARE_clientfieldvector(velocity)
+PRVM_DECLARE_clientfieldvector(modellight_ambient)
+PRVM_DECLARE_clientfieldvector(modellight_diffuse)
+PRVM_DECLARE_clientfieldvector(modellight_dir)
PRVM_DECLARE_clientfunction(CSQC_ConsoleCommand)
PRVM_DECLARE_clientfunction(CSQC_Ent_Remove)
PRVM_DECLARE_clientfunction(CSQC_Ent_Spawn)
PRVM_DECLARE_field(userwavefunc_param3)
PRVM_DECLARE_field(v_angle)
PRVM_DECLARE_field(velocity)
+PRVM_DECLARE_field(modellight_ambient)
+PRVM_DECLARE_field(modellight_diffuse)
+PRVM_DECLARE_field(modellight_dir)
PRVM_DECLARE_field(view_ofs)
PRVM_DECLARE_field(viewmodelforclient)
PRVM_DECLARE_field(viewzoom)
"DP_CON_STARTMAP "
"DP_CRYPTO "
"DP_CSQC_BINDMAPS "
-"DP_CSQC_ENTITYNOCULL "
+"DP_CSQC_ENTITYWORLDOBJECT "
+"DP_CSQC_ENTITYMODELLIGHT "
"DP_CSQC_ENTITYTRANSPARENTSORTING_OFFSET "
"DP_CSQC_MULTIFRAME_INTERPOLATION "
"DP_CSQC_BOXPARTICLES "