Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <LineBlockTracer.h>
Public Types | |
enum | eLineOfSight { losAir = 1 , losWater = 2 , losLava = 4 , losAirWaterLava = losAir | losWater | losLava , losAirWater = losAir | losWater } |
Public Member Functions | |
cLineBlockTracer (cWorld &a_World, cCallbacks &a_Callbacks) | |
bool | Trace (Vector3d a_Start, Vector3d a_End) |
Traces one line between Start and End; returns true if the entire line was traced (until OnNoMoreHits()) More... | |
Static Public Member Functions | |
static bool | FirstSolidHitTrace (cWorld &a_World, const Vector3d &a_Start, const Vector3d &a_End, Vector3d &a_HitCoords, Vector3i &a_HitBlockCoords, eBlockFace &a_HitBlockFace) |
Traces until the first solid block is hit (or until end, whichever comes first. More... | |
static bool | LineOfSightTrace (cWorld &a_World, const Vector3d &a_Start, const Vector3d &a_End, int a_Sight) |
Returns true if the two positions are within line of sight (not obscured by blocks). More... | |
static bool | Trace (cWorld &a_World, cCallbacks &a_Callbacks, const Vector3d a_Start, const Vector3d a_End) |
Traces one line between Start and End; returns true if the entire line was traced (until OnNoMoreHits()) More... | |
Protected Member Functions | |
void | CalcXZIntersection (double a_Y, double &a_IntersectX, double &a_IntersectZ) |
Calculates the XZ coords of an intersection with the specified Yconst plane; assumes that such an intersection exists. More... | |
bool | ChunkCallback (cChunk *a_Chunk) |
void | FixStartAboveWorld (void) |
Adjusts the start point above the world to just at the world's top. More... | |
void | FixStartBelowWorld (void) |
Adjusts the start point below the world to just at the world's bottom. More... | |
bool | MoveToNextBlock (void) |
Moves m_Current to the next block on the line; returns false if no move is possible (reached the end) More... | |
Protected Attributes | |
Vector3i | m_Current |
The current block. More... | |
eBlockFace | m_CurrentFace |
The face through which the current block has been entered. More... | |
Vector3d | m_Diff |
The difference in coords, End - Start. More... | |
Vector3i | m_Dir |
The increment at which the block coords are going from Start to End; either +1 or -1. More... | |
Vector3d | m_End |
The end point of the trace. More... | |
Vector3d | m_Start |
The start point of the trace. More... | |
Private Types | |
using | Super = cBlockTracer |
Definition at line 25 of file LineBlockTracer.h.
|
private |
Definition at line 28 of file LineBlockTracer.h.
Enumerator | |
---|---|
losAir | |
losWater | |
losLava | |
losAirWaterLava | |
losAirWater |
Definition at line 32 of file LineBlockTracer.h.
cLineBlockTracer::cLineBlockTracer | ( | cWorld & | a_World, |
cCallbacks & | a_Callbacks | ||
) |
Definition at line 17 of file LineBlockTracer.cpp.
|
protected |
Calculates the XZ coords of an intersection with the specified Yconst plane; assumes that such an intersection exists.
Definition at line 209 of file LineBlockTracer.cpp.
|
protected |
Definition at line 283 of file LineBlockTracer.cpp.
|
static |
Traces until the first solid block is hit (or until end, whichever comes first.
If a solid block was hit, returns true and fills a_HitCoords, a_HitBlockCoords and a_HitBlockFace. If a_End is encountered without hitting any solid block, returns false and doesn't touch a_HitCoords, a_HitBlockCoords nor a_HitBlockFace. a_HitCoords is the exact coords of the hit, a_HitBlockCoords are the coords of the solid block that was hit, a_HitBlockFace is the face of the solid block that was hit.
Definition at line 81 of file LineBlockTracer.cpp.
|
protected |
Adjusts the start point above the world to just at the world's top.
Definition at line 186 of file LineBlockTracer.cpp.
|
protected |
Adjusts the start point below the world to just at the world's bottom.
Definition at line 199 of file LineBlockTracer.cpp.
|
static |
Returns true if the two positions are within line of sight (not obscured by blocks).
a_Sight specifies which blocks are considered transparent for the trace, is an OR-combination of eLineOfSight constants.
Definition at line 42 of file LineBlockTracer.cpp.
|
protected |
Moves m_Current to the next block on the line; returns false if no move is possible (reached the end)
Definition at line 220 of file LineBlockTracer.cpp.
|
static |
Traces one line between Start and End; returns true if the entire line was traced (until OnNoMoreHits())
Definition at line 32 of file LineBlockTracer.cpp.
Traces one line between Start and End; returns true if the entire line was traced (until OnNoMoreHits())
Definition at line 137 of file LineBlockTracer.cpp.
|
protected |
The current block.
Definition at line 88 of file LineBlockTracer.h.
|
protected |
The face through which the current block has been entered.
Definition at line 91 of file LineBlockTracer.h.
|
protected |
The difference in coords, End - Start.
Definition at line 82 of file LineBlockTracer.h.
|
protected |
The increment at which the block coords are going from Start to End; either +1 or -1.
Definition at line 85 of file LineBlockTracer.h.
|
protected |
The end point of the trace.
Definition at line 79 of file LineBlockTracer.h.
|
protected |
The start point of the trace.
Definition at line 76 of file LineBlockTracer.h.