Panda3D
 All Classes Functions Variables Enumerations
save_egg_file.cxx
1 // Filename: save_egg_file.cxx
2 // Created by: drose (26Feb02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "save_egg_file.h"
16 #include "eggSaver.h"
17 #include "config_egg2pg.h"
18 #include "sceneGraphReducer.h"
19 #include "virtualFileSystem.h"
20 #include "config_util.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Function: save_egg_file
24 // Description: A convenience function; converts the indicated scene
25 // graph to an egg file and writes it to disk.
26 ////////////////////////////////////////////////////////////////////
27 bool
28 save_egg_file(const Filename &filename, PandaNode *node, CoordinateSystem cs) {
29  PT(EggData) data = new EggData;
30  if (cs == CS_default) {
31  cs = get_default_coordinate_system();
32  }
33  data->set_coordinate_system(cs);
34 
35  EggSaver saver(data);
36  saver.add_node(node);
37 
38  return data->write_egg(filename);
39 }
40 
41 ////////////////////////////////////////////////////////////////////
42 // Function: save_egg_data
43 // Description: Another convenience function; works like
44 // save_egg_file() but populates an EggData instead of
45 // writing the results to disk.
46 ////////////////////////////////////////////////////////////////////
47 bool
48 save_egg_data(EggData *data, PandaNode *node) {
49  EggSaver saver(data);
50  saver.add_node(node);
51  return true;
52 }
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
This is the primary interface into all the egg data, and the root of the egg file structure...
Definition: eggData.h:41
Converts the scene graph beginning at the indicated node into an EggData structure, for writing to an egg file.
Definition: eggSaver.h:56
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44