Blender V5.3
draco_bridge/intern/common.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#include "common.h"
6
7#include <cstring>
8
9size_t getNumberOfComponents(char *dataType)
10{
11 if (!strcmp(dataType, "SCALAR")) {
12 return 1;
13 }
14 if (!strcmp(dataType, "VEC2")) {
15 return 2;
16 }
17 if (!strcmp(dataType, "VEC3")) {
18 return 3;
19 }
20 if (!strcmp(dataType, "VEC4")) {
21 return 4;
22 }
23 if (!strcmp(dataType, "MAT2")) {
24 return 4;
25 }
26 if (!strcmp(dataType, "MAT3")) {
27 return 9;
28 }
29 if (!strcmp(dataType, "MAT4")) {
30 return 16;
31 }
32
33 return 0;
34}
35
36size_t getComponentByteLength(size_t componentType)
37{
38 switch (componentType) {
41 return 1;
42
45 return 2;
46
49 return 4;
50
51 default:
52 return 0;
53 }
54}
55
56size_t getAttributeStride(size_t componentType, char *dataType)
57{
58 return getComponentByteLength(componentType) * getNumberOfComponents(dataType);
59}
size_t getAttributeStride(size_t componentType, char *dataType)
size_t getComponentByteLength(size_t componentType)
size_t getNumberOfComponents(char *dataType)