From 921c8bed921be936cce34712ac71c0f5bf105484 Mon Sep 17 00:00:00 2001 From: ikpil Date: Sat, 1 Apr 2023 02:01:02 +0900 Subject: [PATCH] vector3f serializable --- src/DotRecast.Core/Vector3f.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/DotRecast.Core/Vector3f.cs b/src/DotRecast.Core/Vector3f.cs index 5b69308..8e02a08 100644 --- a/src/DotRecast.Core/Vector3f.cs +++ b/src/DotRecast.Core/Vector3f.cs @@ -23,15 +23,15 @@ namespace DotRecast.Core { public struct Vector3f { - public float x; - public float y; - public float z; + public float x { get; set; } + public float y { get; set; } + public float z { get; set; } public static Vector3f Zero { get; } = new Vector3f(0, 0, 0); public static Vector3f Of(float[] f) { - return new Vector3f(f[0], f[1], f[2]); + return new Vector3f(f); } public static Vector3f Of(float x, float y, float z) @@ -46,6 +46,13 @@ namespace DotRecast.Core this.z = z; } + public Vector3f(float[] f) + { + x = f[0]; + y = f[1]; + z = f[2]; + } + public float this[int index] { get => GetElement(index);