forked from oerkki/voxelands
remove nodemod/tempmod
This commit is contained in:
parent
b91697527a
commit
e150faf7dc
|
@ -797,11 +797,6 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||||
p.Y = readS16(&data[4]);
|
p.Y = readS16(&data[4]);
|
||||||
p.Z = readS16(&data[6]);
|
p.Z = readS16(&data[6]);
|
||||||
|
|
||||||
//TimeTaker t1("TOCLIENT_REMOVENODE");
|
|
||||||
|
|
||||||
// This will clear the cracking animation after digging
|
|
||||||
((ClientMap&)m_env.getMap()).clearTempMod(p);
|
|
||||||
|
|
||||||
removeNode(p);
|
removeNode(p);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2276,34 +2271,6 @@ float Client::getEnergy()
|
||||||
return player->getEnergy();
|
return player->getEnergy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::setTempMod(v3s16 p, NodeMod mod)
|
|
||||||
{
|
|
||||||
//JMutexAutoLock envlock(m_env_mutex); //bulk comment-out
|
|
||||||
assert(m_env.getMap().mapType() == MAPTYPE_CLIENT);
|
|
||||||
|
|
||||||
core::map<v3s16, MapBlock*> affected_blocks;
|
|
||||||
((ClientMap&)m_env.getMap()).setTempMod(p, mod, &affected_blocks);
|
|
||||||
|
|
||||||
for(core::map<v3s16, MapBlock*>::Iterator i = affected_blocks.getIterator(); i.atEnd() == false; i++) {
|
|
||||||
MapBlock *block = i.getNode()->getValue();
|
|
||||||
addUpdateMeshTask(block->getPos());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Client::clearTempMod(v3s16 p)
|
|
||||||
{
|
|
||||||
//JMutexAutoLock envlock(m_env_mutex); //bulk comment-out
|
|
||||||
assert(m_env.getMap().mapType() == MAPTYPE_CLIENT);
|
|
||||||
|
|
||||||
core::map<v3s16, MapBlock*> affected_blocks;
|
|
||||||
((ClientMap&)m_env.getMap()).clearTempMod(p, &affected_blocks);
|
|
||||||
|
|
||||||
for(core::map<v3s16, MapBlock*>::Iterator i = affected_blocks.getIterator(); i.atEnd() == false; i++) {
|
|
||||||
MapBlock *block = i.getNode()->getValue();
|
|
||||||
addUpdateMeshTask(block->getPos());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Client::addUpdateMeshTask(v3s16 p, bool ack_to_server, bool refresh_only)
|
void Client::addUpdateMeshTask(v3s16 p, bool ack_to_server, bool refresh_only)
|
||||||
{
|
{
|
||||||
MapBlock *b = m_env.getMap().getBlockNoCreateNoEx(p);
|
MapBlock *b = m_env.getMap().getBlockNoCreateNoEx(p);
|
||||||
|
|
|
@ -271,9 +271,6 @@ public:
|
||||||
u16 getHunger();
|
u16 getHunger();
|
||||||
float getEnergy();
|
float getEnergy();
|
||||||
|
|
||||||
void setTempMod(v3s16 p, NodeMod mod);
|
|
||||||
void clearTempMod(v3s16 p);
|
|
||||||
|
|
||||||
bool getChatMessage(std::wstring &message)
|
bool getChatMessage(std::wstring &message)
|
||||||
{
|
{
|
||||||
if(m_chat_queue.size() == 0)
|
if(m_chat_queue.size() == 0)
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
#define MAP_BLOCKSIZE 16
|
#define MAP_BLOCKSIZE 16
|
||||||
/*
|
/*
|
||||||
This makes mesh updates too slow, as many meshes are updated during
|
This makes mesh updates too slow, as many meshes are updated during
|
||||||
the main loop (related to TempMods and day/night)
|
the main loop (related to day/night)
|
||||||
*/
|
*/
|
||||||
//#define MAP_BLOCKSIZE 32
|
//#define MAP_BLOCKSIZE 32
|
||||||
|
|
||||||
|
|
|
@ -569,7 +569,7 @@ static void meshgen_cuboid(
|
||||||
const aabb3f &box,
|
const aabb3f &box,
|
||||||
TileSpec *tiles,
|
TileSpec *tiles,
|
||||||
int tilecount,
|
int tilecount,
|
||||||
bool selected,
|
SelectedNode selected,
|
||||||
const f32* txc,
|
const f32* txc,
|
||||||
v3s16 angle,
|
v3s16 angle,
|
||||||
v3f centre,
|
v3f centre,
|
||||||
|
@ -727,7 +727,7 @@ static void meshgen_cuboid(
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (cols) {
|
if (cols) {
|
||||||
meshgen_custom_lights(colours,cols[0],cols[1],cols[2],cols[3],4);
|
meshgen_custom_lights(colours,cols[0],cols[1],cols[2],cols[3],4);
|
||||||
}else if (selected) {
|
}else if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,4);
|
meshgen_selected_lights(colours,255,4);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,faces[i],4,vertices[i]);
|
meshgen_lights(data,n,p,colours,255,faces[i],4,vertices[i]);
|
||||||
|
@ -740,7 +740,7 @@ static void meshgen_cuboid(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: this can also have the fuck optimised out of it, make less faces where possible */
|
/* TODO: this can also have the fuck optimised out of it, make less faces where possible */
|
||||||
static void meshgen_build_nodebox(MeshMakeData *data, v3s16 p, MapNode &n, bool selected, std::vector<NodeBox> &boxes, TileSpec *tiles)
|
static void meshgen_build_nodebox(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected, std::vector<NodeBox> &boxes, TileSpec *tiles)
|
||||||
{
|
{
|
||||||
v3f pos = intToFloat(p,BS);
|
v3f pos = intToFloat(p,BS);
|
||||||
for (std::vector<NodeBox>::iterator i = boxes.begin(); i != boxes.end(); i++) {
|
for (std::vector<NodeBox>::iterator i = boxes.begin(); i != boxes.end(); i++) {
|
||||||
|
@ -771,7 +771,7 @@ static void meshgen_build_nodebox(MeshMakeData *data, v3s16 p, MapNode &n, bool
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void meshgen_rooftri(MeshMakeData *data, MapNode &n, v3s16 p, v3f corners[3], v3f pos, TileSpec &tile, bool selected, s16 rot, v3s16 face)
|
static void meshgen_rooftri(MeshMakeData *data, MapNode &n, v3s16 p, v3f corners[3], v3f pos, TileSpec &tile, SelectedNode selected, s16 rot, v3s16 face)
|
||||||
{
|
{
|
||||||
// vertices for top and bottom tri
|
// vertices for top and bottom tri
|
||||||
v3f top_v[3];
|
v3f top_v[3];
|
||||||
|
@ -815,7 +815,7 @@ static void meshgen_rooftri(MeshMakeData *data, MapNode &n, v3s16 p, v3f corners
|
||||||
};
|
};
|
||||||
u16 indices[] = {0,1,2};
|
u16 indices[] = {0,1,2};
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,3);
|
meshgen_selected_lights(colours,255,3);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,downface,3,tri_v);
|
meshgen_lights(data,n,p,colours,255,downface,3,tri_v);
|
||||||
|
@ -833,7 +833,7 @@ static void meshgen_rooftri(MeshMakeData *data, MapNode &n, v3s16 p, v3f corners
|
||||||
};
|
};
|
||||||
u16 indices[] = {0,1,2};
|
u16 indices[] = {0,1,2};
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,3);
|
meshgen_selected_lights(colours,255,3);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,upface,3,tri_v);
|
meshgen_lights(data,n,p,colours,255,upface,3,tri_v);
|
||||||
|
@ -845,7 +845,7 @@ static void meshgen_rooftri(MeshMakeData *data, MapNode &n, v3s16 p, v3f corners
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void meshgen_leaftri(MeshMakeData *data, MapNode &n, v3s16 p, v3f corners[3], v3f pos, TileSpec &tile, bool selected, s16 rot)
|
static void meshgen_leaftri(MeshMakeData *data, MapNode &n, v3s16 p, v3f corners[3], v3f pos, TileSpec &tile, SelectedNode selected, s16 rot)
|
||||||
{
|
{
|
||||||
// vertices
|
// vertices
|
||||||
v3f v[3];
|
v3f v[3];
|
||||||
|
@ -871,7 +871,7 @@ static void meshgen_leaftri(MeshMakeData *data, MapNode &n, v3s16 p, v3f corners
|
||||||
};
|
};
|
||||||
u16 indices[] = {0,1,2};
|
u16 indices[] = {0,1,2};
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,3);
|
meshgen_selected_lights(colours,255,3);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,v3s16(0,0,0),3,tri_v);
|
meshgen_lights(data,n,p,colours,255,v3s16(0,0,0),3,tri_v);
|
||||||
|
@ -891,11 +891,11 @@ void meshgen_preset_smooth_lights(MeshMakeData *data, v3s16 p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_cubelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
void meshgen_cubelike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected)
|
||||||
{
|
{
|
||||||
v3f pos = intToFloat(p, BS);
|
v3f pos = intToFloat(p, BS);
|
||||||
if (meshgen_hardface(data,p,n,v3s16(-1,0,0))) {
|
if (meshgen_hardface(data,p,n,v3s16(-1,0,0))) {
|
||||||
TileSpec tile = getNodeTile(n,p,v3s16(-1,0,0),data->m_temp_mods,NULL);
|
TileSpec tile = getNodeTile(n,p,v3s16(-1,0,0),data->m_select[p+data->m_blockpos_nodes],NULL);
|
||||||
video::S3DVertex vertices[4] = {
|
video::S3DVertex vertices[4] = {
|
||||||
video::S3DVertex(-0.5*BS, 0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0()),
|
video::S3DVertex(-0.5*BS, 0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0()),
|
||||||
video::S3DVertex(-0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
|
video::S3DVertex(-0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
|
||||||
|
@ -905,7 +905,7 @@ void meshgen_cubelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
|
|
||||||
u16 indices[6] = {0,1,2,2,3,0};
|
u16 indices[6] = {0,1,2,2,3,0};
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,4);
|
meshgen_selected_lights(colours,255,4);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,v3s16(-1,0,0),4,vertices);
|
meshgen_lights(data,n,p,colours,255,v3s16(-1,0,0),4,vertices);
|
||||||
|
@ -918,7 +918,7 @@ void meshgen_cubelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
data->append(tile.getMaterial(), vertices, 4, indices, 6, colours);
|
data->append(tile.getMaterial(), vertices, 4, indices, 6, colours);
|
||||||
}
|
}
|
||||||
if (meshgen_hardface(data,p,n,v3s16(1,0,0))) {
|
if (meshgen_hardface(data,p,n,v3s16(1,0,0))) {
|
||||||
TileSpec tile = getNodeTile(n,p,v3s16(1,0,0),data->m_temp_mods,NULL);
|
TileSpec tile = getNodeTile(n,p,v3s16(1,0,0),data->m_select[p+data->m_blockpos_nodes],NULL);
|
||||||
video::S3DVertex vertices[4] = {
|
video::S3DVertex vertices[4] = {
|
||||||
video::S3DVertex(0.5*BS,-0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y1()),
|
video::S3DVertex(0.5*BS,-0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y1()),
|
||||||
video::S3DVertex(0.5*BS,-0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y1()),
|
video::S3DVertex(0.5*BS,-0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y1()),
|
||||||
|
@ -928,7 +928,7 @@ void meshgen_cubelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
|
|
||||||
u16 indices[6] = {0,1,2,2,3,0};
|
u16 indices[6] = {0,1,2,2,3,0};
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,4);
|
meshgen_selected_lights(colours,255,4);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,v3s16(1,0,0),4,vertices);
|
meshgen_lights(data,n,p,colours,255,v3s16(1,0,0),4,vertices);
|
||||||
|
@ -941,7 +941,7 @@ void meshgen_cubelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
data->append(tile.getMaterial(), vertices, 4, indices, 6, colours);
|
data->append(tile.getMaterial(), vertices, 4, indices, 6, colours);
|
||||||
}
|
}
|
||||||
if (meshgen_hardface(data,p,n,v3s16(0,-1,0))) {
|
if (meshgen_hardface(data,p,n,v3s16(0,-1,0))) {
|
||||||
TileSpec tile = getNodeTile(n,p,v3s16(0,-1,0),data->m_temp_mods,NULL);
|
TileSpec tile = getNodeTile(n,p,v3s16(0,-1,0),data->m_select[p+data->m_blockpos_nodes],NULL);
|
||||||
video::S3DVertex vertices[4] = {
|
video::S3DVertex vertices[4] = {
|
||||||
video::S3DVertex( 0.5*BS,-0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0()),
|
video::S3DVertex( 0.5*BS,-0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0()),
|
||||||
video::S3DVertex(-0.5*BS,-0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
|
video::S3DVertex(-0.5*BS,-0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
|
||||||
|
@ -951,7 +951,7 @@ void meshgen_cubelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
|
|
||||||
u16 indices[6] = {0,1,2,2,3,0};
|
u16 indices[6] = {0,1,2,2,3,0};
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,4);
|
meshgen_selected_lights(colours,255,4);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,v3s16(0,-1,0),4,vertices);
|
meshgen_lights(data,n,p,colours,255,v3s16(0,-1,0),4,vertices);
|
||||||
|
@ -964,7 +964,7 @@ void meshgen_cubelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
data->append(tile.getMaterial(), vertices, 4, indices, 6, colours);
|
data->append(tile.getMaterial(), vertices, 4, indices, 6, colours);
|
||||||
}
|
}
|
||||||
if (meshgen_hardface(data,p,n,v3s16(0,1,0))) {
|
if (meshgen_hardface(data,p,n,v3s16(0,1,0))) {
|
||||||
TileSpec tile = getNodeTile(n,p,v3s16(0,1,0),data->m_temp_mods,NULL);
|
TileSpec tile = getNodeTile(n,p,v3s16(0,1,0),data->m_select[p+data->m_blockpos_nodes],NULL);
|
||||||
video::S3DVertex vertices[4] = {
|
video::S3DVertex vertices[4] = {
|
||||||
video::S3DVertex( 0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y1()),
|
video::S3DVertex( 0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y1()),
|
||||||
video::S3DVertex(-0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y1()),
|
video::S3DVertex(-0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y1()),
|
||||||
|
@ -974,7 +974,7 @@ void meshgen_cubelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
|
|
||||||
u16 indices[6] = {0,1,2,2,3,0};
|
u16 indices[6] = {0,1,2,2,3,0};
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,4);
|
meshgen_selected_lights(colours,255,4);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,v3s16(0,1,0),4,vertices);
|
meshgen_lights(data,n,p,colours,255,v3s16(0,1,0),4,vertices);
|
||||||
|
@ -987,7 +987,7 @@ void meshgen_cubelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
data->append(tile.getMaterial(), vertices, 4, indices, 6, colours);
|
data->append(tile.getMaterial(), vertices, 4, indices, 6, colours);
|
||||||
}
|
}
|
||||||
if (meshgen_hardface(data,p,n,v3s16(0,0,-1))) {
|
if (meshgen_hardface(data,p,n,v3s16(0,0,-1))) {
|
||||||
TileSpec tile = getNodeTile(n,p,v3s16(0,0,-1),data->m_temp_mods,NULL);
|
TileSpec tile = getNodeTile(n,p,v3s16(0,0,-1),data->m_select[p+data->m_blockpos_nodes],NULL);
|
||||||
video::S3DVertex vertices[4] = {
|
video::S3DVertex vertices[4] = {
|
||||||
video::S3DVertex(-0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0()),
|
video::S3DVertex(-0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0()),
|
||||||
video::S3DVertex( 0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
|
video::S3DVertex( 0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
|
||||||
|
@ -997,7 +997,7 @@ void meshgen_cubelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
|
|
||||||
u16 indices[6] = {0,1,2,2,3,0};
|
u16 indices[6] = {0,1,2,2,3,0};
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,4);
|
meshgen_selected_lights(colours,255,4);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,v3s16(0,0,-1),4,vertices);
|
meshgen_lights(data,n,p,colours,255,v3s16(0,0,-1),4,vertices);
|
||||||
|
@ -1010,7 +1010,7 @@ void meshgen_cubelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
data->append(tile.getMaterial(), vertices, 4, indices, 6, colours);
|
data->append(tile.getMaterial(), vertices, 4, indices, 6, colours);
|
||||||
}
|
}
|
||||||
if (meshgen_hardface(data,p,n,v3s16(0,0,1))) {
|
if (meshgen_hardface(data,p,n,v3s16(0,0,1))) {
|
||||||
TileSpec tile = getNodeTile(n,p,v3s16(0,0,1),data->m_temp_mods,NULL);
|
TileSpec tile = getNodeTile(n,p,v3s16(0,0,1),data->m_select[p+data->m_blockpos_nodes],NULL);
|
||||||
video::S3DVertex vertices[4] = {
|
video::S3DVertex vertices[4] = {
|
||||||
video::S3DVertex( 0.5*BS, 0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0()),
|
video::S3DVertex( 0.5*BS, 0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0()),
|
||||||
video::S3DVertex(-0.5*BS, 0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
|
video::S3DVertex(-0.5*BS, 0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
|
||||||
|
@ -1020,7 +1020,7 @@ void meshgen_cubelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
|
|
||||||
u16 indices[6] = {0,1,2,2,3,0};
|
u16 indices[6] = {0,1,2,2,3,0};
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,4);
|
meshgen_selected_lights(colours,255,4);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,v3s16(0,0,1),4,vertices);
|
meshgen_lights(data,n,p,colours,255,v3s16(0,0,1),4,vertices);
|
||||||
|
@ -1035,7 +1035,7 @@ void meshgen_cubelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: should use custom vertexes instead of boxes for curved rails */
|
/* TODO: should use custom vertexes instead of boxes for curved rails */
|
||||||
void meshgen_raillike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
void meshgen_raillike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected)
|
||||||
{
|
{
|
||||||
bool is_rail_x [] = { false, false }; /* x-1, x+1 */
|
bool is_rail_x [] = { false, false }; /* x-1, x+1 */
|
||||||
bool is_rail_z [] = { false, false }; /* z-1, z+1 */
|
bool is_rail_z [] = { false, false }; /* z-1, z+1 */
|
||||||
|
@ -1166,7 +1166,7 @@ void meshgen_raillike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
TileSpec *tile;
|
TileSpec *tile;
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
// Handles facedir rotation for textures
|
// Handles facedir rotation for textures
|
||||||
tiles[i] = getNodeTile(n,p,tile_dirs[i],data->m_temp_mods);
|
tiles[i] = getNodeTile(n,p,tile_dirs[i],data->m_select[p+data->m_blockpos_nodes]);
|
||||||
}
|
}
|
||||||
v3f pos = intToFloat(p,BS);
|
v3f pos = intToFloat(p,BS);
|
||||||
|
|
||||||
|
@ -1408,10 +1408,10 @@ void meshgen_raillike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_plantlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
void meshgen_plantlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected)
|
||||||
{
|
{
|
||||||
ContentFeatures *f = &content_features(n);
|
ContentFeatures *f = &content_features(n);
|
||||||
TileSpec tile = getNodeTile(n,p,v3s16(0,0,0),data->m_temp_mods);
|
TileSpec tile = getNodeTile(n,p,v3s16(0,0,0),data->m_select[p+data->m_blockpos_nodes]);
|
||||||
v3f offset(0,0,0);
|
v3f offset(0,0,0);
|
||||||
if (data->m_vmanip.getNodeRO(data->m_blockpos_nodes + p + v3s16(0,-1,0)).getContent() == CONTENT_FLOWER_POT)
|
if (data->m_vmanip.getNodeRO(data->m_blockpos_nodes + p + v3s16(0,-1,0)).getContent() == CONTENT_FLOWER_POT)
|
||||||
offset = v3f(0,-0.25*BS,0);
|
offset = v3f(0,-0.25*BS,0);
|
||||||
|
@ -1514,7 +1514,7 @@ void meshgen_plantlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
|
|
||||||
u16 indices[] = {0,1,2,2,3,0};
|
u16 indices[] = {0,1,2,2,3,0};
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,4);
|
meshgen_selected_lights(colours,255,4);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,v3s16(0,0,0),4,vertices);
|
meshgen_lights(data,n,p,colours,255,v3s16(0,0,0),4,vertices);
|
||||||
|
@ -1528,7 +1528,7 @@ void meshgen_plantlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_liquid(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
void meshgen_liquid(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected)
|
||||||
{
|
{
|
||||||
ContentFeatures *f = &content_features(n);
|
ContentFeatures *f = &content_features(n);
|
||||||
TileSpec *tiles = f->tiles;
|
TileSpec *tiles = f->tiles;
|
||||||
|
@ -1734,7 +1734,7 @@ void meshgen_liquid(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
|
|
||||||
u16 indices[] = {0,1,2,2,3,0};
|
u16 indices[] = {0,1,2,2,3,0};
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,f->vertex_alpha,4);
|
meshgen_selected_lights(colours,f->vertex_alpha,4);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,f->vertex_alpha,dir,4,vertices);
|
meshgen_lights(data,n,p,colours,f->vertex_alpha,dir,4,vertices);
|
||||||
|
@ -1769,7 +1769,7 @@ void meshgen_liquid(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
|
|
||||||
u16 indices[] = {0,1,2,2,3,0};
|
u16 indices[] = {0,1,2,2,3,0};
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,f->vertex_alpha,4);
|
meshgen_selected_lights(colours,f->vertex_alpha,4);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,f->vertex_alpha,v3s16(0,1,0),4,vertices);
|
meshgen_lights(data,n,p,colours,f->vertex_alpha,v3s16(0,1,0),4,vertices);
|
||||||
|
@ -1783,7 +1783,7 @@ void meshgen_liquid(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_liquid_source(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
void meshgen_liquid_source(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected)
|
||||||
{
|
{
|
||||||
ContentFeatures *f = &content_features(n);
|
ContentFeatures *f = &content_features(n);
|
||||||
TileSpec *tiles = f->tiles;
|
TileSpec *tiles = f->tiles;
|
||||||
|
@ -1945,7 +1945,7 @@ void meshgen_liquid_source(MeshMakeData *data, v3s16 p, MapNode &n, bool selecte
|
||||||
|
|
||||||
u16 indices[] = {0,1,2,2,3,0};
|
u16 indices[] = {0,1,2,2,3,0};
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,f->vertex_alpha,4);
|
meshgen_selected_lights(colours,f->vertex_alpha,4);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,f->vertex_alpha,g_6dirs[j],4,vertices);
|
meshgen_lights(data,n,p,colours,f->vertex_alpha,g_6dirs[j],4,vertices);
|
||||||
|
@ -1958,7 +1958,7 @@ void meshgen_liquid_source(MeshMakeData *data, v3s16 p, MapNode &n, bool selecte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_nodebox(MeshMakeData *data, v3s16 p, MapNode &n, bool selected, bool has_meta)
|
void meshgen_nodebox(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected, bool has_meta)
|
||||||
{
|
{
|
||||||
static const v3s16 tile_dirs[6] = {
|
static const v3s16 tile_dirs[6] = {
|
||||||
v3s16(0, 1, 0),
|
v3s16(0, 1, 0),
|
||||||
|
@ -1973,7 +1973,7 @@ void meshgen_nodebox(MeshMakeData *data, v3s16 p, MapNode &n, bool selected, boo
|
||||||
NodeMetadata *meta = data->m_env->getMap().getNodeMetadataClone(p+data->m_blockpos_nodes);
|
NodeMetadata *meta = data->m_env->getMap().getNodeMetadataClone(p+data->m_blockpos_nodes);
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
// Handles facedir rotation for textures
|
// Handles facedir rotation for textures
|
||||||
tiles[i] = getNodeTile(n,p,tile_dirs[i],data->m_temp_mods,meta);
|
tiles[i] = getNodeTile(n,p,tile_dirs[i],data->m_select[p+data->m_blockpos_nodes],meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<NodeBox> boxes = content_features(n).getNodeBoxes(n);
|
std::vector<NodeBox> boxes = content_features(n).getNodeBoxes(n);
|
||||||
|
@ -1989,7 +1989,7 @@ void meshgen_nodebox(MeshMakeData *data, v3s16 p, MapNode &n, bool selected, boo
|
||||||
if (boxes.size() > 0) {
|
if (boxes.size() > 0) {
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
// Handles facedir rotation for textures
|
// Handles facedir rotation for textures
|
||||||
tiles[i] = getMetaTile(n,p,tile_dirs[i],data->m_temp_mods);
|
tiles[i] = getMetaTile(n,p,tile_dirs[i],data->m_select[p+data->m_blockpos_nodes]);
|
||||||
}
|
}
|
||||||
meshgen_build_nodebox(data,p,n,selected,boxes,tiles);
|
meshgen_build_nodebox(data,p,n,selected,boxes,tiles);
|
||||||
}
|
}
|
||||||
|
@ -1997,7 +1997,7 @@ void meshgen_nodebox(MeshMakeData *data, v3s16 p, MapNode &n, bool selected, boo
|
||||||
delete meta;
|
delete meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_glasslike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
void meshgen_glasslike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected)
|
||||||
{
|
{
|
||||||
static const v3s16 tile_dirs[6] = {
|
static const v3s16 tile_dirs[6] = {
|
||||||
v3s16(0, 1, 0),
|
v3s16(0, 1, 0),
|
||||||
|
@ -2011,7 +2011,7 @@ void meshgen_glasslike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
TileSpec tiles[6];
|
TileSpec tiles[6];
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
// Handles facedir rotation for textures
|
// Handles facedir rotation for textures
|
||||||
tiles[i] = getNodeTile(n,p,tile_dirs[i],data->m_temp_mods);
|
tiles[i] = getNodeTile(n,p,tile_dirs[i],data->m_select[p+data->m_blockpos_nodes]);
|
||||||
}
|
}
|
||||||
|
|
||||||
v3f pos = intToFloat(p,BS);
|
v3f pos = intToFloat(p,BS);
|
||||||
|
@ -2067,7 +2067,7 @@ void meshgen_glasslike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
|
|
||||||
u16 indices[] = {0,1,2,2,3,0};
|
u16 indices[] = {0,1,2,2,3,0};
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,4);
|
meshgen_selected_lights(colours,255,4);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,g_6dirs[j],4,vertices);
|
meshgen_lights(data,n,p,colours,255,g_6dirs[j],4,vertices);
|
||||||
|
@ -2081,7 +2081,7 @@ void meshgen_glasslike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_torchlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
void meshgen_torchlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected)
|
||||||
{
|
{
|
||||||
static const f32 txc[24] = {
|
static const f32 txc[24] = {
|
||||||
0.625,0.125,0.75,0.25,
|
0.625,0.125,0.75,0.25,
|
||||||
|
@ -2192,7 +2192,7 @@ void meshgen_torchlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
// Add to mesh collector
|
// Add to mesh collector
|
||||||
for (s32 j=0; j<6; j++) {
|
for (s32 j=0; j<6; j++) {
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,4);
|
meshgen_selected_lights(colours,255,4);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,faces[j],4,vertices[j]);
|
meshgen_lights(data,n,p,colours,255,faces[j],4,vertices[j]);
|
||||||
|
@ -2206,7 +2206,7 @@ void meshgen_torchlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_fencelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
void meshgen_fencelike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected)
|
||||||
{
|
{
|
||||||
static const v3s16 tile_dirs[6] = {
|
static const v3s16 tile_dirs[6] = {
|
||||||
v3s16( 0, 1, 0),
|
v3s16( 0, 1, 0),
|
||||||
|
@ -2239,7 +2239,7 @@ void meshgen_fencelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
TileSpec tiles[6];
|
TileSpec tiles[6];
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
// Handles facedir rotation for textures
|
// Handles facedir rotation for textures
|
||||||
tiles[i] = getNodeTile(n,p,tile_dirs[i],data->m_temp_mods);
|
tiles[i] = getNodeTile(n,p,tile_dirs[i],data->m_select[p+data->m_blockpos_nodes]);
|
||||||
}
|
}
|
||||||
|
|
||||||
v3f pos = intToFloat(p, BS);
|
v3f pos = intToFloat(p, BS);
|
||||||
|
@ -2349,9 +2349,9 @@ void meshgen_fencelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_firelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
void meshgen_firelike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected)
|
||||||
{
|
{
|
||||||
TileSpec tile = getNodeTile(n,p,v3s16(0,1,0),data->m_temp_mods);
|
TileSpec tile = getNodeTile(n,p,v3s16(0,1,0),data->m_select[p+data->m_blockpos_nodes]);
|
||||||
content_t current = n.getContent();
|
content_t current = n.getContent();
|
||||||
content_t n2c;
|
content_t n2c;
|
||||||
MapNode n2;
|
MapNode n2;
|
||||||
|
@ -2422,7 +2422,7 @@ void meshgen_firelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
}
|
}
|
||||||
u16 indices[] = {0,1,2,2,3,0};
|
u16 indices[] = {0,1,2,2,3,0};
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,4);
|
meshgen_selected_lights(colours,255,4);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,v3s16(0,0,0),4,vertices);
|
meshgen_lights(data,n,p,colours,255,v3s16(0,0,0),4,vertices);
|
||||||
|
@ -2436,7 +2436,7 @@ void meshgen_firelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_walllike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
void meshgen_walllike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected)
|
||||||
{
|
{
|
||||||
static const v3s16 tile_dirs[6] = {
|
static const v3s16 tile_dirs[6] = {
|
||||||
v3s16(0, 1, 0),
|
v3s16(0, 1, 0),
|
||||||
|
@ -2452,7 +2452,7 @@ void meshgen_walllike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
TileSpec tiles[6];
|
TileSpec tiles[6];
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
// Handles facedir rotation for textures
|
// Handles facedir rotation for textures
|
||||||
tiles[i] = getNodeTile(n,p,tile_dirs[i],data->m_temp_mods);
|
tiles[i] = getNodeTile(n,p,tile_dirs[i],data->m_select[p+data->m_blockpos_nodes]);
|
||||||
}
|
}
|
||||||
|
|
||||||
v3f pos = intToFloat(p, BS);
|
v3f pos = intToFloat(p, BS);
|
||||||
|
@ -2542,7 +2542,7 @@ void meshgen_walllike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_rooflike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
void meshgen_rooflike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected)
|
||||||
{
|
{
|
||||||
bool is_roof_x [] = { false, false }; /* x-1, x+1 */
|
bool is_roof_x [] = { false, false }; /* x-1, x+1 */
|
||||||
bool is_roof_z [] = { false, false }; /* z-1, z+1 */
|
bool is_roof_z [] = { false, false }; /* z-1, z+1 */
|
||||||
|
@ -2593,8 +2593,8 @@ void meshgen_rooflike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
u8 adjacencies = is_roof_x[0] + is_roof_x[1] + is_roof_z[0] + is_roof_z[1];
|
u8 adjacencies = is_roof_x[0] + is_roof_x[1] + is_roof_z[0] + is_roof_z[1];
|
||||||
|
|
||||||
// get the tile, with crack if being dug
|
// get the tile, with crack if being dug
|
||||||
TileSpec tile = getNodeTile(n,p,v3s16(0,1,0),data->m_temp_mods);
|
TileSpec tile = getNodeTile(n,p,v3s16(0,1,0),data->m_select[p+data->m_blockpos_nodes]);
|
||||||
TileSpec toptile = getNodeTile(n,p,v3s16(0,-1,0),data->m_temp_mods);
|
TileSpec toptile = getNodeTile(n,p,v3s16(0,-1,0),data->m_select[p+data->m_blockpos_nodes]);
|
||||||
|
|
||||||
u8 type = 0;
|
u8 type = 0;
|
||||||
s16 angle = 0;
|
s16 angle = 0;
|
||||||
|
@ -3478,7 +3478,7 @@ void meshgen_rooflike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_leaflike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
void meshgen_leaflike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected)
|
||||||
{
|
{
|
||||||
bool is_xp = false;
|
bool is_xp = false;
|
||||||
bool is_xm = false;
|
bool is_xm = false;
|
||||||
|
@ -3514,8 +3514,8 @@ void meshgen_leaflike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
is_xmzm = true;
|
is_xmzm = true;
|
||||||
|
|
||||||
// get the tile, with crack if being dug
|
// get the tile, with crack if being dug
|
||||||
TileSpec tile = getNodeTile(n,p,v3s16(0,1,0),data->m_temp_mods);
|
TileSpec tile = getNodeTile(n,p,v3s16(0,1,0),data->m_select[p+data->m_blockpos_nodes]);
|
||||||
TileSpec toptile = getNodeTile(n,p,v3s16(0,-1,0),data->m_temp_mods);
|
TileSpec toptile = getNodeTile(n,p,v3s16(0,-1,0),data->m_select[p+data->m_blockpos_nodes]);
|
||||||
|
|
||||||
u8 type = 0;
|
u8 type = 0;
|
||||||
s16 angle = 0;
|
s16 angle = 0;
|
||||||
|
@ -3653,7 +3653,7 @@ void meshgen_leaflike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_wirelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected, bool is3d)
|
void meshgen_wirelike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected, bool is3d)
|
||||||
{
|
{
|
||||||
MapNode n_plus_y = data->m_vmanip.getNodeNoEx(data->m_blockpos_nodes + p + v3s16(0,1,0));
|
MapNode n_plus_y = data->m_vmanip.getNodeNoEx(data->m_blockpos_nodes + p + v3s16(0,1,0));
|
||||||
MapNode n_minus_x = data->m_vmanip.getNodeNoEx(data->m_blockpos_nodes + p + v3s16(-1,0,0));
|
MapNode n_minus_x = data->m_vmanip.getNodeNoEx(data->m_blockpos_nodes + p + v3s16(-1,0,0));
|
||||||
|
@ -3790,12 +3790,12 @@ void meshgen_wirelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected, bo
|
||||||
TileSpec tiles[6];
|
TileSpec tiles[6];
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
// Handles facedir rotation for textures
|
// Handles facedir rotation for textures
|
||||||
tiles[i] = getNodeTile(n,p,tile_dirs[i],data->m_temp_mods);
|
tiles[i] = getNodeTile(n,p,tile_dirs[i],data->m_select[p+data->m_blockpos_nodes]);
|
||||||
}
|
}
|
||||||
|
|
||||||
v3f pos = intToFloat(p, BS);
|
v3f pos = intToFloat(p, BS);
|
||||||
u8 cols[4] = {250,64,64,64};
|
u8 cols[4] = {250,64,64,64};
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
cols[0] = 255;
|
cols[0] = 255;
|
||||||
cols[1] = 64;
|
cols[1] = 64;
|
||||||
cols[2] = 64;
|
cols[2] = 64;
|
||||||
|
@ -4047,7 +4047,7 @@ void meshgen_wirelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected, bo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_stairlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
void meshgen_stairlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected)
|
||||||
{
|
{
|
||||||
static v3s16 faces[6] = {
|
static v3s16 faces[6] = {
|
||||||
v3s16( 0, 1, 0),
|
v3s16( 0, 1, 0),
|
||||||
|
@ -4069,7 +4069,7 @@ void meshgen_stairlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
TileSpec tiles[6];
|
TileSpec tiles[6];
|
||||||
for (int i=0; i<6; i++) {
|
for (int i=0; i<6; i++) {
|
||||||
// Handles facedir rotation for textures
|
// Handles facedir rotation for textures
|
||||||
tiles[i] = getNodeTile(n,p,faces[i],data->m_temp_mods);
|
tiles[i] = getNodeTile(n,p,faces[i],data->m_select[p+data->m_blockpos_nodes]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool urot = (n.getContent() >= CONTENT_SLAB_STAIR_UD_MIN && n.getContent() <= CONTENT_SLAB_STAIR_UD_MAX);
|
bool urot = (n.getContent() >= CONTENT_SLAB_STAIR_UD_MIN && n.getContent() <= CONTENT_SLAB_STAIR_UD_MAX);
|
||||||
|
@ -4273,7 +4273,7 @@ void meshgen_stairlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
vertices[i][j].TCoords += tiles[i].texture.pos;
|
vertices[i][j].TCoords += tiles[i].texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,vcounts[i]);
|
meshgen_selected_lights(colours,255,vcounts[i]);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,f,vcounts[i],vertices[i]);
|
meshgen_lights(data,n,p,colours,255,f,vcounts[i],vertices[i]);
|
||||||
|
@ -4297,7 +4297,7 @@ void meshgen_stairlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
vertices[i][j].TCoords += tiles[i].texture.pos;
|
vertices[i][j].TCoords += tiles[i].texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,vcounts[i]);
|
meshgen_selected_lights(colours,255,vcounts[i]);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,f,vcounts[i],vertices[i]);
|
meshgen_lights(data,n,p,colours,255,f,vcounts[i],vertices[i]);
|
||||||
|
@ -4322,7 +4322,7 @@ void meshgen_stairlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
vertices[i][j].TCoords += tiles[i].texture.pos;
|
vertices[i][j].TCoords += tiles[i].texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,vcounts[i]);
|
meshgen_selected_lights(colours,255,vcounts[i]);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,f,vcounts[i],vertices[i]);
|
meshgen_lights(data,n,p,colours,255,f,vcounts[i],vertices[i]);
|
||||||
|
@ -4343,7 +4343,7 @@ void meshgen_stairlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
vertices[i][j].TCoords += tiles[i].texture.pos;
|
vertices[i][j].TCoords += tiles[i].texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,vcounts[i]);
|
meshgen_selected_lights(colours,255,vcounts[i]);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,faces[i],vcounts[i],vertices[i]);
|
meshgen_lights(data,n,p,colours,255,faces[i],vcounts[i],vertices[i]);
|
||||||
|
@ -4358,7 +4358,7 @@ void meshgen_stairlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_slablike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
void meshgen_slablike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected)
|
||||||
{
|
{
|
||||||
static v3s16 faces[6] = {
|
static v3s16 faces[6] = {
|
||||||
v3s16( 0, 1, 0),
|
v3s16( 0, 1, 0),
|
||||||
|
@ -4380,7 +4380,7 @@ void meshgen_slablike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
TileSpec tiles[6];
|
TileSpec tiles[6];
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
// Handles facedir rotation for textures
|
// Handles facedir rotation for textures
|
||||||
tiles[i] = getNodeTile(n,p,faces[i],data->m_temp_mods);
|
tiles[i] = getNodeTile(n,p,faces[i],data->m_select[p+data->m_blockpos_nodes]);
|
||||||
}
|
}
|
||||||
v3f pos = intToFloat(p, BS);
|
v3f pos = intToFloat(p, BS);
|
||||||
|
|
||||||
|
@ -4439,7 +4439,7 @@ void meshgen_slablike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
vertices[i][j].TCoords += tiles[i].texture.pos;
|
vertices[i][j].TCoords += tiles[i].texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,4);
|
meshgen_selected_lights(colours,255,4);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,ufaces[i],4,vertices[i]);
|
meshgen_lights(data,n,p,colours,255,ufaces[i],4,vertices[i]);
|
||||||
|
@ -4463,7 +4463,7 @@ void meshgen_slablike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
vertices[i][j].TCoords += tiles[i].texture.pos;
|
vertices[i][j].TCoords += tiles[i].texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,4);
|
meshgen_selected_lights(colours,255,4);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,faces[i],4,vertices[i]);
|
meshgen_lights(data,n,p,colours,255,faces[i],4,vertices[i]);
|
||||||
|
@ -4478,7 +4478,7 @@ void meshgen_slablike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected)
|
||||||
{
|
{
|
||||||
bool x_plus = false;
|
bool x_plus = false;
|
||||||
bool x_plus_any = false;
|
bool x_plus_any = false;
|
||||||
|
@ -4546,8 +4546,8 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
}else if (!meshgen_hardface(data,p,n,v3s16(0,0,-1))) {
|
}else if (!meshgen_hardface(data,p,n,v3s16(0,0,-1))) {
|
||||||
z_minus_any = true;
|
z_minus_any = true;
|
||||||
}
|
}
|
||||||
TileSpec tile = getNodeTile(n,p,v3s16(1,0,0),data->m_temp_mods);
|
TileSpec tile = getNodeTile(n,p,v3s16(1,0,0),data->m_select[p+data->m_blockpos_nodes]);
|
||||||
TileSpec endtile = getNodeTile(n,p,v3s16(0,1,0),data->m_temp_mods);
|
TileSpec endtile = getNodeTile(n,p,v3s16(0,1,0),data->m_select[p+data->m_blockpos_nodes]);
|
||||||
video::S3DVertex vertices[10] = {
|
video::S3DVertex vertices[10] = {
|
||||||
video::S3DVertex(0 ,-BS*0.5,BS*0.499, 0,0,0, video::SColor(255,255,255,255), 0.125, 0.),
|
video::S3DVertex(0 ,-BS*0.5,BS*0.499, 0,0,0, video::SColor(255,255,255,255), 0.125, 0.),
|
||||||
video::S3DVertex(BS*0.125,-BS*0.5,BS*0.499, 0,0,0, video::SColor(255,255,255,255), 0.25, 0.),
|
video::S3DVertex(BS*0.125,-BS*0.5,BS*0.499, 0,0,0, video::SColor(255,255,255,255), 0.25, 0.),
|
||||||
|
@ -4612,7 +4612,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += tile.texture.pos;
|
v[i].TCoords += tile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,10);
|
meshgen_selected_lights(colours,255,10);
|
||||||
}else{
|
}else{
|
||||||
v3s16 f[3];
|
v3s16 f[3];
|
||||||
|
@ -4644,7 +4644,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += endtile.texture.pos;
|
v[i].TCoords += endtile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,6);
|
meshgen_selected_lights(colours,255,6);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,v3s16(0,1,0),6,v);
|
meshgen_lights(data,n,p,colours,255,v3s16(0,1,0),6,v);
|
||||||
|
@ -4668,7 +4668,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += endtile.texture.pos;
|
v[i].TCoords += endtile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,6);
|
meshgen_selected_lights(colours,255,6);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,v3s16(0,-1,0),6,v);
|
meshgen_lights(data,n,p,colours,255,v3s16(0,-1,0),6,v);
|
||||||
|
@ -4690,7 +4690,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += tile.texture.pos;
|
v[i].TCoords += tile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,6);
|
meshgen_selected_lights(colours,255,6);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,v3s16(0,1,0),6,v);
|
meshgen_lights(data,n,p,colours,255,v3s16(0,1,0),6,v);
|
||||||
|
@ -4715,7 +4715,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += tile.texture.pos;
|
v[i].TCoords += tile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,10);
|
meshgen_selected_lights(colours,255,10);
|
||||||
}else{
|
}else{
|
||||||
v3s16 f[3];
|
v3s16 f[3];
|
||||||
|
@ -4750,7 +4750,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += tile.texture.pos;
|
v[i].TCoords += tile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,10);
|
meshgen_selected_lights(colours,255,10);
|
||||||
}else{
|
}else{
|
||||||
v3s16 f[3];
|
v3s16 f[3];
|
||||||
|
@ -4785,7 +4785,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += tile.texture.pos;
|
v[i].TCoords += tile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,10);
|
meshgen_selected_lights(colours,255,10);
|
||||||
}else{
|
}else{
|
||||||
v3s16 f[3];
|
v3s16 f[3];
|
||||||
|
@ -4821,7 +4821,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += tile.texture.pos;
|
v[i].TCoords += tile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,10);
|
meshgen_selected_lights(colours,255,10);
|
||||||
}else{
|
}else{
|
||||||
v3s16 f[3];
|
v3s16 f[3];
|
||||||
|
@ -4857,7 +4857,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += tile.texture.pos;
|
v[i].TCoords += tile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,10);
|
meshgen_selected_lights(colours,255,10);
|
||||||
}else{
|
}else{
|
||||||
v3s16 f[3];
|
v3s16 f[3];
|
||||||
|
@ -4891,7 +4891,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += endtile.texture.pos;
|
v[i].TCoords += endtile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,6);
|
meshgen_selected_lights(colours,255,6);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,v3s16(1,0,0),6,v);
|
meshgen_lights(data,n,p,colours,255,v3s16(1,0,0),6,v);
|
||||||
|
@ -4915,7 +4915,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += endtile.texture.pos;
|
v[i].TCoords += endtile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,6);
|
meshgen_selected_lights(colours,255,6);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,v3s16(-1,0,0),6,v);
|
meshgen_lights(data,n,p,colours,255,v3s16(-1,0,0),6,v);
|
||||||
|
@ -4939,7 +4939,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += tile.texture.pos;
|
v[i].TCoords += tile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,10);
|
meshgen_selected_lights(colours,255,10);
|
||||||
}else{
|
}else{
|
||||||
v3s16 f[3];
|
v3s16 f[3];
|
||||||
|
@ -4975,7 +4975,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += tile.texture.pos;
|
v[i].TCoords += tile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,10);
|
meshgen_selected_lights(colours,255,10);
|
||||||
}else{
|
}else{
|
||||||
v3s16 f[3];
|
v3s16 f[3];
|
||||||
|
@ -5010,7 +5010,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += tile.texture.pos;
|
v[i].TCoords += tile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,10);
|
meshgen_selected_lights(colours,255,10);
|
||||||
}else{
|
}else{
|
||||||
v3s16 f[3];
|
v3s16 f[3];
|
||||||
|
@ -5044,7 +5044,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += endtile.texture.pos;
|
v[i].TCoords += endtile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,6);
|
meshgen_selected_lights(colours,255,6);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,v3s16(0,0,1),6,v);
|
meshgen_lights(data,n,p,colours,255,v3s16(0,0,1),6,v);
|
||||||
|
@ -5068,7 +5068,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += endtile.texture.pos;
|
v[i].TCoords += endtile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,6);
|
meshgen_selected_lights(colours,255,6);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,v3s16(0,0,-1),6,v);
|
meshgen_lights(data,n,p,colours,255,v3s16(0,0,-1),6,v);
|
||||||
|
@ -5093,7 +5093,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += tile.texture.pos;
|
v[i].TCoords += tile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,10);
|
meshgen_selected_lights(colours,255,10);
|
||||||
}else{
|
}else{
|
||||||
v3s16 f[3];
|
v3s16 f[3];
|
||||||
|
@ -5128,7 +5128,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
v[i].TCoords += tile.texture.pos;
|
v[i].TCoords += tile.texture.pos;
|
||||||
}
|
}
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,10);
|
meshgen_selected_lights(colours,255,10);
|
||||||
}else{
|
}else{
|
||||||
v3s16 f[3];
|
v3s16 f[3];
|
||||||
|
@ -5156,7 +5156,7 @@ void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_flaglike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
void meshgen_flaglike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected)
|
||||||
{
|
{
|
||||||
static const v3s16 tile_dirs[6] = {
|
static const v3s16 tile_dirs[6] = {
|
||||||
v3s16(0, 1, 0),
|
v3s16(0, 1, 0),
|
||||||
|
@ -5173,10 +5173,10 @@ void meshgen_flaglike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
NodeMetadata *meta = data->m_env->getMap().getNodeMetadataClone(p+data->m_blockpos_nodes);
|
NodeMetadata *meta = data->m_env->getMap().getNodeMetadataClone(p+data->m_blockpos_nodes);
|
||||||
for (u16 i=0; i<6; i++) {
|
for (u16 i=0; i<6; i++) {
|
||||||
// Handles facedir rotation for textures
|
// Handles facedir rotation for textures
|
||||||
tiles[i] = getNodeTile(pn,p,tile_dirs[i],data->m_temp_mods);
|
tiles[i] = getNodeTile(pn,p,tile_dirs[i],data->m_select[p+data->m_blockpos_nodes]);
|
||||||
}
|
}
|
||||||
|
|
||||||
flag = getNodeTile(n,p,v3s16(0,0,0),data->m_temp_mods,meta);
|
flag = getNodeTile(n,p,v3s16(0,0,0),data->m_select[p+data->m_blockpos_nodes],meta);
|
||||||
|
|
||||||
std::vector<NodeBox> boxes = content_features(n).getNodeBoxes(n);
|
std::vector<NodeBox> boxes = content_features(n).getNodeBoxes(n);
|
||||||
meshgen_build_nodebox(data,p,n,selected,boxes,tiles);
|
meshgen_build_nodebox(data,p,n,selected,boxes,tiles);
|
||||||
|
@ -5210,7 +5210,7 @@ void meshgen_flaglike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
|
|
||||||
u16 indices[] = {0,1,2,2,3,0};
|
u16 indices[] = {0,1,2,2,3,0};
|
||||||
std::vector<u32> colours;
|
std::vector<u32> colours;
|
||||||
if (selected) {
|
if (selected.is_coloured) {
|
||||||
meshgen_selected_lights(colours,255,4);
|
meshgen_selected_lights(colours,255,4);
|
||||||
}else{
|
}else{
|
||||||
meshgen_lights(data,n,p,colours,255,v3s16(0,0,0),4,vertices);
|
meshgen_lights(data,n,p,colours,255,v3s16(0,0,0),4,vertices);
|
||||||
|
@ -5225,7 +5225,7 @@ void meshgen_flaglike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
delete meta;
|
delete meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
void meshgen_melonlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
void meshgen_melonlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected)
|
||||||
{
|
{
|
||||||
ContentFeatures *f = &content_features(n.getContent());
|
ContentFeatures *f = &content_features(n.getContent());
|
||||||
if (f->param2_type != CPT_PLANTGROWTH || n.param2 == 0) {
|
if (f->param2_type != CPT_PLANTGROWTH || n.param2 == 0) {
|
||||||
|
@ -5245,7 +5245,7 @@ void meshgen_melonlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected)
|
||||||
TileSpec tiles[6];
|
TileSpec tiles[6];
|
||||||
for (u16 i=0; i<6; i++) {
|
for (u16 i=0; i<6; i++) {
|
||||||
// Handles facedir rotation for textures
|
// Handles facedir rotation for textures
|
||||||
tiles[i] = getNodeTile(n,p,tile_dirs[i],data->m_temp_mods);
|
tiles[i] = getNodeTile(n,p,tile_dirs[i],data->m_select[p+data->m_blockpos_nodes]);
|
||||||
}
|
}
|
||||||
|
|
||||||
float v = (float)n.param2*0.0625;
|
float v = (float)n.param2*0.0625;
|
||||||
|
@ -5259,7 +5259,7 @@ void meshgen_farnode(MeshMakeData *data, v3s16 p, MapNode &n)
|
||||||
{
|
{
|
||||||
v3f pos = intToFloat(p, BS);
|
v3f pos = intToFloat(p, BS);
|
||||||
if (meshgen_farface(data,p,n,v3s16(-1,0,0))) {
|
if (meshgen_farface(data,p,n,v3s16(-1,0,0))) {
|
||||||
TileSpec tile = getNodeTile(n,p,v3s16(-1,0,0),data->m_temp_mods,NULL);
|
TileSpec tile = getNodeTile(n,p,v3s16(-1,0,0),data->m_select[p+data->m_blockpos_nodes],NULL);
|
||||||
video::S3DVertex vertices[4] = {
|
video::S3DVertex vertices[4] = {
|
||||||
video::S3DVertex(-0.5*BS, 0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0()),
|
video::S3DVertex(-0.5*BS, 0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0()),
|
||||||
video::S3DVertex(-0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
|
video::S3DVertex(-0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
|
||||||
|
@ -5276,7 +5276,7 @@ void meshgen_farnode(MeshMakeData *data, v3s16 p, MapNode &n)
|
||||||
data->appendFar(tile.getMaterial(), vertices, 4, indices, 6);
|
data->appendFar(tile.getMaterial(), vertices, 4, indices, 6);
|
||||||
}
|
}
|
||||||
if (meshgen_farface(data,p,n,v3s16(1,0,0))) {
|
if (meshgen_farface(data,p,n,v3s16(1,0,0))) {
|
||||||
TileSpec tile = getNodeTile(n,p,v3s16(1,0,0),data->m_temp_mods,NULL);
|
TileSpec tile = getNodeTile(n,p,v3s16(1,0,0),data->m_select[p+data->m_blockpos_nodes],NULL);
|
||||||
video::S3DVertex vertices[4] = {
|
video::S3DVertex vertices[4] = {
|
||||||
video::S3DVertex(0.5*BS,-0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y1()),
|
video::S3DVertex(0.5*BS,-0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y1()),
|
||||||
video::S3DVertex(0.5*BS,-0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y1()),
|
video::S3DVertex(0.5*BS,-0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y1()),
|
||||||
|
@ -5293,7 +5293,7 @@ void meshgen_farnode(MeshMakeData *data, v3s16 p, MapNode &n)
|
||||||
data->appendFar(tile.getMaterial(), vertices, 4, indices, 6);
|
data->appendFar(tile.getMaterial(), vertices, 4, indices, 6);
|
||||||
}
|
}
|
||||||
if (meshgen_farface(data,p,n,v3s16(0,-1,0))) {
|
if (meshgen_farface(data,p,n,v3s16(0,-1,0))) {
|
||||||
TileSpec tile = getNodeTile(n,p,v3s16(0,-1,0),data->m_temp_mods,NULL);
|
TileSpec tile = getNodeTile(n,p,v3s16(0,-1,0),data->m_select[p+data->m_blockpos_nodes],NULL);
|
||||||
video::S3DVertex vertices[4] = {
|
video::S3DVertex vertices[4] = {
|
||||||
video::S3DVertex( 0.5*BS,-0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0()),
|
video::S3DVertex( 0.5*BS,-0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0()),
|
||||||
video::S3DVertex(-0.5*BS,-0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
|
video::S3DVertex(-0.5*BS,-0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
|
||||||
|
@ -5311,7 +5311,7 @@ void meshgen_farnode(MeshMakeData *data, v3s16 p, MapNode &n)
|
||||||
data->appendFar(tile.getMaterial(), vertices, 4, indices, 6);
|
data->appendFar(tile.getMaterial(), vertices, 4, indices, 6);
|
||||||
}
|
}
|
||||||
if (meshgen_farface(data,p,n,v3s16(0,1,0))) {
|
if (meshgen_farface(data,p,n,v3s16(0,1,0))) {
|
||||||
TileSpec tile = getNodeTile(n,p,v3s16(0,1,0),data->m_temp_mods,NULL);
|
TileSpec tile = getNodeTile(n,p,v3s16(0,1,0),data->m_select[p+data->m_blockpos_nodes],NULL);
|
||||||
video::S3DVertex vertices[4] = {
|
video::S3DVertex vertices[4] = {
|
||||||
video::S3DVertex( 0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y1()),
|
video::S3DVertex( 0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y1()),
|
||||||
video::S3DVertex(-0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y1()),
|
video::S3DVertex(-0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y1()),
|
||||||
|
@ -5328,7 +5328,7 @@ void meshgen_farnode(MeshMakeData *data, v3s16 p, MapNode &n)
|
||||||
data->appendFar(tile.getMaterial(), vertices, 4, indices, 6);
|
data->appendFar(tile.getMaterial(), vertices, 4, indices, 6);
|
||||||
}
|
}
|
||||||
if (meshgen_farface(data,p,n,v3s16(0,0,-1))) {
|
if (meshgen_farface(data,p,n,v3s16(0,0,-1))) {
|
||||||
TileSpec tile = getNodeTile(n,p,v3s16(0,0,-1),data->m_temp_mods,NULL);
|
TileSpec tile = getNodeTile(n,p,v3s16(0,0,-1),data->m_select[p+data->m_blockpos_nodes],NULL);
|
||||||
video::S3DVertex vertices[4] = {
|
video::S3DVertex vertices[4] = {
|
||||||
video::S3DVertex(-0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0()),
|
video::S3DVertex(-0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0()),
|
||||||
video::S3DVertex( 0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
|
video::S3DVertex( 0.5*BS, 0.5*BS,-0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
|
||||||
|
@ -5345,7 +5345,7 @@ void meshgen_farnode(MeshMakeData *data, v3s16 p, MapNode &n)
|
||||||
data->appendFar(tile.getMaterial(), vertices, 4, indices, 6);
|
data->appendFar(tile.getMaterial(), vertices, 4, indices, 6);
|
||||||
}
|
}
|
||||||
if (meshgen_farface(data,p,n,v3s16(0,0,1))) {
|
if (meshgen_farface(data,p,n,v3s16(0,0,1))) {
|
||||||
TileSpec tile = getNodeTile(n,p,v3s16(0,0,1),data->m_temp_mods,NULL);
|
TileSpec tile = getNodeTile(n,p,v3s16(0,0,1),data->m_select[p+data->m_blockpos_nodes],NULL);
|
||||||
video::S3DVertex vertices[4] = {
|
video::S3DVertex vertices[4] = {
|
||||||
video::S3DVertex( 0.5*BS, 0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0()),
|
video::S3DVertex( 0.5*BS, 0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0()),
|
||||||
video::S3DVertex(-0.5*BS, 0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
|
video::S3DVertex(-0.5*BS, 0.5*BS, 0.5*BS, 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
|
||||||
|
|
|
@ -32,25 +32,25 @@
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
|
|
||||||
void meshgen_preset_smooth_lights(MeshMakeData *data, v3s16 p);
|
void meshgen_preset_smooth_lights(MeshMakeData *data, v3s16 p);
|
||||||
void meshgen_cubelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected);
|
void meshgen_cubelike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected);
|
||||||
void meshgen_raillike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected);
|
void meshgen_raillike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected);
|
||||||
void meshgen_plantlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected);
|
void meshgen_plantlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected);
|
||||||
void meshgen_liquid(MeshMakeData *data, v3s16 p, MapNode &n, bool selected);
|
void meshgen_liquid(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected);
|
||||||
void meshgen_liquid_source(MeshMakeData *data, v3s16 p, MapNode &n, bool selected);
|
void meshgen_liquid_source(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected);
|
||||||
void meshgen_nodebox(MeshMakeData *data, v3s16 p, MapNode &n, bool selected, bool meta);
|
void meshgen_nodebox(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected, bool meta);
|
||||||
void meshgen_glasslike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected);
|
void meshgen_glasslike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected);
|
||||||
void meshgen_torchlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected);
|
void meshgen_torchlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected);
|
||||||
void meshgen_fencelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected);
|
void meshgen_fencelike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected);
|
||||||
void meshgen_firelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected);
|
void meshgen_firelike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected);
|
||||||
void meshgen_walllike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected);
|
void meshgen_walllike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected);
|
||||||
void meshgen_rooflike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected);
|
void meshgen_rooflike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected);
|
||||||
void meshgen_leaflike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected);
|
void meshgen_leaflike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected);
|
||||||
void meshgen_wirelike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected, bool is3d);
|
void meshgen_wirelike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected, bool is3d);
|
||||||
void meshgen_stairlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected);
|
void meshgen_stairlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected);
|
||||||
void meshgen_slablike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected);
|
void meshgen_slablike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected);
|
||||||
void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected);
|
void meshgen_trunklike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected);
|
||||||
void meshgen_flaglike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected);
|
void meshgen_flaglike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected);
|
||||||
void meshgen_melonlike(MeshMakeData *data, v3s16 p, MapNode &n, bool selected);
|
void meshgen_melonlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode selected);
|
||||||
void meshgen_farnode(MeshMakeData *data, v3s16 p, MapNode &n);
|
void meshgen_farnode(MeshMakeData *data, v3s16 p, MapNode &n);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1686,7 +1686,7 @@ void the_game(
|
||||||
client.groundAction(0, nodepos, neighbourpos, g_selected_item);
|
client.groundAction(0, nodepos, neighbourpos, g_selected_item);
|
||||||
}
|
}
|
||||||
if (input->getLeftClicked())
|
if (input->getLeftClicked())
|
||||||
client.setTempMod(nodepos, NodeMod(NODEMOD_CRACK, 0));
|
selected_node_crack = 0;
|
||||||
if (input->getLeftState()) {
|
if (input->getLeftState()) {
|
||||||
MapNode n = client.getNode(nodepos);
|
MapNode n = client.getNode(nodepos);
|
||||||
|
|
||||||
|
@ -1728,7 +1728,7 @@ void the_game(
|
||||||
if (selected_node_crack >= CRACK_ANIMATION_LENGTH) {
|
if (selected_node_crack >= CRACK_ANIMATION_LENGTH) {
|
||||||
infostream<<"Digging completed"<<std::endl;
|
infostream<<"Digging completed"<<std::endl;
|
||||||
client.groundAction(3, nodepos, neighbourpos, g_selected_item);
|
client.groundAction(3, nodepos, neighbourpos, g_selected_item);
|
||||||
client.clearTempMod(nodepos);
|
selected_node_crack = 0;
|
||||||
client.removeNode(nodepos);
|
client.removeNode(nodepos);
|
||||||
|
|
||||||
if (enable_particles)
|
if (enable_particles)
|
||||||
|
|
91
src/map.cpp
91
src/map.cpp
|
@ -3819,97 +3819,6 @@ void ClientMap::renderPostFx()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientMap::setTempMod(v3s16 p, NodeMod mod,
|
|
||||||
core::map<v3s16, MapBlock*> *affected_blocks)
|
|
||||||
{
|
|
||||||
bool changed = false;
|
|
||||||
/*
|
|
||||||
Add it to all blocks touching it
|
|
||||||
*/
|
|
||||||
v3s16 dirs[7] = {
|
|
||||||
v3s16(0,0,0), // this
|
|
||||||
v3s16(0,0,1), // back
|
|
||||||
v3s16(0,1,0), // top
|
|
||||||
v3s16(1,0,0), // right
|
|
||||||
v3s16(0,0,-1), // front
|
|
||||||
v3s16(0,-1,0), // bottom
|
|
||||||
v3s16(-1,0,0), // left
|
|
||||||
};
|
|
||||||
for(u16 i=0; i<7; i++)
|
|
||||||
{
|
|
||||||
v3s16 p2 = p + dirs[i];
|
|
||||||
// Block position of neighbor (or requested) node
|
|
||||||
v3s16 blockpos = getNodeBlockPos(p2);
|
|
||||||
MapBlock * blockref = getBlockNoCreateNoEx(blockpos);
|
|
||||||
if(blockref == NULL)
|
|
||||||
continue;
|
|
||||||
// Relative position of requested node
|
|
||||||
v3s16 relpos = p - blockpos*MAP_BLOCKSIZE;
|
|
||||||
if(blockref->setTempMod(relpos, mod))
|
|
||||||
{
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(changed && affected_blocks!=NULL)
|
|
||||||
{
|
|
||||||
for(u16 i=0; i<7; i++)
|
|
||||||
{
|
|
||||||
v3s16 p2 = p + dirs[i];
|
|
||||||
// Block position of neighbor (or requested) node
|
|
||||||
v3s16 blockpos = getNodeBlockPos(p2);
|
|
||||||
MapBlock * blockref = getBlockNoCreateNoEx(blockpos);
|
|
||||||
if(blockref == NULL)
|
|
||||||
continue;
|
|
||||||
affected_blocks->insert(blockpos, blockref);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return changed;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ClientMap::clearTempMod(v3s16 p,
|
|
||||||
core::map<v3s16, MapBlock*> *affected_blocks)
|
|
||||||
{
|
|
||||||
bool changed = false;
|
|
||||||
v3s16 dirs[7] = {
|
|
||||||
v3s16(0,0,0), // this
|
|
||||||
v3s16(0,0,1), // back
|
|
||||||
v3s16(0,1,0), // top
|
|
||||||
v3s16(1,0,0), // right
|
|
||||||
v3s16(0,0,-1), // front
|
|
||||||
v3s16(0,-1,0), // bottom
|
|
||||||
v3s16(-1,0,0), // left
|
|
||||||
};
|
|
||||||
for(u16 i=0; i<7; i++)
|
|
||||||
{
|
|
||||||
v3s16 p2 = p + dirs[i];
|
|
||||||
// Block position of neighbor (or requested) node
|
|
||||||
v3s16 blockpos = getNodeBlockPos(p2);
|
|
||||||
MapBlock * blockref = getBlockNoCreateNoEx(blockpos);
|
|
||||||
if(blockref == NULL)
|
|
||||||
continue;
|
|
||||||
// Relative position of requested node
|
|
||||||
v3s16 relpos = p - blockpos*MAP_BLOCKSIZE;
|
|
||||||
if(blockref->clearTempMod(relpos))
|
|
||||||
{
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(changed && affected_blocks!=NULL)
|
|
||||||
{
|
|
||||||
for(u16 i=0; i<7; i++)
|
|
||||||
{
|
|
||||||
v3s16 p2 = p + dirs[i];
|
|
||||||
// Block position of neighbor (or requested) node
|
|
||||||
v3s16 blockpos = getNodeBlockPos(p2);
|
|
||||||
MapBlock * blockref = getBlockNoCreateNoEx(blockpos);
|
|
||||||
if(blockref == NULL)
|
|
||||||
continue;
|
|
||||||
affected_blocks->insert(blockpos, blockref);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return changed;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClientMap::expireMeshes(bool only_daynight_diffed)
|
void ClientMap::expireMeshes(bool only_daynight_diffed)
|
||||||
{
|
{
|
||||||
TimeTaker timer("expireMeshes()");
|
TimeTaker timer("expireMeshes()");
|
||||||
|
|
17
src/map.h
17
src/map.h
|
@ -35,7 +35,6 @@
|
||||||
#include "common_irrlicht.h"
|
#include "common_irrlicht.h"
|
||||||
#include "mapgen.h"
|
#include "mapgen.h"
|
||||||
#include "mapnode.h"
|
#include "mapnode.h"
|
||||||
#include "mapblock_nodemod.h"
|
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "voxel.h"
|
#include "voxel.h"
|
||||||
|
|
||||||
|
@ -553,22 +552,6 @@ public:
|
||||||
|
|
||||||
void renderPostFx();
|
void renderPostFx();
|
||||||
|
|
||||||
/*
|
|
||||||
Methods for setting temporary modifications to nodes for
|
|
||||||
drawing.
|
|
||||||
|
|
||||||
Returns true if something changed.
|
|
||||||
|
|
||||||
All blocks whose mesh could have been changed are inserted
|
|
||||||
to affected_blocks.
|
|
||||||
*/
|
|
||||||
bool setTempMod(v3s16 p, NodeMod mod,
|
|
||||||
core::map<v3s16, MapBlock*> *affected_blocks=NULL);
|
|
||||||
bool clearTempMod(v3s16 p,
|
|
||||||
core::map<v3s16, MapBlock*> *affected_blocks=NULL);
|
|
||||||
// Efficient implementation needs a cache of TempMods
|
|
||||||
//void clearTempMods();
|
|
||||||
|
|
||||||
void expireMeshes(bool only_daynight_diffed);
|
void expireMeshes(bool only_daynight_diffed);
|
||||||
|
|
||||||
// For debug printing
|
// For debug printing
|
||||||
|
|
|
@ -62,7 +62,6 @@ MapBlock::MapBlock(Map *parent, v3s16 pos, bool dummy):
|
||||||
m_mesh_expired = false;
|
m_mesh_expired = false;
|
||||||
mesh_mutex.Init();
|
mesh_mutex.Init();
|
||||||
mesh = NULL;
|
mesh = NULL;
|
||||||
m_temp_mods_mutex.Init();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
#include "voxel.h"
|
#include "voxel.h"
|
||||||
#include "nodemetadata.h"
|
#include "nodemetadata.h"
|
||||||
#include "staticobject.h"
|
#include "staticobject.h"
|
||||||
#include "mapblock_nodemod.h"
|
|
||||||
#ifndef SERVER
|
#ifndef SERVER
|
||||||
#include "mapblock_mesh.h"
|
#include "mapblock_mesh.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -419,50 +418,6 @@ public:
|
||||||
// Copies data from VoxelManipulator getPosRelative()
|
// Copies data from VoxelManipulator getPosRelative()
|
||||||
void copyFrom(VoxelManipulator &dst);
|
void copyFrom(VoxelManipulator &dst);
|
||||||
|
|
||||||
#ifndef SERVER // Only on client
|
|
||||||
/*
|
|
||||||
Methods for setting temporary modifications to nodes for
|
|
||||||
drawing
|
|
||||||
|
|
||||||
returns true if the mod was different last time
|
|
||||||
*/
|
|
||||||
bool setTempMod(v3s16 p, const NodeMod &mod)
|
|
||||||
{
|
|
||||||
/*dstream<<"setTempMod called on block"
|
|
||||||
<<" ("<<p.X<<","<<p.Y<<","<<p.Z<<")"
|
|
||||||
<<", mod.type="<<mod.type
|
|
||||||
<<", mod.param="<<mod.param
|
|
||||||
<<std::endl;*/
|
|
||||||
JMutexAutoLock lock(m_temp_mods_mutex);
|
|
||||||
|
|
||||||
return m_temp_mods.set(p, mod);
|
|
||||||
}
|
|
||||||
// Returns true if there was one
|
|
||||||
bool getTempMod(v3s16 p, NodeMod *mod)
|
|
||||||
{
|
|
||||||
JMutexAutoLock lock(m_temp_mods_mutex);
|
|
||||||
|
|
||||||
return m_temp_mods.get(p, mod);
|
|
||||||
}
|
|
||||||
bool clearTempMod(v3s16 p)
|
|
||||||
{
|
|
||||||
JMutexAutoLock lock(m_temp_mods_mutex);
|
|
||||||
|
|
||||||
return m_temp_mods.clear(p);
|
|
||||||
}
|
|
||||||
bool clearTempMods()
|
|
||||||
{
|
|
||||||
JMutexAutoLock lock(m_temp_mods_mutex);
|
|
||||||
|
|
||||||
return m_temp_mods.clear();
|
|
||||||
}
|
|
||||||
void copyTempMods(NodeModMap &dst)
|
|
||||||
{
|
|
||||||
JMutexAutoLock lock(m_temp_mods_mutex);
|
|
||||||
m_temp_mods.copy(dst);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Update day-night lighting difference flag.
|
Update day-night lighting difference flag.
|
||||||
|
|
||||||
|
@ -638,11 +593,6 @@ private:
|
||||||
In practice this is set when the day/night lighting switches.
|
In practice this is set when the day/night lighting switches.
|
||||||
*/
|
*/
|
||||||
bool m_mesh_expired;
|
bool m_mesh_expired;
|
||||||
|
|
||||||
// Temporary modifications to nodes
|
|
||||||
// These are only used when drawing
|
|
||||||
NodeModMap m_temp_mods;
|
|
||||||
JMutex m_temp_mods_mutex;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -45,13 +45,6 @@ void MeshMakeData::fill(u32 daynight_ratio, MapBlock *block)
|
||||||
|
|
||||||
v3s16 blockpos_nodes = m_blockpos*MAP_BLOCKSIZE;
|
v3s16 blockpos_nodes = m_blockpos*MAP_BLOCKSIZE;
|
||||||
|
|
||||||
/*
|
|
||||||
There is no harm not copying the TempMods of the neighbors
|
|
||||||
because they are already copied to this block
|
|
||||||
*/
|
|
||||||
m_temp_mods.clear();
|
|
||||||
block->copyTempMods(m_temp_mods);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copy data
|
Copy data
|
||||||
*/
|
*/
|
||||||
|
@ -131,7 +124,7 @@ static video::SColor blend_light(u32 data, u32 daylight_factor)
|
||||||
Gets node tile from any place relative to block.
|
Gets node tile from any place relative to block.
|
||||||
Returns TILE_NODE if doesn't exist or should not be drawn.
|
Returns TILE_NODE if doesn't exist or should not be drawn.
|
||||||
*/
|
*/
|
||||||
TileSpec getNodeTile(MapNode mn, v3s16 p, v3s16 face_dir, NodeModMap &temp_mods, NodeMetadata *meta)
|
TileSpec getNodeTile(MapNode mn, v3s16 p, v3s16 face_dir, SelectedNode &select, NodeMetadata *meta)
|
||||||
{
|
{
|
||||||
TileSpec spec;
|
TileSpec spec;
|
||||||
spec = mn.getTile(face_dir,false);
|
spec = mn.getTile(face_dir,false);
|
||||||
|
@ -271,29 +264,26 @@ TileSpec getNodeTile(MapNode mn, v3s16 p, v3s16 face_dir, NodeModMap &temp_mods,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Check temporary modifications on this node
|
apply crack to this node
|
||||||
*/
|
*/
|
||||||
NodeMod mod;
|
if (select.has_crack) {
|
||||||
if (temp_mods.get(p, &mod)) {
|
/*
|
||||||
if (mod == NODEMOD_CRACK) {
|
Get texture id, translate it to name, append stuff to
|
||||||
/*
|
name, get texture id
|
||||||
Get texture id, translate it to name, append stuff to
|
*/
|
||||||
name, get texture id
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Get original texture name
|
// Get original texture name
|
||||||
u32 orig_id = spec.texture.id;
|
u32 orig_id = spec.texture.id;
|
||||||
std::string orig_name = g_texturesource->getTextureName(orig_id);
|
std::string orig_name = g_texturesource->getTextureName(orig_id);
|
||||||
|
|
||||||
// Create new texture name
|
// Create new texture name
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os<<orig_name<<"^[crack"<<mod.param;
|
os<<orig_name<<"^[crack"<<select.crack;
|
||||||
|
|
||||||
// Get new texture
|
// Get new texture
|
||||||
u32 new_id = g_texturesource->getTextureId(os.str());
|
u32 new_id = g_texturesource->getTextureId(os.str());
|
||||||
|
|
||||||
spec.texture = g_texturesource->getTexture(new_id);
|
spec.texture = g_texturesource->getTexture(new_id);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return spec;
|
return spec;
|
||||||
|
@ -303,36 +293,32 @@ TileSpec getNodeTile(MapNode mn, v3s16 p, v3s16 face_dir, NodeModMap &temp_mods,
|
||||||
Gets node meta tile from any place relative to block.
|
Gets node meta tile from any place relative to block.
|
||||||
Returns TILE_NODE if doesn't exist or should not be drawn.
|
Returns TILE_NODE if doesn't exist or should not be drawn.
|
||||||
*/
|
*/
|
||||||
TileSpec getMetaTile(MapNode mn, v3s16 p, v3s16 face_dir,
|
TileSpec getMetaTile(MapNode mn, v3s16 p, v3s16 face_dir, SelectedNode &select)
|
||||||
NodeModMap &temp_mods)
|
|
||||||
{
|
{
|
||||||
TileSpec spec;
|
TileSpec spec;
|
||||||
spec = mn.getMetaTile(face_dir);
|
spec = mn.getMetaTile(face_dir);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Check temporary modifications on this node
|
apply crack to this node
|
||||||
*/
|
*/
|
||||||
NodeMod mod;
|
if (select.has_crack) {
|
||||||
if (temp_mods.get(p, &mod)) {
|
/*
|
||||||
if (mod == NODEMOD_CRACK) {
|
Get texture id, translate it to name, append stuff to
|
||||||
/*
|
name, get texture id
|
||||||
Get texture id, translate it to name, append stuff to
|
*/
|
||||||
name, get texture id
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Get original texture name
|
// Get original texture name
|
||||||
u32 orig_id = spec.texture.id;
|
u32 orig_id = spec.texture.id;
|
||||||
std::string orig_name = g_texturesource->getTextureName(orig_id);
|
std::string orig_name = g_texturesource->getTextureName(orig_id);
|
||||||
|
|
||||||
// Create new texture name
|
// Create new texture name
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os<<orig_name<<"^[crack"<<mod.param;
|
os<<orig_name<<"^[crack"<<select.crack;
|
||||||
|
|
||||||
// Get new texture
|
// Get new texture
|
||||||
u32 new_id = g_texturesource->getTextureId(os.str());
|
u32 new_id = g_texturesource->getTextureId(os.str());
|
||||||
|
|
||||||
spec.texture = g_texturesource->getTexture(new_id);
|
spec.texture = g_texturesource->getTexture(new_id);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return spec;
|
return spec;
|
||||||
|
@ -430,7 +416,6 @@ void MapBlockMesh::generate(MeshMakeData *data, v3s16 camera_offset, JMutex *mut
|
||||||
|
|
||||||
data->m_blockpos_nodes = data->m_blockpos*MAP_BLOCKSIZE;
|
data->m_blockpos_nodes = data->m_blockpos*MAP_BLOCKSIZE;
|
||||||
data->m_smooth_lighting = g_settings->getBool("smooth_lighting");
|
data->m_smooth_lighting = g_settings->getBool("smooth_lighting");
|
||||||
bool selected = false;
|
|
||||||
m_pos = data->m_blockpos;
|
m_pos = data->m_blockpos;
|
||||||
|
|
||||||
for(s16 z=0; z<MAP_BLOCKSIZE; z++)
|
for(s16 z=0; z<MAP_BLOCKSIZE; z++)
|
||||||
|
@ -440,9 +425,7 @@ void MapBlockMesh::generate(MeshMakeData *data, v3s16 camera_offset, JMutex *mut
|
||||||
v3s16 p(x,y,z);
|
v3s16 p(x,y,z);
|
||||||
|
|
||||||
MapNode n = data->m_vmanip.getNodeNoEx(data->m_blockpos_nodes+p);
|
MapNode n = data->m_vmanip.getNodeNoEx(data->m_blockpos_nodes+p);
|
||||||
NodeMod mod;
|
SelectedNode selected = data->m_select[p+data->m_blockpos_nodes];
|
||||||
data->m_temp_mods.get(p,&mod);
|
|
||||||
selected = (mod == NODEMOD_SELECTION);
|
|
||||||
|
|
||||||
if (g_sound) {
|
if (g_sound) {
|
||||||
std::string snd = content_features(n).sound_ambient;
|
std::string snd = content_features(n).sound_ambient;
|
||||||
|
@ -492,7 +475,7 @@ void MapBlockMesh::generate(MeshMakeData *data, v3s16 camera_offset, JMutex *mut
|
||||||
data->m_sounds->erase(i);
|
data->m_sounds->erase(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (data->m_smooth_lighting && !selected)
|
if (data->m_smooth_lighting && !selected.is_coloured)
|
||||||
meshgen_preset_smooth_lights(data,p);
|
meshgen_preset_smooth_lights(data,p);
|
||||||
switch (content_features(n).draw_type) {
|
switch (content_features(n).draw_type) {
|
||||||
case CDT_AIRLIKE:
|
case CDT_AIRLIKE:
|
||||||
|
|
|
@ -27,17 +27,17 @@
|
||||||
#define MAPBLOCK_MESH_HEADER
|
#define MAPBLOCK_MESH_HEADER
|
||||||
|
|
||||||
#include "common_irrlicht.h"
|
#include "common_irrlicht.h"
|
||||||
#include "mapblock_nodemod.h"
|
|
||||||
#include "voxel.h"
|
#include "voxel.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Mesh making stuff
|
Mesh making stuff
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Helper functions
|
// Helper functions
|
||||||
TileSpec getNodeTile(MapNode mn, v3s16 p, v3s16 face_dir, NodeModMap &temp_mods, NodeMetadata *meta = NULL);
|
TileSpec getNodeTile(MapNode mn, v3s16 p, v3s16 face_dir, SelectedNode &select, NodeMetadata *meta = NULL);
|
||||||
TileSpec getMetaTile(MapNode mn, v3s16 p, v3s16 face_dir, NodeModMap &temp_mods);
|
TileSpec getMetaTile(MapNode mn, v3s16 p, v3s16 face_dir, SelectedNode &select);
|
||||||
u8 getSmoothLight(v3s16 p, v3s16 corner, VoxelManipulator &vmanip);
|
u8 getSmoothLight(v3s16 p, v3s16 corner, VoxelManipulator &vmanip);
|
||||||
|
|
||||||
class MapBlock;
|
class MapBlock;
|
||||||
|
@ -65,7 +65,7 @@ struct MeshMakeData
|
||||||
{
|
{
|
||||||
u32 m_daynight_ratio;
|
u32 m_daynight_ratio;
|
||||||
bool m_refresh_only;
|
bool m_refresh_only;
|
||||||
NodeModMap m_temp_mods;
|
std::map<v3s16,SelectedNode> m_select;
|
||||||
VoxelManipulator m_vmanip;
|
VoxelManipulator m_vmanip;
|
||||||
v3s16 m_blockpos;
|
v3s16 m_blockpos;
|
||||||
v3s16 m_blockpos_nodes;
|
v3s16 m_blockpos_nodes;
|
||||||
|
|
|
@ -1,128 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
* Minetest-c55
|
|
||||||
* Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
|
|
||||||
*
|
|
||||||
* mapblock_nodemod.h
|
|
||||||
* voxelands - 3d voxel world sandbox game
|
|
||||||
* Copyright (C) Lisa 'darkrose' Milne 2014 <lisa@ltmnet.com>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
* See the GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
*
|
|
||||||
* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne
|
|
||||||
* for Voxelands.
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
#ifndef MAPBLOCK_NODEMOD_HEADER
|
|
||||||
#define MAPBLOCK_NODEMOD_HEADER
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
enum NodeModType
|
|
||||||
{
|
|
||||||
NODEMOD_NONE = 0x0,
|
|
||||||
NODEMOD_UNUSED = 0x01, // used to be CHANGECONTENT - no longer used
|
|
||||||
NODEMOD_CRACK = 0x02, // param is crack progression
|
|
||||||
NODEMOD_SELECTION = 0x04 // param is ignored
|
|
||||||
};
|
|
||||||
|
|
||||||
struct NodeMod
|
|
||||||
{
|
|
||||||
NodeMod(enum NodeModType a_type=NODEMOD_NONE, u16 a_param=0)
|
|
||||||
{
|
|
||||||
type = a_type;
|
|
||||||
param = a_param;
|
|
||||||
}
|
|
||||||
bool operator==(enum NodeModType c_type)
|
|
||||||
{
|
|
||||||
return ((type&c_type)==c_type);
|
|
||||||
}
|
|
||||||
bool operator==(const NodeMod &other)
|
|
||||||
{
|
|
||||||
return (type == other.type && param == other.param);
|
|
||||||
}
|
|
||||||
void operator|=(const NodeMod &other)
|
|
||||||
{
|
|
||||||
type |= other.type;
|
|
||||||
if (other.type != NODEMOD_SELECTION)
|
|
||||||
param = other.param;
|
|
||||||
}
|
|
||||||
u16 type;
|
|
||||||
u16 param;
|
|
||||||
};
|
|
||||||
|
|
||||||
class NodeModMap
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/*
|
|
||||||
returns true if the mod was different last time
|
|
||||||
*/
|
|
||||||
bool set(v3s16 p, const NodeMod &mod)
|
|
||||||
{
|
|
||||||
// See if old is different, cancel if it is not different.
|
|
||||||
std::map<v3s16, NodeMod>::iterator n = m_mods.find(p);
|
|
||||||
if (n != m_mods.end()) {
|
|
||||||
NodeMod old = n->second;
|
|
||||||
if(old == mod)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
old |= mod;
|
|
||||||
m_mods[p] = old;
|
|
||||||
}else{
|
|
||||||
m_mods[p] = mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// Returns true if there was one
|
|
||||||
bool get(v3s16 p, NodeMod *mod)
|
|
||||||
{
|
|
||||||
std::map<v3s16, NodeMod>::iterator n = m_mods.find(p);
|
|
||||||
if (n == m_mods.end())
|
|
||||||
return false;
|
|
||||||
if(mod)
|
|
||||||
*mod = n->second;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
bool clear(v3s16 p)
|
|
||||||
{
|
|
||||||
if (m_mods.find(p) != m_mods.end()) {
|
|
||||||
m_mods.erase(p);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bool clear()
|
|
||||||
{
|
|
||||||
if(m_mods.size() == 0)
|
|
||||||
return false;
|
|
||||||
m_mods.clear();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
void copy(NodeModMap &dest)
|
|
||||||
{
|
|
||||||
dest.m_mods.clear();
|
|
||||||
|
|
||||||
for(std::map<v3s16, NodeMod>::iterator i = m_mods.begin();
|
|
||||||
i != m_mods.end(); i++)
|
|
||||||
{
|
|
||||||
dest.m_mods[i->first] = i->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::map<v3s16, NodeMod> m_mods;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -788,7 +788,14 @@ struct SelectedNode
|
||||||
{
|
{
|
||||||
pos = v3s16(0,0,0);
|
pos = v3s16(0,0,0);
|
||||||
has_crack = false;
|
has_crack = false;
|
||||||
is_coloured = true;
|
is_coloured = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectedNode(bool h)
|
||||||
|
{
|
||||||
|
pos = v3s16(0,0,0);
|
||||||
|
has_crack = false;
|
||||||
|
is_coloured = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectedNode(v3s16 p)
|
SelectedNode(v3s16 p)
|
||||||
|
|
Loading…
Reference in New Issue