Lagrange
Loading...
Searching...
No Matches
CistaMesh.h
1/*
2 * Copyright 2026 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 <lagrange/AttributeFwd.h>
15#include <lagrange/AttributeValueType.h>
16
17#include <cista/containers/string.h>
18#include <cista/containers/vector.h>
19
20#include <cstdint>
21#include <type_traits>
22
23namespace lagrange::serialization::internal {
24
25namespace data = cista::offset;
26
29{
30 data::string name;
31 AttributeId attribute_id = 0;
32 std::underlying_type_t<AttributeValueType> value_type = 0;
33 std::underlying_type_t<AttributeElement> element_type = 0;
34 std::underlying_type_t<AttributeUsage> usage = 0;
35 uint64_t num_channels = 0;
36 uint64_t num_elements = 0;
37 bool is_indexed = false;
38
39 // Non-indexed attribute: raw data bytes (num_elements * num_channels * sizeof(ValueType))
40 data::vector<uint8_t> data_bytes;
41
42 // Indexed attribute: values and indices stored separately
43 data::vector<uint8_t> values_bytes;
44 uint64_t values_num_elements = 0;
45 uint64_t values_num_channels = 0;
46 data::vector<uint8_t> indices_bytes;
47 uint64_t indices_num_elements = 0;
48 uint8_t index_type_size = 0; // sizeof(Index) of the mesh (4 or 8)
49};
50
53{
54 uint32_t version = 1; // Format version for forward/backward compatibility
55
56 uint8_t scalar_type_size = 0; // sizeof(Scalar): 4 for float, 8 for double
57 uint8_t index_type_size = 0; // sizeof(Index): 4 for uint32_t, 8 for uint64_t
58
59 uint64_t num_vertices = 0;
60 uint64_t num_facets = 0;
61 uint64_t num_corners = 0;
62 uint64_t num_edges = 0;
63 uint64_t dimension = 0;
64 uint64_t vertex_per_facet = 0;
65
66 data::vector<CistaAttributeInfo> attributes;
67};
68
69} // namespace lagrange::serialization::internal
uint32_t AttributeId
Identified to be used to access an attribute.
Definition AttributeFwd.h:73
Metadata and raw data for a single serialized attribute.
Definition CistaMesh.h:29
Complete serialized mesh representation.
Definition CistaMesh.h:53