Skip to content

Engine → Physics → collision_mesh_asset.h

collision_mesh_asset

Syntax

class CONJURE_API collision_mesh_asset

Constructors

AccessSignatureDescription
publiccollision_mesh_asset();
publiccollision_mesh_asset( const collision_mesh_asset &) = default;
publiccollision_mesh_asset( collision_mesh_asset &&) noexcept = default;

Destructors

AccessSignatureDescription
public~collision_mesh_asset();

Variables

AccessNameTypeDefaultDescription
privatemBoundsmath::aabb{}
privatemIndicesstd::vector<u32>{}
privatemPositionsstd::vector<math::vec3>{}
privatemShapesstd::shared_ptr<const detail::collision_mesh_shapes>nullptr

Functions

Public

bounds

[[nodiscard]] const math::aabb &bounds() const noexcept;

Bounds of every position (invalid for an empty mesh).

from_geometry

[[nodiscard]] static core::result<collision_mesh_asset> from_geometry(
    std::span<const math::vec3> positions,
    std::span<const u32> indices);

Builds a mesh from positions and triangle indices. GEOMETRY_INVALID when the index count is not a multiple of three, an index is out of range, a position is not finite or no non-degenerate triangle remains. Degenerate triangles (repeated vertex or zero area) are dropped; unreferenced vertices are kept.

from_payload

[[nodiscard]] static core::result<collision_mesh_asset> from_payload(
    std::span<const std::byte> payload);

Parses a cooked payload. GEOMETRY_INVALID for a short or inconsistent buffer.

has_shapes

[[nodiscard]] bool has_shapes() const noexcept;

True once the loader built the Jolt shapes (false for a mesh made by from_geometry).

indices

[[nodiscard]] std::span<const u32> indices() const noexcept;

positions

[[nodiscard]] std::span<const math::vec3> positions() const noexcept;

set_shapes

void set_shapes(
    std::shared_ptr<const detail::collision_mesh_shapes> shapes) noexcept;

Installs the Jolt shapes. For the physics module's own use.

shapes

[[nodiscard]] const detail::collision_mesh_shapes *shapes() const noexcept;

The Jolt shapes, or nullptr. For the physics module's own use.

to_payload

[[nodiscard]] std::vector<std::byte> to_payload() const;

The cooked payload of this mesh (deterministic bytes).

triangle_count

[[nodiscard]] u32 triangle_count() const noexcept;

vertex_count

[[nodiscard]] u32 vertex_count() const noexcept;

Operator Overloads

Public

operator=

collision_mesh_asset &operator=(
    const collision_mesh_asset &) = default;
collision_mesh_asset &operator=(
    collision_mesh_asset &&) noexcept = default;