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

WP_Vertex.h

Go to the documentation of this file.
00001 /* Copyright (C) 2001 W.P. van Paassen - peter@paassen.tmfweb.nl
00002 
00003    This program is free software; you can redistribute it and/or modify it under
00004    the terms of the GNU General Public License as published by the Free
00005    Software Foundation; either version 2 of the License, or (at your
00006    option) any later version.
00007 
00008    This program is distributed in the hope that it will be useful, but WITHOUT
00009    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00010    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00011    for more details.
00012 
00013    You should have received a copy of the GNU General Public License
00014    along with this program; see the file COPYING.  If not, write to the Free
00015    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
00016 
00017 #ifndef WP_VERTEX_H
00018 #define WP_VERTEX_H
00019 
00020 #include "WP_Def.h"
00021 #include "WP_Point3D.h"
00022 #include "WP_Vector3D.h"
00023 
00024 namespace WPCG
00025 {
00044 class WP_Vertex
00045 {
00046 public:
00047   WP_Vertex(){};
00048 
00053   WP_Vertex(const WP_Point3D& p, const WP_Vector3D& n):point(p), normal(n)
00054     {
00055       texCoords[0] = texCoords[1] = 0.0;
00056     };
00057 
00058   ~WP_Vertex(){};
00059 
00065   inline WP_Vertex& operator=(const WP_Vertex& v)
00066     {
00067       if (this == &v)
00068         return *this;
00069 
00070       point = v.point;
00071       normal = v.normal;
00072       texCoords[0] = v.texCoords[0];
00073       texCoords[1] = v.texCoords[1];
00074       return *this;
00075     }
00076 
00082   inline void lerp3D(const WP_Vertex* v, float t)
00083     {
00084       WP_Point3D p = v->point;
00085       WP_Vector3D c = p - point;
00086       point = point + (c * t); 
00087     };
00088   
00092   WP_Point3D point;
00093 
00097   WP_Vector3D normal;
00098 
00102   scalar texCoords[2];
00103 };
00104 }
00105 #endif
00106 

Generated on Tue Jan 28 20:26:35 2003 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002