diff --git a/src/GPUTileHandler.cs b/src/GPUTileHandler.cs index d0979ba..faf07cb 100644 --- a/src/GPUTileHandler.cs +++ b/src/GPUTileHandler.cs @@ -47,7 +47,8 @@ public static byte[] GetGPUTile(List instances, bool UseScaleNonUnifor foreach (var node in model.LogicalNodes) { - node.LocalTransform *= Matrix4x4.CreateTranslation(translation); + var tra = new Vector3((float)translation.X, (float)translation.Y, (float)translation.Z); + node.LocalTransform *= Matrix4x4.CreateTranslation(tra); } var bytes = model.WriteGLB().Array; @@ -73,7 +74,7 @@ private static StructuralMetadataClass AddMetadataSchema(ModelRoot gltf) return schemaClass; } - private static SceneBuilder AddModels(IEnumerable instances, Vector3 translation, bool UseScaleNonUniform) + private static SceneBuilder AddModels(IEnumerable instances, Point translation, bool UseScaleNonUniform) { var sceneBuilder = new SceneBuilder(); @@ -88,7 +89,7 @@ private static SceneBuilder AddModels(IEnumerable instances, Vector3 t return sceneBuilder; } - private static void AddModelInstancesToScene(SceneBuilder sceneBuilder, IEnumerable instances, bool UseScaleNonUniform, Vector3 translation, string model) + private static void AddModelInstancesToScene(SceneBuilder sceneBuilder, IEnumerable instances, bool UseScaleNonUniform, Point translation, string model) { var modelInstances = instances.Where(s => s.Model.Equals(model)).ToList(); var modelRoot = ModelRoot.Load(model); @@ -103,7 +104,7 @@ private static void AddModelInstancesToScene(SceneBuilder sceneBuilder, IEnumera } } - private static SceneBuilder GetSceneBuilder(IMeshBuilder meshBuilder, Instance instance, bool UseScaleNonUniform, Vector3 translation, int pointId) + private static SceneBuilder GetSceneBuilder(IMeshBuilder meshBuilder, Instance instance, bool UseScaleNonUniform, Point translation, int pointId) { var transformation = GetInstanceTransform(instance, UseScaleNonUniform, translation); var json = "{\"_FEATURE_ID_0\":" + pointId + "}"; @@ -112,7 +113,7 @@ private static SceneBuilder GetSceneBuilder(IMeshBuilder meshBu return sceneBuilder; } - private static AffineTransform GetInstanceTransform(Instance instance, bool UseScaleNonUniform, Vector3 translation) + private static AffineTransform GetInstanceTransform(Instance instance, bool UseScaleNonUniform, Point translation) { var point = (Point)instance.Position; @@ -126,7 +127,7 @@ private static AffineTransform GetInstanceTransform(Instance instance, bool UseS var instanceQuaternion = Quaternion.CreateFromYawPitchRoll((float)instance.Yaw, (float)instance.Pitch, (float)instance.Roll); var res = Quaternion.CreateFromRotationMatrix(m4); - var position2 = position - translation; + var position2 = new Vector3((float)(position.X - translation.X), (float)(position.Y - translation.Y), (float)(position.Z - translation.Z)); var scale = UseScaleNonUniform ? new Vector3((float)instance.ScaleNonUniform[0], (float)instance.ScaleNonUniform[1], (float)instance.ScaleNonUniform[2]) : @@ -199,8 +200,8 @@ private static Matrix4x4 GetTransformationMatrix((Vector3 East, Vector3 North, V m4.M33 = forward.Z; return m4; } - private static Vector3 ToYUp(Point position) + private static Point ToYUp(Point position) { - return new Vector3((float)position.X, (float)position.Z, (float)position.Y * -1); + return new Point((double)position.X, (double)position.Z, (double)position.Y * -1); } }