Rerun C++ SDK
Loading...
Searching...
No Matches
triangle_indices.hpp
1// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/store/re_types/definitions/rerun/components/triangle_indices.fbs".
3
4#pragma once
5
6#include "../datatypes/uvec3d.hpp"
7#include "../result.hpp"
8
9#include <array>
10#include <cstdint>
11#include <memory>
12
13namespace rerun::components {
14 /// **Component**: The three indices of a triangle in a triangle mesh.
17
18 public: // START of extensions from triangle_indices_ext.cpp:
19 /// Construct TriangleIndices from v0/v1/v2 values.
20 TriangleIndices(uint32_t v0, uint32_t v1, uint32_t v2) : indices{v0, v1, v2} {}
21
22 /// Construct UVec3D from v0/v1/v2 uint32_t pointer.
23 explicit TriangleIndices(const uint32_t* indices_)
24 : indices{indices_[0], indices_[1], indices_[2]} {}
25
26 // END of extensions from triangle_indices_ext.cpp, start of generated code:
27
28 public:
29 TriangleIndices() = default;
30
31 TriangleIndices(rerun::datatypes::UVec3D indices_) : indices(indices_) {}
32
33 TriangleIndices& operator=(rerun::datatypes::UVec3D indices_) {
34 indices = indices_;
35 return *this;
36 }
37
38 TriangleIndices(std::array<uint32_t, 3> xyz_) : indices(xyz_) {}
39
40 TriangleIndices& operator=(std::array<uint32_t, 3> xyz_) {
41 indices = xyz_;
42 return *this;
43 }
44
45 /// Cast to the underlying UVec3D datatype
46 operator rerun::datatypes::UVec3D() const {
47 return indices;
48 }
49 };
50} // namespace rerun::components
51
52namespace rerun {
53 static_assert(sizeof(rerun::datatypes::UVec3D) == sizeof(components::TriangleIndices));
54
55 /// \private
56 template <>
57 struct Loggable<components::TriangleIndices> {
58 static constexpr const char Name[] = "rerun.components.TriangleIndices";
59
60 /// Returns the arrow data type this type corresponds to.
61 static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
62 return Loggable<rerun::datatypes::UVec3D>::arrow_datatype();
63 }
64
65 /// Serializes an array of `rerun::components::TriangleIndices` into an arrow array.
66 static Result<std::shared_ptr<arrow::Array>> to_arrow(
67 const components::TriangleIndices* instances, size_t num_instances
68 ) {
69 if (num_instances == 0) {
70 return Loggable<rerun::datatypes::UVec3D>::to_arrow(nullptr, 0);
71 } else if (instances == nullptr) {
72 return rerun::Error(
73 ErrorCode::UnexpectedNullArgument,
74 "Passed array instances is null when num_elements> 0."
75 );
76 } else {
77 return Loggable<rerun::datatypes::UVec3D>::to_arrow(
78 &instances->indices,
79 num_instances
80 );
81 }
82 }
83 };
84} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:95
All built-in components. See Types in the Rerun manual.
Definition rerun.hpp:79
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:22
Component: The three indices of a triangle in a triangle mesh.
Definition triangle_indices.hpp:15
TriangleIndices(const uint32_t *indices_)
Construct UVec3D from v0/v1/v2 uint32_t pointer.
Definition triangle_indices.hpp:23
TriangleIndices(uint32_t v0, uint32_t v1, uint32_t v2)
Construct TriangleIndices from v0/v1/v2 values.
Definition triangle_indices.hpp:20
Datatype: A uint32 vector in 3D space.
Definition uvec3d.hpp:20