Browse Source

Implement Hor+ FOVs

Adam Johnson 12 years ago
parent
commit
38f5e6ea0a
  1. 7
      Sources/Plasma/Apps/plClient/plClient.cpp
  2. 92
      Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp
  3. 37
      Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.h
  4. 17
      Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.cpp
  5. 5
      Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.h
  6. 137
      Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp
  7. 13
      Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h
  8. 2
      Sources/Plasma/FeatureLib/pfPython/cyCamera.cpp
  9. 2
      Sources/Plasma/FeatureLib/pfPython/cyCamera.h
  10. 14
      Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp

7
Sources/Plasma/Apps/plClient/plClient.cpp

@ -1578,11 +1578,8 @@ bool plClient::StartInit()
fNewCamera->Init();
fNewCamera->SetPipeline( GetPipeline() );
float aspectratio = (float)fPipeline->Width() / (float)fPipeline->Height();
plVirtualCam1::SetAspectRatio(aspectratio);
plVirtualCam1::SetFOV(plVirtualCam1::GetFOVw(), plVirtualCam1::GetFOVh());
pfGameGUIMgr::GetInstance()->SetAspectRatio( aspectratio );
plVirtualCam1::Refresh();
pfGameGUIMgr::GetInstance()->SetAspectRatio( (float)fPipeline->Width() / (float)fPipeline->Height() );
plMouseDevice::Instance()->SetDisplayResolution((float)fPipeline->Width(), (float)fPipeline->Height());
plInputManager::SetRecenterMouse(false);

92
Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp

