This commit is contained in:
David Rose 2012-02-04 01:16:41 +00:00
parent 651a95df40
commit fdf4cf15d4
2 changed files with 12 additions and 2 deletions

View File

@ -33,10 +33,17 @@ PfmBba() {
"Treats (0,0,0) in the pfm file as a special don't-touch value.", "Treats (0,0,0) in the pfm file as a special don't-touch value.",
&PfmBba::dispatch_none, &_got_zero_special); &PfmBba::dispatch_none, &_got_zero_special);
add_option
("r", "index", 0,
"Selects a reorder index.",
&PfmBba::dispatch_int, NULL, &_reorder_index);
add_option add_option
("o", "filename", 50, ("o", "filename", 50,
"Specify the filename to which the resulting bba file will be written.", "Specify the filename to which the resulting bba file will be written.",
&PfmBba::dispatch_filename, &_got_output_filename, &_output_filename); &PfmBba::dispatch_filename, &_got_output_filename, &_output_filename);
_reorder_index = 0;
} }
@ -90,13 +97,15 @@ process_pfm(const Filename &input_filename, PfmFile &file) {
} }
// This is the order expected by our existing bba system. // This is the order expected by our existing bba system.
static const int ri = 0; static const int num_reorder_points = 4;
static const int reorder_points[][8] = { static const int reorder_points[num_reorder_points][8] = {
{ 0, 1, 2, 3, 4, 5, 6, 7 }, // unfiltered { 0, 1, 2, 3, 4, 5, 6, 7 }, // unfiltered
{ 7, 5, 1, 3, 6, 4, 0, 2 }, // front, floor { 7, 5, 1, 3, 6, 4, 0, 2 }, // front, floor
{ 4, 6, 2, 0, 5, 7, 3, 1 }, // left { 4, 6, 2, 0, 5, 7, 3, 1 }, // left
{ 7, 5, 1, 3, 2, 0, 4, 6 }, // right { 7, 5, 1, 3, 2, 0, 4, 6 }, // right
}; };
int ri = max(_reorder_index, 0);
ri = min(ri, num_reorder_points - 1);
for (int i = 0; i < bounds->get_num_points(); ++i) { for (int i = 0; i < bounds->get_num_points(); ++i) {
LPoint3 p = bounds->get_point(reorder_points[ri][i]); LPoint3 p = bounds->get_point(reorder_points[ri][i]);

View File

@ -45,6 +45,7 @@ private:
bool _got_zero_special; bool _got_zero_special;
bool _got_output_filename; bool _got_output_filename;
Filename _output_filename; Filename _output_filename;
int _reorder_index;
}; };
#endif #endif