Panda3D
|
00001 // Filename: loaderOptions.h 00002 // Created by: drose (05Oct05) 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 #ifndef LOADEROPTIONS_H 00016 #define LOADEROPTIONS_H 00017 00018 #include "pandabase.h" 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Class : LoaderOptions 00022 // Description : Specifies parameters that may be passed to the 00023 // loader. 00024 //////////////////////////////////////////////////////////////////// 00025 class EXPCL_PANDA_PUTIL LoaderOptions { 00026 PUBLISHED: 00027 // Flags for loading model files. 00028 enum LoaderFlags { 00029 LF_search = 0x0001, 00030 LF_report_errors = 0x0002, 00031 LF_convert_skeleton = 0x0004, 00032 LF_convert_channels = 0x0008, 00033 LF_convert_anim = 0x000c, // skeleton + channels 00034 LF_no_disk_cache = 0x0010, // disallow BamCache 00035 LF_no_ram_cache = 0x0020, // disallow ModelPool 00036 LF_no_cache = 0x0030, // no_disk + no_ram 00037 LF_cache_only = 0x0040, // fail if not in cache 00038 LF_allow_instance = 0x0080, // returned pointer might be shared 00039 }; 00040 00041 // Flags for loading texture files. 00042 enum TextureFlags { 00043 TF_preload = 0x0004, // Texture will have RAM image 00044 TF_preload_simple = 0x0008, // Texture will have simple RAM image 00045 TF_allow_1d = 0x0010, // If texture is Nx1, make a 1-d texture 00046 TF_generate_mipmaps = 0x0020, // Consider generating mipmaps 00047 }; 00048 00049 LoaderOptions(int flags = LF_search | LF_report_errors); 00050 INLINE LoaderOptions(int flags, int texture_flags); 00051 INLINE LoaderOptions(const LoaderOptions ©); 00052 INLINE void operator = (const LoaderOptions ©); 00053 00054 INLINE void set_flags(int flags); 00055 INLINE int get_flags() const; 00056 00057 INLINE void set_texture_flags(int flags); 00058 INLINE int get_texture_flags() const; 00059 00060 void output(ostream &out) const; 00061 00062 private: 00063 void write_flag(ostream &out, string &sep, 00064 const string &flag_name, int flag) const; 00065 void write_texture_flag(ostream &out, string &sep, 00066 const string &flag_name, int flag) const; 00067 int _flags; 00068 int _texture_flags; 00069 }; 00070 00071 INLINE ostream &operator << (ostream &out, const LoaderOptions &opts) { 00072 opts.output(out); 00073 return out; 00074 } 00075 00076 #include "loaderOptions.I" 00077 00078 #endif