Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
115 lines
1.7 KiB
C++
115 lines
1.7 KiB
C++
#include"stdafx.h"
|
|
#include"CameraInfo.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
CameraInfo::CameraInfo()
|
|
{
|
|
ViewLoop=NULL;
|
|
CurTime=0.0f;
|
|
Mode=CM_TRACK;
|
|
Animate=true;
|
|
CamATrkFlg=true;
|
|
TarATrkFlg=true;
|
|
Vel=0.5f;
|
|
NearClip=1.0f;
|
|
FarClip=350.0f;
|
|
FOV=Stuff::Pi_Over_3;
|
|
|
|
}
|
|
|
|
CameraInfo::~CameraInfo()
|
|
{
|
|
|
|
}
|
|
|
|
void CameraInfo::ValidateTime()
|
|
{
|
|
if(CurTime<=-1.0f) CurTime=0.0f;
|
|
else
|
|
if(CurTime<0.0f) CurTime=1.0f+CurTime;
|
|
|
|
if(CurTime>=2.0f) CurTime=0.0f;
|
|
else
|
|
if(CurTime>=1.0f) CurTime-=1.0f;
|
|
|
|
|
|
}
|
|
|
|
|
|
void CameraInfo::SetTime(float tme)
|
|
{
|
|
CurTime=tme;
|
|
ValidateTime();
|
|
UpdateCPos();
|
|
}
|
|
|
|
void CameraInfo::AddTime(float tme)
|
|
{
|
|
if(!Animate || Mode==CM_FREE) return;
|
|
CurTime+=tme*Vel;
|
|
ValidateTime();
|
|
UpdateCPos();
|
|
}
|
|
|
|
void CameraInfo::ZeroTime()
|
|
{
|
|
CurTime=0.0;
|
|
UpdateCPos();
|
|
}
|
|
|
|
void CameraInfo::SetMode(CAMMODE cmd)
|
|
{
|
|
Mode=cmd;
|
|
//if(CMode==CM_FREE) CMode.Animate=false;
|
|
}
|
|
|
|
void CameraInfo::UpdateCPos()
|
|
{
|
|
if(!ViewLoop) return;
|
|
Stuff::Point3D p3d;
|
|
Stuff::Vector3D v3d;
|
|
|
|
float tme=CurTime;
|
|
|
|
if(UseTarget && TargetLoc==Loc) TargetLoc.x+=0.0001f;
|
|
|
|
if(Mode==CM_TRACK)
|
|
{
|
|
ViewLoop->Evaluate(tme,&p3d,&v3d);
|
|
|
|
Loc.x=p3d.x;
|
|
Loc.z=p3d.z;
|
|
|
|
if(UseTarget)
|
|
{
|
|
v3d.x=TargetLoc.x-Loc.x;
|
|
v3d.y=TargetLoc.y-Loc.y;
|
|
v3d.z=TargetLoc.z-Loc.z;
|
|
}
|
|
|
|
v3d.Normalize(v3d);
|
|
Dir=v3d;
|
|
}
|
|
|
|
|
|
if(Mode==CameraInfo::CM_FREE)
|
|
{
|
|
if(UseTarget)
|
|
{
|
|
v3d.x=TargetLoc.x-Loc.x;
|
|
v3d.y=TargetLoc.y-Loc.y;
|
|
v3d.z=TargetLoc.z-Loc.z;
|
|
v3d.Normalize(v3d);
|
|
Dir=v3d;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|