hacky stuff

This commit is contained in:
David Rose 2012-02-16 00:18:31 +00:00
parent 1fc2e4b35d
commit 0b0a286101

View File

@ -33,17 +33,10 @@ 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;
} }
@ -96,19 +89,22 @@ process_pfm(const Filename &input_filename, PfmFile &file) {
return false; return false;
} }
// This is the order expected by our existing bba system. LPoint3 points[8];
static const int num_reorder_points = 4; for (int i = 0; i < 8; ++i) {
static const int reorder_points[num_reorder_points][8] = { points[i] = bounds->get_point(i);
{ 0, 1, 2, 3, 4, 5, 6, 7 }, // unfiltered }
{ 7, 5, 1, 3, 6, 4, 0, 2 }, // front, floor LPlanef plane(points[0], points[1], points[2]);
{ 4, 6, 2, 0, 5, 7, 3, 1 }, // left LVector3 normal = plane.get_normal();
{ 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) { static const PN_stdfloat scale = 20.0f;
LPoint3 p = bounds->get_point(reorder_points[ri][i]); normal *= scale;
points[0] += normal;
points[1] += normal;
points[2] += normal;
points[3] += normal;
for (int i = 0; i < 8; ++i) {
const LPoint3 &p = points[i];
out << p[0] << "," << p[1] << "," << p[2] << "\n"; out << p[0] << "," << p[1] << "," << p[2] << "\n";
} }
} }