|
@@ -30,6 +30,7 @@
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
PfmTrans::
|
|
PfmTrans::
|
|
|
PfmTrans() {
|
|
PfmTrans() {
|
|
|
|
|
+ _no_data_nan_num_channels = 0;
|
|
|
_got_transform = false;
|
|
_got_transform = false;
|
|
|
_transform = LMatrix4::ident_mat();
|
|
_transform = LMatrix4::ident_mat();
|
|
|
_rotate = 0;
|
|
_rotate = 0;
|
|
@@ -46,6 +47,11 @@ PfmTrans() {
|
|
|
"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.",
|
|
|
&PfmTrans::dispatch_none, &_got_zero_special);
|
|
&PfmTrans::dispatch_none, &_got_zero_special);
|
|
|
|
|
|
|
|
|
|
+ add_option
|
|
|
|
|
+ ("nan", "num_channels", 0,
|
|
|
|
|
+ "Treats a NaN in any of the first num_channels channels as a special don't-touch value.",
|
|
|
|
|
+ &PfmTrans::dispatch_int, &_got_no_data_nan, &_no_data_nan_num_channels);
|
|
|
|
|
+
|
|
|
add_option
|
|
add_option
|
|
|
("resize", "width,height", 0,
|
|
("resize", "width,height", 0,
|
|
|
"Resamples the pfm file to scale it to the indicated grid size. "
|
|
"Resamples the pfm file to scale it to the indicated grid size. "
|
|
@@ -62,7 +68,7 @@ PfmTrans() {
|
|
|
add_option
|
|
add_option
|
|
|
("autocrop", "", 0,
|
|
("autocrop", "", 0,
|
|
|
"Automatically crops to the smallest possible rectangle that includes "
|
|
"Automatically crops to the smallest possible rectangle that includes "
|
|
|
- "all points. Requires -z.",
|
|
|
|
|
|
|
+ "all points. Requires -z or -nan.",
|
|
|
&PfmTrans::dispatch_none, &_got_autocrop);
|
|
&PfmTrans::dispatch_none, &_got_autocrop);
|
|
|
|
|
|
|
|
add_option
|
|
add_option
|
|
@@ -118,6 +124,11 @@ PfmTrans() {
|
|
|
("vistex", "texture.jpg", 60,
|
|
("vistex", "texture.jpg", 60,
|
|
|
"Specifies the name of the texture to apply to the visualization.",
|
|
"Specifies the name of the texture to apply to the visualization.",
|
|
|
&PfmTrans::dispatch_filename, &_got_vistex_filename, &_vistex_filename);
|
|
&PfmTrans::dispatch_filename, &_got_vistex_filename, &_vistex_filename);
|
|
|
|
|
+
|
|
|
|
|
+ add_option
|
|
|
|
|
+ ("ls", "filename.txt", 60,
|
|
|
|
|
+ "Lists the points in the file to the indicated text file.",
|
|
|
|
|
+ &PfmTrans::dispatch_filename, &_got_ls_filename, &_ls_filename);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -162,7 +173,11 @@ run() {
|
|
|
bool PfmTrans::
|
|
bool PfmTrans::
|
|
|
process_pfm(const Filename &input_filename, PfmFile &file) {
|
|
process_pfm(const Filename &input_filename, PfmFile &file) {
|
|
|
PfmVizzer vizzer(file);
|
|
PfmVizzer vizzer(file);
|
|
|
- file.set_zero_special(_got_zero_special);
|
|
|
|
|
|
|
+ if (_got_no_data_nan) {
|
|
|
|
|
+ file.set_no_data_nan(_no_data_nan_num_channels);
|
|
|
|
|
+ } else if (_got_zero_special) {
|
|
|
|
|
+ file.set_zero_special(true);
|
|
|
|
|
+ }
|
|
|
vizzer.set_vis_inverse(_got_vis_inverse);
|
|
vizzer.set_vis_inverse(_got_vis_inverse);
|
|
|
vizzer.set_vis_2d(_got_vis_2d);
|
|
vizzer.set_vis_2d(_got_vis_2d);
|
|
|
|
|
|
|
@@ -238,6 +253,24 @@ process_pfm(const Filename &input_filename, PfmFile &file) {
|
|
|
mesh.reparent_to(_mesh_root);
|
|
mesh.reparent_to(_mesh_root);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (_got_ls_filename) {
|
|
|
|
|
+ pofstream out;
|
|
|
|
|
+ _ls_filename.set_text();
|
|
|
|
|
+ if (_ls_filename.open_write(out, true)) {
|
|
|
|
|
+ for (int yi = 0; yi < file.get_y_size(); ++yi) {
|
|
|
|
|
+ for (int xi = 0; xi < file.get_x_size(); ++xi) {
|
|
|
|
|
+ if (file.has_point(xi, yi)) {
|
|
|
|
|
+ out << "(" << xi << ", " << yi << "):";
|
|
|
|
|
+ for (int ci = 0; ci < file.get_num_channels(); ++ci) {
|
|
|
|
|
+ out << " " << file.get_channel(xi, yi, ci);
|
|
|
|
|
+ }
|
|
|
|
|
+ out << "\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
Filename output_filename;
|
|
Filename output_filename;
|
|
|
if (_got_output_filename) {
|
|
if (_got_output_filename) {
|
|
|
output_filename = _output_filename;
|
|
output_filename = _output_filename;
|