Panda3D
Loading...
Searching...
No Matches
eggMaterial.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 eggMaterial.I
10 * @author drose
11 * @date 1999-01-29
12 */
13
14/**
15 * @since 1.10.0
16 */
17INLINE void EggMaterial::
18set_base(const LColor &base) {
19 _base = base;
20 _flags |= F_base;
21}
22
23/**
24 * @since 1.10.0
25 */
26INLINE void EggMaterial::
27clear_base() {
28 _flags &= ~F_base;
29}
30
31/**
32 * @since 1.10.0
33 */
34INLINE bool EggMaterial::
35has_base() const {
36 return (_flags & F_base) != 0;
37}
38
39/**
40 * It is legal to call this even if has_base() returns false. If so, it
41 * simply returns the default base color.
42 *
43 * @since 1.10.0
44 */
45INLINE LColor EggMaterial::
46get_base() const {
47 if (has_base()) {
48 return _base;
49 } else {
50 return LColor(1.0, 1.0, 1.0, 1.0);
51 }
52}
53
54/**
55 *
56 */
57INLINE void EggMaterial::
58set_diff(const LColor &diff) {
59 _diff = diff;
60 _flags |= F_diff;
61}
62
63/**
64 *
65 */
66INLINE void EggMaterial::
67clear_diff() {
68 _flags &= ~F_diff;
69}
70
71/**
72 *
73 */
74INLINE bool EggMaterial::
75has_diff() const {
76 return (_flags & F_diff) != 0;
77}
78
79/**
80 * It is legal to call this even if has_diff() returns false. If so, it
81 * simply returns the default diff color.
82 */
83INLINE LColor EggMaterial::
84get_diff() const {
85 if (has_diff()) {
86 return _diff;
87 } else {
88 return LColor(1.0, 1.0, 1.0, 1.0);
89 }
90}
91
92/**
93 *
94 */
95INLINE void EggMaterial::
96set_amb(const LColor &amb) {
97 _amb = amb;
98 _flags |= F_amb;
99}
100
101/**
102 *
103 */
104INLINE void EggMaterial::
105clear_amb() {
106 _flags &= ~F_amb;
107}
108
109/**
110 *
111 */
112INLINE bool EggMaterial::
113has_amb() const {
114 return (_flags & F_amb) != 0;
115}
116
117/**
118 * It is legal to call this even if has_amb() returns false. If so, it simply
119 * returns the default amb color.
120 */
121INLINE LColor EggMaterial::
122get_amb() const {
123 if (has_amb()) {
124 return _amb;
125 } else {
126 return LColor(1.0, 1.0, 1.0, 1.0);
127 }
128}
129
130/**
131 *
132 */
133INLINE void EggMaterial::
134set_emit(const LColor &emit) {
135 _emit = emit;
136 _flags |= F_emit;
137}
138
139/**
140 *
141 */
142INLINE void EggMaterial::
143clear_emit() {
144 _flags &= ~F_emit;
145}
146
147/**
148 *
149 */
150INLINE bool EggMaterial::
151has_emit() const {
152 return (_flags & F_emit) != 0;
153}
154
155/**
156 * It is legal to call this even if has_emit() returns false. If so, it
157 * simply returns the default emit color.
158 */
159INLINE LColor EggMaterial::
160get_emit() const {
161 if (has_emit()) {
162 return _emit;
163 } else {
164 return LColor(0.0, 0.0, 0.0, 1.0);
165 }
166}
167
168/**
169 *
170 */
171INLINE void EggMaterial::
172set_spec(const LColor &spec) {
173 _spec = spec;
174 _flags |= F_spec;
175}
176
177/**
178 *
179 */
180INLINE void EggMaterial::
181clear_spec() {
182 _flags &= ~F_spec;
183}
184
185/**
186 *
187 */
188INLINE bool EggMaterial::
189has_spec() const {
190 return (_flags & F_spec) != 0;
191}
192
193/**
194 * It is legal to call this even if has_spec() returns false. If so, it
195 * simply returns the default spec color.
196 */
197INLINE LColor EggMaterial::
198get_spec() const {
199 if (has_spec()) {
200 return _spec;
201 } else {
202 return LColor(0.0, 0.0, 0.0, 1.0);
203 }
204}
205
206/**
207 *
208 */
209INLINE void EggMaterial::
210set_shininess(double shininess) {
211 _shininess = shininess;
212 _flags |= F_shininess;
213}
214
215/**
216 *
217 */
218INLINE void EggMaterial::
219clear_shininess() {
220 _flags &= ~F_shininess;
221}
222
223/**
224 *
225 */
226INLINE bool EggMaterial::
227has_shininess() const {
228 return (_flags & F_shininess) != 0;
229}
230
231/**
232 *
233 */
234INLINE double EggMaterial::
235get_shininess() const {
236 if (has_shininess()) {
237 return _shininess;
238 } else {
239 return 0.0;
240 }
241}
242
243/**
244 * @since 1.10.0
245 */
246INLINE void EggMaterial::
247set_roughness(double roughness) {
248 _roughness = roughness;
249 _flags |= F_roughness;
250}
251
252/**
253 * @since 1.10.0
254 */
255INLINE void EggMaterial::
257 _flags &= ~F_roughness;
258}
259
260/**
261 * @since 1.10.0
262 */
263INLINE bool EggMaterial::
264has_roughness() const {
265 return (_flags & F_roughness) != 0;
266}
267
268/**
269 * @since 1.10.0
270 */
271INLINE double EggMaterial::
272get_roughness() const {
273 if (has_roughness()) {
274 return _roughness;
275 } else {
276 return 1.0;
277 }
278}
279
280/**
281 * @since 1.10.0
282 */
283INLINE void EggMaterial::
284set_metallic(double metallic) {
285 _metallic = metallic;
286 _flags |= F_metallic;
287}
288
289/**
290 * @since 1.10.0
291 */
292INLINE void EggMaterial::
294 _flags &= ~F_metallic;
295}
296
297/**
298 * @since 1.10.0
299 */
300INLINE bool EggMaterial::
301has_metallic() const {
302 return (_flags & F_metallic) != 0;
303}
304
305/**
306 * @since 1.10.0
307 */
308INLINE double EggMaterial::
309get_metallic() const {
310 if (has_metallic()) {
311 return _metallic;
312 } else {
313 return 0.0;
314 }
315}
316
317/**
318 * @since 1.10.0
319 */
320INLINE void EggMaterial::
321set_ior(double ior) {
322 _ior = ior;
323 _flags |= F_ior;
324}
325
326/**
327 * @since 1.10.0
328 */
329INLINE void EggMaterial::
330clear_ior() {
331 _flags &= ~F_ior;
332}
333
334/**
335 * @since 1.10.0
336 */
337INLINE bool EggMaterial::
338has_ior() const {
339 return (_flags & F_ior) != 0;
340}
341
342/**
343 * @since 1.10.0
344 */
345INLINE double EggMaterial::
346get_ior() const {
347 if (has_ior()) {
348 return _ior;
349 } else {
350 return 1.0;
351 }
352}
353
354/**
355 *
356 */
357INLINE void EggMaterial::
358set_local(bool local) {
359 _local = local;
360 _flags |= F_local;
361}
362
363/**
364 *
365 */
366INLINE void EggMaterial::
367clear_local() {
368 _flags &= ~F_local;
369}
370
371/**
372 *
373 */
374INLINE bool EggMaterial::
375has_local() const {
376 return (_flags & F_local) != 0;
377}
378
379/**
380 *
381 */
382INLINE bool EggMaterial::
383get_local() const {
384 if (has_local()) {
385 return _local;
386 } else {
387 return 0.0;
388 }
389}
390
391/**
392 *
393 */
394INLINE UniqueEggMaterials::
395UniqueEggMaterials(int eq) : _eq(eq) {
396}
397
398/**
399 *
400 */
401INLINE bool UniqueEggMaterials::
402operator ()(const EggMaterial *t1, const EggMaterial *t2) const {
403 return t1->sorts_less_than(*t2, _eq);
404}
get_emit
It is legal to call this even if has_emit() returns false.
Definition eggMaterial.h:95
bool sorts_less_than(const EggMaterial &other, int eq) const
An ordering operator to compare two materials for sorting order.
get_spec
It is legal to call this even if has_spec() returns false.
Definition eggMaterial.h:96
get_diff
It is legal to call this even if has_diff() returns false.
Definition eggMaterial.h:93
get_amb
It is legal to call this even if has_amb() returns false.
Definition eggMaterial.h:94
get_base
It is legal to call this even if has_base() returns false.
Definition eggMaterial.h:92