Is it possible to have multiple sf::Transforms (rotations and scales) for one renderstate? Each transform would have to correspond with one quad in a vertex array and each vertex quad would have a unique center point based on its texture. I am asking this because I need to rotate, scale, (and possibly translate though that is not as important) each vertex quad in a VertexArray around its own center point instead of around one center point.
In the code below I was able to resize my robot (the red figure in the image below) but not rotate the 22 layers that make up the robot around their own center point. Instead, they were rotated around the head of the robot as you can see below.
sf::Texture* tex = new sf::Texture;
tex->loadFromFile("spritesheet.png");
sf::RenderStates rendState;
//tile Width and Height
//all the tiles are the same size
float tileWH = tex->getSize().y;
rendState.texture = tex;
for (int j = 0; j < 22; j++) {
int i = (22 - j);
float yVal = (350.0f + (i*0.8f));
float left = xVal;
float top = yVal;
sf::Vertex * quad = &verticies[j * 4];
quad[0].position = sf::Vector2f(left, top + tileWH);
quad[1].position = sf::Vector2f(left, top);
quad[2].position = sf::Vector2f(left + tileWH, top);
quad[3].position = sf::Vector2f(left + tileWH, top + tileWH);
quad[0].texCoords = sf::Vector2f(tileWH*i, tileWH);
quad[1].texCoords = sf::Vector2f(tileWH*i, 0.0f);
quad[2].texCoords = sf::Vector2f(tileWH*i + tileWH, 0.0f);
quad[3].texCoords = sf::Vector2f(tileWH*i + tileWH, tileWH);
sf::Transform transform;
sf::Transform secondTransfrom;
sf::Vector2f center = sf::Vector2f((tileWH / (2.0f)) + left, (tileWH / (2.0f)) + top);
//rotation is only around the head of the robot instead of each image layer
secondTransfrom.rotate(angle, center);
//scaling is working
transform.scale(sf::Vector2f(5.0f, 5.0f), center);
rendState.transform *= secondTransfrom;
rendState.transform *= transform;
*/
}
window->draw(verticies, rendState);
: