Fix #119270: Multires color attribute fallback drawing changed to black

Before e05c36f56d the fallback for unsupported attributes was
white. That's arbitrary, but not worth changing.
This commit is contained in:
Hans Goudey
2024-03-11 10:41:31 -04:00
parent 95810eec8f
commit 8b9abd09c8

View File

@@ -314,6 +314,21 @@ static const CustomData *get_cdata(bke::AttrDomain domain, const PBVH_GPU_Args &
}
}
template<typename T> T fallback_value_for_fill()
{
return T();
}
template<> ColorGeometry4f fallback_value_for_fill()
{
return ColorGeometry4f(1.0f, 1.0f, 1.0f, 1.0f);
}
template<> ColorGeometry4b fallback_value_for_fill()
{
return fallback_value_for_fill<ColorGeometry4f>().encode();
}
struct PBVHBatches {
Vector<PBVHVbo> vbos;
Map<std::string, PBVHBatch> batches;
@@ -584,7 +599,7 @@ struct PBVHBatches {
using VBOType = typename Converter::VBOType;
std::fill_n(static_cast<VBOType *>(GPU_vertbuf_get_data(vbo.vert_buf)),
GPU_vertbuf_get_vertex_len(vbo.vert_buf),
VBOType());
Converter::convert(fallback_value_for_fill<T>()));
});
}
}