Skip to content

Commit 75a4a87

Browse files
committed
Fixed rasterizeTrilinear function signature for MSVC
Signed-off-by: Nick Avramoussis <[email protected]>
1 parent 934a8ac commit 75a4a87

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

openvdb/openvdb/points/PointRasterizeTrilinear.h

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,29 @@ struct TrilinearTraits<ValueT, false>
4949
using TreeT = typename PointDataTreeT::template ValueConverter<ResultT>::Type;
5050
};
5151

52-
/// @brief Threaded method to perform a weighted rasterization of all points within a voxel
53-
/// @details Accumulates values and weights according to a simple 0-1-0 weighted hat function.
54-
/// This algorithm is an exact inverse of a trilinear interpolation and thus a key method
55-
/// used in PIC/FLIP style simulations. Returns a grid of the same precision as the input
56-
/// source attribute.
57-
///
58-
/// @tparam Staggered whether to perform a staggered rasterization
59-
/// @param points the PointDataGrid used to hold the point set to be rasterized
60-
/// @param attribute the name of the source attribute to rasterize
61-
/// @param exclude the group of names to exclude
52+
/// @brief Perform weighted trilinear rasterization of all points within a
53+
/// voxel. This method takes and returns a tree i.e. ignores grid
54+
/// transformations.
55+
/// @details Accumulates values and weights according to a simple 0-1-0 weighted
56+
/// hat function. This algorithm is an exact inverse of a trilinear
57+
/// interpolation and thus a key method used in PIC/FLIP style simulations.
58+
/// Returns a tree of the same precision as the input source attribute, but
59+
/// may be of a different math type depending on the value of the Staggered
60+
/// template attribute. If Staggered is true, this method produces values at
61+
/// each voxels negative faces, causing scalar attributes to produce
62+
/// math::Vec3<ValueT> tree types. The result Tree type is equal to:
63+
/// TrilinearTraits<ValueT, Staggered>::template TreeT<PointDataTreeT>
64+
/// @tparam Staggered whether to perform a staggered or collocated rasterization
65+
/// @tparam ValueT the value type of the point attribute to rasterize
66+
/// @param points the point tree to be rasterized
67+
/// @param attribute the name of the attribute to rasterize. Must be a scalar
68+
/// or Vec3 attribute.
69+
/// @param filter an optional point filter to use
6270
template <bool Staggered,
6371
typename ValueT,
6472
typename FilterT = NullFilter,
6573
typename PointDataTreeT = PointDataTree>
66-
inline typename TrilinearTraits<ValueT, Staggered>::template
67-
TreeT<PointDataTreeT>::Ptr
74+
inline auto
6875
rasterizeTrilinear(const PointDataTreeT& points,
6976
const std::string& attribute,
7077
const FilterT& filter = NullFilter());
@@ -326,14 +333,22 @@ struct CellCenteredTransfer :
326333
}
327334
};
328335

336+
// @note If building with MSVC we have to use auto to deduce the return type
337+
// due to a compiler bug. We can also use that for the public API - but
338+
// we explicitly define it in non-msvc builds to ensure the API remains
339+
// consistent
329340
template <bool Staggered,
330341
typename ValueT,
331342
typename CodecT,
332343
typename PositionCodecT,
333344
typename FilterT,
334345
typename PointDataTreeT>
335-
inline typename TrilinearTraits<ValueT, Staggered>::template
336-
TreeT<PointDataTreeT>::Ptr
346+
inline
347+
#ifndef _MSC_VER
348+
typename TrilinearTraits<ValueT, Staggered>::template TreeT<PointDataTreeT>::Ptr
349+
#else
350+
auto
351+
#endif
337352
rasterizeTrilinear(const PointDataTreeT& points,
338353
const size_t pidx,
339354
const size_t sidx,
@@ -372,8 +387,7 @@ template <bool Staggered,
372387
typename ValueT,
373388
typename FilterT,
374389
typename PointDataTreeT>
375-
inline typename TrilinearTraits<ValueT, Staggered>::template
376-
TreeT<PointDataTreeT>::Ptr
390+
inline auto
377391
rasterizeTrilinear(const PointDataTreeT& points,
378392
const std::string& attribute,
379393
const FilterT& filter)

0 commit comments

Comments
 (0)