X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fio%2Fsg_binobj.hxx;h=be77d5864252149e7bfd52a11e21831c89e4020c;hb=f19e83dcf10d5fced3d799c884a4654d7ada6548;hp=ae3ccad504300fd44b4f56edf3fbadc93aa25449;hpb=7fc8c026884b2d0a1b683765c089a9bef5ac47c8;p=simgear.git diff --git a/simgear/io/sg_binobj.hxx b/simgear/io/sg_binobj.hxx index ae3ccad5..be77d586 100644 --- a/simgear/io/sg_binobj.hxx +++ b/simgear/io/sg_binobj.hxx @@ -19,7 +19,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // $Id$ @@ -33,13 +33,14 @@ #include #include #include +#include #include #include #include #include -#include STL_STRING +#include @@ -74,9 +75,9 @@ typedef group_list::const_iterator const_group_list_iterator; * * - prop_typecode: material_name | ??? * - * - nelements: SHORT (Gives us 65536 which ought to be enough, right?) + * - nelements: USHORT (Gives us 65536 which ought to be enough, right?) * - * - nproperties: SHORT + * - nproperties: USHORT * * - *_typecode: CHAR * @@ -89,13 +90,13 @@ typedef group_list::const_iterator const_group_list_iterator; class SGBinObject { unsigned short version; - Point3D gbs_center; + SGVec3d gbs_center; float gbs_radius; - point_list wgs84_nodes; // vertex list - point_list colors; // color list - point_list normals; // normal list - point_list texcoords; // texture coordinate list + std::vector wgs84_nodes; // vertex list + std::vector colors; // color list + std::vector normals; // normal list + std::vector texcoords; // texture coordinate list group_list pts_v; // points vertex index group_list pts_n; // points normal index @@ -125,23 +126,51 @@ public: inline unsigned short get_version() const { return version; } - inline const Point3D& get_gbs_center() const { return gbs_center; } - inline void set_gbs_center( const Point3D& p ) { gbs_center = p; } + inline Point3D get_gbs_center() const { return Point3D::fromSGVec3(gbs_center); } + inline void set_gbs_center( const Point3D& p ) { gbs_center = p.toSGVec3d(); } + inline const SGVec3d& get_gbs_center2() const { return gbs_center; } + inline void set_gbs_center( const SGVec3d& p ) { gbs_center = p; } inline float get_gbs_radius() const { return gbs_radius; } inline void set_gbs_radius( float r ) { gbs_radius = r; } - inline const point_list& get_wgs84_nodes() const { return wgs84_nodes; } - inline void set_wgs84_nodes( const point_list& n ) { wgs84_nodes = n; } - - inline const point_list& get_colors() const { return colors; } - inline void set_colors( const point_list& c ) { colors = c; } - - inline const point_list& get_normals() const { return normals; } - inline void set_normals( const point_list& n ) { normals = n; } - - inline const point_list& get_texcoords() const { return texcoords; } - inline void set_texcoords( const point_list& t ) { texcoords = t; } + inline const std::vector& get_wgs84_nodes() const + { return wgs84_nodes; } + inline void set_wgs84_nodes( const std::vector& n ) + { wgs84_nodes = n; } + inline void set_wgs84_nodes( const point_list& n ) + { + wgs84_nodes.resize(n.size()); + for (unsigned i = 0; i < wgs84_nodes.size(); ++i) + wgs84_nodes[i] = n[i].toSGVec3d(); + } + + inline const std::vector& get_colors() const { return colors; } + inline void set_colors( const std::vector& c ) { colors = c; } + inline void set_colors( const point_list& c ) + { + colors.resize(c.size()); + for (unsigned i = 0; i < colors.size(); ++i) + colors[i] = SGVec4f(c[i].toSGVec3f(), 1); + } + + inline const std::vector& get_normals() const { return normals; } + inline void set_normals( const std::vector& n ) { normals = n; } + inline void set_normals( const point_list& n ) + { + normals.resize(n.size()); + for (unsigned i = 0; i < normals.size(); ++i) + normals[i] = n[i].toSGVec3f(); + } + + inline const std::vector& get_texcoords() const { return texcoords; } + inline void set_texcoords( const std::vector& t ) { texcoords = t; } + inline void set_texcoords( const point_list& t ) + { + texcoords.resize(t.size()); + for (unsigned i = 0; i < texcoords.size(); ++i) + texcoords[i] = t[i].toSGVec2f(); + } inline const group_list& get_pts_v() const { return pts_v; } inline void set_pts_v( const group_list& g ) { pts_v = g; }