MeshChanged EventHandler is not called when single array elements are changed, arrays as attributes inside Mesh.cs
Example:
var cube = new Cube();
cube.Colors[2] = (uint)ColorUint.Red; // no event handler
var tmpArr = new uint[] { (uint)ColorUint.Red, (uint)ColorUint.Blue, ... }
cube.Colors = tmpArr; // event handler is called
Possible solution: Observable Collection
may fix: #456
To make things even worse:
CA1819: Properties should not return arrays
https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1819?view=vs-2019
Arrays returned by properties are not write-protected, even if the property is read-only. To keep the array tamper-proof, the property must return a copy of the array.
After consulting with @RedImp1470 pushed directly to develop with 66eece2f9769f08bb2a22108b38a03f708b7ea2d and f8ed74c4cc8d0e4261c311a18371c290921c30f7
The AABB is now being updated automatically.
Reversed commits as these changes are too broad to merge without review!
New feature branch.
I've implemented an ObservableArray<T> which can be used the same way as the arrays could be used before, however all Mesh attributes are now readonly to prevent any shenanigans with vanishing EventListeners when assigning a new array to an attribute. To assign a new value, a user needs to call the Assign() method, which takes care of everything, as the implicit operator needs to be static and can't be used in this case.
Second try: #533
See #605