building.h

00001 /*--License:
00002         Lilith 3D Engine
00003         Copyright Lee Thomason (Grinning Lizard Software) 2002-2007
00004         www.grinninglizard.com/lilith
00005 
00006         This program is free software; you can redistribute it and/or
00007         modify it under the terms of the GNU General Public License
00008         as published by the Free Software Foundation; either version 2
00009         of the License, or (at your option) any later version.
00010 
00011         This program is distributed in the hope that it will be useful,
00012         but WITHOUT ANY WARRANTY; without even the implied warranty of
00013         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014         GNU General Public License for more details.
00015 
00016         You should have received a copy of the GNU General Public License
00017         along with this program; if not, write to the Free Software
00018         Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 
00020         The full text of the license can be found in license.txt
00021 */
00022 
00023 #ifndef LILITH3D_BUILDING_INCLUDED
00024 #define LILITH3D_BUILDING_INCLUDED
00025 
00026 #include "mesh.h"
00027 #include "../grinliz/glutil.h"
00028 #include "meshresource.h"
00029 
00064 namespace lilith3d
00065 {
00066 
00078 class BuildingMesh : public StaticMesh
00079 {
00080         friend class lilith3d::TerrainMesh;
00081 
00082   protected:
00086         BuildingMesh(   const StaticResource* meshResource,
00087                                         const grinliz::Vector3F& position );    // integer values - must be patch aligned
00088 
00089   public:
00090         virtual ~BuildingMesh();
00091 
00092         // Terrain callback to change the z value.
00093         virtual void UpdateZ( float z );
00094 
00095         virtual void StreamOutMesh( ELightPass light, EPass pass );
00096 
00098         const grinliz::Rectangle2I& VertexBounds() const        { return vertexBounds; }
00099 
00100         /*      Terrain to building connectcion. Input is a head/tail vertex pair,
00101                 output is point the pather should use for cross-over.
00102         */
00103         PathSurfaceInstance* GetPadPSIFromVertex( int tail, int head, grinliz::Vector2F* a0 );
00104 
00105         /*      Terrain to building connection. Is a particular segment valid? */
00106         //PathSurfaceInstance* GetPadPSI( const grinliz::Vector2F& a0, const grinliz::Vector2F& a1, grinliz::Vector2F* out );
00107 
00108         /*      Terrain to building connection. Take anything at the point */
00109         PathSurfaceInstance* GetPadPSI( float x, float y );
00110 
00111         virtual void IntersectRay(      int flags, 
00112                                                                 const grinliz::Vector3F& point, 
00113                                                                 const grinliz::Vector3F& dir, 
00114                                                                 LilithObjectList* vec );
00115 
00116         // Note this bit of evil - buildings can not be positioned or rotated after creation.
00117         virtual void SetPosV( const grinliz::Vector3F& _newLoc, const grinliz::Matrix4& _newRot )       {
00118                 GLASSERT( 0 );  // Does no harm, but you probably didn't mean to call this.
00119         }
00120 
00121   private:
00122         void StreamOutPather();
00123 
00124         grinliz::Rectangle2I vertexBounds;
00125         grinliz::Rectangle2I mapBounds;
00126 
00127         //TerrainConnectorVector terrainConnectors;
00128         PSIVector psiVector;
00129 };
00130 };
00131 #endif

Generated on Fri Mar 23 19:36:21 2007 for Lilith3D by  doxygen 1.5.1-p1