19 template<
typename Func>
30 using T =
typename decltype(type_tag)::
type;
31 if constexpr (std::is_same_v<T, void>) {
41 template<
typename Func>
59 return static_cast<int8_t>(std::round(weights.x * v0 + weights.y *
v1 + weights.z *
v2));
62 template<>
inline bool mix3(
const float3 &weights,
const bool &v0,
const bool &
v1,
const bool &
v2)
64 return (weights.x * v0 + weights.y *
v1 + weights.z *
v2) >= 0.5f;
67 template<>
inline int mix3(
const float3 &weights,
const int &v0,
const int &
v1,
const int &
v2)
69 return static_cast<int>(std::round(weights.x * v0 + weights.y *
v1 + weights.z *
v2));
73 inline float mix3(
const float3 &weights,
const float &v0,
const float &
v1,
const float &
v2)
75 return weights.x * v0 + weights.y *
v1 + weights.z *
v2;
81 return weights.x * v0 + weights.y *
v1 + weights.z *
v2;
87 return weights.x * v0 + weights.y *
v1 + weights.z *
v2;
110 const float4 mixed = v0_f * weights[0] + v1_f * weights[1] + v2_f * weights[2];
112 static_cast<uint8_t>(mixed[1]),
113 static_cast<uint8_t>(mixed[2]),
114 static_cast<uint8_t>(mixed[3])};
125 template<
typename T>
T mix2(
float factor,
const T &
a,
const T &
b);
127 template<>
inline bool mix2(
const float factor,
const bool &
a,
const bool &
b)
129 return ((1.0f - factor) *
a + factor *
b) >= 0.5f;
134 return static_cast<int8_t>(std::round((1.0f - factor) *
a + factor *
b));
137 template<>
inline int mix2(
const float factor,
const int &
a,
const int &
b)
139 return static_cast<int>(std::round((1.0f - factor) *
a + factor *
b));
142 template<>
inline float mix2(
const float factor,
const float &
a,
const float &
b)
144 return (1.0f - factor) *
a + factor *
b;
191 : buffer_(
buffer), default_value_(default_value), total_weights_(
buffer.size(), 0.0f)
194 memset(buffer_.
data(), 0,
sizeof(
T) * buffer_.
size());
203 buffer_[index] += value * weight;
204 total_weights_[index] += weight;
213 const float weight = total_weights_[i];
215 buffer_[i] *= 1.0f / weight;
218 buffer_[i] = default_value_;
248 void mix_in(
const int64_t index,
const bool value, [[maybe_unused]]
const float weight = 1.0f)
250 buffer_[index] |= value;
265 template<
typename T,
typename AccumulationT, T (*ConvertToT)(const AccumulationT &value)>
270 AccumulationT value = {0};
280 : buffer_(
buffer), default_value_(default_value), accumulation_buffer_(
buffer.size())
286 const AccumulationT converted_value =
static_cast<AccumulationT
>(value);
287 Item &item = accumulation_buffer_[index];
288 item.value += converted_value * weight;
289 item.weight += weight;
295 const Item &item = accumulation_buffer_[i];
296 if (item.weight > 0.0f) {
297 const float weight_inv = 1.0f / item.weight;
298 const T converted_value = ConvertToT(item.value * weight_inv);
299 buffer_[i] = converted_value;
302 buffer_[i] = default_value_;
359 return static_cast<int>(std::round(value));
368 return value >= 0.5f;
378 return static_cast<int8_t>(std::round(value));
typedef float(TangentPoint)[2]
CustomData interface, see also DNA_customdata_types.h.
#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 type
_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
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
ATTR_WARN_UNUSED_RESULT const BMVert * v2
void to_static_type_tag(const Fn &fn) const
constexpr int64_t size() const
constexpr void fill(const T &value)
constexpr IndexRange index_range() const
constexpr T * data() const
BooleanPropagationMixer(MutableSpan< bool > buffer)
void mix_in(const int64_t index, const bool value, [[maybe_unused]] const float weight=1.0f)
ColorGeometry4bMixer(MutableSpan< ColorGeometry4b > buffer, ColorGeometry4b default_color=ColorGeometry4b(0, 0, 0, 255))
void mix_in(int64_t index, const ColorGeometry4b &color, float weight=1.0f)
ColorGeometry4fMixer(MutableSpan< ColorGeometry4f > buffer, ColorGeometry4f default_color=ColorGeometry4f(0.0f, 0.0f, 0.0f, 1.0f))
void mix_in(int64_t index, const ColorGeometry4f &color, float weight=1.0f)
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={})
SyclQueue void void size_t num_bytes void
ccl_global float * buffer
typename DefaultMixerStruct< T >::type DefaultMixer
T mix3(const float3 &weights, const T &v0, const T &v1, const T &v2)
typename DefaultPropatationMixerStruct< T >::type DefaultPropatationMixer
void convert_to_static_type(const CPPType &cpp_type, const Func &func)
T mix2(float factor, const T &a, const T &b)
const blender::CPPType * custom_data_type_to_cpp_type(const eCustomDataType type)
T interpolate(const T &a, const T &b, const FactorT &t)
vec_base< float, 3 > float3
vec_base< float, 2 > float2
ColorSceneLinearByteEncoded4b< eAlpha::Premultiplied > ColorGeometry4b
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static bool float_to_bool(const float &value)
static int8_t float_to_int8_t(const float &value)
static int double_to_int(const double &value)
typename DefaultMixerStruct< T >::type type