head 1.4; access; symbols; locks; strict; comment @# @; 1.4 date 2002.09.07.01.50.35; author curt; state Exp; branches; next 1.3; 1.3 date 2002.08.31.19.01.50; author curt; state Exp; branches; next 1.2; 1.2 date 2002.08.31.18.53.58; author curt; state Exp; branches; next 1.1; 1.1 date 2002.02.15.17.21.54; 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

# SGBinObject Class Reference

A class to manipulate the simgear 3d object format. More...

`#include <sg_binobj.hxx>`

List of all members.

## Public Methods
unsigned short | get_version () const
const Point3D & | get_gbs_center () const
void | set_gbs_center (const Point3D &p)
float | get_gbs_radius () const
void | set_gbs_radius (float r)
const point_list & | get_wgs84_nodes () const
void | set_wgs84_nodes (const point_list &n)
const point_list & | get_colors () const
void | set_colors (const point_list &c)
const point_list & | get_normals () const
void | set_normals (const point_list &n)
const point_list & | get_texcoords () const
void | set_texcoords (const point_list &t)
const group_list & | get_pts_v () const
void | set_pts_v (const group_list &g)
const group_list & | get_pts_n () const
void | set_pts_n (const group_list &g)
const group_list & | get_pts_c () const
void | set_pts_c (const group_list &g)
const group_list & | get_pts_tc () const
void | set_pts_tc (const group_list &g)
const string_list & | get_pt_materials () const
void | set_pt_materials (const string_list &s)
const group_list & | get_tris_v () const
void | set_tris_v (const group_list &g)
const group_list & | get_tris_n () const
void | set_tris_n (const group_list &g)
const group_list & | get_tris_c () const
void | set_tris_c (const group_list &g)
const group_list & | get_tris_tc () const
void | set_tris_tc (const group_list &g)
const string_list & | get_tri_materials () const
void | set_tri_materials (const string_list &s)
const group_list & | get_strips_v () const
void | set_strips_v (const group_list &g)
const group_list & | get_strips_n () const
void | set_strips_n (const group_list &g)
const group_list & | get_strips_c () const
void | set_strips_c (const group_list &g)
const group_list & | get_strips_tc () const
void | set_strips_tc (const group_list &g)
const string_list & | get_strip_materials () const
void | set_strip_materials (const string_list &s)
const group_list & | get_fans_v () const
void | set_fans_v (const group_list &g)
const group_list & | get_fans_n () const
void | set_fans_n (const group_list &g)
const group_list & | get_fans_c () const
void | set_fans_c (const group_list &g)
const group_list & | get_fans_tc () const
void | set_fans_tc (const group_list &g)
const string_list & | get_fan_materials () const
void | set_fan_materials (const string_list &s)
bool | read_bin (const string &file)
| Read a binary file object and populate the provided structures.
bool | write_bin (const string &base, const string &name, const SGBucket &b)
| Write out the structures to a binary file.
bool | write_ascii (const string &base, const string &name, const SGBucket &b)
| Write out the structures to an ASCII file.
## Related Functions
(Note that these are not member functions.)
double | sgCalcBoundingRadius (Point3D center, point_list &wgs84_nodes)
| Calculate the bounding sphere of a set of nodes.

## Detailed Description

A class to manipulate the simgear 3d object format.

This class provides functionality to both read and write the binary format.

Here is a really quick overview of the file syntax:

- scenery-file: magic, nobjects, object+

- magic: "TG" + version

- object: obj_typecode, nproperties, nelements, property+, element+

- element: nbytes, BYTE+

- property: prop_typecode, nbytes, BYTE+

- obj_typecode: bounding sphere | vertices | normals | texcoords | points | triangles | fans | strips

- prop_typecode: material_name | ???

- nelements: SHORT (Gives us 65536 which ought to be enough, right?)

- nproperties: SHORT

- *_typecode: CHAR

- nbytes: INTEGER (If we used short here that would mean 65536 bytes = 16384 floats = 5461 vertices which is not enough for future growth)

- vertex: FLOAT, FLOAT, FLOAT

Definition at line 89 of file sg_binobj.hxx.

## Member Function Documentation

bool SGBinObject::read_bin | ( | const string & | file | ) |

  | Read a binary file object and populate the provided structures. Parameters:
  file | input file name
Returns: result of read Definition at line 282 of file sg_binobj.cxx.

bool SGBinObject::write_ascii | ( | const string & | base,
|  | const string & | name,
|  | const SGBucket & | b
| ) |

  | Write out the structures to an ASCII file. We assume that the groups come to us sorted by material property. If not, things don't break, but the result won't be as optimal. Parameters:
  base | name of output path
  name | name of output file
  b | bucket for object location
Returns: result of write Definition at line 1048 of file sg_binobj.cxx. References SGBucket::gen_base_path(), point_list, SG_SCENERY_FILE_FORMAT, sgCalcBoundingRadius(), Point3D::x(), Point3D::y(), and Point3D::z().

bool SGBinObject::write_bin | ( | const string & | base,
|  | const string & | name,
|  | const SGBucket & | b
| ) |

  | Write out the structures to a binary file. We assume that the groups come to us sorted by material property. If not, things don't break, but the result won't be as optimal. Parameters:
  base | name of output path
  name | name of output file
  b | bucket for object location
Returns: result of write Definition at line 612 of file sg_binobj.cxx. References SGBucket::gen_base_path(), SG_FILE_MAGIC_NUMBER, Point3D::x(), Point3D::y(), and Point3D::z().

## Friends And Related Function Documentation

double sgCalcBoundingRadius | ( | Point3D | center,
|  | point_list & | wgs84_nodes
| ) | `[related]`

  | Calculate the bounding sphere of a set of nodes. Center is the center of the tile and zero elevation. Parameters:
  center | center of our bounding radius
  wgs84_nodes | list of points in wgs84 coordinates
Returns: radius Definition at line 145 of file sg_binobj.cxx. References Point3D::distance3Dsquared(), and point_list. Referenced by write_ascii().

The documentation for this class was generated from the following files:

- sg_binobj.hxx
- sg_binobj.cxx

@ 1.3 log @Oops, try again. @ text @d393 1 a393 1