Panda3D
panda
src
putil
autoTextureScale.cxx
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 autoTextureScale.cxx
10
* @author drose
11
* @date 2011-11-28
12
*/
13
14
#include "
autoTextureScale.h
"
15
#include "
string_utils.h
"
16
#include "
config_putil.h
"
17
18
using
std::istream;
19
using
std::ostream;
20
using
std::string;
21
22
ostream &
23
operator << (ostream &out, AutoTextureScale ats) {
24
switch
(ats) {
25
case
ATS_none:
26
return
out <<
"none"
;
27
28
case
ATS_down:
29
return
out <<
"down"
;
30
31
case
ATS_up:
32
return
out <<
"up"
;
33
34
case
ATS_pad:
35
return
out <<
"pad"
;
36
37
case
ATS_unspecified:
38
return
out <<
"unspecified"
;
39
}
40
41
return
out <<
"**invalid AutoTextureScale ("
<< (int)ats <<
")**"
;
42
}
43
44
istream &
45
operator >> (istream &in, AutoTextureScale &ats) {
46
string
word;
47
in >> word;
48
49
if
(cmp_nocase(word,
"none"
) == 0 ||
50
cmp_nocase(word,
"0"
) == 0 ||
51
cmp_nocase(word,
"#f"
) == 0 ||
52
(!word.empty() && tolower(word[0]) ==
'f'
)) {
53
ats = ATS_none;
54
55
}
else
if
(cmp_nocase(word,
"down"
) == 0 ||
56
cmp_nocase(word,
"1"
) == 0 ||
57
cmp_nocase(word,
"#t"
) == 0 ||
58
(!word.empty() && tolower(word[0]) ==
't'
)) {
59
ats = ATS_down;
60
61
}
else
if
(cmp_nocase(word,
"up"
) == 0) {
62
ats = ATS_up;
63
64
}
else
if
(cmp_nocase(word,
"pad"
) == 0) {
65
ats = ATS_pad;
66
67
}
else
{
68
util_cat->error() <<
"Invalid AutoTextureScale value: "
<< word <<
"\n"
;
69
ats = ATS_none;
70
}
71
72
return
in;
73
}
string_utils.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
config_putil.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
autoTextureScale.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Generated on Wed Jan 23 2019 21:40:15 for Panda3D by
1.8.15