utility::geometry namespace

various geometry and geometry related operation utilities.

functions

generate_tangents
generates tangent information for the geometry data
public static
generate_tangents
generates tangent information for the geometry data.
public static
create_quad
generates a quad primitive with the bounds coordinates.
public static
create_plane
generates a plane primitive with the bounds coordinates.
public static
create_box
generates a box primitive with a pivot of {0,0,0}.
public static

Function documentation

static std::vector<psl::vec3> utility::geometry::generate_tangents(const std::vector<psl::vec3>& positions, const std::vector<psl::vec2>& uvs, const std::vector<uint32_t>& indices)

Brief

generates tangent information for the geometry data

Details

Parameters
positions in vertex position info
uvs in vertex UVs
indices in triangle indices.
Returns the generated tangent information.

static bool utility::geometry::generate_tangents(core::resource::handle<core::data::geometry_t> geometry_data)

Brief

generates tangent information for the geometry data.

Details

generates tangent information for the given geometry data, which, on success, is injected into the input handle.

Parameters
geometry_data in/out the geometry data container.
Returns if the operation was successful (true) or not (false).

static core::resource::handle<core::data::geometry_t> utility::geometry::create_quad(core::resource::cache_t& cache, float top, float bottom, float left, float right)

Brief

generates a quad primitive with the bounds coordinates.

Details

the principal difference between this function and utility::geometry::create_plane() is that this method allows fine control of the extents. This can be handy for generating UI elements.

Parameters
cache in/out the cache to store the generated geometry information on.
top in the extent in the +Y axis.
bottom in the extent in the -Y axis.
left in the extent in the +X axis.
right in the extent in the -X axis.
Returns the handle to the generated geometry data.

static core::resource::handle<core::data::geometry_t> utility::geometry::create_plane(core::resource::cache_t& cache, psl::vec2 size = psl::vec2::one, psl::ivec2 subdivisions = psl::ivec2(1, 1), psl::vec2 uvScale = psl::vec2::one)

Brief

generates a plane primitive with the bounds coordinates.

Details

the principal differences between this method and utility::geometry::create_quad() is that the plane can be subdivided, and has finer control over the UV's, making it better suited for 3D geometry.

Parameters
cache in/out the cache to store the generated geometry information on.
size in the extent in the XZ axis.
subdivisions in the amount of times to subdivide the mesh in the XZ axis.
uvScale in multiplier on the UV scale, where {1, 1} is the normalized coordinates.
Returns the handle to the generated geometry data.

static core::resource::handle<core::data::geometry_t> utility::geometry::create_box(core::resource::cache_t& cache, psl::vec3 scale = psl::vec3::one)

Brief

generates a box primitive with a pivot of {0,0,0}.

Details

Parameters
cache in/out the cache to store the generated geometry information on.
scale in the scale of the object.
Returns the handle to the generated geometry data.