@ -177,18 +177,32 @@ void plCameraBrain1::Pop()
}
// set the goal to which we want to animate the fov
void plCameraBrain1::SetFOVGoal(float h, double t)
void plCameraBrain1::SetFOVGoal(float w, float h, double t)
{
if (fFOVGoal == h || h == fCamera->GetFOVh())
if (fFOVhGoal == h || h == fCamera->GetFOVh() &&
fFOVwGoal == w || w == fCamera->GetFOVw())
return;
float dif = h - fCamera->GetFOVh();
fFOVAnimRate = dif / ((float)t);
fFOVhAnimRate = dif / ((float)t);
fFOVGoal = h;
fFOVhGoal = h;
fFOVStartTime = hsTimer::GetSysSeconds();
fFOVEndTime = fFOVStartTime + t;
if (w == 0.f)
{
fFOVwGoal = IMakeFOVwZoom(h);
dif = fFOVwGoal - fCamera->GetFOVw();
fFOVwAnimRate = dif / ((float)t);
}
else
{
dif = w - fCamera->GetFOVw();
fFOVwAnimRate = dif / ((float)t);
fFOVwGoal = w;
}
fFlags.SetBit(kAnimateFOV);
}
@ -241,20 +255,25 @@ void plCameraBrain1::Update(bool forced)
// adjust FOV based on elapsed time
void plCameraBrain1::IAnimateFOV(double time)
{
float dH = fFOVAnimRate * hsTimer::GetDelSysSeconds();
float dH = fFOVhAnimRate * hsTimer::GetDelSysSeconds();
float dW = fFOVwAnimRate * hsTimer::GetDelSysSeconds();
dH += fCamera->GetFOVh();
dW += fCamera->GetFOVw();
if ( (fFOVAnimRate < 0.0f && dH <= fFOVGoal) ||
(fFOVAnimRate > 0.0f && dH >= fFOVGoal) )
if ( (fFOVhAnimRate < 0.0f && dH <= fFOVhGoal) ||
(fFOVhAnimRate > 0.0f && dH >= fFOVhGoal) )
{
fFlags.ClearBit(kAnimateFOV);
dH = fFOVGoal;
dH = fFOVhGoal;
}
if ( (fFOVwAnimRate < 0.0f && dW <= fFOVwGoal) ||
(fFOVwAnimRate > 0.0f && dW >= fFOVwGoal) )
{
dW = fFOVwGoal;
}
fCamera->SetFOVw( (float)(dH * plVirtualCam1::Instance()->GetAspectRatio()) );
fCamera->SetFOVh( dH );
if (dW == fFOVwGoal && dH == fFOVhGoal)
fFlags.ClearBit(kAnimateFOV);
fCamera->SetFOV( dW, dH );
}
// move the camera's origin point (not where it is looking) toward where it is going
@ -262,7 +281,7 @@ void plCameraBrain1::IMoveTowardGoal(double elapsedTime)
{
bool current = plVirtualCam1::Instance()->IsCurrentCamera(GetCamera());
if (fFlags.IsBitSet(kCutPos) || fFlags.IsBitSet(kNonPhys) || !current)
if (fFlags.IsBitSet(kCutPos) || fFlags.IsBitSet(kNonPhys) || !current)
{
fCamera->SetTargetPos(fGoal);
return;
@ -280,12 +299,12 @@ void plCameraBrain1::IMoveTowardGoal(double elapsedTime)
//smooth out stoppage...
float adjMaxVel = fVelocity;
if (distToGoal <= 5.0f && distToGoal > 0.1f)
{
{
float mult = (distToGoal - 5.0f)*0.1f;
adjMaxVel = fVelocity - hsABS(fVelocity*mult);
}
}
if (distToGoal > 0.0f)
dir.Normalize();
@ -536,6 +555,14 @@ void plCameraBrain1::Write(hsStream* stream, hsResMgr* mgr)
stream->WriteLEFloat(fZoomMin);
stream->WriteLEFloat(fZoomMax);
}
float plCameraBrain1::IMakeFOVwZoom(float fovH) const
{
float num = tan(hsDegreesToRadians(fovH / 2)) * tan(hsDegreesToRadians(fCamera->GetFOVw() / 2));
float denom = tan(hsDegreesToRadians(fCamera->GetFOVh() / 2));
return 2 * hsABS(hsRadiansToDegrees(atan(num / denom)));
}
bool plCameraBrain1::MsgReceive(plMessage* msg)
{
plCameraMsg* pCamMsg = plCameraMsg::ConvertNoRef(msg);
@ -544,16 +571,18 @@ bool plCameraBrain1::MsgReceive(plMessage* msg)
if (pCamMsg->Cmd(plCameraMsg::kStartZoomIn))
{
fFlags.SetBit(kAnimateFOV);
fFOVGoal = fZoomMin;
fFOVAnimRate = -1*fZoomRate;
fFOVhGoal = fZoomMin;
fFOVwGoal = IMakeFOVwZoom(fZoomMin);
fFOVwAnimRate = fFOVhAnimRate = -1*fZoomRate;
return true;
}
else
if (pCamMsg->Cmd(plCameraMsg::kStartZoomOut))
{
fFlags.SetBit(kAnimateFOV);
fFOVGoal = fZoomMax;
fFOVAnimRate = fZoomRate;
fFOVhGoal = fZoomMax;
fFOVwGoal = IMakeFOVwZoom(fZoomMax);
fFOVwAnimRate = fFOVhAnimRate = fZoomRate;
return true;
}
else
@ -637,8 +666,9 @@ bool plCameraBrain1::MsgReceive(plMessage* msg)
if (pCMsg->GetControlCode() == B_CAMERA_ZOOM_IN && fFlags.IsBitSet(kZoomEnabled))
{
fFlags.SetBit(kAnimateFOV);
fFOVGoal = fZoomMin;
fFOVAnimRate = -1*fZoomRate;
fFOVhGoal = fZoomMin;
fFOVwGoal = IMakeFOVwZoom(fZoomMin);
fFOVwAnimRate = fFOVhAnimRate = -1*fZoomRate;
fFOVEndTime = hsTimer::GetSysSeconds() + 60;
return true;
}
@ -646,8 +676,9 @@ bool plCameraBrain1::MsgReceive(plMessage* msg)
if (pCMsg->GetControlCode() == B_CAMERA_ZOOM_OUT && fFlags.IsBitSet(kZoomEnabled))
{
fFlags.SetBit(kAnimateFOV);
fFOVGoal = fZoomMax;
fFOVAnimRate = fZoomRate;
fFOVhGoal = fZoomMax;
fFOVwGoal = IMakeFOVwZoom(fZoomMin);
fFOVwAnimRate = fFOVhAnimRate = fZoomRate;
fFOVEndTime = hsTimer::GetSysSeconds() + 60;
return true;
}
@ -657,11 +688,12 @@ bool plCameraBrain1::MsgReceive(plMessage* msg)
if (fFlags.IsBitSet(kZoomEnabled))
{
fFlags.SetBit(kAnimateFOV);
fFOVGoal = fZoomMin + ((fZoomMax - fZoomMin) / 2);
if (fCamera->GetFOVw() >= fFOVGoal)
fFOVAnimRate = -1*fZoomRate;
fFOVhGoal = fZoomMin + ((fZoomMax - fZoomMin) / 2);
fFOVwGoal = IMakeFOVwZoom(fFOVhGoal);
if (fCamera->GetFOVh() >= fFOVhGoal)
fFOVwAnimRate = fFOVhAnimRate = -1*fZoomRate;
else
fFOVAnimRate = fZoomRate;
fFOVwAnimRate = fFOVhAnimRate = fZoomRate;
fFOVEndTime = hsTimer::GetSysSeconds() + 60;
}
return true;

37
Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.h

@ -128,7 +128,7 @@ public:
void SetGoal(hsPoint3 pt) { fGoal = pt; }
void SetPOAGoal(hsPoint3 pt) { fPOAGoal = pt; }
void SetFOVGoal(float h, double t);
void SetFOVGoal(float w, float h, double t);
void SetZoomParams(float max, float min, float rate);
void SetXPanLimit(float x) {fXPanLimit = x;}
@ -173,16 +173,17 @@ protected:
void IMoveTowardGoal(double time);
void IPointTowardGoal(double time);
void IAnimateFOV(double time);
void IAdjustVelocity(float adjAccelRate,
float adjDecelRate,
hsVector3* dir,
hsVector3* vel,
float maxSpeed,
void IAdjustVelocity(float adjAccelRate,
float adjDecelRate,
hsVector3* dir,
hsVector3* vel,
float maxSpeed,
float distToGoal,
double elapsedTime);
float IClampVelocity(hsVector3* vel, float maxSpeed, double elapsedTime);
bool IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal);
bool IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal);
float IMakeFOVwZoom(float fovH) const;
plCameraModifier1* fCamera;
plKey fSubjectKey;
@ -197,25 +198,25 @@ protected:
float fPOAVelocity;
float fPOAAccel;
float fPOADecel;
hsVector3 fPOAOffset;
hsPoint3 fGoal;
hsPoint3 fPOAGoal;
hsVector3 fPOAOffset;
hsPoint3 fGoal;
hsPoint3 fPOAGoal;
float fXPanLimit;
float fZPanLimit;
float fPanSpeed;
float fFOVGoal;
double fFOVStartTime;
double fFOVEndTime;
float fFOVAnimRate;
float fFOVwGoal, fFOVhGoal;
double fFOVStartTime;
double fFOVEndTime;
float fFOVwAnimRate, fFOVhAnimRate;
float fZoomRate;
float fZoomMax;
float fZoomMin;
hsBitVector fMoveFlags;
hsBitVector fFlags;
hsMatrix44 fTargetMatrix;
hsBitVector fMoveFlags;
hsBitVector fFlags;
hsMatrix44 fTargetMatrix;
float fOffsetLength;
float fOffsetPct;
double fFallTimer;
double fFallTimer;
};
class plControlEventMsg;

