Blender
V5.0
source
blender
gpu
intern
gpu_vertex_format_normals.cc
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2025 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
5
#include "
BLI_math_vector_types.hh
"
6
#include "
BLI_span.hh
"
7
#include "
BLI_task.hh
"
8
9
#include "
GPU_attribute_convert.hh
"
10
11
namespace
blender::gpu
{
12
13
template
<
typename
GPUType>
14
static
void
convert_normals_impl
(
const
Span<float3>
src,
MutableSpan<GPUType>
dst)
15
{
16
threading::parallel_for
(src.
index_range
(), 2048, [&](
const
IndexRange
range) {
17
for (const int i : range) {
18
dst[i] = convert_normal<GPUType>(src[i]);
19
}
20
});
21
}
22
23
template
<>
void
convert_normals
(
const
Span<float3>
src,
MutableSpan<PackedNormal>
dst)
24
{
25
convert_normals_impl
(src, dst);
26
}
27
template
<>
void
convert_normals
(
const
Span<float3>
src,
MutableSpan<short4>
dst)
28
{
29
convert_normals_impl
(src, dst);
30
}
31
32
}
// namespace blender::gpu
BLI_math_vector_types.hh
BLI_span.hh
BLI_task.hh
GPU_attribute_convert.hh
blender::IndexRange
Definition
BLI_index_range.hh:50
blender::MutableSpan
Definition
BLI_span.hh:443
blender::Span
Definition
BLI_span.hh:74
blender::Span::index_range
constexpr IndexRange index_range() const
Definition
BLI_span.hh:401
blender::gpu
Definition
blf_internal_types.hh:32
blender::gpu::convert_normals_impl
static void convert_normals_impl(const Span< float3 > src, MutableSpan< GPUType > dst)
Definition
gpu_vertex_format_normals.cc:14
blender::gpu::convert_normals
void convert_normals(Span< float3 > src, MutableSpan< GPUType > dst)
blender::threading::parallel_for
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
Definition
BLI_task.hh:93
Generated on
for Blender by
doxygen
1.16.1