Thank you for the answer,
What about the second example? In case it wasn't clear what I meant, here's an example:
struct TransformableStruct1 : public sf::Transformable, public sf::Drawable {
sf::RectangleShape shape = sf::RectangleShape({ 100.f, 100.f });
void draw(sf::RenderTarget& target, sf::RenderStates states) const override {
states.transform *= getTransform();
target.draw(shape, states);
}
};
struct TransformableStruct2 : public sf::Transformable, public sf::Drawable {
TransformableStruct1 ts1;
void draw(sf::RenderTarget& target, sf::RenderStates states) const override {
states.transform *= getTransform();
target.draw(ts1, states);
}
};
struct TransformableStruct3 : public sf::Transformable, public sf::Drawable {
TransformableStruct1 ts2;
void draw(sf::RenderTarget& target, sf::RenderStates states) const override {
states.transform *= getTransform();
target.draw(ts2, states);
}
};
struct FinalStruct final : public sf::Transformable, public sf::Drawable
{
TransformableStruct3 ts3;
void draw(sf::RenderTarget& target, sf::RenderStates states) const override
{
states.transform *= getTransform();
target.draw(ts3, states);
}
};
In order to draw FinalStruct object, transform has to be multiplied 4 times (
states.transform *= getTransform(); lines). Could the final result of those multiplications be incorrect, if there's a lot of them, as small precision errors get carried over?
Secondly, how can I ensure the values in transform matrix are low enough, as there's no way to check them as far as I know?
By the way, is there a specific math and physics library you would recommend for this case?
Thanks