mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
commit before some more radical changes
This commit is contained in:
parent
06eb0ad4d0
commit
01c2b003e1
12 changed files with 222 additions and 63 deletions
62
src/main.cpp
62
src/main.cpp
|
@ -2701,6 +2701,55 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(n.d == CONTENT_SIGN_WALL)
|
||||
{
|
||||
v3s16 dir = unpackDir(n.dir);
|
||||
v3f dir_f = v3f(dir.X, dir.Y, dir.Z);
|
||||
dir_f *= BS/2 - BS/6 - BS/20;
|
||||
v3f cpf = npf + dir_f;
|
||||
f32 distance = (cpf - camera_position).getLength();
|
||||
|
||||
v3f vertices[4] =
|
||||
{
|
||||
v3f(BS*0.42,-BS*0.35,-BS*0.4),
|
||||
v3f(BS*0.49, BS*0.35, BS*0.4),
|
||||
};
|
||||
|
||||
for(s32 i=0; i<2; i++)
|
||||
{
|
||||
if(dir == v3s16(1,0,0))
|
||||
vertices[i].rotateXZBy(0);
|
||||
if(dir == v3s16(-1,0,0))
|
||||
vertices[i].rotateXZBy(180);
|
||||
if(dir == v3s16(0,0,1))
|
||||
vertices[i].rotateXZBy(90);
|
||||
if(dir == v3s16(0,0,-1))
|
||||
vertices[i].rotateXZBy(-90);
|
||||
if(dir == v3s16(0,-1,0))
|
||||
vertices[i].rotateXYBy(-90);
|
||||
if(dir == v3s16(0,1,0))
|
||||
vertices[i].rotateXYBy(90);
|
||||
|
||||
vertices[i] += npf;
|
||||
}
|
||||
|
||||
core::aabbox3d<f32> box;
|
||||
|
||||
box = core::aabbox3d<f32>(vertices[0]);
|
||||
box.addInternalPoint(vertices[1]);
|
||||
|
||||
if(distance < mindistance)
|
||||
{
|
||||
if(box.intersectsWithLine(shootline))
|
||||
{
|
||||
nodefound = true;
|
||||
nodepos = np;
|
||||
neighbourpos = np;
|
||||
mindistance = distance;
|
||||
nodehilightbox = box;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
Regular blocks
|
||||
*/
|
||||
|
@ -2765,11 +2814,20 @@ int main(int argc, char *argv[])
|
|||
static float dig_time = 0.0;
|
||||
static u16 dig_index = 0;
|
||||
|
||||
// Visualize selection
|
||||
/*
|
||||
Visualize selection
|
||||
*/
|
||||
|
||||
hilightboxes.push_back(nodehilightbox);
|
||||
|
||||
// Handle digging
|
||||
/*
|
||||
TODO:
|
||||
Check information text of node
|
||||
*/
|
||||
|
||||
/*
|
||||
Handle digging
|
||||
*/
|
||||
|
||||
if(g_input->getLeftReleased())
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue