GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
OGSF library - setting and manipulating keyframes animation (lower level functions) More...
#include <stdlib.h>
#include <math.h>
#include <grass/gis.h>
#include <grass/glocale.h>
#include <grass/gstypes.h>
#include <grass/keyframe.h>
#include <grass/kftypes.h>
Go to the source code of this file.
Functions | |
Keylist * | gk_copy_key (Keylist *k) |
Copy keyframes. More... | |
unsigned long | gk_get_mask_sofar (float time, Keylist *keys) |
Get mask value. More... | |
int | gk_viable_keys_for_mask (unsigned long mask, Keylist *keys, Keylist **keyret) |
ADD. More... | |
void | gk_follow_frames (Viewnode *view, int numsteps, Keylist *keys, int step, int onestep, int render, unsigned long mode) |
Checks key masks. More... | |
void | gk_free_key (Keylist *ok) |
Free keyframe list. More... | |
Viewnode * | gk_make_framesfromkeys (Keylist *keys, int keysteps, int newsteps, int loop, float t) |
Generate viewnode from keyframes. More... | |
double | get_key_neighbors (int nvk, double time, double range, int loop, Keylist *karray[], Keylist **km1, Keylist **kp1, Keylist **kp2, Keylist **km2, double *dt1, double *dt2) |
Find interval containing time. More... | |
double | lin_interp (float dt, float val1, float val2) |
Linear interpolation. More... | |
double | get_2key_neighbors (int nvk, float time, float range, int loop, Keylist *karray[], Keylist **km1, Keylist **kp1) |
Finds interval containing time, putting left (or equal) key at km1, right at kp1. More... | |
Viewnode * | gk_make_linear_framesfromkeys (Keylist *keys, int keysteps, int newsteps, int loop) |
Generate viewnode from keyframe list (linear interpolation) More... | |
void | correct_twist (Keylist *k) |
Correct twist value. More... | |
int | gk_draw_path (Viewnode *views, int steps, Keylist *keys) |
Draw path. More... | |
OGSF library - setting and manipulating keyframes animation (lower level functions)
GRASS OpenGL gsurf OGSF Library
(C) 1999-2008 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file gk.c.
void correct_twist | ( | Keylist * | k | ) |
Correct twist value.
k | keyframe list |
Definition at line 702 of file gk.c.
References NULL.
Referenced by gk_make_framesfromkeys(), and gk_make_linear_framesfromkeys().
double get_2key_neighbors | ( | int | nvk, |
float | time, | ||
float | range, | ||
int | loop, | ||
Keylist * | karray[], | ||
Keylist ** | km1, | ||
Keylist ** | kp1 | ||
) |
Finds interval containing time, putting left (or equal) key at km1, right at kp1.
nvk | |
time | |
range | |
loop | |
karray | |
km1 | |
km2 |
Definition at line 560 of file gk.c.
References NULL, and tools::pos.
Referenced by gk_make_linear_framesfromkeys().
double get_key_neighbors | ( | int | nvk, |
double | time, | ||
double | range, | ||
int | loop, | ||
Keylist * | karray[], | ||
Keylist ** | km1, | ||
Keylist ** | kp1, | ||
Keylist ** | kp2, | ||
Keylist ** | km2, | ||
double * | dt1, | ||
double * | dt2 | ||
) |
Find interval containing time.
Changed June 94 to handle masks - now need to have called get_viable_keys for appropriate mask first to build the ARRAY of viable keyframes.
Putting left (or equal) key at km1, right at kp1, 2nd to right at kp2, and second to left at km2. dt1 is given the length of the current + left intervals dt2 is given the length of the current + right intervals
nvk | |
time | |
range | |
loop | |
karray | |
km1 | |
kp1 | |
kp2 | |
km2 | |
dt1 | |
dt2 |
Definition at line 457 of file gk.c.
References NULL, tools::pos, and tools::range.
Referenced by gk_make_framesfromkeys().
Keylist* gk_copy_key | ( | Keylist * | k | ) |
Draw path.
views | Viewnode struct |
steps | step value |
keys | keyframe list |
Definition at line 740 of file gk.c.
References mcalc_builder::frame, GS_background_color(), GS_default_draw_color(), GS_get_from(), GS_get_longdim(), gsd_bgnline(), gsd_color_func(), gsd_colormode(), gsd_endline(), gsd_linewidth(), gsd_vert_func(), gsd_x(), gsd_zwritemask(), and NULL.
Referenced by gk_follow_frames(), GK_set_tension(), and GK_show_path().
void gk_follow_frames | ( | Viewnode * | view, |
int | numsteps, | ||
Keylist * | keys, | ||
int | step, | ||
int | onestep, | ||
int | render, | ||
unsigned long | mode | ||
) |
Checks key masks.
Because if they're masked up until the current position, pre-existing (or current) field should be used.
view | pointer to Viewmode struct |
numsteps | number of steps |
keys | list of keyframes |
step | step value |
onestep | |
render | |
mode |
Definition at line 143 of file gk.c.
References mcalc_builder::frame, G_debug(), gk_draw_path(), gk_get_mask_sofar(), GP_alldraw_site(), GS_alldraw_cplane_fences(), GS_alldraw_surf(), GS_alldraw_wire(), GS_background_color(), GS_clear(), GS_done_draw(), GS_draw_all_list(), GS_get_from(), GS_get_viewdir(), GS_getlight_position(), GS_moveto(), GS_ready_draw(), GS_set_draw(), GS_set_fov(), GS_set_twist(), GS_set_viewdir(), GS_setlight_position(), GV_alldraw_vect(), GVL_alldraw_vol(), num, dialogs::w, X, y, and Y.
Referenced by GK_do_framestep().
void gk_free_key | ( | Keylist * | ok | ) |
Free keyframe list.
ok | pointer to Keylist struct |
Definition at line 273 of file gk.c.
References G_free().
Referenced by GK_clear_keys().
unsigned long gk_get_mask_sofar | ( | float | time, |
Keylist * | keys | ||
) |
Get mask value.
Get begin & end pos, AND all masks in keys <= pos
Time must be between 0.0 & 1.0
time | timestamp |
keys | list of keyframes |
Definition at line 81 of file gk.c.
Referenced by gk_follow_frames().
Generate viewnode from keyframes.
Here we use a cardinal cubic spline
keys | list of keyframes |
keysteps | keyframe step |
newsteps | new step value |
loop | loop indicator |
t |
Definition at line 303 of file gk.c.
References correct_twist(), G_free(), G_warning(), get_key_neighbors(), gk_viable_keys_for_mask(), lin_interp(), NULL, and tools::range.
Referenced by GK_update_frames().
Generate viewnode from keyframe list (linear interpolation)
Here we use linear interpolation. Loop variable isn't used, but left in for use in possible "linear interp with smoothing" version.
kesy | keyframe list |
keysteps | step value |
newsteps | new step value |
loop | loop indicator |
pointer | to viewnode struct |
NULL | on failure |
Definition at line 606 of file gk.c.
References correct_twist(), G_free(), G_warning(), get_2key_neighbors(), gk_viable_keys_for_mask(), lin_interp(), NULL, and tools::range.
Referenced by GK_update_frames().
int gk_viable_keys_for_mask | ( | unsigned long | mask, |
Keylist * | keys, | ||
Keylist ** | keyret | ||
) |
ADD.
mask | mask value | |
keys | list of keyframes | |
[out] | keyret | output list of keyframes |
Definition at line 114 of file gk.c.
Referenced by gk_make_framesfromkeys(), and gk_make_linear_framesfromkeys().
double lin_interp | ( | float | dt, |
float | val1, | ||
float | val2 | ||
) |
Linear interpolation.
dt | coeficient |
val2 | value 2 |
val1 | value 1 |
Definition at line 541 of file gk.c.
Referenced by gk_make_framesfromkeys(), and gk_make_linear_framesfromkeys().