Skip to content

Commit 95c9d1a

Browse files
committed
refactor: Shorten render entity class name in world render stage.
1 parent 09dc947 commit 95c9d1a

File tree

12 files changed

+36
-36
lines changed

12 files changed

+36
-36
lines changed

libopenage/gamestate/game_entity.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022-2023 the openage authors. See copying.md for legal info.
1+
// Copyright 2022-2024 the openage authors. See copying.md for legal info.
22

33
#include "game_entity.h"
44

@@ -30,7 +30,7 @@ entity_id_t GameEntity::get_id() const {
3030
return this->id;
3131
}
3232

33-
void GameEntity::set_render_entity(const std::shared_ptr<renderer::world::WorldRenderEntity> &entity) {
33+
void GameEntity::set_render_entity(const std::shared_ptr<renderer::world::RenderEntity> &entity) {
3434
// TODO: Transfer state from old render entity to new one?
3535

3636
this->render_entity = entity;

libopenage/gamestate/game_entity.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace openage {
1515

1616
namespace renderer::world {
17-
class WorldRenderEntity;
17+
class RenderEntity;
1818
}
1919

2020
namespace gamestate {
@@ -62,7 +62,7 @@ class GameEntity {
6262
*
6363
* @param entity New render entity.
6464
*/
65-
void set_render_entity(const std::shared_ptr<renderer::world::WorldRenderEntity> &entity);
65+
void set_render_entity(const std::shared_ptr<renderer::world::RenderEntity> &entity);
6666

6767
/**
6868
* Set the event manager of this entity.
@@ -142,7 +142,7 @@ class GameEntity {
142142
/**
143143
* Render entity for pushing updates to the renderer. Can be \p nullptr.
144144
*/
145-
std::shared_ptr<renderer::world::WorldRenderEntity> render_entity;
145+
std::shared_ptr<renderer::world::RenderEntity> render_entity;
146146

147147
/**
148148
* Event manager.

libopenage/renderer/demo/stresstest_0.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ void renderer_stresstest_0(const util::Path &path) {
147147
terrain0->update(terrain_size, tiles);
148148

149149
// World entities
150-
std::vector<std::shared_ptr<renderer::world::WorldRenderEntity>> render_entities{};
150+
std::vector<std::shared_ptr<renderer::world::RenderEntity>> render_entities{};
151151
auto add_world_entity = [&](const coord::phys3 initial_pos,
152152
const time::time_t time) {
153153
const auto animation_path = "./textures/test_tank_mirrored.sprite";

libopenage/renderer/demo/stresstest_1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ void renderer_stresstest_1(const util::Path &path) {
151151
// send the terrain data to the terrain renderer
152152
terrain0->update(terrain_size, tiles);
153153

154-
std::vector<std::shared_ptr<renderer::world::WorldRenderEntity>> render_entities{};
154+
std::vector<std::shared_ptr<renderer::world::RenderEntity>> render_entities{};
155155
auto add_world_entity = [&](const coord::phys3 initial_pos,
156156
const time::time_t time) {
157157
const auto animation_path = "./textures/test_tank_mirrored.sprite";

libopenage/renderer/render_factory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ std::shared_ptr<terrain::RenderEntity> RenderFactory::add_terrain_render_entity(
2323
return entity;
2424
}
2525

26-
std::shared_ptr<world::WorldRenderEntity> RenderFactory::add_world_render_entity() {
27-
auto entity = std::make_shared<world::WorldRenderEntity>();
26+
std::shared_ptr<world::RenderEntity> RenderFactory::add_world_render_entity() {
27+
auto entity = std::make_shared<world::RenderEntity>();
2828
this->world_renderer->add_render_entity(entity);
2929

3030
return entity;

libopenage/renderer/render_factory.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class RenderEntity;
1616

1717
namespace world {
1818
class WorldRenderStage;
19-
class WorldRenderEntity;
19+
class RenderEntity;
2020
} // namespace world
2121

2222
/**
@@ -55,7 +55,7 @@ class RenderFactory {
5555
*
5656
* @return Render entity for pushing terrain updates.
5757
*/
58-
std::shared_ptr<world::WorldRenderEntity> add_world_render_entity();
58+
std::shared_ptr<world::RenderEntity> add_world_render_entity();
5959

6060
private:
6161
/**

libopenage/renderer/stages/world/object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ WorldObject::WorldObject(const std::shared_ptr<renderer::resources::AssetManager
4343
last_update{0.0} {
4444
}
4545

46-
void WorldObject::set_render_entity(const std::shared_ptr<WorldRenderEntity> &entity) {
46+
void WorldObject::set_render_entity(const std::shared_ptr<RenderEntity> &entity) {
4747
this->render_entity = entity;
4848
this->fetch_updates();
4949
}

libopenage/renderer/stages/world/object.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Animation2dInfo;
2929
} // namespace resources
3030

3131
namespace world {
32-
class WorldRenderEntity;
32+
class RenderEntity;
3333

3434
/**
3535
* Stores the state of a renderable object in the World render stage.
@@ -49,7 +49,7 @@ class WorldObject {
4949
*
5050
* @param entity New world render entity.
5151
*/
52-
void set_render_entity(const std::shared_ptr<WorldRenderEntity> &entity);
52+
void set_render_entity(const std::shared_ptr<RenderEntity> &entity);
5353

5454
/**
5555
* Fetch updates from the render entity.
@@ -177,7 +177,7 @@ class WorldObject {
177177
* Entity that gets updates from the gamestate, e.g. the position and
178178
* requested animation data.
179179
*/
180-
std::shared_ptr<WorldRenderEntity> render_entity;
180+
std::shared_ptr<RenderEntity> render_entity;
181181

182182
/**
183183
* Reference ID for passing interaction with the graphic (e.g. mouse clicks) back to

libopenage/renderer/stages/world/render_entity.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010

1111
namespace openage::renderer::world {
1212

13-
WorldRenderEntity::WorldRenderEntity() :
14-
RenderEntity{},
13+
RenderEntity::RenderEntity() :
14+
renderer::RenderEntity{},
1515
ref_id{0},
1616
position{nullptr, 0, "", nullptr, SCENE_ORIGIN},
1717
angle{nullptr, 0, "", nullptr, 0},
1818
animation_path{nullptr, 0} {
1919
}
2020

21-
void WorldRenderEntity::update(const uint32_t ref_id,
22-
const curve::Continuous<coord::phys3> &position,
23-
const curve::Segmented<coord::phys_angle_t> &angle,
24-
const std::string animation_path,
25-
const time::time_t time) {
21+
void RenderEntity::update(const uint32_t ref_id,
22+
const curve::Continuous<coord::phys3> &position,
23+
const curve::Segmented<coord::phys_angle_t> &angle,
24+
const std::string animation_path,
25+
const time::time_t time) {
2626
std::unique_lock lock{this->mutex};
2727

2828
this->ref_id = ref_id;
@@ -40,10 +40,10 @@ void WorldRenderEntity::update(const uint32_t ref_id,
4040
this->last_update = time;
4141
}
4242

43-
void WorldRenderEntity::update(const uint32_t ref_id,
44-
const coord::phys3 position,
45-
const std::string animation_path,
46-
const time::time_t time) {
43+
void RenderEntity::update(const uint32_t ref_id,
44+
const coord::phys3 position,
45+
const std::string animation_path,
46+
const time::time_t time) {
4747
std::unique_lock lock{this->mutex};
4848

4949
this->ref_id = ref_id;
@@ -53,25 +53,25 @@ void WorldRenderEntity::update(const uint32_t ref_id,
5353
this->last_update = time;
5454
}
5555

56-
uint32_t WorldRenderEntity::get_id() {
56+
uint32_t RenderEntity::get_id() {
5757
std::shared_lock lock{this->mutex};
5858

5959
return this->ref_id;
6060
}
6161

62-
const curve::Continuous<coord::scene3> &WorldRenderEntity::get_position() {
62+
const curve::Continuous<coord::scene3> &RenderEntity::get_position() {
6363
std::shared_lock lock{this->mutex};
6464

6565
return this->position;
6666
}
6767

68-
const curve::Segmented<coord::phys_angle_t> &WorldRenderEntity::get_angle() {
68+
const curve::Segmented<coord::phys_angle_t> &RenderEntity::get_angle() {
6969
std::shared_lock lock{this->mutex};
7070

7171
return this->angle;
7272
}
7373

74-
const curve::Discrete<std::string> &WorldRenderEntity::get_animation_path() {
74+
const curve::Discrete<std::string> &RenderEntity::get_animation_path() {
7575
std::shared_lock lock{this->mutex};
7676

7777
return this->animation_path;

libopenage/renderer/stages/world/render_entity.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ namespace openage::renderer::world {
1818
/**
1919
* Render entity for pushing updates to the World renderer.
2020
*/
21-
class WorldRenderEntity final : public renderer::RenderEntity {
21+
class RenderEntity final : public renderer::RenderEntity {
2222
public:
23-
WorldRenderEntity();
24-
~WorldRenderEntity() = default;
23+
RenderEntity();
24+
~RenderEntity() = default;
2525

2626
/**
2727
* Update the render entity with information from the gamestate.

0 commit comments

Comments
 (0)