head 1.4; access; symbols; locks; strict; comment @# @; 1.4 date 2002.09.07.01.50.39; author curt; state Exp; branches; next 1.3; 1.3 date 2002.08.31.19.01.57; author curt; state Exp; branches; next 1.2; 1.2 date 2002.08.31.18.54.03; author curt; state Exp; branches; next 1.1; 1.1 date 2002.02.15.17.22.00; author curt; state Exp; branches; next ; desc @@ 1.4 log @Updated doxygen docs. @ text @
Main Page Class Hierarchy Compound List File List Compound Members File Members

# sg_binobj.hxx

Go to the documentation of this file.

    00001
    00006 // Written by Curtis Olson, started January 2000.
    00007 //
    00008 // Copyright (C) 2000  Curtis L. Olson  - curt@@flightgear.org
    00009 //
    00010 // This program is free software; you can redistribute it and/or modify
    00011 // it under the terms of the GNU General Public License as published by
    00012 // the Free Software Foundation; either version 2 of the License, or
    00013 // (at your option) any later version.
    00014 //
    00015 // This program is distributed in the hope that it will be useful,
    00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00018 // GNU General Public License for more details.
    00019 //
    00020 // You should have received a copy of the GNU General Public License
    00021 // along with this program; if not, write to the Free Software
    00022 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00023 //
    00024 // $Id: sg_binobj.hxx,v 1.11 2002/08/23 17:52:10 curt Exp $
    00025
    00026
    00027 #ifndef _SG_BINOBJ_HXX
    00028 #define _SG_BINOBJ_HXX
    00029
    00030
    00031 #include <plib/sg.h>
    00032
    00033 #include <simgear/compiler.h>
    00034 #include <simgear/constants.h>
    00035 #include <simgear/math/sg_types.hxx>
    00036 #include <simgear/bucket/newbucket.hxx>
    00037
    00038 #include <stdio.h>
    00039 #include <time.h>
    00040
    00041 #include <list>
    00042 #include STL_STRING
    00043
    00044
    00045
    00047 typedef vector < int_list > group_list;
    00048 typedef group_list::iterator group_list_iterator;
    00049 typedef group_list::const_iterator const_group_list_iterator;
    00050
    00051
    00053 #define SG_FILE_MAGIC_NUMBER  ( ('S'<<24) + ('G'<<16) + SG_BINOBJ_VERSION )
    00054
    00055
    00089 class SGBinObject {
    00090     unsigned short version;
    00091
    00092     Point3D gbs_center;
    00093     float gbs_radius;
    00094
    00095     point_list wgs84_nodes;     // vertex list
    00096     point_list colors;          // color list
    00097     point_list normals;         // normal list
    00098     point_list texcoords;       // texture coordinate list
    00099
    00100     group_list pts_v;           // points vertex index
    00101     group_list pts_n;           // points normal index
    00102     group_list pts_c;           // points color index
    00103     group_list pts_tc;          // points texture coordinate index
    00104     string_list pt_materials;   // points materials
    00105
    00106     group_list tris_v;          // triangles vertex index
    00107     group_list tris_n;          // triangles normal index
    00108     group_list tris_c;          // triangles color index
    00109     group_list tris_tc;         // triangles texture coordinate index
    00110     string_list tri_materials;  // triangles materials
    00111
    00112     group_list strips_v;        // tristrips vertex index
    00113     group_list strips_n;        // tristrips normal index
    00114     group_list strips_c;        // tristrips color index
    00115     group_list strips_tc;       // tristrips texture coordinate index
    00116     string_list strip_materials;// tristrips materials
    00117
    00118     group_list fans_v;          // fans vertex index
    00119     group_list fans_n;          // fans normal index
    00120     group_list fans_c;          // fans color index
    00121     group_list fans_tc;         // fans texture coordinate index
    00122     string_list fan_materials;  // fans materials
    00123
    00124 public:
    00125
    00126     inline unsigned short get_version() const { return version; }
    00127
    00128     inline const Point3D& get_gbs_center() const { return gbs_center; }
    00129     inline void set_gbs_center( const Point3D& p ) { gbs_center = p; }
    00130
    00131     inline float get_gbs_radius() const { return gbs_radius; }
    00132     inline void set_gbs_radius( float r ) { gbs_radius = r; }
    00133
    00134     inline const point_list& get_wgs84_nodes() const { return wgs84_nodes; }
    00135     inline void set_wgs84_nodes( const point_list& n ) { wgs84_nodes = n; }
    00136
    00137     inline const point_list& get_colors() const { return colors; }
    00138     inline void set_colors( const point_list& c ) { colors = c; }
    00139
    00140     inline const point_list& get_normals() const { return normals; }
    00141     inline void set_normals( const point_list& n ) { normals = n; }
    00142
    00143     inline const point_list& get_texcoords() const { return texcoords; }
    00144     inline void set_texcoords( const point_list& t ) { texcoords = t; }
    00145
    00146     inline const group_list& get_pts_v() const { return pts_v; }
    00147     inline void set_pts_v( const group_list& g ) { pts_v = g; }
    00148     inline const group_list& get_pts_n() const { return pts_n; }
    00149     inline void set_pts_n( const group_list& g ) { pts_n = g; }
    00150     inline const group_list& get_pts_c() const { return pts_c; }
    00151     inline void set_pts_c( const group_list& g ) { pts_c = g; }
    00152     inline const group_list& get_pts_tc() const { return pts_tc; }
    00153     inline void set_pts_tc( const group_list& g ) { pts_tc = g; }
    00154     inline const string_list& get_pt_materials() const { return pt_materials; }
    00155     inline void set_pt_materials( const string_list& s ) { pt_materials = s; }
    00156
    00157     inline const group_list& get_tris_v() const { return tris_v; }
    00158     inline void set_tris_v( const group_list& g ) { tris_v = g; }
    00159     inline const group_list& get_tris_n() const { return tris_n; }
    00160     inline void set_tris_n( const group_list& g ) { tris_n = g; }
    00161     inline const group_list& get_tris_c() const { return tris_c; }
    00162     inline void set_tris_c( const group_list& g ) { tris_c = g; }
    00163     inline const group_list& get_tris_tc() const { return tris_tc; }
    00164     inline void set_tris_tc( const group_list& g ) { tris_tc = g; }
    00165     inline const string_list& get_tri_materials() const { return tri_materials; }
    00166     inline void set_tri_materials( const string_list& s ) { tri_materials = s; }
    00167
    00168     inline const group_list& get_strips_v() const { return strips_v; }
    00169     inline void set_strips_v( const group_list& g ) { strips_v = g; }
    00170     inline const group_list& get_strips_n() const { return strips_n; }
    00171     inline void set_strips_n( const group_list& g ) { strips_n = g; }
    00172     inline const group_list& get_strips_c() const { return strips_c; }
    00173     inline void set_strips_c( const group_list& g ) { strips_c = g; }
    00174
    00175     inline const group_list& get_strips_tc() const { return strips_tc; }
    00176     inline void set_strips_tc( const group_list& g ) { strips_tc = g; }
    00177     inline const string_list& get_strip_materials() const { return strip_materials; }
    00178     inline void set_strip_materials( const string_list& s ) { strip_materials = s; }
    00179
    00180     inline const group_list& get_fans_v() const { return fans_v; }
    00181     inline void set_fans_v( const group_list& g ) { fans_v = g; }
    00182     inline const group_list& get_fans_n() const { return fans_n; }
    00183     inline void set_fans_n( const group_list& g ) { fans_n = g; }
    00184     inline const group_list& get_fans_c() const { return fans_c; }
    00185     inline void set_fans_c( const group_list& g ) { fans_c = g; }
    00186
    00187     inline const group_list& get_fans_tc() const { return fans_tc; }
    00188     inline void set_fans_tc( const group_list& g ) { fans_tc = g; }
    00189     inline const string_list& get_fan_materials() const { return fan_materials; }
    00190     inline void set_fan_materials( const string_list& s ) { fan_materials = s; }
    00191
    00197     bool read_bin( const string& file );
    00198
    00208     bool write_bin( const string& base, const string& name, const SGBucket& b );
    00209
    00219     bool write_ascii( const string& base, const string& name,
    00220                       const SGBucket& b );
    00221 };
    00222
    00223
    00232 double sgCalcBoundingRadius( Point3D center, point_list& wgs84_nodes );
    00233
    00234
    00235 #endif // _SG_BINOBJ_HXX

@ 1.3 log @Oops, try again. @ text @d174 1 a174 1