mirror of https://github.com/vitalif/openscad
Allow preview of designs with only background or highlight objects. Fixes #1005
parent
a3a6b66061
commit
90f58ced7d
|
@ -43,8 +43,8 @@ public:
|
|||
CSGTermEvaluator evaluator(tree, &geomevaluator);
|
||||
boost::shared_ptr<CSGTerm> root_raw_term = evaluator.evaluateCSGTerm( *root_node, this->highlight_terms, this->background_terms );
|
||||
|
||||
if (!root_raw_term) {
|
||||
PRINT("Error: CSG generation failed! (no top level object found)");
|
||||
if (!root_raw_term && this->background_terms.empty()) {
|
||||
PRINT("Error: CSG generation failed! (no objects found)");
|
||||
call_progress_function();
|
||||
return false;
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ public:
|
|||
PRINT("Compiling design (CSG Products normalization)...");
|
||||
call_progress_function();
|
||||
CSGTermNormalizer normalizer( normalizelimit );
|
||||
if (root_raw_term) {
|
||||
this->root_norm_term = normalizer.normalize(root_raw_term);
|
||||
if (this->root_norm_term) {
|
||||
this->root_chain = new CSGChain();
|
||||
|
@ -63,6 +64,7 @@ public:
|
|||
PRINT("WARNING: CSG normalization resulted in an empty tree");
|
||||
call_progress_function();
|
||||
}
|
||||
}
|
||||
|
||||
if (this->highlight_terms.size() > 0) {
|
||||
PRINTB("Compiling highlights (%i CSG Trees)...", this->highlight_terms.size() );
|
||||
|
|
|
@ -58,10 +58,11 @@ OpenCSGRenderer::OpenCSGRenderer(CSGChain *root_chain, CSGChain *highlights_chai
|
|||
|
||||
void OpenCSGRenderer::draw(bool /*showfaces*/, bool showedges) const
|
||||
{
|
||||
if (this->root_chain) {
|
||||
GLint *shaderinfo = this->shaderinfo;
|
||||
if (!shaderinfo[0]) shaderinfo = NULL;
|
||||
if (this->root_chain) {
|
||||
renderCSGChain(this->root_chain, showedges ? shaderinfo : NULL, false, false);
|
||||
}
|
||||
if (this->background_chain) {
|
||||
renderCSGChain(this->background_chain, showedges ? shaderinfo : NULL, false, true);
|
||||
}
|
||||
|
@ -69,7 +70,6 @@ void OpenCSGRenderer::draw(bool /*showfaces*/, bool showedges) const
|
|||
renderCSGChain(this->highlights_chain, showedges ? shaderinfo : NULL, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OpenCSGRenderer::renderCSGChain(CSGChain *chain, GLint *shaderinfo,
|
||||
bool highlight, bool background) const
|
||||
|
|
|
@ -1031,8 +1031,8 @@ void MainWindow::compileCSG(bool procevents)
|
|||
CSGTermEvaluator csgrenderer(this->tree, &geomevaluator);
|
||||
if (procevents) QApplication::processEvents();
|
||||
this->root_raw_term = csgrenderer.evaluateCSGTerm(*root_node, highlight_terms, background_terms);
|
||||
if (!root_raw_term) {
|
||||
PRINT("ERROR: CSG generation failed! (no top level object found)");
|
||||
if (!root_raw_term && background_terms.empty()) {
|
||||
PRINT("ERROR: CSG generation failed! (no objects found)");
|
||||
}
|
||||
GeometryCache::instance()->print();
|
||||
#ifdef ENABLE_CGAL
|
||||
|
@ -1048,12 +1048,13 @@ void MainWindow::compileCSG(bool procevents)
|
|||
delete this->progresswidget;
|
||||
this->progresswidget = NULL;
|
||||
|
||||
if (root_raw_term) {
|
||||
PRINT("Compiling design (CSG Products normalization)...");
|
||||
if (procevents) QApplication::processEvents();
|
||||
|
||||
size_t normalizelimit = 2 * Preferences::inst()->getValue("advanced/openCSGLimit").toUInt();
|
||||
CSGTermNormalizer normalizer(normalizelimit);
|
||||
|
||||
if (root_raw_term) {
|
||||
this->root_norm_term = normalizer.normalize(this->root_raw_term);
|
||||
if (this->root_norm_term) {
|
||||
this->root_chain = new CSGChain();
|
||||
|
@ -1064,9 +1065,9 @@ void MainWindow::compileCSG(bool procevents)
|
|||
PRINT("WARNING: CSG normalization resulted in an empty tree");
|
||||
if (procevents) QApplication::processEvents();
|
||||
}
|
||||
}
|
||||
|
||||
if (highlight_terms.size() > 0)
|
||||
{
|
||||
if (highlight_terms.size() > 0) {
|
||||
PRINTB("Compiling highlights (%d CSG Trees)...", highlight_terms.size());
|
||||
if (procevents) QApplication::processEvents();
|
||||
|
||||
|
@ -1077,8 +1078,7 @@ void MainWindow::compileCSG(bool procevents)
|
|||
}
|
||||
}
|
||||
|
||||
if (background_terms.size() > 0)
|
||||
{
|
||||
if (background_terms.size() > 0) {
|
||||
PRINTB("Compiling background (%d CSG Trees)...", background_terms.size());
|
||||
if (procevents) QApplication::processEvents();
|
||||
|
||||
|
@ -1111,7 +1111,6 @@ void MainWindow::compileCSG(bool procevents)
|
|||
PRINTB("Total rendering time: %d hours, %d minutes, %d seconds", (s / (60*60)) % ((s / 60) % 60) % (s % 60));
|
||||
if (procevents) QApplication::processEvents();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::actionUpdateCheck()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue