/***************************************************************************
                          body.h  -  description
                             -------------------
    begin                : Mit Sep 25 13:11:41 CEST 2002
    copyright            : (C) 2002 by Harald Krippel
    email                : neuro.harald@surfeu.at
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/


// plib
#include <plib/ssg.h>
#include <plib/js.h>
// ODE
#include <ode/ode.h>

#include "globdefines.h"

class Body
{
   public:
     Body(void);

     void   createOdeBody(dWorldID odworld, dSpaceID odspace, int typ);
     void   typ(dSpaceID odspace,int typ);
     void   adjustMass(float tmpmass);
     void   Scale(float x, float y, float z);
     void   update(ssgRoot *scene, float dt);
     void   setTransform (ssgTransform *objtrans, const dReal pos[3], const dReal R[12],dVector3 dxyz);
     void   SetPosition ();
     void   GetPosition ( sgCoord  *bodypos );
     void   SetRotation ();
     void   Rotation (float h, float p, float r);
     void   SetLinearVel ();
     void   AddRelForce ();
     void   SetAngularVel ();
     void   AddRelTorque ();
     ~Body(void);

   ssgTransform *objtrans[MAX_BODY_OBJ*2];
   ssgTransform *boxobjtrans;
   sgCoord      pos;

    /* ode test */
    dMass odm;
    dBodyID odbody[MAX_BODY_OBJ];
    dGeomID odgeom[MAX_BODY_OBJ];
    dGeomID odgeom_group;

    float lvel[3];
    float avel[3];
    
    int oldtyp;
  
protected:

};

