当前位置: 首页 > news >正文

网站如何做app梧州本地网站

网站如何做app,梧州本地网站,北京搜索引擎推广服务,凡科网做网站基础概念 一个星球(例如地球)的气候系统主要是一些基本参数基于公转周期(年)和自转周期(日)的变化,这其中会有两个变化因素:地理位置(经纬度)和天气变化&…

基础概念

一个星球(例如地球)的气候系统主要是一些基本参数基于公转周期(年)和自转周期(日)的变化,这其中会有两个变化因素:地理位置(经纬度)和天气变化(冷暖空气流动或台风等)。

公转、自转及时间

时间决定于星球的公转周期形成年、星球的自转周期形成日,其下可以更细分出来月、时分秒等。

另外以地球为例,计时还和经度(时区)相关,部分区域可能还有夏令时等。维度决定了日出日落时间的区别,比如会出现极昼极夜等。

基本气候参数

温度:

湿度:

压强:

云量:

日照强度:

风速(方向、强度):

降雨强度:

降雪强度:

雾霾(颜色、强度):

雷暴:打雷闪电出现的频次和强度

另外有些衍生参数:

积水量:

积雪量:

积尘量:

气候影响因素

时间变化(四季和昼夜):

全年随着四季变化,各种基础参数指标会有个变化的曲线;基本所有的气候参数的基础值从这里产生;

极昼太阳远近会有基础气候参数变化,极夜太阳远近也有一些基础气候参数变化(可能比较小),然后中间维度区域在日出和日落事件发生后会逐渐做昼夜切换。

天气变化:

由于随机变化的冷暖气流变化,引起短期和随机的基础气候变化。可以分为:降水天气(雨、雪、冰雹)、雷暴天气、雾霾天气、强风天气(含飓风)。注意部分天气可能会同时发生,比如雷阵雨,同时包含下雨和雷暴甚至同时包含狂风。

游戏逻辑:

由于特殊的技能需要或者BOSS状态等也可能会引起气候参数的变化,此类状态变化独立于自然气候变化并且具有更高优先级,消失后会过渡回自然天气。

系统设计

中间全局管理器ClimateCoordinator用来管理各种基本气候参数,并且会在当前参数值和目标参数值之间做自然过渡。

特定区域内的气候可以根据四季、昼夜等时间变化做变化,另外会有一系列区域内会出现的天气变化,他们应用时也会影响区域内的基础气象参数。游戏逻辑可以在任何时候直接操作ClimateCoordinator来实现从自然天气到游戏逻辑参数的过渡。

对于需要根据气候表现做表演的对象,直接根据ClimateCoordinator中的值来进行对应值修改或者效果表现即可,如果表现参数和气候参数不直接对应可以添加中间对象转换。

方案

中间状态ClimateCoordinator

class CLIMATERUNTIME_API UClimateCoordinator : public UTickableWorldSubsystem
{
...void RegistVolume(AClimateVolume* Volume);void UnRegistVolume(AClimateVolume* Volume);void BindEarthGlobalInfo(UClimateEarthGlobalInfoComponent* Component);void UnbindEarthGlobalInfo(UClimateEarthGlobalInfoComponent* Component);// 0~1: degree of a yearUFUNCTION(BlueprintCallable, Category = "RuntimeClimate|DateTime")const float GetYearDegree() const;// 0~1: degree of a dayUFUNCTION(BlueprintCallable, Category = "RuntimeClimate|DateTime")const float GetDayDegree() const;UFUNCTION(BlueprintCallable, Category = "RuntimeClimate|DateTime")const FDateTime GetDateTime() const { return AreaDateTime; }UFUNCTION(BlueprintCallable, Category = "RuntimeClimate|DateTime")void SetDateTime(const FDateTime& DateTime) { AreaDateTime = DateTime; }UFUNCTION(BlueprintCallable, Category = "RuntimeClimate")const int32 GetTimeScalar() const;UFUNCTION(BlueprintCallable, Category = "RuntimeClimate")void SetTimeScalar(const int32 TimeScalar);UFUNCTION(BlueprintCallable, Category = "RuntimeClimate|Weather")void OverwriteTemperature(bool bOverwirte, const float Temperature, const float FadeDuration);UFUNCTION(BlueprintCallable, Category = "RuntimeClimate|Weather")const float GetTemperature() const;UFUNCTION(BlueprintCallable, Category = "RuntimeClimate|Weather")void OverwriteHumidity(bool bOverwirte, const float Humidity, const float FadeDuration);UFUNCTION(BlueprintCallable, Category = "RuntimeClimate|Weather")const float GetHumidity() const;
...
}

