Panda3D

- Main Page
- Packages
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions

# EggData Class Reference

This is the primary interface into all the egg data, and the root of the egg file structure. More...

Inheritance diagram for EggData:

List of all members.

## Public Member Functions
| EggData ()
| EggData (EggData const copy)
int | collapseEquivalentMaterials ()
| Removes duplicate references to the same material with the same properties.
int | collapseEquivalentTextures ()
| Removes duplicate references to the same texture image with the same properties.
bool | getAutoResolveExternals ()
| Indicates whether the EggData object will automatically resolve any external references when read() is called.
CoordinateSystem | getCoordinateSystem ()
| Returns the coordinate system in which the egg file is defined.
Filename const | getEggFilename ()
| Returns the directory in which the egg file is considered to reside.
bool | loadExternals (DSearchPath const searchpath)
| Loads up all the egg files referenced by <File> entries within the egg structure, and inserts their contents in place of the <File> entries.
bool | loadExternals ()
| Loads up all the egg files referenced by <File> entries within the egg structure, and inserts their contents in place of the <File> entries.
bool | loadExternals (DSearchPath const searchpath, BamCacheRecord record)
| Loads up all the egg files referenced by <File> entries within the egg structure, and inserts their contents in place of the <File> entries.
| merge (EggData other)
| Appends the other egg structure to the end of this one.
EggData | operator= (EggData const copy)
bool | originalHadAbsolutePathnames ()
| Returns true if the data processed in the last call to read() contained absolute pathnames, or false if those pathnames were all relative.
bool | read (Filename filename, string display_name)
| Opens the indicated filename and reads the egg data contents from it.
bool | read (Filename filename)
| Opens the indicated filename and reads the egg data contents from it.
bool | read (istream in)
| Parses the egg syntax contained in the indicated input stream.
| recomputePolygonNormals ()
| Recomputes all the polygon normals for polygon geometry at this group node and below so that they accurately reflect the vertex positions.
| recomputeVertexNormals (double threshold)
| Recomputes all the vertex normals for polygon geometry at this group node and below so that they accurately reflect the vertex positions.
| setAutoResolveExternals (bool resolve)
| Indicates whether the EggData object will automatically resolve any external references when read() is called.
| setCoordinateSystem (CoordinateSystem coordsys)
| Changes the coordinate system of the EggData.
| setEggFilename (Filename const egg_filename)
| Sets the filename--especially the directory part--in which the egg file is considered to reside.
| stripNormals ()
| Removes all normals from primitives, and the vertices they reference, at this node and below.
bool | writeEgg (ostream out)
| The main interface for writing complete egg files.
bool | writeEgg (Filename filename)
| The main interface for writing complete egg files.
## Static Public Member Functions
static TypeHandle | getClassType ()
static bool | resolveEggFilename (Filename egg_filename, DSearchPath const searchpath)
| Looks for the indicated filename, first along the indicated searchpath, and then along the model_path.
static bool | resolveEggFilename (Filename egg_filename)
| Looks for the indicated filename, first along the indicated searchpath, and then along the model_path.

## Detailed Description

This is the primary interface into all the egg data, and the root of the egg file structure.

An EggData structure corresponds exactly with an egg file on the disk.

The EggData class inherits from EggGroupNode its collection of children, which are accessed by using the EggData itself as an STL container with begin() and end() calls. The children of the EggData class are the toplevel nodes in the egg file.

## Constructor & Destructor Documentation

EggData | ( |  | ) |

EggData | ( | EggData const | copy | ) |

## Member Function Documentation

int collapseEquivalentMaterials | ( |  | ) |

Removes duplicate references to the same material with the same properties.

Considers two material references with identical properties, but different mref names, to be equivalent, and collapses them, choosing one mref name to keep arbitrarily. Returns the number of materials removed.

int collapseEquivalentTextures | ( |  | ) |

Removes duplicate references to the same texture image with the same properties.

Considers two texture references with identical properties, but different tref names, to be equivalent, and collapses them, choosing one tref name to keep arbitrarily. Returns the number of textures removed.

bool getAutoResolveExternals | ( |  | ) |

Indicates whether the EggData object will automatically resolve any external references when read() is called.

The default is false.

static TypeHandle getClassType | ( |  | ) | `[static]`

Reimplemented from EggGroupNode.

CoordinateSystem getCoordinateSystem | ( |  | ) |

Returns the coordinate system in which the egg file is defined.

Filename const getEggFilename | ( |  | ) |

Returns the directory in which the egg file is considered to reside.

bool loadExternals | ( | DSearchPath const | searchpath | ) |

Loads up all the egg files referenced by <File> entries within the egg structure, and inserts their contents in place of the <File> entries.

Searches for files in the searchpath, if not found directly, and writes error messages to the indicated output stream. Returns true if all externals were loaded successfully, false otherwise.

