Skip to content

Commit d70c838

Browse files
committed
chore: updated from serializable objects update
1 parent 5823d61 commit d70c838

File tree

12 files changed

+62
-51
lines changed

12 files changed

+62
-51
lines changed

Core/include/PluginCore.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace polymorph::engine
3737
std::unique_ptr<ISerializableObjectFactory> _objectFactory;
3838
Engine &_game;
3939

40-
graphical::DisplayModule _window;
40+
render::DisplayModule _window;
4141

4242
public:
4343
/**

Core/include/modules/CameraModule.hpp

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

1515
#include "Config/XmlComponent.hpp"
1616

17-
namespace polymorph::graphical
17+
namespace polymorph::render
1818
{
1919
PSERIALIZABLE(CameraModule)
2020
{
@@ -62,7 +62,7 @@ namespace polymorph::graphical
6262

6363
};
6464

65-
PSERIALIZABLE_IMPL(polymorph::graphical, CameraModule)
65+
PSERIALIZABLE_IMPL(polymorph::render, CameraModule)
6666
{
6767

6868
PSERIALIZABLE_IMPL_CTOR(CameraModule)
@@ -88,7 +88,7 @@ namespace polymorph::graphical
8888
void end3DMode() final;
8989

9090
private:
91-
void _loadModule();
91+
void _loadModule(polymorph::engine::PluginManager &Plugins);
9292

9393

9494
//////////////////////--------------------------/////////////////////////

Core/include/modules/WindowModule.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "polymorph/Core.hpp"
1515
#include "Core/Settings/VideoSettings.hpp"
1616

17-
namespace polymorph::graphical
17+
namespace polymorph::render
1818
{
1919

2020
class DisplayModule
@@ -25,7 +25,7 @@ namespace polymorph::graphical
2525
public:
2626
explicit DisplayModule(
2727
std::shared_ptr<polymorph::engine::Settings::VideoSettings> settings,
28-
std::string title);
28+
std::string title, polymorph::engine::PluginManager &Plugins);
2929

3030
~DisplayModule();
3131

@@ -79,7 +79,7 @@ namespace polymorph::graphical
7979
void endDrawing();
8080

8181
private:
82-
void _loadModule();
82+
void _loadModule(polymorph::engine::PluginManager &Plugins);
8383

8484
//////////////////////--------------------------/////////////////////////
8585

Core/src/PluginCore.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace polymorph::engine
1818

1919
PluginCore::PluginCore(PluginCore::XmlNode &data, Engine &game, std::string PluginsPath)
2020
: _data(data), _game(game), _pluginsPath(std::move(PluginsPath)), assetManager(game.getAssetManager()), pluginManager(game.getPluginManager()),
21-
_window(std::forward<std::shared_ptr<engine::Settings::VideoSettings>>(game.getVideoSettings()), game.getTitle())
21+
_window(std::forward<std::shared_ptr<engine::Settings::VideoSettings>>(game.getVideoSettings()), game.getTitle(), game.getPluginManager())
2222
{
2323
if (!game.isDebugMode())
2424
_window.setLogLevel(5);

Core/src/modules/CameraModule.cpp

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77

88
#include <polymorph/render-core.hpp>
99
#include "PluginCore.hpp"
10+
#include "modules/CameraModule.hpp"
1011

11-
polymorph::graphical::CameraModuleImpl::CameraModuleImpl(std::shared_ptr<myxmlpp::Node> &data, polymorph::engine::Config::XmlComponent &manager)
12+
13+
polymorph::render::CameraModuleImpl::CameraModuleImpl(std::shared_ptr<myxmlpp::Node> &data,
14+
polymorph::engine::Config::XmlComponent &manager, polymorph::engine::PluginManager &Plugins)
1215
: SerializableCameraModule()
1316
{
14-
_loadModule();
17+
_loadModule(Plugins);
1518
manager.setSubProperty("_up", data, _up);
1619
manager.setSubProperty("_position", data, _position);
1720
manager.setSubProperty("_target", data, _target);
@@ -23,60 +26,68 @@ polymorph::graphical::CameraModuleImpl::CameraModuleImpl(std::shared_ptr<myxmlpp
2326
_camera->setFOV(_fov);
2427
}
2528

26-
void polymorph::graphical::CameraModuleImpl::setTarget(polymorph::engine::Vector3 target)
29+
void polymorph::render::CameraModuleImpl::setTarget(polymorph::engine::Vector3 target)
2730
{
2831
_target = target;
2932
_camera->setTarget(_target.x, _target.y, _target.z);
3033
}
3134

32-
void polymorph::graphical::CameraModuleImpl::setPosition(polymorph::engine::Vector3 pos)
35+
void polymorph::render::CameraModuleImpl::setPosition(polymorph::engine::Vector3 pos)
3336
{
3437
_position = pos;
3538
_camera->setPosition(_position.x, _position.y, _position.z);
3639
}
3740

38-
void polymorph::graphical::CameraModuleImpl::move(polymorph::engine::Vector3 pos)
41+
void polymorph::render::CameraModuleImpl::move(polymorph::engine::Vector3 pos)
3942
{
4043
_position = pos;
4144
_camera->move(pos.x, pos.y, pos.z);
4245
}
4346

44-
void polymorph::graphical::CameraModuleImpl::setUp(polymorph::engine::Vector3 up)
47+
void polymorph::render::CameraModuleImpl::setUp(polymorph::engine::Vector3 up)
4548
{
4649
_up = up;
4750
_camera->setUp(up.x, up.y, up.z);
4851
}
4952

50-
void polymorph::graphical::CameraModuleImpl::setFOV(float fov)
53+
void polymorph::render::CameraModuleImpl::setFOV(float fov)
5154
{
5255
_fov = fov;
5356
_camera->setFOV(_fov);
5457
}
5558

56-
void polymorph::graphical::CameraModuleImpl::begin3DMode()
59+
void polymorph::render::CameraModuleImpl::begin3DMode()
5760
{
5861
_camera->begin3DMode();
5962
}
6063

61-
void polymorph::graphical::CameraModuleImpl::end3DMode()
64+
void polymorph::render::CameraModuleImpl::end3DMode()
6265
{
6366
_camera->end3DMode();
6467
}
6568

66-
float polymorph::graphical::CameraModuleImpl::getFov() const
69+
float polymorph::render::CameraModuleImpl::getFov() const
6770
{
6871
return _fov;
6972
}
7073

71-
polymorph::engine::Vector3 polymorph::graphical::CameraModuleImpl::getUp() const
74+
polymorph::engine::Vector3 polymorph::render::CameraModuleImpl::getUp() const
7275
{
7376
return _up;
7477
}
7578

76-
void polymorph::graphical::CameraModuleImpl::_loadModule()
79+
void polymorph::render::CameraModuleImpl::_loadModule(polymorph::engine::PluginManager &Plugins)
7780
{
7881
if (_c_camera)
7982
return;
80-
_c_camera = engine::PluginCore::Plugin->pluginManager.getSymbol<polymorph::graphical::Symbols::createCameraDEF>(polymorph::graphical::Symbols::createCamera);
83+
_c_camera = Plugins.getSymbol<polymorph::graphical::Symbols::createCameraDEF>(polymorph::graphical::Symbols::createCamera);
84+
}
85+
86+
polymorph::render::CameraModuleImpl::CameraModuleImpl(
87+
polymorph::engine::PluginManager &Plugins)
88+
{
89+
_loadModule(Plugins);
90+
_camera = std::unique_ptr<polymorph::graphical::ICamera>(_c_camera());
91+
8192
}
8293

Core/src/modules/WindowModule.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
#include "PluginCore.hpp"
1313

1414

15-
polymorph::graphical::DisplayModule::DisplayModule(
16-
std::shared_ptr<engine::Settings::VideoSettings> settings, std::string title):
15+
polymorph::render::DisplayModule::DisplayModule(
16+
std::shared_ptr<engine::Settings::VideoSettings> settings, std::string title, engine::PluginManager &Plugins):
1717
_settings(std::move(settings)), _title(std::move(title))
1818
{
19-
_loadModule();
19+
_loadModule(Plugins);
2020
if (_c_window == nullptr || _c_drawer == nullptr)
2121
throw engine::ExceptionLogger("[render-core]: No createWindow symbol found");
2222
_windowModule = std::unique_ptr<polymorph::graphical::IWindow>(_c_window(
@@ -28,75 +28,75 @@ polymorph::graphical::DisplayModule::DisplayModule(
2828
setTitle(_title);
2929
}
3030

31-
polymorph::graphical::DisplayModule::~DisplayModule()
31+
polymorph::render::DisplayModule::~DisplayModule()
3232
{
3333
if (isOpen())
3434
close();
3535
}
3636

37-
void polymorph::graphical::DisplayModule::close()
37+
void polymorph::render::DisplayModule::close()
3838
{
3939
if (isOpen())
4040
_windowModule->close();
4141
}
4242

43-
bool polymorph::graphical::DisplayModule::isOpen()
43+
bool polymorph::render::DisplayModule::isOpen()
4444
{
4545
return _windowModule->isOpen();
4646
}
4747

48-
bool polymorph::graphical::DisplayModule::isFullscreen()
48+
bool polymorph::render::DisplayModule::isFullscreen()
4949
{
5050
return _windowModule->isFullscreen();
5151
}
5252

53-
void polymorph::graphical::DisplayModule::setFullscreen(bool fullscreen)
53+
void polymorph::render::DisplayModule::setFullscreen(bool fullscreen)
5454
{
5555
return _windowModule->setFullscreen(fullscreen);
5656
}
5757

58-
void polymorph::graphical::DisplayModule::setTitle(const std::string &title)
58+
void polymorph::render::DisplayModule::setTitle(const std::string &title)
5959
{
6060
_windowModule->setTitle(title);
6161
}
6262

63-
polymorph::engine::Vector2 polymorph::graphical::DisplayModule::getResolution() const
63+
polymorph::engine::Vector2 polymorph::render::DisplayModule::getResolution() const
6464
{
6565
return _settings->getResolution();
6666
}
6767

68-
void polymorph::graphical::DisplayModule::clearWindow(polymorph::engine::Color color)
68+
void polymorph::render::DisplayModule::clearWindow(polymorph::engine::Color color)
6969
{
7070
_drawingModule->clear(color.r, color.g, color.b, color.a);
7171
}
7272

73-
void polymorph::graphical::DisplayModule::clearWindow()
73+
void polymorph::render::DisplayModule::clearWindow()
7474
{
7575
_drawingModule->clear(0, 0, 0, 255);
7676
}
7777

78-
void polymorph::graphical::DisplayModule::beginDrawing()
78+
void polymorph::render::DisplayModule::beginDrawing()
7979
{
8080
_drawingModule->beginDrawing();
8181
}
8282

83-
void polymorph::graphical::DisplayModule::endDrawing()
83+
void polymorph::render::DisplayModule::endDrawing()
8484
{
8585
_drawingModule->endDrawing();
8686
}
8787

88-
void polymorph::graphical::DisplayModule::_loadModule()
88+
void polymorph::render::DisplayModule::_loadModule(polymorph::engine::PluginManager &Plugins)
8989
{
9090
if (_c_window)
9191
return;
92-
_c_window = engine::PluginCore::Plugin->pluginManager.getSymbol<polymorph::graphical::Symbols::createWindowDEF>(polymorph::graphical::Symbols::createWindow);
92+
_c_window = Plugins.getSymbol<polymorph::graphical::Symbols::createWindowDEF>(polymorph::graphical::Symbols::createWindow);
9393
if (_c_drawer)
9494
return;
95-
_c_drawer = engine::PluginCore::Plugin->pluginManager.getSymbol<polymorph::graphical::Symbols::createDrawerDEF>(polymorph::graphical::Symbols::createDrawer);
95+
_c_drawer = Plugins.getSymbol<polymorph::graphical::Symbols::createDrawerDEF>(polymorph::graphical::Symbols::createDrawer);
9696

9797
}
9898

99-
void polymorph::graphical::DisplayModule::setLogLevel(int level)
99+
void polymorph::render::DisplayModule::setLogLevel(int level)
100100
{
101101
_windowModule->setLogLevel(level);
102102
}

Factory/include/ObjectFactory.hpp

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

1111
#include "ScriptingAPI/ScriptingApi.hpp"
1212
#include <unordered_map>
13-
13+
#include "../../Core/include/modules/CameraModule.hpp"
1414

1515
OBJECT_FACTORY_BEGIN()
1616

1717
OBJECT_FACTORY_MAP(){
18-
MAKE_SERIALIZABLE(polymorph::graphical, CameraModule)
18+
MAKE_SERIALIZABLE(polymorph::render, CameraModule)
1919
};
2020

2121
OBJECT_FACTORY_EMPTY_MAP(){
22-
MAKE_EMPTY_SERIALIZABLE(polymorph::graphical, CameraModule)
22+
MAKE_EMPTY_SERIALIZABLE(polymorph::render, CameraModule)
2323
};
2424

2525
OBJECT_FACTORY_END()

Factory/include/ScriptFactory.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
//${SCRIPTS_INCLUDES}
1919

2020
FACTORY_BEGIN() {
21-
MAKE_COMPONENT(polymorph::graphical, Camera)
21+
MAKE_COMPONENT(polymorph::render, Camera)
2222
} FACTORY_END()

Factory/src/initializers/CameraInitalizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
#include "../../../Scripts/include/CameraComponentImpl.hpp"
1010

1111

12-
MAKE_INIT_BUILD(polymorph::graphical, Camera,
12+
MAKE_INIT_BUILD(polymorph::render, Camera,
1313
camera,
1414
TargetType,
1515
PointTarget
1616
)
1717

18-
MAKE_INIT_REF(polymorph::graphical, Camera,
18+
MAKE_INIT_REF(polymorph::render, Camera,
1919
ObjectTarget
2020
)

Scripts/include/CameraComponent.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "Utilities/Time.hpp"
1717
#include "modules/CameraModule.hpp"
1818

19-
namespace polymorph::graphical
19+
namespace polymorph::render
2020
{
2121

2222
COMPONENT(Camera)
@@ -34,7 +34,7 @@ namespace polymorph::graphical
3434
engine::GameObject ObjectTarget;
3535
engine::Vector3 PointTarget;
3636

37-
graphical::CameraModule camera;
37+
CameraModule camera;
3838

3939
private:
4040

0 commit comments

Comments
 (0)