[Bf-blender-cvs] [75ba9627e75] temp-explicit-colors: Renamed ColorGeometry to ColorGeometry4f.
Jeroen Bakker
noreply at git.blender.org
Mon Apr 19 15:39:14 CEST 2021
Commit: 75ba9627e7595ebf5b068f6224b7b6ba441b9db4
Author: Jeroen Bakker
Date: Mon Apr 19 07:47:13 2021 +0200
Branches: temp-explicit-colors
https://developer.blender.org/rB75ba9627e7595ebf5b068f6224b7b6ba441b9db4
Renamed ColorGeometry to ColorGeometry4f.
===================================================================
M source/blender/blenkernel/BKE_attribute_math.hh
M source/blender/blenkernel/intern/attribute_access.cc
M source/blender/blenkernel/intern/attribute_math.cc
M source/blender/blenkernel/intern/geometry_component_mesh.cc
M source/blender/blenlib/BLI_color.hh
M source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
M source/blender/functions/intern/cpp_types.cc
M source/blender/nodes/geometry/nodes/node_geo_attribute_clamp.cc
M source/blender/nodes/geometry/nodes/node_geo_attribute_color_ramp.cc
M source/blender/nodes/geometry/nodes/node_geo_attribute_compare.cc
M source/blender/nodes/geometry/nodes/node_geo_attribute_fill.cc
M source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc
M source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc
M source/blender/nodes/intern/node_geometry_exec.cc
M source/blender/nodes/intern/node_socket.cc
M source/blender/nodes/intern/type_conversions.cc
M source/blender/nodes/shader/nodes/node_shader_sepcombRGB.cc
M source/blender/nodes/shader/nodes/node_shader_valToRgb.cc
===================================================================
diff --git a/source/blender/blenkernel/BKE_attribute_math.hh b/source/blender/blenkernel/BKE_attribute_math.hh
index f6a93a7dbd2..c5272b04582 100644
--- a/source/blender/blenkernel/BKE_attribute_math.hh
+++ b/source/blender/blenkernel/BKE_attribute_math.hh
@@ -46,7 +46,7 @@ void convert_to_static_type(const CustomDataType data_type, const Func &func)
func(bool());
break;
case CD_PROP_COLOR:
- func(ColorGeometry());
+ func(ColorGeometry4f());
break;
default:
BLI_assert_unreachable();
@@ -91,12 +91,12 @@ inline float3 mix3(const float3 &weights, const float3 &v0, const float3 &v1, co
}
template<>
-inline ColorGeometry mix3(const float3 &weights,
- const ColorGeometry &v0,
- const ColorGeometry &v1,
- const ColorGeometry &v2)
+inline ColorGeometry4f mix3(const float3 &weights,
+ const ColorGeometry4f &v0,
+ const ColorGeometry4f &v1,
+ const ColorGeometry4f &v2)
{
- ColorGeometry result;
+ ColorGeometry4f result;
interp_v4_v4v4v4(result, v0, v1, v2, weights);
return result;
}
@@ -203,14 +203,14 @@ class SimpleMixerWithAccumulationType {
class ColorGeometryMixer {
private:
- MutableSpan<ColorGeometry> buffer_;
- ColorGeometry default_color_;
+ MutableSpan<ColorGeometry4f> buffer_;
+ ColorGeometry4f default_color_;
Array<float> total_weights_;
public:
- ColorGeometryMixer(MutableSpan<ColorGeometry> buffer,
- ColorGeometry default_color = {0, 0, 0, 1});
- void mix_in(const int64_t index, const ColorGeometry &color, const float weight = 1.0f);
+ ColorGeometryMixer(MutableSpan<ColorGeometry4f> buffer,
+ ColorGeometry4f default_color = {0, 0, 0, 1});
+ void mix_in(const int64_t index, const ColorGeometry4f &color, const float weight = 1.0f);
void finalize();
};
@@ -227,8 +227,8 @@ template<> struct DefaultMixerStruct<float2> {
template<> struct DefaultMixerStruct<float3> {
using type = SimpleMixer<float3>;
};
-template<> struct DefaultMixerStruct<ColorGeometry> {
- /* Use a special mixer for colors. ColorGeometry can't be added/multiplied, because this is not
+template<> struct DefaultMixerStruct<ColorGeometry4f> {
+ /* Use a special mixer for colors. ColorGeometry4f can't be added/multiplied, because this is not
* something one should usually do with colors. */
using type = ColorGeometryMixer;
};
diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc
index 0f79f9c386e..7c0ff5df873 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -60,7 +60,7 @@ const blender::fn::CPPType *custom_data_type_to_cpp_type(const CustomDataType ty
case CD_PROP_INT32:
return &CPPType::get<int>();
case CD_PROP_COLOR:
- return &CPPType::get<ColorGeometry>();
+ return &CPPType::get<ColorGeometry4f>();
case CD_PROP_BOOL:
return &CPPType::get<bool>();
default:
@@ -83,7 +83,7 @@ CustomDataType cpp_type_to_custom_data_type(const blender::fn::CPPType &type)
if (type.is<int>()) {
return CD_PROP_INT32;
}
- if (type.is<ColorGeometry>()) {
+ if (type.is<ColorGeometry4f>()) {
return CD_PROP_COLOR;
}
if (type.is<bool>()) {
@@ -310,7 +310,7 @@ ReadAttributeLookup CustomDataAttributeProvider::try_get_for_read(
case CD_PROP_INT32:
return this->layer_to_read_attribute<int>(layer, domain_size);
case CD_PROP_COLOR:
- return this->layer_to_read_attribute<ColorGeometry>(layer, domain_size);
+ return this->layer_to_read_attribute<ColorGeometry4f>(layer, domain_size);
case CD_PROP_BOOL:
return this->layer_to_read_attribute<bool>(layer, domain_size);
default:
@@ -344,7 +344,7 @@ WriteAttributeLookup CustomDataAttributeProvider::try_get_for_write(
case CD_PROP_INT32:
return this->layer_to_write_attribute<int>(layer, domain_size);
case CD_PROP_COLOR:
- return this->layer_to_write_attribute<ColorGeometry>(layer, domain_size);
+ return this->layer_to_write_attribute<ColorGeometry4f>(layer, domain_size);
case CD_PROP_BOOL:
return this->layer_to_write_attribute<bool>(layer, domain_size);
default:
diff --git a/source/blender/blenkernel/intern/attribute_math.cc b/source/blender/blenkernel/intern/attribute_math.cc
index 54fdcdf93a1..155b034b404 100644
--- a/source/blender/blenkernel/intern/attribute_math.cc
+++ b/source/blender/blenkernel/intern/attribute_math.cc
@@ -18,21 +18,21 @@
namespace blender::attribute_math {
-ColorGeometryMixer::ColorGeometryMixer(MutableSpan<ColorGeometry> output_buffer,
- ColorGeometry default_color)
+ColorGeometryMixer::ColorGeometryMixer(MutableSpan<ColorGeometry4f> output_buffer,
+ ColorGeometry4f default_color)
: buffer_(output_buffer),
default_color_(default_color),
total_weights_(output_buffer.size(), 0.0f)
{
- buffer_.fill(ColorGeometry(0, 0, 0, 0));
+ buffer_.fill(ColorGeometry4f(0, 0, 0, 0));
}
void ColorGeometryMixer::mix_in(const int64_t index,
- const ColorGeometry &color,
+ const ColorGeometry4f &color,
const float weight)
{
BLI_assert(weight >= 0.0f);
- ColorGeometry &output_color = buffer_[index];
+ ColorGeometry4f &output_color = buffer_[index];
output_color.r += color.r * weight;
output_color.g += color.g * weight;
output_color.b += color.b * weight;
@@ -44,7 +44,7 @@ void ColorGeometryMixer::finalize()
{
for (const int64_t i : buffer_.index_range()) {
const float weight = total_weights_[i];
- ColorGeometry &output_color = buffer_[i];
+ ColorGeometry4f &output_color = buffer_[i];
if (weight > 0.0f) {
const float weight_inv = 1.0f / weight;
output_color.r *= weight_inv;
diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc b/source/blender/blenkernel/intern/geometry_component_mesh.cc
index 31d1cba83a2..9ae30ef1fe6 100644
--- a/source/blender/blenkernel/intern/geometry_component_mesh.cc
+++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc
@@ -785,16 +785,16 @@ static void set_loop_uv(MLoopUV &uv, float2 co)
copy_v2_v2(uv.uv, co);
}
-static ColorGeometry get_loop_color(const MLoopCol &col)
+static ColorGeometry4f get_loop_color(const MLoopCol &col)
{
- ColorGeometry srgb_color;
+ ColorGeometry4f srgb_color;
rgba_uchar_to_float(srgb_color, &col.r);
- ColorGeometry linear_color;
+ ColorGeometry4f linear_color;
srgb_to_linearrgb_v4(linear_color, srgb_color);
return linear_color;
}
-static void set_loop_color(MLoopCol &col, ColorGeometry linear_color)
+static void set_loop_color(MLoopCol &col, ColorGeometry4f linear_color)
{
linearrgb_to_srgb_uchar4(&col.r, linear_color);
}
@@ -1132,8 +1132,8 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
CD_PROP_COLOR,
CD_MLOOPCOL,
corner_access,
- make_derived_read_attribute<MLoopCol, ColorGeometry, get_loop_color>,
- make_derived_write_attribute<MLoopCol, ColorGeometry, get_loop_color, set_loop_color>);
+ make_derived_read_attribute<MLoopCol, ColorGeometry4f, get_loop_color>,
+ make_derived_write_attribute<MLoopCol, ColorGeometry4f, get_loop_color, set_loop_color>);
static VertexGroupsAttributeProvider vertex_groups;
static CustomDataAttributeProvider corner_custom_data(ATTR_DOMAIN_CORNER, corner_access);
diff --git a/source/blender/blenlib/BLI_color.hh b/source/blender/blenlib/BLI_color.hh
index eb6257664bc..6dc467feba4 100644
--- a/source/blender/blenlib/BLI_color.hh
+++ b/source/blender/blenlib/BLI_color.hh
@@ -82,7 +82,7 @@ using ColorRender = Color4f<LinearRGB, eAlpha::Premultiplied>;
using ColorReference = Color4f<LinearRGB, eAlpha::Premultiplied>;
using ColorCompositor = Color4f<LinearRGB, eAlpha::Premultiplied>;
using ColorTheme = Color4b<Srgb, eAlpha::Straight>;
-using ColorGeometry = Color4f<LinearRGB, eAlpha::Premultiplied>;
+using ColorGeometry4f = Color4f<LinearRGB, eAlpha::Premultiplied>;
namespace color_transfers_ {
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
index 18c6a9d7d37..b2627be94a8 100644
--- a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
+++ b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
@@ -153,7 +153,7 @@ std::unique_ptr<ColumnValues> GeometryDataSource::get_column_values(
const std::string name = StringRef(column_id.name) + suffixes[column_id.index];
return column_values_from_function(
name, domain_size, [varray, axis = column_id.index](int index, CellValue &r_cell_value) {
- ColorGeometry value;
+ ColorGeometry4f value;
varray->get(index, &value);
r_cell_value.value_float = value[axis];
});
diff --git a/source/blender/functions/intern/cpp_types.cc b/source/blender/functions/intern/cpp_types.cc
index 5475f66c0cd..65fa39e353f 100644
--- a/source/blender/functions/intern/cpp_types.cc
+++ b/source/blender/functions/intern/cpp_types.cc
@@ -34,7 +34,7 @@ MAKE_CPP_TYPE(int32, int32_t)
MAKE_CPP_TYPE(uint32, uint32_t)
MAKE_CPP_TYPE(uint8, uint8_t)
-MAKE_CPP_TYPE(ColorGeometry, blender::ColorGeometry)
+MAKE_CPP_TYPE(ColorGeometry4f, blender::ColorGeometry4f)
// MAKE_CPP_TYPE(Color4b, blender::Color4b)
MAKE_CPP_TYPE(string, std::string)
diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_clamp.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_clamp.cc
index 23c11efed4f..0db6db7716f 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_clamp.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_clamp.cc
@@ -102,11 +102,11 @@ template<> inline float3 clamp_value(const float3 val, const f
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list