Panda3D
Loading...
Searching...
No Matches
loaderOptions.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file loaderOptions.h
10 * @author drose
11 * @date 2005-10-05
12 */
13
14#ifndef LOADEROPTIONS_H
15#define LOADEROPTIONS_H
16
17#include "pandabase.h"
18#include "autoTextureScale.h"
19
20/**
21 * Specifies parameters that may be passed to the loader.
22 */
23class EXPCL_PANDA_PUTIL LoaderOptions {
24PUBLISHED:
25 // Flags for loading model files.
26 enum LoaderFlags {
27 LF_search = 0x0001,
28 LF_report_errors = 0x0002,
29 LF_convert_skeleton = 0x0004,
30 LF_convert_channels = 0x0008,
31 LF_convert_anim = 0x000c, // skeleton + channels
32 LF_no_disk_cache = 0x0010, // disallow BamCache
33 LF_no_ram_cache = 0x0020, // disallow ModelPool
34 LF_no_cache = 0x0030, // no_disk + no_ram
35 LF_cache_only = 0x0040, // fail if not in cache
36 LF_allow_instance = 0x0080, // returned pointer might be shared
37 };
38
39 // Flags for loading texture files.
40 enum TextureFlags {
41 TF_preload = 0x0004, // Texture will have RAM image
42 TF_preload_simple = 0x0008, // Texture will have simple RAM image
43 TF_allow_1d = 0x0010, // If texture is Nx1, make a 1-d texture
44 TF_generate_mipmaps = 0x0020, // Consider generating mipmaps
45 TF_multiview = 0x0040, // Load a multiview texture in pages
46 TF_integer = 0x0080, // Load as an integer (RGB) texture
47 TF_float = 0x0100, // Load as a floating-point (depth) texture
48 TF_allow_compression = 0x0200, // Consider compressing RAM image
49 };
50
51 LoaderOptions(int flags = LF_search | LF_report_errors);
52 constexpr LoaderOptions(int flags, int texture_flags);
53
54 INLINE void set_flags(int flags);
55 INLINE int get_flags() const;
56 MAKE_PROPERTY(flags, get_flags, set_flags);
57
58 INLINE void set_texture_flags(int flags);
59 INLINE int get_texture_flags() const;
60 INLINE void set_texture_num_views(int num_views);
61 INLINE int get_texture_num_views() const;
62 MAKE_PROPERTY(texture_flags, get_texture_flags, set_texture_flags);
63 MAKE_PROPERTY(texture_num_views, get_texture_num_views,
64 set_texture_num_views);
65
66 INLINE void set_auto_texture_scale(AutoTextureScale scale);
67 INLINE AutoTextureScale get_auto_texture_scale() const;
68 MAKE_PROPERTY(auto_texture_scale, get_auto_texture_scale,
69 set_auto_texture_scale);
70
71 void output(std::ostream &out) const;
72
73private:
74 void write_flag(std::ostream &out, std::string &sep,
75 const std::string &flag_name, int flag) const;
76 void write_texture_flag(std::ostream &out, std::string &sep,
77 const std::string &flag_name, int flag) const;
78 int _flags;
79 int _texture_flags;
80 int _texture_num_views;
81 AutoTextureScale _auto_texture_scale;
82};
83
84INLINE std::ostream &operator << (std::ostream &out, const LoaderOptions &opts) {
85 opts.output(out);
86 return out;
87}
88
89#include "loaderOptions.I"
90
91#endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Specifies parameters that may be passed to the loader.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.