Utils

Namespaces

Text

Types

ClipRegion

HatchingStyle

LineStroke

TessellationConfig

LineCap

Fields

None

Round

Functions

bool

CreateEllipticalArc

bool

CreateThickLine

bool

TriangulateFace

bool

CreateHatchingPattern

bool

CreateTexturedQuad

bool

CreatePointMeshes

Detailed Description

namespace Utils

Type Documentation

enum class SC::Store::Utils::LineCap

Denotes a line’s end cap.

Values:

enumerator None
enumerator Round

Function Documentation

bool SC::Store::Utils::CreateEllipticalArc(TessellationConfig const &config, float x_radius, float y_radius, float x_axis_rotation_radians, bool large_arc_flag, bool sweep_flag, bool invert_y, float begin_x_pos, float begin_y_pos, float end_x_pos, float end_y_pos, std::vector<Point> &out_points)

Generates the points for the path along an elliptical arc. Ignores z-coordinates. Generated z-coordinates are set to zero. The arguments and behavior are that of SVG elliptical arcs: https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands

Parameters
  • config – Configures tessellation.

  • x_radius – The radius of the ellipse along the x-axis

  • y_radius – The radius of the ellipse along the y-axis

  • x_axis_rotation_radians – Rotates the generated ellipse along the x-axis by this many radians.

  • large_arc_flag – Controls whether or not the generated arc is generated as a large arc.

  • sweep_flag – If true, the generated arc is swept in the positive angle direction. Otherwise it is swept in the negative direction.

  • invert_y – Denotes whether or not the Y-axis is inverted.

  • begin_x_pos – The x-coordinate of the arc’s begin position

  • begin_y_pos – The y-coordinate of the arc’s begin position

  • end_x_pos – The x-coordinate of the arc’s end position

  • end_y_pos – The y-coordinate of the arc’s end position

  • out_points – Where the generate arc’s points get returned.

Returns

Returns true if the operation succeeded. Otherwise it returns false.

bool SC::Store::Utils::CreateThickLine(TessellationConfig const &config, LineStroke const &stroke, std::vector<Point> const &path, std::vector<Point> &out_points, std::vector<uint32_t> &out_triangle_indices)

Generates the points and triangles for a thick line. Ignores z-coordinates. Generated z-coordinates are set to zero.

Parameters
  • config – Configures tessellation.

  • stroke – Configures stroke properties of the generated thick line.

  • path – The path used to define the spine of the thick line.

  • out_points – Generated points are returned here.

  • out_triangle_indices – Generated triangle indices are returned here.

Returns

Returns true if the operation succeeded. Otherwise it returns false.

bool SC::Store::Utils::TriangulateFace(SC::Store::Point const *points, int const *face_list, size_t face_list_count, SC::Store::Point const &normal, std::vector<SC::Store::Point> &out_points)

Triangulates a supplied polygonal face.

Parameters
  • points – The points used by the supplied face list for specifying face vertices.

  • face_list – A list of indices that refer to the supplied points. These indices denote the face to triangulate. An unclosed face list loop will automatically be closed by the triangulator.

  • face_list_count – The first integer is the number of vertices in the first face, followed by an integer for each vertex, which are indices into the point array. For example, if the face list contains [3 0 1 2], then a triangle is formed from the first three points in the point array. The next array index in the face list starts another face, and so on. Additionally, if the value representing the number of vertices is < 0, the face represents a hole.

  • normal – The normal of the face to triangulate.

  • out_points – The vertices of the generated triangles get emitted here.

Returns

Returns true if successful. Returns false otherwise.

bool SC::Store::Utils::CreateHatchingPattern(Model &model, std::vector<ClipRegion> const &localSpaceClipRegions, std::vector<HatchingStyle> const &hatchingStyles, Matrix3d const &worldMatrix, MaterialKey material, bool visibility, InstanceKey &instanceKey)

Creates a hatching zone.

Parameters
  • model – (in) SC model file to generate hatching into.

  • localSpaceClipRegions – (in) hatching limits in local space.

  • hatchingStyles – (in) defines hatching style (orientation, gap between lines).

  • worldMatrix – (in) world space matrix (will be applied on the localSpaceClipRegions).

  • material – (in) line material to use.

  • visibility – (in) tells if hatching will be visible or not.

  • instanceKey – (out) stream cache instance key of the resulting hatching.

Returns

true if all went right, false otherwise.

bool SC::Store::Utils::CreateTexturedQuad(Model &model, ImageKey textureKey, float xPos, float yPos, float width, float height, Matrix3d const &worldMatrix, bool visibility, InstanceKey &instanceKey)

Creates a textured quad.

Parameters
  • model – (in) SC model file to generate quad into.

  • textureKey – (in) SC key of the texture

  • xPos – (in) left local position of the quad

  • yPos – (in) bottom local position of the quad

  • width – (in) width of the quad

  • height – (in) height of the quad

  • worldMatrix – (in) world space matrix

  • visibility – (in) tells if the quad will be visible or not.

  • instanceKey – (out) stream cache instance key of the resulting quad.

Returns

true if all went right, false otherwise.

bool SC::Store::Utils::CreatePointMeshes(Model &model, Point const *points, RGBA32 const *rgba32s, size_t count, MeshKeys &mesh_keys)

Creates point meshes for a set of points.

Parameters
  • model – (in) SC model file to generate point meshes into.

  • points – (in) Points to process

  • rgba32s – (in) Colors to process maybe nullptr. If provided must be per-point.

  • count – (in) Number of points to process

  • mesh_keys – (out) Resulting mesh keys.

Returns

true if all went right, false otherwise.