地理信息

class AEarthInfo : public AInfo
{
...float Latitude = 45.0f;float Longitude = -73.0f;float NorthOffset = 0;float BaseElevation = 0;int32 TimeZone = -5.0;int32 Year = 2022;int32 Month = 5;int32 Day = 17;int32 Hours = 12;int32 Minutes = 0;int32 Seconds = 0;uint8 bIsDaylightSavingTime : 1;int32 DSTStartMonth = 6;int32 DSTStartDay = 1;int32 DSTEndMonth = 8;int32 DSTEndDay = 31;int32 TimeScalar = 0;...
}

区域气候盒子

class CLIMATERUNTIME_API AClimateVolume : public AVolume
{
...int32 Priority = 0;uint32 bEnabled : 1;uint32 bUnbound : 1;virtual void PostRegisterAllComponents() override;virtual void PostUnregisterAllComponents() override;virtual void Tick(float DeltaSeconds) override;uint32 bTemperatureValid : 1;float Temperature = 20;float TemperatureUpdateSpeed = 0.01;
...
}

一系列表演辅助类

雾效影响组件:

UCLASS(ClassGroup = (Climate), meta = (BlueprintSpawnableComponent))
class CLIMATERUNTIME_API UClimateFogComponent : public UActorComponent
{GENERATED_UCLASS_BODY()public:virtual void OnRegister() override;virtual void OnUnregister() override;virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;UPROPERTY(EditAnywhere, Category = ExponentialHeightFog)FRuntimeFloatCurve ExponentialHeightFogDensityCurveFloat;UPROPERTY(EditAnywhere, Category = ExponentialHeightFog)FRuntimeCurveLinearColor ExponentialHeightFogScatteringColorCurveFloat;private:UPROPERTY(Transient)class UExponentialHeightFogComponent* ManagedComponent = nullptr;UPROPERTY(Transient)class UClimateCoordinator* ClimateCoordinator = nullptr;
};

根据经纬度、时区等信息计算日出、日落时间的计算函数:

