1 #ifndef SCENE_GENERATOR_H
2 #define SCENE_GENERATOR_H
22 struct AnimationPlaceholder {
23 std::string sprite_name;
30 struct MapRenderables {
31 std::vector<std::shared_ptr<Entity>> entities;
32 std::vector<AnimationPlaceholder> dynamic_animations;
35 struct DynamicAnimation {
36 std::shared_ptr<Entity> entity;
37 std::shared_ptr<Graphics::TileAnimator<SpriteMovementMotor::SpriteState>> animator;
40 std::weak_ptr<Graphics::TextureManager> texture_manager;
41 std::weak_ptr<Graphics::ShaderManager> shader_manager;
42 std::map<std::string, DynamicAnimation> dynamic_animations;
44 unsigned int ui_z_slots;
47 Graphics::VertexData generateBasisTile(
const unsigned int base_width,
const unsigned int base_height,
const unsigned int current_width,
const unsigned int current_height,
const unsigned int x_pos = 0,
const unsigned int y_pos = 0,
const unsigned int offset_x = 0,
const unsigned int offset_y = 0);
48 std::shared_ptr<Graphics::BaseTexture> textureFromTileset(
const Tmx::Tileset* tileset,
const std::string& path);
49 std::shared_ptr<Graphics::BaseTexture> normalTextureFromTileset(
const Tmx::Tileset* tileset,
const std::string& path);
50 std::shared_ptr<Graphics::BaseTexture> displacementTextureFromTileset(
const Tmx::Tileset* tileset,
const std::string& path);
51 std::vector<glm::vec2> generateTextureCoords(
const Tmx::TileLayer* layer,
const unsigned int x_pos,
const unsigned int y_pos,
const unsigned int texture_width,
const unsigned int texture_height,
const unsigned int tile_width,
const unsigned int tile_height);
52 std::vector<glm::vec3> generateVertexCoords(
const unsigned int base_width,
const unsigned int base_height,
const unsigned int current_width,
const unsigned int current_height,
const unsigned int x_pos = 0,
const unsigned int y_pos = 0,
const unsigned int offset_x = 0,
const unsigned int offset_y = 0);
55 MapRenderables createRenderablesFromMap(
const unsigned int patch_width_tiles,
const unsigned int patch_height_tiles,
const Map& map);
56 std::vector<std::shared_ptr<Entity>> createStaticallyAnimatedTilesFromMap(
const Map& map);
57 std::map<std::string, DynamicAnimation> createAnimationsFromAnimationMap(
const Map& map);
58 std::vector<std::shared_ptr<Component>> createLightsFromMap(
const Map& map);
59 std::shared_ptr<Physics::CollisionData> createCollisionDataFromMap(
const Map& map);
63 float calculateZ(
unsigned int layer_index,
unsigned int layers_total);
77 SceneGenerator(
const Map& animation_index, std::shared_ptr<Graphics::TextureManager> texture_manager, std::shared_ptr<Graphics::ShaderManager> shader_manager,
const unsigned int ui_z_slots);
102 std::shared_ptr<Scene>
createSceneFromMap(
const unsigned int patch_width_tiles,
const unsigned int patch_height_tiles,
const Map& map);
SceneGenerator & operator=(const SceneGenerator &other)=default
SceneGenerator equal operator.
SpriteState
Sprite state enum.
Definition: sprite_movement.h:21
Class for vertex data.
Definition: vertex_data.h:17
std::string getStrippedMapName(const std::string path)
Strips path specification from map name.
Definition: scene_generator.cpp:668
std::shared_ptr< Entity > getDynamicEntityByName(const std::string &name)
Gets a dynamic entity by name.
Definition: scene_generator.cpp:310
std::vector< std::string > getDynamicEntityNames() const noexcept
Gets all dynamic entity names.
Definition: scene_generator.cpp:319
Class wrapper for Tmx::Map.
Definition: map.h:11
Definition: scene_generator.h:19
~SceneGenerator()
Definition: scene_generator.cpp:24
std::shared_ptr< Scene > createSceneFromMap(const unsigned int patch_width_tiles, const unsigned int patch_height_tiles, const Map &map)
Creates a scene from a map.
Definition: scene_generator.cpp:276