For Models that doesnot have grouped frames.
Where and how i can get "frame interval"? this info stored in MDL? or in QC? or in engine itself (in exe)?
So some models have frame interval (in seconds) 0.05 for 10 fps.
Some have even 5 fps and intervel 0.5 seconds?
Where i can get fps info from model?
i use this tutorial QER: TUTORIAL 4 - Motion and Animation Interpolation for interpolation. but i modified part of code.
/*
=================
R_SetupAliasBlendedFrame
[email protected]: model animation interpolation
=================
*/
void R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t* e)
{
int pose;
int numposes;
float blend;
if ((frame >= paliashdr->numframes) || (frame < 0))
{
Con_DPrintf ("R_AliasSetupFrame: no such frame %d\n", frame);
frame = 0;
}
pose = paliashdr->frames[frame].firstpose;
numposes = paliashdr->frames[frame].numposes;
if (numposes > 1)
{
e->frame_interval = (paliashdr->frames[frame].interval);
pose += (int)(cl.time / e->frame_interval) % numposes;
}
else
{
/* One tenth of a second is a good for most Quake animations.
If the nextthink is longer then the animation is usually meant to pause
(e.g. check out the shambler magic animation in shambler.qc). If its
shorter then things will still be smoothed partly, and the jumps will be
less noticable because of the shorter time. So, this is probably a good
assumption. */
e->frame_interval = (0.01/host_frametime - 0.01/host_frametime*0.84)/2; //raven: stupid illusion of host_frametime (host_framerate in console) effect. Here is my problem i want get frame interval. or get fps of model and get interval (interval = 1/fps) fps of model = ?
}
if (e->pose2 != pose)
{
e->frame_start_time = cl.time; //raven: I am use cl.time instead realtime - host_frametime affect interpolation for grouped frames in model
e->pose1 = e->pose2;
e->pose2 = pose;
blend = 0;
}
else
{
blend = (cl.time - e->frame_start_time) / e->frame_interval; //raven: I am use cl.time instead realtime - host_frametime affect interpolation for grouped frames in model
}
// wierd things start happening if blend passes 1
if (cl.paused || blend > 1) blend = 1;
GL_DrawAliasBlendedFrame (paliashdr, e->pose1, e->pose2, blend);
}
Where and how i can get "frame interval"? this info stored in MDL? or in QC? or in engine itself (in exe)?
So some models have frame interval (in seconds) 0.05 for 10 fps.
Some have even 5 fps and intervel 0.5 seconds?
Where i can get fps info from model?
i use this tutorial QER: TUTORIAL 4 - Motion and Animation Interpolation for interpolation. but i modified part of code.
/*
=================
R_SetupAliasBlendedFrame
[email protected]: model animation interpolation
=================
*/
void R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t* e)
{
int pose;
int numposes;
float blend;
if ((frame >= paliashdr->numframes) || (frame < 0))
{
Con_DPrintf ("R_AliasSetupFrame: no such frame %d\n", frame);
frame = 0;
}
pose = paliashdr->frames[frame].firstpose;
numposes = paliashdr->frames[frame].numposes;
if (numposes > 1)
{
e->frame_interval = (paliashdr->frames[frame].interval);
pose += (int)(cl.time / e->frame_interval) % numposes;
}
else
{
/* One tenth of a second is a good for most Quake animations.
If the nextthink is longer then the animation is usually meant to pause
(e.g. check out the shambler magic animation in shambler.qc). If its
shorter then things will still be smoothed partly, and the jumps will be
less noticable because of the shorter time. So, this is probably a good
assumption. */
e->frame_interval = (0.01/host_frametime - 0.01/host_frametime*0.84)/2; //raven: stupid illusion of host_frametime (host_framerate in console) effect. Here is my problem i want get frame interval. or get fps of model and get interval (interval = 1/fps) fps of model = ?
}
if (e->pose2 != pose)
{
e->frame_start_time = cl.time; //raven: I am use cl.time instead realtime - host_frametime affect interpolation for grouped frames in model
e->pose1 = e->pose2;
e->pose2 = pose;
blend = 0;
}
else
{
blend = (cl.time - e->frame_start_time) / e->frame_interval; //raven: I am use cl.time instead realtime - host_frametime affect interpolation for grouped frames in model
}
// wierd things start happening if blend passes 1
if (cl.paused || blend > 1) blend = 1;
GL_DrawAliasBlendedFrame (paliashdr, e->pose1, e->pose2, blend);
}
Comment