Go to the documentation of this file.
24 loader._data->load_externals(
DSearchPath(), loader._record);
28 if (loader._error && !egg_accept_errors) {
30 <<
"Errors in egg file.\n";
34 if (loader._root !=
nullptr && egg_flatten) {
37 int combine_siblings_bits = 0;
38 if (egg_combine_geoms) {
39 combine_siblings_bits |= SceneGraphReducer::CS_geom_node;
41 if (egg_flatten_radius > 0.0) {
42 combine_siblings_bits |= SceneGraphReducer::CS_within_radius;
46 int num_reduced = gr.
flatten(loader._root, combine_siblings_bits);
47 egg2pg_cat.info() <<
"Flattened " << num_reduced <<
" nodes.\n";
53 gr.
premunge(loader._root, RenderState::make_empty());
56 gr.
unify(loader._root,
true);
57 if (egg2pg_cat.is_debug()) {
58 egg2pg_cat.debug() <<
"Unified.\n";
73 load_egg_file(
const Filename &filename, CoordinateSystem cs,
79 if (record !=
nullptr) {
84 loader._data->set_egg_filename(egg_filename);
85 loader._data->set_auto_resolve_externals(
true);
86 loader._data->set_coordinate_system(cs);
87 loader._record = record;
90 if (vfile ==
nullptr) {
94 loader._data->set_egg_timestamp(vfile->get_timestamp());
97 std::istream *istr = vfile->open_read_file(
true);
98 if (istr ==
nullptr) {
100 <<
"Couldn't read " << egg_filename <<
"\n";
105 <<
"Reading " << egg_filename <<
"\n";
107 okflag = loader._data->read(*istr);
108 vfile->close_read_file(istr);
112 <<
"Error reading " << egg_filename <<
"\n";
116 return load_from_loader(loader);
125 load_egg_data(
EggData *data, CoordinateSystem cs) {
132 loader._data->steal_children(children_holder);
134 loader._data->set_auto_resolve_externals(
true);
135 loader._data->set_coordinate_system(cs);
137 return load_from_loader(loader);
void set_text()
Indicates that the filename represents a text file.
Converts an egg data structure, possibly read from an egg file but not necessarily,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An instance of this class is written to the front of a Bam or Txo file to make the file a cached inst...
An interface for simplifying ("flattening") scene graphs by eliminating unneeded nodes and collapsing...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PointerTo< VirtualFile > get_file(const Filename &filename, bool status_only=false) const
Looks up the file by the indicated name in the file system.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int collect_vertex_data(PandaNode *root, int collect_bits=~0)
Collects all different GeomVertexData blocks that have compatible formats at this node and below into...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A base class for nodes in the hierarchy that are not leaf nodes.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void unify(PandaNode *root, bool preserve_order)
Calls unify() on every GeomNode at this level and below.
void set_combine_radius(PN_stdfloat combine_radius)
Specifies the radius that is used in conjunction with CS_within_radius to decide whether a subgraph's...
void steal_children(EggGroupNode &other)
Moves all the children from the other node to this one.
This is the primary interface into all the egg data, and the root of the egg file structure.
This class stores a list of directories that can be searched, in order, to locate a particular file.
A hierarchy of directories and files that appears to be one continuous file system,...
void premunge(PandaNode *root, const RenderState *initial_state)
Walks the scene graph rooted at this node and below, and uses the indicated GSG to premunge every Geo...
PT(PandaNode) load_egg_data(EggData *data
Another convenience function; works like load_egg_file() but starts from an already-filled EggData st...
int flatten(PandaNode *root, int combine_siblings_bits)
Simplifies the graph by removing unnecessary nodes and nodes.
static VirtualFileSystem * get_global_ptr()
Returns the default global VirtualFileSystem.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The abstract base class for a file or directory within the VirtualFileSystem.
void add_dependent_file(const Filename &pathname)
Adds the indicated file to the list of files that will be loaded to generate the data in this record.
A basic node of the scene graph or data graph.
The name of a file, such as a texture file or an Egg file.