/// <summary> /// Applies the sky values /// </summary> /// <param name="_Owner"></param> /// <param name="_Sky"></param> public void Apply( NuajOrchestrator _Owner, ModulePerspective _Sky ) { _Owner.m_AirDensity = 1e-5f * AirDensity; _Owner.m_FogDensity = 1e-4f * FogDensity; _Sky.DensityRayleigh = _Owner.m_CurrentMultiplier * _Owner.m_AirDensity; _Sky.DensityMie = _Owner.m_CurrentMultiplier * _Owner.m_FogDensity; }
/// <summary> /// Applies the fog values /// </summary> /// <param name="_Owner"></param> /// <param name="_Fog"></param> public void Apply( NuajOrchestrator _Owner, ModulePerspective.FogLayer _Fog ) { if ( !(_Fog.Enabled=Enabled) ) return; _Fog.Altitude = Altitude; _Fog.Thickness = Thickness; _Fog.MieDensityFactor = MieFactor; _Fog.DensityRatioBottom = MieBottomRatio; _Fog.MaxDistance = MaxDistance; _Fog.IsotropicSkyFactor = AmbientFactor; _Fog.StepSize = StepSize; _Fog.NoiseTilingHorizontal = NoiseTilingX; _Fog.NoiseTilingVertical = NoiseTilingY; _Fog.NoiseAmplitude = NoiseAmplitude; _Fog.NoiseOffset = NoiseOffset; _Fog.DownpourStrength = DownpourStrength; // Setup wind _Fog.WindDirectionAngle = _Owner.m_WindDirectionAngle; _Fog.WindForce = _Owner.ComputeWindForce( _Fog.Altitude ); }
void OnGUI() { m_bUsingGUI = false; if ( Manager == null ) { // Get the manager first... Manager = FindObjectOfType( typeof(NuajManager) ) as NuajManager; if ( Manager == null ) return; } // Retrieve the orchestrators if ( Orch == null ) Orch = FindObjectOfType( typeof(NuajOrchestrator) ) as NuajOrchestrator; bool bCanShowSimpleMode = Orch != null; // Watermark if ( Watermark ) GUI.Label( new Rect( Screen.width - 0.0f - Watermark.width, Screen.height - 4.0f - Watermark.height, Watermark.width, Watermark.height ), new GUIContent( Watermark ) ); // Display X = Y = 0.0f; Label( "Arrow Keys + Space : Move", 250.0f ); Label( "Left Mouse : Look. Return : Resume demo", 300.0f ); if ( !(ShowControls = CheckBox( "Show Controls", ShowControls )) ) return; // Show FPS if ( FPSDisplay != null ) FPSDisplay.active = CheckBox( "Show FPS", FPSDisplay.active ); PreviousY(); // Come back if ( bCanShowSimpleMode && GUI.Button( new Rect( X + 120.0f, NextY(), 120.0f, STANDARD_HEIGHT ), AdvancedMode ? "Simple" : "Advanced" ) ) AdvancedMode = !AdvancedMode; Indent(); Separate( 4 ); if ( Orch != null && !AdvancedMode ) { // ==== SIMPLE CONTROLS ==== // Simple Day/Night Orch.TimeOfDay = Slider( "Time of Day", Orch.TimeOfDay, 0.0f, 24.0f ); Orch.DensityMultiplierAtNight = Slider( "Sunset Drama", Orch.DensityMultiplierAtNight, 0.0f, 8.0f ); // Weather interpolant GUI.Label( new Rect( X, Y, 100.0f, STANDARD_HEIGHT ), "Source Weather" ); GUI.Label( new Rect( X + 300.0f, Y, 100.0f, STANDARD_HEIGHT ), "Target Weather" ); NextY(); Orch.WeatherTypeSource = (NuajOrchestrator.WEATHER_PRESETS) SourcePreset.List( new Rect( X, Y, 100.0f, STANDARD_HEIGHT ), (int) Orch.WeatherTypeSource, ComboBoxContents, GUIStyle.none ); Orch.WeatherBalance = HorizontalSlider( new Rect( X + 100.0f, Y + 4, 200.0f, STANDARD_HEIGHT-8.0f ), Orch.WeatherBalance, 0.0f, 1.0f ); Orch.WeatherTypeTarget = (NuajOrchestrator.WEATHER_PRESETS) TargetPreset.List( new Rect( X + 300.0f, Y, 100.0f, STANDARD_HEIGHT ), (int) Orch.WeatherTypeTarget, ComboBoxContents, GUIStyle.none ); NextY(); Orch.WindForce = Slider( "Wind", Orch.WindForce, 0.0f, 0.2f ); } else { // ==== ADVANCED CONTROLS ==== // Sun Manager.SunElevation = Slider( "Sun Elevation", Manager.SunElevation, 0.0f, 180.0f, Mathf.Rad2Deg ); Manager.SunAzimuth = Slider( "Sun Azimuth", Manager.SunAzimuth, -180.0f, 180.0f, Mathf.Rad2Deg ); Manager.ModuleSky.DensityRayleigh = Slider( "Air Density", Manager.ModuleSky.DensityRayleigh, 0.0f, 200.0f, 1e5f ); Manager.ModuleSky.DensityMie = Slider( "Fog", Manager.ModuleSky.DensityMie, 0.0f, 1000.0f, 1e4f ); Separate(); // Clouds if ( Manager.ModuleCloudVolume.CloudLayersCount > 0 ) { Nuaj.ModuleCloudVolume.CloudLayer L0 = Manager.ModuleCloudVolume.CloudLayers[0] as Nuaj.ModuleCloudVolume.CloudLayer; Label( "Layer 0", 100.0f ); Indent(); L0.Coverage = Slider( "Coverage", L0.Coverage, -1.0f, 1.0f ); L0.Density = Slider( "Density", L0.Density, 0.0f, 1.0f, 0.2e3f ); L0.Altitude = Slider( "Altitude", L0.Altitude, -1.0f, 12.0f ); L0.WindForce = Slider( "Wind", L0.WindForce, 0.0f, 0.5f ); if ( L0.Thickness < 1.0f ) L0.Thickness = 1.0f; // So we can always tweak something... UnIndent(); } if ( Manager.ModuleCloudLayer.CloudLayersCount > 0 ) { Nuaj.ModuleCloudLayer.CloudLayer L1 = Manager.ModuleCloudLayer.CloudLayers[0] as Nuaj.ModuleCloudLayer.CloudLayer; Label( "Layer 1", 100.0f ); Indent(); L1.Coverage = Slider( "Coverage", L1.Coverage, -1.0f, 1.0f ); L1.Density = Slider( "Density", L1.Density, 0.0f, 1.0f, 50.0f ); L1.Altitude = Slider( "Altitude", L1.Altitude, -1.0f, 12.0f ); L1.WindForce = Slider( "Wind", L1.WindForce, 0.0f, 1.0f ); UnIndent(); } } Manager.ToneMappingGammaHighlights = Slider( "Gamma", Manager.ToneMappingGammaHighlights, 0.0f, 4.0f ); UnIndent(); }
/// <summary> /// Applies the cloud values /// </summary> /// <param name="_Owner"></param> /// <param name="_Cloud"></param> /// <param name="_Values"></param> /// <param name="_WeatherBalance"></param> public void Apply( NuajOrchestrator _Owner, ModuleCloudVolume.CloudLayer _Cloud ) { if ( !(_Cloud.Enabled=Enabled) ) return; _Cloud.Altitude = Altitude; _Cloud.Thickness = Thickness; _Cloud.Coverage = Coverage; _Cloud.Density = 5.0e-3f * Density; _Cloud.NoiseTiling = 0.02f * NoiseTiling; _Cloud.AmplitudeFactor = NoiseAmplitude; _Cloud.FrequencyFactor = NoiseFrequency; // Setup wind _Cloud.WindDirectionAngle = _Owner.m_WindDirectionAngle; _Cloud.WindForce = _Owner.ComputeWindForce( _Cloud.Altitude ); }
public void Apply( NuajManager _Manager, NuajOrchestrator _Orch, float _Time ) { // Apply orchestrator preset _Orch.WeatherTypeSource = PresetSource; _Orch.WeatherTypeTarget = PresetTarget; _Orch.WeatherBalance = PresetBalanceStart + (PresetBalanceEnd - PresetBalanceStart) * _Time / Duration; _Orch.TimeOfDay = TimeOfDayStart + (TimeOfDayEnd - TimeOfDayStart) * _Time / Duration; _Orch.DensityMultiplierAtNight = NightDensityFactor; _Orch.WindForce = Wind; _Orch.WindDirectionAngle = WindAngle; // Compute spline position if ( !m_bPathPreProcessed ) PreProcessPath(); if ( m_KeyIndex > PositionKeys.Length-2 ) return; // Can't interpolate... while ( _Time > m_KeyTimes[m_KeyIndex+1] ) { m_KeyIndex++; if ( m_KeyIndex >= m_IntervalDurations.Length ) return; // End of path... } // Interpolate position/view vectors float t = (_Time - m_KeyTimes[m_KeyIndex]) / m_IntervalDurations[m_KeyIndex]; // Normalize time Vector3 Position = LerpPosition( ref PositionKeys[m_KeyIndex], ref PositionKeys[m_KeyIndex+1], t ); Vector3 View = LerpView( ref RotationKeys[m_KeyIndex], ref RotationKeys[m_KeyIndex+1], t ); // Recompute view matrix Transform T = _Manager.Camera.transform; Vector3 Right = Vector3.Cross( Vector3.up, View ).normalized; Vector3 Up = Vector3.Cross( View, Right ); T.right = Right; T.up = Up; T.forward = View; T.position = Position; }