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_GRAVITY_H 00024 #define LSG_GRAVITY_H 1 00025 00026 /** 00027 * \file gravity.h 00028 * \brief Gravitational force attracting particles 00029 */ 00030 00031 #include <lescegra/particle/particlemodifier.h> 00032 00033 #include <lescegra/util/vertex.h> 00034 00035 /** 00036 * \ingroup particle 00037 * \brief Gravitational force attracting particles 00038 * 00039 * Attract particles with gravitational force (a = mass * 1 / dist ^ 2) 00040 */ 00041 typedef struct { 00042 LsgParticleModifier super; 00043 Vertex location; 00044 float mass; 00045 float time; 00046 } LsgGravity; 00047 00048 LsgGravity* LsgGravity_create(float now); 00049 void LsgGravity_init(LsgGravity* self, float now); 00050 void LsgGravity_update(LsgGravity* self, LsgList* particles, float now); 00051 00052 #define LsgGravity_destroy(self) LsgParticleModifier_destry(&(self)->super) 00053 00054 #endif