diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-07-15 15:18:30 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-07-15 15:23:35 +0300 |
commit | e8f8c13d4b76ba587ef7cf33370b286d4fbd36bc (patch) | |
tree | 371472ae220ad8740b310aaa8f4c5746448302c5 /source/blender/blenlib/BLI_span.hh | |
parent | 0c062a9e082130212447c2b67e8e16b8a2e622d1 (diff) | |
parent | 44bb73e765a6f79bc14a46449368f83e572d8bad (diff) |
PointCloud: Initial rendering support for Workbenchtmp-pointcloud-render
Also includes outline overlays. Removes the temp overlay drawing
We make the geometry follow camera like billboards this uses less
geometry. Currently we use half octahedron for now. Goal would be
to use icospheres.
This patch also optimize the case when pointcloud has uniform radius.
However we should premultiply the radius prop by the default radius
beforehand to avoid a multiplication on CPU.
Differential Revision: https://developer.blender.org/D8301
Diffstat (limited to 'source/blender/blenlib/BLI_span.hh')
-rw-r--r-- | source/blender/blenlib/BLI_span.hh | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/source/blender/blenlib/BLI_span.hh b/source/blender/blenlib/BLI_span.hh index 92d3124e01d..57ef9ce9eb6 100644 --- a/source/blender/blenlib/BLI_span.hh +++ b/source/blender/blenlib/BLI_span.hh @@ -100,6 +100,11 @@ template<typename T> class Span { { } + template<typename U, typename std::enable_if_t<is_convertible_pointer_v<U, T>> * = nullptr> + Span(const U *start, uint size) : start_((const T *)start), size_(size) + { + } + /** * Reference an initializer_list. Note that the data in the initializer_list is only valid until * the expression containing it is fully computed. @@ -128,9 +133,8 @@ template<typename T> class Span { * Span<T *> -> Span<const T *> * Span<Derived *> -> Span<Base *> */ - template<typename U, - typename std::enable_if<std::is_convertible<U *, T>::value>::type * = nullptr> - Span(Span<U *> array) : Span((T *)array.data(), array.size()) + template<typename U, typename std::enable_if_t<is_convertible_pointer_v<U, T>> * = nullptr> + Span(Span<U> array) : start_((T *)array.data()), size_(array.size()) { } @@ -436,21 +440,6 @@ template<typename T> class MutableSpan { { } - /** - * Reference an initializer_list. Note that the data in the initializer_list is only valid until - * the expression containing it is fully computed. - * - * Do: - * call_function_with_array({1, 2, 3, 4}); - * - * Don't: - * MutableSpan<int> span = {1, 2, 3, 4}; - * call_function_with_array(span); - */ - MutableSpan(std::initializer_list<T> &list) : MutableSpan(list.begin(), list.size()) - { - } - MutableSpan(std::vector<T> &vector) : MutableSpan(vector.data(), vector.size()) { } @@ -607,14 +596,6 @@ template<typename T> class MutableSpan { }; /** - * Shorthand to make use of automatic template parameter deduction. - */ -template<typename T> Span<T> ref_c_array(const T *array, uint size) -{ - return Span<T>(array, size); -} - -/** * Utilities to check that arrays have the same size in debug builds. */ template<typename T1, typename T2> void assert_same_size(const T1 &v1, const T2 &v2) |