1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Cpp11 initializers: last src root changeset (#6022)

* Cpp11 initializers: last src root changeset

Finish to migrate all src root folder files to C++11 constructor initializers
This commit is contained in:
Loïc Blot 2017-06-21 11:51:29 +02:00 committed by GitHub
parent 12aad731ad
commit 1425c6def1
20 changed files with 127 additions and 223 deletions

View file

@ -199,10 +199,8 @@ WieldMeshSceneNode::WieldMeshSceneNode(
bool lighting
):
scene::ISceneNode(parent, mgr, id),
m_meshnode(NULL),
m_material_type(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF),
m_lighting(lighting),
m_bounding_box(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
m_lighting(lighting)
{
m_enable_shaders = g_settings->getBool("enable_shaders");
m_anisotropic_filter = g_settings->getBool("anisotropic_filter");
@ -211,7 +209,7 @@ WieldMeshSceneNode::WieldMeshSceneNode(
// If this is the first wield mesh scene node, create a cache
// for extrusion meshes (and a cube mesh), otherwise reuse it
if (g_extrusion_mesh_cache == NULL)
if (!g_extrusion_mesh_cache)
g_extrusion_mesh_cache = new ExtrusionMeshCache();
else
g_extrusion_mesh_cache->grab();
@ -232,11 +230,11 @@ WieldMeshSceneNode::~WieldMeshSceneNode()
{
sanity_check(g_extrusion_mesh_cache);
if (g_extrusion_mesh_cache->drop())
g_extrusion_mesh_cache = NULL;
g_extrusion_mesh_cache = nullptr;
}
void WieldMeshSceneNode::setCube(const ContentFeatures &f,
v3f wield_scale, ITextureSource *tsrc)
v3f wield_scale)
{
scene::IMesh *cubemesh = g_extrusion_mesh_cache->createCube();
scene::SMesh *copy = cloneMesh(cubemesh);
@ -252,7 +250,7 @@ void WieldMeshSceneNode::setExtruded(const std::string &imagename,
{
video::ITexture *texture = tsrc->getTexture(imagename);
if (!texture) {
changeToMesh(NULL);
changeToMesh(nullptr);
return;
}
@ -335,13 +333,13 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client)
def.wield_scale * WIELD_SCALE_FACTOR
/ (BS * f.visual_scale));
} else if (f.drawtype == NDT_AIRLIKE) {
changeToMesh(NULL);
changeToMesh(nullptr);
} else if (f.drawtype == NDT_PLANTLIKE) {
setExtruded(tsrc->getTextureName(f.tiles[0].layers[0].texture_id),
def.wield_scale, tsrc,
f.tiles[0].layers[0].animation_frame_count);
} else if (f.drawtype == NDT_NORMAL || f.drawtype == NDT_ALLFACES) {
setCube(f, def.wield_scale, tsrc);
setCube(f, def.wield_scale);
} else {
MeshMakeData mesh_make_data(client, false);
MapNode mesh_make_node(id, 255, 0);
@ -373,14 +371,14 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client)
}
// no wield mesh found
changeToMesh(NULL);
changeToMesh(nullptr);
}
void WieldMeshSceneNode::setColor(video::SColor c)
{
assert(!m_lighting);
scene::IMesh *mesh=m_meshnode->getMesh();
if (mesh == NULL)
scene::IMesh *mesh = m_meshnode->getMesh();
if (!mesh)
return;
u8 red = c.getRed();
@ -408,7 +406,7 @@ void WieldMeshSceneNode::render()
void WieldMeshSceneNode::changeToMesh(scene::IMesh *mesh)
{
if (mesh == NULL) {
if (!mesh) {
scene::IMesh *dummymesh = g_extrusion_mesh_cache->createCube();
m_meshnode->setVisible(false);
m_meshnode->setMesh(dummymesh);
@ -438,7 +436,7 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result)
g_extrusion_mesh_cache->grab();
}
scene::SMesh *mesh = NULL;
scene::SMesh *mesh = nullptr;
// Shading is on by default
result->needs_shading = true;
@ -499,20 +497,18 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result)
rotateMeshXZby(mesh, -45);
rotateMeshYZby(mesh, -30);
postProcessNodeMesh(mesh, f, false, false, NULL,
&result->buffer_colors);
postProcessNodeMesh(mesh, f, false, false, nullptr, &result->buffer_colors);
}
result->mesh = mesh;
}
scene::SMesh * getExtrudedMesh(ITextureSource *tsrc,
const std::string &imagename)
scene::SMesh *getExtrudedMesh(ITextureSource *tsrc, const std::string &imagename)
{
video::ITexture *texture = tsrc->getTextureForMesh(imagename);
if (!texture) {
return NULL;
return nullptr;
}
core::dimension2d<u32> dim = texture->getSize();