Skip to content

Commit

Permalink
Added single sided option to BufferOperation
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonbeverage committed Feb 4, 2025
1 parent c5913d5 commit b33f680
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
12 changes: 11 additions & 1 deletion src/osgEarthImGui/NodeGraphGUI
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,6 @@ namespace osgEarth
polygonsToPoints->setRandom(random);
updateNodeGraph();
}

ImGui::PopItemWidth();
}

Expand Down Expand Up @@ -705,6 +704,17 @@ namespace osgEarth
op->setCapStyle(static_cast<Stroke::LineCapStyle>(item_current));
updateNodeGraph();
}

ImGui::PushItemWidth(100.0f);
bool singleSided = op->getSingleSided();
if (ImGui::Checkbox("Single Sided", &singleSided))
{
op->setSingleSided(singleSided);
updateNodeGraph();
}
ImGui::PopItemWidth();


ImGui::PopItemWidth();
}

Expand Down
12 changes: 10 additions & 2 deletions src/osgEarthProcedural/NodeGraph
Original file line number Diff line number Diff line change
Expand Up @@ -1581,6 +1581,8 @@ namespace osgEarth

if (features && distance)
{
FeatureList output;

for (auto& f : features->featuresValue)
{
BufferParameters params;
Expand All @@ -1591,14 +1593,17 @@ namespace osgEarth
BufferParameters::CAP_SQUARE;

params._cornerSegs = _numQuadSegs;
params._singleSided = _singleSided;

osg::ref_ptr<Geometry> geom;
if (f->getGeometry()->buffer(distance->floatValue, geom, params))
{
f->setGeometry(geom.get());
Feature* newFeature = new Feature(*f);
newFeature->setGeometry(geom.get());
output.push_back(newFeature);
}
}
set_output("Features", features->featuresValue);
set_output("Features", output);
}
}

Expand All @@ -1608,9 +1613,12 @@ namespace osgEarth
const int& getNumQuadSegs() const { return _numQuadSegs; }
void setNumQuadSegs(const int& numQuadSegs) { _numQuadSegs = numQuadSegs; }

const bool& getSingleSided() const { return _singleSided; }
void setSingleSided(const bool& singleSided) { _singleSided = singleSided; }

int _numQuadSegs = 0;
Stroke::LineCapStyle _capStyle = Stroke::LineCapStyle::LINECAP_SQUARE;
bool _singleSided = false;
};

class OSGEARTHPROCEDURAL_EXPORT CurrentLODOperation : public NodeGraphOperation
Expand Down

0 comments on commit b33f680

Please sign in to comment.