2001-05-20 02:39:56 +00:00
|
|
|
/*
|
|
|
|
r_tent.c
|
|
|
|
|
|
|
|
rendering entities
|
|
|
|
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2003-01-15 15:31:36 +00:00
|
|
|
|
2001-05-20 02:39:56 +00:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
# include <string.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
# include <strings.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2021-07-24 05:19:52 +00:00
|
|
|
#include "QF/scene/entity.h"
|
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
#include "r_internal.h"
|
2001-05-20 02:39:56 +00:00
|
|
|
|
2012-01-04 09:30:47 +00:00
|
|
|
float
|
2021-07-22 06:39:28 +00:00
|
|
|
R_EntityBlend (animation_t *animation, int pose, float interval)
|
2012-01-04 09:30:47 +00:00
|
|
|
{
|
|
|
|
float blend;
|
|
|
|
|
2021-07-22 06:39:28 +00:00
|
|
|
if (animation->nolerp) {
|
|
|
|
animation->nolerp = 0;
|
|
|
|
animation->pose1 = pose;
|
|
|
|
animation->pose2 = pose;
|
2012-04-25 01:09:23 +00:00
|
|
|
return 0.0;
|
|
|
|
}
|
2021-07-22 06:39:28 +00:00
|
|
|
animation->frame_interval = interval;
|
|
|
|
if (animation->pose2 != pose) {
|
|
|
|
animation->frame_start_time = vr_data.realtime;
|
|
|
|
if (animation->pose2 == -1) {
|
|
|
|
animation->pose1 = pose;
|
2012-01-04 09:30:47 +00:00
|
|
|
} else {
|
2021-07-22 06:39:28 +00:00
|
|
|
animation->pose1 = animation->pose2;
|
2012-01-04 09:30:47 +00:00
|
|
|
}
|
2021-07-22 06:39:28 +00:00
|
|
|
animation->pose2 = pose;
|
2012-01-04 09:30:47 +00:00
|
|
|
blend = 0.0;
|
2012-02-14 08:28:09 +00:00
|
|
|
} else if (vr_data.paused) {
|
2012-01-04 09:30:47 +00:00
|
|
|
blend = 1.0;
|
|
|
|
} else {
|
2021-07-22 06:39:28 +00:00
|
|
|
blend = (vr_data.realtime - animation->frame_start_time)
|
|
|
|
/ animation->frame_interval;
|
2012-01-04 09:30:47 +00:00
|
|
|
blend = min (blend, 1.0);
|
|
|
|
}
|
|
|
|
return blend;
|
|
|
|
}
|