Page principale | Hiérarchie des classes | Liste alphabétique | Liste des classes | Liste des fichiers | Membres de classe

C:/Projects/ngn/include/q3entities.h

00001 /***************************************************************************
00002  *            q3entities.h
00003  *
00004  *  Tue Feb  3 06:53:52 2004
00005  *  Copyright  2004  thierry schartz
00006  *  thierry.schartz@bluebottle.com
00007  ****************************************************************************/
00008 /*
00009  *  This program is free software; you can redistribute it and/or modify
00010  *  it under the terms of the GNU General Public License as published by
00011  *  the Free Software Foundation; either version 2 of the License, or
00012  *  (at your option) any later version.
00013  *
00014  *  This program is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *  GNU Library General Public License for more details.
00018  *
00019  *  You should have received a copy of the GNU General Public License
00020  *  along with this program; if not, write to the Free Software
00021  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00022  */
00023  #ifndef _Q3ENTITIES_H
00024  #define _Q3ENTITIES_H
00025  
00026  #ifdef WIN32
00027  #include <windows.h>
00028  #endif
00029  
00030  #include <vector>
00031  #include <string>
00032  #include "vector3d.h"
00033  #include "color.h"
00034 
00035 namespace ngn {
00036         namespace core {
00037                 namespace bsp {
00038 
00039 
00040                                 // entry points in bsp map
00041                                 struct entry_point
00042                                 {
00043                                         Vector3df pos;
00044                                         double angle;
00045                                 };
00046                                 // light entity
00047                                 struct q3_light
00048                                 {
00049                                         Vector3df pos;
00050                                         Colorf color;
00051                                         float intensity;
00052                                 };
00053 
00054                                 struct ent_pair
00055                                 {
00056                                         std::string type ;
00057                                         std::string value ;
00058                                 };
00059                                 struct ent_block
00060                                 {
00061                                         std::vector<ent_pair> epairs;
00062                                 };
00063 
00064 
00065  
00066                                 class Q3EntityParser
00067                                 {
00068                                 public:
00069                                         // constructor
00070                                         Q3EntityParser();
00071                                         // destructor
00072                                         virtual ~Q3EntityParser();
00073                                         // load entities from bsp file
00074                                         virtual void loadEntities( const char *entities );
00075                                         // return vector of found entities
00076                                         std::vector<entry_point> getSpawnPoints();
00077 
00078                                 protected:
00079 
00080                                         // load entry points
00081                                         void loadSpawnPoints();
00082                                         // fill an ent_pair given a line
00083                                         ent_pair extractDataFromLine( std::string line );       
00084 
00085                                         std::string m_entities; // the entities string
00086                                         int m_nEntities;        // number of entities
00087                                         std::vector<ent_block> m_blocks;        // entities blocks
00088                                         std::vector<entry_point> m_spawn_points;        // bsp map entry points
00089                                         
00090                                         
00091  
00092                                 };
00093 
00094 
00095 
00096 
00097                 }//bsp
00098         }//core
00099 }//ngn
00100 #endif /* _Q3ENTITIES_H */
00101 

Généré le Fri Nov 19 14:20:29 2004 pour NGN par  doxygen 1.3.9.1