summaryrefslogtreecommitdiff
path: root/src/wieldmesh.cpp
diff options
context:
space:
mode:
authorNer'zhul <nerzhul@users.noreply.github.com>2017-01-09 20:39:22 +0100
committerGitHub <noreply@github.com>2017-01-09 20:39:22 +0100
commit8e7449e09253e138716d8dbad6a2ab5c6e089e28 (patch)
treeca6895fb557229445b04639efe7fc57b3e33157b /src/wieldmesh.cpp
parent11df7e886a674e280e3ec6f895c11fc1e70eb7b3 (diff)
downloadminetest-8e7449e09253e138716d8dbad6a2ab5c6e089e28.tar.gz
minetest-8e7449e09253e138716d8dbad6a2ab5c6e089e28.tar.bz2
minetest-8e7449e09253e138716d8dbad6a2ab5c6e089e28.zip
Environment & IGameDef code refactoring (#4985)
* Environment code refactoring * Cleanup includes & class declarations in client & server environment to improve build speed * ServerEnvironment::m_gamedef is now a pointer to Server instead of IGameDef, permitting to cleanup many casts. * Cleanup IGameDef * Move ITextureSource* IGameDef::getTextureSource() to Client only. * Also move ITextureSource *IGameDef::tsrc() helper * drop getShaderSource, getSceneManager, getSoundManager & getCamera abstract call * drop unused emerge() call * cleanup server unused functions (mentionned before) * Drop one unused parameter from ContentFeatures::updateTextures * move checkLocalPrivilege to Client * Remove some unnecessary casts * create_formspec_menu: remove IWritableTextureSource pointer, as client already knows it * Fix some comments * Change required IGameDef to Server/Client pointers * Previous change that game.cpp sometimes calls functions with Client + InventoryManager + IGameDef in same functions but it's the same objects * Remove duplicate Client pointer in GUIFormSpecMenu::GUIFormSpecMenu * drop ClientMap::sectorWasDrawn which is unused
Diffstat (limited to 'src/wieldmesh.cpp')
-rw-r--r--src/wieldmesh.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/wieldmesh.cpp b/src/wieldmesh.cpp
index 9c4d5b642..c305238fe 100644
--- a/src/wieldmesh.cpp
+++ b/src/wieldmesh.cpp
@@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "settings.h"
#include "wieldmesh.h"
#include "inventory.h"
-#include "gamedef.h"
+#include "client.h"
#include "itemdef.h"
#include "nodedef.h"
#include "mesh.h"
@@ -283,7 +283,7 @@ void WieldMeshSceneNode::setExtruded(const std::string &imagename,
video::SMaterial &material = m_meshnode->getMaterial(0);
material.setTexture(0, tsrc->getTextureForMesh(imagename));
material.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
- material.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
+ material.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
material.MaterialType = m_material_type;
material.setFlag(video::EMF_BACK_FACE_CULLING, true);
// Enable bi/trilinear filtering only for high resolution textures
@@ -304,12 +304,12 @@ void WieldMeshSceneNode::setExtruded(const std::string &imagename,
}
}
-void WieldMeshSceneNode::setItem(const ItemStack &item, IGameDef *gamedef)
+void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client)
{
- ITextureSource *tsrc = gamedef->getTextureSource();
- IItemDefManager *idef = gamedef->getItemDefManager();
- IShaderSource *shdrsrc = gamedef->getShaderSource();
- INodeDefManager *ndef = gamedef->getNodeDefManager();
+ ITextureSource *tsrc = client->getTextureSource();
+ IItemDefManager *idef = client->getItemDefManager();
+ IShaderSource *shdrsrc = client->getShaderSource();
+ INodeDefManager *ndef = client->getNodeDefManager();
const ItemDefinition &def = item.getDefinition(idef);
const ContentFeatures &f = ndef->get(def.name);
content_t id = ndef->getId(def.name);
@@ -341,7 +341,7 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, IGameDef *gamedef)
} else if (f.drawtype == NDT_NORMAL || f.drawtype == NDT_ALLFACES) {
setCube(f.tiles, def.wield_scale, tsrc);
} else {
- MeshMakeData mesh_make_data(gamedef, false);
+ MeshMakeData mesh_make_data(client, false);
MapNode mesh_make_node(id, 255, 0);
mesh_make_data.fillSingleNode(&mesh_make_node);
MapBlockMesh mapblock_mesh(&mesh_make_data, v3s16(0, 0, 0));
@@ -435,11 +435,11 @@ void WieldMeshSceneNode::changeToMesh(scene::IMesh *mesh)
m_meshnode->setVisible(true);
}
-scene::IMesh *getItemMesh(IGameDef *gamedef, const ItemStack &item)
+scene::IMesh *getItemMesh(Client *client, const ItemStack &item)
{
- ITextureSource *tsrc = gamedef->getTextureSource();
- IItemDefManager *idef = gamedef->getItemDefManager();
- INodeDefManager *ndef = gamedef->getNodeDefManager();
+ ITextureSource *tsrc = client->getTextureSource();
+ IItemDefManager *idef = client->getItemDefManager();
+ INodeDefManager *ndef = client->getNodeDefManager();
const ItemDefinition &def = item.getDefinition(idef);
const ContentFeatures &f = ndef->get(def.name);
content_t id = ndef->getId(def.name);
@@ -470,7 +470,7 @@ scene::IMesh *getItemMesh(IGameDef *gamedef, const ItemStack &item)
mesh = cloneMesh(g_extrusion_mesh_cache->createCube());
scaleMesh(mesh, v3f(1.2, 1.2, 1.2));
} else {
- MeshMakeData mesh_make_data(gamedef, false);
+ MeshMakeData mesh_make_data(client, false);
MapNode mesh_make_node(id, 255, 0);
mesh_make_data.fillSingleNode(&mesh_make_node);
MapBlockMesh mapblock_mesh(&mesh_make_data, v3s16(0, 0, 0));