GCC Code Coverage Report


ernie/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
15 / 15
100.0%
Branches:
-
-%
Functions:
12 / 12, 1 excl
100.0%

scene/schema/vol.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2 /// @file vol.h
3 /// @brief UsdVol's volumes and fields, with Ernie's in-memory NanoVDB and dense fields.
4 ///
5 /// References:
6 /// - Pixar, UsdVol, https://openusd.org/release/api/usd_vol_page_front.html
7 #pragma once
8
9 #include "ernie/scene/schema/geom.h"
10
11 // clang-format off
12 #define ERNIE_FIELD_SELECTION_ATTRIBUTES(X, where) \
13 X(std::string, FieldName, "fieldName", "", "The grid's name in the " where "; unset, any grid.", \
14 .group = "Field", .dirty = Dirty::Points) \
15 X(int, FieldIndex, "fieldIndex", 0, \
16 "Which of the " where "'s grids of that name, or of all its grids without one; 0 the first.", \
17 .group = "Field", .lower = AtLeast(0.0), .dirty = Dirty::Points)
18
19 #define ERNIE_FIELD_ASSET_ATTRIBUTES(X) \
20 X(std::string, FilePath, "filePath", "", "The grid's file: NanoVDB, uncompressed.", \
21 .group = "Field", .asset = true, .dirty = Dirty::Points) \
22 ERNIE_FIELD_SELECTION_ATTRIBUTES(X, "file") \
23 X(std::string, FieldDataType, "fieldDataType", "", \
24 "The grid's value type, for reference; Ernie reads it from the file.", .group = "Field") \
25 X(std::string, VectorDataRoleHint, "vectorDataRoleHint", "None", "What a vector grid holds.", \
26 .group = "Field", .options = {"None", "Point", "Normal", "Vector", "Color"})
27
28 #define ERNIE_OPENVDB_ASSET_ATTRIBUTES(X) \
29 X(std::string, FieldClass, "fieldClass", "", \
30 "The grid's class, for reference: Ernie renders fog volumes, not level sets.", \
31 .group = "Field", .options = {"levelSet", "fogVolume", "staggered", "unknown"})
32
33 #define ERNIE_NANOVDB_FIELD_ATTRIBUTES(X) \
34 X(Tensor, Buffer, "ernie:buffer", Tensor(), \
35 "NanoVDB grids back to back as NanoVDB keeps them in memory (Warp's Volume.array()), on " \
36 "the host or a device.", \
37 .group = "Field", .bytes = true, .dirty = Dirty::Points) \
38 ERNIE_FIELD_SELECTION_ATTRIBUTES(X, "buffer")
39
40 #define ERNIE_DENSE_FIELD_ATTRIBUTES(X) \
41 X(Tensor, Values, "ernie:values", Tensor(), \
42 "float32 (x, y, z) values, z fastest, on the host or a device; 0 is empty.", \
43 .group = "Field", .ranks = {3}, .dirty = Dirty::Points) \
44 X(double, VoxelSize, "ernie:voxelSize", 1.0, \
45 "Metres between values: value (i, j, k) lies at the voxel size times (i, j, k).", \
46 .group = "Field", .lower = Above(0.0), .finite = true, .dirty = Dirty::Points)
47 // clang-format on
48
49 namespace ernie {
50
51 12 ERNIE_SCHEMA_ACCESSORS(Volume, Gprim, ERNIE_NO_ATTRIBUTES);
52
53 3 class Volume : public VolumeAccessors<Volume, Gprim> {
54 3 ERNIE_SCHEMA_BODY(Volume, Gprim,
55 "A volume, bounded by and rendered from the fields its field:<name> "
56 "relationships name.")
57 3 ERNIE_SCHEMA_DEFINE(Volume)
58 /// Names a field of the volume, as `field:<name>`.
59 Volume& SetField(std::string_view name, const Path& field);
60 };
61
62 46 ERNIE_SCHEMA(FieldBase, Xformable, ERNIE_NO_ATTRIBUTES,
63 "A field's frame and grid, which volumes name.");
64 4 ERNIE_SCHEMA(FieldAsset, FieldBase, ERNIE_FIELD_ASSET_ATTRIBUTES, "A field read from a file.");
65 8 ERNIE_CONCRETE_SCHEMA(OpenVDBAsset, FieldAsset, ERNIE_OPENVDB_ASSET_ATTRIBUTES,
66 "An OpenVDB grid, read once converted to NanoVDB.");
67 3 ERNIE_CONCRETE_SCHEMA(NanoVDBField, FieldBase, ERNIE_NANOVDB_FIELD_ATTRIBUTES,
68 "NanoVDB grids in memory, written each step by a simulation.");
69 4 ERNIE_CONCRETE_SCHEMA(DenseField, FieldBase, ERNIE_DENSE_FIELD_ATTRIBUTES,
70 "A dense grid of values, as solvers write them.");
71
72 } // namespace ernie
73