Panda3D
 All Classes Functions Variables Enumerations
loaderOptions.h
1 // Filename: loaderOptions.h
2 // Created by: drose (05Oct05)
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 #ifndef LOADEROPTIONS_H
16 #define LOADEROPTIONS_H
17 
18 #include "pandabase.h"
19 #include "autoTextureScale.h"
20 
21 ////////////////////////////////////////////////////////////////////
22 // Class : LoaderOptions
23 // Description : Specifies parameters that may be passed to the
24 // loader.
25 ////////////////////////////////////////////////////////////////////
26 class EXPCL_PANDA_PUTIL LoaderOptions {
27 PUBLISHED:
28  // Flags for loading model files.
29  enum LoaderFlags {
30  LF_search = 0x0001,
31  LF_report_errors = 0x0002,
32  LF_convert_skeleton = 0x0004,
33  LF_convert_channels = 0x0008,
34  LF_convert_anim = 0x000c, // skeleton + channels
35  LF_no_disk_cache = 0x0010, // disallow BamCache
36  LF_no_ram_cache = 0x0020, // disallow ModelPool
37  LF_no_cache = 0x0030, // no_disk + no_ram
38  LF_cache_only = 0x0040, // fail if not in cache
39  LF_allow_instance = 0x0080, // returned pointer might be shared
40  };
41 
42  // Flags for loading texture files.
43  enum TextureFlags {
44  TF_preload = 0x0004, // Texture will have RAM image
45  TF_preload_simple = 0x0008, // Texture will have simple RAM image
46  TF_allow_1d = 0x0010, // If texture is Nx1, make a 1-d texture
47  TF_generate_mipmaps = 0x0020, // Consider generating mipmaps
48  TF_multiview = 0x0040, // Load a multiview texture in pages
49  TF_integer = 0x0080, // Load as an integer (RGB) texture
50  TF_float = 0x0100, // Load as a floating-point (depth) texture
51  };
52 
53  LoaderOptions(int flags = LF_search | LF_report_errors);
54  INLINE LoaderOptions(int flags, int texture_flags);
55  INLINE LoaderOptions(const LoaderOptions &copy);
56  INLINE void operator = (const LoaderOptions &copy);
57 
58  INLINE void set_flags(int flags);
59  INLINE int get_flags() const;
60 
61  INLINE void set_texture_flags(int flags);
62  INLINE int get_texture_flags() const;
63  INLINE void set_texture_num_views(int num_views);
64  INLINE int get_texture_num_views() const;
65 
66  INLINE void set_auto_texture_scale(AutoTextureScale scale);
67  INLINE AutoTextureScale get_auto_texture_scale() const;
68 
69  void output(ostream &out) const;
70 
71 private:
72  void write_flag(ostream &out, string &sep,
73  const string &flag_name, int flag) const;
74  void write_texture_flag(ostream &out, string &sep,
75  const string &flag_name, int flag) const;
76  int _flags;
77  int _texture_flags;
78  int _texture_num_views;
79  AutoTextureScale _auto_texture_scale;
80 };
81 
82 INLINE ostream &operator << (ostream &out, const LoaderOptions &opts) {
83  opts.output(out);
84  return out;
85 }
86 
87 #include "loaderOptions.I"
88 
89 #endif
Specifies parameters that may be passed to the loader.
Definition: loaderOptions.h:26