15 #include "load_collada_file.h" 16 #include "colladaLoader.h" 17 #include "config_collada.h" 18 #include "sceneGraphReducer.h" 19 #include "virtualFileSystem.h" 20 #include "config_util.h" 21 #include "bamCacheRecord.h" 27 if (loader._error && !collada_accept_errors) {
29 <<
"Errors in collada file.\n";
33 if (loader._root != NULL && collada_flatten) {
36 int combine_siblings_bits = 0;
37 if (collada_combine_geoms) {
38 combine_siblings_bits |= SceneGraphReducer::CS_geom_node;
40 if (collada_flatten_radius > 0.0) {
41 combine_siblings_bits |= SceneGraphReducer::CS_within_radius;
45 int num_reduced = gr.
flatten(loader._root, combine_siblings_bits);
46 collada_cat.info() <<
"Flattened " << num_reduced <<
" nodes.\n";
52 gr.
premunge(loader._root, RenderState::make_empty());
55 gr.
unify(loader._root,
true);
56 if (collada_cat.is_debug()) {
57 collada_cat.debug() <<
"Unified.\n";
74 load_collada_file(
const Filename &filename, CoordinateSystem cs,
84 loader._filename = filename;
86 loader._record = record;
89 <<
"Reading " << filename <<
"\n";
91 if (!loader.
read(filename)) {
95 return load_from_loader(loader);
A node of this type is created automatically at the root of each model file that is loaded...
Object that interfaces with the COLLADA DOM library and loads the COLLADA structures into Panda nodes...
A basic node of the scene graph or data graph.
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...
A hierarchy of directories and files that appears to be one continuous file system, even though the files may originate from several different sources that may not be related to the actual OS's file system.
An interface for simplifying ("flattening") scene graphs by eliminating unneeded nodes and collapsing...
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 build_graph()
Converts scene graph structures into a Panda3D scene graph, with _root being the root node...
The name of a file, such as a texture file or an Egg file.
void unify(PandaNode *root, bool preserve_order)
Calls unify() on every GeomNode at this level and below.
An instance of this class is written to the front of a Bam or Txo file to make the file a cached inst...
static VirtualFileSystem * get_global_ptr()
Returns the default global VirtualFileSystem.
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...
int flatten(PandaNode *root, int combine_siblings_bits)
Simplifies the graph by removing unnecessary nodes and nodes.
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...
bool read(const Filename &filename)
Reads from the indicated file.