From 01c2b003e1efb839ad246eb939af7fa8336b9ad5 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 3 Apr 2011 16:21:06 +0300 Subject: commit before some more radical changes --- src/main.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index c9db0bdc4..a901163df 100644 --- a/src/main.cpp +++ b/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 box; + + box = core::aabbox3d(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()) { -- cgit v1.2.3