/// <summary> /// Gets the fog amount in the area specified. /// nFogType = nFogType specifies wether the Sun, or Moon fog type is returned. /// Valid values for nFogType are FOG_TYPE_SUN or FOG_TYPE_MOON. /// If no valid area (or object) is specified, it uses the area of caller. /// If an object other than an area is specified, will use the area that the object is currently in. /// </summary> public static int GetFogAmount(FogType nFogType, uint oArea = OBJECT_INVALID) { Internal.NativeFunctions.StackPushObject(oArea); Internal.NativeFunctions.StackPushInteger(nFogType.InternalValue); Internal.NativeFunctions.CallBuiltIn(785); return(Internal.NativeFunctions.StackPopInteger()); }
/// <summary> /// Gets the fog amount in the area specified. /// nFogType = nFogType specifies wether the Sun, or Moon fog type is returned. /// Valid values for nFogType are FOG_TYPE_SUN or FOG_TYPE_MOON. /// If no valid area (or object) is specified, it uses the area of caller. /// If an object other than an area is specified, will use the area that the object is currently in. /// </summary> public static int GetFogAmount(FogType nFogType, uint oArea = global::SWLOR.Game.Server.NWN._.OBJECT_INVALID) { Internal.NativeFunctions.StackPushObject(oArea); Internal.NativeFunctions.StackPushInteger((int)nFogType); Internal.NativeFunctions.CallBuiltIn(785); return(Internal.NativeFunctions.StackPopInteger()); }
/// <summary> /// Sets the fog color in the area specified. /// nFogType = FOG_TYPE_* specifies wether the Sun, Moon, or both fog types are set. /// nFogColor = FOG_COLOR_* specifies the color the fog is being set to. /// The fog color can also be represented as a hex RGB number if specific color shades /// are desired. /// The format of a hex specified color would be 0xFFEEDD where /// FF would represent the amount of red in the color /// EE would represent the amount of green in the color /// DD would represent the amount of blue in the color. /// If no valid area (or object) is specified, it uses the area of caller. /// If an object other than an area is specified, will use the area that the object is currently in. /// </summary> public static void SetFogColor(FogType nFogType, FogColorType nFogColor, uint oArea = OBJECT_INVALID) { Internal.NativeFunctions.StackPushObject(oArea); Internal.NativeFunctions.StackPushInteger(nFogColor.InternalValue); Internal.NativeFunctions.StackPushInteger(nFogType.InternalValue); Internal.NativeFunctions.CallBuiltIn(780); }
/// <summary> /// Gets the fog amount in the area specified. /// nFogType = nFogType specifies wether the Sun, or Moon fog type is returned. /// Valid values for nFogType are FOG_TYPE_SUN or FOG_TYPE_MOON. /// If no valid area (or object) is specified, it uses the area of caller. /// If an object other than an area is specified, will use the area that the object is currently in. /// </summary> public static int GetFogAmount(FogType nFogType, uint oArea = Core.NWScript.NWScript.OBJECT_INVALID) { Internal.NativeFunctions.StackPushObject(oArea); Internal.NativeFunctions.StackPushInteger((int)nFogType); Internal.NativeFunctions.CallBuiltIn(785); return(Internal.NativeFunctions.StackPopInteger()); }
/// <summary> /// Gets the fog color in the area specified. /// nFogType specifies wether the Sun, or Moon fog type is returned. /// Valid values for nFogType are FOG_TYPE_SUN or FOG_TYPE_MOON. /// If no valid area (or object) is specified, it uses the area of caller. /// If an object other than an area is specified, will use the area that the object is currently in. /// </summary> public static FogColor GetFogColor(FogType nFogType, uint oArea = OBJECT_INVALID) { NWN.Internal.NativeFunctions.StackPushObject(oArea); NWN.Internal.NativeFunctions.StackPushInteger((int)nFogType); NWN.Internal.NativeFunctions.CallBuiltIn(783); return((FogColor)NWN.Internal.NativeFunctions.StackPopInteger()); }
/// <summary> /// Sets the fog amount in the area specified. /// nFogType = FOG_TYPE_* specifies wether the Sun, Moon, or both fog types are set. /// nFogAmount = specifies the density that the fog is being set to. /// If no valid area (or object) is specified, it uses the area of caller. /// If an object other than an area is specified, will use the area that the object is currently in. /// </summary> public static void SetFogAmount(FogType nFogType, int nFogAmount, uint oArea = Core.NWScript.NWScript.OBJECT_INVALID) { Internal.NativeFunctions.StackPushObject(oArea); Internal.NativeFunctions.StackPushInteger(nFogAmount); Internal.NativeFunctions.StackPushInteger((int)nFogType); Internal.NativeFunctions.CallBuiltIn(784); }
public override bool OnInitialize() { //Read common header base.OnInitialize(); //Set defaults _colors = new List <RGBAPixel>(); //Read header values _flags = (SCN0FogFlags)Data->_flags; _type = (FogType)(int)Data->_type; //Don't bother reading data if the entry is null if (_name == "<null>") { return(false); } //Read fog color ReadColors( (uint)_flags, (uint)SCN0FogFlags.FixedColor, ref _solidColor, ref _colors, FrameCount, Data->_color.Address, ref _constantColor, ref _numEntries); return(false); }
/// <summary> /// Sets the fog amount in the area specified. /// nFogType = FOG_TYPE_* specifies wether the Sun, Moon, or both fog types are set. /// nFogAmount = specifies the density that the fog is being set to. /// If no valid area (or object) is specified, it uses the area of caller. /// If an object other than an area is specified, will use the area that the object is currently in. /// </summary> public static void SetFogAmount(FogType nFogType, int nFogAmount, uint oArea = global::SWLOR.Game.Server.NWN._.OBJECT_INVALID) { Internal.NativeFunctions.StackPushObject(oArea); Internal.NativeFunctions.StackPushInteger(nFogAmount); Internal.NativeFunctions.StackPushInteger((int)nFogType); Internal.NativeFunctions.CallBuiltIn(784); }
/// <summary> /// Gets the fog color in the area specified. /// nFogType specifies wether the Sun, or Moon fog type is returned. /// Valid values for nFogType are FOG_TYPE_SUN or FOG_TYPE_MOON. /// If no valid area (or object) is specified, it uses the area of caller. /// If an object other than an area is specified, will use the area that the object is currently in. /// </summary> public static FogColorType GetFogColor(FogType nFogType, uint oArea = OBJECT_INVALID) { Internal.NativeFunctions.StackPushObject(oArea); Internal.NativeFunctions.StackPushInteger(nFogType.InternalValue); Internal.NativeFunctions.CallBuiltIn(783); return(new FogColorType(Internal.NativeFunctions.StackPopInteger())); }
/// <summary> /// Sets the fog color in the area specified. /// nFogType = FOG_TYPE_* specifies wether the Sun, Moon, or both fog types are set. /// nFogColor = FOG_COLOR_* specifies the color the fog is being set to. /// The fog color can also be represented as a hex RGB number if specific color shades /// are desired. /// The format of a hex specified color would be 0xFFEEDD where /// FF would represent the amount of red in the color /// EE would represent the amount of green in the color /// DD would represent the amount of blue in the color. /// If no valid area (or object) is specified, it uses the area of caller. /// If an object other than an area is specified, will use the area that the object is currently in. /// </summary> public static void SetFogColor(FogType nFogType, FogColor nFogColor, uint oArea = Core.NWScript.NWScript.OBJECT_INVALID) { Internal.NativeFunctions.StackPushObject(oArea); Internal.NativeFunctions.StackPushInteger((int)nFogColor); Internal.NativeFunctions.StackPushInteger((int)nFogType); Internal.NativeFunctions.CallBuiltIn(780); }
/// <summary> /// 帧更新 /// </summary> private void UpdatePreFrame() { if (IsPlaying()) { //OnJudgePassCondition(); } if (mFogType == FogType.Foging) { if (mFogTime > 0) { mFogTime -= Time.deltaTime; } else { mFogType = FogType.Normal; // 向下位机发送结束冰冻消息 Debugger.Log("结束喷雾消息"); } } if (mSupportType == SupportType.Support) { if (mSupportTime > 0) { mSupportTime -= Time.deltaTime; } else { mSupportType = SupportType.Normal; } } }
public void SendFogMessage(FogType f, int sTime, int eTime) { var fMessage = new FogMessage { StartTime = sTime, EndTime = eTime, type = f }; Helper.Multiplayer.SendMessage(fMessage, "FogSync"); }
/// <summary> /// 响应冰冻道具 /// </summary> /// <param name="fogTime"></param> /// <param name="freezeTime"></param> void OnFreezeProp(float fogTime, float freezeTime) { // 想下位机发送喷雾消息 Debugger.Log("开始喷雾"); mFogTime = fogTime; mFogType = FogType.Foging; //ScenesManager.Instance.OnFreeProp(freezeTime); }
private void CreateFogMaterial() { if (EnviroSky.instance == null) { return; } if (dither == null) { dither = Resources.Load("tex_enviro_dither") as Texture2D; } if (detailNoiseTexture == null) { detailNoiseTexture = Resources.Load("enviro_clouds_detail_low") as Texture3D; } if (blackTexture == null) { blackTexture = Resources.Load("tex_enviro_black") as Texture2D; } //Cleanup if (fogMat != null) { DestroyImmediate(fogMat); } if (!EnviroSky.instance.useFog) { Shader shader = Shader.Find("Enviro/Standard/EnviroFogRenderingDisabled"); fogMat = new Material(shader); if (shader == null) { currentFogType = FogType.Disabled; } } else if (!EnviroSky.instance.fogSettings.useSimpleFog) { Shader shader = Shader.Find("Enviro/Standard/EnviroFogRendering"); fogMat = new Material(shader); if (shader == null) { currentFogType = FogType.Standard; } } else { Shader shader = Shader.Find("Enviro/Standard/EnviroFogRenderingSimple"); if (shader == null) { fogMat = new Material(shader); } currentFogType = FogType.Simple; } }
public FogAnimationFrame(float start, float end, Vector3 color, FogType type) { Start = start; End = end; Color = color; Type = type; Index = 0; hasS = hasE = false; }
public override void Render(StringBuilder sb) { TagName = "Fog"; AddProperty("color", Vector3.ToString(Color)); AddProperty("slm:density", Density); AddProperty("fogType", FogType.ToString()); base.Render(sb); }
public void modifyFog(FogType type) { var test = m_file.Elements("global").Elements("Engine").Elements("Render").Elements("Fog").Elements().First().Name.ToString(); var depths = m_file.Elements("global").Elements("Engine").Elements("Render").Elements("Fog").Elements().ToDictionary ( c => c.Name, c => c.Attribute("Depth") ); var maxViewRanges = m_file.Elements("global").Elements("Engine").Elements("Render").Elements("Fog").Elements().ToDictionary ( c => c.Name, c => c.Attribute("MaxViewRange") ); switch (type) { case FogType.Removed: foreach (KeyValuePair <XName, XAttribute> v in depths) { v.Value.SetValue(m_removedDepth); } foreach (KeyValuePair <XName, XAttribute> v in maxViewRanges) { v.Value.SetValue(m_removedMaxViewRange); } break; case FogType.Adjusted: foreach (KeyValuePair <XName, XAttribute> v in depths) { v.Value.SetValue(m_adjustedDepth); } foreach (KeyValuePair <XName, XAttribute> v in maxViewRanges) { v.Value.SetValue(m_adjustedMaxViewRange); } break; case FogType.Default: depths["Low"].SetValue("96"); depths["Medium"].SetValue("128"); depths["High"].SetValue("192"); depths["Ultra"].SetValue("256"); maxViewRanges["Low"].SetValue("4800.0f"); maxViewRanges["Medium"].SetValue("4800.0f"); maxViewRanges["High"].SetValue("6400.0f"); maxViewRanges["Ultra"].SetValue("6400.0f"); break; } }
protected virtual LightingExplorerTableColumn[] GetVolumeColumns() { return(new[] { new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Name, HDStyles.Name, null, 200), // 0: Name new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Checkbox, HDStyles.On, "m_Enabled", 25), // 1: Enabled new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Checkbox, HDStyles.GlobalVolume, "isGlobal", 60), // 2: Is Global new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Float, HDStyles.Priority, "priority", 60), // 3: Priority new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Custom, HDStyles.VolumeProfile, "sharedProfile", 100, (r, prop, dep) => // 4: Profile { if (prop.objectReferenceValue != null) { EditorGUI.PropertyField(r, prop, GUIContent.none); } }), new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Checkbox, HDStyles.HasVisualEnvironment, "sharedProfile", 100, (r, prop, dep) =>// 5: Has Visual environment { Volume volume = prop.serializedObject.targetObject as Volume; bool hasVisualEnvironment = volumeDataPairing[volume].hasVisualEnvironment; EditorGUI.BeginDisabledGroup(true); EditorGUI.Toggle(r, hasVisualEnvironment); EditorGUI.EndDisabledGroup(); }), new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Custom, HDStyles.SkyType, "sharedProfile", 100, (r, prop, dep) => // 6: Sky type { Volume volume = prop.serializedObject.targetObject as Volume; if (volumeDataPairing[volume].hasVisualEnvironment) { SkyType skyType = volumeDataPairing[volume].skyType; EditorGUI.BeginDisabledGroup(true); EditorGUI.EnumPopup(r, skyType); EditorGUI.EndDisabledGroup(); } }), new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Custom, HDStyles.FogType, "sharedProfile", 100, (r, prop, dep) => // 7: Fog type { Volume volume = prop.serializedObject.targetObject as Volume; if (volumeDataPairing[volume].hasVisualEnvironment) { FogType fogType = volumeDataPairing[volume].fogType; EditorGUI.BeginDisabledGroup(true); EditorGUI.EnumPopup(r, fogType); EditorGUI.EndDisabledGroup(); } }), new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Checkbox, HDStyles.HasStaticLightingSky, "sharedProfile", 100, (r, prop, dep) => // 8: Has Static Lighting Sky { Volume volume = prop.serializedObject.targetObject as Volume; bool hasStaticLightingSky = volumeDataPairing[volume].hasStaticLightingSky; EditorGUI.BeginDisabledGroup(true); EditorGUI.Toggle(r, hasStaticLightingSky); EditorGUI.EndDisabledGroup(); }), }); }
// Not used by the volumetric fog. public void PushShaderParametersCommon(HDCamera hdCamera, CommandBuffer cmd, FogType type) { Debug.Assert(hdCamera.frameSettings.enableAtmosphericScattering); cmd.SetGlobalInt(HDShaderIDs._AtmosphericScatteringType, (int)type); // Fog Color cmd.SetGlobalFloat(m_ColorModeParam, (float)colorMode.value); cmd.SetGlobalColor(m_FogColorDensityParam, new Color(color.value.r, color.value.g, color.value.b, density)); cmd.SetGlobalVector(m_MipFogParam, new Vector4(mipFogNear, mipFogFar, mipFogMaxMip, 0.0f)); }
public override void Initialize() { this.LevelManager.LevelChanged += (Action)(() => { this.type = FogType.ExponentialSquared; if (this.LevelManager.Sky == null) { return; } this.density = this.LevelManager.Sky.FogDensity; this.FogSettingsChanged(); }); }
public void PushShaderParametersCommon(CommandBuffer cmd, FogType type, FrameSettings frameSettings) { if (frameSettings.enableAtmosphericScattering) { cmd.SetGlobalFloat(m_TypeParam, (float)type); } else { cmd.SetGlobalFloat(m_TypeParam, (float)FogType.None); } // Fog Color cmd.SetGlobalFloat(m_ColorModeParam, (float)colorMode.value); cmd.SetGlobalColor(m_FogColorDensityParam, new Color(color.value.r, color.value.g, color.value.b, density)); cmd.SetGlobalVector(m_MipFogParam, new Vector4(mipFogNear, mipFogFar, mipFogMaxMip, 0.0f)); }
/// <summary>Returns a string describing the fog type. </summary> /// <param name="CurrentFogType">The type of the fog being looked at.</param> /// <returns>The fog type</returns> internal static string DescFogType(FogType CurrentFogType) { switch (CurrentFogType) { case FogType.None: return("None"); case FogType.Blinding: return("Blinding"); case FogType.Normal: return("Normal"); default: return("ERROR"); } }
public VolumeData(bool isGlobal, VolumeProfile profile, bool hasStaticLightingSky) { this.isGlobal = isGlobal; this.profile = profile; VisualEnvironment visualEnvironment = null; this.hasVisualEnvironment = profile.TryGet <VisualEnvironment>(typeof(VisualEnvironment), out visualEnvironment); if (this.hasVisualEnvironment) { this.skyType = (SkyType)visualEnvironment.skyType.value; this.fogType = visualEnvironment.fogType.value; } else { this.skyType = (SkyType)1; this.fogType = (FogType)0; } this.hasStaticLightingSky = hasStaticLightingSky; }
/// <summary>This function creates the fog </summary> public void CreateWeather(FogType fType, bool force) { FogElapsed.Reset(); CurrentFogType = FogType.Normal; if (Game1.random.NextDouble() < .25) { CurrentFogType = FogType.Light; } else if (Game1.random.NextDouble() > .90) { CurrentFogType = FogType.Blinding; } if (force) { CurrentFogType = fType; } SetFogTargetAlpha(); switch (CurrentFogType) { case FogType.Normal: FogTexture = TextureData.LightFogTexture; break; case FogType.Light: FogTexture = TextureData.ThickFogTexture; break; case FogType.Blinding: FogTexture = TextureData.ThickestFogTexture; break; default: FogTexture = TextureData.LightFogTexture; break; } FogAlpha = FogTargetAlpha; }
public VolumeData(bool isGlobal, VolumeProfile profile) { this.isGlobal = isGlobal; this.profile = profile; VisualEnvironment visualEnvironment = null; this.hasVisualEnvironment = profile != null?profile.TryGet <VisualEnvironment>(typeof(VisualEnvironment), out visualEnvironment) : false; if (this.hasVisualEnvironment) { this.skyType = (SkyType)visualEnvironment.skyType.value; this.fogType = visualEnvironment.fogType.value; } else { this.skyType = (SkyType)1; this.fogType = (FogType)0; } }
public void PushShaderParametersCommon(HDCamera hdCamera, CommandBuffer cmd, FogType type) { Debug.Assert(hdCamera.frameSettings.IsEnabled(FrameSettingsField.AtmosphericScattering)); int pbrSkyAtmosphereFlag = 0; var visualEnvironment = VolumeManager.instance.stack.GetComponent <VisualEnvironment>(); Debug.Assert(visualEnvironment != null); // The PBR sky contributes to atmospheric scattering. pbrSkyAtmosphereFlag = visualEnvironment.skyType.value == (int)SkyType.PhysicallyBased ? 128 : 0; cmd.SetGlobalInt(HDShaderIDs._AtmosphericScatteringType, pbrSkyAtmosphereFlag | (int)type); cmd.SetGlobalFloat(HDShaderIDs._MaxFogDistance, maxFogDistance.value); // Fog Color cmd.SetGlobalFloat(m_ColorModeParam, (float)colorMode.value); cmd.SetGlobalColor(m_FogColorDensityParam, new Color(color.value.r, color.value.g, color.value.b, density.value)); cmd.SetGlobalVector(m_MipFogParam, new Vector4(mipFogNear.value, mipFogFar.value, mipFogMaxMip.value, 0.0f)); }
private void buttonApply_Click(object sender, EventArgs e) { FogType action = FogType.Default; switch (comboBoxAction.SelectedIndex) { case 0: action = FogType.Removed; break; case 1: action = FogType.Adjusted; break; default: action = FogType.Default; break; } m_file.modifyFog(action); m_file.saveConfig(); MessageBox.Show("Applied!", "Applied", MessageBoxButtons.OK); }
/// <summary> /// Initializes a new instance of the <see cref="FogPostEffect"/> class. /// Set the density for Exponencial and Exponencial Squared and near/far plane for Linear /// </summary> /// <param name="type">The type.</param> public FogPostEffect(FogType type) : base(PostEffectType.Deferred) { fogType = type; }
/// <summary>This function creates the fog </summary> public void CreateWeather(FogType fType, bool force) { CurrentFogType = FogType.Normal; if (ClimatesOfFerngill.Dice.NextDoublePositive() < .25) { CurrentFogType = FogType.Light; } else if (ClimatesOfFerngill.Dice.NextDoublePositive() > .90) { CurrentFogType = FogType.Blinding; } if (force) { CurrentFogType = fType; } SetFogTargetAlpha(); this.FogAlpha = this.FogTargetAlpha; //now determine the fog expiration time double fogChance = ClimatesOfFerngill.Dice.NextDoublePositive(); /* * So we should rarely have full day fog, and it should on average burn off around 9am. * So, the strongest odds should be 820 to 930, with sharply falling off odds until 1200. And then * so, extremely rare odds for until 7pm and even rarer than midnight. */ if (FogTimeSpan == SDVTimePeriods.Morning) { BeginTime = new SDVTime(0600); if (fogChance > 0 && fogChance < .25) { this.ExpirationTime = new SDVTime(830); } else if (fogChance >= .25 && fogChance < .32) { this.ExpirationTime = new SDVTime(900); } else if (fogChance >= .32 && fogChance < .41) { this.ExpirationTime = new SDVTime(930); } else if (fogChance >= .41 && fogChance < .55) { this.ExpirationTime = new SDVTime(950); } else if (fogChance >= .55 && fogChance < .7) { this.ExpirationTime = new SDVTime(1040); } else if (fogChance >= .7 && fogChance < .8) { this.ExpirationTime = new SDVTime(1120); } else if (fogChance >= .8 && fogChance < .9) { this.ExpirationTime = new SDVTime(1200); } else if (fogChance >= .9 && fogChance < .95) { this.ExpirationTime = new SDVTime(1220); } else if (fogChance >= .95 && fogChance < .98) { this.ExpirationTime = new SDVTime(1300); } else if (fogChance >= .98 && fogChance < .99) { this.ExpirationTime = new SDVTime(1910); } else if (fogChance >= .99) { this.ExpirationTime = new SDVTime(2400); } } else { BeginTime = new SDVTime(Game1.getModeratelyDarkTime()); BeginTime.AddTime(ClimatesOfFerngill.Dice.Next(-15, 90)); ExpirationTime = new SDVTime(BeginTime); ExpirationTime.AddTime(ClimatesOfFerngill.Dice.Next(120, 310)); BeginTime.ClampToTenMinutes(); ExpirationTime.ClampToTenMinutes(); } if (SDVTime.CurrentTime >= BeginTime) { UpdateStatus(WeatherType, true); } }
public void SetFog(Color color, FogType fogType, float start, float end, float density, bool pixelFog, bool rangeFog) { VideoDriver_SetFog(_raw, color.ToUnmanaged(), fogType, start, end, density, pixelFog, rangeFog); }
static extern void VideoDriver_SetFog(IntPtr videodriver, int[] color, FogType fogType, float start, float end, float density, bool pixel, bool range);
public override void Initialize() { this.LevelManager.LevelChanged += (Action) (() => { this.type = FogType.ExponentialSquared; if (this.LevelManager.Sky == null) return; this.density = this.LevelManager.Sky.FogDensity; this.FogSettingsChanged(); }); }
/// <summary> /// Create the post effect for using Exponencial or Exponencial Squared /// </summary> /// <param name="density"></param> /// <param name="type"></param> public FogPostEffect(float density, FogType type) : base(PostEffectType.Deferred) { System.Diagnostics.Debug.Assert(type != SceneControl.FogType.LINEAR, "For linear fog, use the other constructor"); this.density = density; fogType = type; }