private void LoadPointCloud() { var serializedPointCloudLines = File.ReadAllLines(PointCloudFilePath); foreach (var serializedPointCloudLine in serializedPointCloudLines) { var parts = serializedPointCloudLine.Split(' '); var x = float.Parse(parts[0]); var y = float.Parse(parts[1]); var z = float.Parse(parts[2]); var pointCloudKey = new PointCloudKey(x, y); var pointCloudValue = new PointCloudValue(x, y, z); if (!_pointCloud.ContainsKey(pointCloudKey)) { _pointCloud.Add(pointCloudKey, pointCloudValue); } } }
private void CapturePointCloud() { var playerPosition = Function.Call <Vector3>(Hash.GET_ENTITY_COORDS, Game.Player.Character); for (var x = playerPosition.X - PointCloudCaptureRadius / 2; x < playerPosition.X + PointCloudCaptureRadius / 2; x += PointCloudCapturePrecision) { for (var y = playerPosition.Y - PointCloudCaptureRadius / 2; y < playerPosition.Y + PointCloudCaptureRadius / 2; y += PointCloudCapturePrecision) { var pointCloudKey = new PointCloudKey(x, y); if (!_pointCloud.ContainsKey(pointCloudKey)) { var groundHeightAtPlayerPosition = World.GetGroundHeight(new Vector2(x, y)); var pointCloudValue = new PointCloudValue(pointCloudKey.X, pointCloudKey.Y, groundHeightAtPlayerPosition); _pointCloud.Add(pointCloudKey, pointCloudValue); } } } }