00001 /********************************************************************* 00002 * lescegra * 00003 * * 00004 * http://geeky.kicks-ass.org/projects/lescegra.html * 00005 * * 00006 * Copyright 2003 by Enno Cramer <uebergeek@web.de> * 00007 * * 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Library General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Library General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Library General Public * 00019 * License along with this library; if not, write to the Free * 00020 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00021 *********************************************************************/ 00022 00023 #ifndef LSG_INTERPOLATOR_H 00024 #define LSG_INTERPOLATOR_H 1 00025 00026 /** 00027 * \file interpolator.h 00028 * \brief Animate a vertex through keyframe interpolation 00029 * 00030 * \deprecated Can only update a single vertex which leads to out-of-date 00031 * bounding boxes when used on node members. 00032 */ 00033 00034 #include <lescegra/sg/node.h> 00035 00036 #include <lescegra/util/list.h> 00037 #include <lescegra/util/vertex.h> 00038 00039 00040 typedef enum interpolate_mode { 00041 STEP, 00042 LINEAR, 00043 BEZIER, 00044 CATMULL_ROM 00045 } InterpolatorMode; 00046 00047 /** 00048 * \brief Animate a vertex through keyframe interpolation 00049 * 00050 * \deprecated Can only update a single vertex which leads to out-of-date 00051 * bounding boxes when used on node members. 00052 */ 00053 typedef struct { 00054 Node super; 00055 float* target; 00056 InterpolatorMode mode; 00057 List* control; 00058 } Interpolator; 00059 00060 Interpolator* interpolator_create(Vertex target, InterpolatorMode mode); 00061 void interpolator_init(Interpolator* self, Vertex target, InterpolatorMode mode); 00062 void interpolator_update(Interpolator* self, float now); 00063 void interpolator_destroy(Interpolator* self); 00064 00065 #define interpolator_clean(self) node_clean(&(self)->super) 00066 #define interpolator_display(self, frust) node_disply(&(self)->super, frust) 00067 #define interpolator_collide(self, v, n) node_collide(&(self)->super, v, n) 00068 00069 void interpolator_add_control(Interpolator* self, Vertex v, float time); 00070 00071 #endif