-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
In some cases such as material classes in Vulkan or OpenGL based applications, we may want to have some packed data that can be copied to a Uniform Buffer Object (UBO). Using Property members does not allow this as the signals are also interleaved in the memory layout of the containing class.
Would it make sense and be feasible to offer a RefProperty (name open to improvement) that acts just like a Property (signals and can participate in binding expressions) but which reads and writes data to a provided reference.
Consider:
class Material
{
public:
Property<vec3> baseColor;
Property<float> metal;
Property<float> roughness;
Property<float> ambientOcclusion;
};
This is not good to transform into a UBO that would like to layout data like:
struct UboMaterialData {
vec3 baseColor;
vec3 metalRoughAoFactors;
};
Would this alternative make sense and be feasible?
class Material
{
public:
RefProperty<vec3> baseColor{ &d.baseColor };
RefProperty<float> metal{ &d.metalRoughAoFactors.x };
RefProperty<float> roughness{ &d.metalRoughAoFactors.y };
RefProperty<float> ambientOcclusion{ &d.metalRoughAoFactors.z };
private:
UboMaterialData d;
};
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels