Panda3D
configVariableColor.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 configVariableColor.h
10  * @author rdb
11  * @date 2014-02-02
12  */
13 
14 #ifndef CONFIGVARIABLECOLOR_H
15 #define CONFIGVARIABLECOLOR_H
16 
17 #include "dtoolbase.h"
18 #include "config_linmath.h"
19 #include "config_prc.h"
20 #include "configVariable.h"
21 #include "luse.h"
22 
23 /**
24  * This is a convenience class to specialize ConfigVariable as a set of
25  * floating-point types representing a color value.
26  *
27  * It interprets the color differently depending on how many words were
28  * specified: if only one, it is interpreted as a shade of gray with alpha 1.
29  * If two values were specified, a grayscale and alpha pair. If three, a set
30  * of R, G, B values with alpha 1, and if four, a complete RGBA color.
31  *
32  * This isn't defined in dtool because it relies on the LColor class, which is
33  * defined in linmath.
34  */
35 class EXPCL_PANDA_LINMATH ConfigVariableColor : public ConfigVariable {
36 PUBLISHED:
37  INLINE ConfigVariableColor(const std::string &name);
38  INLINE ConfigVariableColor(const std::string &name, const LColor &default_value,
39  const std::string &description = std::string(),
40  int flags = 0);
41  INLINE ConfigVariableColor(const std::string &name, const std::string &default_value,
42  const std::string &description = std::string(),
43  int flags = 0);
44 
45  INLINE void operator = (const LColor &value);
46  INLINE operator const LColor & () const;
47 
48  INLINE PN_stdfloat operator [] (int n) const;
49 
50  INLINE void set_value(const LColor &value);
51  INLINE const LColor &get_value() const;
52  INLINE LColor get_default_value() const;
53 
54 private:
55  void set_default_value(const LColor &default_value);
56 
57 private:
58  mutable AtomicAdjust::Integer _local_modified;
59  mutable LColor _cache;
60 };
61 
62 #include "configVariableColor.I"
63 
64 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a convenience class to specialize ConfigVariable as a set of floating-point types representin...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a generic, untyped ConfigVariable.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.