Currently, Vector3
has some strange behavior when compared to other vector and color classes. It is the only vector/color class that uses internal coordinates (_x
, _y
, _z
) and tracks when they are updated. All of its methods then read from the internal coordinates, and external access is done on the getters (x
, y
, z
), which could impact performance.
When it comes to the Tensor API, Vector3
is not compatible with its interface, IVector3Like
, but all of the other vector and color classes are. While this is not an issue when working only with Vector3
instances, when working with the interface (IVector3Like
), this quickly creates problems for developers as they must implement every static method they use. This highlights that IVector3Like
is not really supported, while many of the other I*Like
interfaces just work. IVector3Like
should just work with a Vector3
class, but due to Vector3
’s static methods using the internal coordinate members, IVector3Like
is incompatible.
I propose a new class, Vector3Dirty
(though any other name would work), which operates on the x
, y
, and z
members of Vector3Dirty
and IVector3Like
. This class would not have “dirty tracking”, which would speed up performance both for the methods and for users. This class is compatible with Vector3
, Vector3Dirty
, and IVector3Like
, making it a solid choice when a developer does not need dirty tracking but desires compatibility with IVector3Like
.
@Deltakosh Requested we talk about this on the forum first.