17
Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.cpp

@ -135,20 +135,28 @@ plSceneObject* plCameraModifier1::GetSubject()
return GetBrain()->GetSubject();
else
return fSubObj;
}
}
void plCameraModifier1::SetFOV(float w, float h, bool fUpdateVCam)
{
fFOVw = w;
fFOVh = h;
if (plVirtualCam1::Instance() && fUpdateVCam)
plVirtualCam1::SetFOV(this);
}
void plCameraModifier1::SetFOVw(float f, bool fUpdateVCam)
{
fFOVw = f;
if (plVirtualCam1::Instance() && fUpdateVCam)
plVirtualCam1::SetFOV(fFOVw, fFOVh, this);
plVirtualCam1::SetFOV(this);
}
void plCameraModifier1::SetFOVh(float f, bool fUpdateVCam)
{
fFOVh = f;
if (plVirtualCam1::Instance() && fUpdateVCam)
plVirtualCam1::SetFOV(fFOVw, fFOVh, this);
plVirtualCam1::SetFOV(this);
}
bool plCameraModifier1::SetFaded(bool b)
@ -192,8 +200,9 @@ bool plCameraModifier1::MsgReceive(plMessage* msg)
double time2 = (double)pEventMsg->fEventTime;
time = hsABS(time - time2);
float h = fFOVInstructions[pEventMsg->fIndex]->GetConfig()->fFOVh;
float w = fFOVInstructions[pEventMsg->fIndex]->GetConfig()->fFOVw;
if (GetBrain())
GetBrain()->SetFOVGoal(h, time);
GetBrain()->SetFOVGoal(w, h, time);
}
plAnimCmdMsg* pAnimMsg = plAnimCmdMsg::ConvertNoRef(msg);

