mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-16 08:10:32 +02:00
Added setAnim to camera. Added global fog set via worldspawn.
This commit is contained in:
@@ -1023,6 +1023,7 @@ static const char* CAMWND_PROP_FILTER_MASK = "QER_CamWnd_FilterMask";
|
||||
#define CAMWND_MENU_CMD_RESET_FILTERS 62106
|
||||
#define CAMWND_MENU_CMD_SHOW_TARGET_LINES 62107
|
||||
#define CAMWND_MENU_CMD_SHOW_TRIGGER_BRUSHES 62108
|
||||
#define CAMWND_MENU_CMD_CUBIC_CLIPPING 62109
|
||||
|
||||
#define CAMWND_FILTER_HIDE_WORLD 0x00000001
|
||||
#define CAMWND_FILTER_HIDE_PATCHES 0x00000002
|
||||
@@ -1189,11 +1190,26 @@ static void CamWnd_ResetFilters(CCamWnd* cam) {
|
||||
CamWnd_RequestRedraw(cam);
|
||||
}
|
||||
|
||||
static void CamWnd_ToggleCubicClipping(CCamWnd* cam) {
|
||||
if (g_pParentWnd) {
|
||||
g_pParentWnd->SendMessage(WM_COMMAND, ID_VIEW_CUBICCLIPPING, 0);
|
||||
}
|
||||
else {
|
||||
g_PrefsDlg.m_bCubicClipping ^= 1;
|
||||
g_PrefsDlg.SavePrefs();
|
||||
Map_BuildBrushData();
|
||||
CamWnd_RequestRedraw(cam);
|
||||
}
|
||||
}
|
||||
|
||||
static void CamWnd_HandleMenuCommand(CCamWnd* cam, int command) {
|
||||
switch (command) {
|
||||
case CAMWND_MENU_CMD_REALTIME_LIGHTING:
|
||||
CamWnd_ToggleRealtimeLighting(cam);
|
||||
break;
|
||||
case CAMWND_MENU_CMD_CUBIC_CLIPPING:
|
||||
CamWnd_ToggleCubicClipping(cam);
|
||||
break;
|
||||
case CAMWND_MENU_CMD_SHOW_WORLD:
|
||||
CamWnd_ToggleFilterBit(cam, CAMWND_FILTER_HIDE_WORLD);
|
||||
break;
|
||||
@@ -1264,6 +1280,8 @@ static void CamWnd_ShowFiltersMenu(HWND hWnd, CCamWnd* cam) {
|
||||
ClientToScreen(hWnd, &pt);
|
||||
|
||||
menu = CreatePopupMenu();
|
||||
AppendMenu(menu, MF_STRING | (g_PrefsDlg.m_bCubicClipping ? MF_CHECKED : 0), CAMWND_MENU_CMD_CUBIC_CLIPPING, "Cubic clipping");
|
||||
AppendMenu(menu, MF_SEPARATOR, 0, NULL);
|
||||
CamWnd_AppendVisibleFilterItem(menu, mask, CAMWND_FILTER_HIDE_WORLD, CAMWND_MENU_CMD_SHOW_WORLD, "Show world geometry");
|
||||
CamWnd_AppendVisibleFilterItem(menu, mask, CAMWND_FILTER_HIDE_PATCHES, CAMWND_MENU_CMD_SHOW_PATCHES, "Show patches");
|
||||
CamWnd_AppendVisibleFilterItem(menu, mask, CAMWND_FILTER_HIDE_MODELS, CAMWND_MENU_CMD_SHOW_MODELS, "Show models");
|
||||
@@ -2834,11 +2852,11 @@ void CCamWnd::OnPaint() {
|
||||
idGraphicsDeviceContextHelper context(dc.m_hDC, hglrc, true);
|
||||
|
||||
g_pSplitList = NULL;
|
||||
if (g_bClipMode) {
|
||||
if (g_Clip1.Set() && g_Clip2.Set()) {
|
||||
g_pSplitList = ((g_pParentWnd->ActiveXY()->GetViewType() == XZ) ? !g_bSwitch : g_bSwitch) ? &g_brBackSplits : &g_brFrontSplits;
|
||||
}
|
||||
}
|
||||
//if (g_bClipMode) {
|
||||
// if (g_Clip1.Set() && g_Clip2.Set()) {
|
||||
// g_pSplitList = ((g_pParentWnd->ActiveXY()->GetViewType() == XZ) ? !g_bSwitch : g_bSwitch) ? &g_brBackSplits : &g_brFrontSplits;
|
||||
// }
|
||||
//}
|
||||
|
||||
Cam_Draw();
|
||||
}
|
||||
@@ -5369,6 +5387,45 @@ void CCamWnd::DrawEntityData() {
|
||||
This used the renderSystem to draw a fully lit view of the world
|
||||
=======================================================================================================================
|
||||
*/
|
||||
static renderGlobalFogMode_t Cam_ParseGlobalFogMode(const char* mode) {
|
||||
if (idStr::Icmp(mode, "linear") == 0) {
|
||||
return RENDER_GLOBAL_FOG_LINEAR;
|
||||
}
|
||||
if (idStr::Icmp(mode, "exp2") == 0) {
|
||||
return RENDER_GLOBAL_FOG_EXP2;
|
||||
}
|
||||
return RENDER_GLOBAL_FOG_EXP;
|
||||
}
|
||||
|
||||
static void Cam_SetGlobalFogFromWorldspawn(renderView_t& refdef) {
|
||||
renderGlobalFog_t& fog = refdef.globalFog;
|
||||
|
||||
memset(&fog, 0, sizeof(fog));
|
||||
fog.mode = RENDER_GLOBAL_FOG_EXP;
|
||||
fog.density = 1.0f;
|
||||
fog.end = 1.0f;
|
||||
fog.color.Set(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
if (world_entity == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
const idDict& args = world_entity->epairs;
|
||||
fog.enabled = args.GetBool("globalFog", args.GetString("fog_global", "0"));
|
||||
fog.mode = Cam_ParseGlobalFogMode(args.GetString("globalFogMode", args.GetString("fog_mode", "exp")));
|
||||
fog.density = args.GetFloat("globalFogDensity", args.GetString("fog_density", "1"));
|
||||
fog.start = args.GetFloat("globalFogStart", args.GetString("fog_start", "0"));
|
||||
fog.end = args.GetFloat("globalFogEnd", args.GetString("fog_end", "1"));
|
||||
|
||||
idVec3 color;
|
||||
if (args.GetVector("globalFogColor", args.GetString("fog_color", "0 0 0"), color)) {
|
||||
fog.color.x = color.x;
|
||||
fog.color.y = color.y;
|
||||
fog.color.z = color.z;
|
||||
}
|
||||
fog.color.w = args.GetFloat("globalFogAlpha", args.GetString("fog_alpha", "1"));
|
||||
}
|
||||
|
||||
void CCamWnd::Cam_Render() {
|
||||
|
||||
renderView_t refdef;
|
||||
@@ -5410,6 +5467,7 @@ void CCamWnd::Cam_Render() {
|
||||
if (animationMode) {
|
||||
refdef.time = eventLoop->Milliseconds();
|
||||
}
|
||||
Cam_SetGlobalFogFromWorldspawn(refdef);
|
||||
|
||||
g_qeglobals.rw->RenderScene(&refdef);
|
||||
|
||||
@@ -5482,4 +5540,3 @@ void CCamWnd::UpdateCameraView() {
|
||||
saveValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user