44 std::vector<RouteGuidance::Node> route;
46 route.push_back({ { node.position.x, node.position.y }, node.edgeId, node.streetName });
62 sprintf_s(msg,
sizeof msg,
"Advanced route from node %zu to %zu at %.4f,%.4f (%.1f km/h)",
70 for (
const auto& cue : cues)
73 sprintf_s(msg,
sizeof msg,
"Cue type %i edge %i direction %i distance %.1fm next node %zu at %.4f,%.4f (%.1f km/h)",
74 cue.type, cue.edgeId, cue.direction, cue.meters,
nextNodeIndex,
154 sprintf_s(msg,
sizeof msg,
"CreateVertexBuffer failed %x with length %zu", hr, (
bus->
nodes.size() + 1) *
sizeof RiseScreenVertex);
176 vtxs->
x = center.x; vtxs->
y = center.y; vtxs->
z = 0.0f; vtxs->
w = 1.0f;
182 const auto mapPosition = map.
WorldToScreen({ iter->position.x, iter->position.y });
183 vtxs->
x = mapPosition.x; vtxs->
y = mapPosition.y; vtxs->
z = 0.0f; vtxs->
w = 1.0f;
207 outpacket.
f_x =
static_cast<float>(pEdgeId);
208 outpacket.
f_y = pDistance;
209 outpacket.
f_z = pDirection;
210 outpacket.
f_w =
static_cast<float>(pType);
217 if (bearing < -30.0f && bearing >= -60.0f)
219 else if (bearing < -60.0f && bearing > -130.0f)
221 else if (bearing > 30.0f && bearing <= 60.0f)
223 else if (bearing > 60.0f && bearing < 130.0f)
225 else if (bearing > 130.0f || bearing < -130.0f)
247 const float radians = atan2f(vec.y, vec.x);
253 result = roundf(result);
268 return dist * 2000.0f;
273 float headingChange = pTargetHeading - pCurrentHeading;
274 return headingChange =
customModulo(headingChange + 180.0f, 360.0f) - 180.0f;
282 return a - floorf(a / n) * n;
288 sprintf_s(newmsg,
sizeof newmsg,
"TURNBYTURN: %s", msg);
#define SAFE_RELEASE(value)
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
float DebugDistanceToNextNode
bool streetViewConfigured
std::vector< Snode > nodes
unsigned char turnByTurnRoutingType
size_t turnByTurnExpectedNodes
void Log(const char *msg, Level level=Info, int errorCode=0)
void AddToCallStack(const char *msg)
void SendToServer(void *pData, DWORD dwSize, bool bGuaranteed, PacketOrdering order=ORDERING_NONE) const
HRESULT Lock(UINT offset, UINT bytes, void **output, DWORD flags)
HRESULT DrawPrimitive(Primitive type, UINT first, UINT count)
HRESULT CreateStateBlock(UINT type, RenderStateSnapshot **result)
HRESULT SetPixelShader(std::nullptr_t)
HRESULT GetViewport(Viewport *value) const
HRESULT SetStreamSource(UINT stream, RenderBuffer *buffer, UINT offset, UINT stride)
HRESULT SetRenderState(DWORD state, DWORD value)
HRESULT SetFVF(DWORD value)
HRESULT SetViewport(const Viewport *value)
HRESULT CreateVertexBuffer(UINT bytes, DWORD usage, DWORD format, ResourcePool pool, RenderBuffer **result, void *shared)
HRESULT SetTextureStageState(DWORD stage, DWORD state, DWORD value)
HRESULT SetVertexShader(std::nullptr_t)
std::size_t NextNodeIndex() const
void Reset(std::vector< Node > nodes={}, bool preserveRecalculationCooldown=false)
std::vector< Cue > Update(Point position, float speedKph, float elapsedSeconds=0.0f)
@ TYPE_MAPPED_ROUTE_ENDED
static float angleBetweenPositionsDeg(const RiseMath::Vector2 &vectorA, const RiseMath::Vector2 &vectorB)
static float convertDistanceToMeters(float dist)
static float distanceBetweenPositions(const RiseMath::Vector2 &vectorA, const RiseMath::Vector2 &vectorB)
Direction GetDirection(float bearing) const
void CreateVB(Rendering::RenderDevice *pd3dDevice)
static float vectorToDegrees(const RiseMath::Vector2 &vec)
static float customModulo(float a, float n)
void Trace(char *msg, Logger::Level severity=Logger::Level::Info) const
float GetHeadingToNextNode() const
void Update(bool pIsGrndVehicle, float pElasedTime)
TurnByTurn(Bus *pBus, Logger *pLoggger, Networking *pNetworking)
static float getHeadingChange(float targetHeading, float currentHeading)
Rendering::RenderBuffer * m_avRouteMap
RiseMath::Vector2 vehiclePosTcp
void sendUpdateToServer(int pEdgeId, float pDistance, float pDirection, UpdateType pType) const
void Draw(Rendering::RenderDevice *pd3dDevice, const StreetMapProjection &map)
void UpdateVB(const StreetMapProjection &map)
constexpr uint32_t DYNAMIC
constexpr uint32_t WRITEONLY
constexpr uint32_t DISCARD
constexpr uint32_t ALPHABLENDENABLE
constexpr uint32_t DIFFUSE
constexpr uint32_t DISABLE
constexpr uint32_t SELECTARG2
constexpr uint32_t COLOROP
constexpr uint32_t COLORARG2
constexpr PackedColor ColorRGB(unsigned r, unsigned g, unsigned b)
RenderDevice * ClientRenderer()
float Vec2Length(const Vector2 *a)
Vector2 * Vec2Normalize(Vector2 *out, const Vector2 *a)
Point WorldToScreen(Point position) const
Point OverlayToScreen(Point texturePosition) const