void CalcSunPositionByLocationAndDateTime(float Latitude, float Longitude, float TimeZone, bool bIsDaylightSavingTime, const FDateTime& CalcTime, FClimateSunPosition& SunPositionData)
{float TimeOffset = TimeZone;if (bIsDaylightSavingTime){TimeOffset += 1.0f;}double LatitudeRad = FMath::DegreesToRadians(Latitude);// Get the julian day (number of days since Jan 1st of the year 4713 BC)double JulianDay = CalcTime.GetJulianDay() + (CalcTime.GetTimeOfDay().GetTotalHours() - TimeOffset) / 24.0;double JulianCentury = (JulianDay - 2451545.0) / 36525.0;// Get the sun's mean longitude , referred to the mean equinox of julian datedouble GeomMeanLongSunDeg = FMath::Fmod(280.46646 + JulianCentury * (36000.76983 + JulianCentury * 0.0003032), 360.0);double GeomMeanLongSunRad = FMath::DegreesToRadians(GeomMeanLongSunDeg);// Get the sun's mean anomalydouble GeomMeanAnomSunDeg = 357.52911 + JulianCentury * (35999.05029 - 0.0001537 * JulianCentury);double GeomMeanAnomSunRad = FMath::DegreesToRadians(GeomMeanAnomSunDeg);// Get the earth's orbit eccentricitydouble EccentEarthOrbit = 0.016708634 - JulianCentury * (0.000042037 + 0.0000001267 * JulianCentury);// Get the sun's equation of the centerdouble SunEqOfCtr = FMath::Sin(GeomMeanAnomSunRad) * (1.914602 - JulianCentury * (0.004817 + 0.000014 * JulianCentury))+ FMath::Sin(2.0 * GeomMeanAnomSunRad) * (0.019993 - 0.000101 * JulianCentury)+ FMath::Sin(3.0 * GeomMeanAnomSunRad) * 0.000289;// Get the sun's true longitudedouble SunTrueLongDeg = GeomMeanLongSunDeg + SunEqOfCtr;// Get the sun's true anomaly//	double SunTrueAnomDeg = GeomMeanAnomSunDeg + SunEqOfCtr;//	double SunTrueAnomRad = FMath::DegreesToRadians(SunTrueAnomDeg);// Get the earth's distance from the sun//	double SunRadVectorAUs = (1.000001018*(1.0 - EccentEarthOrbit*EccentEarthOrbit)) / (1.0 + EccentEarthOrbit*FMath::Cos(SunTrueAnomRad));// Get the sun's apparent longitudedouble SunAppLongDeg = SunTrueLongDeg - 0.00569 - 0.00478 * FMath::Sin(FMath::DegreesToRadians(125.04 - 1934.136 * JulianCentury));double SunAppLongRad = FMath::DegreesToRadians(SunAppLongDeg);// Get the earth's mean obliquity of the eclipticdouble MeanObliqEclipticDeg = 23.0 + (26.0 + ((21.448 - JulianCentury * (46.815 + JulianCentury * (0.00059 - JulianCentury * 0.001813)))) / 60.0) / 60.0;// Get the oblique correctiondouble ObliqCorrDeg = MeanObliqEclipticDeg + 0.00256 * FMath::Cos(FMath::DegreesToRadians(125.04 - 1934.136 * JulianCentury));double ObliqCorrRad = FMath::DegreesToRadians(ObliqCorrDeg);// Get the sun's right ascensiondouble SunRtAscenRad = FMath::Atan2(FMath::Cos(ObliqCorrRad) * FMath::Sin(SunAppLongRad), FMath::Cos(SunAppLongRad));double SunRtAscenDeg = FMath::RadiansToDegrees(SunRtAscenRad);// Get the sun's declinationdouble SunDeclinRad = FMath::Asin(FMath::Sin(ObliqCorrRad) * FMath::Sin(SunAppLongRad));double SunDeclinDeg = FMath::RadiansToDegrees(SunDeclinRad);double VarY = FMath::Pow(FMath::Tan(ObliqCorrRad / 2.0), 2.0);// Get the equation of timedouble EqOfTimeMinutes = 4.0 * FMath::RadiansToDegrees(VarY * FMath::Sin(2.0 * GeomMeanLongSunRad) - 2.0 * EccentEarthOrbit * FMath::Sin(GeomMeanAnomSunRad) + 4.0 * EccentEarthOrbit * VarY * FMath::Sin(GeomMeanAnomSunRad) * FMath::Cos(2.0 * GeomMeanLongSunRad) - 0.5 * VarY * VarY * FMath::Sin(4.0 * GeomMeanLongSunRad) - 1.25 * EccentEarthOrbit * EccentEarthOrbit * FMath::Sin(2.0 * GeomMeanAnomSunRad));// Get the hour angle of the sunrisedouble HASunriseDeg = FMath::RadiansToDegrees(FMath::Acos(FMath::Cos(FMath::DegreesToRadians(90.833)) / (FMath::Cos(LatitudeRad) * FMath::Cos(SunDeclinRad)) - FMath::Tan(LatitudeRad) * FMath::Tan(SunDeclinRad)));//	double SunlightDurationMinutes = 8.0 * HASunriseDeg;// Get the local time of the sun's rise and setdouble SolarNoonLST = (720.0 - 4.0 * Longitude - EqOfTimeMinutes + TimeOffset * 60.0) / 1440.0;double SunriseTimeLST = SolarNoonLST - HASunriseDeg * 4.0 / 1440.0;double SunsetTimeLST = SolarNoonLST + HASunriseDeg * 4.0 / 1440.0;// Get the true solar timedouble TrueSolarTimeMinutes = FMath::Fmod(CalcTime.GetTimeOfDay().GetTotalMinutes() + EqOfTimeMinutes + 4.0 * Longitude - 60.0 * TimeOffset, 1440.0);// Get the hour angle of current timedouble HourAngleDeg = TrueSolarTimeMinutes < 0 ? TrueSolarTimeMinutes / 4.0 + 180 : TrueSolarTimeMinutes / 4.0 - 180.0;double HourAngleRad = FMath::DegreesToRadians(HourAngleDeg);// Get the solar zenith angledouble SolarZenithAngleRad = FMath::Acos(FMath::Sin(LatitudeRad) * FMath::Sin(SunDeclinRad) + FMath::Cos(LatitudeRad) * FMath::Cos(SunDeclinRad) * FMath::Cos(HourAngleRad));double SolarZenithAngleDeg = FMath::RadiansToDegrees(SolarZenithAngleRad);// Get the sun elevationdouble SolarElevationAngleDeg = 90.0 - SolarZenithAngleDeg;double SolarElevationAngleRad = FMath::DegreesToRadians(SolarElevationAngleDeg);double TanOfSolarElevationAngle = FMath::Tan(SolarElevationAngleRad);// Get the approximated atmospheric refractiondouble ApproxAtmosphericRefractionDeg = 0.0;if (SolarElevationAngleDeg <= 85.0){if (SolarElevationAngleDeg > 5.0){ApproxAtmosphericRefractionDeg = 58.1 / TanOfSolarElevationAngle - 0.07 / FMath::Pow(TanOfSolarElevationAngle, 3) + 0.000086 / FMath::Pow(TanOfSolarElevationAngle, 5) / 3600.0;}else{if (SolarElevationAngleDeg > -0.575){ApproxAtmosphericRefractionDeg = 1735.0 + SolarElevationAngleDeg * (-518.2 + SolarElevationAngleDeg * (103.4 + SolarElevationAngleDeg * (-12.79 + SolarElevationAngleDeg * 0.711)));}else{ApproxAtmosphericRefractionDeg = -20.772 / TanOfSolarElevationAngle;}}ApproxAtmosphericRefractionDeg /= 3600.0;}// Get the corrected solar elevationdouble SolarElevationcorrectedforatmrefractionDeg = SolarElevationAngleDeg + ApproxAtmosphericRefractionDeg;// Get the solar azimuth double tmp = FMath::RadiansToDegrees(FMath::Acos(((FMath::Sin(LatitudeRad) * FMath::Cos(SolarZenithAngleRad)) - FMath::Sin(SunDeclinRad)) / (FMath::Cos(LatitudeRad) * FMath::Sin(SolarZenithAngleRad))));double SolarAzimuthAngleDegcwfromN = HourAngleDeg > 0.0 ? FMath::Fmod(tmp + 180.0, 360.0) : FMath::Fmod(540.0 - tmp, 360.0);// offset elevation angle to fit with UE coords systemSunPositionData.Elevation = 180.0f + SolarElevationAngleDeg;SunPositionData.CorrectedElevation = 180.0f + SolarElevationcorrectedforatmrefractionDeg;SunPositionData.Azimuth = SolarAzimuthAngleDegcwfromN;SunPositionData.SolarNoon = FTimespan::FromDays(SolarNoonLST);SunPositionData.SunriseTime = FTimespan::FromDays(SunriseTimeLST);SunPositionData.SunsetTime = FTimespan::FromDays(SunsetTimeLST);
}

