/***************************************************************************
                          tribarrier.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.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef TRIBARRIER_H
#define TRIBARRIER_H


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

#include "globdefines.h"

#define  MAXVERTEX  32000
#define  MAXINDEX  (32000*3)

class TriBarrier
{
   public:
     TriBarrier(void);

     void   createTriMesh(dSpaceID odspace, const char *file);
     void   update(ssgRoot *scene, float dt);
     void   setTransform (ssgTransform *objtrans, const dReal pos[3], const dReal R[12],dVector3 dxyz);
     void   SetPosition ();
     void   Print ();
     void   GetPosition ( sgCoord  *bodypos );
     ~TriBarrier(void);

   sgCoord      pos;
   ssgTransform *objtrans;
   ssgTransform *boxobjtrans;
      

protected:
     void buildTriMeshData(const char *file);
    /* ode */
   dTriMeshDataID data;
   dGeomID TriMesh;
   long VertexCount;
   long IndexCount;
   dVector3 Vertices[MAXVERTEX];
   int Indices[MAXINDEX];
};

#endif
