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