29 template<
typename Func>
65 template<>
inline bool mix3(
const float3 &weights,
const bool &v0,
const bool &
v1,
const bool &
v2)
67 return (weights.
x * v0 + weights.
y *
v1 + weights.
z *
v2) >= 0.5f;
70 template<>
inline int mix3(
const float3 &weights,
const int &v0,
const int &
v1,
const int &
v2)
72 return static_cast<int>(weights.
x * v0 + weights.
y *
v1 + weights.
z *
v2);
76 inline float mix3(
const float3 &weights,
const float &v0,
const float &
v1,
const float &
v2)
78 return weights.
x * v0 + weights.
y *
v1 + weights.
z *
v2;
84 return weights.
x * v0 + weights.
y *
v1 + weights.
z *
v2;
90 return weights.
x * v0 + weights.
y *
v1 + weights.
z *
v2;
123 : buffer_(
buffer), default_value_(default_value), total_weights_(
buffer.size(), 0.0f)
126 memset(buffer_.
data(), 0,
sizeof(
T) * buffer_.
size());
135 buffer_[index] += value * weight;
136 total_weights_[index] += weight;
145 const float weight = total_weights_[i];
147 buffer_[i] *= 1.0f / weight;
150 buffer_[i] = default_value_;
158 template<
typename T,
typename AccumulationT, T (*ConvertToT)(const AccumulationT &value)>
163 AccumulationT value = {0};
173 : buffer_(
buffer), default_value_(default_value), accumulation_buffer_(
buffer.size())
179 const AccumulationT converted_value =
static_cast<AccumulationT
>(value);
180 Item &item = accumulation_buffer_[index];
181 item.value += converted_value * weight;
182 item.weight += weight;
188 const Item &item = accumulation_buffer_[i];
189 if (item.weight > 0.0f) {
190 const float weight_inv = 1.0f / item.weight;
191 const T converted_value = ConvertToT(item.value * weight_inv);
192 buffer_[i] = converted_value;
195 buffer_[i] = default_value_;
234 return static_cast<int>(value);
243 return value >= 0.5f;
typedef float(TangentPoint)[2]
#define BLI_assert_unreachable()
#define BLI_STATIC_ASSERT(a, msg)
void interp_v4_v4v4v4(float p[4], const float v1[4], const float v2[4], const float v3[4], const float w[3])
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
ATTR_WARN_UNUSED_RESULT const BMVert * v2
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr T * data() const
void mix_in(const int64_t index, const Color4f &color, const float weight=1.0f)
Color4fMixer(MutableSpan< Color4f > buffer, Color4f default_color={0, 0, 0, 1})
void mix_in(const int64_t index, const T &value, const float weight=1.0f)
SimpleMixerWithAccumulationType(MutableSpan< T > buffer, T default_value={})
void mix_in(const int64_t index, const T &value, const float weight=1.0f)
SimpleMixer(MutableSpan< T > buffer, T default_value={})
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
typename DefaultMixerStruct< T >::type DefaultMixer
T mix3(const float3 &weights, const T &v0, const T &v1, const T &v2)
void convert_to_static_type(const CustomDataType data_type, const Func &func)
static bool float_to_bool(const float &value)
static int double_to_int(const double &value)