From 740a04b9db67cb711604eba078597207b36778af Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 10 Sep 2026 05:03:06 +0200 Subject: [PATCH] Fix large worlds build --- Source/Engine/Core/Math/Float4.cs | 34 +++++++++++++++++++++++ Source/Engine/Networking/NetworkStream.cs | 12 ++++---- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Source/Engine/Core/Math/Float4.cs b/Source/Engine/Core/Math/Float4.cs index 26abf4b2e..032118413 100644 --- a/Source/Engine/Core/Math/Float4.cs +++ b/Source/Engine/Core/Math/Float4.cs @@ -181,6 +181,40 @@ namespace FlaxEngine W = w; } + /// + /// Initializes a new instance of the struct. + /// + /// A vector containing the values with which to initialize the X, Y and Z components. + public Float4(Vector3 value) + { + X = (float)value.X; + Y = (float)value.Y; + Z = (float)value.Z; + } + + /// + /// Initializes a new instance of the struct. + /// + /// A vector containing the values with which to initialize the X, Y and Z components. + public Float4(Double3 value) + { + X = (float)value.X; + Y = (float)value.Y; + Z = (float)value.Z; + } + + /// + /// Initializes a new instance of the struct. + /// + /// A vector containing the values with which to initialize the X, Y and Z components. + public Float4(Vector4 value) + { + X = (float)value.X; + Y = (float)value.Y; + Z = (float)value.Z; + W = (float)value.W; + } + /// /// Initializes a new instance of the struct. /// diff --git a/Source/Engine/Networking/NetworkStream.cs b/Source/Engine/Networking/NetworkStream.cs index c986a7f20..3cd76271c 100644 --- a/Source/Engine/Networking/NetworkStream.cs +++ b/Source/Engine/Networking/NetworkStream.cs @@ -319,10 +319,10 @@ namespace FlaxEngine.Networking public void WriteVector3(Vector3 value) { #if USE_LARGE_WORLDS - var tmp = new Vector3(value); - WriteBytes((byte*)&tmp, sizeof(Vector3)); + var tmp = new Float3(value); + WriteBytes((byte*)&tmp, sizeof(Float3)); #else - WriteBytes((byte*)&value, sizeof(Vector3)); + WriteBytes((byte*)&value, sizeof(Float3)); #endif } @@ -340,10 +340,10 @@ namespace FlaxEngine.Networking public void WriteVector4(Vector4 value) { #if USE_LARGE_WORLDS - var tmp = new Vector4(value); - WriteBytes((byte*)&tmp, sizeof(Vector4)); + var tmp = new Float4(value); + WriteBytes((byte*)&tmp, sizeof(Float4)); #else - WriteBytes((byte*)&value, sizeof(Vector4)); + WriteBytes((byte*)&value, sizeof(Float4)); #endif }