diff --git a/pandatool/src/gtk-stats/gtkStats.cxx b/pandatool/src/gtk-stats/gtkStats.cxx index 45c286fa59..8913d8caf4 100644 --- a/pandatool/src/gtk-stats/gtkStats.cxx +++ b/pandatool/src/gtk-stats/gtkStats.cxx @@ -13,14 +13,6 @@ GtkStatsMainWindow *GtkStats::_main_window = NULL; -static bool user_interrupted = false; - -// This simple signal handler lets us know when the user has pressed -// control-C, so we can clean up nicely. -static void signal_handler(int) { - user_interrupted = true; -} - //////////////////////////////////////////////////////////////////// // Function: GtkStats::Constructor // Access: Public diff --git a/pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx b/pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx index 976c1785b2..dade009c40 100644 --- a/pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx +++ b/pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx @@ -253,7 +253,7 @@ pack_labels() { int num_labels = get_num_labels(); - while (_y_positions.size() < num_labels) { + while ((int)_y_positions.size() < num_labels) { _y_positions.push_back(0); } diff --git a/pandatool/src/pstatserver/pStatClientData.cxx b/pandatool/src/pstatserver/pStatClientData.cxx index e3bdf92855..d8790c1407 100644 --- a/pandatool/src/pstatserver/pStatClientData.cxx +++ b/pandatool/src/pstatserver/pStatClientData.cxx @@ -232,7 +232,7 @@ add_collector(PStatCollectorDef *def) { nassertv(def->_index < 1000); // Make sure we have enough slots allocated. - while (_collectors.size() <= def->_index) { + while ((int)_collectors.size() <= def->_index) { _collectors.push_back(NULL); } @@ -257,7 +257,7 @@ define_thread(int thread_index, const string &name) { nassertv(thread_index < 1000); // Make sure we have enough slots allocated. - while (_threads.size() <= thread_index) { + while ((int)_threads.size() <= thread_index) { _threads.push_back(Thread()); } diff --git a/pandatool/src/pstatserver/pStatGraph.I b/pandatool/src/pstatserver/pStatGraph.I index 2f3b45499a..70290aed1b 100644 --- a/pandatool/src/pstatserver/pStatGraph.I +++ b/pandatool/src/pstatserver/pStatGraph.I @@ -33,7 +33,7 @@ get_num_labels() const { //////////////////////////////////////////////////////////////////// INLINE int PStatGraph:: get_label_collector(int n) const { - nassertr(n >= 0 && n < _labels.size(), 0); + nassertr(n >= 0 && n < (int)_labels.size(), 0); return _labels[n]; } @@ -44,7 +44,7 @@ get_label_collector(int n) const { //////////////////////////////////////////////////////////////////// INLINE string PStatGraph:: get_label_name(int n) const { - nassertr(n >= 0 && n < _labels.size(), string()); + nassertr(n >= 0 && n < (int)_labels.size(), string()); return _monitor->get_client_data()->get_collector_name(_labels[n]); } @@ -55,7 +55,7 @@ get_label_name(int n) const { //////////////////////////////////////////////////////////////////// INLINE RGBColorf PStatGraph:: get_label_color(int n) const { - nassertr(n >= 0 && n < _labels.size(), RGBColorf(0.0, 0.0, 0.0)); + nassertr(n >= 0 && n < (int)_labels.size(), RGBColorf(0.0, 0.0, 0.0)); return _monitor->get_collector_color(_labels[n]); } diff --git a/pandatool/src/pstatserver/pStatGraph.cxx b/pandatool/src/pstatserver/pStatGraph.cxx index d69ff62e20..aeb337fb6d 100644 --- a/pandatool/src/pstatserver/pStatGraph.cxx +++ b/pandatool/src/pstatserver/pStatGraph.cxx @@ -92,7 +92,7 @@ const PStatGraph::GuideBar &PStatGraph:: get_guide_bar(int n) const { #ifndef NDEBUG static GuideBar bogus_bar(0.0, "bogus", false); - nassertr(n >= 0 && n < _guide_bars.size(), bogus_bar); + nassertr(n >= 0 && n < (int)_guide_bars.size(), bogus_bar); #endif return _guide_bars[n]; } diff --git a/pandatool/src/pstatserver/pStatThreadData.cxx b/pandatool/src/pstatserver/pStatThreadData.cxx index 6b63b4ed9c..5daeeda0ab 100644 --- a/pandatool/src/pstatserver/pStatThreadData.cxx +++ b/pandatool/src/pstatserver/pStatThreadData.cxx @@ -81,7 +81,7 @@ bool PStatThreadData:: has_frame(int frame_number) const { int rel_frame = frame_number - _first_frame_number; - return (rel_frame >= 0 && rel_frame < _frames.size() && + return (rel_frame >= 0 && rel_frame < (int)_frames.size() && _frames[rel_frame] != (PStatFrameData *)NULL); } @@ -96,7 +96,7 @@ has_frame(int frame_number) const { const PStatFrameData &PStatThreadData:: get_frame(int frame_number) const { int rel_frame = frame_number - _first_frame_number; - if (rel_frame >= _frames.size()) { + if (rel_frame >= (int)_frames.size()) { rel_frame = _frames.size() - 1; } @@ -108,11 +108,11 @@ get_frame(int frame_number) const { } else { // No frame data that old. Return the oldest frame we've got. rel_frame = 0; - while (rel_frame < _frames.size() && + while (rel_frame < (int)_frames.size() && _frames[rel_frame] == (PStatFrameData *)NULL) { rel_frame++; } - return (rel_frame < _frames.size()) ? *_frames[rel_frame] : _null_frame; + return (rel_frame < (int)_frames.size()) ? *_frames[rel_frame] : _null_frame; } } @@ -164,12 +164,12 @@ get_frame_at_time(double time) const { int PStatThreadData:: get_frame_number_at_time(double time, int hint) const { hint -= _first_frame_number; - if (hint >= 0 && hint < _frames.size()) { + if (hint >= 0 && hint < (int)_frames.size()) { if (_frames[hint] != (PStatFrameData *)NULL && _frames[hint]->get_start() <= time) { // The hint might be right. Scan forward from there. int i = hint + 1; - while (i < _frames.size() && + while (i < (int)_frames.size() && (_frames[i] == (PStatFrameData *)NULL || _frames[i]->get_start() <= time)) { if (_frames[i] != (PStatFrameData *)NULL) { @@ -309,13 +309,13 @@ record_new_frame(int frame_number, PStatFrameData *frame_data) { _frames.push_back(NULL); } else { - while (_first_frame_number + _frames.size() <= frame_number) { + while (_first_frame_number + (int)_frames.size() <= frame_number) { _frames.push_back(NULL); } } int index = frame_number - _first_frame_number; - nassertv(index >= 0 && index < _frames.size()); + nassertv(index >= 0 && index < (int)_frames.size()); if (_frames[index] != (PStatFrameData *)NULL) { nout << "Got repeated frame data for frame " << frame_number << "\n"; diff --git a/pandatool/src/stitch/stitchImageProgram.cxx b/pandatool/src/stitch/stitchImageProgram.cxx index da3830cf8b..cc8ad7c576 100644 --- a/pandatool/src/stitch/stitchImageProgram.cxx +++ b/pandatool/src/stitch/stitchImageProgram.cxx @@ -20,6 +20,11 @@ StitchImageProgram() { "The images are generated internally using a CPU-based rasterization " "algorithm (no graphics hardware is used)."); + + add_option + ("f", "", 0, + "Apply a very simple filter in an attempt to smooth the results.", + &StitchImageProgram::dispatch_none, &_filter_output); } //////////////////////////////////////////////////////////////////// @@ -30,6 +35,7 @@ StitchImageProgram() { void StitchImageProgram:: run() { StitchImageRasterizer outputter; + outputter._filter_output = _filter_output; _command_file.process(outputter); } diff --git a/pandatool/src/stitch/stitchImageProgram.h b/pandatool/src/stitch/stitchImageProgram.h index f6cf853764..7bf0709e38 100644 --- a/pandatool/src/stitch/stitchImageProgram.h +++ b/pandatool/src/stitch/stitchImageProgram.h @@ -21,6 +21,9 @@ public: StitchImageProgram(); void run(); + +private: + bool _filter_output; }; #endif diff --git a/pandatool/src/stitchbase/morphGrid.cxx b/pandatool/src/stitchbase/morphGrid.cxx index b0219c9889..3885ffb318 100644 --- a/pandatool/src/stitchbase/morphGrid.cxx +++ b/pandatool/src/stitchbase/morphGrid.cxx @@ -228,7 +228,7 @@ init(int x_verts, int y_verts) { &_table[y][x + 1])); } } - assert(_triangles.size() == num_tris); + assert((int)_triangles.size() == num_tris); // Now create a 2-d table of TriangleTree nodes, each of which // points to a pair of triangles. We'll use this to build up the diff --git a/pandatool/src/stitchbase/stitchCommand.cxx b/pandatool/src/stitchbase/stitchCommand.cxx index 6b2666ea84..11a2fa60c5 100644 --- a/pandatool/src/stitchbase/stitchCommand.cxx +++ b/pandatool/src/stitchbase/stitchCommand.cxx @@ -475,6 +475,9 @@ make_lens() { case C_singularity_tolerance: _lens->set_singularity_tolerance((*ci)->get_number()); break; + + default: + break; } } @@ -616,6 +619,9 @@ create_image() { case C_grid: image->setup_grid((int)(*ci)->_n[0], (int)(*ci)->_n[1]); break; + + default: + break; } } diff --git a/pandatool/src/stitchbase/stitchImage.cxx b/pandatool/src/stitchbase/stitchImage.cxx index 543e7353ad..b0b913f62f 100644 --- a/pandatool/src/stitchbase/stitchImage.cxx +++ b/pandatool/src/stitchbase/stitchImage.cxx @@ -14,13 +14,13 @@ StitchImage:: StitchImage(const string &name, const string &filename, StitchLens *lens, const LVecBase2d &size_pixels, const LVecBase2d &pixels_per_mm) : - _filename(filename), - _name(name), _lens(lens), _size_pixels(size_pixels), _pixels_per_mm(pixels_per_mm), _rotate(LMatrix3d::ident_mat()), - _inv_rotate(LMatrix3d::ident_mat()) + _inv_rotate(LMatrix3d::ident_mat()), + _filename(filename), + _name(name) { _size_mm.set((_size_pixels[0] - 1.0) / _pixels_per_mm[0], (_size_pixels[1] - 1.0) / _pixels_per_mm[1]); diff --git a/pandatool/src/stitchbase/stitchImageRasterizer.cxx b/pandatool/src/stitchbase/stitchImageRasterizer.cxx index 18c8c06969..7d5d11410a 100644 --- a/pandatool/src/stitchbase/stitchImageRasterizer.cxx +++ b/pandatool/src/stitchbase/stitchImageRasterizer.cxx @@ -12,7 +12,6 @@ StitchImageRasterizer:: StitchImageRasterizer() { - //_filter_output = false; _filter_output = true; } diff --git a/pandatool/src/stitchbase/stitcher.cxx b/pandatool/src/stitchbase/stitcher.cxx index ad76800ac6..88cbbf71e8 100644 --- a/pandatool/src/stitchbase/stitcher.cxx +++ b/pandatool/src/stitchbase/stitcher.cxx @@ -258,8 +258,8 @@ stitch_image(StitchImage *image) { best_i = 0; best_j = 0; } else { - for (int i = 0; i < mp.size(); i++) { - for (int j = 0; j < mp.size(); j++) { + for (int i = 0; i < (int)mp.size(); i++) { + for (int j = 0; j < (int)mp.size(); j++) { if (j != i) { LMatrix3d rot; double score = try_match(image, rot, mp, i, j); diff --git a/pandatool/src/stitchbase/triangleRasterizer.cxx b/pandatool/src/stitchbase/triangleRasterizer.cxx index 7cc7b0dd99..69a982843c 100644 --- a/pandatool/src/stitchbase/triangleRasterizer.cxx +++ b/pandatool/src/stitchbase/triangleRasterizer.cxx @@ -517,7 +517,6 @@ filter_pixel(RGBColord &rgb, double &alpha, int si = (int)(s + 0.5); int ti = _texture->get_y_size() - 1 - (int)(t + 0.5); - int n = 0; rgb.set(0.0, 0.0, 0.0); alpha = 0.0; @@ -530,6 +529,8 @@ filter_pixel(RGBColord &rgb, double &alpha, return; } + int num_total = 0; + int num_visible = 0; for (int yr = -ri; yr <= ri; yr++) { int tii = ti + yr; for (int xr = -ri; xr <= ri; xr++) { @@ -537,21 +538,22 @@ filter_pixel(RGBColord &rgb, double &alpha, if (sii >= 0 && sii < _texture->get_x_size() && tii >= 0 && tii < _texture->get_y_size()) { rgb += _texture->get_xel(sii, tii); - alpha += 1.0; + num_visible++; } - n++; + num_total++; } } - if (alpha != 0.0) { - rgb /= alpha; + if (num_visible != 0) { + rgb /= (double)num_visible; + alpha = 1.0; } // We would do this to antialias the edge of the image. However, it // seems to cause problems at seams, so we won't do it. /* - if (n != 0) { - alpha = alpha / (double)n; + if (num_total != 0) { + alpha = (double)num_visible / (double)num_total; } */ } diff --git a/pandatool/src/stitchviewer/stitchImageVisualizer.cxx b/pandatool/src/stitchviewer/stitchImageVisualizer.cxx index c1febb44c5..d126406d54 100644 --- a/pandatool/src/stitchviewer/stitchImageVisualizer.cxx +++ b/pandatool/src/stitchviewer/stitchImageVisualizer.cxx @@ -280,7 +280,7 @@ handle_event(CPT(Event) event) { if (name.size() == 1 && isalpha(name[0])) { int index = tolower(name[0]) - 'a'; - if (index >= 0 && index < _images.size()) { + if (index >= 0 && index < (int)_images.size()) { toggle_viz(_images[index]); return; } diff --git a/pandatool/src/stitchviewer/triangleMesh.cxx b/pandatool/src/stitchviewer/triangleMesh.cxx index 373822f9d6..1abf07a673 100644 --- a/pandatool/src/stitchviewer/triangleMesh.cxx +++ b/pandatool/src/stitchviewer/triangleMesh.cxx @@ -9,9 +9,9 @@ TriangleMesh:: TriangleMesh(int x_verts, int y_verts) : + _coords(0), _norms(0), _colors(0), _texcoords(0), _x_verts(x_verts), - _y_verts(y_verts), - _coords(0), _norms(0), _colors(0), _texcoords(0) + _y_verts(y_verts) { } @@ -32,7 +32,7 @@ get_num_verts() const { GeomTristrip *TriangleMesh:: build_mesh() const { - int num_verts = _x_verts * _y_verts; + // int num_verts = _x_verts * _y_verts; int num_tstrips = (_y_verts-1); int tstrip_length = 2*(_x_verts-1)+2;