Agrarsense
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
WeatherParameters.h
Go to the documentation of this file.
1// Copyright (c) 2023 FrostBit Software Lab at the Lapland University of Applied Sciences
2//
3// This work is licensed under the terms of the MIT license.
4// For a copy, see <https://opensource.org/licenses/MIT>.
5
6#pragma once
7
8#include "Math/Color.h"
9
10#include "WeatherParameters.generated.h"
11
12USTRUCT(BlueprintType)
13struct AGRARSENSE_API FWeatherParameters
14{
15 GENERATED_BODY()
16
17 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "-40.0", ClampMax = "40.0", UIMin = "-40.0", UIMax = "40.0"))
18 float Temperature = 10.0f;
19
20 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "100.0", UIMin = "0.0", UIMax = "100.0"))
21 float Precipitation = 0.0f;
22
23 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "1.0", ClampMax = "5.0", UIMin = "1.0", UIMax = "5.0"))
24 float PrecipitationParticleSize = 1.0f;
25
26 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "1.0", UIMin = "0.0", UIMax = "1.0"))
27 float Cloudiness = 0.05f;
28
29 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "100.0", UIMin = "0.0", UIMax = "100.0"))
30 float Fog = 0.0f;
31
32 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "10.0", UIMin = "0.0", UIMax = "10.0"))
33 float FogFalloff = 0.2f;
34
35 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "25.0", UIMin = "0.0", UIMax = "25.0"))
36 float WindIntensity = 0.0f;
37
38 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "360.0", UIMin = "0.0", UIMax = "360.0"))
39 float WindDirection = 15.0f;
40
41 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "100.0", UIMin = "0.0", UIMax = "100.0"))
42 float SnowAmount = 0.0f;
43
44 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "1.0", UIMin = "0.0", UIMax = "1.0"))
45 float TreeSnowiness = 0.0f;
46
47 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "1", ClampMax = "12", UIMin = "1", UIMax = "12"))
48 int Month = 7;
49
50 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.0", ClampMax = "24", UIMin = "0.0", UIMax = "24"))
51 int Time = 12;
52
53 /*
54 * Use manual leaf colors or change tree leaf colors based on the month.
55 * If any color is (0.0f, 0.0f, 0.0f, 0.0f), it will be ignored.
56 */
57 UPROPERTY(EditAnywhere, BlueprintReadWrite)
58 bool UseManualLeafColors = false;
59
60 UPROPERTY(EditAnywhere, BlueprintReadWrite)
61 FLinearColor BirchLeafColor = FLinearColor(0.0f, 0.0f, 0.0f, 0.0f);
62
63 UPROPERTY(EditAnywhere, BlueprintReadWrite)
64 FLinearColor PineLeafColor = FLinearColor(0.0f, 0.0f, 0.0f, 0.0f);
65
66 UPROPERTY(EditAnywhere, BlueprintReadWrite)
67 FLinearColor SpruceLeafColor = FLinearColor(0.0f, 0.0f, 0.0f, 0.0f);
68
69 UPROPERTY(EditAnywhere, BlueprintReadWrite)
70 FLinearColor AlderLeafColor = FLinearColor(0.0f, 0.0f, 0.0f, 0.0f);
71
72 bool IsWinterSnowCondition()
73 {
74 return SnowAmount != 0.0f;
75 }
76
78 {
79 return (Month == 12 || Month <= 3);
80 }
81
87 {
88 return Temperature <= 0.0f && Precipitation != 0.0f;
89 }
90
91 FString ToString() const
92 {
93 return FString::Printf(
94 TEXT("%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %d, %d"),
95 Temperature,
96 Precipitation,
97 PrecipitationParticleSize,
98 Cloudiness,
99 Fog,
100 FogFalloff,
101 WindIntensity,
102 WindDirection,
103 SnowAmount,
104 TreeSnowiness,
105 Month,
106 Time
107 );
108 }
109
110 FString ToStringHumanReadable() const
111 {
112 return FString::Printf(
113 TEXT("Temperature: %.2f, Precipitation: %.2f, Precipitation Particle Size: %.2f, Cloudiness: %.2f, Fog: %.2f, Fog Falloff: %.2f, Wind Intensity: %.2f, Wind Direction: %.2f, Snow Amount: %.2f, Tree Snowiness: %.2f, Month: %d, Time: %d"),
114 Temperature,
115 Precipitation,
116 PrecipitationParticleSize,
117 Cloudiness,
118 Fog,
119 FogFalloff,
120 WindIntensity,
121 WindDirection,
122 SnowAmount,
123 TreeSnowiness,
124 Month,
125 Time
126 );
127 }
128};
FString ToStringHumanReadable() const
FString ToString() const