mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
add :powertwo option
This commit is contained in:
parent
fc1c9ac134
commit
cd8659ea2b
@ -430,6 +430,12 @@ describe_input_file() {
|
|||||||
"also be overridden for a particular texture using the 'coverage' "
|
"also be overridden for a particular texture using the 'coverage' "
|
||||||
"keyword on the texture line.\n\n");
|
"keyword on the texture line.\n\n");
|
||||||
|
|
||||||
|
show_text(" :powertwo flag", 10,
|
||||||
|
"Specifies whether textures should be forced to a power of two "
|
||||||
|
"size when they are not placed within a palette. Use 1 for true, "
|
||||||
|
"to force textures to a power of two; or 0 to leave them exactly "
|
||||||
|
"the size they are specified. The default is true.\n\n");
|
||||||
|
|
||||||
show_text(" :round fraction fuzz", 10,
|
show_text(" :round fraction fuzz", 10,
|
||||||
"When the coverage area is computed, it may optionally be "
|
"When the coverage area is computed, it may optionally be "
|
||||||
"rounded up to the next sizeable unit before placing the "
|
"rounded up to the next sizeable unit before placing the "
|
||||||
|
@ -77,6 +77,9 @@ read(istream &in, const string &filename) {
|
|||||||
} else if (words[0] == ":coverage") {
|
} else if (words[0] == ":coverage") {
|
||||||
okflag = parse_coverage_line(words);
|
okflag = parse_coverage_line(words);
|
||||||
|
|
||||||
|
} else if (words[0] == ":powertwo") {
|
||||||
|
okflag = parse_powertwo_line(words);
|
||||||
|
|
||||||
} else if (words[0] == ":imagetype") {
|
} else if (words[0] == ":imagetype") {
|
||||||
okflag = parse_imagetype_line(words);
|
okflag = parse_imagetype_line(words);
|
||||||
|
|
||||||
@ -400,6 +403,37 @@ parse_coverage_line(const vector_string &words) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: TxaFile::parse_powertwo_line
|
||||||
|
// Access: Private
|
||||||
|
// Description: Handles the line in a .txa file that begins with the
|
||||||
|
// keyword ":powertwo" and indicates whether textures
|
||||||
|
// should by default be forced to a power of two.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool TxaFile::
|
||||||
|
parse_powertwo_line(const vector_string &words) {
|
||||||
|
if (words.size() != 2) {
|
||||||
|
nout << "Exactly one parameter required for :powertwo, either a 0 "
|
||||||
|
<< "or a 1.\n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int flag;
|
||||||
|
if (!string_to_int(words[1], flag)) {
|
||||||
|
nout << "Invalid powertwo flag: " << words[1] << "\n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag != 0 && flag != 1) {
|
||||||
|
nout << "Invalid powertwo flag: " << flag << "\n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
pal->_force_power_2 = (flag != 0);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: TxaFile::parse_imagetype_line
|
// Function: TxaFile::parse_imagetype_line
|
||||||
// Access: Private
|
// Access: Private
|
||||||
|
@ -53,6 +53,7 @@ private:
|
|||||||
bool parse_margin_line(const vector_string &words);
|
bool parse_margin_line(const vector_string &words);
|
||||||
bool parse_background_line(const vector_string &words);
|
bool parse_background_line(const vector_string &words);
|
||||||
bool parse_coverage_line(const vector_string &words);
|
bool parse_coverage_line(const vector_string &words);
|
||||||
|
bool parse_powertwo_line(const vector_string &words);
|
||||||
bool parse_imagetype_line(const vector_string &words);
|
bool parse_imagetype_line(const vector_string &words);
|
||||||
bool parse_shadowtype_line(const vector_string &words);
|
bool parse_shadowtype_line(const vector_string &words);
|
||||||
bool parse_round_line(const vector_string &words);
|
bool parse_round_line(const vector_string &words);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user