Lagrange
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 <cstdint>
15#include <limits>
16#include <array>
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
88 Force,
89};
90
102 SilentCopy,
103};
104
115 SilentCopy,
116};
117
126 SilentCopy,
127};
128
139};
140
150};
151
159 Force,
160};
161
165class AttributeBase;
166
168template <typename ValueType>
169class Attribute;
170
172template <typename ValueType, typename Index>
173class IndexedAttribute;
174
176
177} // namespace lagrange
AttributeWritePolicy
Policy for attempting to write to read-only external buffers.
Definition: AttributeFwd.h:123
AttributeCopyPolicy
Policy for copying attribute that are views onto external buffers.
Definition: AttributeFwd.h:146
uint32_t AttributeId
Identified to be used to access an attribute.
Definition: AttributeFwd.h:73
AttributeUsage
Usage tag indicating how the attribute should behave under mesh transformations.
Definition: AttributeFwd.h:54
AttributeShrinkPolicy
Policy for shrinking external attribute buffers.
Definition: AttributeFwd.h:110
AttributeCreatePolicy
Policy for attribute creation with reserved attribute names.
Definition: AttributeFwd.h:86
AttributeElement
Type of element to which the attribute is attached.
Definition: AttributeFwd.h:26
constexpr AttributeId invalid_attribute_id()
Invalid attribute id.
Definition: AttributeFwd.h:76
AttributeDeletePolicy
Policy for attribute deletion of reserved attribute names.
Definition: AttributeFwd.h:157
AttributeExportPolicy
Policy for exporting attributes that are views onto external buffers.
Definition: AttributeFwd.h:134
AttributeGrowthPolicy
Policy for growing external attribute buffers.
Definition: AttributeFwd.h:96
@ ErrorIfReadOnly
Throws an exception when trying to write to a read-only buffer.
@ String
Mesh attribute is a metadata string (stored as a uint8_t buffer).
@ Position
Mesh attribute must have exactly dim channels.
@ Tangent
Mesh attribute can have dim or dim + 1 channels.
@ CornerIndex
Single channel integer attribute indexing a mesh corner.
@ VertexIndex
Single channel integer attribute indexing a mesh vertex.
@ EdgeIndex
Single channel integer attribute indexing a mesh edge.
@ Normal
Mesh attribute can have dim or dim + 1 channels.
@ FacetIndex
Single channel integer attribute indexing a mesh facet.
@ Color
Mesh attribute can have 1, 2, 3 or 4 channels.
@ UV
Mesh attribute must have exactly 2 channels.
@ Bitangent
Mesh attribute can have dim or dim + 1 channels.
@ IgnoreIfExternal
Ignore external buffers when trying to shrink an attribute.
@ Force
Force creation of reserved attribute names.
@ ErrorIfReserved
Default deletion policy, throw an exception if attribute name is reserved.
@ 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
@ CopyIfUnmanaged
Copy the buffer during export if the attribute points to an unmanaged external buffer.
@ KeepExternalPtr
Keep the raw pointer to the external buffer data. Use with caution.
@ CopyIfExternal
Copy the buffer during export if the attribute points to an external buffer.
@ ErrorIfExternal
Throws an exception when trying to grow an external buffer (even if the new size is.
@ SilentCopy
Silently copy the buffer data if it grows beyond the buffer capacity.
@ WarnAndCopy
Logs a warning and copy the buffer data if it grows beyond the buffer capacity.
@ AllowWithinCapacity
Allow attribute growth as long as it remains within the capacity of the external.
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
Type alias for one-dimensional column Eigen vectors.
Definition: views.h:79
Main namespace for Lagrange.
Definition: AABBIGL.h:30