Panda3D
colorAttrib.I
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 colorAttrib.I
10  * @author drose
11  * @date 2002-02-22
12  */
13 
14 /**
15  * Use ColorAttrib::make() to construct a new ColorAttrib object.
16  */
17 INLINE ColorAttrib::
18 ColorAttrib(ColorAttrib::Type type, const LColor &color) :
19  _type(type),
20  _color(color)
21 {
22  quantize_color();
23 }
24 
25 /**
26  * Returns the type of color specified by this ColorAttrib. The options are:
27  *
28  * T_vertex - use the vertex color specified in the geometry itself.
29  *
30  * T_flat - use the color specified in this ColorAttrib for all geometry. You
31  * can get this color via get_color().
32  *
33  * T_off - use the color white.
34  */
35 INLINE ColorAttrib::Type ColorAttrib::
36 get_color_type() const {
37  return _type;
38 }
39 
40 /**
41  * If the type is T_flat or T_off, this returns the color that will be applied
42  * to geometry. If the type is T_vertex, this is meaningless.
43  */
44 INLINE const LColor &ColorAttrib::
45 get_color() const {
46  return _color;
47 }