Revert incorrect checkins.

This commit is contained in:
bubnikv 2016-04-11 17:34:15 +02:00
parent ed83ff37f8
commit 3ba625da22
10 changed files with 22 additions and 122 deletions

View File

@ -9,9 +9,6 @@ use Slic3r::Geometry qw(X Y PI scale chained_path deg2rad);
use Slic3r::Geometry::Clipper qw(union union_ex diff diff_ex intersection_ex offset offset2);
use Slic3r::Surface ':types';
use Data::Dumper qw(Dumper);
has 'bounding_box' => (is => 'ro', required => 0);
has 'fillers' => (is => 'rw', default => sub { {} });
@ -227,10 +224,8 @@ sub make_fill {
density => $density/100,
layer_height => $h,
), @{ $surface->offset(-scale($f->spacing)/2) };
next unless @polylines;
print "Polylines after fill_surface: ", Dumper(\@polylines);
# calculate actual flow from spacing (which might have been adjusted by the infill
# pattern generator)
@ -256,7 +251,6 @@ sub make_fill {
push @fills, my $collection = Slic3r::ExtrusionPath::Collection->new;
$collection->no_sort($f->no_sort);
print "collecton->append\n";
$collection->append(
map Slic3r::ExtrusionPath->new(
polyline => $_,

View File

@ -124,7 +124,6 @@ sub mouse_event {
if ($e->Entering && &Wx::wxMSW) {
# wxMSW needs focus in order to catch mouse wheel events
$self->SetFocus;
print "Slic3r::GUI::3DScene::Base; SetFocus\n";
} elsif ($e->LeftDClick) {
$self->on_double_click->()
if $self->on_double_click;

View File

@ -182,7 +182,6 @@ sub new {
EVT_LIST_ITEM_ACTIVATED($self, $self->{list}, \&list_item_activated);
EVT_KEY_DOWN($self->{list}, sub {
my ($list, $event) = @_;
print "Plater.pm: Getting key $event\n";
if ($event->GetKeyCode == WXK_TAB) {
$list->Navigate($event->ShiftDown ? &Wx::wxNavigateBackward : &Wx::wxNavigateForward);
} else {

View File

@ -5,9 +5,6 @@ package Slic3r::GUI::Plater::2DToolpaths;
use strict;
use warnings;
use utf8;
use Data::Dumper qw(Dumper);
#use Carp qw(confess);
use Carp;
use Slic3r::Print::State ':steps';
use Wx qw(:misc :sizer :slider :statictext :keycode wxWHITE wxWANTS_CHARS);
@ -54,10 +51,6 @@ sub new {
});
EVT_KEY_DOWN($canvas, sub {
my ($s, $event) = @_;
print "Slic3r::GUI::Plater::2DToolpaths: Getting key ", $event->GetKeyCode, "\n";
# print Dumper(\$event);
my $key = $event->GetKeyCode;
if ($key == 85 || $key == WXK_LEFT) {
# Keys: 'D' or WXK_LEFT
@ -130,10 +123,8 @@ sub set_z {
package Slic3r::GUI::Plater::2DToolpaths::Canvas;
use Wx qw(:misc wxWANTS_CHARS);
use Wx::Event qw(EVT_PAINT EVT_SIZE EVT_IDLE EVT_MOUSEWHEEL EVT_MOUSE_EVENTS EVT_KEY_DOWN);
use Wx::Event qw(EVT_PAINT EVT_SIZE EVT_IDLE EVT_MOUSEWHEEL EVT_MOUSE_EVENTS);
use OpenGL qw(:glconstants :glfunctions :glufunctions :gluconstants);
use OpenGL::Shader;
use base qw(Wx::GLCanvas Class::Accessor);
use Wx::GLCanvas qw(:all);
use List::Util qw(min max first);
@ -163,20 +154,17 @@ __PACKAGE__->mk_accessors(qw(
sub new {
my ($class, $parent, $print) = @_;
my $self = $class->SUPER::new($parent, -1, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);
my $self = $class->SUPER::new($parent);
$self->print($print);
$self->_zoom(1);
# 2D point in model space
$self->_camera_target(Slic3r::Pointf->new(0,0));
# Texture for the extrusion simulator. The texture will be allocated / reallocated on Resize.
# print "new\n";
$self->_texture_name(0);
$self->_texture_size(Slic3r::Point->new(0,0));
$self->_extrusion_simulator(Slic3r::ExtrusionSimulator->new());
$self->_simulation_mode(0);
# print "new end\n";
EVT_PAINT($self, sub {
my $dc = Wx::PaintDC->new($self);
@ -228,17 +216,6 @@ sub new {
$self->Refresh;
});
EVT_MOUSE_EVENTS($self, \&mouse_event);
EVT_KEY_DOWN($self, sub {
my ($s, $event) = @_;
print "Slic3r::GUI::Plater::2DToolpaths::Canvas: Getting key $event\n";
my $key = $event->GetKeyCode;
if ($key > 45 && $key <= 50) {
# Keys: '1' to '3'
$self->set_simulation_mode($key - 45);
}
});
return $self;
}
@ -267,7 +244,6 @@ sub mouse_event {
if ($e->Entering && &Wx::wxMSW) {
# wxMSW needs focus in order to catch mouse wheel events
$self->SetFocus;
print "Slic3r::GUI::Plater::2DToolpaths::Canvas SetFocus\n";
} elsif ($e->Dragging) {
if ($e->LeftIsDown || $e->MiddleIsDown || $e->RightIsDown) {
# if dragging, translate view
@ -344,14 +320,6 @@ sub Render {
$self->SetCurrent($context);
$self->InitGL;
#print glGetString(GL_VERSION), "\n";
#print glGetString(GL_VENDOR), "\n";
#print glGetString(GL_RENDERER), "\n";
# my $nExtensions = glGetInteger(GL_NUM_EXTENSIONS);
# for (my $i = 0; $i < $nExtensions; ++ $i) {
# print glGetStringi(GL_EXTENSIONS, $i);
# }
glClearColor(1, 1, 1, 0);
glClear(GL_COLOR_BUFFER_BIT);
@ -366,12 +334,10 @@ sub Render {
glLoadIdentity();
if ($self->_simulation_mode and $self->_texture_name and $self->_texture_size->x() > 0 and $self->_texture_size->y() > 0) {
#print "draw\n";
$self->_simulate_extrusion();
my ($x, $y) = $self->GetSizeWH;
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,GL_REPLACE);
#print "Texture name ", $self->_texture_name, "\n";
glBindTexture(GL_TEXTURE_2D, $self->_texture_name);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
@ -401,7 +367,6 @@ sub Render {
glEnd();
glPopMatrix();
glBindTexture(GL_TEXTURE_2D, 0);
#print "draw end\n";
}
# anti-alias
@ -440,7 +405,7 @@ sub Render {
glTranslatef(@$copy, 0);
foreach my $slice (@{$layer->slices}) {
glColor3f(0.75, 0.75, 0.75);
glColor3f(0.95, 0.95, 0.95);
if ($tess) {
gluTessBeginPolygon($tess);
@ -540,66 +505,43 @@ sub _draw_path {
glPushMatrix();
glTranslatef(@$copy, 0);
foreach my $line (@{$path->polyline->lines}) {
if (1) {
glBegin(GL_LINES);
glVertex2f(@{$line->a});
glVertex2f(@{$line->b});
glEnd();
} else {
my @c = $self->color;
$self->line($line->a->x, $line->a->y, $line->b->x, $line->b->y, $path->width, $c[0], $c[1], $c[2], 0.5, 0, 0, 1);
}
glBegin(GL_LINES);
glVertex2f(@{$line->a});
glVertex2f(@{$line->b});
glEnd();
}
glPopMatrix();
}
} else {
foreach my $line (@{$path->polyline->lines}) {
if (1) {
glBegin(GL_LINES);
glVertex2f(@{$line->a});
glVertex2f(@{$line->b});
glEnd();
} else {
my @c = $self->color;
$self->line($line->a->x, $line->a->y, $line->b->x, $line->b->y, $path->width, $c[0], $c[1], $c[2], 0.5, 0, 0, 1);
}
}
}
glBegin(GL_LINES);
glVertex2f(@{$line->a});
glVertex2f(@{$line->b});
glEnd();
}
}
}
sub _simulate_extrusion {
#print "_simulate_extrusion";
my ($self) = @_;
$self->_extrusion_simulator->reset_accumulator();
foreach my $layer (@{$self->layers}) {
if (abs($layer->print_z - $self->z) < epsilon) {
#print "_simulate_extrusion - print_z ", $layer->print_z, "\n";
my $object = $layer->object;
# print Dumper($object);
my @shifts = (defined $object) ? @{$object->_shifted_copies} : (Slic3r::Point->new(0, 0));
foreach my $layerm (@{$layer->regions}) {
# print Dumper($layerm);
my @extrusions = ();
if ($object->step_done(STEP_PERIMETERS)) {
#print "Perimeters: ", @{$layerm->perimeters}, "\n";
# print Dumper(\@{$layerm->perimeters});
push @extrusions, @$_ for @{$layerm->perimeters};
}
if ($object->step_done(STEP_INFILL)) {
#print "Fills: ", @{$layerm->fills}, "\n";
# print Dumper(\@{$layerm->fills});
push @extrusions, @$_ for @{$layerm->fills};
}
# print Dumper(\@extrusions);
foreach my $extrusion_entity (@extrusions) {
#print "simulating an extrusion entity\n";
my @paths = $extrusion_entity->isa('Slic3r::ExtrusionLoop')
? @$extrusion_entity
: ($extrusion_entity);
foreach my $path (@paths) {
#print "simulating a path\n";
#print Data::Dumper->Dump([$path, @paths], [qw(foo *ary)]);
# print Data::Dumper(\$path);
print "width: ", $path->width,
" height: ", $path->height,
" mm3_per_mm: ", $path->mm3_per_mm,
@ -620,13 +562,9 @@ sub InitGL {
return if $self->init;
return unless $self->GetContext;
#Vojtech: Create an OpenGL texture?
#print "initgl\n";
my $texture_id = 0;
($texture_id) = glGenTextures_p(1);
$self->_texture_name($texture_id);
#print "initgl end\n";
$self->init(1);
}
@ -660,7 +598,6 @@ sub Resize {
$self->SetCurrent($self->GetContext);
my ($x, $y) = $self->GetSizeWH;
#print "resize\n";
if ($self->_texture_size->x() < $x or $self->_texture_size->y() < $y) {
# Allocate a large enough OpenGL texture with power of 2 dimensions.
$self->_texture_size->set_x(1) if ($self->_texture_size->x() == 0);
@ -682,17 +619,13 @@ sub Resize {
0); # ptr to texture data
}
glBindTexture(GL_TEXTURE_2D, 0);
#print "resize - setimagesize\n";
$self->_extrusion_simulator->set_image_size($self->_texture_size);
}
$self->_extrusion_simulator->set_viewport(Slic3r::Geometry::BoundingBox->new_from_points(
[Slic3r::Point->new(0, 0), Slic3r::Point->new($x, $y)]));
#print "resize end\n";
glViewport(0, 0, $x, $y);
Slic3r::Point->new(0,0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@ -768,8 +701,6 @@ sub line {
$alphablend, # use alpha blend or not
) = @_;
#die 'Inside 2DToolpaths::line(). This was not expected to be called.';
my $t;
my $R;
my $f = $w - int($w);
@ -937,8 +868,6 @@ sub line {
}
# What is the purpose of this dialog? Testing? A stand-alone application?
# Currently this dialog is not instantiated.
package Slic3r::GUI::Plater::2DToolpaths::Dialog;
use Wx qw(:dialog :id :misc :sizer);

View File

@ -51,8 +51,6 @@ sub new {
EVT_KEY_DOWN($canvas, sub {
my ($s, $event) = @_;
print "3DPreview.pm: Getting key $event\n";
my $key = $event->GetKeyCode;
if ($key == 85 || $key == 315) {
$slider->SetValue($slider->GetValue + 1);

View File

@ -77,7 +77,6 @@ sub new {
});
EVT_KEY_DOWN($self->{treectrl}, sub {
my ($treectrl, $event) = @_;
print "Tab.pm: Getting key $event\n";
if ($event->GetKeyCode == WXK_TAB) {
$treectrl->Navigate($event->ShiftDown ? &Wx::wxNavigateBackward : &Wx::wxNavigateForward);
} else {

View File

@ -13,17 +13,10 @@ use Getopt::Long qw(:config no_auto_abbrev);
use List::Util qw(first);
use POSIX qw(setlocale LC_NUMERIC);
use Slic3r;
use Slic3r::GUI;
use Time::HiRes qw(gettimeofday tv_interval);
#use Slic3r::XS;
#use Data::Dumper;
$|++;
binmode STDOUT, ':utf8';
# my $extrusionsim = Slic3r::ExtrusionSimulator->new(width=>0, height=>0, nozzle_diameter=>0);
#print Dumper($extrusionsim);
#print Dumper($extrusionsim->image_ptr);
our %opt = ();
my %cli_options = ();
{

View File

@ -89,9 +89,6 @@ path through the BOOST_DIR environment variable:
EOF
# Enable C++ 0x features of the language.
#push @cflags, qw(-std=c++0x);
if ($ENV{SLIC3R_DEBUG}) {
# only on newer GCCs: -ftemplate-backtrace-limit=0
push @cflags, qw(-DSLIC3R_DEBUG -g);

View File

@ -13,6 +13,7 @@
#include <assert.h>
#ifdef SLIC3R_DEBUG
#define SLIC3R_TRIANGLEMESH_DEBUG
#include "SVG.hpp"
#endif
@ -445,8 +446,7 @@ TriangleMeshSlicer::slice(const std::vector<float> &z, std::vector<Polygons>* la
float min_z = fminf(facet->vertex[0].z, fminf(facet->vertex[1].z, facet->vertex[2].z));
float max_z = fmaxf(facet->vertex[0].z, fmaxf(facet->vertex[1].z, facet->vertex[2].z));
#if 0
// #ifdef SLIC3R_DEBUG
#ifdef SLIC3R_TRIANGLEMESH_DEBUG
printf("\n==> FACET %d (%f,%f,%f - %f,%f,%f - %f,%f,%f):\n", facet_idx,
facet->vertex[0].x, facet->vertex[0].y, facet->vertex[0].z,
facet->vertex[1].x, facet->vertex[1].y, facet->vertex[1].z,
@ -458,8 +458,7 @@ TriangleMeshSlicer::slice(const std::vector<float> &z, std::vector<Polygons>* la
std::vector<float>::const_iterator min_layer, max_layer;
min_layer = std::lower_bound(z.begin(), z.end(), min_z); // first layer whose slice_z is >= min_z
max_layer = std::upper_bound(z.begin() + (min_layer - z.begin()), z.end(), max_z) - 1; // last layer whose slice_z is <= max_z
#if 0
// #ifdef SLIC3R_DEBUG
#ifdef SLIC3R_TRIANGLEMESH_DEBUG
printf("layers: min = %d, max = %d\n", (int)(min_layer - z.begin()), (int)(max_layer - z.begin()));
#endif
@ -475,8 +474,7 @@ TriangleMeshSlicer::slice(const std::vector<float> &z, std::vector<Polygons>* la
layers->resize(z.size());
for (std::vector<IntersectionLines>::iterator it = lines.begin(); it != lines.end(); ++it) {
size_t layer_idx = it - lines.begin();
#if 0
// #ifdef SLIC3R_DEBUG
#ifdef SLIC3R_TRIANGLEMESH_DEBUG
printf("Layer %zu:\n", layer_idx);
#endif
this->make_loops(*it, &(*layers)[layer_idx]);
@ -491,8 +489,7 @@ TriangleMeshSlicer::slice(const std::vector<float> &z, std::vector<ExPolygons>*
layers->resize(z.size());
for (std::vector<Polygons>::const_iterator loops = layers_p.begin(); loops != layers_p.end(); ++loops) {
#if 0
// #ifdef SLIC3R_DEBUG
#ifdef SLIC3R_TRIANGLEMESH_DEBUG
size_t layer_id = loops - layers_p.begin();
printf("Layer %zu (slice_z = %.2f):\n", layer_id, z[layer_id]);
#endif
@ -716,8 +713,7 @@ TriangleMeshSlicer::make_loops(std::vector<IntersectionLine> &lines, Polygons* l
}
loops->push_back(p);
#if 0
// #ifdef SLIC3R_DEBUG
#ifdef SLIC3R_TRIANGLEMESH_DEBUG
printf(" Discovered %s polygon of %d points\n", (p.is_counter_clockwise() ? "ccw" : "cw"), (int)p.points.size());
#endif
@ -726,7 +722,7 @@ TriangleMeshSlicer::make_loops(std::vector<IntersectionLine> &lines, Polygons* l
// we can't close this loop!
//// push @failed_loops, [@loop];
//#ifdef SLIC3R_DEBUG
//#ifdef SLIC3R_TRIANGLEMESH_DEBUG
printf(" Unable to close this loop having %d points\n", (int)loop.size());
//#endif
goto CYCLE;
@ -838,8 +834,7 @@ TriangleMeshSlicer::make_expolygons(const Polygons &loops, ExPolygons* slices)
ExPolygons ex_slices;
offset2(p_slices, &ex_slices, +safety_offset, -safety_offset);
#if 0
// #ifdef SLIC3R_DEBUG
#ifdef SLIC3R_TRIANGLEMESH_DEBUG
size_t holes_count = 0;
for (ExPolygons::const_iterator e = ex_slices.begin(); e != ex_slices.end(); ++e) {
holes_count += e->holes.size();
@ -1058,8 +1053,7 @@ TriangleMeshSlicer::TriangleMeshSlicer(TriangleMesh* _mesh) : mesh(_mesh), v_sca
}
this->facets_edges[facet_idx][i] = edge_idx;
#if 0
// #ifdef SLIC3R_DEBUG
#ifdef SLIC3R_TRIANGLEMESH_DEBUG
printf(" [facet %d, edge %d] a_id = %d, b_id = %d --> edge %d\n", facet_idx, i, a_id, b_id, edge_idx);
#endif
}

View File

@ -1,6 +1,5 @@
#ifdef SLIC3RXS
#include <xsinit.h>
#include <assert.h>
namespace Slic3r {
@ -394,7 +393,6 @@ void from_SV(SV* poly_sv, MultiPoint* THIS)
void from_SV_check(SV* poly_sv, MultiPoint* THIS)
{
if (sv_isobject(poly_sv) && (SvTYPE(SvRV(poly_sv)) == SVt_PVMG)) {
// (MultiPoint*)SvIV((SV*)SvRV( poly_sv ))
*THIS = *(MultiPoint*)SvIV((SV*)SvRV( poly_sv ));
} else {
from_SV(poly_sv, THIS);