qboolean clear;
// if true, don't clear or do any post process effects (bloom, etc)
qboolean isoverlay;
+ // if true, this is the MAIN view (which is, after CSQC, copied into the scene for use e.g. by r_speeds 1, showtex, prydon cursor)
+ qboolean ismain;
// whether to draw r_showtris and such, this is only true for the main
// view render, all secondary renders (mirrors, portals, cameras,
extern cvar_t r_equalize_entities_fullbright;
r_refdef_view_t csqc_original_r_refdef_view;
+r_refdef_view_t csqc_main_r_refdef_view;
// #1 void(vector ang) makevectors
static void VM_CL_makevectors (prvm_prog_t *prog)
case VF_CLEARSCREEN:
PRVM_G_FLOAT(OFS_RETURN) = r_refdef.view.isoverlay;
break;
+ case VF_MAINVIEW:
+ PRVM_G_FLOAT(OFS_RETURN) = r_refdef.view.ismain;
+ break;
case VF_FOG_DENSITY:
PRVM_G_FLOAT(OFS_RETURN) = r_refdef.fog_density;
break;
case VF_CLEARSCREEN:
r_refdef.view.isoverlay = !k;
break;
+ case VF_MAINVIEW:
+ PRVM_G_FLOAT(OFS_RETURN) = r_refdef.view.ismain;
+ break;
case VF_FOG_DENSITY:
r_refdef.fog_density = k;
break;
vmpolygons_t *polys = &prog->vmpolygons;
VM_SAFEPARMCOUNT(0, VM_CL_R_RenderScene);
+ // update the views
+ if(r_refdef.view.ismain)
+ {
+ // set the main view
+ csqc_main_r_refdef_view = r_refdef.view;
+
+ // clear the flags so no other view becomes "main" unless CSQC sets VF_MAINVIEW
+ r_refdef.view.ismain = false;
+ csqc_original_r_refdef_view.ismain = false;
+ }
+
// we need to update any RENDER_VIEWMODEL entities at this point because
// csqc supplies its own view matrix
CL_UpdateViewEntities();
}
extern r_refdef_view_t csqc_original_r_refdef_view;
+extern r_refdef_view_t csqc_main_r_refdef_view;
qboolean CL_VM_UpdateView (void)
{
prvm_prog_t *prog = CLVM_prog;
return false;
R_TimeReport("pre-UpdateView");
CSQC_BEGIN
+ r_refdef.view.ismain = true;
csqc_original_r_refdef_view = r_refdef.view;
+ csqc_main_r_refdef_view = r_refdef.view;
//VectorCopy(cl.viewangles, oldangles);
PRVM_clientglobalfloat(time) = cl.time;
PRVM_clientglobaledict(self) = cl.csqc_server2csqcentitynumber[cl.playerentity];
//VectorCopy(oldangles, cl.viewangles);
// Dresk : Reset Dmg Globals Here
CL_VM_UpdateDmgGlobals(0, 0, emptyvector);
- r_refdef.view = csqc_original_r_refdef_view;
+ r_refdef.view = csqc_main_r_refdef_view;
+ R_RenderView_UpdateViewVectors(); // we have to do this, as we undid the scene render doing this for us
CSQC_END
+
R_TimeReport("UpdateView");
return true;
}
#define VF_FOG_HEIGHT 210 //(float)
#define VF_FOG_FADEDEPTH 211 //(float)
+#define VF_MAINVIEW 212 //(float)
+
#define RF_VIEWMODEL 1 // The entity is never drawn in mirrors. In engines with realtime lighting, it casts no shadows.
#define RF_EXTERNALMODEL 2 // The entity is appears in mirrors but not in the normal view. It does still cast shadows in engines with realtime lighting.
#define RF_DEPTHHACK 4 // The entity appears closer to the view than normal, either by scaling it wierdly or by just using a depthrange. This will usually be found in conjunction with RF_VIEWMODEL
//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
\ No newline at end of file
+//use -1 as buffer handle to justs end delim as postdata
+
+//DP_CSQC_MAINVIEW
+//idea: divVerent
+//darkplaces implementation: divVerent
+//constant definitions:
+const float VF_MAINVIEW = 212;
+//use setproperty(VF_MAINVIEW, 1); before calling R_RenderView for the render
+//that shall become the "main" view, which is e.g. used by PRYDON_CLIENTCURSOR
+//this flag is set for the first scene, and not cleared by R_ClearScene
+//this flag is automatically cleared by R_RenderView
+//so when not using this extension, the first view rendered is the main view
R_RenderView_UpdateViewVectors
================
*/
-static void R_RenderView_UpdateViewVectors(void)
+void R_RenderView_UpdateViewVectors(void)
{
// break apart the view matrix into vectors for various purposes
// it is important that this occurs outside the RenderScene function because that can be called from reflection renders, where the vectors come out wrong
void R_Init(void);
void R_UpdateVariables(void); // must call after setting up most of r_refdef, but before calling R_RenderView
void R_RenderView(void); // must set r_refdef and call R_UpdateVariables first
+void R_RenderView_UpdateViewVectors(void); // just updates r_refdef.view.{forward,left,up,origin,right,inverse_matrix}
typedef enum r_refdef_scene_type_s {
RST_CLIENT,
"DP_CSQC_ENTITYWORLDOBJECT "
"DP_CSQC_ENTITYMODELLIGHT "
"DP_CSQC_ENTITYTRANSPARENTSORTING_OFFSET "
+"DP_CSQC_MAINVIEW "
"DP_CSQC_MULTIFRAME_INTERPOLATION "
"DP_CSQC_BOXPARTICLES "
"DP_CSQC_SPAWNPARTICLE "