Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

mesh.h

Go to the documentation of this file.
00001 /*
00002  *  Part of rvglue source code,
00003  *  Copyright (C) 2000 Alexander Kroeller (alilein@gmx.de)
00004  *  Copyright (C) 2000 Christer Sundin (ces) (christer@sundin.nu)
00005  *  Copyright (C) 2001 Gabor Varga (vag) (bootes@freemail.hu)
00006  *
00007  *  This program is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; either version 2 of the License, or
00010  *  (at your option) any later version.
00011  *
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020  */
00021 
00022 /*
00023  * $Id: mesh.h,v 1.2 2000/05/03 09:09:58 ali Exp ali $
00024  *
00025  * $Log: mesh.h,v $
00026  * Revision 1.2  2000/05/03 09:09:58  ali
00027  * ces sync
00028  *
00029  * Revision 1.1  2000/05/03 08:49:53  ali
00030  * Initial revision
00031  */
00032 #ifndef __MESH_H
00033 #define __MESH_H
00034 
00035 #include "rvtypes.h"
00036 #include "polygon.h"
00037 #include "vertex.h"
00038 #include "surface.h"
00039 #include "polymod.h"
00040 
00041 
00043 
00046 class Mesh
00047 {
00048   friend class CollapsedMesh;
00049 
00050 public:
00051   Mesh(RV_PRM_Mesh*, FILE *, bool intermediate);
00052   Mesh(RV_W_Mesh*, FILE *, bool intermediate);
00053   Mesh();
00054 
00058   Mesh(Mesh *);
00059   ~Mesh();
00060 
00061   void translate(rvfloat dx, rvfloat dy, rvfloat dz);
00062   void translate(Vector &v) {translate(v.x(),v.y(),v.z());};  // vag 2001-06-28
00063   void rotate(Matrix_3x3 &);
00064 
00070   void write_w(FILE *, bool is_im_file);
00071 
00076   bool isDegenerated(void);
00077 
00081   void cleanupPolyList(void);
00082 
00086   void cleanupVertexList(void);
00087 
00091   void optimize(void);
00092 
00093   int numPolys(void);
00094   int numSolidPolys(void);
00095 
00096   Surface *createPolySurface(int pidx);
00097 
00101   void add(Polygon *p);  // ces 2000-04-13
00102   
00106   void add(Vertex *v);  // ces 2000-04-13
00107 
00114   void deleteSomePolys(bool delUnsolids, bool delInvisibles);
00115 
00116   /*
00117    * Applies the modifier to every polygon
00118    */
00119   bool apply(PolygonModifier *);
00120 
00121   /*
00122    * Adjust abox (if needed) so this Mesh is inside.
00123    * Invisible polys are excluded.
00124    */
00125   void calc_visible_bounds(AxisBox &abox);  // vag 2001-06-28
00126 
00127 protected:
00128   void load(FILE *, bool intermediate, bool is_Instance);
00129 
00130   void calc_bounds(void);
00131 
00132 public:
00133   Polygon **poly;
00134   RV_W_Mesh data;
00135   Vertex **verts;
00136   int max_polys;  // ces 2000-04-13
00137   int max_verts;  // ces 2000-04-13
00138 };
00139 
00140 
00141 
00142 #endif

Generated at Mon Jul 2 16:54:57 2001 for rvtmod/rvglue by doxygen1.2.0 written by Dimitri van Heesch, © 1997-2000