Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

absobj.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Stephen Bridges                                 *
00003  *   widget@widget.dynu.com                                                *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef ABSOBJ_H
00021 #define ABSOBJ_H
00022 
00026 // $Id$
00027 
00028 #include "obj.h"
00029 #include "tritype.h"
00030 #include <vector>
00031 
00032 using namespace std;
00033 
00038 class AbsObj : public Obj
00039 {
00040 public:
00041     AbsObj();
00044     Vec4 col;
00046     Vec4 vrot;
00048     Vec4 l;
00050     Vec4 vl;
00052     Vec4 vr;
00056     bool gotGrav;
00058     bool gotMove;
00060     enum objtype {UnSet = 0, Static, MainObj, Debris, NonContact, Projectile};
00061     enum objtype ourType;
00063     float LastColl;
00064     
00066     Matrix4x4 affine;
00068     Matrix4x4 invaff;
00069 
00071     float life;
00073     float mass;
00075     Matrix4x4 invtensor;    
00077     Vec4 forces;
00079     Vec4 torques;
00081     vector<Vec4> vertlist;
00083     vector<tritype> trilist;
00085     vector<Vec4> normlist;
00086 
00087     void genericupdate(float time);
00089     void pos(float px, float py, float pz) {Obj::pos(px, py, pz); getAffine();};
00090 
00094     void setTransp(float t) { col(3) = t;};
00096     void setColour(float rin, float gin, float bin)
00097         {col(0) = rin; col(1) = gin; col(2) = bin;};
00099     void setRotation(float xin, float yin, float zin);
00101     void setVel(float xin, float yin, float zin)
00102     {vl(0) = xin; vl(1) = yin, vl(2) = zin;getAffine();} ;
00104     void setRotVel(float xin, float yin, float zin)
00105     {vr(0) = xin; vr(1) = yin, vr(2) = zin;};
00107     void addRotVel(float xin, float yin, float zin)
00108     {vr(0) += xin; vr(1) += yin, vr(2) += zin;};
00109     void calcTorque(Vec4 pos, Vec4 force);
00110     void getAffine(void);
00114     void genericrender(void);
00115     bool collide(const AbsObj &incoming, Vec4 *collpt = NULL, Vec4 *colln = NULL, Vec4 *collintr = NULL);
00116     bool collidept(const AbsObj &incoming, Vec4 *colln = NULL);
00117     
00121     virtual void update(float time) = 0;
00125     virtual void render(void) = 0;
00126 };
00127 
00128 int collideResponse(float time, AbsObj &bill, AbsObj &ben, Vec4 &pt, Vec4 &n, Vec4 &intr, float sticky = 0.8);
00129 
00130 #endif
00131 
00132 /*
00133  * $Log$
00134  *
00135  */
00136 
00137 // EOF

Generated on Mon Jan 3 15:14:19 2005 for Graviton by  doxygen 1.3.9.1