Skip to content

Commit

Permalink
Added possibility to define line width/thickness in Rendering::Utilit…
Browse files Browse the repository at this point in the history
…ies function with LineStrips objects

Summary: Simply extending the Utility function based on `LineStrips` to allowing specifying the width/thickness of the lines.

Reviewed By: enpe

Differential Revision: D63348379

fbshipit-source-id: e44b1ac256974035188572c4aae63700fbd579f9
  • Loading branch information
janherling authored and facebook-github-bot committed Sep 25, 2024
1 parent b6e2088 commit 8783ead
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion impl/ocean/rendering/Utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ TransformRef Utilities::createPoints(const Engine& engine, const Vectors3& verti
return TransformRef();
}

TransformRef Utilities::createLines(const Engine& engine, const Vectors3& vertices, const VertexIndexGroups& lineIndexGroups, const RGBAColor& emissiveColor, const RGBAColors& colorsPerVertex, MaterialRef* material, AttributeSetRef* attributeSet, LineStripsRef* lineStrips, VertexSetRef* vertexSet)
TransformRef Utilities::createLines(const Engine& engine, const Vectors3& vertices, const VertexIndexGroups& lineIndexGroups, const RGBAColor& emissiveColor, const Scalar lineWidth, const RGBAColors& colorsPerVertex, MaterialRef* material, AttributeSetRef* attributeSet, LineStripsRef* lineStrips, VertexSetRef* vertexSet)
{
try
{
Expand All @@ -1086,6 +1086,11 @@ TransformRef Utilities::createLines(const Engine& engine, const Vectors3& vertic
internalLineStrips->setVertexSet(internalVertexSet);
internalLineStrips->setStrips(lineIndexGroups);

if (lineWidth != Scalar(1))
{
internalLineStrips->setLineWidth(lineWidth);
}

const GeometryRef internalGeometry = engine.factory().createGeometry();

const AttributeSetRef internalAttributeSet = engine.factory().createAttributeSet();
Expand Down
3 changes: 2 additions & 1 deletion impl/ocean/rendering/Utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,15 @@ class OCEAN_RENDERING_EXPORT Utilities
* @param vertices The vertices of all points to be rendered, at least one
* @param lineIndexGroups The group of vertex indices defining several individual lines, at least one
* @param emissiveColor The emissiveColor of all vertices in case 'colorsPerVertex' is empty, can be transparent
* @param lineWidth The width of the lines in pixels, with range [1, infinity)
* @param colorsPerVertex The optional colors of the individual vertices, one for each vertex or empty to use the 'emissiveColor'
* @param material Optional resulting Material node; will be invalid if colorPerVertex is not empty
* @param attributeSet Optional resulting AttributeSet node
* @param lineStrips Optional resulting LineStrips node
* @param vertexSet Optional resulting VertexSet node
* @return The resulting transform node holding the geometry node
*/
static TransformRef createLines(const Engine& engine, const Vectors3& vertices, const VertexIndexGroups& lineIndexGroups, const RGBAColor& emissiveColor, const RGBAColors& colorsPerVertex = RGBAColors(), MaterialRef* material = nullptr, AttributeSetRef* attributeSet = nullptr, LineStripsRef* lineStrips = nullptr, VertexSetRef* vertexSet = nullptr);
static TransformRef createLines(const Engine& engine, const Vectors3& vertices, const VertexIndexGroups& lineIndexGroups, const RGBAColor& emissiveColor, const Scalar lineWidth = Scalar(1), const RGBAColors& colorsPerVertex = RGBAColors(), MaterialRef* material = nullptr, AttributeSetRef* attributeSet = nullptr, LineStripsRef* lineStrips = nullptr, VertexSetRef* vertexSet = nullptr);

/**
* Returns a Transform holding a geometry with lines (a wireframe of a mesh).
Expand Down

0 comments on commit 8783ead

Please sign in to comment.