5
Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.h

@ -128,8 +128,9 @@ public:
void SetTargetPOA(hsPoint3 pos) { fAt = pos; }
void SetSubworldPos(hsPoint3 pos) { fLastSubPos = pos; }
void SetSubworldPOA(hsPoint3 pos) { fLastSubPOA = pos; }
float GetFOVw() { return fFOVw; }
float GetFOVh() { return fFOVh; }
float GetFOVw() const { return fFOVw; }
float GetFOVh() const { return fFOVh; }
void SetFOV(float w, float h, bool fUpdateVCam = true);
void SetFOVw(float f, bool fUpdateVCam = true);
void SetFOVh(float f, bool fUpdateVCam = true);
bool GetInSubworld() { return fInSubLastUpdate; }

137
Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp

@ -88,25 +88,22 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsGeometry3.h"
#include "hsQuat.h"
float plVirtualCam1::fFOVw = 45.0f;
float plVirtualCam1::fFOVh = 33.75f;
float plVirtualCam1::fHither = 0.3f;
float plVirtualCam1::fYon = 500.0f;
bool plVirtualCam1::printFOV = false;
bool plVirtualCam1::fUseAccelOverride = 1;
bool plVirtualCam1::freeze = 0;
//float plVirtualCam1::fAccel = 5.0f;
//float plVirtualCam1::fDecel = 5.0f;
//float plVirtualCam1::fVel = 10.0f;
float plVirtualCam1::fAccel = 50.0f;
float plVirtualCam1::fDecel = 50.0f;
float plVirtualCam1::fVel = 100.0f;
float plVirtualCam1::fPanResponseTime = 3.0f;
float plVirtualCam1::fFallTimerDelay = 0.25f;
bool plVirtualCam1::alwaysCutForColin = false;
bool plVirtualCam1::WalkPan3rdPerson = false;
bool plVirtualCam1::StayInFirstPersonForever = false;
float plVirtualCam1::fAspectRatio = fFOVw / fFOVh;
float plVirtualCam1::fFOVw = 45.0f;
float plVirtualCam1::fFOVh = 33.75f;
float plVirtualCam1::fAspectRatio = 4.f/3.f;
float plVirtualCam1::fHither = 0.3f;
float plVirtualCam1::fYon = 500.0f;
bool plVirtualCam1::printFOV = false;
bool plVirtualCam1::fUseAccelOverride = 1;
bool plVirtualCam1::freeze = 0;
float plVirtualCam1::fAccel = 50.0f;
float plVirtualCam1::fDecel = 50.0f;
float plVirtualCam1::fVel = 100.0f;
float plVirtualCam1::fPanResponseTime = 3.0f;
float plVirtualCam1::fFallTimerDelay = 0.25f;
bool plVirtualCam1::alwaysCutForColin = false;
bool plVirtualCam1::WalkPan3rdPerson = false;
bool plVirtualCam1::StayInFirstPersonForever = false;
// #define STATUS_LOG
@ -269,7 +266,7 @@ void plVirtualCam1::RebuildStack(const plKey& key)
pMsg->AddReceiver(plNetClientMgr::GetInstance()->GetLocalPlayerKey());
plgDispatch::MsgSend(pMsg);
}
fForceCutOnce=true;
}
@ -286,54 +283,43 @@ void plVirtualCam1::SetOffset(float x, float y, float z)
}
// static function
void plVirtualCam1::SetFOV(float x, float y)
void plVirtualCam1::SetFOV(float w, float h)
{
static float fourXthree = (4.f/3.f);
float fovW = y * fAspectRatio;
fFOVw = fovW;
fFOVh = y;
if (! plVirtualCam1::Instance()->fPipe)
return;
fFOVh = h;
if (fAspectRatio == fourXthree)
fFOVw = w;
else
{
float scale = fAspectRatio / fourXthree;
fFOVw = 2 * hsRadiansToDegrees(atan(scale * tan(hsDegreesToRadians(w/2))));
}
plVirtualCam1::Instance()->SetFlags(plVirtualCam1::kSetFOV);
#ifdef STATUS_LOG
if (printFOV)
camLog->AddLineF("FOV changed by console command to %f", fFOVw);
#endif
}
// static function
void plVirtualCam1::SetFOV(float x, float y, plCameraModifier1* pCam)
void plVirtualCam1::SetFOV(plCameraModifier1* pCam)
{
if (plVirtualCam1::Instance()->GetCurrentCamera() != pCam)
return;
SetFOV(pCam->GetFOVw(), pCam->GetFOVh());
}
float diff = hsABS(fFOVw - x);
if (diff > 10.0f)
{
#ifdef STATUS_LOG
camLog->AddLineF("Radical FOV change of %f", diff);
#endif
}
float fovW = y * fAspectRatio;
void plVirtualCam1::Refresh()
{
plPipeline* pipe = plVirtualCam1::Instance()->fPipe;
SetAspectRatio((float)pipe->Width() / (float)pipe->Height());
}
fFOVw = fovW;
fFOVh = y;
void plVirtualCam1::SetAspectRatio(float ratio)
{
fAspectRatio = ratio;
if (! plVirtualCam1::Instance()->fPipe)
return;
plVirtualCam1::Instance()->SetFlags(plVirtualCam1::kSetFOV);
#ifdef STATUS_LOG
if (printFOV)
camLog->AddLineF("FOV changed to %f", fFOVw);
#endif
// resize the FOV accordingly
plCameraModifier1* pCam = plVirtualCam1::Instance()->GetCurrentCamera();
hsAssert(pCam, "CameraModifier1 shouldn't be nullptr?");
if (pCam)
SetFOV(pCam->GetFOVw(), pCam->GetFOVh());
}
// static function
@ -913,7 +899,7 @@ void plVirtualCam1::FirstPersonOverride()
#ifdef STATUS_LOG
camLog->AddLineF("Built-In First Person Camera Disabled");
#endif
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
SetFOV(GetCurrentStackCamera());
GetCurrentStackCamera()->Push(!HasFlags(kAvatarWalking));
plAvatarInputInterface::GetInstance()->CameraInThirdPerson(true);
FreezeOutput(2);
@ -938,7 +924,7 @@ void plVirtualCam1::FirstPersonOverride()
fFirstPersonOverride = (plCameraModifier1*)pKey->GetObjectPtr();
GetCurrentStackCamera()->Pop();
fFirstPersonOverride->Push(!HasFlags(kAvatarWalking));
SetFOV(fFirstPersonOverride->GetFOVw(), fFirstPersonOverride->GetFOVh(), fFirstPersonOverride);
SetFOV(fFirstPersonOverride);
plAvatarInputInterface::GetInstance()->CameraInThirdPerson(false);
// no need to keep transitioning if we are currently...
if (fTransPos == POS_TRANS_FOLLOW)
@ -1178,12 +1164,12 @@ bool plVirtualCam1::MsgReceive(plMessage* msg)
#endif
if (fFirstPersonOverride)
{
SetFOV(fFirstPersonOverride->GetFOVw(), fFirstPersonOverride->GetFOVh(), fFirstPersonOverride);
SetFOV(fFirstPersonOverride);
fFirstPersonOverride->Push(!HasFlags(kAvatarWalking));
}
else
{
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
SetFOV(GetCurrentStackCamera());
GetCurrentStackCamera()->Push(!HasFlags(kAvatarWalking));
}
@ -1243,7 +1229,7 @@ bool plVirtualCam1::MsgReceive(plMessage* msg)
pTrans->fCutPOA = pTrans->fCutPos = true;
StartTransition(pTrans);
delete(pTrans);
SetFOV(fPythonOverride->GetFOVw(), fPythonOverride->GetFOVh(), fPythonOverride);
SetFOV(fPythonOverride);
ClearFlags(kFirstPersonEnabled);
}
}
@ -1289,7 +1275,7 @@ bool plVirtualCam1::MsgReceive(plMessage* msg)
#ifdef STATUS_LOG
camLog->AddLineF("Forcing 3rd Person from scripts");
#endif
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
SetFOV(GetCurrentStackCamera());
}
}
}
@ -1320,7 +1306,7 @@ bool plVirtualCam1::MsgReceive(plMessage* msg)
#ifdef STATUS_LOG
camLog->AddLineF("Forcing 3rd Person from code");
#endif
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
SetFOV(GetCurrentStackCamera());
}
ClearFlags(kFirstPersonEnabled);
#ifdef STATUS_LOG
@ -1673,9 +1659,9 @@ void plVirtualCam1::PushCamera(plCameraModifier1* pCam, bool bDefault)
AddCameraToStack(pCam);
#ifdef STATUS_LOG
camLog->AddLineF("Camera %s is now the DEFAULT camera for this age", pCam->GetKeyName().c_str());
#endif
#endif
}
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
SetFOV(GetCurrentStackCamera());
}
void plVirtualCam1::PopCamera(plCameraModifier1* pCam)
@ -1812,7 +1798,7 @@ void plVirtualCam1::PopCamera(plCameraModifier1* pCam)
fCameraStack.erase(it);
}
if (!InTransition())
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
SetFOV(GetCurrentStackCamera());
}
void plVirtualCam1::PopAll()
@ -1831,7 +1817,6 @@ void plVirtualCam1::StartTransition(CamTrans* transition)
{
GetCurrentStackCamera()->GetBrain()->SetFlags(plCameraBrain1::kCutPOAOnce);
GetCurrentStackCamera()->GetBrain()->SetFlags(plCameraBrain1::kCutPosOnce);
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
fXPanLimit = GetCurrentStackCamera()->GetBrain()->GetXPanLimit();
fZPanLimit = GetCurrentStackCamera()->GetBrain()->GetZPanLimit();
StartInterpPanLimits();
@ -1877,7 +1862,7 @@ void plVirtualCam1::StartTransition(CamTrans* transition)
// pAvBrain->SetFlags(plCameraBrain1::kCutPOA);
// }
pAvBrain->SetSubject(pCam->GetBrain()->GetSubject());
pBrain = pAvBrain;
pBrain = pAvBrain;
}
else
{
@ -1960,12 +1945,12 @@ void plVirtualCam1::StartTransition(CamTrans* transition)
if (transition->fCutPOA)
{
pBrain->SetFlags(plCameraBrain1::kCutPOA);
pCam->GetBrain()->SetFlags(plCameraBrain1::kCutPOAOnce);
pCam->GetBrain()->SetFlags(plCameraBrain1::kCutPOAOnce);
}
fTransitionCamera->SetBrain(pBrain);
pBrain->SetCamera(fTransitionCamera);
// deal with FOV -
// deal with FOV -
float diffH = hsABS(pCam->GetFOVh() - fPrevCam->GetFOVh());
if ( diffH )
{
@ -1982,13 +1967,9 @@ void plVirtualCam1::StartTransition(CamTrans* transition)
hsPoint3 posdist = fTransitionCamera->GetTargetPos() - pCam->GetTargetPos();
dist.Set(&posdist);
}
time = (double)(dist.Magnitude() / pBrain->GetVelocity());
// set up the transition camera to the current FOV
fTransitionCamera->SetFOVh(GetFOVh(), false);
fTransitionCamera->SetFOVw(GetFOVw(), false);
fTransitionCamera->GetBrain()->SetFOVGoal(pCam->GetFOVh(), time);
time = (dist.Magnitude() / pBrain->GetVelocity());
fTransitionCamera->GetBrain()->SetFOVGoal(pCam->GetFOVw(), pCam->GetFOVh(), time);
}
StartInterpPanLimits();

