merge from latest

Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
chcurran
2021-07-27 15:51:35 -07:00
127 changed files with 3093 additions and 1288 deletions
@@ -84,7 +84,7 @@ namespace AZ
else
{
AZ::Debug::Trace::Instance().Assert(__FILE__, __LINE__, AZ_FUNCTION_SIGNATURE,
"Bus has multiple threads in its callstack records. Configure MutexType on the bus, or don't send to it from multiple threads");
"Bus %s has multiple threads in its callstack records. Configure MutexType on the bus, or don't send to it from multiple threads", BusType::GetName());
}
}
@@ -71,7 +71,7 @@ namespace AZ
return &out;
}
Matrix4x4* MakeOrthographicMatrixRH(Matrix4x4& out, float left, float right, float bottom, float top, float nearDist, float farDist)
Matrix4x4* MakeOrthographicMatrixRH(Matrix4x4& out, float left, float right, float bottom, float top, float nearDist, float farDist, bool reverseDepth)
{
AZ_Assert(right > left, "right should be greater than left");
// valid to have matrix invert top/bottom and far/near
@@ -83,6 +83,11 @@ namespace AZ
return nullptr;
}
if (reverseDepth)
{
AZStd::swap(nearDist, farDist);
}
out.SetRow(0, 2.f/(right - left), 0.f, 0.f, - (right + left) / (right - left) );
out.SetRow(1, 0.f, 2.f / (top - bottom), 0.f, - (top + bottom) / (top - bottom) );
out.SetRow(2, 0.f, 0.f, 1 / (nearDist - farDist), nearDist / (nearDist - farDist) );
@@ -57,8 +57,9 @@ namespace AZ
//! @param top The y coordinate of top view-plane
//! @param near Distance to the near view-plane. Must be no less than zero.
//! @param far Distance to the far view-plane. Must be greater than zero.
//! @param reverseDepth Set to true to reverse depth which means near distance maps to 1 and far distance maps to 0.
//! @return Pointer of the output matrix
Matrix4x4* MakeOrthographicMatrixRH(Matrix4x4& out, float left, float right, float bottom, float top, float nearDist, float farDist);
Matrix4x4* MakeOrthographicMatrixRH(Matrix4x4& out, float left, float right, float bottom, float top, float nearDist, float farDist, bool reverseDepth = false);
//! Transforms a position by a matrix. This function can be used with any generic cases which include projection matrices.
Vector3 MatrixTransformPosition(const Matrix4x4& matrix, const Vector3& inPosition);
+1 -1
View File
@@ -12,7 +12,7 @@
ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME})
ly_get_list_relative_pal_filename(common_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/Common)
if(LY_ENABLE_RAD_TELEMETRY)
if(LY_RAD_TELEMETRY_ENABLED)
set(AZ_CORE_RADTELEMETRY_FILES ${common_dir}/azcore_profile_telemetry_files.cmake)
set(AZ_CORE_RADTELEMETRY_PLATFORM_INCLUDES ${pal_dir}/profile_telemetry_platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
set(AZ_CORE_RADTELEMETRY_INCLUDE_DIRECTORIES ${common_dir})
@@ -12,6 +12,6 @@
# is being avoided to prevent overriding functions declared in other targets platfrom
# specific cmake files
if(LY_ENABLE_RAD_TELEMETRY)
if(LY_RAD_TELEMETRY_ENABLED)
set(LY_COMPILE_DEFINITIONS PUBLIC AZ_PROFILE_TELEMETRY)
endif()
@@ -12,6 +12,6 @@
# is being avoided to prevent overriding functions declared in other targets platfrom
# specific cmake files
if(LY_ENABLE_RAD_TELEMETRY)
if(LY_RAD_TELEMETRY_ENABLED)
set(LY_COMPILE_DEFINITIONS PUBLIC AZ_PROFILE_TELEMETRY)
endif()
@@ -12,6 +12,6 @@
# is being avoided to prevent overriding functions declared in other targets platfrom
# specific cmake files
if(LY_ENABLE_RAD_TELEMETRY)
if(LY_RAD_TELEMETRY_ENABLED)
set(LY_COMPILE_DEFINITIONS PUBLIC AZ_PROFILE_TELEMETRY)
endif()
@@ -6,6 +6,6 @@
#
#
if(LY_ENABLE_RAD_TELEMETRY)
if(LY_RAD_TELEMETRY_ENABLED)
set(LY_COMPILE_DEFINITIONS PUBLIC AZ_PROFILE_TELEMETRY)
endif()
@@ -63,6 +63,13 @@ namespace Camera
//! @return The camera frustum's height
virtual float GetFrustumHeight() = 0;
//! Gets whether or not the camera is using an orthographic projection.
//! @return True if the camera is using an orthographic projection, or false if the camera is using a perspective projection.
virtual bool IsOrthographic() = 0;
//! @return The half width of the orthographic projection, @see SetOrthographicHalfWidth.
virtual float GetOrthographicHalfWidth() = 0;
//! Sets the camera's field of view in degrees between 0 < fov < 180 degrees
//! @param fov The camera frustum's new field of view in degrees
virtual void SetFov(float fov)
@@ -95,6 +102,15 @@ namespace Camera
//! @param height The camera frustum's new height
virtual void SetFrustumHeight(float height) = 0;
//! Sets whether or not the camera should use an orthographic projection in place of a perspective projection.
//! @param orthographic If true, the camera will use an orthographic projection
virtual void SetOrthographic(bool orthographic) = 0;
//! Sets the half-width of the orthographic projection.
//! @params halfWidth Used to calculate the bounds of the projection while in orthographic mode.
//! The height is calculated automatically based on the aspect ratio.
virtual void SetOrthographicHalfWidth(float halfWidth) = 0;
//! Makes the camera the active view
virtual void MakeActiveView() = 0;
+2 -2
View File
@@ -10,7 +10,7 @@
ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME})
ly_get_list_relative_pal_filename(common_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/Common)
set(LY_ENABLE_STATISTICAL_PROFILING OFF CACHE BOOL "Enables statistical profiling when using AZ_PROFILE_SCOPE. If True, it takes effect only if RAD Telemetry is disabled.")
set(LY_STATISTICAL_PROFILING_ENABLED OFF CACHE BOOL "Enables statistical profiling when using AZ_PROFILE_SCOPE. If True, it takes effect only if RAD Telemetry is disabled.")
set(LY_TOUCHBENDING_LAYER_BIT 63 CACHE STRING "Use TouchBending as the collision layer. The TouchBending layer can be a number from 1 to 63 (Default=63).")
ly_add_target(
@@ -38,7 +38,7 @@ ly_add_target(
3rdParty::lz4
)
if(LY_ENABLE_STATISTICAL_PROFILING)
if(LY_STATISTICAL_PROFILING_ENABLED)
ly_add_source_properties(
SOURCES AzFramework/Debug/StatisticalProfilerProxy.h
PROPERTY COMPILE_DEFINITIONS
@@ -9,8 +9,13 @@
#pragma once
#include <AzCore/Interface/Interface.h>
#include <AzCore/EBus/EBus.h>
#if PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
#include <xcb/xcb.h>
#endif // LY_COMPILE_DEFINITIONS
namespace AzFramework
{
class LinuxLifecycleEvents
@@ -25,4 +30,31 @@ namespace AzFramework
using Bus = AZ::EBus<LinuxLifecycleEvents>;
};
#if PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
class LinuxXcbConnectionManager
{
public:
AZ_RTTI(LinuxXcbConnectionManager, "{649951316-3626-4C9D-9DCA-2E7ABF84C0A9}");
virtual ~LinuxXcbConnectionManager() = default;
virtual xcb_connection_t* GetXcbConnection() const = 0;
};
class LinuxXcbConnectionManagerBusTraits
: public AZ::EBusTraits
{
public:
//////////////////////////////////////////////////////////////////////////
// EBusTraits overrides
static constexpr AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static constexpr AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
//////////////////////////////////////////////////////////////////////////
};
using LinuxXcbConnectionManagerBus = AZ::EBus<LinuxXcbConnectionManager, LinuxXcbConnectionManagerBusTraits>;
using LinuxXcbConnectionManagerInterface = AZ::Interface<LinuxXcbConnectionManager>;
#endif // PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
} // namespace AzFramework
@@ -12,6 +12,32 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
namespace AzFramework
{
#if PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
class LinuxXcbConnectionManagerImpl
: public LinuxXcbConnectionManagerBus::Handler
{
public:
LinuxXcbConnectionManagerImpl()
{
m_xcbConnection = xcb_connect(nullptr, nullptr);
AZ_Error("ApplicationLinux", m_xcbConnection != nullptr, "Unable to connect to X11 Server.");
LinuxXcbConnectionManagerBus::Handler::BusConnect();
}
~LinuxXcbConnectionManagerImpl()
{
LinuxXcbConnectionManagerBus::Handler::BusDisconnect();
xcb_disconnect(m_xcbConnection);
}
xcb_connection_t* GetXcbConnection() const override
{
return m_xcbConnection;
}
private:
xcb_connection_t* m_xcbConnection = nullptr;
};
#endif // PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
////////////////////////////////////////////////////////////////////////////////////////////////
class ApplicationLinux
: public Application::Implementation
@@ -27,6 +53,12 @@ namespace AzFramework
// Application::Implementation
void PumpSystemEventLoopOnce() override;
void PumpSystemEventLoopUntilEmpty() override;
private:
#if PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
AZStd::unique_ptr<LinuxXcbConnectionManager> m_xcbConnectionManager;
#endif // PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
};
////////////////////////////////////////////////////////////////////////////////////////////////
@@ -39,11 +71,26 @@ namespace AzFramework
ApplicationLinux::ApplicationLinux()
{
LinuxLifecycleEvents::Bus::Handler::BusConnect();
#if PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
m_xcbConnectionManager = AZStd::make_unique<LinuxXcbConnectionManagerImpl>();
if (LinuxXcbConnectionManagerInterface::Get() == nullptr)
{
LinuxXcbConnectionManagerInterface::Register(m_xcbConnectionManager.get());
}
#endif // PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
}
////////////////////////////////////////////////////////////////////////////////////////////////
ApplicationLinux::~ApplicationLinux()
{
#if PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
if (LinuxXcbConnectionManagerInterface::Get() == m_xcbConnectionManager.get())
{
LinuxXcbConnectionManagerInterface::Unregister(m_xcbConnectionManager.get());
}
m_xcbConnectionManager.reset();
#endif // PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
LinuxLifecycleEvents::Bus::Handler::BusDisconnect();
}
@@ -5,3 +5,30 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
# Based on the linux window manager trait, perform the appropriate additional build configurations
# Only 'xcb', 'wayland', and 'xlib' are recognized
if (${PAL_TRAIT_LINUX_WINDOW_MANAGER} STREQUAL "xcb")
find_library(XCB_LIBRARY xcb)
set(LY_BUILD_DEPENDENCIES
PRIVATE
${XCB_LIBRARY}
)
set(LY_COMPILE_DEFINITIONS PUBLIC PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB)
elseif(PAL_TRAIT_LINUX_WINDOW_MANAGER STREQUAL "wayland")
set(LY_COMPILE_DEFINITIONS PUBLIC PAL_TRAIT_LINUX_WINDOW_MANAGER_WAYLAND)
elseif(PAL_TRAIT_LINUX_WINDOW_MANAGER STREQUAL "xlib")
set(LY_COMPILE_DEFINITIONS PUBLIC PAL_TRAIT_LINUX_WINDOW_MANAGER_XLIB)
else()
message(FATAL_ERROR, "Linux Window Manager ${PAL_TRAIT_LINUX_WINDOW_MANAGER} is not recognized")
endif()
@@ -22,6 +22,7 @@ namespace AzNetworking
const AZ::TimeMs deltaTimeMs = currentTimeMs - m_lastLoggedTimeMs;
m_atoms[m_activeAtom].m_bytesTransmitted += byteCount;
m_atoms[m_activeAtom].m_packetsSent++;
m_atoms[m_activeAtom].m_timeAccumulatorMs += deltaTimeMs;
if (m_atoms[m_activeAtom].m_timeAccumulatorMs >= m_maxSampleTimeMs)
@@ -32,6 +33,11 @@ namespace AzNetworking
m_lastLoggedTimeMs = currentTimeMs;
}
void DatarateMetrics::LogPacketLost()
{
m_atoms[m_activeAtom].m_packetsLost++;
}
float DatarateMetrics::GetBytesPerSecond() const
{
const uint32_t sampleAtom = 1 - m_activeAtom;
@@ -47,6 +53,18 @@ namespace AzNetworking
return (bytesLogged * 1000.0f) / sampleTime; // (* 1000) to convert from bytes per millisecond to bytes per second
}
float DatarateMetrics::GetLossRatePercent() const
{
const uint32_t sampleAtom = 1 - m_activeAtom;
if (m_atoms[sampleAtom].m_packetsSent == 0)
{
return 0.0f;
}
return float(m_atoms[sampleAtom].m_packetsLost) / float(m_atoms[sampleAtom].m_packetsSent);
}
void ConnectionComputeRtt::LogPacketSent(PacketId packetId, AZ::TimeMs currentTimeMs)
{
for (uint32_t i = 0; i < MaxTrackableEntries; i++)
@@ -19,8 +19,10 @@ namespace AzNetworking
{
DatarateAtom() = default;
AZ::TimeMs m_timeAccumulatorMs = AZ::TimeMs{ 0 };
uint32_t m_bytesTransmitted = 0;
AZ::TimeMs m_timeAccumulatorMs = AZ::TimeMs{0};
uint32_t m_packetsSent = 0;
uint32_t m_packetsLost = 0;
};
//! @class DatarateMetrics
@@ -40,19 +42,26 @@ namespace AzNetworking
//! @param currentTimeMs current process time in milliseconds
void LogPacket(uint32_t byteCount, AZ::TimeMs currentTimeMs);
//! Invoked whenever a packet has determined to be lost.
void LogPacketLost();
//! Retrieve a sample of the datarate being incurred by this connection in bytes per second.
//! @return datarate for traffic sent to or from the connection in bytes per second
float GetBytesPerSecond() const;
//! Returns the estimated packet loss rate as a percentage of packets.
//! @return the estimated percentage loss rate
float GetLossRatePercent() const;
private:
//! Used internally to swap buffers used for metric gathering.
void SwapBuffers();
static constexpr AZ::TimeMs MaxSampleTimeMs = AZ::TimeMs{500};
static constexpr AZ::TimeMs MaxSampleTimeMs = AZ::TimeMs{ 2000 };
AZ::TimeMs m_maxSampleTimeMs = MaxSampleTimeMs;
AZ::TimeMs m_lastLoggedTimeMs = MaxSampleTimeMs;
AZ::TimeMs m_maxSampleTimeMs = MaxSampleTimeMs;
AZ::TimeMs m_lastLoggedTimeMs = MaxSampleTimeMs;
uint32_t m_activeAtom = 0;
DatarateAtom m_atoms[2];
};
@@ -69,7 +78,7 @@ namespace AzNetworking
ConnectionPacketEntry(PacketId packetId, AZ::TimeMs sendTimeMs);
PacketId m_packetId = InvalidPacketId;
AZ::TimeMs m_sendTimeMs = AZ::TimeMs{0};
AZ::TimeMs m_sendTimeMs = AZ::TimeMs{0};
};
//! @class ConnectionComputeRtt
@@ -100,8 +109,8 @@ namespace AzNetworking
private:
static constexpr uint32_t MaxTrackableEntries = 4;
static constexpr float InitialRoundTripTime = 0.1f; //< Start off with a 100 millisecond estimate for Rtt
static constexpr uint32_t MaxTrackableEntries = 8;
static constexpr float InitialRoundTripTime = 0.1f; //< Start off with a 100 millisecond estimate for Rtt
float m_roundTripTime = InitialRoundTripTime;
ConnectionPacketEntry m_entries[MaxTrackableEntries];
@@ -117,6 +126,11 @@ namespace AzNetworking
//! Resets all internal metrics to defaults.
void Reset();
void LogPacketSent(uint32_t byteCount, AZ::TimeMs currentTimeMs);
void LogPacketRecv(uint32_t byteCount, AZ::TimeMs currentTimeMs);
void LogPacketLost();
void LogPacketAcked();
uint32_t m_packetsSent = 0;
uint32_t m_packetsRecv = 0;
uint32_t m_packetsLost = 0;
@@ -40,4 +40,33 @@ namespace AzNetworking
{
*this = ConnectionMetrics();
}
inline void ConnectionMetrics::LogPacketSent(uint32_t byteCount, AZ::TimeMs currentTimeMs)
{
if (byteCount > 0)
{
m_packetsSent++;
}
m_sendDatarate.LogPacket(byteCount, currentTimeMs);
}
inline void ConnectionMetrics::LogPacketRecv(uint32_t byteCount, AZ::TimeMs currentTimeMs)
{
if (byteCount > 0)
{
m_packetsRecv++;
}
m_recvDatarate.LogPacket(byteCount, currentTimeMs);
}
inline void ConnectionMetrics::LogPacketLost()
{
m_packetsLost++;
m_sendDatarate.LogPacketLost();
}
inline void ConnectionMetrics::LogPacketAcked()
{
m_packetsAcked++;
}
}
@@ -95,11 +95,6 @@ namespace AzNetworking
//! @return the max transmission unit for this connection
virtual uint32_t GetConnectionMtu() const = 0;
//! Sets connection quality values for testing poor connection conditions.
//! Currently unsupported on TcpConnections
//! @param connectionQuality simulated connection quality values to use
virtual void SetConnectionQuality(const ConnectionQuality& connectionQuality) = 0;
//! Returns the connection identifier for this connection instance.
//! @return the connection identifier for this connection instance
ConnectionId GetConnectionId() const;
@@ -128,12 +123,23 @@ namespace AzNetworking
//! @return reference to the connection metric info
ConnectionMetrics& GetMetrics();
//! Retrieves debug connection quality settings.
//! Currently unsupported on TcpConnections
//! @return connection quality structure for this connection
const ConnectionQuality& GetConnectionQuality() const;
//! Retrieves debug connection quality settings, non-const.
//! Currently unsupported on TcpConnections
//! @return connection quality structure for this connection
ConnectionQuality& GetConnectionQuality();
private:
// The following data members are here in the interface for performance reasons
ConnectionId m_connectionId = InvalidConnectionId;
IpAddress m_remoteAddress;
ConnectionMetrics m_connectionMetrics;
ConnectionQuality m_connectionQuality;
void* m_userData = nullptr;
};
}
@@ -59,4 +59,14 @@ namespace AzNetworking
{
return m_connectionMetrics;
}
inline const ConnectionQuality& IConnection::GetConnectionQuality() const
{
return m_connectionQuality;
}
inline ConnectionQuality& IConnection::GetConnectionQuality()
{
return m_connectionQuality;
}
}
@@ -122,7 +122,7 @@ namespace AzNetworking
bool TcpConnection::UpdateRecv()
{
const AZ::TimeMs startTimeMs = AZ::GetElapsedTimeMs();
GetMetrics().m_recvDatarate.LogPacket(0, startTimeMs);
GetMetrics().LogPacketRecv(0, startTimeMs);
// Read new data off the input socket
{
@@ -261,11 +261,6 @@ namespace AzNetworking
return 0; // do nothing, unsupported on TCP connections
}
void TcpConnection::SetConnectionQuality([[maybe_unused]] const ConnectionQuality& connectionQuality)
{
; // do nothing, unsupported on TCP connections
}
bool TcpConnection::SendPacketInternal(PacketType packetType, TcpPacketEncodingBuffer& payloadBuffer, AZ::TimeMs currentTimeMs)
{
AZ_Assert(payloadBuffer.GetCapacity() < AZStd::numeric_limits<uint16_t>::max(), "Buffer capacity should be representable using 2 bytes or less");
@@ -333,8 +328,7 @@ namespace AzNetworking
}
m_sendRingbuffer.AdvanceWriteBuffer(headerSize + payloadSize);
GetMetrics().m_packetsSent++;
GetMetrics().m_sendDatarate.LogPacket(headerSize + payloadSize, currentTimeMs);
GetMetrics().LogPacketSent(headerSize + payloadSize, currentTimeMs);
m_networkInterface.GetMetrics().m_sendPackets++;
UpdateSend();
return true;
@@ -379,8 +373,7 @@ namespace AzNetworking
memcpy(dstData, srcData, packetSize);
m_recvRingbuffer.AdvanceReadBuffer(serializer.GetReadSize() + packetSize);
GetMetrics().m_packetsRecv++;
GetMetrics().m_recvDatarate.LogPacket(packetSize, currentTimeMs);
GetMetrics().LogPacketRecv(packetSize, currentTimeMs);
m_networkInterface.GetMetrics().m_recvPackets++;
return true;
}
@@ -102,7 +102,6 @@ namespace AzNetworking
bool Disconnect(DisconnectReason reason, TerminationEndpoint endpoint) override;
void SetConnectionMtu(uint32_t connectionMtu) override;
uint32_t GetConnectionMtu() const override;
void SetConnectionQuality(const ConnectionQuality& connectionQuality) override;
// @}
//! Sets the registered socket file descriptor for this TcpConnection in the associated ConnectionSet instance.
@@ -152,7 +152,7 @@ namespace AzNetworking
void UdpConnection::ProcessAcked(PacketId packetId, AZ::TimeMs currentTimeMs)
{
GetMetrics().m_packetsAcked++;
GetMetrics().LogPacketAcked();
m_reliableQueue.OnPacketAcked(m_networkInterface, *this, packetId);
// Compute Rtt adjustments
@@ -172,8 +172,7 @@ namespace AzNetworking
GetMetrics().m_connectionRtt.LogPacketSent(packetId, currentTimeMs);
}
GetMetrics().m_packetsSent++;
GetMetrics().m_sendDatarate.LogPacket(packetSize, currentTimeMs);
GetMetrics().LogPacketSent(packetSize, currentTimeMs);
m_lastSentPacketMs = currentTimeMs;
m_unackedPacketCount = 0;
}
@@ -193,7 +192,7 @@ namespace AzNetworking
return PacketTimeoutResult::Acked;
case PacketAckState::Nacked:
GetMetrics().m_packetsLost++;
GetMetrics().LogPacketLost();
if (reliability == ReliabilityType::Reliable)
{
m_reliableQueue.OnPacketLost(m_networkInterface, *this, packetId);
@@ -224,8 +223,7 @@ namespace AzNetworking
return false;
}
GetMetrics().m_packetsRecv++;
GetMetrics().m_recvDatarate.LogPacket(packetSize, currentTimeMs);
GetMetrics().LogPacketRecv(packetSize, currentTimeMs);
if (header.GetIsReliable() && !m_reliableQueue.OnPacketReceived(header))
{
@@ -66,13 +66,8 @@ namespace AzNetworking
bool Disconnect(DisconnectReason reason, TerminationEndpoint endpoint) override;
void SetConnectionMtu(uint32_t connectionMtu) override;
uint32_t GetConnectionMtu() const override;
void SetConnectionQuality(const ConnectionQuality& connectionQuality) override;
// @}
//! Gets connection quality values for testing poor connection conditions.
//! @return connection quality values for this IConnection instance
const ConnectionQuality& GetConnectionQuality() const;
//! Returns a suitable encryption endpoint for this connection type.
//! @return reference to the connections encryption endpoint
DtlsEndpoint& GetDtlsEndpoint();
@@ -146,8 +141,6 @@ namespace AzNetworking
UdpFragmentQueue m_fragmentQueue;
ConnectionState m_state = ConnectionState::Disconnected;
ConnectionRole m_connectionRole = ConnectionRole::Connector;
ConnectionQuality m_connectionQuality;
DtlsEndpoint m_dtlsEndpoint;
AZ::TimeMs m_lastSentPacketMs;
@@ -160,4 +153,3 @@ namespace AzNetworking
}
#include <AzNetworking/UdpTransport/UdpConnection.inl>
@@ -10,16 +10,6 @@
namespace AzNetworking
{
inline void UdpConnection::SetConnectionQuality(const ConnectionQuality& connectionQuality)
{
m_connectionQuality = connectionQuality;
}
inline const ConnectionQuality& UdpConnection::GetConnectionQuality() const
{
return m_connectionQuality;
}
inline DtlsEndpoint& UdpConnection::GetDtlsEndpoint()
{
return m_dtlsEndpoint;
@@ -224,8 +224,7 @@ namespace AzNetworking
continue;
}
connection->GetMetrics().m_recvDatarate.LogPacket(packet.m_receivedBytes + UdpPacketHeaderSize, currentTimeMs);
connection->GetMetrics().m_packetsRecv++;
connection->GetMetrics().LogPacketRecv(packet.m_receivedBytes + UdpPacketHeaderSize, currentTimeMs);
// Decode the packet flag bitset first since it's always uncompressed
UdpPacketHeader header;
@@ -126,7 +126,7 @@ namespace AzNetworking
#ifdef ENABLE_LATENCY_DEBUG
if (connectionQuality.m_lossPercentage > 0)
{
if (int32_t(m_random.GetRandom() % 100) < (connectionQuality.m_lossPercentage / 2))
if (int32_t(m_random.GetRandom() % 100) < (connectionQuality.m_lossPercentage))
{
// Pretend we sent, but don't actually send
return true;
@@ -157,9 +157,11 @@ namespace AzNetworking
#ifdef ENABLE_LATENCY_DEBUG
else if ((connectionQuality.m_latencyMs > AZ::TimeMs{ 0 }) || (connectionQuality.m_varianceMs > AZ::TimeMs{ 0 }))
{
const AZ::TimeMs jitterMs = aznumeric_cast<AZ::TimeMs>(m_random.GetRandom()) % (connectionQuality.m_varianceMs / aznumeric_cast<AZ::TimeMs>(2));
const AZ::TimeMs jitterMs = aznumeric_cast<AZ::TimeMs>(m_random.GetRandom()) % (connectionQuality.m_varianceMs > AZ::TimeMs{ 0 }
? connectionQuality.m_varianceMs
: AZ::TimeMs{ 1 });
const AZ::TimeMs currTimeMs = AZ::GetElapsedTimeMs();
const AZ::TimeMs deferTimeMs = (connectionQuality.m_latencyMs / aznumeric_cast<AZ::TimeMs>(2)) + jitterMs;
const AZ::TimeMs deferTimeMs = (connectionQuality.m_latencyMs) + jitterMs;
DeferredData deferred = DeferredData(address, data, size, encrypt, dtlsEndpoint);
AZ::Interface<AZ::IEventScheduler>::Get()->AddCallback([&, deferredData = deferred]
@@ -102,7 +102,7 @@ namespace Camera
using EditorCameraNotificationBus = AZ::EBus<EditorCameraNotifications>;
/**
* This bus is for requesting any camera-view-related changes
* This bus is for requesting any camera-view-related changes or information
*/
class EditorCameraViewRequests : public AZ::ComponentBus
{
@@ -115,6 +115,11 @@ namespace Camera
* Sets this camera as the active view in the scene, otherwise restores the default editor camera if it was already active
*/
virtual void ToggleCameraAsActiveView() = 0;
/**
* Gets the camera state associated with this view.
*/
virtual bool GetCameraState(AzFramework::CameraState& cameraState) = 0;
};
using EditorCameraViewRequestBus = AZ::EBus<EditorCameraViewRequests>;