Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

LWLayer.h

Go to the documentation of this file.
00001 
00002 /*
00003     TEDDY - General graphics application library
00004     Copyright (C) 1999-2002  Timo Suoranta
00005     tksuoran@cc.helsinki.fi
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Lesser General Public
00009     License as published by the Free Software Foundation; either
00010     version 2.1 of the License, or (at your option) any later version.
00011 
00012     This library 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 GNU
00015     Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public
00018     License along with this library; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 
00021     $Id:  $
00022 */
00023 
00024 
00025 #ifndef TEDDY__IMPORTS__LW_LAYER__H
00026 #define TEDDY__IMPORTS__LW_LAYER__H
00027 
00028 
00029 #include "Teddy/TeddyConfig.h"
00030 #if defined( TEDDY_INCLUDE_LW_SCENE )
00031 
00032 
00033 #include "Teddy/Maths/Vector.h"
00034 #include "Teddy/Models/Model.h"
00035 #include "Teddy/Imports/lwdef.h"
00036 #include "Teddy/SysSupport/StdMap.h"
00037 #include "Teddy/SysSupport/Types.h"
00038 #include <cstring>
00039 
00040 
00041 //  Forward declarations
00042 namespace Teddy {
00043     namespace Models { class Face;   };
00044     namespace Models { class Vertex; };
00045 };
00046 using namespace Teddy::Models;
00047 using namespace Teddy::SysSupport;
00048 
00049 
00050 namespace Teddy   {
00051 namespace Imports {
00052 
00053 
00054 class LWClip;
00055 class LWEnvelope;
00056 class LWFile;
00057 class LWModel;
00058 class LWSurface;
00059 
00060 
00061 typedef std::map<std::string, Model     *> string_to_Model;
00062 typedef std::map<std::string, LWSurface *> string_to_LWSurface;
00063 typedef std::map<U4,          Vertex    *> U4_to_Vertex;
00064 typedef std::map<U4,          Face      *> U4_to_Face;
00065 typedef std::map<U4,          LWEnvelope*> U4_to_LWEnvelope;
00066 typedef std::map<U4,          LWClip    *> U4_to_LWClip;
00067 
00068 
00073 class LWLayer : public Model {
00074 public:
00075     LWLayer( LWModel *model, const std::string &name, U2 flags, Vector pivot, int parent );
00076     virtual ~LWLayer();
00077 
00078     LWClip  *getClip     ( VX clip_index );
00079     LWModel *getModel    ();
00080     void     processLayer();  
00081 
00082 protected:
00083     bool processChunk    ();  
00084 
00085     //  LWOB & LWLO
00086     void pointList                 ();  //  LWOB::PNTS & LWO2::PNTS
00087     void polygonList               ();  //  LWO2::POLS
00088     void faceList                  ();  //  LWOB::POLS
00089     void surfaceList               ();  //  SRFS
00090     void curveList                 ();  //  CRVS
00091     void patchList                 ();  //  PCHS
00092     void surface_sc                ();  //  SURF
00093 
00094     //  LWO2
00095     void vertexMapping_ID4_U2_S0_d ();  //  VMAP
00096     void polygonTags_ID4_d         ();  //  PTAG
00097     void envelope_U4_sc            ();  //  ENVL
00098     void clip_U4_sc                ();  //  CLIP
00099     void surf_S0_S0_sc             ();  //  SURF
00100     void boundingBox_VEC12_VEC12   ();  //  BBOX
00101     void descriptionLine_S0        ();  //  DESC
00102     void comments_S0               ();  //  TEXT
00103     void thumbnail_U2_U2_d         ();  //  ICON
00104 
00105 protected:
00106     int      parent_layer;  
00107     Vector   pivot;         
00108     U2       flags;         
00109     LWFile  *f;
00110     LWModel *model;         
00111 
00112     std::string          description_line;
00113     std::string          commentary_text;   
00114     string_to_Model      models;
00115     string_to_LWSurface  surfaces;
00116     U4_to_Vertex         vertices;  
00117     U4_to_Face           faces;
00118     U4_to_LWEnvelope     envelopes;
00119     U4_to_LWClip         clips;
00120     U4                   num_vertices;
00121     U4                   num_faces;
00122     U4                   num_surfaces;
00123     U4                   num_envelopes;
00124     U4                   num_clips;
00125     U4                   current_surface;
00126     Vector               bbox_min;
00127     Vector               bbox_max;
00128 };
00129 
00130 
00131 };  //  namespace Imports
00132 };  //  namespace Teddy
00133 
00134 
00135 #endif  //  TEDDY_INCLUDE_LW_SCENE
00136 #endif  //  TEDDY__IMPORTS__LW_LAYER__H
00137