13
Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h

@ -123,17 +123,18 @@ public:
void Init();
virtual bool MsgReceive(plMessage* msg);
static void SetFOV(float w, float h);
static void SetFOV(float w, float h, plCameraModifier1* pCam);
static void SetFOV(float x, float y);
static void SetFOV(plCameraModifier1* pCam);
static void SetDepth(float h, float y);
static float GetFOVw() { return fFOVw; }
static float GetFOVh() { return fFOVh; }
static float GetHither() { return fHither; }
static float GetYon() { return fYon; }
static void SetOffset(float x, float y, float z);
static void SetAspectRatio(float aspect) { fAspectRatio = aspect; }
static void Refresh();
static float GetAspectRatio() { return fAspectRatio; }
static void SetAspectRatio(float ratio);
bool InTransition() { return fTransPos != POS_TRANS_OFF; }
plCameraModifier1* GetCurrentCamera();
plCameraModifier1* GetCurrentStackCamera();
@ -231,7 +232,7 @@ private:
double fUnPanEndTime;
double fInterpPanLimitTime;
float fRetainedFY;
// built-in cameras
plCameraModifier1* fDriveCamera; // for driving around
plCameraModifier1* fTransitionCamera; // transitions between cameras placed in scenes
@ -241,11 +242,11 @@ private:
plCameraModifier1* fThirdPersonCam; // built in third person cam for ccr's when they jump about
static float fFOVh, fFOVw;
static float fAspectRatio;
static float fHither, fYon;
static plVirtualCam1* fInstance;
static bool printFOV;
static float fPanResponseTime;
static float fAspectRatio;
bool fForceCutOnce;
};

