class Object {
string name;
uint32 instanceId;
};
class Component : public Object {
GameObject *gameObject;
uint32 typeId;
}; // 44 bytes total in size
class Transform : public Component {
Vector2 localPosition; // 52 bytes
Vector2 localScale; // 60 bytes
Transform *parent; // 64 bytes
// Are we not aligned on a 16 bytes boundary here?
Matrix4 worldMatrix; // holds 4 vector 4s (which wrap __m128)
std::unordered_map<tbdString, tbdTransform*> children;
tbdVector2 worldPosition;
tbdVector2 worldScale;
float32 localRotation;
float32 worldRotation;
bool isDirty;
uint8 __pad[15] // -- total of 256 bytes
};
Unfortunately, despite trying to ensure the worldMatrix was aligned on a proper boundary, it still breaks. I tried overriding new/delete and using an Aligned version of malloc/free, but that would break in Object's constructor. Do I need to just implement object and component as an interface or an abstract class so I can reorder the structure of the concrete class the way I want/need to? Also, why is this failing in its current form? Thanks in advance for the help. Intrinsics are still new to me.