3#include "GeometryToBufferStrategies.hpp"
5#include <ossia/dataflow/geometry_port.hpp>
7#include <Threedim/Debug.hpp>
74[[nodiscard]]
constexpr halp::attribute_format toHalpFormat(AttributeFormat fmt)
noexcept
85 case AttributeFormat::Float4:
return halp::attribute_format::float4;
86 case AttributeFormat::Float3:
return halp::attribute_format::float3;
87 case AttributeFormat::Float2:
return halp::attribute_format::float2;
88 case AttributeFormat::Float:
return halp::attribute_format::float1;
89 case AttributeFormat::UNormByte4:
return halp::attribute_format::unormbyte4;
90 case AttributeFormat::UNormByte2:
return halp::attribute_format::unormbyte2;
91 case AttributeFormat::UNormByte:
return halp::attribute_format::unormbyte1;
92 case AttributeFormat::UInt4:
return halp::attribute_format::uint4;
93 case AttributeFormat::UInt2:
return halp::attribute_format::uint2;
94 case AttributeFormat::UInt:
return halp::attribute_format::uint1;
95 case AttributeFormat::SInt4:
return halp::attribute_format::sint4;
96 case AttributeFormat::SInt2:
return halp::attribute_format::sint2;
97 case AttributeFormat::SInt:
return halp::attribute_format::sint1;
98 case AttributeFormat::Half4:
return halp::attribute_format::half4;
99 case AttributeFormat::Half3:
return halp::attribute_format::half3;
100 case AttributeFormat::Half2:
return halp::attribute_format::half2;
101 case AttributeFormat::Half:
return halp::attribute_format::half1;
102 case AttributeFormat::UShort4:
return halp::attribute_format::ushort4;
103 case AttributeFormat::UShort2:
return halp::attribute_format::ushort2;
104 case AttributeFormat::UShort:
return halp::attribute_format::ushort1;
105 case AttributeFormat::SShort4:
return halp::attribute_format::sshort4;
106 case AttributeFormat::SShort2:
return halp::attribute_format::sshort2;
107 case AttributeFormat::SShort:
return halp::attribute_format::sshort1;
109 return halp::attribute_format::float4;
112[[nodiscard]]
constexpr int32_t attributeFormatSize(AttributeFormat fmt)
noexcept
114 return Threedim::attributeFormatSize(toHalpFormat(fmt));
117[[nodiscard]]
constexpr halp::primitive_topology
118toHalpTopology(PrimitiveTopology t)
noexcept
122 case PrimitiveTopology::Triangles:
123 return halp::primitive_topology::triangles;
124 case PrimitiveTopology::TriangleStrip:
125 return halp::primitive_topology::triangle_strip;
126 case PrimitiveTopology::TriangleFan:
127 return halp::primitive_topology::triangle_fan;
128 case PrimitiveTopology::Lines:
129 return halp::primitive_topology::lines;
130 case PrimitiveTopology::LineStrip:
131 return halp::primitive_topology::line_strip;
132 case PrimitiveTopology::Points:
133 return halp::primitive_topology::points;
135 return halp::primitive_topology::triangles;
138[[nodiscard]]
constexpr halp::cull_mode toHalpCullMode(CullMode c)
noexcept
143 return halp::cull_mode::none;
144 case CullMode::Front:
145 return halp::cull_mode::front;
147 return halp::cull_mode::back;
149 return halp::cull_mode::none;
152[[nodiscard]]
constexpr halp::front_face toHalpFrontFace(FrontFace f)
noexcept
156 case FrontFace::CounterClockwise:
157 return halp::front_face::counter_clockwise;
158 case FrontFace::Clockwise:
159 return halp::front_face::clockwise;
161 return halp::front_face::counter_clockwise;
164[[nodiscard]]
constexpr halp::index_format toHalpIndexFormat(IndexFormat f)
noexcept
168 case IndexFormat::UInt16:
169 return halp::index_format::uint16;
170 case IndexFormat::UInt32:
171 return halp::index_format::uint32;
173 return halp::index_format::uint32;
176[[nodiscard]]
constexpr halp::binding_classification
177toHalpClassification(
bool instanced)
noexcept
179 return instanced ? halp::binding_classification::per_instance
180 : halp::binding_classification::per_vertex;
185[[nodiscard]]
inline int resolveSemanticFromName(
const std::string& name)
noexcept
188 return static_cast<int>(ossia::attribute_semantic::custom);
190 auto sem = ossia::name_to_semantic(name);
191 return static_cast<int>(sem);