I have written packing problem code whiich fills 2d grid with various shapes (each shape itself represents as 2d grid) and it is working fine.
However now i want to port this to Job System and ill be using a struct instead of shape class, shape class itself is complex as it contains not just 2d grid to represent shape, but also some other values.
Now my question is coming from OOP Mindset,
that if i loop on shapes array, then backtrack then loop on shape, so each time ill b copying the struct instead of referencing it, will it be slow or fast?
Coming from OOP mindset myself the way it worked out for me is that I “encapsulated” my class data into other various structs. So instead of 100 tile objects in an array I created structs for data that I perform operations on. So for instance I might have tile position struct that I perform a perlin noise function on and the output is the result of the perlin noise function but the indexes for both the input data and output data point to the same tile. So I guess you could think that the data is stretched out horizontally in such a way that you can perform discrete operations (jobs) on that data.
To your question I didn’t quite understand if you still had a shapes class and were trying to use it still or not. My advice (which was hard for me as well) would be to get rid of your shape class if you can and use lists of structs organized in such a way where when you perform operations on the data that only the data you need is used.
Thank you very much for your detailed reply I realy liked the following approeach suggested by you.
“So I guess you could think that the data is stretched out horizontally in such a way that you can perform discrete operations (jobs) on that data.”