As an aside, it's a shame SFML 2 can't drop the non-C++11 support. Because std::array would be a useful C++ standard structure for the previous array discussion.
I think the signature
template <typename T>
void setParameterArray(const std::string& name, const T* array, std::size_t length);
should be okay, then the user can have a
std::vector, a
std::array, a raw array or anything else that stores its elements contiguously.
Should we add sf::Vector4<T> while we're at it? I'm fine with using wrapper classes as long as we do it consistently.
I see your point of consistency, but 4D vectors currently don't have any use case outside the shader.
I would prefer the Matrix type stores its values, partly because that's least likely to surprise people, partly because it seems more flexible, and partly because that's what the Vector types do.
Right, storing the values would allow the user to pass around matrix objects with value semantics.
I'm unsure about hiding Matrix inside the Shader namespace because the Vectors don't do that
I'm not sure whether we should orient ourselves too much on the vectors. Their primary purpose is to act as a coordinate abstraction in rendering (2D) and audio (3D),
sf::Shader::setParameter only provides overloads taking them for convenience. We do not have a
sf::Vector<N>, for example.
What's more important to me is keeping in mind that there may be further uniform types that could have their own wrappers -- now there is already
sf::Shader::CurrentTextureType, and one possibility is to define something similar to
sf::Shader::Matrix for GLSL structs/arrays in the future. It makes sense if that is logically aggregated within
sf::Shader.
and the Vectors already have the "where are the linear algebra functions?" problem. Would having Matrices too really make it any worse? Not to mention sf::Transform essentially is a Matrix with a couple of those lin alg functions defined.
At the moment, SFML provides more or less exactly the linear algebra functions that it needs itself in the public API.
sf::Transform is specialized to 2D rendering with one size, and provides several convenience functions related to 2D transforms. I don't see why SFML should provide a generic, general-purpose matrix class if there are libraries that do it in a much better way.