diff options
author | don bright <hugh.m.bright@gmail.com> | 2013-03-03 19:12:37 (GMT) |
---|---|---|
committer | don bright <hugh.m.bright@gmail.com> | 2013-03-03 19:12:37 (GMT) |
commit | 3f345b936192d02b821b6d297ce60203f116ad4d (patch) | |
tree | f378e48c597a5d3382ae68048c4a537e912a7b4e /src/CsgInfo.h | |
parent | 03de7fce81270e10af88ed0488f12d549a3a4f15 (diff) |
begin to make offscreen opencsg compile look like the one in mainwin.cc
Diffstat (limited to 'src/CsgInfo.h')
-rw-r--r-- | src/CsgInfo.h | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/CsgInfo.h b/src/CsgInfo.h index 816071f..b6dac60 100644 --- a/src/CsgInfo.h +++ b/src/CsgInfo.h @@ -18,6 +18,8 @@ public: highlights_chain = NULL; background_chain = NULL; glview = NULL; + progress_function = NULL; + normalizelimit = RenderSettings::inst()->openCSGTermLimit; } OffscreenView *glview; shared_ptr<CSGTerm> root_norm_term; // Normalized CSG products @@ -27,6 +29,18 @@ public: std::vector<shared_ptr<CSGTerm> > background_terms; CSGChain *background_chain; + int normalizelimit; + + void (*progress_function)(void); + void set_progress_function( void (*funcname)(void) ) + { + progress_function = funcname; + } + void call_progress_function() + { + if (progress_function) progress_function(); + } + bool prep_chains( const Tree &tree ) { const AbstractNode *root_node = tree.root(); @@ -36,11 +50,13 @@ public: if (!root_raw_term) { fprintf(stderr, "Error: CSG generation failed! (no top level object found)\n"); + call_progress_function(); return false; } - // CSG normalization - CSGTermNormalizer normalizer( RenderSettings::inst()->openCSGTermLimit ); + PRINT("Compiling design (CSG Products normalization)..."); + call_progress_function(); + CSGTermNormalizer normalizer( normalizelimit ); this->root_norm_term = normalizer.normalize(root_raw_term); if (this->root_norm_term) { this->root_chain = new CSGChain(); @@ -50,11 +66,12 @@ public: else { this->root_chain = NULL; fprintf(stderr, "WARNING: CSG normalization resulted in an empty tree\n"); + call_progress_function(); } if (this->highlight_terms.size() > 0) { std::cerr << "Compiling highlights (" << this->highlight_terms.size() << " CSG Trees)...\n"; - + call_progress_function(); this->highlights_chain = new CSGChain(); for (unsigned int i = 0; i < this->highlight_terms.size(); i++) { this->highlight_terms[i] = normalizer.normalize(this->highlight_terms[i]); @@ -63,8 +80,8 @@ public: } if (this->background_terms.size() > 0) { - std::cerr << "Compiling background (" << this->background_terms.size() << " CSG Trees)...\n"; - + std::cerr << "Compiling background (%d CSG Trees)..." << this->background_terms.size() << " CSG Trees)...\n"; + call_progress_function(); this->background_chain = new CSGChain(); for (unsigned int i = 0; i < this->background_terms.size(); i++) { this->background_terms[i] = normalizer.normalize(this->background_terms[i]); |