bool loadExternals | ( |  | ) |

Loads up all the egg files referenced by <File> entries within the egg structure, and inserts their contents in place of the <File> entries.

Searches for files in the searchpath, if not found directly, and writes error messages to the indicated output stream. Returns true if all externals were loaded successfully, false otherwise.

bool loadExternals | ( | DSearchPath const | searchpath,
|  | BamCacheRecord | record
| ) |  |

Loads up all the egg files referenced by <File> entries within the egg structure, and inserts their contents in place of the <File> entries.

Searches for files in the searchpath, if not found directly, and writes error messages to the indicated output stream. Returns true if all externals were loaded successfully, false otherwise.

merge | ( | EggData | other | ) |

Appends the other egg structure to the end of this one.

The other egg structure is invalidated.

EggData operator= | ( | EggData const | copy | ) |

bool originalHadAbsolutePathnames | ( |  | ) |

Returns true if the data processed in the last call to read() contained absolute pathnames, or false if those pathnames were all relative.

This method is necessary because if auto_resolve_externals() is in effect, it may modify the pathnames to be absolute whether or not they were as loaded from disk. This method can be used to query the state of the original egg file from disk.

bool read | ( | Filename | filename,
|  | string | display_name
| ) |  |

Opens the indicated filename and reads the egg data contents from it.

Returns true if the file was successfully opened and read, false if there were some errors, in which case the data may be partially read.

error is the output stream to which to write error messages.

bool read | ( | Filename | filename | ) |

Opens the indicated filename and reads the egg data contents from it.

Returns true if the file was successfully opened and read, false if there were some errors, in which case the data may be partially read.

error is the output stream to which to write error messages.

bool read | ( | istream | in | ) |

Parses the egg syntax contained in the indicated input stream.

Returns true if the stream was a completely valid egg file, false if there were some errors, in which case the data may be partially read.

Before you call this routine, you should probably call set_egg_filename() to set the name of the egg file we're processing, if at all possible. If there is no such filename, you may set it to the empty string.

recomputePolygonNormals | ( |  | ) |

Recomputes all the polygon normals for polygon geometry at this group node and below so that they accurately reflect the vertex positions.

Normals are removed from the vertices and defined only on polygons, giving the geometry a faceted appearance.

This function also removes degenerate polygons that do not have enough vertices to define a normal. It does not affect normals for other kinds of primitives like Nurbs or Points.

This function does not remove or adjust vertices in the vertex pool; it only adds new vertices with the normals removed. Thus, it is a good idea to call remove_unused_vertices() after calling this.

Reimplemented from EggGroupNode.

recomputeVertexNormals | ( | double | threshold | ) |

Recomputes all the vertex normals for polygon geometry at this group node and below so that they accurately reflect the vertex positions.

A shared edge between two polygons (even in different groups) is considered smooth if the angle between the two edges is less than threshold degrees.

This function also removes degenerate polygons that do not have enough vertices to define a normal. It does not affect normals for other kinds of primitives like Nurbs or Points.

This function does not remove or adjust vertices in the vertex pool; it only adds new vertices with the correct normals. Thus, it is a good idea to call remove_unused_vertices() after calling this.

Reimplemented from EggGroupNode.

static bool resolveEggFilename | ( | Filename | egg_filename | ) | `[static]`

Looks for the indicated filename, first along the indicated searchpath, and then along the model_path.

If found, updates the filename to the full path and returns true; otherwise, returns false.

static bool resolveEggFilename | ( | Filename | egg_filename,
|  | DSearchPath const | searchpath
| ) |  | `[static]`

Looks for the indicated filename, first along the indicated searchpath, and then along the model_path.

If found, updates the filename to the full path and returns true; otherwise, returns false.

setAutoResolveExternals | ( | bool | resolve | ) |

Indicates whether the EggData object will automatically resolve any external references when read() is called.

The default is false.

setCoordinateSystem | ( | CoordinateSystem | coordsys | ) |

Changes the coordinate system of the EggData.

If the coordinate system was previously different, this may result in a conversion of the data.

setEggFilename | ( | Filename const | egg_filename | ) |

Sets the filename--especially the directory part--in which the egg file is considered to reside.

This is also implicitly set by read().

stripNormals | ( |  | ) |

Removes all normals from primitives, and the vertices they reference, at this node and below.

This function does not remove or adjust vertices in the vertex pool; it only adds new vertices with the normal removed. Thus, it is a good idea to call remove_unused_vertices() after calling this.

Reimplemented from EggGroupNode.

bool writeEgg | ( | Filename | filename | ) |

The main interface for writing complete egg files.

bool writeEgg | ( | ostream | out | ) |

The main interface for writing complete egg files.

All Classes Namespaces Functions Variables Enumerations Enumerator Properties