1

So I have the following problem. I have an Asset base class. Then I have a Texture class that derives from it and from there I have VulkanTexture, OpenGLTexture and DirectXTexture that all inherit Texture. When serializing a Texture I only need the Texture itself(as it has the necessary virtual methods that can read/write the data) not the API specific one. I am serializing Assets and from there the Save(Archive, Texture) method is called automatically and I call archive(base_class<Asset>(texture)). Asset and Texture are registered types using CEREAL_REGISTER_TYPE and their relationship is also registered, but it seems I may need to register VulkanTexture and create a serialization function for it too. Is there a way around this as it requires quite a bit more 'useless' code as I would have to do it for a lot of classes?

0 Answers0