I'll just write as my mind goes.
In other words, what does this additional class bring?
Mainly a better consistency between the two different high and low level APIs.
I think that Hiura idea is to avoid having SetTexture and SetTransform on Window so that it doesn't interfere with Sprites transformations.
Yes, but also to have the same code structure on both sprites/texts/... and meshes.
We can achieve the same effect with a Draw taking 3 arguments, instead of an extra class
From SFML point of view it would be the same. But from the user point of view it would be a little bit different : for example if you're storing your graphical object in a vector then you need to store a tuple of three object instead of only one.
As I write these lines I realize that most people wouldn't store graphics object directly but instead have classed like this one :
class XYZ {
sf::Mesh myMesh;
sf::Tranform myTrans;
:
:
So when it comes to storing data it don't change much between the wrapping DrawableMesh class and the three-arguments Draw method.
But I don't like the idea, what if we want to use the same texture or the same transformation for several maps? We'd have to repeatedly apply the texture and transformation.
Are you thinking that performance will be an issue with this system ? I don't think so because it's very rare to keep the same texture / transformation to draw several objects. If I'm not wrong on that last fact the performance shouldn't be a issue in most cases.
Even if you have a lot of objects with the same texture then you need a very specific data structure to take part of this new system. And even with this data structure I think most user will call SetTexture even if it's not necessary just in case they have a flaw in on of their application module. (Ok, this is not a good argument because this would be a mistake to proceed like this and not fix the bug.)
My point is their wouldn't be so much different (performance-speaking or program-design-speaking) between calling window.SetTexture when drawing and drawableMesh.SetTexture when setting up the dm object.
Therefore, following your idea, the DrawableMesh class would store a pointer to a texture and a copy of a transform and a mesh. But how would they be accessed after the object is constructed? Wouldn't it be too verbose, compared to just storing the 3 objects (texture/mesh/transform) separately? You would have to get/set them everytime you want to change them
Yes, unfortunately. Because duplicating the API and add Scale, Rotate, ... to DrawableMesh would be a bad idea.
This isn't the best solution.
Definitely not, I agree.
So the Draw(mesh, texture, tranform) looks better than my idea. It also look consistent with Draw(sprite) if Sprite have their own Texture and Tranform. (Mixing window.Set[Texture|Transform]+window.Draw(mesh) and window.Draw(sprite) is confusing for me too.)
Maybe to add more flexibility to Draw(mesh, texture, tranform) version (let's call it gsaurus' idea for convenience if you don't mind) RenderTarget can have these overloads :
Draw(Mesh, Transform, Texture) // update current Texture and Transform
Draw(Mesh, Transform) // keep current Texture
Draw(Mesh, Texture) // keep Texture
Draw(Mesh) // keep both
Draw(Sprite/Text/...) // Use sprite's Transform and Texture
But the last one has still something confusing : does it update or keep the current Texture and Transform ? It would be easy if Sprite-like doesn't own their Transform and Texture. So is it possible ? It's possible only if all sprite-like have both Texture and Transform without specific requirement.
Can a Text have a specific texture ? (Would it be feasible for the implementation to display an image "in" the text's characters ?) Yes, I think so.
Because every sprite-like can have both Transform and Texture and doesn't have any specific requirement on these (or did I miss something there ?) I think sprite-like shouldn't have their own Transform and Texture.
To sum up my thoughts :I agree that the DrawableMesh is not a good idea and that having these overload in RenderTarget should keep things consistent between the two high and low APIs :
Draw(Mesh, Transform, Texture) // update current Texture and Transform
Draw(Mesh, Transform) // keep current Texture
Draw(Mesh, Texture) // keep current Transform
Draw(Mesh) // keep both
Draw(Sprite/Text/..., Transform, Texture) // update current Texture and Transform
Draw(Sprite/Text/..., Transform) // keep current Texture
Draw(Sprite/Text/..., Texture) // keep current Transform
Draw(Sprite/Text/...) // keep both
And if one doesn't want any texture he/she can call Draw(mesh or sprite-like, 0) or Draw(mesh or sprite-like, transform, 0) depending on the need to change the transformation.