@@ -305,163 +305,6 @@ bool isLogForwarding(OP_OpTypeId);
305
305
// / @}
306
306
307
307
308
- // //////////////////////////////////////
309
-
310
-
311
- // / Helper class used internally by processTypedGrid()
312
- template <typename GridType, typename OpType, bool IsConst/* =false*/ >
313
- struct GridProcessor {
314
- static inline void call (OpType& op, GridPtr grid) {
315
- #ifdef _MSC_VER
316
- op.operator ()<GridType>(openvdb::gridPtrCast<GridType>(grid));
317
- #else
318
- op.template operator ()<GridType>(openvdb::gridPtrCast<GridType>(grid));
319
- #endif
320
- }
321
- };
322
-
323
- // / Helper class used internally by processTypedGrid()
324
- template <typename GridType, typename OpType>
325
- struct GridProcessor <GridType, OpType, /* IsConst=*/ true > {
326
- static inline void call (OpType& op, GridCPtr grid) {
327
- #ifdef _MSC_VER
328
- op.operator ()<GridType>(openvdb::gridConstPtrCast<GridType>(grid));
329
- #else
330
- op.template operator ()<GridType>(openvdb::gridConstPtrCast<GridType>(grid));
331
- #endif
332
- }
333
- };
334
-
335
-
336
- // / Helper function used internally by processTypedGrid()
337
- template <typename GridType, typename OpType, typename GridPtrType>
338
- inline void
339
- doProcessTypedGrid (GridPtrType grid, OpType& op)
340
- {
341
- GridProcessor<GridType, OpType,
342
- std::is_const<typename GridPtrType::element_type>::value>::call (op, grid);
343
- }
344
-
345
-
346
- // //////////////////////////////////////
347
-
348
-
349
- // / @brief Utility function that, given a generic grid pointer,
350
- // / calls a functor on the fully-resolved grid
351
- // /
352
- // / @par Example:
353
- // / @code
354
- // / using openvdb::Coord;
355
- // / using openvdb::CoordBBox;
356
- // /
357
- // / struct FillOp {
358
- // / const CoordBBox bbox;
359
- // /
360
- // / FillOp(const CoordBBox& b): bbox(b) {}
361
- // /
362
- // / template<typename GridT>
363
- // / void operator()(typename GridT::Ptr grid) const {
364
- // / using ValueT = typename GridT::ValueType;
365
- // / grid->fill(bbox, ValueT(1));
366
- // / }
367
- // / };
368
- // /
369
- // / CoordBBox bbox(Coord(0,0,0), Coord(10,10,10));
370
- // / processTypedGrid(myGridPtr, FillOp(bbox));
371
- // / @endcode
372
- // /
373
- // / @return @c false if the grid type is unknown or unhandled.
374
- // / @deprecated Use UTvdbProcessTypedGrid() or GEOvdbProcessTypedGrid() instead.
375
- template <typename GridPtrType, typename OpType>
376
- OPENVDB_DEPRECATED
377
- bool
378
- processTypedGrid (GridPtrType grid, OpType& op)
379
- {
380
- using namespace openvdb ;
381
- if (grid->template isType <BoolGrid>()) doProcessTypedGrid<BoolGrid>(grid, op);
382
- else if (grid->template isType <FloatGrid>()) doProcessTypedGrid<FloatGrid>(grid, op);
383
- else if (grid->template isType <DoubleGrid>()) doProcessTypedGrid<DoubleGrid>(grid, op);
384
- else if (grid->template isType <Int32Grid>()) doProcessTypedGrid<Int32Grid>(grid, op);
385
- else if (grid->template isType <Int64Grid>()) doProcessTypedGrid<Int64Grid>(grid, op);
386
- else if (grid->template isType <Vec3IGrid>()) doProcessTypedGrid<Vec3IGrid>(grid, op);
387
- else if (grid->template isType <Vec3SGrid>()) doProcessTypedGrid<Vec3SGrid>(grid, op);
388
- else if (grid->template isType <Vec3DGrid>()) doProcessTypedGrid<Vec3DGrid>(grid, op);
389
- else return false ; // /< @todo throw exception ("unknown grid type")
390
- return true ;
391
- }
392
-
393
-
394
- // / @brief Utility function that, given a generic grid pointer, calls
395
- // / a functor on the fully-resolved grid, provided that the grid's
396
- // / voxel values are 3-vectors (vec3i, vec3s or vec3d)
397
- // /
398
- // / Usage:
399
- // / @code
400
- // / struct NormalizeOp {
401
- // / template<typename GridT>
402
- // / void operator()(typename GridT::Ptr grid) const { normalizeVectors(*grid); }
403
- // / };
404
- // /
405
- // / processTypedVec3Grid(myGridPtr, NormalizeOp());
406
- // / @endcode
407
- // /
408
- // / @return @c false if the grid type is unknown or non-vector.
409
- // / @sa UTvdbProcessTypedGridVec3
410
- // / @deprecated Use UTvdbProcessTypedGridVec3() or GEOvdbProcessTypedGridVec3() instead.
411
- template <typename GridPtrType, typename OpType>
412
- OPENVDB_DEPRECATED
413
- bool
414
- processTypedVec3Grid (GridPtrType grid, OpType& op)
415
- {
416
- using namespace openvdb ;
417
- if (grid->template isType <Vec3IGrid>()) doProcessTypedGrid<Vec3IGrid>(grid, op);
418
- else if (grid->template isType <Vec3SGrid>()) doProcessTypedGrid<Vec3SGrid>(grid, op);
419
- else if (grid->template isType <Vec3DGrid>()) doProcessTypedGrid<Vec3DGrid>(grid, op);
420
- else return false ; // /< @todo throw exception ("grid type is not vec3")
421
- return true ;
422
- }
423
-
424
-
425
- // / @brief Utility function that, given a generic grid pointer,
426
- // / calls a functor on the fully-resolved grid
427
- // /
428
- // / @par Example:
429
- // / @code
430
- // / using openvdb::Coord;
431
- // / using openvdb::CoordBBox;
432
- // /
433
- // / struct FillOp {
434
- // / const CoordBBox bbox;
435
- // /
436
- // / FillOp(const CoordBBox& b): bbox(b) {}
437
- // /
438
- // / template<typename GridT>
439
- // / void operator()(typename GridT::Ptr grid) const {
440
- // / using ValueT = typename GridT::ValueType;
441
- // / grid->fill(bbox, ValueT(1));
442
- // / }
443
- // / };
444
- // /
445
- // / CoordBBox bbox(Coord(0,0,0), Coord(10,10,10));
446
- // / processTypedScalarGrid(myGridPtr, FillOp(bbox));
447
- // / @endcode
448
- // /
449
- // / @return @c false if the grid type is unknown or non-scalar.
450
- // / @deprecated Use UTvdbProcessTypedGridScalar() or GEOvdbProcessTypedGridScalar() instead.
451
- template <typename GridPtrType, typename OpType>
452
- OPENVDB_DEPRECATED
453
- bool
454
- processTypedScalarGrid (GridPtrType grid, OpType& op)
455
- {
456
- using namespace openvdb ;
457
- if (grid->template isType <FloatGrid>()) doProcessTypedGrid<FloatGrid>(grid, op);
458
- else if (grid->template isType <DoubleGrid>()) doProcessTypedGrid<DoubleGrid>(grid, op);
459
- else if (grid->template isType <Int32Grid>()) doProcessTypedGrid<Int32Grid>(grid, op);
460
- else if (grid->template isType <Int64Grid>()) doProcessTypedGrid<Int64Grid>(grid, op);
461
- else return false ; // /< @todo throw exception ("grid type is not scalar")
462
- return true ;
463
- }
464
-
465
308
} // namespace openvdb_houdini
466
309
467
310
#endif // OPENVDB_HOUDINI_UTILS_HAS_BEEN_INCLUDED
0 commit comments