参考

http://www.yayakq.cn/news/37122/

相关文章:

  • 国内定机票网站建设一个网站的上线流程
  • 常州网站建设方案搜索引擎营销的优缺点
  • 菏泽兼职网站建设网页设计个人
  • 移动网站搭建明天正式解封
  • dede做的网站打不开公共服务平台
  • 网站建设用到的算法官网网站建设平台
  • 帮企业做网站郑州百度网站优化排名
  • 灵犀科技 网站建设营销一体化平台
  • 谁做网站收录青岛官网seo
  • 游戏网站制作板式郑州网页设计培训
  • 做爰视频网站网站安全建设思考
  • 做网站用什么软件设计好wordpress 酒店
  • 北京酒店团购网站建设优度公司做的网站
  • 中国建设网站企业网上银行业务功能个人网站备案注意事项
  • 超云建站威廉网站建设
  • 苏州园区手机网站制作网站建设 如何友情链接
  • 网站建设规划设计公司排名wordpress 滑块验证码
  • h5网站建设报价多少钱跨境电商手机app平台
  • 2019做网站必须做可信网站吗有哪些网页设计软件
  • 内蒙古建设协会网站做婚恋网站
  • 霸州放心的网络建站网站关键词提升
  • 都匀市城乡建设局网站易语言做网站登陆
  • 深圳网站建设怎么注册安全工程师题库免费版
  • 北京最大做网站的公司有哪些医疗器械备案
  • 电子商务网站规划、电子商务网站建设wordpress伪静态优化
  • 如何做网站商铺wordpress网站加密码破解
  • 龙华做棋牌网站建设杭州巴顿品牌设计
  • 微信上的网站在线书店网站怎么做
  • 做一家拍卖网站需要什么资质WordPress百度智能小程序
  • php网站 config珠海网站开发