/* * GRacer * * Copyright (C) 1999 Takashi Matsuda * * 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 the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ #ifndef __GRACER_PHYSICS_H__ #define __GRACER_PHYSICS_H__ #include "gr_global.h" #include "gr_matrix.h" #include "gr_quat.h" #define GRAVITY 9.8 typedef struct GrInertial { double current; double target; double speed; double accel; } GrInertial; typedef struct GrRigidBody { float mass; GrMatrix m_j; struct { GrVertexd pos, spd; GrVertexd rot, omg; GrQuaternion quat; GrVertex force; GrVertex m; GrMatrix m_zyx; /* local coordinate to global */ GrMatrix m_rzyx; /* global coordinate to local */ } state[2]; } GrRigidBody; #ifdef __cplusplus extern "C" { #endif #if 0 } #endif void gr_phisics_inertial_move (GrInertial *value, double h); void gr_rigid_body_integral (GrRigidBody *rb, int from, double h); void gr_rigid_body_reset (GrRigidBody *rb, int which); void gr_rigid_body_add_force_relative (GrRigidBody *rb, int which, GrVertex *point, GrVertex *force); void gr_rigid_body_add_force (GrRigidBody *rb, int which, GrVertex *point, GrVertex *force); #ifdef __cplusplus } #endif #endif /* __GRACER_PHYSICS_H__ */