Panda3D
|
00001 // Filename: loaderFileType.cxx 00002 // Created by: drose (20Jun00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "loaderFileType.h" 00016 #include "loaderOptions.h" 00017 #include "config_pgraph.h" 00018 00019 00020 TypeHandle LoaderFileType::_type_handle; 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Function: LoaderFileType::Constructor 00024 // Access: Protected 00025 // Description: 00026 //////////////////////////////////////////////////////////////////// 00027 LoaderFileType:: 00028 LoaderFileType() { 00029 // Derived LoaderFileType classes that return a different result 00030 // based on the setting of certain LoaderOptions flags (like 00031 // LF_convert_anim) should set those bits in the following bitmask, 00032 // so that we will not inadvertently cache a model without 00033 // respecting these flags. 00034 _no_cache_flags = 0; 00035 } 00036 00037 //////////////////////////////////////////////////////////////////// 00038 // Function: LoaderFileType::Destructor 00039 // Access: Public, Virtual 00040 // Description: 00041 //////////////////////////////////////////////////////////////////// 00042 LoaderFileType:: 00043 ~LoaderFileType() { 00044 } 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Function: LoaderFileType::get_additional_extensions 00048 // Access: Published, Virtual 00049 // Description: Returns a space-separated list of extension, in 00050 // addition to the one returned by get_extension(), that 00051 // are recognized by this loader. 00052 //////////////////////////////////////////////////////////////////// 00053 string LoaderFileType:: 00054 get_additional_extensions() const { 00055 return string(); 00056 } 00057 00058 //////////////////////////////////////////////////////////////////// 00059 // Function: LoaderFileType::supports_compressed 00060 // Access: Published, Virtual 00061 // Description: Returns true if this file type can transparently load 00062 // compressed files (with a .pz extension), false 00063 // otherwise. 00064 //////////////////////////////////////////////////////////////////// 00065 bool LoaderFileType:: 00066 supports_compressed() const { 00067 return false; 00068 } 00069 00070 //////////////////////////////////////////////////////////////////// 00071 // Function: LoaderFileType::get_allow_disk_cache 00072 // Access: Published, Virtual 00073 // Description: Returns true if the loader flags allow retrieving the 00074 // model from the on-disk bam cache (if it is enabled), 00075 // false otherwise. 00076 //////////////////////////////////////////////////////////////////// 00077 bool LoaderFileType:: 00078 get_allow_disk_cache(const LoaderOptions &options) const { 00079 return (options.get_flags() & (LoaderOptions::LF_no_disk_cache | _no_cache_flags)) == 0; 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: LoaderFileType::get_allow_ram_cache 00084 // Access: Published 00085 // Description: Returns true if the loader flags allow retrieving the 00086 // model from the in-memory ModelPool cache, false 00087 // otherwise. 00088 //////////////////////////////////////////////////////////////////// 00089 bool LoaderFileType:: 00090 get_allow_ram_cache(const LoaderOptions &options) const { 00091 return (options.get_flags() & (LoaderOptions::LF_no_ram_cache | _no_cache_flags)) == 0; 00092 } 00093 00094 //////////////////////////////////////////////////////////////////// 00095 // Function: LoaderFileType::load_file 00096 // Access: Public, Virtual 00097 // Description: 00098 //////////////////////////////////////////////////////////////////// 00099 PT(PandaNode) LoaderFileType:: 00100 load_file(const Filename &path, const LoaderOptions &options, 00101 BamCacheRecord *record) const { 00102 loader_cat.error() 00103 << get_type() << " cannot read PandaNode objects.\n"; 00104 return NULL; 00105 }