Landscape rendering
As you can observe in the C++ sample for this chapter, our aircraft travels continuously over a desert. This continuity can be achieved in many ways and with many different levels of detail and complexity. However, we chose to go in a very simple and yet effective way of doing it, using a feature that SFML provides out of the box.
SpriteNode
In order to display our background sprite through the scene graph, we created a new SceneNode
type, the SpriteNode
, which acts as a simple sf::Sprite
that can be plugged into our tree structure. Conveniently, this is all we need to make our landscape. We only have to create SpriteNode
and attach it to our background layer of the scene graph.
To demonstrate the implementation of a new node type, there follows a small snippet of the SpriteNode
declaration:
class SpriteNode : public SceneNode { public: explicit SpriteNode(const sf::Texture& texture); SpriteNode(const sf::Texture& texture,const...