From fdf4cf15d42eedf4097ef75a01ba94416d88aef6 Mon Sep 17 00:00:00 2001 From: David Rose Date: Sat, 4 Feb 2012 01:16:41 +0000 Subject: [PATCH] add -r --- pandatool/src/pfmprogs/pfmBba.cxx | 13 +++++++++++-- pandatool/src/pfmprogs/pfmBba.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pandatool/src/pfmprogs/pfmBba.cxx b/pandatool/src/pfmprogs/pfmBba.cxx index 8ea2be0c66..3a31c28f87 100755 --- a/pandatool/src/pfmprogs/pfmBba.cxx +++ b/pandatool/src/pfmprogs/pfmBba.cxx @@ -33,10 +33,17 @@ PfmBba() { "Treats (0,0,0) in the pfm file as a special don't-touch value.", &PfmBba::dispatch_none, &_got_zero_special); + add_option + ("r", "index", 0, + "Selects a reorder index.", + &PfmBba::dispatch_int, NULL, &_reorder_index); + add_option ("o", "filename", 50, "Specify the filename to which the resulting bba file will be written.", &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. - static const int ri = 0; - static const int reorder_points[][8] = { + static const int num_reorder_points = 4; + static const int reorder_points[num_reorder_points][8] = { { 0, 1, 2, 3, 4, 5, 6, 7 }, // unfiltered { 7, 5, 1, 3, 6, 4, 0, 2 }, // front, floor { 4, 6, 2, 0, 5, 7, 3, 1 }, // left { 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) { LPoint3 p = bounds->get_point(reorder_points[ri][i]); diff --git a/pandatool/src/pfmprogs/pfmBba.h b/pandatool/src/pfmprogs/pfmBba.h index b22c533602..2311fac65d 100755 --- a/pandatool/src/pfmprogs/pfmBba.h +++ b/pandatool/src/pfmprogs/pfmBba.h @@ -45,6 +45,7 @@ private: bool _got_zero_special; bool _got_output_filename; Filename _output_filename; + int _reorder_index; }; #endif