Skip to content

Commit 2f31ae9

Browse files
tarcilajeffamstutz
authored andcommitted
Rename export_StructuredRegularToNanoVDB to export_StructuredVolumeToNanoVDB
1 parent a4ea3fd commit 2f31ae9

File tree

5 files changed

+32
-33
lines changed

5 files changed

+32
-33
lines changed

tsd/apps/tools/tsdVolumeToNanoVDB.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ int main(int argc, const char *argv[])
157157
"Detected rectilinear grid; writing NanoVDB sidecar with axis coordinates.");
158158
}
159159

160-
tsd::io::export_StructuredRegularVolumeToNanoVDB(spatialField,
160+
tsd::io::export_StructuredVolumeToNanoVDB(spatialField,
161161
outputFile->c_str(),
162162
undefinedValue.has_value(),
163163
undefinedValue.value_or(0.0f),

tsd/src/tsd/io/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ PRIVATE
4949
procedural/generate_randomSpheres.cpp
5050
procedural/generate_rtow.cpp
5151
procedural/generate_sphereSetVolume.cpp
52-
serialization/export_RegularVolumeToNanoVDB.cpp
52+
serialization/export_StructuredVolumeToNanoVDB.cpp
5353
serialization/NanoVdbSidecar.cpp
5454
serialization/export_SceneToUSD.cpp
5555
serialization/serialization_datatree.cpp

tsd/src/tsd/io/serialization.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void load_Scene(Scene &scene, core::DataNode &root);
3737

3838
void export_SceneToUSD(
3939
Scene &scene, const char *filename, int framesPerSecond = 30);
40-
void export_StructuredRegularVolumeToNanoVDB(
40+
void export_StructuredVolumeToNanoVDB(
4141
const SpatialField* spatialField,
4242
std::string_view outputFilename,
4343
bool useUndefinedValue = false,

tsd/src/tsd/io/serialization/export_RegularVolumeToNanoVDB.cpp renamed to tsd/src/tsd/io/serialization/export_StructuredVolumeToNanoVDB.cpp

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ using namespace std::string_view_literals;
2828
namespace tsd::io {
2929

3030
template <typename T>
31-
void doExportStructuredRegularVolumeToNanoVDB(const T *data,
31+
void doExportStructuredVolumeToNanoVDB(const T *data,
3232
math::float3 origin,
3333
math::float3 spacing,
3434
math::int3 dims,
@@ -39,17 +39,17 @@ void doExportStructuredRegularVolumeToNanoVDB(const T *data,
3939
bool enableDithering)
4040
{
4141
tsd::core::logStatus(
42-
"[export_StructuredRegularVolumeToNanoVDB] Volume dimensions: %u x %u x %u",
42+
"[export_StructuredVolumeToNanoVDB] Volume dimensions: %u x %u x %u",
4343
dims.x,
4444
dims.y,
4545
dims.z);
4646
tsd::core::logStatus(
47-
"[export_StructuredRegularVolumeToNanoVDB] Origin: (%.3f, %.3f, %.3f)",
47+
"[export_StructuredVolumeToNanoVDB] Origin: (%.3f, %.3f, %.3f)",
4848
origin.x,
4949
origin.y,
5050
origin.z);
5151
tsd::core::logStatus(
52-
"[export_StructuredRegularVolumeToNanoVDB] Spacing: (%.3f, %.3f, %.3f)",
52+
"[export_StructuredVolumeToNanoVDB] Spacing: (%.3f, %.3f, %.3f)",
5353
spacing.x,
5454
spacing.y,
5555
spacing.z);
@@ -142,7 +142,7 @@ void doExportStructuredRegularVolumeToNanoVDB(const T *data,
142142
: 0.0f;
143143

144144
tsd::core::logStatus(
145-
"[export_StructuredRegularVolumeToNanoVDB] Active voxels: %zu/%zu (%.1f%% inactive cell compression)",
145+
"[export_StructuredVolumeToNanoVDB] Active voxels: %zu/%zu (%.1f%% inactive cell compression)",
146146
activeVoxelsCount,
147147
totalVoxelsCount,
148148
inactiveCellCompression * 100.0f);
@@ -152,11 +152,11 @@ void doExportStructuredRegularVolumeToNanoVDB(const T *data,
152152
// Validate quantization choice
153153
if (precision == VDBPrecision::Fp4 && valueRange > 30.0f) {
154154
tsd::core::logWarning(
155-
"[export_StructuredRegularVolumeToNanoVDB] Fp4 quantization with value range %.2f may introduce significant error (recommended < 30.0)",
155+
"[export_StructuredVolumeToNanoVDB] Fp4 quantization with value range %.2f may introduce significant error (recommended < 30.0)",
156156
valueRange);
157157
} else if (precision == VDBPrecision::Fp8 && valueRange > 500.0f) {
158158
tsd::core::logWarning(
159-
"[export_StructuredRegularVolumeToNanoVDB] Fp8 quantization with value range %.2f may introduce significant error (recommended < 500.0)",
159+
"[export_StructuredVolumeToNanoVDB] Fp8 quantization with value range %.2f may introduce significant error (recommended < 500.0)",
160160
valueRange);
161161
}
162162

@@ -203,7 +203,7 @@ void doExportStructuredRegularVolumeToNanoVDB(const T *data,
203203
break;
204204
case VDBPrecision::Half:
205205
tsd::core::logWarning(
206-
"[export_StructuredRegularVolumeToNanoVDB] Half precision not supported in this NanoVDB build, using Fp16 instead");
206+
"[export_StructuredVolumeToNanoVDB] Half precision not supported in this NanoVDB build, using Fp16 instead");
207207
handle = nanovdb::tools::createNanoGrid<nanovdb::tools::build::Grid<float>,
208208
nanovdb::Fp16>(*buildGrid,
209209
nanovdb::tools::StatsMode::All,
@@ -215,7 +215,7 @@ void doExportStructuredRegularVolumeToNanoVDB(const T *data,
215215

216216
if (!handle) {
217217
tsd::core::logError(
218-
"[export_StructuredRegularVolumeToNanoVDB] Failed to create NanoVDB grid.");
218+
"[export_StructuredVolumeToNanoVDB] Failed to create NanoVDB grid.");
219219
return;
220220
}
221221

@@ -229,12 +229,12 @@ void doExportStructuredRegularVolumeToNanoVDB(const T *data,
229229
: 0.0f;
230230

231231
tsd::core::logStatus(
232-
"[export_StructuredRegularVolumeToNanoVDB] Quantization compression: %.1f%% (%.2f MB -> %.2f MB)",
232+
"[export_StructuredVolumeToNanoVDB] Quantization compression: %.1f%% (%.2f MB -> %.2f MB)",
233233
quantizationCompression * 100.0f,
234234
uncompressedActiveSize / (1024.0f * 1024.0f),
235235
finalSize / (1024.0f * 1024.0f));
236236
tsd::core::logStatus(
237-
"[export_StructuredRegularVolumeToNanoVDB] Total compression: %.1f%% (%.2f MB -> %.2f MB)",
237+
"[export_StructuredVolumeToNanoVDB] Total compression: %.1f%% (%.2f MB -> %.2f MB)",
238238
totalCompression * 100.0f,
239239
uncompressedSize / (1024.0f * 1024.0f),
240240
finalSize / (1024.0f * 1024.0f));
@@ -244,16 +244,16 @@ void doExportStructuredRegularVolumeToNanoVDB(const T *data,
244244
nanovdb::io::writeGrid(
245245
std::string(outputFilename).c_str(), handle, nanovdb::io::Codec::NONE);
246246
tsd::core::logStatus(
247-
"[export_StructuredRegularVolumeToNanoVDB] Successfully wrote VDB file: %s",
247+
"[export_StructuredVolumeToNanoVDB] Successfully wrote VDB file: %s",
248248
std::string(outputFilename).c_str());
249249
} catch (const std::exception &e) {
250250
tsd::core::logError(
251-
"[export_StructuredRegularVolumeToNanoVDB] Failed to write VDB file: %s",
251+
"[export_StructuredVolumeToNanoVDB] Failed to write VDB file: %s",
252252
e.what());
253253
}
254254
}
255255

256-
void export_StructuredRegularVolumeToNanoVDB(const SpatialField *spatialField,
256+
void export_StructuredVolumeToNanoVDB(const SpatialField *spatialField,
257257
std::string_view outputFilename,
258258
bool useUndefinedValue,
259259
float undefinedValue,
@@ -268,7 +268,7 @@ void export_StructuredRegularVolumeToNanoVDB(const SpatialField *spatialField,
268268

269269
if (!isStructuredRegular && !isStructuredRectilinear) {
270270
tsd::core::logError(
271-
"[export_StructuredRegularVolumeToNanoVDB] Not a structured volume.");
271+
"[export_StructuredVolumeToNanoVDB] Not a structured volume.");
272272
return;
273273
}
274274

@@ -281,14 +281,13 @@ void export_StructuredRegularVolumeToNanoVDB(const SpatialField *spatialField,
281281
// Dumb heuristic here: everything but cell is node-centered
282282
const bool cellCentered = dataCentering == "cell"sv;
283283

284-
tsd::core::logStatus(
285-
"[export_StructuredRegularVolumeToNanoVDB] Data centering: %s",
284+
tsd::core::logStatus("[export_StructuredVolumeToNanoVDB] Data centering: %s",
286285
dataCentering.c_str());
287286

288287
const auto *volumeData = spatialField->parameterValueAsObject<Array>("data");
289288
if (!volumeData) {
290289
tsd::core::logError(
291-
"[export_StructuredRegularVolumeToNanoVDB] No volume data found.");
290+
"[export_StructuredVolumeToNanoVDB] No volume data found.");
292291
return;
293292
}
294293

@@ -334,7 +333,7 @@ void export_StructuredRegularVolumeToNanoVDB(const SpatialField *spatialField,
334333

335334
if (!axisX || !axisY || !axisZ) {
336335
tsd::core::logError(
337-
"[export_StructuredRegularVolumeToNanoVDB] Missing rectilinear coordinates.");
336+
"[export_StructuredVolumeToNanoVDB] Missing rectilinear coordinates.");
338337
return;
339338
}
340339

@@ -359,13 +358,13 @@ void export_StructuredRegularVolumeToNanoVDB(const SpatialField *spatialField,
359358
if (!copyAxis(axisX, coordsX) || !copyAxis(axisY, coordsY)
360359
|| !copyAxis(axisZ, coordsZ)) {
361360
tsd::core::logError(
362-
"[export_StructuredRegularVolumeToNanoVDB] Rectilinear coordinates must be float or double.");
361+
"[export_StructuredVolumeToNanoVDB] Rectilinear coordinates must be float or double.");
363362
return;
364363
}
365364

366365
if (coordsX.size() < 2 || coordsY.size() < 2 || coordsZ.size() < 2) {
367366
tsd::core::logError(
368-
"[export_StructuredRegularVolumeToNanoVDB] Rectilinear coordinates must have at least two entries per axis.");
367+
"[export_StructuredVolumeToNanoVDB] Rectilinear coordinates must have at least two entries per axis.");
369368
return;
370369
}
371370

@@ -387,7 +386,7 @@ void export_StructuredRegularVolumeToNanoVDB(const SpatialField *spatialField,
387386
}
388387

389388
auto dispatchExport = [&](auto ptr) {
390-
doExportStructuredRegularVolumeToNanoVDB(ptr,
389+
doExportStructuredVolumeToNanoVDB(ptr,
391390
origin,
392391
spacing,
393392
dims,
@@ -419,7 +418,7 @@ void export_StructuredRegularVolumeToNanoVDB(const SpatialField *spatialField,
419418
break;
420419
default:
421420
tsd::core::logError(
422-
"[export_StructuredRegularVolumeToNanoVDB] Volume data is not of a supported float type.");
421+
"[export_StructuredVolumeToNanoVDB] Volume data is not of a supported float type.");
423422
return;
424423
}
425424

@@ -428,12 +427,11 @@ void export_StructuredRegularVolumeToNanoVDB(const SpatialField *spatialField,
428427
std::string sidecarError;
429428
if (!writeSidecar(sidecar, sidecarPath, sidecarError)) {
430429
tsd::core::logWarning(
431-
"[export_StructuredRegularVolumeToNanoVDB] Failed to write sidecar %s: %s",
430+
"[export_StructuredVolumeToNanoVDB] Failed to write sidecar %s: %s",
432431
sidecarPath.string().c_str(),
433432
sidecarError.c_str());
434433
} else {
435-
tsd::core::logStatus(
436-
"[export_StructuredRegularVolumeToNanoVDB] Wrote sidecar: %s",
434+
tsd::core::logStatus("[export_StructuredVolumeToNanoVDB] Wrote sidecar: %s",
437435
sidecarPath.string().c_str());
438436
}
439437
}

tsd/src/tsd/ui/imgui/modals/ExportNanoVDBFileDialog.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,10 @@ void ExportNanoVDBFileDialog::buildUI()
111111
auto spatialFieldObject = selectedObject->parameterValueAsObject("value");
112112

113113
if (!spatialFieldObject
114-
|| (spatialFieldObject->subtype() != core::tokens::volume::structuredRegular &&
115-
spatialFieldObject->subtype() != core::tokens::volume::structuredRectilinear)
116-
) {
114+
|| (spatialFieldObject->subtype()
115+
!= core::tokens::volume::structuredRegular
116+
&& spatialFieldObject->subtype()
117+
!= core::tokens::volume::structuredRectilinear)) {
117118
core::logError(
118119
"[ExportVDBFileDialog] Selected TransferFunction1D does not reference a structured regular volume.");
119120
return;
@@ -145,7 +146,7 @@ void ExportNanoVDBFileDialog::buildUI()
145146
break;
146147
}
147148

148-
io::export_StructuredRegularVolumeToNanoVDB(
149+
io::export_StructuredVolumeToNanoVDB(
149150
static_cast<const core::SpatialField *>(spatialFieldObject),
150151
m_filename.c_str(),
151152
m_enableUndefinedValue,

0 commit comments

Comments
 (0)