2
Sources/Plasma/FeatureLib/pfPython/cyCamera.cpp

@ -267,7 +267,7 @@ void cyCamera::SetFOV(float fov, double t)
plCameraBrain1* camBrain = curCam->GetBrain();
if (camBrain)
{
camBrain->SetFOVGoal(fov,t);
camBrain->SetFOVGoal(0.f, fov, t);
}
}
}

2
Sources/Plasma/FeatureLib/pfPython/cyCamera.h

@ -114,7 +114,7 @@ public:
virtual void SetAspectRatio(float aspectratio) { plVirtualCam1::SetAspectRatio(aspectratio); }
virtual float GetAspectRatio() const { return plVirtualCam1::GetAspectRatio(); }
virtual void RefreshFOV() { plVirtualCam1::SetFOV(plVirtualCam1::GetFOVw(), plVirtualCam1::GetFOVh()); }
virtual void RefreshFOV() { plVirtualCam1::Refresh(); }
};

14
Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp

@ -2241,9 +2241,8 @@ void plDXPipeline::IResetToDefaults(D3DPRESENT_PARAMETERS *params)
plBitmap::SetGlobalLevelChopCount(2 - fDefaultPipeParams.TextureQuality);
// adjust camera properties
plVirtualCam1::SetAspectRatio((float)fSettings.fOrigWidth / (float)fSettings.fOrigHeight);
plVirtualCam1::SetFOV(plVirtualCam1::GetFOVw(), plVirtualCam1::GetFOVh());
plVirtualCam1::Refresh();
// fire off a message to the client so we can write defaults to the ini file, and adjust the window size
plKey clientKey = hsgResMgr::ResMgr()->FindKey( kClient_KEY );
plClientMsg* clientMsg = new plClientMsg(plClientMsg::kSetGraphicsDefaults);
@ -2406,12 +2405,10 @@ void plDXPipeline::ResetDisplayDevice(int Width, int Height, int ColorDepth, boo
// Force a device reset
fDeviceLost = true;
fForceDeviceReset = true;
plVirtualCam1::SetAspectRatio((float)Width / (float)Height);
plVirtualCam1::SetFOV(plVirtualCam1::GetFOVw(), plVirtualCam1::GetFOVh());
plVirtualCam1::Refresh();
IResetDevice();
return;
}
@ -9257,7 +9254,6 @@ void plDXPipeline::SetViewTransform(const plViewTransform& v)
}
IUpdateViewFlags();
IWorldToCameraToD3D();
}

Loading…
Cancel
Save