From 7f5cf417de5e83641e6aa0998cc9dc8b377346b6 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 23 Apr 2014 21:06:46 +0100 Subject: Some change to Entity.cpp * Added comments to BroadcastMovementUpdate() and the collision tracer --- src/Tracer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/Tracer.cpp') diff --git a/src/Tracer.cpp b/src/Tracer.cpp index 6da6b2ad7..be42430a5 100644 --- a/src/Tracer.cpp +++ b/src/Tracer.cpp @@ -219,6 +219,10 @@ bool cTracer::Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int return false; } + if ((pos.y < 0) || (pos.y >= cChunkDef::Height)) + { + return false; + } BLOCKTYPE BlockID = m_World->GetBlock(pos.x, pos.y, pos.z); // Block is counted as a collision if we are not doing a line of sight and it is solid, // or if the block is not air and not water. That way mobs can still see underwater. @@ -226,7 +230,7 @@ bool cTracer::Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int { BlockHitPosition = pos; int Normal = GetHitNormal(a_Start, End, pos ); - if(Normal > 0) + if (Normal > 0) { HitNormal = m_NormalTable[Normal-1]; } -- cgit v1.2.3 From 7fff12bfacbb4bef1c02cea0ec10fdc9a6fb64e4 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 19:13:23 +0200 Subject: Fixed spaces around single-line comments. There should be at least two spaces in front and one space after //-style comments. --- src/Tracer.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/Tracer.cpp') diff --git a/src/Tracer.cpp b/src/Tracer.cpp index be42430a5..d788d9e26 100644 --- a/src/Tracer.cpp +++ b/src/Tracer.cpp @@ -7,7 +7,7 @@ #include "Entities/Entity.h" #ifndef _WIN32 - #include // abs() + #include #endif @@ -247,7 +247,7 @@ bool cTracer::Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int // return 1 = hit, other is not hit int LinesCross(float x0,float y0,float x1,float y1,float x2,float y2,float x3,float y3) { - //float linx, liny; + // float linx, liny; float d=(x1-x0)*(y3-y2)-(y1-y0)*(x3-x2); if (abs(d)<0.001) {return 0;} @@ -257,8 +257,8 @@ int LinesCross(float x0,float y0,float x1,float y1,float x2,float y2,float x3,fl float CD=((y0-y2)*(x1-x0)-(x0-x2)*(y1-y0))/d; if (CD>=0.0 && CD<=1.0) { - //linx=x0+AB*(x1-x0); - //liny=y0+AB*(y1-y0); + // linx=x0+AB*(x1-x0); + // liny=y0+AB*(y1-y0); return 1; } } @@ -291,7 +291,7 @@ int cTracer::intersect3D_SegmentPlane( const Vector3f & a_Origin, const Vector3f if (sI < 0 || sI > 1) return 0; // no intersection - //Vector3f I ( a_Ray->GetOrigin() + sI * u );//S.P0 + sI * u; // compute segment intersect point + // Vector3f I ( a_Ray->GetOrigin() + sI * u );//S.P0 + sI * u; // compute segment intersect point RealHit = a_Origin + u * sI; return 1; } @@ -310,8 +310,8 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve Vector3f Look = (end - start); Look.Normalize(); - float dot = Look.Dot( Vector3f(-1, 0, 0) ); // first face normal is x -1 - if(dot < 0) + float dot = Look.Dot( Vector3f(-1, 0, 0) ); // first face normal is x -1 + if (dot < 0) { int Lines = LinesCross( start.x, start.y, end.x, end.y, BlockPos.x, BlockPos.y, BlockPos.x, BlockPos.y + 1 ); if(Lines == 1) @@ -324,7 +324,7 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve } } } - dot = Look.Dot( Vector3f(0, 0, -1) ); // second face normal is z -1 + dot = Look.Dot( Vector3f(0, 0, -1) ); // second face normal is z -1 if(dot < 0) { int Lines = LinesCross( start.z, start.y, end.z, end.y, BlockPos.z, BlockPos.y, BlockPos.z, BlockPos.y + 1 ); @@ -338,7 +338,7 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve } } } - dot = Look.Dot( Vector3f(1, 0, 0) ); // third face normal is x 1 + dot = Look.Dot( Vector3f(1, 0, 0) ); // third face normal is x 1 if(dot < 0) { int Lines = LinesCross( start.x, start.y, end.x, end.y, BlockPos.x + 1, BlockPos.y, BlockPos.x + 1, BlockPos.y + 1 ); @@ -352,7 +352,7 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve } } } - dot = Look.Dot( Vector3f(0, 0, 1) ); // fourth face normal is z 1 + dot = Look.Dot( Vector3f(0, 0, 1) ); // fourth face normal is z 1 if(dot < 0) { int Lines = LinesCross( start.z, start.y, end.z, end.y, BlockPos.z + 1, BlockPos.y, BlockPos.z + 1, BlockPos.y + 1 ); @@ -366,7 +366,7 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve } } } - dot = Look.Dot( Vector3f(0, 1, 0) ); // fifth face normal is y 1 + dot = Look.Dot( Vector3f(0, 1, 0) ); // fifth face normal is y 1 if(dot < 0) { int Lines = LinesCross( start.y, start.x, end.y, end.x, BlockPos.y + 1, BlockPos.x, BlockPos.y + 1, BlockPos.x + 1 ); @@ -380,7 +380,7 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve } } } - dot = Look.Dot( Vector3f(0, -1, 0) ); // sixth face normal is y -1 + dot = Look.Dot( Vector3f(0, -1, 0) ); // sixth face normal is y -1 if(dot < 0) { int Lines = LinesCross( start.y, start.x, end.y, end.x, BlockPos.y, BlockPos.x, BlockPos.y, BlockPos.x + 1 ); -- cgit v1.2.3 From 2423fbf2efa39e28cc348acc11b9269e573dcdef Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 22:15:34 +0200 Subject: Normalized comments. This was mostly done automatically and then visually inspected for obvious errors. All //-style comments should have a 2-space separation from the code, and 1 space after the comment sign. --- src/Tracer.cpp | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'src/Tracer.cpp') diff --git a/src/Tracer.cpp b/src/Tracer.cpp index d788d9e26..54b4716e3 100644 --- a/src/Tracer.cpp +++ b/src/Tracer.cpp @@ -273,36 +273,50 @@ int LinesCross(float x0,float y0,float x1,float y1,float x2,float y2,float x3,fl // 2 = the segment lies in the plane int cTracer::intersect3D_SegmentPlane( const Vector3f & a_Origin, const Vector3f & a_End, const Vector3f & a_PlanePos, const Vector3f & a_PlaneNormal ) { - Vector3f u = a_End - a_Origin;//a_Ray.P1 - S.P0; - Vector3f w = a_Origin - a_PlanePos;//S.P0 - Pn.V0; + Vector3f u = a_End - a_Origin; // a_Ray.P1 - S.P0; + Vector3f w = a_Origin - a_PlanePos; // S.P0 - Pn.V0; - float D = a_PlaneNormal.Dot( u );//dot(Pn.n, u); - float N = -(a_PlaneNormal.Dot( w ) );//-dot(a_Plane.n, w); + float D = a_PlaneNormal.Dot( u ); // dot(Pn.n, u); + float N = -(a_PlaneNormal.Dot( w ) ); // -dot(a_Plane.n, w); const float EPSILON = 0.0001f; - if (fabs(D) < EPSILON) { // segment is parallel to plane - if (N == 0) // segment lies in plane + if (fabs(D) < EPSILON) + { + // segment is parallel to plane + if (N == 0) + { + // segment lies in plane return 2; - return 0; // no intersection + } + return 0; // no intersection } + // they are not parallel // compute intersect param float sI = N / D; if (sI < 0 || sI > 1) - return 0; // no intersection + { + return 0; // no intersection + } - // Vector3f I ( a_Ray->GetOrigin() + sI * u );//S.P0 + sI * u; // compute segment intersect point + // Vector3f I ( a_Ray->GetOrigin() + sI * u );// S.P0 + sI * u; // compute segment intersect point RealHit = a_Origin + u * sI; return 1; } + + + + int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Vector3i & a_BlockPos) { Vector3i SmallBlockPos = a_BlockPos; char BlockID = m_World->GetBlock( a_BlockPos.x, a_BlockPos.y, a_BlockPos.z ); if( BlockID == E_BLOCK_AIR || IsBlockWater(BlockID)) + { return 0; + } Vector3f BlockPos; BlockPos = Vector3f(SmallBlockPos); -- cgit v1.2.3 From 00c524519ef6c7ceaf4ac91307617cfd65d7cf21 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 19 Jul 2014 14:53:41 +0200 Subject: Fixed style: spaces after commas. --- src/Tracer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Tracer.cpp') diff --git a/src/Tracer.cpp b/src/Tracer.cpp index 54b4716e3..fd8a297c0 100644 --- a/src/Tracer.cpp +++ b/src/Tracer.cpp @@ -18,11 +18,11 @@ cTracer::cTracer(cWorld * a_World) : m_World(a_World) { m_NormalTable[0].Set(-1, 0, 0); - m_NormalTable[1].Set( 0, 0,-1); + m_NormalTable[1].Set( 0, 0, -1); m_NormalTable[2].Set( 1, 0, 0); m_NormalTable[3].Set( 0, 0, 1); m_NormalTable[4].Set( 0, 1, 0); - m_NormalTable[5].Set( 0,-1, 0); + m_NormalTable[5].Set( 0, -1, 0); } @@ -245,7 +245,7 @@ bool cTracer::Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int // return 1 = hit, other is not hit -int LinesCross(float x0,float y0,float x1,float y1,float x2,float y2,float x3,float y3) +int LinesCross(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3) { // float linx, liny; -- cgit v1.2.3 From 6be79575fd50e37ac275bd0cb9d16f9e51e8a225 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 20 Jul 2014 23:10:31 +0200 Subject: Style: Normalized spaces after if, for and while. --- src/Tracer.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'src/Tracer.cpp') diff --git a/src/Tracer.cpp b/src/Tracer.cpp index fd8a297c0..df01e9129 100644 --- a/src/Tracer.cpp +++ b/src/Tracer.cpp @@ -59,7 +59,7 @@ void cTracer::SetValues(const Vector3f & a_Start, const Vector3f & a_Direction) step.z = (int) SigNum(dir.z); // normalize the direction vector - if( dir.SqrLength() > 0.f ) dir.Normalize(); + if (dir.SqrLength() > 0.f ) dir.Normalize(); // how far we must move in the ray direction before // we encounter a new voxel in x-direction @@ -192,7 +192,7 @@ bool cTracer::Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int if (step.y > 0.0f) { - if(pos.y >= end1.y) + if (pos.y >= end1.y) { reachedY = true; } @@ -313,7 +313,7 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve Vector3i SmallBlockPos = a_BlockPos; char BlockID = m_World->GetBlock( a_BlockPos.x, a_BlockPos.y, a_BlockPos.z ); - if( BlockID == E_BLOCK_AIR || IsBlockWater(BlockID)) + if (BlockID == E_BLOCK_AIR || IsBlockWater(BlockID)) { return 0; } @@ -328,10 +328,10 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve if (dot < 0) { int Lines = LinesCross( start.x, start.y, end.x, end.y, BlockPos.x, BlockPos.y, BlockPos.x, BlockPos.y + 1 ); - if(Lines == 1) + if (Lines == 1) { Lines = LinesCross( start.x, start.z, end.x, end.z, BlockPos.x, BlockPos.z, BlockPos.x, BlockPos.z + 1 ); - if(Lines == 1) + if (Lines == 1) { intersect3D_SegmentPlane( start, end, BlockPos, Vector3f(-1, 0, 0) ); return 1; @@ -339,13 +339,13 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve } } dot = Look.Dot( Vector3f(0, 0, -1) ); // second face normal is z -1 - if(dot < 0) + if (dot < 0) { int Lines = LinesCross( start.z, start.y, end.z, end.y, BlockPos.z, BlockPos.y, BlockPos.z, BlockPos.y + 1 ); - if(Lines == 1) + if (Lines == 1) { Lines = LinesCross( start.z, start.x, end.z, end.x, BlockPos.z, BlockPos.x, BlockPos.z, BlockPos.x + 1 ); - if(Lines == 1) + if (Lines == 1) { intersect3D_SegmentPlane( start, end, BlockPos, Vector3f(0, 0, -1) ); return 2; @@ -353,13 +353,13 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve } } dot = Look.Dot( Vector3f(1, 0, 0) ); // third face normal is x 1 - if(dot < 0) + if (dot < 0) { int Lines = LinesCross( start.x, start.y, end.x, end.y, BlockPos.x + 1, BlockPos.y, BlockPos.x + 1, BlockPos.y + 1 ); - if(Lines == 1) + if (Lines == 1) { Lines = LinesCross( start.x, start.z, end.x, end.z, BlockPos.x + 1, BlockPos.z, BlockPos.x + 1, BlockPos.z + 1 ); - if(Lines == 1) + if (Lines == 1) { intersect3D_SegmentPlane( start, end, BlockPos + Vector3f(1, 0, 0), Vector3f(1, 0, 0) ); return 3; @@ -367,13 +367,13 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve } } dot = Look.Dot( Vector3f(0, 0, 1) ); // fourth face normal is z 1 - if(dot < 0) + if (dot < 0) { int Lines = LinesCross( start.z, start.y, end.z, end.y, BlockPos.z + 1, BlockPos.y, BlockPos.z + 1, BlockPos.y + 1 ); - if(Lines == 1) + if (Lines == 1) { Lines = LinesCross( start.z, start.x, end.z, end.x, BlockPos.z + 1, BlockPos.x, BlockPos.z + 1, BlockPos.x + 1 ); - if(Lines == 1) + if (Lines == 1) { intersect3D_SegmentPlane( start, end, BlockPos + Vector3f(0, 0, 1), Vector3f(0, 0, 1) ); return 4; @@ -381,13 +381,13 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve } } dot = Look.Dot( Vector3f(0, 1, 0) ); // fifth face normal is y 1 - if(dot < 0) + if (dot < 0) { int Lines = LinesCross( start.y, start.x, end.y, end.x, BlockPos.y + 1, BlockPos.x, BlockPos.y + 1, BlockPos.x + 1 ); - if(Lines == 1) + if (Lines == 1) { Lines = LinesCross( start.y, start.z, end.y, end.z, BlockPos.y + 1, BlockPos.z, BlockPos.y + 1, BlockPos.z + 1 ); - if(Lines == 1) + if (Lines == 1) { intersect3D_SegmentPlane( start, end, BlockPos + Vector3f(0, 1, 0), Vector3f(0, 1, 0) ); return 5; @@ -395,13 +395,13 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve } } dot = Look.Dot( Vector3f(0, -1, 0) ); // sixth face normal is y -1 - if(dot < 0) + if (dot < 0) { int Lines = LinesCross( start.y, start.x, end.y, end.x, BlockPos.y, BlockPos.x, BlockPos.y, BlockPos.x + 1 ); - if(Lines == 1) + if (Lines == 1) { Lines = LinesCross( start.y, start.z, end.y, end.z, BlockPos.y, BlockPos.z, BlockPos.y, BlockPos.z + 1 ); - if(Lines == 1) + if (Lines == 1) { intersect3D_SegmentPlane( start, end, BlockPos, Vector3f(0, -1, 0) ); return 6; -- cgit v1.2.3 From 93d29555e58df172bafba530afbc593c16ec66a3 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 21 Jul 2014 15:19:48 +0200 Subject: Style: Normalized to no spaces before closing parenthesis. --- src/Tracer.cpp | 64 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'src/Tracer.cpp') diff --git a/src/Tracer.cpp b/src/Tracer.cpp index df01e9129..756147a7b 100644 --- a/src/Tracer.cpp +++ b/src/Tracer.cpp @@ -37,7 +37,7 @@ cTracer::~cTracer() -float cTracer::SigNum( float a_Num ) +float cTracer::SigNum( float a_Num) { if (a_Num < 0.f) return -1.f; if (a_Num > 0.f) return 1.f; @@ -59,7 +59,7 @@ void cTracer::SetValues(const Vector3f & a_Start, const Vector3f & a_Direction) step.z = (int) SigNum(dir.z); // normalize the direction vector - if (dir.SqrLength() > 0.f ) dir.Normalize(); + if (dir.SqrLength() > 0.f) dir.Normalize(); // how far we must move in the ray direction before // we encounter a new voxel in x-direction @@ -229,7 +229,7 @@ bool cTracer::Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int if ((!a_LineOfSight && cBlockInfo::IsSolid(BlockID)) || (a_LineOfSight && (BlockID != E_BLOCK_AIR) && !IsBlockWater(BlockID))) { BlockHitPosition = pos; - int Normal = GetHitNormal(a_Start, End, pos ); + int Normal = GetHitNormal(a_Start, End, pos); if (Normal > 0) { HitNormal = m_NormalTable[Normal-1]; @@ -271,13 +271,13 @@ int LinesCross(float x0, float y0, float x1, float y1, float x2, float y2, float // Return: 0 = disjoint (no intersection) // 1 = intersection in the unique point *I0 // 2 = the segment lies in the plane -int cTracer::intersect3D_SegmentPlane( const Vector3f & a_Origin, const Vector3f & a_End, const Vector3f & a_PlanePos, const Vector3f & a_PlaneNormal ) +int cTracer::intersect3D_SegmentPlane( const Vector3f & a_Origin, const Vector3f & a_End, const Vector3f & a_PlanePos, const Vector3f & a_PlaneNormal) { Vector3f u = a_End - a_Origin; // a_Ray.P1 - S.P0; Vector3f w = a_Origin - a_PlanePos; // S.P0 - Pn.V0; - float D = a_PlaneNormal.Dot( u ); // dot(Pn.n, u); - float N = -(a_PlaneNormal.Dot( w ) ); // -dot(a_Plane.n, w); + float D = a_PlaneNormal.Dot( u); // dot(Pn.n, u); + float N = -(a_PlaneNormal.Dot( w)); // -dot(a_Plane.n, w); const float EPSILON = 0.0001f; if (fabs(D) < EPSILON) @@ -299,7 +299,7 @@ int cTracer::intersect3D_SegmentPlane( const Vector3f & a_Origin, const Vector3f return 0; // no intersection } - // Vector3f I ( a_Ray->GetOrigin() + sI * u );// S.P0 + sI * u; // compute segment intersect point + // Vector3f I ( a_Ray->GetOrigin() + sI * u);// S.P0 + sI * u; // compute segment intersect point RealHit = a_Origin + u * sI; return 1; } @@ -311,7 +311,7 @@ int cTracer::intersect3D_SegmentPlane( const Vector3f & a_Origin, const Vector3f int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Vector3i & a_BlockPos) { Vector3i SmallBlockPos = a_BlockPos; - char BlockID = m_World->GetBlock( a_BlockPos.x, a_BlockPos.y, a_BlockPos.z ); + char BlockID = m_World->GetBlock( a_BlockPos.x, a_BlockPos.y, a_BlockPos.z); if (BlockID == E_BLOCK_AIR || IsBlockWater(BlockID)) { @@ -324,86 +324,86 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve Vector3f Look = (end - start); Look.Normalize(); - float dot = Look.Dot( Vector3f(-1, 0, 0) ); // first face normal is x -1 + float dot = Look.Dot( Vector3f(-1, 0, 0)); // first face normal is x -1 if (dot < 0) { - int Lines = LinesCross( start.x, start.y, end.x, end.y, BlockPos.x, BlockPos.y, BlockPos.x, BlockPos.y + 1 ); + int Lines = LinesCross( start.x, start.y, end.x, end.y, BlockPos.x, BlockPos.y, BlockPos.x, BlockPos.y + 1); if (Lines == 1) { - Lines = LinesCross( start.x, start.z, end.x, end.z, BlockPos.x, BlockPos.z, BlockPos.x, BlockPos.z + 1 ); + Lines = LinesCross( start.x, start.z, end.x, end.z, BlockPos.x, BlockPos.z, BlockPos.x, BlockPos.z + 1); if (Lines == 1) { - intersect3D_SegmentPlane( start, end, BlockPos, Vector3f(-1, 0, 0) ); + intersect3D_SegmentPlane( start, end, BlockPos, Vector3f(-1, 0, 0)); return 1; } } } - dot = Look.Dot( Vector3f(0, 0, -1) ); // second face normal is z -1 + dot = Look.Dot( Vector3f(0, 0, -1)); // second face normal is z -1 if (dot < 0) { - int Lines = LinesCross( start.z, start.y, end.z, end.y, BlockPos.z, BlockPos.y, BlockPos.z, BlockPos.y + 1 ); + int Lines = LinesCross( start.z, start.y, end.z, end.y, BlockPos.z, BlockPos.y, BlockPos.z, BlockPos.y + 1); if (Lines == 1) { - Lines = LinesCross( start.z, start.x, end.z, end.x, BlockPos.z, BlockPos.x, BlockPos.z, BlockPos.x + 1 ); + Lines = LinesCross( start.z, start.x, end.z, end.x, BlockPos.z, BlockPos.x, BlockPos.z, BlockPos.x + 1); if (Lines == 1) { - intersect3D_SegmentPlane( start, end, BlockPos, Vector3f(0, 0, -1) ); + intersect3D_SegmentPlane( start, end, BlockPos, Vector3f(0, 0, -1)); return 2; } } } - dot = Look.Dot( Vector3f(1, 0, 0) ); // third face normal is x 1 + dot = Look.Dot( Vector3f(1, 0, 0)); // third face normal is x 1 if (dot < 0) { - int Lines = LinesCross( start.x, start.y, end.x, end.y, BlockPos.x + 1, BlockPos.y, BlockPos.x + 1, BlockPos.y + 1 ); + int Lines = LinesCross( start.x, start.y, end.x, end.y, BlockPos.x + 1, BlockPos.y, BlockPos.x + 1, BlockPos.y + 1); if (Lines == 1) { - Lines = LinesCross( start.x, start.z, end.x, end.z, BlockPos.x + 1, BlockPos.z, BlockPos.x + 1, BlockPos.z + 1 ); + Lines = LinesCross( start.x, start.z, end.x, end.z, BlockPos.x + 1, BlockPos.z, BlockPos.x + 1, BlockPos.z + 1); if (Lines == 1) { - intersect3D_SegmentPlane( start, end, BlockPos + Vector3f(1, 0, 0), Vector3f(1, 0, 0) ); + intersect3D_SegmentPlane( start, end, BlockPos + Vector3f(1, 0, 0), Vector3f(1, 0, 0)); return 3; } } } - dot = Look.Dot( Vector3f(0, 0, 1) ); // fourth face normal is z 1 + dot = Look.Dot( Vector3f(0, 0, 1)); // fourth face normal is z 1 if (dot < 0) { - int Lines = LinesCross( start.z, start.y, end.z, end.y, BlockPos.z + 1, BlockPos.y, BlockPos.z + 1, BlockPos.y + 1 ); + int Lines = LinesCross( start.z, start.y, end.z, end.y, BlockPos.z + 1, BlockPos.y, BlockPos.z + 1, BlockPos.y + 1); if (Lines == 1) { - Lines = LinesCross( start.z, start.x, end.z, end.x, BlockPos.z + 1, BlockPos.x, BlockPos.z + 1, BlockPos.x + 1 ); + Lines = LinesCross( start.z, start.x, end.z, end.x, BlockPos.z + 1, BlockPos.x, BlockPos.z + 1, BlockPos.x + 1); if (Lines == 1) { - intersect3D_SegmentPlane( start, end, BlockPos + Vector3f(0, 0, 1), Vector3f(0, 0, 1) ); + intersect3D_SegmentPlane( start, end, BlockPos + Vector3f(0, 0, 1), Vector3f(0, 0, 1)); return 4; } } } - dot = Look.Dot( Vector3f(0, 1, 0) ); // fifth face normal is y 1 + dot = Look.Dot( Vector3f(0, 1, 0)); // fifth face normal is y 1 if (dot < 0) { - int Lines = LinesCross( start.y, start.x, end.y, end.x, BlockPos.y + 1, BlockPos.x, BlockPos.y + 1, BlockPos.x + 1 ); + int Lines = LinesCross( start.y, start.x, end.y, end.x, BlockPos.y + 1, BlockPos.x, BlockPos.y + 1, BlockPos.x + 1); if (Lines == 1) { - Lines = LinesCross( start.y, start.z, end.y, end.z, BlockPos.y + 1, BlockPos.z, BlockPos.y + 1, BlockPos.z + 1 ); + Lines = LinesCross( start.y, start.z, end.y, end.z, BlockPos.y + 1, BlockPos.z, BlockPos.y + 1, BlockPos.z + 1); if (Lines == 1) { - intersect3D_SegmentPlane( start, end, BlockPos + Vector3f(0, 1, 0), Vector3f(0, 1, 0) ); + intersect3D_SegmentPlane( start, end, BlockPos + Vector3f(0, 1, 0), Vector3f(0, 1, 0)); return 5; } } } - dot = Look.Dot( Vector3f(0, -1, 0) ); // sixth face normal is y -1 + dot = Look.Dot( Vector3f(0, -1, 0)); // sixth face normal is y -1 if (dot < 0) { - int Lines = LinesCross( start.y, start.x, end.y, end.x, BlockPos.y, BlockPos.x, BlockPos.y, BlockPos.x + 1 ); + int Lines = LinesCross( start.y, start.x, end.y, end.x, BlockPos.y, BlockPos.x, BlockPos.y, BlockPos.x + 1); if (Lines == 1) { - Lines = LinesCross( start.y, start.z, end.y, end.z, BlockPos.y, BlockPos.z, BlockPos.y, BlockPos.z + 1 ); + Lines = LinesCross( start.y, start.z, end.y, end.z, BlockPos.y, BlockPos.z, BlockPos.y, BlockPos.z + 1); if (Lines == 1) { - intersect3D_SegmentPlane( start, end, BlockPos, Vector3f(0, -1, 0) ); + intersect3D_SegmentPlane( start, end, BlockPos, Vector3f(0, -1, 0)); return 6; } } -- cgit v1.2.3