Panda3D
loaderFileTypeEgg.cxx
1 // Filename: loaderFileTypeEgg.cxx
2 // Created by: drose (20Jun00)
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 "loaderFileTypeEgg.h"
16 #include "load_egg_file.h"
17 #include "save_egg_file.h"
18 
19 #include "eggData.h"
20 
21 TypeHandle LoaderFileTypeEgg::_type_handle;
22 
23 ////////////////////////////////////////////////////////////////////
24 // Function: LoaderFileTypeEgg::Constructor
25 // Access: Public
26 // Description:
27 ////////////////////////////////////////////////////////////////////
28 LoaderFileTypeEgg::
29 LoaderFileTypeEgg() {
30 }
31 
32 ////////////////////////////////////////////////////////////////////
33 // Function: LoaderFileTypeEgg::get_name
34 // Access: Public, Virtual
35 // Description:
36 ////////////////////////////////////////////////////////////////////
37 string LoaderFileTypeEgg::
38 get_name() const {
39  return "Egg";
40 }
41 
42 ////////////////////////////////////////////////////////////////////
43 // Function: LoaderFileTypeEgg::get_extension
44 // Access: Public, Virtual
45 // Description:
46 ////////////////////////////////////////////////////////////////////
47 string LoaderFileTypeEgg::
48 get_extension() const {
49  return "egg";
50 }
51 
52 ////////////////////////////////////////////////////////////////////
53 // Function: LoaderFileTypeEgg::supports_compressed
54 // Access: Published, Virtual
55 // Description: Returns true if this file type can transparently load
56 // compressed files (with a .pz extension), false
57 // otherwise.
58 ////////////////////////////////////////////////////////////////////
61  return true;
62 }
63 
64 ////////////////////////////////////////////////////////////////////
65 // Function: LoaderFileTypeEgg::supports_load
66 // Access: Published, Virtual
67 // Description: Returns true if the file type can be used to load
68 // files, and load_file() is supported. Returns false
69 // if load_file() is unimplemented and will always fail.
70 ////////////////////////////////////////////////////////////////////
72 supports_load() const {
73  return true;
74 }
75 
76 ////////////////////////////////////////////////////////////////////
77 // Function: LoaderFileTypeEgg::supports_save
78 // Access: Published, Virtual
79 // Description: Returns true if the file type can be used to save
80 // files, and save_file() is supported. Returns false
81 // if save_file() is unimplemented and will always fail.
82 ////////////////////////////////////////////////////////////////////
84 supports_save() const {
85  return true;
86 }
87 
88 ////////////////////////////////////////////////////////////////////
89 // Function: LoaderFileTypeEgg::load_file
90 // Access: Public, Virtual
91 // Description:
92 ////////////////////////////////////////////////////////////////////
93 PT(PandaNode) LoaderFileTypeEgg::
94 load_file(const Filename &path, const LoaderOptions &,
95  BamCacheRecord *record) const {
96  PT(PandaNode) result = load_egg_file(path, CS_default, record);
97  return result;
98 }
99 
100 ////////////////////////////////////////////////////////////////////
101 // Function: LoaderFileTypeEgg::save_file
102 // Access: Public, Virtual
103 // Description:
104 ////////////////////////////////////////////////////////////////////
105 bool LoaderFileTypeEgg::
106 save_file(const Filename &path, const LoaderOptions &options,
107  PandaNode *node) const {
108  return save_egg_file(path, node);
109 }
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
Specifies parameters that may be passed to the loader.
Definition: loaderOptions.h:26
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
An instance of this class is written to the front of a Bam or Txo file to make the file a cached inst...
virtual bool supports_save() const
Returns true if the file type can be used to save files, and save_file() is supported.
virtual bool supports_load() const
Returns true if the file type can be used to load files, and load_file() is supported.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
virtual bool supports_compressed() const
Returns true if this file type can transparently load compressed files (with a .pz extension)...