From 2cecbc9f2f7fef67a411a96ccc7edafebd3ceba1 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Fri, 6 Dec 2013 21:55:30 -0500 Subject: [PATCH] Update the FOV when using plCaptureRender --- .../FeatureLib/pfCamera/plVirtualCamNeu.cpp | 27 ++++++++++--------- .../FeatureLib/pfCamera/plVirtualCamNeu.h | 3 ++- .../PubUtilLib/plPipeline/plCaptureRender.cpp | 3 +++ 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp b/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp index ee0e0adc..2e1237d3 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp +++ b/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp @@ -309,6 +309,7 @@ void plVirtualCam1::Refresh() { plPipeline* pipe = plVirtualCam1::Instance()->fPipe; SetAspectRatio((float)pipe->Width() / (float)pipe->Height()); + plVirtualCam1::Instance()->SetOutputFOV(); } void plVirtualCam1::SetAspectRatio(float ratio) @@ -845,18 +846,7 @@ void plVirtualCam1::Output() targetMatrix.GetInverse(&inverse); fPipe->SetWorldToCamera( targetMatrix, inverse ); if (HasFlags(kSetFOV)) // are we changing the field of view? - { - ClearFlags(kSetFOV); - fPipe->SetFOV(fFOVw,fFOVh); - fPipe->RefreshMatrices(); - if (foutLog) - { - fprintf(foutLog, "****************************************************************\n"); - fprintf(foutLog, "FOV changed to %f %f\n",fFOVh, fFOVw); - fprintf(foutLog, "****************************************************************\n"); - } - - } + SetOutputFOV(); /* if (foutLog) { fprintf(foutLog, "output pos %f %f %f\n", fOutputPos.fX,fOutputPos.fY,fOutputPos.fZ); @@ -865,6 +855,19 @@ void plVirtualCam1::Output() } */ } +void plVirtualCam1::SetOutputFOV() +{ + ClearFlags(kSetFOV); + fPipe->SetFOV(fFOVw, fFOVh); + fPipe->RefreshMatrices(); + if (foutLog) + { + fprintf(foutLog, "****************************************************************\n"); + fprintf(foutLog, "FOV changed to %f %f\n", fFOVh, fFOVw); + fprintf(foutLog, "****************************************************************\n"); + } +} + void plVirtualCam1::Init() { plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), GetKey()); diff --git a/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h b/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h index 4fbd5d30..04daad34 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h +++ b/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h @@ -81,9 +81,10 @@ protected: void Output(); + void SetOutputFOV(); void IUpdate(); void INext(); - + public: enum flags { diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.cpp index d67e8884..a449c863 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.cpp @@ -54,6 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsResMgr.h" #include "pnKeyedObject/plUoid.h" +#include "pfCamera/plVirtualCamNeu.h" #include "pfGameGUIMgr/pfGameGUIMgr.h" #else // MF_FRONTBUFF_CAPTURE @@ -89,12 +90,14 @@ void plCaptureRenderRequest::Render(plPipeline* pipe, plPageTreeMgr* pageMgr) // Clear our render target // Render the scene pipe->PushRenderRequest(this); + plVirtualCam1::Refresh(); pipe->ClearRenderTarget(); pageMgr->Render(pipe); pipe->PopRenderRequest(this); + plVirtualCam1::Refresh(); // set up state so we can clear the z-buffer for every gui dialog (and therefore not have it // be obscured by other geometry)