29 #include "../idlib/precompiled.h"
165 if ( strlen ( cam ) ) {
179 if ( strlen ( cam ) == 0) {
336 if ( !filename.
Length() ) {
341 if ( !parser.
LoadFile( filename ) ) {
353 parser.
Error(
"Invalid version %d. Should be version %d\n", version,
MD5_VERSION );
363 if ( numFrames <= 0 ) {
364 parser.
Error(
"Invalid number of frames: %d", numFrames );
377 if ( ( numCuts < 0 ) || ( numCuts > numFrames ) ) {
378 parser.
Error(
"Invalid number of camera cuts: %d", numCuts );
385 for( i = 0; i < numCuts; i++ ) {
388 parser.
Error(
"Invalid camera cut" );
397 for( i = 0; i < numFrames; i++ ) {
421 float diff_t, last_t,
t;
422 float diff_q, last_q,
q;
423 diff_t = last_t = 0.0f;
424 diff_q = last_q = 0.0f;
425 for( i = 1; i < numFrames; i++ ) {
427 q = (
camera[
i ].q.ToQuat() -
camera[ i - 1 ].q.ToQuat() ).Length();
436 gameLocal.
Printf(
"%d: %.8f : %.8f, %.8f : %.8f\n", i, t, diff_t, q, diff_q );
520 frame = frameTime / 1000;
566 SetTimeState ts( timeGroup );
575 frame = frameTime / 1000;
576 lerp = ( frameTime % 1000 ) * 0.001
f;
592 int prevFrame = prevFrameTime / 1000;
604 if ( prevCut != cut ) {
611 if ( ( frame < 0 ) || (
camera.
Num() < 2 ) ) {
639 }
else if ( lerp == 0.0
f ) {
640 camFrame = &
camera[ frame ];
645 camFrame = &
camera[ frame ];
646 invlerp = 1.0f - lerp;
649 q3.
Slerp( q1, q2, lerp );
651 view->
vieworg = camFrame[ 0 ].
t * invlerp + camFrame[ 1 ].
t * lerp +
offset;
652 view->
fov_x = camFrame[ 0 ].
fov * invlerp + camFrame[ 1 ].
fov * lerp;
661 static int lastFrame = 0;
662 static idVec3 lastFrameVec( 0.0
f, 0.0
f, 0.0
f );
virtual const idVec3 & GetOrigin(int id=0) const =0
GLdouble GLdouble GLdouble GLdouble q
idPlayer * GetLocalPlayer() const
float GetFloat(const char *key, const char *defaultString="0") const
idMat3 ToMat3(void) const
int GetInt(const char *key, const char *defaultString="0") const
const idEventDef EV_Camera_SetAttachments("<getattachments>", NULL)
idStr & SetFileExtension(const char *extension)
assert(prefInfo.fullscreenBtn)
void Restore(idRestoreGame *savefile)
void WriteObject(const idClass *obj)
void Save(idSaveGame *savefile) const
void Printf(const char *fmt,...) const id_attribute((format(printf
type * GetEntity(void) const
void SetNum(int newnum, bool resize=true)
idMat3 ToMat3(void) const
const idEventDef EV_Activate("activate","e")
idList< cameraFrame_t > camera
void void void void void Error(const char *fmt,...) const id_attribute((format(printf
static int CurrentThreadNum(void)
int Parse1DMatrix(int x, float *m)
idEntity * FindEntity(const char *name) const
void Event_SetAttachments()
void UpdatePVSAreas(void)
void SetGranularity(int newgranularity)
#define MD5_VERSION_STRING
void Draw(const idVec4 &color, float scale) const
const idEventDef EV_Camera_Stop("stop", NULL)
float ParseFloat(bool *errorFlag=NULL)
void Set(const char *key, const char *value)
idQuat & Slerp(const idQuat &from, const idQuat &to, float t)
void Event_Activate(idEntity *activator)
void WriteVec3(const idVec3 &vec)
void SetNumSamples(int num)
void Restore(idRestoreGame *savefile)
void Event_SetCallback(void)
#define EVENT(event, function)
#define ABSTRACT_DECLARATION(nameofsuperclass, nameofclass)
virtual void GetViewParms(renderView_t *view)
virtual renderView_t * GetRenderView()
idCVar g_showcamerainfo("g_showcamerainfo","0", CVAR_GAME|CVAR_ARCHIVE,"displays the current frame # for the camera when playing cinematics")
void Error(const char *str,...) id_attribute((format(printf
virtual void GetViewParms(renderView_t *view)
idEntityPtr< idEntity > activator
idCVar g_debugCinematic("g_debugCinematic","0", CVAR_GAME|CVAR_BOOL,"")
idPhysics * GetPhysics(void) const
virtual void DebugLine(const idVec4 &color, const idVec3 &start, const idVec3 &end, const int lifetime=0, const bool depthTest=false)=0
virtual renderView_t * GetRenderView()
const char * GetString(const char *key, const char *defaultString="") const
void ReadFloat(float &value)
idVec3 vec3_origin(0.0f, 0.0f, 0.0f)
void WriteFloat(const float value)
idCamera * GetCamera(void) const
bool GetBool(const char *key, const char *defaultString="0") const
virtual void UpdateChangeableSpawnArgs(const idDict *source)
void CalculateRenderView(void)
renderView_t * GetRenderView(void)
idVec3 GetVector(const char *key, const char *defaultString=NULL) const
virtual const idMat3 & GetAxis(int id=0) const =0
static void ObjectMoveDone(int threadnum, idEntity *obj)
idBounds Expand(const float d) const
void WriteInt(const int value)
void Event_Activate(idEntity *activator)
int ExpectTokenString(const char *string)
void CalcFov(float base_fov, float &fov_x, float &fov_y) const
void AddValue(float value)
void SetCamera(idCamera *cam)
idMat3 ToMat3(void) const
idQuat ToQuat(void) const
#define CLASS_DECLARATION(nameofsuperclass, nameofclass)
const char * GetName(void) const
void Save(idSaveGame *savefile) const
void ReadVec3(idVec3 &vec)
void Restore(idRestoreGame *savefile)
const char * c_str(void) const
void BecomeActive(int flags)
const idEventDef EV_Thread_SetCallback("<script_setcallback>", NULL)
virtual void DebugBounds(const idVec4 &color, const idBounds &bounds, const idVec3 &org=vec3_origin, const int lifetime=0)=0
void SetAttachment(idEntity **e, const char *p)
idRenderWorld * gameRenderWorld
char * va(const char *fmt,...)
void Save(idSaveGame *savefile) const
bool PostEventMS(const idEventDef *ev, int time)
virtual void GetViewParms(renderView_t *view)=0
const idEventDef EV_Camera_Start("start", NULL)
void BecomeInactive(int flags)
static void ReturnInt(int value)
int ReadToken(idToken *token)
void ActivateTargets(idEntity *activator) const
void ReadObject(idClass *&obj)
int LoadFile(const char *filename, bool OSPath=false)