It turns out that our current serialization method for collider shapes (based on erased-serde) is twice as slow as the serialization of shapes represented as enums. Therefore, this PR adds a methods to all Shape in order to transform them to an enum TypedShape which can then be serialized more efficiently. This also simplifies the serialization/deserialization code significantly.
Now TypedShape is kind of a more descriptive enum than the existing ShapeType, so we may want to get rid of ShapeType in the future. Though I'm keeping that change for another PR since I want to think about a little more considering ShapeType can be converted to an integer which can be useful for collision dispatch( even though we don't use it currently).
While adding the TypedShape enum, I also fixed the ShapeType enum to add the Custom variant.
Fix #3.
It turns out that our current serialization method for collider shapes (based on
erased-serde
) is twice as slow as the serialization of shapes represented as enums. Therefore, this PR adds a methods to allShape
in order to transform them to an enumTypedShape
which can then be serialized more efficiently. This also simplifies the serialization/deserialization code significantly.Now
TypedShape
is kind of a more descriptive enum than the existingShapeType
, so we may want to get rid ofShapeType
in the future. Though I'm keeping that change for another PR since I want to think about a little more consideringShapeType
can be converted to an integer which can be useful for collision dispatch( even though we don't use it currently).While adding the
TypedShape
enum, I also fixed theShapeType
enum to add theCustom
variant. Fix #3.