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:
parent
12aad731ad
commit
1425c6def1
@ -24,11 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
ServerActiveObject::ServerActiveObject(ServerEnvironment *env, v3f pos):
|
ServerActiveObject::ServerActiveObject(ServerEnvironment *env, v3f pos):
|
||||||
ActiveObject(0),
|
ActiveObject(0),
|
||||||
m_known_by_count(0),
|
|
||||||
m_removed(false),
|
|
||||||
m_pending_deactivation(false),
|
|
||||||
m_static_exists(false),
|
|
||||||
m_static_block(1337,1337,1337),
|
|
||||||
m_env(env),
|
m_env(env),
|
||||||
m_base_position(pos)
|
m_base_position(pos)
|
||||||
{
|
{
|
||||||
@ -82,7 +77,7 @@ ItemStack ServerActiveObject::getWieldedItem() const
|
|||||||
if(inv)
|
if(inv)
|
||||||
{
|
{
|
||||||
const InventoryList *list = inv->getList(getWieldList());
|
const InventoryList *list = inv->getList(getWieldList());
|
||||||
if(list && (getWieldIndex() < (s32)list->getSize()))
|
if(list && (getWieldIndex() < (s32)list->getSize()))
|
||||||
return list->getItem(getWieldIndex());
|
return list->getItem(getWieldIndex());
|
||||||
}
|
}
|
||||||
return ItemStack();
|
return ItemStack();
|
||||||
|
@ -204,7 +204,7 @@ public:
|
|||||||
deleted until this is 0 to keep the id preserved for the right
|
deleted until this is 0 to keep the id preserved for the right
|
||||||
object.
|
object.
|
||||||
*/
|
*/
|
||||||
u16 m_known_by_count;
|
u16 m_known_by_count = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
- Whether this object is to be removed when nobody knows about
|
- Whether this object is to be removed when nobody knows about
|
||||||
@ -215,7 +215,7 @@ public:
|
|||||||
to be deleted.
|
to be deleted.
|
||||||
- This can be set to true by anything else too.
|
- This can be set to true by anything else too.
|
||||||
*/
|
*/
|
||||||
bool m_removed;
|
bool m_removed = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is set to true when an object should be removed from the active
|
This is set to true when an object should be removed from the active
|
||||||
@ -226,17 +226,17 @@ public:
|
|||||||
m_known_by_count is true, object is deleted from the active object
|
m_known_by_count is true, object is deleted from the active object
|
||||||
list.
|
list.
|
||||||
*/
|
*/
|
||||||
bool m_pending_deactivation;
|
bool m_pending_deactivation = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Whether the object's static data has been stored to a block
|
Whether the object's static data has been stored to a block
|
||||||
*/
|
*/
|
||||||
bool m_static_exists;
|
bool m_static_exists = false;
|
||||||
/*
|
/*
|
||||||
The block from which the object was loaded from, and in which
|
The block from which the object was loaded from, and in which
|
||||||
a copy of the static data resides.
|
a copy of the static data resides.
|
||||||
*/
|
*/
|
||||||
v3s16 m_static_block;
|
v3s16 m_static_block = v3s16(1337,1337,1337);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Queue of messages to be sent to the client
|
Queue of messages to be sent to the client
|
||||||
|
@ -73,15 +73,10 @@ struct ValueSpec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct SettingsEntry {
|
struct SettingsEntry {
|
||||||
SettingsEntry() :
|
SettingsEntry() {}
|
||||||
group(NULL),
|
|
||||||
is_group(false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
SettingsEntry(const std::string &value_) :
|
SettingsEntry(const std::string &value_) :
|
||||||
value(value_),
|
value(value_)
|
||||||
group(NULL),
|
|
||||||
is_group(false)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
SettingsEntry(Settings *group_) :
|
SettingsEntry(Settings *group_) :
|
||||||
@ -89,9 +84,9 @@ struct SettingsEntry {
|
|||||||
is_group(true)
|
is_group(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
std::string value;
|
std::string value = "";
|
||||||
Settings *group;
|
Settings *group = nullptr;
|
||||||
bool is_group;
|
bool is_group = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::unordered_map<std::string, SettingsEntry> SettingEntries;
|
typedef std::unordered_map<std::string, SettingsEntry> SettingEntries;
|
||||||
|
19
src/shader.h
19
src/shader.h
@ -44,16 +44,13 @@ std::string getShaderPath(const std::string &name_of_shader,
|
|||||||
const std::string &filename);
|
const std::string &filename);
|
||||||
|
|
||||||
struct ShaderInfo {
|
struct ShaderInfo {
|
||||||
std::string name;
|
std::string name = "";
|
||||||
video::E_MATERIAL_TYPE base_material;
|
video::E_MATERIAL_TYPE base_material = video::EMT_SOLID;
|
||||||
video::E_MATERIAL_TYPE material;
|
video::E_MATERIAL_TYPE material = video::EMT_SOLID;
|
||||||
u8 drawtype;
|
u8 drawtype = 0;
|
||||||
u8 material_type;
|
u8 material_type = 0;
|
||||||
s32 user_data;
|
|
||||||
|
|
||||||
ShaderInfo(): name(""), base_material(video::EMT_SOLID),
|
ShaderInfo() {}
|
||||||
material(video::EMT_SOLID),
|
|
||||||
drawtype(0), material_type(0) {}
|
|
||||||
virtual ~ShaderInfo() {}
|
virtual ~ShaderInfo() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -85,11 +82,11 @@ template <typename T, std::size_t count=1>
|
|||||||
class CachedShaderSetting {
|
class CachedShaderSetting {
|
||||||
const char *m_name;
|
const char *m_name;
|
||||||
T m_sent[count];
|
T m_sent[count];
|
||||||
bool has_been_set;
|
bool has_been_set = false;
|
||||||
bool is_pixel;
|
bool is_pixel;
|
||||||
protected:
|
protected:
|
||||||
CachedShaderSetting(const char *name, bool is_pixel) :
|
CachedShaderSetting(const char *name, bool is_pixel) :
|
||||||
m_name(name), has_been_set(false), is_pixel(is_pixel)
|
m_name(name), is_pixel(is_pixel)
|
||||||
{}
|
{}
|
||||||
public:
|
public:
|
||||||
void set(const T value[count], video::IMaterialRendererServices *services)
|
void set(const T value[count], video::IMaterialRendererServices *services)
|
||||||
|
32
src/sky.cpp
32
src/sky.cpp
@ -14,15 +14,7 @@
|
|||||||
|
|
||||||
Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id,
|
Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id,
|
||||||
ITextureSource *tsrc):
|
ITextureSource *tsrc):
|
||||||
scene::ISceneNode(parent, mgr, id),
|
scene::ISceneNode(parent, mgr, id)
|
||||||
m_visible(true),
|
|
||||||
m_fallback_bg_color(255, 255, 255, 255),
|
|
||||||
m_first_update(true),
|
|
||||||
m_brightness(0.5),
|
|
||||||
m_cloud_brightness(0.5),
|
|
||||||
m_bgcolor_bright_f(1, 1, 1, 1),
|
|
||||||
m_skycolor_bright_f(1, 1, 1, 1),
|
|
||||||
m_cloudcolor_bright_f(1, 1, 1, 1)
|
|
||||||
{
|
{
|
||||||
setAutomaticCulling(scene::EAC_OFF);
|
setAutomaticCulling(scene::EAC_OFF);
|
||||||
m_box.MaxEdge.set(0, 0, 0);
|
m_box.MaxEdge.set(0, 0, 0);
|
||||||
@ -85,8 +77,6 @@ Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_directional_colored_fog = g_settings->getBool("directional_colored_fog");
|
m_directional_colored_fog = g_settings->getBool("directional_colored_fog");
|
||||||
|
|
||||||
m_clouds_enabled = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -109,7 +99,7 @@ void Sky::render()
|
|||||||
|
|
||||||
if (!camera || !driver)
|
if (!camera || !driver)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ScopeProfiler sp(g_profiler, "Sky::render()", SPT_AVG);
|
ScopeProfiler sp(g_profiler, "Sky::render()", SPT_AVG);
|
||||||
|
|
||||||
// Draw perspective skybox
|
// Draw perspective skybox
|
||||||
@ -138,7 +128,7 @@ void Sky::render()
|
|||||||
float moonsize = 0.04;
|
float moonsize = 0.04;
|
||||||
video::SColorf mooncolor_f(0.50, 0.57, 0.65, 1);
|
video::SColorf mooncolor_f(0.50, 0.57, 0.65, 1);
|
||||||
video::SColorf mooncolor2_f(0.85, 0.875, 0.9, 1);
|
video::SColorf mooncolor2_f(0.85, 0.875, 0.9, 1);
|
||||||
|
|
||||||
float nightlength = 0.415;
|
float nightlength = 0.415;
|
||||||
float wn = nightlength / 2;
|
float wn = nightlength / 2;
|
||||||
float wicked_time_of_day = 0;
|
float wicked_time_of_day = 0;
|
||||||
@ -181,11 +171,11 @@ void Sky::render()
|
|||||||
const f32 o = 0.0f;
|
const f32 o = 0.0f;
|
||||||
static const u16 indices[4] = {0, 1, 2, 3};
|
static const u16 indices[4] = {0, 1, 2, 3};
|
||||||
video::S3DVertex vertices[4];
|
video::S3DVertex vertices[4];
|
||||||
|
|
||||||
driver->setMaterial(m_materials[1]);
|
driver->setMaterial(m_materials[1]);
|
||||||
|
|
||||||
video::SColor cloudyfogcolor = m_bgcolor;
|
video::SColor cloudyfogcolor = m_bgcolor;
|
||||||
|
|
||||||
// Draw far cloudy fog thing blended with skycolor
|
// Draw far cloudy fog thing blended with skycolor
|
||||||
for (u32 j = 0; j < 4; j++) {
|
for (u32 j = 0; j < 4; j++) {
|
||||||
video::SColor c = cloudyfogcolor.getInterpolated(m_skycolor, 0.45);
|
video::SColor c = cloudyfogcolor.getInterpolated(m_skycolor, 0.45);
|
||||||
@ -361,7 +351,7 @@ void Sky::render()
|
|||||||
vertices[i].Pos.rotateXYBy(wicked_time_of_day * 360 - 90);
|
vertices[i].Pos.rotateXYBy(wicked_time_of_day * 360 - 90);
|
||||||
}
|
}
|
||||||
driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
|
driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
|
||||||
|
|
||||||
d = moonsize * 1.3;
|
d = moonsize * 1.3;
|
||||||
c = mooncolor;
|
c = mooncolor;
|
||||||
c.setAlpha(0.15 * 255);
|
c.setAlpha(0.15 * 255);
|
||||||
@ -466,7 +456,7 @@ void Sky::render()
|
|||||||
indices, SKY_STAR_COUNT, video::EVT_STANDARD,
|
indices, SKY_STAR_COUNT, video::EVT_STANDARD,
|
||||||
scene::EPT_QUADS, video::EIT_16BIT);
|
scene::EPT_QUADS, video::EIT_16BIT);
|
||||||
} while(0);
|
} while(0);
|
||||||
|
|
||||||
// Draw far cloudy fog thing below east and west horizons
|
// Draw far cloudy fog thing below east and west horizons
|
||||||
for (u32 j = 0; j < 2; j++) {
|
for (u32 j = 0; j < 2; j++) {
|
||||||
video::SColor c = cloudyfogcolor;
|
video::SColor c = cloudyfogcolor;
|
||||||
@ -510,7 +500,7 @@ void Sky::update(float time_of_day, float time_brightness,
|
|||||||
m_time_of_day = time_of_day;
|
m_time_of_day = time_of_day;
|
||||||
m_time_brightness = time_brightness;
|
m_time_brightness = time_brightness;
|
||||||
m_sunlight_seen = sunlight_seen;
|
m_sunlight_seen = sunlight_seen;
|
||||||
|
|
||||||
bool is_dawn = (time_brightness >= 0.20 && time_brightness < 0.35);
|
bool is_dawn = (time_brightness >= 0.20 && time_brightness < 0.35);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -535,7 +525,7 @@ void Sky::update(float time_of_day, float time_brightness,
|
|||||||
video::SColorf skycolor_bright_normal_f = video::SColor(255, 140, 186, 250);
|
video::SColorf skycolor_bright_normal_f = video::SColor(255, 140, 186, 250);
|
||||||
video::SColorf skycolor_bright_dawn_f = video::SColor(255, 180, 186, 250);
|
video::SColorf skycolor_bright_dawn_f = video::SColor(255, 180, 186, 250);
|
||||||
video::SColorf skycolor_bright_night_f = video::SColor(255, 0, 107, 255);
|
video::SColorf skycolor_bright_night_f = video::SColor(255, 0, 107, 255);
|
||||||
|
|
||||||
// pure white: becomes "diffuse light component" for clouds
|
// pure white: becomes "diffuse light component" for clouds
|
||||||
video::SColorf cloudcolor_bright_normal_f = video::SColor(255, 255, 255, 255);
|
video::SColorf cloudcolor_bright_normal_f = video::SColor(255, 255, 255, 255);
|
||||||
// dawn-factoring version of pure white (note: R is above 1.0)
|
// dawn-factoring version of pure white (note: R is above 1.0)
|
||||||
@ -555,7 +545,7 @@ void Sky::update(float time_of_day, float time_brightness,
|
|||||||
else
|
else
|
||||||
m_brightness = m_brightness * 0.98 + direct_brightness * 0.02;
|
m_brightness = m_brightness * 0.98 + direct_brightness * 0.02;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_clouds_visible = true;
|
m_clouds_visible = true;
|
||||||
float color_change_fraction = 0.98;
|
float color_change_fraction = 0.98;
|
||||||
if (sunlight_seen) {
|
if (sunlight_seen) {
|
||||||
|
20
src/sky.h
20
src/sky.h
@ -117,25 +117,25 @@ private:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool m_visible;
|
bool m_visible = true;
|
||||||
video::SColor m_fallback_bg_color; // Used when m_visible=false
|
// Used when m_visible=false
|
||||||
bool m_first_update;
|
video::SColor m_fallback_bg_color = video::SColor(255, 255, 255, 255);
|
||||||
|
bool m_first_update = true;
|
||||||
float m_time_of_day;
|
float m_time_of_day;
|
||||||
float m_time_brightness;
|
float m_time_brightness;
|
||||||
bool m_sunlight_seen;
|
bool m_sunlight_seen;
|
||||||
float m_brightness;
|
float m_brightness = 0.5f;
|
||||||
float m_cloud_brightness;
|
float m_cloud_brightness = 0.5f;
|
||||||
bool m_clouds_visible; // Whether clouds are disabled due to player underground
|
bool m_clouds_visible; // Whether clouds are disabled due to player underground
|
||||||
bool m_clouds_enabled; // Initialised to true, reset only by set_sky API
|
bool m_clouds_enabled = true; // Initialised to true, reset only by set_sky API
|
||||||
bool m_directional_colored_fog;
|
bool m_directional_colored_fog;
|
||||||
video::SColorf m_bgcolor_bright_f;
|
video::SColorf m_bgcolor_bright_f = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
video::SColorf m_skycolor_bright_f;
|
video::SColorf m_skycolor_bright_f = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
video::SColorf m_cloudcolor_bright_f;
|
video::SColorf m_cloudcolor_bright_f = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
video::SColor m_bgcolor;
|
video::SColor m_bgcolor;
|
||||||
video::SColor m_skycolor;
|
video::SColor m_skycolor;
|
||||||
video::SColorf m_cloudcolor_f;
|
video::SColorf m_cloudcolor_f;
|
||||||
v3f m_stars[SKY_STAR_COUNT];
|
v3f m_stars[SKY_STAR_COUNT];
|
||||||
video::S3DVertex m_star_vertices[SKY_STAR_COUNT * 4];
|
|
||||||
video::ITexture *m_sun_texture;
|
video::ITexture *m_sun_texture;
|
||||||
video::ITexture *m_moon_texture;
|
video::ITexture *m_moon_texture;
|
||||||
video::ITexture *m_sun_tonemap;
|
video::ITexture *m_sun_tonemap;
|
||||||
|
@ -90,9 +90,7 @@ void sockets_cleanup()
|
|||||||
|
|
||||||
Address::Address()
|
Address::Address()
|
||||||
{
|
{
|
||||||
m_addr_family = 0;
|
|
||||||
memset(&m_address, 0, sizeof(m_address));
|
memset(&m_address, 0, sizeof(m_address));
|
||||||
m_port = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Address::Address(u32 address, u16 port)
|
Address::Address(u32 address, u16 port)
|
||||||
|
@ -103,13 +103,13 @@ public:
|
|||||||
void print(std::ostream *s) const;
|
void print(std::ostream *s) const;
|
||||||
std::string serializeString() const;
|
std::string serializeString() const;
|
||||||
private:
|
private:
|
||||||
unsigned int m_addr_family;
|
unsigned int m_addr_family = 0;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct sockaddr_in ipv4;
|
struct sockaddr_in ipv4;
|
||||||
struct sockaddr_in6 ipv6;
|
struct sockaddr_in6 ipv6;
|
||||||
} m_address;
|
} m_address;
|
||||||
u16 m_port; // Port is separate from sockaddr structures
|
u16 m_port = 0; // Port is separate from sockaddr structures
|
||||||
};
|
};
|
||||||
|
|
||||||
class UDPSocket
|
class UDPSocket
|
||||||
|
@ -29,15 +29,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
struct StaticObject
|
struct StaticObject
|
||||||
{
|
{
|
||||||
u8 type;
|
u8 type = 0;
|
||||||
v3f pos;
|
v3f pos;
|
||||||
std::string data;
|
std::string data;
|
||||||
|
|
||||||
StaticObject():
|
StaticObject() {}
|
||||||
type(0),
|
|
||||||
pos(0,0,0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
StaticObject(u8 type_, v3f pos_, const std::string &data_):
|
StaticObject(u8 type_, v3f pos_, const std::string &data_):
|
||||||
type(type_),
|
type(type_),
|
||||||
pos(pos_),
|
pos(pos_),
|
||||||
@ -88,7 +84,7 @@ public:
|
|||||||
|
|
||||||
void serialize(std::ostream &os);
|
void serialize(std::ostream &os);
|
||||||
void deSerialize(std::istream &is);
|
void deSerialize(std::istream &is);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NOTE: When an object is transformed to active, it is removed
|
NOTE: When an object is transformed to active, it is removed
|
||||||
from m_stored and inserted to m_active.
|
from m_stored and inserted to m_active.
|
||||||
|
@ -26,8 +26,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
class Settings;
|
class Settings;
|
||||||
|
|
||||||
#define WORLDNAME_BLACKLISTED_CHARS "/\\"
|
|
||||||
|
|
||||||
struct SubgameSpec
|
struct SubgameSpec
|
||||||
{
|
{
|
||||||
std::string id; // "" = game does not exist
|
std::string id; // "" = game does not exist
|
||||||
@ -37,15 +35,15 @@ struct SubgameSpec
|
|||||||
std::string name;
|
std::string name;
|
||||||
std::string menuicon_path;
|
std::string menuicon_path;
|
||||||
|
|
||||||
SubgameSpec(const std::string &id_="",
|
SubgameSpec(const std::string &id_ = "",
|
||||||
const std::string &path_="",
|
const std::string &path_ = "",
|
||||||
const std::string &gamemods_path_="",
|
const std::string &gamemods_path_ = "",
|
||||||
const std::set<std::string> &addon_mods_paths_=std::set<std::string>(),
|
const std::set<std::string> &addon_mods_paths_ = std::set<std::string>(),
|
||||||
const std::string &name_="",
|
const std::string &name_ = "",
|
||||||
const std::string &menuicon_path_=""):
|
const std::string &menuicon_path_ = ""):
|
||||||
id(id_),
|
id(id_),
|
||||||
path(path_),
|
path(path_),
|
||||||
gamemods_path(gamemods_path_),
|
gamemods_path(gamemods_path_),
|
||||||
addon_mods_paths(addon_mods_paths_),
|
addon_mods_paths(addon_mods_paths_),
|
||||||
name(name_),
|
name(name_),
|
||||||
menuicon_path(menuicon_path_)
|
menuicon_path(menuicon_path_)
|
||||||
|
@ -52,13 +52,7 @@ class TerminalChatConsole : public Thread {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
TerminalChatConsole() :
|
TerminalChatConsole() :
|
||||||
Thread("TerminalThread"),
|
Thread("TerminalThread")
|
||||||
m_log_level(LL_ACTION),
|
|
||||||
m_utf8_bytes_to_wait(0),
|
|
||||||
m_kill_requested(NULL),
|
|
||||||
m_esc_mode(false),
|
|
||||||
m_game_time(0),
|
|
||||||
m_time_of_day(0)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void setup(
|
void setup(
|
||||||
@ -74,7 +68,7 @@ public:
|
|||||||
virtual void *run();
|
virtual void *run();
|
||||||
|
|
||||||
// Highly required!
|
// Highly required!
|
||||||
void clearKillStatus() { m_kill_requested = NULL; }
|
void clearKillStatus() { m_kill_requested = nullptr; }
|
||||||
|
|
||||||
void stopAndWaitforThread();
|
void stopAndWaitforThread();
|
||||||
|
|
||||||
@ -102,10 +96,10 @@ private:
|
|||||||
~CursesInitHelper() { cons->deInitOfCurses(); }
|
~CursesInitHelper() { cons->deInitOfCurses(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
int m_log_level;
|
int m_log_level = LL_ACTION;
|
||||||
std::string m_nick;
|
std::string m_nick;
|
||||||
|
|
||||||
u8 m_utf8_bytes_to_wait;
|
u8 m_utf8_bytes_to_wait = 0;
|
||||||
std::string m_pending_utf8_bytes;
|
std::string m_pending_utf8_bytes;
|
||||||
|
|
||||||
std::list<std::string> m_nicks;
|
std::list<std::string> m_nicks;
|
||||||
@ -114,16 +108,16 @@ private:
|
|||||||
int m_rows;
|
int m_rows;
|
||||||
bool m_can_draw_text;
|
bool m_can_draw_text;
|
||||||
|
|
||||||
bool *m_kill_requested;
|
bool *m_kill_requested = nullptr;
|
||||||
ChatBackend m_chat_backend;
|
ChatBackend m_chat_backend;
|
||||||
ChatInterface *m_chat_interface;
|
ChatInterface *m_chat_interface;
|
||||||
|
|
||||||
TermLogOutput m_log_output;
|
TermLogOutput m_log_output;
|
||||||
|
|
||||||
bool m_esc_mode;
|
bool m_esc_mode = false;
|
||||||
|
|
||||||
u64 m_game_time;
|
u64 m_game_time = 0;
|
||||||
u32 m_time_of_day;
|
u32 m_time_of_day = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TerminalChatConsole g_term_console;
|
extern TerminalChatConsole g_term_console;
|
||||||
|
21
src/tool.h
21
src/tool.h
@ -28,13 +28,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
struct ToolGroupCap
|
struct ToolGroupCap
|
||||||
{
|
{
|
||||||
std::unordered_map<int, float> times;
|
std::unordered_map<int, float> times;
|
||||||
int maxlevel;
|
int maxlevel = 1;
|
||||||
int uses;
|
int uses = 20;
|
||||||
|
|
||||||
ToolGroupCap():
|
ToolGroupCap() {}
|
||||||
maxlevel(1),
|
|
||||||
uses(20)
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool getTime(int rating, float *time) const
|
bool getTime(int rating, float *time) const
|
||||||
{
|
{
|
||||||
@ -118,15 +115,11 @@ HitParams getHitParams(const ItemGroupList &armor_groups,
|
|||||||
|
|
||||||
struct PunchDamageResult
|
struct PunchDamageResult
|
||||||
{
|
{
|
||||||
bool did_punch;
|
bool did_punch = false;
|
||||||
int damage;
|
int damage = 0;
|
||||||
int wear;
|
int wear = 0;
|
||||||
|
|
||||||
PunchDamageResult():
|
PunchDamageResult() {}
|
||||||
did_punch(false),
|
|
||||||
damage(0),
|
|
||||||
wear(0)
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ItemStack;
|
struct ItemStack;
|
||||||
|
@ -130,19 +130,10 @@ static void load_button_texture(button_info* btn, const char* path,
|
|||||||
|
|
||||||
AutoHideButtonBar::AutoHideButtonBar(IrrlichtDevice *device,
|
AutoHideButtonBar::AutoHideButtonBar(IrrlichtDevice *device,
|
||||||
IEventReceiver* receiver) :
|
IEventReceiver* receiver) :
|
||||||
m_texturesource(NULL),
|
|
||||||
m_driver(device->getVideoDriver()),
|
m_driver(device->getVideoDriver()),
|
||||||
m_guienv(device->getGUIEnvironment()),
|
m_guienv(device->getGUIEnvironment()),
|
||||||
m_receiver(receiver),
|
m_receiver(receiver)
|
||||||
m_active(false),
|
|
||||||
m_visible(true),
|
|
||||||
m_timeout(0),
|
|
||||||
m_timeout_value(3),
|
|
||||||
m_initialized(false),
|
|
||||||
m_dir(AHBB_Dir_Right_Left)
|
|
||||||
{
|
{
|
||||||
m_screensize = device->getVideoDriver()->getScreenSize();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoHideButtonBar::init(ISimpleTextureSource* tsrc,
|
void AutoHideButtonBar::init(ISimpleTextureSource* tsrc,
|
||||||
@ -416,16 +407,7 @@ void AutoHideButtonBar::show()
|
|||||||
TouchScreenGUI::TouchScreenGUI(IrrlichtDevice *device, IEventReceiver* receiver):
|
TouchScreenGUI::TouchScreenGUI(IrrlichtDevice *device, IEventReceiver* receiver):
|
||||||
m_device(device),
|
m_device(device),
|
||||||
m_guienv(device->getGUIEnvironment()),
|
m_guienv(device->getGUIEnvironment()),
|
||||||
m_camera_yaw_change(0.0),
|
|
||||||
m_camera_pitch(0.0),
|
|
||||||
m_visible(false),
|
|
||||||
m_move_id(-1),
|
|
||||||
m_receiver(receiver),
|
m_receiver(receiver),
|
||||||
m_move_has_really_moved(false),
|
|
||||||
m_move_downtime(0),
|
|
||||||
m_move_sent_as_mouse_event(false),
|
|
||||||
// use some downlocation way off screen as init value to avoid invalid behaviour
|
|
||||||
m_move_downlocation(v2s32(-10000, -10000)),
|
|
||||||
m_settingsbar(device, receiver),
|
m_settingsbar(device, receiver),
|
||||||
m_rarecontrolsbar(device, receiver)
|
m_rarecontrolsbar(device, receiver)
|
||||||
{
|
{
|
||||||
@ -474,8 +456,6 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc)
|
|||||||
u32 button_size = getGuiButtonSize();
|
u32 button_size = getGuiButtonSize();
|
||||||
m_visible = true;
|
m_visible = true;
|
||||||
m_texturesource = tsrc;
|
m_texturesource = tsrc;
|
||||||
m_control_pad_rect = rect<s32>(0, m_screensize.Y - 3 * button_size,
|
|
||||||
3 * button_size, m_screensize.Y);
|
|
||||||
/*
|
/*
|
||||||
draw control pad
|
draw control pad
|
||||||
0 1 2
|
0 1 2
|
||||||
|
@ -76,7 +76,7 @@ struct button_info
|
|||||||
float repeatdelay;
|
float repeatdelay;
|
||||||
irr::EKEY_CODE keycode;
|
irr::EKEY_CODE keycode;
|
||||||
std::vector<int> ids;
|
std::vector<int> ids;
|
||||||
IGUIButton *guibutton = NULL;
|
IGUIButton *guibutton = nullptr;
|
||||||
bool immediate_release;
|
bool immediate_release;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -114,11 +114,10 @@ public:
|
|||||||
void show();
|
void show();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ISimpleTextureSource *m_texturesource;
|
ISimpleTextureSource *m_texturesource = nullptr;
|
||||||
irr::video::IVideoDriver *m_driver;
|
irr::video::IVideoDriver *m_driver;
|
||||||
IGUIEnvironment *m_guienv;
|
IGUIEnvironment *m_guienv;
|
||||||
IEventReceiver *m_receiver;
|
IEventReceiver *m_receiver;
|
||||||
v2u32 m_screensize;
|
|
||||||
button_info m_starter;
|
button_info m_starter;
|
||||||
std::vector<button_info *> m_buttons;
|
std::vector<button_info *> m_buttons;
|
||||||
|
|
||||||
@ -126,15 +125,15 @@ private:
|
|||||||
v2s32 m_lower_right;
|
v2s32 m_lower_right;
|
||||||
|
|
||||||
/* show settings bar */
|
/* show settings bar */
|
||||||
bool m_active;
|
bool m_active = false;
|
||||||
|
|
||||||
bool m_visible;
|
bool m_visible = true;
|
||||||
|
|
||||||
/* settings bar timeout */
|
/* settings bar timeout */
|
||||||
float m_timeout;
|
float m_timeout = 0.0f;
|
||||||
float m_timeout_value;
|
float m_timeout_value = 3.0f;
|
||||||
bool m_initialized;
|
bool m_initialized = false;
|
||||||
autohide_button_bar_dir m_dir;
|
autohide_button_bar_dir m_dir = AHBB_Dir_Right_Left;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TouchScreenGUI
|
class TouchScreenGUI
|
||||||
@ -177,18 +176,16 @@ private:
|
|||||||
bool m_visible; // is the gui visible
|
bool m_visible; // is the gui visible
|
||||||
|
|
||||||
/* value in degree */
|
/* value in degree */
|
||||||
double m_camera_yaw_change;
|
double m_camera_yaw_change = 0.0;
|
||||||
double m_camera_pitch;
|
double m_camera_pitch = 0.0;
|
||||||
|
|
||||||
line3d<f32> m_shootline;
|
line3d<f32> m_shootline;
|
||||||
|
|
||||||
rect<s32> m_control_pad_rect;
|
int m_move_id = -1;
|
||||||
|
bool m_move_has_really_moved = false;
|
||||||
int m_move_id;
|
s64 m_move_downtime = 0;
|
||||||
bool m_move_has_really_moved;
|
bool m_move_sent_as_mouse_event = false;
|
||||||
s64 m_move_downtime;
|
v2s32 m_move_downlocation = v2s32(-10000, -10000);
|
||||||
bool m_move_sent_as_mouse_event;
|
|
||||||
v2s32 m_move_downlocation;
|
|
||||||
|
|
||||||
button_info m_buttons[after_last_element_id];
|
button_info m_buttons[after_last_element_id];
|
||||||
|
|
||||||
@ -206,9 +203,6 @@ private:
|
|||||||
std::wstring caption, bool immediate_release,
|
std::wstring caption, bool immediate_release,
|
||||||
float repeat_delay = BUTTON_REPEAT_DELAY);
|
float repeat_delay = BUTTON_REPEAT_DELAY);
|
||||||
|
|
||||||
/* load texture */
|
|
||||||
void loadButtonTexture(button_info *btn, const char *path, rect<s32> button_rect);
|
|
||||||
|
|
||||||
struct id_status
|
struct id_status
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
|
@ -33,9 +33,7 @@ u64 emerge_load_time = 0;
|
|||||||
u64 clearflag_time = 0;
|
u64 clearflag_time = 0;
|
||||||
|
|
||||||
|
|
||||||
VoxelManipulator::VoxelManipulator():
|
VoxelManipulator::VoxelManipulator()
|
||||||
m_data(NULL),
|
|
||||||
m_flags(NULL)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,9 +47,9 @@ void VoxelManipulator::clear()
|
|||||||
// Reset area to volume=0
|
// Reset area to volume=0
|
||||||
m_area = VoxelArea();
|
m_area = VoxelArea();
|
||||||
delete[] m_data;
|
delete[] m_data;
|
||||||
m_data = NULL;
|
m_data = nullptr;
|
||||||
delete[] m_flags;
|
delete[] m_flags;
|
||||||
m_flags = NULL;
|
m_flags = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelManipulator::print(std::ostream &o, INodeDefManager *ndef,
|
void VoxelManipulator::print(std::ostream &o, INodeDefManager *ndef,
|
||||||
|
41
src/voxel.h
41
src/voxel.h
@ -60,11 +60,8 @@ class VoxelArea
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Starts as zero sized
|
// Starts as zero sized
|
||||||
VoxelArea():
|
VoxelArea() {}
|
||||||
MinEdge(1,1,1),
|
|
||||||
MaxEdge(0,0,0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
VoxelArea(v3s16 min_edge, v3s16 max_edge):
|
VoxelArea(v3s16 min_edge, v3s16 max_edge):
|
||||||
MinEdge(min_edge),
|
MinEdge(min_edge),
|
||||||
MaxEdge(max_edge)
|
MaxEdge(max_edge)
|
||||||
@ -325,22 +322,22 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Edges are inclusive
|
// Edges are inclusive
|
||||||
v3s16 MinEdge;
|
v3s16 MinEdge = v3s16(1,1,1);
|
||||||
v3s16 MaxEdge;
|
v3s16 MaxEdge;
|
||||||
};
|
};
|
||||||
|
|
||||||
// unused
|
// unused
|
||||||
#define VOXELFLAG_UNUSED (1<<0)
|
#define VOXELFLAG_UNUSED (1 << 0)
|
||||||
// no data about that node
|
// no data about that node
|
||||||
#define VOXELFLAG_NO_DATA (1<<1)
|
#define VOXELFLAG_NO_DATA (1 << 1)
|
||||||
// Algorithm-dependent
|
// Algorithm-dependent
|
||||||
#define VOXELFLAG_CHECKED1 (1<<2)
|
#define VOXELFLAG_CHECKED1 (1 << 2)
|
||||||
// Algorithm-dependent
|
// Algorithm-dependent
|
||||||
#define VOXELFLAG_CHECKED2 (1<<3)
|
#define VOXELFLAG_CHECKED2 (1 << 3)
|
||||||
// Algorithm-dependent
|
// Algorithm-dependent
|
||||||
#define VOXELFLAG_CHECKED3 (1<<4)
|
#define VOXELFLAG_CHECKED3 (1 << 4)
|
||||||
// Algorithm-dependent
|
// Algorithm-dependent
|
||||||
#define VOXELFLAG_CHECKED4 (1<<5)
|
#define VOXELFLAG_CHECKED4 (1 << 5)
|
||||||
|
|
||||||
enum VoxelPrintMode
|
enum VoxelPrintMode
|
||||||
{
|
{
|
||||||
@ -570,29 +567,17 @@ public:
|
|||||||
VoxelArea m_area;
|
VoxelArea m_area;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NULL if data size is 0 (extent (0,0,0))
|
nullptr if data size is 0 (extent (0,0,0))
|
||||||
Data is stored as [z*h*w + y*h + x]
|
Data is stored as [z*h*w + y*h + x]
|
||||||
*/
|
*/
|
||||||
MapNode *m_data;
|
MapNode *m_data = nullptr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Flags of all nodes
|
Flags of all nodes
|
||||||
*/
|
*/
|
||||||
u8 *m_flags;
|
u8 *m_flags = nullptr;
|
||||||
|
|
||||||
static const MapNode ContentIgnoreNode;
|
static const MapNode ContentIgnoreNode;
|
||||||
|
|
||||||
//TODO: Use these or remove them
|
|
||||||
//TODO: Would these make any speed improvement?
|
|
||||||
//bool m_pressure_route_valid;
|
|
||||||
//v3s16 m_pressure_route_surface;
|
|
||||||
|
|
||||||
/*
|
|
||||||
Some settings
|
|
||||||
*/
|
|
||||||
//bool m_disable_water_climb;
|
|
||||||
|
|
||||||
private:
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1402,14 +1402,9 @@ void repair_block_light(ServerMap *map, MapBlock *block,
|
|||||||
modified_blocks);
|
modified_blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
VoxelLineIterator::VoxelLineIterator(
|
VoxelLineIterator::VoxelLineIterator(const v3f &start_position, const v3f &line_vector) :
|
||||||
const v3f &start_position,
|
|
||||||
const v3f &line_vector) :
|
|
||||||
m_start_position(start_position),
|
m_start_position(start_position),
|
||||||
m_line_vector(line_vector),
|
m_line_vector(line_vector)
|
||||||
m_next_intersection_multi(10000.0f, 10000.0f, 10000.0f),
|
|
||||||
m_intersection_multi_inc(10000.0f, 10000.0f, 10000.0f),
|
|
||||||
m_step_directions(1.0f, 1.0f, 1.0f)
|
|
||||||
{
|
{
|
||||||
m_current_node_pos = floatToInt(m_start_position, 1);
|
m_current_node_pos = floatToInt(m_start_position, 1);
|
||||||
|
|
||||||
|
@ -123,17 +123,17 @@ public:
|
|||||||
* which multiplying the line's vector gives a vector that ends
|
* which multiplying the line's vector gives a vector that ends
|
||||||
* on the intersection of two nodes.
|
* on the intersection of two nodes.
|
||||||
*/
|
*/
|
||||||
v3f m_next_intersection_multi;
|
v3f m_next_intersection_multi = v3f(10000.0f, 10000.0f, 10000.0f);
|
||||||
/*!
|
/*!
|
||||||
* Each component stores the smallest positive number, by which
|
* Each component stores the smallest positive number, by which
|
||||||
* m_next_intersection_multi's components can be increased.
|
* m_next_intersection_multi's components can be increased.
|
||||||
*/
|
*/
|
||||||
v3f m_intersection_multi_inc;
|
v3f m_intersection_multi_inc = v3f(10000.0f, 10000.0f, 10000.0f);
|
||||||
/*!
|
/*!
|
||||||
* Direction of the line. Each component can be -1 or 1 (if a
|
* Direction of the line. Each component can be -1 or 1 (if a
|
||||||
* component of the line's vector is 0, then there will be 1).
|
* component of the line's vector is 0, then there will be 1).
|
||||||
*/
|
*/
|
||||||
v3s16 m_step_directions;
|
v3s16 m_step_directions = v3s16(1, 1, 1);
|
||||||
//! Position of the current node.
|
//! Position of the current node.
|
||||||
v3s16 m_current_node_pos;
|
v3s16 m_current_node_pos;
|
||||||
//! If true, the next node will intersect the line, too.
|
//! If true, the next node will intersect the line, too.
|
||||||
|
@ -199,10 +199,8 @@ WieldMeshSceneNode::WieldMeshSceneNode(
|
|||||||
bool lighting
|
bool lighting
|
||||||
):
|
):
|
||||||
scene::ISceneNode(parent, mgr, id),
|
scene::ISceneNode(parent, mgr, id),
|
||||||
m_meshnode(NULL),
|
|
||||||
m_material_type(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF),
|
m_material_type(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF),
|
||||||
m_lighting(lighting),
|
m_lighting(lighting)
|
||||||
m_bounding_box(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
|
|
||||||
{
|
{
|
||||||
m_enable_shaders = g_settings->getBool("enable_shaders");
|
m_enable_shaders = g_settings->getBool("enable_shaders");
|
||||||
m_anisotropic_filter = g_settings->getBool("anisotropic_filter");
|
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
|
// If this is the first wield mesh scene node, create a cache
|
||||||
// for extrusion meshes (and a cube mesh), otherwise reuse it
|
// 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();
|
g_extrusion_mesh_cache = new ExtrusionMeshCache();
|
||||||
else
|
else
|
||||||
g_extrusion_mesh_cache->grab();
|
g_extrusion_mesh_cache->grab();
|
||||||
@ -232,11 +230,11 @@ WieldMeshSceneNode::~WieldMeshSceneNode()
|
|||||||
{
|
{
|
||||||
sanity_check(g_extrusion_mesh_cache);
|
sanity_check(g_extrusion_mesh_cache);
|
||||||
if (g_extrusion_mesh_cache->drop())
|
if (g_extrusion_mesh_cache->drop())
|
||||||
g_extrusion_mesh_cache = NULL;
|
g_extrusion_mesh_cache = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WieldMeshSceneNode::setCube(const ContentFeatures &f,
|
void WieldMeshSceneNode::setCube(const ContentFeatures &f,
|
||||||
v3f wield_scale, ITextureSource *tsrc)
|
v3f wield_scale)
|
||||||
{
|
{
|
||||||
scene::IMesh *cubemesh = g_extrusion_mesh_cache->createCube();
|
scene::IMesh *cubemesh = g_extrusion_mesh_cache->createCube();
|
||||||
scene::SMesh *copy = cloneMesh(cubemesh);
|
scene::SMesh *copy = cloneMesh(cubemesh);
|
||||||
@ -252,7 +250,7 @@ void WieldMeshSceneNode::setExtruded(const std::string &imagename,
|
|||||||
{
|
{
|
||||||
video::ITexture *texture = tsrc->getTexture(imagename);
|
video::ITexture *texture = tsrc->getTexture(imagename);
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
changeToMesh(NULL);
|
changeToMesh(nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,13 +333,13 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client)
|
|||||||
def.wield_scale * WIELD_SCALE_FACTOR
|
def.wield_scale * WIELD_SCALE_FACTOR
|
||||||
/ (BS * f.visual_scale));
|
/ (BS * f.visual_scale));
|
||||||
} else if (f.drawtype == NDT_AIRLIKE) {
|
} else if (f.drawtype == NDT_AIRLIKE) {
|
||||||
changeToMesh(NULL);
|
changeToMesh(nullptr);
|
||||||
} else if (f.drawtype == NDT_PLANTLIKE) {
|
} else if (f.drawtype == NDT_PLANTLIKE) {
|
||||||
setExtruded(tsrc->getTextureName(f.tiles[0].layers[0].texture_id),
|
setExtruded(tsrc->getTextureName(f.tiles[0].layers[0].texture_id),
|
||||||
def.wield_scale, tsrc,
|
def.wield_scale, tsrc,
|
||||||
f.tiles[0].layers[0].animation_frame_count);
|
f.tiles[0].layers[0].animation_frame_count);
|
||||||
} else if (f.drawtype == NDT_NORMAL || f.drawtype == NDT_ALLFACES) {
|
} else if (f.drawtype == NDT_NORMAL || f.drawtype == NDT_ALLFACES) {
|
||||||
setCube(f, def.wield_scale, tsrc);
|
setCube(f, def.wield_scale);
|
||||||
} else {
|
} else {
|
||||||
MeshMakeData mesh_make_data(client, false);
|
MeshMakeData mesh_make_data(client, false);
|
||||||
MapNode mesh_make_node(id, 255, 0);
|
MapNode mesh_make_node(id, 255, 0);
|
||||||
@ -373,14 +371,14 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// no wield mesh found
|
// no wield mesh found
|
||||||
changeToMesh(NULL);
|
changeToMesh(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WieldMeshSceneNode::setColor(video::SColor c)
|
void WieldMeshSceneNode::setColor(video::SColor c)
|
||||||
{
|
{
|
||||||
assert(!m_lighting);
|
assert(!m_lighting);
|
||||||
scene::IMesh *mesh=m_meshnode->getMesh();
|
scene::IMesh *mesh = m_meshnode->getMesh();
|
||||||
if (mesh == NULL)
|
if (!mesh)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
u8 red = c.getRed();
|
u8 red = c.getRed();
|
||||||
@ -408,7 +406,7 @@ void WieldMeshSceneNode::render()
|
|||||||
|
|
||||||
void WieldMeshSceneNode::changeToMesh(scene::IMesh *mesh)
|
void WieldMeshSceneNode::changeToMesh(scene::IMesh *mesh)
|
||||||
{
|
{
|
||||||
if (mesh == NULL) {
|
if (!mesh) {
|
||||||
scene::IMesh *dummymesh = g_extrusion_mesh_cache->createCube();
|
scene::IMesh *dummymesh = g_extrusion_mesh_cache->createCube();
|
||||||
m_meshnode->setVisible(false);
|
m_meshnode->setVisible(false);
|
||||||
m_meshnode->setMesh(dummymesh);
|
m_meshnode->setMesh(dummymesh);
|
||||||
@ -438,7 +436,7 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result)
|
|||||||
g_extrusion_mesh_cache->grab();
|
g_extrusion_mesh_cache->grab();
|
||||||
}
|
}
|
||||||
|
|
||||||
scene::SMesh *mesh = NULL;
|
scene::SMesh *mesh = nullptr;
|
||||||
|
|
||||||
// Shading is on by default
|
// Shading is on by default
|
||||||
result->needs_shading = true;
|
result->needs_shading = true;
|
||||||
@ -499,20 +497,18 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result)
|
|||||||
rotateMeshXZby(mesh, -45);
|
rotateMeshXZby(mesh, -45);
|
||||||
rotateMeshYZby(mesh, -30);
|
rotateMeshYZby(mesh, -30);
|
||||||
|
|
||||||
postProcessNodeMesh(mesh, f, false, false, NULL,
|
postProcessNodeMesh(mesh, f, false, false, nullptr, &result->buffer_colors);
|
||||||
&result->buffer_colors);
|
|
||||||
}
|
}
|
||||||
result->mesh = mesh;
|
result->mesh = mesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
scene::SMesh * getExtrudedMesh(ITextureSource *tsrc,
|
scene::SMesh *getExtrudedMesh(ITextureSource *tsrc, const std::string &imagename)
|
||||||
const std::string &imagename)
|
|
||||||
{
|
{
|
||||||
video::ITexture *texture = tsrc->getTextureForMesh(imagename);
|
video::ITexture *texture = tsrc->getTextureForMesh(imagename);
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
core::dimension2d<u32> dim = texture->getSize();
|
core::dimension2d<u32> dim = texture->getSize();
|
||||||
|
@ -38,13 +38,13 @@ struct ItemPartColor
|
|||||||
* will be used instead of the specific color of the
|
* will be used instead of the specific color of the
|
||||||
* buffer.
|
* buffer.
|
||||||
*/
|
*/
|
||||||
bool override_base;
|
bool override_base = false;
|
||||||
/*!
|
/*!
|
||||||
* The color of the buffer.
|
* The color of the buffer.
|
||||||
*/
|
*/
|
||||||
video::SColor color;
|
video::SColor color = 0;
|
||||||
|
|
||||||
ItemPartColor() : override_base(false), color(0) {}
|
ItemPartColor() {}
|
||||||
|
|
||||||
ItemPartColor(bool override, video::SColor color)
|
ItemPartColor(bool override, video::SColor color)
|
||||||
: override_base(override), color(color)
|
: override_base(override), color(color)
|
||||||
@ -54,7 +54,7 @@ struct ItemPartColor
|
|||||||
|
|
||||||
struct ItemMesh
|
struct ItemMesh
|
||||||
{
|
{
|
||||||
scene::IMesh *mesh;
|
scene::IMesh *mesh = nullptr;
|
||||||
/*!
|
/*!
|
||||||
* Stores the color of each mesh buffer.
|
* Stores the color of each mesh buffer.
|
||||||
*/
|
*/
|
||||||
@ -63,9 +63,9 @@ struct ItemMesh
|
|||||||
* If false, all faces of the item should have the same brightness.
|
* If false, all faces of the item should have the same brightness.
|
||||||
* Disables shading based on normal vectors.
|
* Disables shading based on normal vectors.
|
||||||
*/
|
*/
|
||||||
bool needs_shading;
|
bool needs_shading = true;
|
||||||
|
|
||||||
ItemMesh() : mesh(NULL), buffer_colors(), needs_shading(true) {}
|
ItemMesh() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -78,7 +78,7 @@ public:
|
|||||||
s32 id = -1, bool lighting = false);
|
s32 id = -1, bool lighting = false);
|
||||||
virtual ~WieldMeshSceneNode();
|
virtual ~WieldMeshSceneNode();
|
||||||
|
|
||||||
void setCube(const ContentFeatures &f, v3f wield_scale, ITextureSource *tsrc);
|
void setCube(const ContentFeatures &f, v3f wield_scale);
|
||||||
void setExtruded(const std::string &imagename, v3f wield_scale,
|
void setExtruded(const std::string &imagename, v3f wield_scale,
|
||||||
ITextureSource *tsrc, u8 num_frames);
|
ITextureSource *tsrc, u8 num_frames);
|
||||||
void setItem(const ItemStack &item, Client *client);
|
void setItem(const ItemStack &item, Client *client);
|
||||||
@ -97,7 +97,7 @@ private:
|
|||||||
void changeToMesh(scene::IMesh *mesh);
|
void changeToMesh(scene::IMesh *mesh);
|
||||||
|
|
||||||
// Child scene node with the current wield mesh
|
// Child scene node with the current wield mesh
|
||||||
scene::IMeshSceneNode *m_meshnode;
|
scene::IMeshSceneNode *m_meshnode = nullptr;
|
||||||
video::E_MATERIAL_TYPE m_material_type;
|
video::E_MATERIAL_TYPE m_material_type;
|
||||||
|
|
||||||
// True if EMF_LIGHTING should be enabled.
|
// True if EMF_LIGHTING should be enabled.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user