aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2021-05-03 10:27:00 +0200
committerLoïc Blot <nerzhul@users.noreply.github.com>2021-05-03 19:49:19 +0200
commitde85bc9227ef0db01854fa0eef89256646b4d578 (patch)
tree9fa8a8e9d47178b830b3ac5ccc84af0546d14540 /src
parent48d5abd5bee7a3f956cb2b92745bed6313cf5d8a (diff)
downloadminetest-de85bc9227ef0db01854fa0eef89256646b4d578.tar.gz
minetest-de85bc9227ef0db01854fa0eef89256646b4d578.tar.bz2
minetest-de85bc9227ef0db01854fa0eef89256646b4d578.zip
fix: some code tidy about includes & irr namespaces
Diffstat (limited to 'src')
-rw-r--r--src/client/client.cpp2
-rw-r--r--src/client/client.h2
-rw-r--r--src/client/clientobject.h6
-rw-r--r--src/client/clouds.cpp2
-rw-r--r--src/client/clouds.h3
-rw-r--r--src/client/content_cao.cpp14
-rw-r--r--src/client/content_cao.h2
-rw-r--r--src/client/content_mapblock.cpp2
-rw-r--r--src/client/content_mapblock.h2
-rw-r--r--src/client/game.cpp78
-rw-r--r--src/client/renderingengine.cpp2
-rw-r--r--src/client/renderingengine.h5
-rw-r--r--src/script/common/c_content.h2
-rw-r--r--src/unittest/test_clientactiveobjectmgr.cpp2
14 files changed, 59 insertions, 65 deletions
diff --git a/src/client/client.cpp b/src/client/client.cpp
index c7aae1644..c0da27e44 100644
--- a/src/client/client.cpp
+++ b/src/client/client.cpp
@@ -1475,7 +1475,7 @@ bool Client::updateWieldedItem()
return true;
}
-irr::scene::ISceneManager* Client::getSceneManager()
+scene::ISceneManager* Client::getSceneManager()
{
return m_rendering_engine->get_scene_manager();
}
diff --git a/src/client/client.h b/src/client/client.h
index b819d4301..c9a72b1b3 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -356,7 +356,7 @@ public:
void setCamera(Camera* camera) { m_camera = camera; }
Camera* getCamera () { return m_camera; }
- irr::scene::ISceneManager *getSceneManager();
+ scene::ISceneManager *getSceneManager();
bool shouldShowMinimap() const;
diff --git a/src/client/clientobject.h b/src/client/clientobject.h
index dbc2f22cf..b192f0dcd 100644
--- a/src/client/clientobject.h
+++ b/src/client/clientobject.h
@@ -33,17 +33,13 @@ class LocalPlayer;
struct ItemStack;
class WieldMeshSceneNode;
-namespace irr { namespace scene {
- class ISceneManager;
-}}
-
class ClientActiveObject : public ActiveObject
{
public:
ClientActiveObject(u16 id, Client *client, ClientEnvironment *env);
virtual ~ClientActiveObject();
- virtual void addToScene(ITextureSource *tsrc, irr::scene::ISceneManager *smgr) = 0;
+ virtual void addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr) = 0;
virtual void removeFromScene(bool permanent) {}
virtual void updateLight(u32 day_night_ratio) {}
diff --git a/src/client/clouds.cpp b/src/client/clouds.cpp
index 5a075aaf0..5008047af 100644
--- a/src/client/clouds.cpp
+++ b/src/client/clouds.cpp
@@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
// Menu clouds are created later
class Clouds;
Clouds *g_menuclouds = NULL;
-irr::scene::ISceneManager *g_menucloudsmgr = NULL;
+scene::ISceneManager *g_menucloudsmgr = NULL;
// Constant for now
static constexpr const float cloud_size = BS * 64.0f;
diff --git a/src/client/clouds.h b/src/client/clouds.h
index a4d810faa..c009a05b7 100644
--- a/src/client/clouds.h
+++ b/src/client/clouds.h
@@ -29,8 +29,7 @@ class Clouds;
extern Clouds *g_menuclouds;
// Scene manager used for menu clouds
-namespace irr{namespace scene{class ISceneManager;}}
-extern irr::scene::ISceneManager *g_menucloudsmgr;
+extern scene::ISceneManager *g_menucloudsmgr;
class Clouds : public scene::ISceneNode
{
diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp
index a2fbbf001..6c7559364 100644
--- a/src/client/content_cao.cpp
+++ b/src/client/content_cao.cpp
@@ -188,7 +188,7 @@ public:
static ClientActiveObject* create(Client *client, ClientEnvironment *env);
- void addToScene(ITextureSource *tsrc, irr::scene::ISceneManager *smgr);
+ void addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr);
void removeFromScene(bool permanent);
void updateLight(u32 day_night_ratio);
void updateNodePos();
@@ -219,7 +219,7 @@ ClientActiveObject* TestCAO::create(Client *client, ClientEnvironment *env)
return new TestCAO(client, env);
}
-void TestCAO::addToScene(ITextureSource *tsrc, irr::scene::ISceneManager *smgr)
+void TestCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
{
if(m_node != NULL)
return;
@@ -590,7 +590,7 @@ void GenericCAO::removeFromScene(bool permanent)
m_client->getMinimap()->removeMarker(&m_marker);
}
-void GenericCAO::addToScene(ITextureSource *tsrc, irr::scene::ISceneManager *smgr)
+void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
{
m_smgr = smgr;
@@ -1484,10 +1484,10 @@ void GenericCAO::updateBonePosition()
if (m_bone_position.empty() || !m_animated_meshnode)
return;
- m_animated_meshnode->setJointMode(irr::scene::EJUOR_CONTROL); // To write positions to the mesh on render
+ m_animated_meshnode->setJointMode(scene::EJUOR_CONTROL); // To write positions to the mesh on render
for (auto &it : m_bone_position) {
std::string bone_name = it.first;
- irr::scene::IBoneSceneNode* bone = m_animated_meshnode->getJointNode(bone_name.c_str());
+ scene::IBoneSceneNode* bone = m_animated_meshnode->getJointNode(bone_name.c_str());
if (bone) {
bone->setPosition(it.second.X);
bone->setRotation(it.second.Y);
@@ -1496,7 +1496,7 @@ void GenericCAO::updateBonePosition()
// search through bones to find mistakenly rotated bones due to bug in Irrlicht
for (u32 i = 0; i < m_animated_meshnode->getJointCount(); ++i) {
- irr::scene::IBoneSceneNode *bone = m_animated_meshnode->getJointNode(i);
+ scene::IBoneSceneNode *bone = m_animated_meshnode->getJointNode(i);
if (!bone)
continue;
@@ -1924,7 +1924,7 @@ void GenericCAO::updateMeshCulling()
return;
}
- irr::scene::ISceneNode *node = getSceneNode();
+ scene::ISceneNode *node = getSceneNode();
if (!node)
return;
diff --git a/src/client/content_cao.h b/src/client/content_cao.h
index 32ec9c1c3..4bbba9134 100644
--- a/src/client/content_cao.h
+++ b/src/client/content_cao.h
@@ -236,7 +236,7 @@ public:
void removeFromScene(bool permanent);
- void addToScene(ITextureSource *tsrc, irr::scene::ISceneManager *smgr);
+ void addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr);
inline void expireVisuals()
{
diff --git a/src/client/content_mapblock.cpp b/src/client/content_mapblock.cpp
index e530f3d7f..810c57138 100644
--- a/src/client/content_mapblock.cpp
+++ b/src/client/content_mapblock.cpp
@@ -61,7 +61,7 @@ static constexpr u16 quad_indices[] = {0, 1, 2, 2, 3, 0};
const std::string MapblockMeshGenerator::raillike_groupname = "connect_to_raillike";
MapblockMeshGenerator::MapblockMeshGenerator(MeshMakeData *input, MeshCollector *output,
- irr::scene::IMeshManipulator *mm):
+ scene::IMeshManipulator *mm):
data(input),
collector(output),
nodedef(data->m_client->ndef()),
diff --git a/src/client/content_mapblock.h b/src/client/content_mapblock.h
index cbee49021..237cc7847 100644
--- a/src/client/content_mapblock.h
+++ b/src/client/content_mapblock.h
@@ -173,7 +173,7 @@ public:
public:
MapblockMeshGenerator(MeshMakeData *input, MeshCollector *output,
- irr::scene::IMeshManipulator *mm);
+ scene::IMeshManipulator *mm);
void generate();
void renderSingle(content_t node, u8 param2 = 0x00);
};
diff --git a/src/client/game.cpp b/src/client/game.cpp
index 2f0f50505..eb1dbb5a3 100644
--- a/src/client/game.cpp
+++ b/src/client/game.cpp
@@ -839,7 +839,7 @@ private:
MapDrawControl *draw_control = nullptr;
Camera *camera = nullptr;
Clouds *clouds = nullptr; // Free using ->Drop()
- Sky *m_sky = nullptr; // Free using ->Drop()
+ Sky *sky = nullptr; // Free using ->Drop()
Hud *hud = nullptr;
Minimap *mapper = nullptr;
@@ -1159,8 +1159,8 @@ void Game::shutdown()
if (gui_chat_console)
gui_chat_console->drop();
- if (m_sky)
- m_sky->drop();
+ if (sky)
+ sky->drop();
/* cleanup menus */
while (g_menumgr.menuCount() > 0) {
@@ -1346,8 +1346,8 @@ bool Game::createClient(const GameStartData &start_data)
/* Skybox
*/
- m_sky = new Sky(-1, m_rendering_engine, texture_src, shader_src);
- scsf->setSky(m_sky);
+ sky = new Sky(-1, m_rendering_engine, texture_src, shader_src);
+ scsf->setSky(sky);
skybox = NULL; // This is used/set later on in the main run loop
/* Pre-calculated values
@@ -2754,23 +2754,23 @@ void Game::handleClientEvent_HudChange(ClientEvent *event, CameraOrientation *ca
void Game::handleClientEvent_SetSky(ClientEvent *event, CameraOrientation *cam)
{
- m_sky->setVisible(false);
+ sky->setVisible(false);
// Whether clouds are visible in front of a custom skybox.
- m_sky->setCloudsEnabled(event->set_sky->clouds);
+ sky->setCloudsEnabled(event->set_sky->clouds);
if (skybox) {
skybox->remove();
skybox = NULL;
}
// Clear the old textures out in case we switch rendering type.
- m_sky->clearSkyboxTextures();
+ sky->clearSkyboxTextures();
// Handle according to type
if (event->set_sky->type == "regular") {
// Shows the mesh skybox
- m_sky->setVisible(true);
+ sky->setVisible(true);
// Update mesh based skybox colours if applicable.
- m_sky->setSkyColors(event->set_sky->sky_color);
- m_sky->setHorizonTint(
+ sky->setSkyColors(event->set_sky->sky_color);
+ sky->setHorizonTint(
event->set_sky->fog_sun_tint,
event->set_sky->fog_moon_tint,
event->set_sky->fog_tint_type
@@ -2778,27 +2778,27 @@ void Game::handleClientEvent_SetSky(ClientEvent *event, CameraOrientation *cam)
} else if (event->set_sky->type == "skybox" &&
event->set_sky->textures.size() == 6) {
// Disable the dyanmic mesh skybox:
- m_sky->setVisible(false);
+ sky->setVisible(false);
// Set fog colors:
- m_sky->setFallbackBgColor(event->set_sky->bgcolor);
+ sky->setFallbackBgColor(event->set_sky->bgcolor);
// Set sunrise and sunset fog tinting:
- m_sky->setHorizonTint(
+ sky->setHorizonTint(
event->set_sky->fog_sun_tint,
event->set_sky->fog_moon_tint,
event->set_sky->fog_tint_type
);
// Add textures to skybox.
for (int i = 0; i < 6; i++)
- m_sky->addTextureToSkybox(event->set_sky->textures[i], i, texture_src);
+ sky->addTextureToSkybox(event->set_sky->textures[i], i, texture_src);
} else {
// Handle everything else as plain color.
if (event->set_sky->type != "plain")
infostream << "Unknown sky type: "
<< (event->set_sky->type) << std::endl;
- m_sky->setVisible(false);
- m_sky->setFallbackBgColor(event->set_sky->bgcolor);
+ sky->setVisible(false);
+ sky->setFallbackBgColor(event->set_sky->bgcolor);
// Disable directional sun/moon tinting on plain or invalid skyboxes.
- m_sky->setHorizonTint(
+ sky->setHorizonTint(
event->set_sky->bgcolor,
event->set_sky->bgcolor,
"custom"
@@ -2810,30 +2810,30 @@ void Game::handleClientEvent_SetSky(ClientEvent *event, CameraOrientation *cam)
void Game::handleClientEvent_SetSun(ClientEvent *event, CameraOrientation *cam)
{
- m_sky->setSunVisible(event->sun_params->visible);
- m_sky->setSunTexture(event->sun_params->texture,
+ sky->setSunVisible(event->sun_params->visible);
+ sky->setSunTexture(event->sun_params->texture,
event->sun_params->tonemap, texture_src);
- m_sky->setSunScale(event->sun_params->scale);
- m_sky->setSunriseVisible(event->sun_params->sunrise_visible);
- m_sky->setSunriseTexture(event->sun_params->sunrise, texture_src);
+ sky->setSunScale(event->sun_params->scale);
+ sky->setSunriseVisible(event->sun_params->sunrise_visible);
+ sky->setSunriseTexture(event->sun_params->sunrise, texture_src);
delete event->sun_params;
}
void Game::handleClientEvent_SetMoon(ClientEvent *event, CameraOrientation *cam)
{
- m_sky->setMoonVisible(event->moon_params->visible);
- m_sky->setMoonTexture(event->moon_params->texture,
+ sky->setMoonVisible(event->moon_params->visible);
+ sky->setMoonTexture(event->moon_params->texture,
event->moon_params->tonemap, texture_src);
- m_sky->setMoonScale(event->moon_params->scale);
+ sky->setMoonScale(event->moon_params->scale);
delete event->moon_params;
}
void Game::handleClientEvent_SetStars(ClientEvent *event, CameraOrientation *cam)
{
- m_sky->setStarsVisible(event->star_params->visible);
- m_sky->setStarCount(event->star_params->count, false);
- m_sky->setStarColor(event->star_params->starcolor);
- m_sky->setStarScale(event->star_params->scale);
+ sky->setStarsVisible(event->star_params->visible);
+ sky->setStarCount(event->star_params->count, false);
+ sky->setStarColor(event->star_params->starcolor);
+ sky->setStarScale(event->star_params->scale);
delete event->star_params;
}
@@ -3710,7 +3710,7 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
direct_brightness = time_brightness;
sunlight_seen = true;
} else {
- float old_brightness = m_sky->getBrightness();
+ float old_brightness = sky->getBrightness();
direct_brightness = client->getEnv().getClientMap()
.getBackgroundBrightness(MYMIN(runData.fog_range * 1.2, 60 * BS),
daynight_ratio, (int)(old_brightness * 255.5), &sunlight_seen)
@@ -3737,7 +3737,7 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
runData.time_of_day_smooth = time_of_day_smooth;
- m_sky->update(time_of_day_smooth, time_brightness, direct_brightness,
+ sky->update(time_of_day_smooth, time_brightness, direct_brightness,
sunlight_seen, camera->getCameraMode(), player->getYaw(),
player->getPitch());
@@ -3745,7 +3745,7 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
Update clouds
*/
if (clouds) {
- if (m_sky->getCloudsVisible()) {
+ if (sky->getCloudsVisible()) {
clouds->setVisible(true);
clouds->step(dtime);
// camera->getPosition is not enough for 3rd person views
@@ -3755,14 +3755,14 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
camera_node_position.Y = camera_node_position.Y + camera_offset.Y * BS;
camera_node_position.Z = camera_node_position.Z + camera_offset.Z * BS;
clouds->update(camera_node_position,
- m_sky->getCloudColor());
+ sky->getCloudColor());
if (clouds->isCameraInsideCloud() && m_cache_enable_fog) {
// if inside clouds, and fog enabled, use that as sky
// color(s)
video::SColor clouds_dark = clouds->getColor()
.getInterpolated(video::SColor(255, 0, 0, 0), 0.9);
- m_sky->overrideColors(clouds_dark, clouds->getColor());
- m_sky->setInClouds(true);
+ sky->overrideColors(clouds_dark, clouds->getColor());
+ sky->setInClouds(true);
runData.fog_range = std::fmin(runData.fog_range * 0.5f, 32.0f * BS);
// do not draw clouds after all
clouds->setVisible(false);
@@ -3783,7 +3783,7 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
if (m_cache_enable_fog) {
driver->setFog(
- m_sky->getBgColor(),
+ sky->getBgColor(),
video::EFT_FOG_LINEAR,
runData.fog_range * m_cache_fog_start,
runData.fog_range * 1.0,
@@ -3793,7 +3793,7 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
);
} else {
driver->setFog(
- m_sky->getBgColor(),
+ sky->getBgColor(),
video::EFT_FOG_LINEAR,
100000 * BS,
110000 * BS,
@@ -3873,7 +3873,7 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
/*
Drawing begins
*/
- const video::SColor &skycolor = m_sky->getSkyColor();
+ const video::SColor &skycolor = sky->getSkyColor();
TimeTaker tt_draw("Draw scene");
driver->beginScene(true, true, skycolor);
diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp
index e74446aeb..4f96a6e37 100644
--- a/src/client/renderingengine.cpp
+++ b/src/client/renderingengine.cpp
@@ -225,7 +225,7 @@ bool RenderingEngine::print_video_modes()
return videomode_list != NULL;
}
-void RenderingEngine::removeMesh(const irr::scene::IMesh* mesh)
+void RenderingEngine::removeMesh(const scene::IMesh* mesh)
{
m_device->getSceneManager()->getMeshCache()->removeMesh(mesh);
}
diff --git a/src/client/renderingengine.h b/src/client/renderingengine.h
index 1fd85f5ef..28ddc8652 100644
--- a/src/client/renderingengine.h
+++ b/src/client/renderingengine.h
@@ -26,9 +26,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes_extrabloated.h"
#include "debug.h"
-namespace irr { namespace scene {
-class IMesh;
-}}
class ITextureSource;
class Camera;
class Client;
@@ -60,7 +57,7 @@ public:
static bool print_video_modes();
void cleanupMeshCache();
- void removeMesh(const irr::scene::IMesh* mesh);
+ void removeMesh(const scene::IMesh* mesh);
static v2u32 getWindowSize()
{
diff --git a/src/script/common/c_content.h b/src/script/common/c_content.h
index f54490e3a..4dc614706 100644
--- a/src/script/common/c_content.h
+++ b/src/script/common/c_content.h
@@ -39,6 +39,8 @@ extern "C" {
#include "itemgroup.h"
#include "itemdef.h"
#include "c_types.h"
+// We do a explicit path include because by default c_content.h include src/client/hud.h
+// prior to the src/hud.h, which is not good on server only build
#include "../../hud.h"
namespace Json { class Value; }
diff --git a/src/unittest/test_clientactiveobjectmgr.cpp b/src/unittest/test_clientactiveobjectmgr.cpp
index a43855c19..2d508cf32 100644
--- a/src/unittest/test_clientactiveobjectmgr.cpp
+++ b/src/unittest/test_clientactiveobjectmgr.cpp
@@ -29,7 +29,7 @@ public:
TestClientActiveObject() : ClientActiveObject(0, nullptr, nullptr) {}
~TestClientActiveObject() = default;
ActiveObjectType getType() const { return ACTIVEOBJECT_TYPE_TEST; }
- virtual void addToScene(ITextureSource *tsrc, irr::scene::ISceneManager *smgr) {}
+ virtual void addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr) {}
};
class TestClientActiveObjectMgr : public TestBase