diff --git a/Assets/AWSIM/Prefabs/RGLWeatherManager.prefab b/Assets/AWSIM/Prefabs/RGLWeatherManager.prefab new file mode 100644 index 000000000..57e0000b5 --- /dev/null +++ b/Assets/AWSIM/Prefabs/RGLWeatherManager.prefab @@ -0,0 +1,90 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &6956985947121104793 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6197961024456584825} + - component: {fileID: -8569641881512349866} + - component: {fileID: 5029029592669420807} + - component: {fileID: 2635114183252318215} + m_Layer: 0 + m_Name: RGLWeatherManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6197961024456584825 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6956985947121104793} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -17.985855, y: -8.897016, z: 19.096115} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &-8569641881512349866 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6956985947121104793} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ac280d5abd54451082c0627a0d08b1b9, type: 3} + m_Name: + m_EditorClassIdentifier: + k__BackingField: 0 + k__BackingField: 9 + k__BackingField: 0.003 + k__BackingField: 1.6 + k__BackingField: 0.07 + k__BackingField: 0 + k__BackingField: 268435455 + k__BackingField: 1 +--- !u!114 &5029029592669420807 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6956985947121104793} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: aa72d4643994ea2d4b9e731c9454694c, type: 3} + m_Name: + m_EditorClassIdentifier: + k__BackingField: 0 + k__BackingField: 5 + k__BackingField: 3 + k__BackingField: 0.2 + k__BackingField: 268435455 + k__BackingField: 1 +--- !u!114 &2635114183252318215 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6956985947121104793} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e537672f1e918b452802a824b8840e70, type: 3} + m_Name: + m_EditorClassIdentifier: + k__BackingField: 0 + k__BackingField: 0.03 + k__BackingField: 0.01 + k__BackingField: 2 + k__BackingField: 268435455 diff --git a/Assets/AWSIM/Prefabs/RGLWeatherManager.prefab.meta b/Assets/AWSIM/Prefabs/RGLWeatherManager.prefab.meta new file mode 100644 index 000000000..d86f6ce5e --- /dev/null +++ b/Assets/AWSIM/Prefabs/RGLWeatherManager.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5b82928fb61bd08e9840780da71fbb94 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RGLUnityPlugin/Plugins/Linux/x86_64/libRobotecGPULidar.so b/Assets/RGLUnityPlugin/Plugins/Linux/x86_64/libRobotecGPULidar.so index 5bce7f6f5..af9a41c2d 100755 Binary files a/Assets/RGLUnityPlugin/Plugins/Linux/x86_64/libRobotecGPULidar.so and b/Assets/RGLUnityPlugin/Plugins/Linux/x86_64/libRobotecGPULidar.so differ diff --git a/Assets/RGLUnityPlugin/Plugins/Windows/x86_64/RobotecGPULidar.dll b/Assets/RGLUnityPlugin/Plugins/Windows/x86_64/RobotecGPULidar.dll index 5e3334e6f..441174e6e 100644 Binary files a/Assets/RGLUnityPlugin/Plugins/Windows/x86_64/RobotecGPULidar.dll and b/Assets/RGLUnityPlugin/Plugins/Windows/x86_64/RobotecGPULidar.dll differ diff --git a/Assets/RGLUnityPlugin/Scripts/LidarFogManager.cs b/Assets/RGLUnityPlugin/Scripts/LidarFogManager.cs new file mode 100644 index 000000000..e8f26d7a3 --- /dev/null +++ b/Assets/RGLUnityPlugin/Scripts/LidarFogManager.cs @@ -0,0 +1,98 @@ +// Copyright 2024 Robotec.ai. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using UnityEngine; + +namespace RGLUnityPlugin +{ + /// + /// The singleton component to activate and configure the fog model for the LiDAR sensors. + /// Note: This is a private feature. It requires replacing the RGL binary with the RGL private build binary. + /// + public class LidarFogManager : MonoBehaviour + { + // Singleton pattern + public static LidarFogManager Instance { get; private set; } + + // Delegate to notify that the snow model has been changed + public delegate void OnNewConfigDelegate(); + public OnNewConfigDelegate OnNewConfig; + + [field: Header("Base Settings")] + + [field: SerializeField] + [field: Tooltip("Enable/disable fog effect on devices.r")] + public bool IsFogEnabled { get; set; } = false; + + [field: SerializeField] + [field: Tooltip("The attenuation coefficient for fog corresponding to amount of fog in the air")] + [field: Range(0.003f, 0.5f)] + public float AttenuationCoefficient { get; private set; } = 0.03f; + + [field: SerializeField] + [field: Tooltip("Near cross-point of transmitter and receiver beams of Lidar device in meters. Model assumes that lidar is working in bistatic beam configuration.")] + [field: Range(0.0f, 1.0f)] + public float NearCrossPoint { get; private set; } = 0.01f; + + [field: SerializeField] + [field: Tooltip("Far cross-point of transmitter and receiver beams of Lidar device. Model assumes that lidar is working in bistatic beam configuration.")] + [field: Range(1.0f, 10.0f)] + public float FarCrossPoint { get; private set; } = 2.0f; + + [field: Header("Defaults")] + [field: SerializeField] + [field: Tooltip("Entity ID that is assigned to cloud points resulting from fog hits")] + public int FogId { get; private set; } = 268435455; // Default RGL entity ID. + + private void Awake() + { + if (!IsFogFeatureAvailable()) + { + Debug.LogError("Loaded RGL plugin does not include support for Lidar Fog Model, removing component"); + Destroy(this); + return; + } + + if (Instance != null && Instance != this) + { + Debug.LogError("LidarFogManager is already on the scene. Removing this component"); + Destroy(this); + return; + } + Instance = this; + } + + private void OnValidate() + { + OnNewConfig?.Invoke(); + } + + private void OnEnable() + { + IsFogEnabled = true; + OnNewConfig?.Invoke(); + } + + private void OnDisable() + { + IsFogEnabled = false; + OnNewConfig?.Invoke(); + } + + public bool IsFogFeatureAvailable() + { + return RGLNativeAPI.HasExtension(RGLExtension.RGL_EXTENSION_WEATHER); + } + } +} \ No newline at end of file diff --git a/Assets/RGLUnityPlugin/Scripts/LidarFogManager.cs.meta b/Assets/RGLUnityPlugin/Scripts/LidarFogManager.cs.meta new file mode 100644 index 000000000..e56a4a9d9 --- /dev/null +++ b/Assets/RGLUnityPlugin/Scripts/LidarFogManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e537672f1e918b452802a824b8840e70 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RGLUnityPlugin/Scripts/LidarRainManager.cs b/Assets/RGLUnityPlugin/Scripts/LidarRainManager.cs new file mode 100644 index 000000000..79c9c5de0 --- /dev/null +++ b/Assets/RGLUnityPlugin/Scripts/LidarRainManager.cs @@ -0,0 +1,105 @@ +// Copyright 2024 Robotec.ai. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using UnityEngine; + +namespace RGLUnityPlugin +{ + /// + /// The singleton component to activate and configure the rain model for the LiDAR sensors. + /// Note: This is a private feature. It requires replacing the RGL binary with the RGL private build binary. + /// + public class LidarRainManager : MonoBehaviour + { + // Singleton pattern + public static LidarRainManager Instance { get; private set; } + + // Delegate to notify that the rain model has been changed + public delegate void OnNewConfigDelegate(); + public OnNewConfigDelegate OnNewConfig; + + [field: Header("Base Settings")] + + [field: SerializeField] + [field: Tooltip("Enable/disable rain effect on devices.r")] + public bool IsRainEnabled { get; set; } = false; + + // Rain model properties + [field: SerializeField] + [field: Tooltip("The precipitation rate for rain is expressed in mm per hour")] + [field: Range(0.0f, 10.0f)] + public float RainRate { get; private set; } = 5.0f; + + [field: SerializeField] + [field: Tooltip("Maximal number of droplets which not obstruct the lidar beam")] + [field: Range(1, 5)] + public int RainNumericalThreshold { get; private set; } = 3; + + [field: SerializeField] + [field: Tooltip("Minimal beam aperture occupancy (ratio) that means a hit, both for droplets and for original hit")] + [field: Range(0.0f, 1.0f)] + public float OccupancyThreshold { get; private set; } = 0.2f; + + [field: Header("Defaults")] + + [field: SerializeField] + [field: Tooltip("Entity ID that is assigned to cloud points resulting from droplet hits")] + public int DropletsId { get; private set; } = 268435455; // Default RGL entity ID. + + [field: SerializeField] + [field: Tooltip("Initial intensity of each LiDAR laser beam, used to evaluate energy loss based on beam aperture occupancy")] + [field: Min(0.0f)] + public float FullBeamIntensity { get; private set; } = 1.0f; + + private void Awake() + { + if (!IsRainFeatureAvailable()) + { + Debug.LogError("Loaded RGL plugin does not include support for Lidar Rain Model, removing component"); + Destroy(this); + return; + } + + if (Instance != null && Instance != this) + { + Debug.LogError("LidarRainManager is already on the scene. Removing this component"); + Destroy(this); + return; + } + Instance = this; + } + + private void OnValidate() + { + OnNewConfig?.Invoke(); + } + + private void OnEnable() + { + IsRainEnabled = true; + OnNewConfig?.Invoke(); + } + + private void OnDisable() + { + IsRainEnabled = false; + OnNewConfig?.Invoke(); + } + + public bool IsRainFeatureAvailable() + { + return RGLNativeAPI.HasExtension(RGLExtension.RGL_EXTENSION_WEATHER); + } + } +} \ No newline at end of file diff --git a/Assets/RGLUnityPlugin/Scripts/LidarRainManager.cs.meta b/Assets/RGLUnityPlugin/Scripts/LidarRainManager.cs.meta new file mode 100644 index 000000000..46020fc57 --- /dev/null +++ b/Assets/RGLUnityPlugin/Scripts/LidarRainManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: aa72d4643994ea2d4b9e731c9454694c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RGLUnityPlugin/Scripts/LidarSensor.cs b/Assets/RGLUnityPlugin/Scripts/LidarSensor.cs index fae5cd974..5e37bd3b0 100644 --- a/Assets/RGLUnityPlugin/Scripts/LidarSensor.cs +++ b/Assets/RGLUnityPlugin/Scripts/LidarSensor.cs @@ -93,6 +93,8 @@ public class LidarSensor : MonoBehaviour private const string pointsCompactNodeId = "POINTS_COMPACT"; private const string toLidarFrameNodeId = "TO_LIDAR_FRAME"; private const string snowNodeId = "SNOW"; + private const string rainNodeId = "RAIN"; + private const string fogNodeId = "FOG"; private LidarModel? validatedPreset; private float timer; @@ -150,6 +152,22 @@ public void Start() LidarSnowManager.Instance.OnNewConfig += OnValidate; } + if (LidarRainManager.Instance != null) + { + // Add deactivated node with some initial values. To be activated and updated when validating. + rglGraphLidar.AddNodePointsSimulateRain(rainNodeId, 0.0f, 1.0f, 0.0001f, 1, 0.01f, 1, 0.1f); + rglGraphLidar.SetActive(rainNodeId, false); + LidarRainManager.Instance.OnNewConfig += OnValidate; + } + + if(LidarFogManager.Instance != null) + { + // Add deactivated node with some initial values. To be activated and updated when validating. + rglGraphLidar.AddNodePointsSimulateFog(fogNodeId, 0.03f, 0.1f, 2.0f); + rglGraphLidar.SetActive(fogNodeId, false); + LidarFogManager.Instance.OnNewConfig += OnValidate; + } + OnValidate(); if (doValidateConfigurationOnStartup) @@ -246,6 +264,47 @@ private void ApplyConfiguration(BaseLidarConfiguration newConfig) rglGraphLidar.SetActive(snowNodeId, LidarSnowManager.Instance.IsSnowEnabled); } + // Rain model updates + if (rglGraphLidar.HasNode(rainNodeId)) + { + // Update rain parameters only if feature is enabled (expensive operation) + if (LidarRainManager.Instance.IsRainEnabled) + { + rglGraphLidar.UpdateNodePointsSimulateRain(rainNodeId, + newConfig.GetRayRanges()[0].x, + newConfig.GetRayRanges()[0].y, + LidarRainManager.Instance.RainRate, + newConfig.laserArray.GetLaserRingIds().Length, + newConfig.horizontalBeamDivergence * Mathf.Deg2Rad, + LidarRainManager.Instance.RainNumericalThreshold, + LidarRainManager.Instance.OccupancyThreshold); + rglGraphLidar.UpdateNodePointsRainDefaults(rainNodeId, + LidarRainManager.Instance.DropletsId, + LidarRainManager.Instance.FullBeamIntensity, + 0.0f); // Default, because it is not supported in AWSIM. + } + + rglGraphLidar.SetActive(rainNodeId, LidarRainManager.Instance.IsRainEnabled); + } + + // Fog model updates + if (rglGraphLidar.HasNode(fogNodeId)) + { + // Update fog parameters only if feature is enabled (expensive operation) + if (LidarFogManager.Instance.IsFogEnabled) + { + rglGraphLidar.UpdateNodePointsSimulateFog(fogNodeId, + LidarFogManager.Instance.AttenuationCoefficient, + LidarFogManager.Instance.NearCrossPoint, + LidarFogManager.Instance.FarCrossPoint); + rglGraphLidar.UpdateNodePointsFogDefaults(fogNodeId, + LidarFogManager.Instance.FogId, + 0.0f); // Default, because it is not supported in AWSIM. + } + + rglGraphLidar.SetActive(fogNodeId, LidarFogManager.Instance.IsFogEnabled); + } + rglGraphLidar.ConfigureNodeRaytraceDistortion(lidarRaytraceNodeId, applyVelocityDistortion); if (outputRestriction.enablePeriodicRestriction && outputRestriction.applyRestriction) diff --git a/Assets/RGLUnityPlugin/Scripts/LidarSnowManager.cs b/Assets/RGLUnityPlugin/Scripts/LidarSnowManager.cs index 8c0b08bae..3a8faab5e 100644 --- a/Assets/RGLUnityPlugin/Scripts/LidarSnowManager.cs +++ b/Assets/RGLUnityPlugin/Scripts/LidarSnowManager.cs @@ -65,7 +65,7 @@ public class LidarSnowManager : MonoBehaviour [field: SerializeField] [field: Tooltip("Entity ID that is assigned to cloud points resulting from snowflake hits")] public int SnowflakesId { get; private set; } = 268435455; // Default RGL entity ID. - + [field: SerializeField] [field: Tooltip("Initial intensity of each LiDAR laser beam, used to evaluate energy loss based on beam aperture occupancy")] [field: Min(0.0f)] @@ -108,7 +108,7 @@ private void OnDisable() public bool IsSnowFeatureAvailable() { - return RGLNativeAPI.HasExtension(RGLExtension.RGL_EXTENSION_SNOW); + return RGLNativeAPI.HasExtension(RGLExtension.RGL_EXTENSION_WEATHER); } } } diff --git a/Assets/RGLUnityPlugin/Scripts/LowLevelWrappers/RGLHelperTypes.cs b/Assets/RGLUnityPlugin/Scripts/LowLevelWrappers/RGLHelperTypes.cs index 9b342fb68..107b44f0d 100644 --- a/Assets/RGLUnityPlugin/Scripts/LowLevelWrappers/RGLHelperTypes.cs +++ b/Assets/RGLUnityPlugin/Scripts/LowLevelWrappers/RGLHelperTypes.cs @@ -36,6 +36,8 @@ public enum RGLNodeType POINTS_RADAR_TRACK_OBJECTS, PUBLISH_UDP_OBJECT_LIST, POINTS_SIMULATE_SNOW, + POINTS_SIMULATE_RAIN, + POINTS_SIMULATE_FOG, RAYTRACE, GAUSSIAN_NOISE_ANGULAR_RAY, GAUSSIAN_NOISE_ANGULAR_HITPOINT, diff --git a/Assets/RGLUnityPlugin/Scripts/LowLevelWrappers/RGLNativeAPI.cs b/Assets/RGLUnityPlugin/Scripts/LowLevelWrappers/RGLNativeAPI.cs index 9c050e9c2..efcf0b64c 100644 --- a/Assets/RGLUnityPlugin/Scripts/LowLevelWrappers/RGLNativeAPI.cs +++ b/Assets/RGLUnityPlugin/Scripts/LowLevelWrappers/RGLNativeAPI.cs @@ -182,6 +182,20 @@ public static extern int rgl_node_points_simulate_snow(ref IntPtr node, float mi public static extern int rgl_node_points_simulate_snow_configure_defaults(IntPtr node, int snowflakes_id, float full_beam_intensity, float snowflakes_laser_retro); + [DllImport("RobotecGPULidar")] + public static extern int rgl_node_points_simulate_rain(ref IntPtr node, float min_range, float max_range, float rain_rate, + Int32 num_channels, float beam_divergence , Int32 numerical_threshold, float occupancy_threshold); + + [DllImport("RobotecGPULidar")] + public static extern int rgl_node_points_simulate_rain_configure_defaults(IntPtr node, int droplets_id, float full_beam_intensity, + float droplets_laser_retro); + + [DllImport("RobotecGPULidar")] + public static extern int rgl_node_points_simulate_fog(ref IntPtr node, float attenuationCoefficient, float r1, float r2); + + [DllImport("RobotecGPULidar")] + public static extern int rgl_node_points_simulate_fog_configure_defaults(IntPtr node, int fog_id, float fog_laser_retro); + [DllImport("RobotecGPULidar")] public static extern int rgl_graph_run(IntPtr node); @@ -652,6 +666,29 @@ public static void NodePointsSimulateSnowConfigureDefaults(IntPtr node, int snow CheckErr(rgl_node_points_simulate_snow_configure_defaults(node, snowflakesId, fullBeamIntensity, snowflakesLaserRetro)); } + public static void NodePointsSimulateRain(ref IntPtr node, float minRange, float maxRange, float rainRate, + Int32 numChannels, float beamDivergence, Int32 numericalThreshold, float occupancyThreshold) + { + CheckErr(rgl_node_points_simulate_rain(ref node, minRange, maxRange, rainRate,numChannels, beamDivergence, numericalThreshold, + occupancyThreshold)); + } + + public static void NodePointsSimulateRainConfigureDefaults(IntPtr node, int dropletsId, float fullBeamIntensity, + float dropletsLaserRetro) + { + CheckErr(rgl_node_points_simulate_rain_configure_defaults(node, dropletsId, fullBeamIntensity, dropletsLaserRetro)); + } + + public static void NodePointsSimulateFog(ref IntPtr node, float attenuationCoefficient, float r1, float r2) + { + CheckErr(rgl_node_points_simulate_fog(ref node, attenuationCoefficient, r1, r2)); + } + + public static void NodePointsSimulateFogConfigureDefaults(IntPtr node, int fogId, float fogLaserRetro) + { + CheckErr(rgl_node_points_simulate_fog_configure_defaults(node, fogId, fogLaserRetro)); + } + public static void GraphRun(IntPtr node) { CheckErr(rgl_graph_run(node)); diff --git a/Assets/RGLUnityPlugin/Scripts/LowLevelWrappers/RGLNativeTypes.cs b/Assets/RGLUnityPlugin/Scripts/LowLevelWrappers/RGLNativeTypes.cs index 80ff042e7..7696c5cfd 100644 --- a/Assets/RGLUnityPlugin/Scripts/LowLevelWrappers/RGLNativeTypes.cs +++ b/Assets/RGLUnityPlugin/Scripts/LowLevelWrappers/RGLNativeTypes.cs @@ -175,7 +175,7 @@ public enum RGLExtension : Int32 RGL_EXTENSION_PCL = 0, RGL_EXTENSION_ROS2 = 1, RGL_EXTENSION_UDP = 2, - RGL_EXTENSION_SNOW = 3, + RGL_EXTENSION_WEATHER = 3, RGL_EXTENSION_COUNT }; } diff --git a/Assets/RGLUnityPlugin/Scripts/LowLevelWrappers/RGLNodeSequence.cs b/Assets/RGLUnityPlugin/Scripts/LowLevelWrappers/RGLNodeSequence.cs index 6a8ac1cd6..3589c26f2 100644 --- a/Assets/RGLUnityPlugin/Scripts/LowLevelWrappers/RGLNodeSequence.cs +++ b/Assets/RGLUnityPlugin/Scripts/LowLevelWrappers/RGLNodeSequence.cs @@ -350,6 +350,30 @@ public RGLNodeSequence AddNodePointsSimulateSnow(string identifier, float minRan return this; } + public RGLNodeSequence AddNodePointsSimulateRain(string identifier, float minRange, float maxRange, float rainRate, + Int32 numChannels, float beamDivergence, Int32 numericalThreshold, float occupancyThreshold) + { + CheckNodeNotExist(identifier); + RGLNodeHandle handle = new RGLNodeHandle(); + RGLNativeAPI.NodePointsSimulateRain(ref handle.Node, minRange, maxRange, rainRate, + numChannels, beamDivergence, numericalThreshold, occupancyThreshold); + handle.Type = RGLNodeType.POINTS_SIMULATE_RAIN; + handle.Identifier = identifier; + AddNode(handle); + return this; + } + + public RGLNodeSequence AddNodePointsSimulateFog(string identifier, float attenuationCoefficient, float r1, float r2) + { + CheckNodeNotExist(identifier); + RGLNodeHandle handle = new RGLNodeHandle(); + RGLNativeAPI.NodePointsSimulateFog(ref handle.Node, attenuationCoefficient, r1, r2); + handle.Type = RGLNodeType.POINTS_SIMULATE_FOG; + handle.Identifier = identifier; + AddNode(handle); + return this; + } + //// UPDATE NODES //// public RGLNodeSequence UpdateNodeRaysFromMat3x4f(string identifier, Matrix4x4[] rays) { @@ -479,6 +503,22 @@ public RGLNodeSequence UpdateNodePointsSimulateSnow(string identifier, float min return this; } + public RGLNodeSequence UpdateNodePointsSimulateRain(string identifier, float minRange, float maxRange, + float rainRate, Int32 numChannels, float beamDivergence, Int32 numericalThreshold, float occupancyThreshold) + { + RGLNodeHandle handle = ValidateNode(identifier, RGLNodeType.POINTS_SIMULATE_RAIN); + RGLNativeAPI.NodePointsSimulateRain(ref handle.Node, minRange, maxRange, rainRate, numChannels, + beamDivergence, numericalThreshold, occupancyThreshold); + return this; + } + + public RGLNodeSequence UpdateNodePointsSimulateFog(string identifier, float attenuationCoefficient, float r1, float r2) + { + RGLNodeHandle handle = ValidateNode(identifier, RGLNodeType.POINTS_SIMULATE_FOG); + RGLNativeAPI.NodePointsSimulateFog(ref handle.Node, attenuationCoefficient, r1, r2); + return this; + } + public RGLNodeSequence UpdateNodePointsSnowDefaults(string identifier, int snowflakesId, float fullBeamIntensity, float snowflakesLaserRetro) { RGLNodeHandle handle = ValidateNode(identifier, RGLNodeType.POINTS_SIMULATE_SNOW); @@ -486,6 +526,20 @@ public RGLNodeSequence UpdateNodePointsSnowDefaults(string identifier, int snowf return this; } + public RGLNodeSequence UpdateNodePointsRainDefaults(string identifier, int dropletsId, float fullBeamIntensity, float dropletsLaserRetro) + { + RGLNodeHandle handle = ValidateNode(identifier, RGLNodeType.POINTS_SIMULATE_RAIN); + RGLNativeAPI.NodePointsSimulateRainConfigureDefaults(handle.Node, dropletsId, fullBeamIntensity, dropletsLaserRetro); + return this; + } + + public RGLNodeSequence UpdateNodePointsFogDefaults(string identifier, int fogId, float fogLaserRetro) + { + RGLNodeHandle handle = ValidateNode(identifier, RGLNodeType.POINTS_SIMULATE_FOG); + RGLNativeAPI.NodePointsSimulateFogConfigureDefaults(handle.Node, fogId, fogLaserRetro); + return this; + } + //// CONFIGURE NODES //// public RGLNodeSequence ConfigureNodeRaytraceVelocity(string identifier, Vector3 linearVelocity, Vector3 angularVelocity)