Lagrange
Loading...
Searching...
No Matches
AttributeFwd.h
1/*
2 * Copyright 2022 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12#pragma once
13
14#include <array>
15#include <cstdint>
16#include <limits>
17
18namespace lagrange {
19
22
26enum AttributeElement : int {
28 Vertex = (1 << 0),
29
31 Facet = (1 << 1),
32
34 Edge = (1 << 2),
35
37 Corner = (1 << 3),
38
42 Value = (1 << 4),
43
45 Indexed = (1 << 5),
46};
47
54enum class AttributeUsage : uint16_t {
55 Vector = (1 << 0),
56 Scalar = (1 << 1),
57 Position = (1 << 2),
58 Normal = (1 << 3),
59 Tangent = (1 << 4),
60 Bitangent = (1 << 5),
61 Color = (1 << 6),
62 UV = (1 << 7),
63 VertexIndex = (1 << 8),
64 FacetIndex = (1 << 9),
65 CornerIndex = (1 << 10),
66 EdgeIndex = (1 << 11),
67 String = (1 << 12),
68};
69
73using AttributeId = uint32_t;
74
77{
78 return std::numeric_limits<AttributeId>::max();
79};
80
90
111
132
143
155
166
176
187
191class AttributeBase;
192
194template <typename ValueType>
195class Attribute;
196
198template <typename ValueType, typename Index>
199class IndexedAttribute;
200
202
203} // namespace lagrange
AttributeCreatePolicy
Policy for attribute creation with reserved attribute names.
Definition AttributeFwd.h:86
uint32_t AttributeId
Identified to be used to access an attribute.
Definition AttributeFwd.h:73
AttributeShrinkPolicy
Policy for shrinking external attribute buffers.
Definition AttributeFwd.h:117
AttributeExportPolicy
Policy for exporting attributes that are views onto external buffers.
Definition AttributeFwd.h:149
AttributeUsage
Usage tag indicating how the attribute should behave under mesh transformations.
Definition AttributeFwd.h:54
AttributeGrowthPolicy
Policy for growing external attribute buffers.
Definition AttributeFwd.h:96
AttributeCopyPolicy
Policy for copying attribute that are views onto external buffers.
Definition AttributeFwd.h:161
AttributeElement
Type of element to which the attribute is attached.
Definition AttributeFwd.h:26
AttributeDeletePolicy
Policy for attribute deletion of reserved attribute names.
Definition AttributeFwd.h:172
constexpr AttributeId invalid_attribute_id()
Invalid attribute id.
Definition AttributeFwd.h:76
AttributeWritePolicy
Policy for attempting to write to read-only external buffers.
Definition AttributeFwd.h:138
AttributeCastPolicy
Policy for remapping invalid values when casting to a different value type.
Definition AttributeFwd.h:182
@ Force
Force creation of reserved attribute names.
Definition AttributeFwd.h:88
@ ErrorIfReserved
Default deletion policy, throw an exception if attribute name is reserved.
Definition AttributeFwd.h:87
@ IgnoreIfExternal
Ignore external buffers when trying to shrink an attribute.
Definition AttributeFwd.h:123
@ CopyIfUnmanaged
Copy the buffer during export if the attribute points to an unmanaged external buffer.
Definition AttributeFwd.h:151
@ KeepExternalPtr
Keep the raw pointer to the external buffer data. Use with caution.
Definition AttributeFwd.h:152
@ CopyIfExternal
Copy the buffer during export if the attribute points to an external buffer.
Definition AttributeFwd.h:150
@ String
Mesh attribute is a metadata string (stored as a uint8_t buffer).
Definition AttributeFwd.h:67
@ Position
Mesh attribute must have exactly dim channels.
Definition AttributeFwd.h:57
@ Tangent
Mesh attribute can have dim or dim + 1 channels.
Definition AttributeFwd.h:59
@ CornerIndex
Single channel integer attribute indexing a mesh corner.
Definition AttributeFwd.h:65
@ VertexIndex
Single channel integer attribute indexing a mesh vertex.
Definition AttributeFwd.h:63
@ EdgeIndex
Single channel integer attribute indexing a mesh edge.
Definition AttributeFwd.h:66
@ Normal
Mesh attribute can have dim or dim + 1 channels.
Definition AttributeFwd.h:58
@ FacetIndex
Single channel integer attribute indexing a mesh facet.
Definition AttributeFwd.h:64
@ Color
Mesh attribute can have 1, 2, 3 or 4 channels.
Definition AttributeFwd.h:61
@ UV
Mesh attribute must have exactly 2 channels.
Definition AttributeFwd.h:62
@ Bitangent
Mesh attribute can have dim or dim + 1 channels.
Definition AttributeFwd.h:60
@ Scalar
Mesh attribute must have exactly 1 channel.
Definition AttributeFwd.h:56
@ ErrorIfExternal
Throws an exception when trying to grow an external buffer (even if the new size is still within the ...
Definition AttributeFwd.h:99
@ SilentCopy
Silently copy the buffer data if it grows beyond the buffer capacity.
Definition AttributeFwd.h:109
@ WarnAndCopy
Logs a warning and copy the buffer data if it grows beyond the buffer capacity.
Definition AttributeFwd.h:106
@ AllowWithinCapacity
Allow attribute growth as long as it remains within the capacity of the external buffer.
Definition AttributeFwd.h:103
@ Value
Values that are not attached to a specific element.
Definition AttributeFwd.h:42
@ Edge
Per-edge mesh attributes.
Definition AttributeFwd.h:34
@ Indexed
Indexed mesh attributes.
Definition AttributeFwd.h:45
@ Facet
Per-facet mesh attributes.
Definition AttributeFwd.h:31
@ Corner
Per-corner mesh attributes.
Definition AttributeFwd.h:37
@ Vertex
Per-vertex mesh attributes.
Definition AttributeFwd.h:28
@ ErrorIfReadOnly
Throws an exception when trying to write to a read-only buffer.
Definition AttributeFwd.h:139
@ RemapInvalidIndices
Map invalue values only if the AttributeUsage represents indices.
Definition AttributeFwd.h:183
@ RemapInvalidAlways
Always remap invalid values from source type to target type, regardless of AttributeUsage.
Definition AttributeFwd.h:184
@ DoNotRemapInvalid
Do not remap invalid values. They are simply static_cast<> to the target type.
Definition AttributeFwd.h:185
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
Type alias for one-dimensional column Eigen vectors.
Definition views.h:79
Main namespace for Lagrange.