Panda3D
Loading...
Searching...
No Matches
colorBlendAttrib.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 colorBlendAttrib.I
10 * @author drose
11 * @date 2002-03-29
12 */
13
14/**
15 * Use ColorBlendAttrib::make() to construct a new ColorBlendAttrib object.
16 */
17INLINE ColorBlendAttrib::
18ColorBlendAttrib() :
19 _mode(M_none),
20 _a(O_one),
21 _b(O_one),
22 _alpha_mode(M_none),
23 _alpha_a(O_one),
24 _alpha_b(O_one),
25 _color(LColor::zero()),
26 _involves_constant_color(false),
27 _involves_color_scale(false)
28{
29}
30
31/**
32 * Use ColorBlendAttrib::make() to construct a new ColorBlendAttrib object.
33 */
34INLINE ColorBlendAttrib::
35ColorBlendAttrib(ColorBlendAttrib::Mode mode,
36 ColorBlendAttrib::Operand a, ColorBlendAttrib::Operand b,
37 ColorBlendAttrib::Mode alpha_mode,
38 ColorBlendAttrib::Operand alpha_a, ColorBlendAttrib::Operand alpha_b,
39 const LColor &color) :
40 _mode(mode),
41 _a(a),
42 _b(b),
43 _alpha_mode(alpha_mode),
44 _alpha_a(alpha_a),
45 _alpha_b(alpha_b),
46 _color(color),
47 _involves_constant_color(involves_constant_color(a) ||
48 involves_constant_color(b) ||
49 involves_constant_color(alpha_a) ||
50 involves_constant_color(alpha_b)),
51 _involves_color_scale(involves_color_scale(a) ||
52 involves_color_scale(b) ||
53 involves_color_scale(alpha_a) ||
54 involves_color_scale(alpha_b))
55{
56}
57
58/**
59 * Returns the blending mode for the RGB channels.
60 */
61INLINE ColorBlendAttrib::Mode ColorBlendAttrib::
62get_mode() const {
63 return _mode;
64}
65
66/**
67 * Returns the RGB multiplier for the first component.
68 */
69INLINE ColorBlendAttrib::Operand ColorBlendAttrib::
70get_operand_a() const {
71 return _a;
72}
73
74/**
75 * Returns the RGB multiplier for the second component.
76 */
77INLINE ColorBlendAttrib::Operand ColorBlendAttrib::
78get_operand_b() const {
79 return _b;
80}
81
82/**
83 * Returns the blending mode for the alpha channel.
84 */
85INLINE ColorBlendAttrib::Mode ColorBlendAttrib::
86get_alpha_mode() const {
87 return _alpha_mode;
88}
89
90/**
91 * Returns the alpha multiplier for the first component.
92 */
93INLINE ColorBlendAttrib::Operand ColorBlendAttrib::
94get_alpha_operand_a() const {
95 return _alpha_a;
96}
97
98/**
99 * Returns the alpha multiplier for the second component.
100 */
101INLINE ColorBlendAttrib::Operand ColorBlendAttrib::
102get_alpha_operand_b() const {
103 return _alpha_b;
104}
105
106/**
107 * Returns the constant color associated with the attrib.
108 */
109INLINE LColor ColorBlendAttrib::
110get_color() const {
111 return _color;
112}
113
114/**
115 * Returns true if the this attrib uses the constant color, false otherwise.
116 */
119 return _involves_constant_color;
120}
121
122/**
123 * Returns true if the this attrib uses the color scale attrib, false
124 * otherwise.
125 */
127involves_color_scale() const {
128 return _involves_color_scale;
129}
130
131/**
132 * Returns true if the indicated operand uses the constant color, false
133 * otherwise.
134 */
136involves_constant_color(ColorBlendAttrib::Operand operand) {
137 switch (operand) {
138 case O_constant_color:
139 case O_one_minus_constant_color:
140 case O_constant_alpha:
141 case O_one_minus_constant_alpha:
142 return true;
143
144 default:
145 return false;
146 }
147}
148
149/**
150 * Returns true if the indicated operand uses the color scale attrib, false
151 * otherwise.
152 */
154involves_color_scale(ColorBlendAttrib::Operand operand) {
155 return (operand >= O_color_scale);
156}
get_operand_a
Returns the RGB multiplier for the first component.
get_alpha_operand_b
Returns the alpha multiplier for the second component.
bool involves_color_scale() const
Returns true if the this attrib uses the color scale attrib, false otherwise.
get_alpha_mode
Returns the blending mode for the alpha channel.
get_color
Returns the constant color associated with the attrib.
bool involves_constant_color() const
Returns true if the this attrib uses the constant color, false otherwise.
get_operand_b
Returns the RGB multiplier for the second component.
get_mode
Returns the blending mode for the RGB channels.
get_alpha_operand_a
Returns the alpha multiplier for the first component.