diff --git a/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs b/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs index 1b249d6..677c4be 100644 --- a/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs +++ b/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs @@ -968,6 +968,15 @@ namespace CodeWalker.GameFiles } } } + if (LODLights != null) + { + if (Parent?.DistantLODLights != null) + { + LODLights.Init(Parent.DistantLODLights); + } + else + { } + } } @@ -2116,6 +2125,7 @@ namespace CodeWalker.GameFiles ints[4] = (uint)(bb.Maximum.Y * 10.0f); ints[5] = (uint)(bb.Maximum.Z * 10.0f); + var bones = skel?.BonesMap; var exts = (Archetype.Extensions?.Length ?? 0);// + (Extensions?.Length ?? 0);//seems entity extensions aren't included in this //todo: create extension light instances @@ -2126,7 +2136,7 @@ namespace CodeWalker.GameFiles var la = lightAttrs[i]; var xform = Matrix.Identity; - if ((skel != null) && (skel.BonesMap.TryGetValue(la.BoneId, out Bone bone))) + if ((bones != null) && (bones.TryGetValue(la.BoneId, out Bone bone))) { xform = bone.AbsTransform; } @@ -2995,6 +3005,7 @@ namespace CodeWalker.GameFiles } } + public bool Enabled { get; set; } = true; public void Init(YmapLODLights l, YmapDistantLODLights p, int i) { diff --git a/CodeWalker.Shaders/LightPS.hlsli b/CodeWalker.Shaders/LightPS.hlsli index acafeec..bbb80cf 100644 --- a/CodeWalker.Shaders/LightPS.hlsli +++ b/CodeWalker.Shaders/LightPS.hlsli @@ -92,6 +92,12 @@ float4 GetLineSegmentNearestPoint(float3 v, float3 a, float3 b) } } +float GetAttenuation(float ldist, float falloff, float falloffExponent) +{ + float d = ldist / falloff; + return saturate((1 - d) / (1 + d*d*falloffExponent)); +} + float3 DeferredDirectionalLight(float3 camRel, float3 norm, float4 diffuse, float4 specular, float4 irradiance) { @@ -123,14 +129,14 @@ float4 DeferredLODLight(float3 camRel, float3 norm, float4 diffuse, float4 specu if (ldist <= 0) return 0; float4 rgbi = Unpack4x8UNF(lodlight.Colour).gbar; - float3 lcol = rgbi.rgb * rgbi.a * 5.0f; + float3 lcol = rgbi.rgb * rgbi.a * 100.0f; float3 ldir = srpos / ldist; float pclit = saturate(dot(ldir, norm)); float lamt = 1; if (LightType == 1)//point (sphere) { - lamt *= pow(saturate(1 - (ldist / lodlight.Falloff)), lodlight.FalloffExponent); + lamt *= GetAttenuation(ldist, lodlight.Falloff, lodlight.FalloffExponent); } else if (LightType == 2)//spot (cone) { @@ -139,11 +145,11 @@ float4 DeferredLODLight(float3 camRel, float3 norm, float4 diffuse, float4 specu float oang = lodlight.OuterAngleOrCapExt; if (ang > oang) return 0; lamt *= saturate(1 - ((ang - iang) / (oang - iang))); - lamt *= pow(saturate(1 - (ldist / lodlight.Falloff)), lodlight.FalloffExponent); + lamt *= GetAttenuation(ldist, lodlight.Falloff, lodlight.FalloffExponent); } else if (LightType == 4)//capsule { - lamt *= pow(saturate(1 - (ldist / lodlight.Falloff)), lodlight.FalloffExponent); //TODO! proper capsule lighting... (use point-line dist!) + lamt *= GetAttenuation(ldist, lodlight.Falloff, lodlight.FalloffExponent); //TODO! proper capsule lighting... (use point-line dist!) } pclit *= lamt; @@ -185,7 +191,7 @@ float4 DeferredLight(float3 camRel, float3 norm, float4 diffuse, float4 specular if (InstType == 1)//point (sphere) { - lamt *= pow(saturate(1 - (ldist / InstFalloff)), InstFalloffExponent); + lamt *= GetAttenuation(ldist, InstFalloff, InstFalloffExponent); } else if (InstType == 2)//spot (cone) { @@ -194,11 +200,11 @@ float4 DeferredLight(float3 camRel, float3 norm, float4 diffuse, float4 specular float oang = InstConeOuterAngle; if (ang > oang) return 0; lamt *= saturate(1 - ((ang - iang) / (oang - iang))); - lamt *= pow(saturate(1 - (ldist / InstFalloff)), InstFalloffExponent); + lamt *= GetAttenuation(ldist, InstFalloff, InstFalloffExponent); } else if (InstType == 4)//capsule { - lamt *= pow(saturate(1 - (ldist / InstFalloff)), InstFalloffExponent); + lamt *= GetAttenuation(ldist, InstFalloff, InstFalloffExponent); } pclit *= lamt; diff --git a/CodeWalker/Rendering/Renderable.cs b/CodeWalker/Rendering/Renderable.cs index 2b1c54b..8a38126 100644 --- a/CodeWalker/Rendering/Renderable.cs +++ b/CodeWalker/Rendering/Renderable.cs @@ -1373,17 +1373,28 @@ namespace CodeWalker.Rendering public void Init(ref LightAttributes_s l) { - Position = l.Position; - Colour = new Vector3(l.ColorR, l.ColorG, l.ColorB) * ((l.Intensity * 5.0f) / 255.0f); - Direction = l.Direction; - TangentX = l.Tangent; - TangentY = Vector3.Cross(l.Direction, l.Tangent); + var pos = l.Position; + var dir = l.Direction; + var tan = l.Tangent; + var bones = Owner?.Skeleton?.BonesMap; + if ((bones != null) && (bones.TryGetValue(l.BoneId, out Bone bone))) + { + var xform = bone.AbsTransform; + pos = xform.Multiply(pos); + dir = xform.MultiplyRot(dir); + tan = xform.MultiplyRot(tan); + } + Position = pos; + Colour = new Vector3(l.ColorR, l.ColorG, l.ColorB) * (2.0f * l.Intensity / 255.0f); + Direction = dir; + TangentX = tan; + TangentY = Vector3.Normalize(Vector3.Cross(l.Direction, TangentX)); Type = l.Type; Intensity = l.Intensity; Falloff = l.Falloff; - FalloffExponent = Math.Max(l.FalloffExponent * 0.25f, 0.5f);//is this right? - ConeInnerAngle = l.ConeInnerAngle * 0.01745329f; //is this right?? - ConeOuterAngle = l.ConeOuterAngle * 0.01745329f; //pi/180 + FalloffExponent = l.FalloffExponent; + ConeInnerAngle = Math.Min(l.ConeInnerAngle, l.ConeOuterAngle) * 0.01745329f; //is this right?? + ConeOuterAngle = Math.Max(l.ConeInnerAngle, l.ConeOuterAngle) * 0.01745329f; //pi/180 CapsuleExtent = l.Extent; CullingPlaneNormal = l.CullingPlaneNormal; CullingPlaneOffset = l.CullingPlaneOffset; @@ -1483,11 +1494,6 @@ namespace CodeWalker.Rendering if (ll == null) return; if (dll == null) return; - if (ll.LodLights == null) - { - ll.Init(dll); - } - if (ll.LodLights == null) { return; } @@ -1504,6 +1510,7 @@ namespace CodeWalker.Rendering for (int i = 0; i < n; i++) { var l = ll.LodLights[i]; + if (l.Enabled == false) continue; var light = new LODLight(); light.Position = l.Position; light.Colour = (uint)l.Colour.ToBgra(); @@ -1512,7 +1519,7 @@ namespace CodeWalker.Rendering light.TangentX = new Vector4(l.TangentX, 0.0f); light.TangentY = new Vector4(l.TangentY, 0.0f); light.Falloff = l.Falloff; - light.FalloffExponent = Math.Max(l.FalloffExponent*0.01f, 0.5f);//is this right? + light.FalloffExponent = l.FalloffExponent; light.InnerAngle = l.ConeInnerAngle * 0.012319971f; //pi/255 light.OuterAngleOrCapExt = l.ConeOuterAngleOrCapExt * 0.012319971f; //pi/255 var type = l.Type; diff --git a/CodeWalker/Rendering/RenderableCache.cs b/CodeWalker/Rendering/RenderableCache.cs index 0113585..9f487aa 100644 --- a/CodeWalker/Rendering/RenderableCache.cs +++ b/CodeWalker/Rendering/RenderableCache.cs @@ -248,6 +248,10 @@ namespace CodeWalker.Rendering lodlights.Invalidate(lodlight.LodLights?.Ymap); distlodlights.Invalidate(lodlight.DistLodLights); } + public void InvalidateImmediate(YmapLODLights lodlightsonly) + { + lodlights.UpdateImmediate(lodlightsonly?.Ymap, currentDevice); + } } @@ -432,7 +436,18 @@ namespace CodeWalker.Rendering keysToInvalidate.Enqueue(key); } - + public void UpdateImmediate(TKey key, Device device) + { + TVal item; + if (cacheitems.TryGetValue(key, out item)) + { + Interlocked.Add(ref CacheUse, -item.DataSize); + item.Unload(); + item.Init(key); + item.Load(device); + Interlocked.Add(ref CacheUse, item.DataSize); + } + } } } diff --git a/CodeWalker/Rendering/Renderer.cs b/CodeWalker/Rendering/Renderer.cs index 7622b8d..71b9f0a 100644 --- a/CodeWalker/Rendering/Renderer.cs +++ b/CodeWalker/Rendering/Renderer.cs @@ -550,7 +550,7 @@ namespace CodeWalker.Rendering lightartificialdowncolour = (Color4)weather.CurrentValues.lightArtificialExtDown; float lamult = weather.CurrentValues.lightDirAmbIntensityMult; float abounce = weather.CurrentValues.lightDirAmbBounce; - float minmult = hdr ? 0.1f : 0.5f; + float minmult = hdr ? 0.0f : 0.5f; lightdircolour *= Math.Max(lightdircolour.Alpha, minmult); lightdirambcolour *= lightdirambcolour.Alpha * lamult; // 0.1f * lamult; @@ -1831,11 +1831,17 @@ namespace CodeWalker.Rendering LodManager.MapViewEnabled = MapViewEnabled; LodManager.MapViewDist = camera.OrthographicSize / MapViewDetail; LodManager.ShowScriptedYmaps = ShowScriptedYmaps; + LodManager.LODLightsEnabled = renderlodlights; + LodManager.HDLightsEnabled = renderlights; LodManager.Update(renderworldVisibleYmapDict, camera, currentElapsedTime); + foreach (var updatelodlights in LodManager.UpdateLodLights) + { + renderableCache.InvalidateImmediate(updatelodlights); + } - var ents = LodManager.GetVisibleLeaves(); + var ents = LodManager.VisibleLeaves; for (int i = 0; i < ents.Count; i++) { @@ -3267,16 +3273,13 @@ namespace CodeWalker.Rendering { entity?.EnsureLights(rndbl.Key); - if (interiorent)//only interior ents making lights! todo: fix LOD lights + var linst = new RenderableLightInst(); + for (int i = 0; i < rndbl.Lights.Length; i++) { - var linst = new RenderableLightInst(); - for (int i = 0; i < rndbl.Lights.Length; i++) - { - linst.EntityPosition = position; - linst.EntityRotation = orientation; - linst.Light = rndbl.Lights[i]; - shaders.Enqueue(ref linst); - } + linst.EntityPosition = position; + linst.EntityRotation = orientation; + linst.Light = rndbl.Lights[i]; + shaders.Enqueue(ref linst); } } @@ -3956,6 +3959,8 @@ namespace CodeWalker.Rendering public bool MapViewEnabled = false; public float MapViewDist = 1.0f; public bool ShowScriptedYmaps = true; + public bool HDLightsEnabled = true; + public bool LODLightsEnabled = true; public Camera Camera = null; public Vector3 Position = Vector3.Zero; @@ -3965,6 +3970,11 @@ namespace CodeWalker.Rendering public Dictionary RootEntities = new Dictionary(); public List VisibleLeaves = new List(); + public Dictionary LodLightsDict = new Dictionary(); + public HashSet VisibleLights = new HashSet(); + public HashSet VisibleLightsPrev = new HashSet(); + public HashSet UpdateLodLights = new HashSet(); + public void Update(Dictionary ymaps, Camera camera, float elapsed) { Camera = camera; @@ -4014,6 +4024,14 @@ namespace CodeWalker.Rendering } } } + var remLodLights = ymap.LODLights?.LodLights; + if (remLodLights != null) + { + for (int i = 0; i < remLodLights.Length; i++) + { + LodLightsDict.Remove(remLodLights[i].Hash); + } + } ymap.LodManagerUpdate = false; ymap.LodManagerOldEntities = null; } @@ -4042,15 +4060,21 @@ namespace CodeWalker.Rendering } } } + var addLodLights = ymap.LODLights?.LodLights; + if (addLodLights != null) + { + for (int i = 0; i < addLodLights.Length; i++) + { + var light = addLodLights[i]; + LodLightsDict[light.Hash] = light; + } + } } } - } - - public List GetVisibleLeaves() - { VisibleLeaves.Clear(); + VisibleLights.Clear(); foreach (var kvp in RootEntities) { var ent = kvp.Key; @@ -4063,8 +4087,37 @@ namespace CodeWalker.Rendering } } } - return VisibleLeaves; + + UpdateLodLights.Clear(); + foreach (var light in VisibleLights) + { + if (VisibleLightsPrev.Contains(light) == false) + { + if (LodLightsDict.TryGetValue(light.Hash, out var lodlight)) + { + lodlight.Enabled = false; + UpdateLodLights.Add(lodlight.LodLights); + } + } + } + foreach (var light in VisibleLightsPrev) + { + if (VisibleLights.Contains(light) == false) + { + if (LodLightsDict.TryGetValue(light.Hash, out var lodlight)) + { + lodlight.Enabled = true; + UpdateLodLights.Add(lodlight.LodLights); + } + } + } + + + var vl = VisibleLights; + VisibleLights = VisibleLightsPrev; + VisibleLightsPrev = vl; } + private void RecurseAddVisibleLeaves(YmapEntityDef ent) { var clist = GetEntityChildren(ent); @@ -4082,6 +4135,14 @@ namespace CodeWalker.Rendering if (EntityVisible(ent)) { VisibleLeaves.Add(ent); + + if (HDLightsEnabled && (ent.Lights != null)) + { + for (int i = 0; i < ent.Lights.Length; i++) + { + VisibleLights.Add(ent.Lights[i]); + } + } } } } diff --git a/CodeWalker/WorldForm.Designer.cs b/CodeWalker/WorldForm.Designer.cs index e0e812e..fa5679d 100644 --- a/CodeWalker/WorldForm.Designer.cs +++ b/CodeWalker/WorldForm.Designer.cs @@ -312,6 +312,7 @@ namespace CodeWalker this.ToolbarPanel = new System.Windows.Forms.Panel(); this.SubtitleLabel = new System.Windows.Forms.Label(); this.SubtitleTimer = new System.Windows.Forms.Timer(this.components); + this.HDLightsCheckBox = new System.Windows.Forms.CheckBox(); this.StatusStrip.SuspendLayout(); this.ToolsPanel.SuspendLayout(); this.ToolsTabControl.SuspendLayout(); @@ -2249,6 +2250,7 @@ namespace CodeWalker // // OptionsLightingTabPage // + this.OptionsLightingTabPage.Controls.Add(this.HDLightsCheckBox); this.OptionsLightingTabPage.Controls.Add(this.DeferredShadingCheckBox); this.OptionsLightingTabPage.Controls.Add(this.WeatherRegionComboBox); this.OptionsLightingTabPage.Controls.Add(this.label29); @@ -2304,7 +2306,7 @@ namespace CodeWalker this.WeatherRegionComboBox.Location = new System.Drawing.Point(61, 355); this.WeatherRegionComboBox.Name = "WeatherRegionComboBox"; this.WeatherRegionComboBox.Size = new System.Drawing.Size(133, 21); - this.WeatherRegionComboBox.TabIndex = 43; + this.WeatherRegionComboBox.TabIndex = 50; this.WeatherRegionComboBox.SelectedIndexChanged += new System.EventHandler(this.WeatherRegionComboBox_SelectedIndexChanged); this.WeatherRegionComboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.WeatherRegionComboBox_KeyPress); // @@ -2314,7 +2316,7 @@ namespace CodeWalker this.label29.Location = new System.Drawing.Point(4, 358); this.label29.Name = "label29"; this.label29.Size = new System.Drawing.Size(44, 13); - this.label29.TabIndex = 64; + this.label29.TabIndex = 49; this.label29.Text = "Region:"; // // CloudParamTrackBar @@ -2327,7 +2329,7 @@ namespace CodeWalker this.CloudParamTrackBar.Maximum = 200; this.CloudParamTrackBar.Name = "CloudParamTrackBar"; this.CloudParamTrackBar.Size = new System.Drawing.Size(188, 45); - this.CloudParamTrackBar.TabIndex = 63; + this.CloudParamTrackBar.TabIndex = 55; this.CloudParamTrackBar.TickFrequency = 10; this.CloudParamTrackBar.Value = 100; this.CloudParamTrackBar.Scroll += new System.EventHandler(this.CloudParamTrackBar_Scroll); @@ -2341,7 +2343,7 @@ namespace CodeWalker this.CloudParamComboBox.Location = new System.Drawing.Point(78, 409); this.CloudParamComboBox.Name = "CloudParamComboBox"; this.CloudParamComboBox.Size = new System.Drawing.Size(116, 21); - this.CloudParamComboBox.TabIndex = 62; + this.CloudParamComboBox.TabIndex = 54; this.CloudParamComboBox.SelectedIndexChanged += new System.EventHandler(this.CloudParamComboBox_SelectedIndexChanged); this.CloudParamComboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.CloudParamComboBox_KeyPress); // @@ -2351,7 +2353,7 @@ namespace CodeWalker this.label23.Location = new System.Drawing.Point(4, 412); this.label23.Name = "label23"; this.label23.Size = new System.Drawing.Size(69, 13); - this.label23.TabIndex = 61; + this.label23.TabIndex = 53; this.label23.Text = "Cloud param:"; // // CloudsComboBox @@ -2363,7 +2365,7 @@ namespace CodeWalker this.CloudsComboBox.Location = new System.Drawing.Point(61, 382); this.CloudsComboBox.Name = "CloudsComboBox"; this.CloudsComboBox.Size = new System.Drawing.Size(133, 21); - this.CloudsComboBox.TabIndex = 60; + this.CloudsComboBox.TabIndex = 52; this.CloudsComboBox.SelectedIndexChanged += new System.EventHandler(this.CloudsComboBox_SelectedIndexChanged); this.CloudsComboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.CloudsComboBox_KeyPress); // @@ -2373,7 +2375,7 @@ namespace CodeWalker this.label21.Location = new System.Drawing.Point(4, 385); this.label21.Name = "label21"; this.label21.Size = new System.Drawing.Size(42, 13); - this.label21.TabIndex = 59; + this.label21.TabIndex = 51; this.label21.Text = "Clouds:"; // // TimeSpeedLabel @@ -2382,7 +2384,7 @@ namespace CodeWalker this.TimeSpeedLabel.Location = new System.Drawing.Point(78, 263); this.TimeSpeedLabel.Name = "TimeSpeedLabel"; this.TimeSpeedLabel.Size = new System.Drawing.Size(63, 13); - this.TimeSpeedLabel.TabIndex = 58; + this.TimeSpeedLabel.TabIndex = 44; this.TimeSpeedLabel.Text = "0.5 min/sec"; // // label20 @@ -2391,7 +2393,7 @@ namespace CodeWalker this.label20.Location = new System.Drawing.Point(3, 263); this.label20.Name = "label20"; this.label20.Size = new System.Drawing.Size(65, 13); - this.label20.TabIndex = 57; + this.label20.TabIndex = 43; this.label20.Text = "Time speed:"; // // TimeSpeedTrackBar @@ -2404,7 +2406,7 @@ namespace CodeWalker this.TimeSpeedTrackBar.Minimum = 40; this.TimeSpeedTrackBar.Name = "TimeSpeedTrackBar"; this.TimeSpeedTrackBar.Size = new System.Drawing.Size(133, 45); - this.TimeSpeedTrackBar.TabIndex = 41; + this.TimeSpeedTrackBar.TabIndex = 46; this.TimeSpeedTrackBar.TickFrequency = 5; this.TimeSpeedTrackBar.Value = 50; this.TimeSpeedTrackBar.Scroll += new System.EventHandler(this.TimeSpeedTrackBar_Scroll); @@ -2414,7 +2416,7 @@ namespace CodeWalker this.TimeStartStopButton.Location = new System.Drawing.Point(10, 279); this.TimeStartStopButton.Name = "TimeStartStopButton"; this.TimeStartStopButton.Size = new System.Drawing.Size(45, 23); - this.TimeStartStopButton.TabIndex = 40; + this.TimeStartStopButton.TabIndex = 45; this.TimeStartStopButton.Text = "Start"; this.TimeStartStopButton.UseVisualStyleBackColor = true; this.TimeStartStopButton.Click += new System.EventHandler(this.TimeStartStopButton_Click); @@ -2427,7 +2429,7 @@ namespace CodeWalker this.ArtificialAmbientLightCheckBox.Location = new System.Drawing.Point(10, 137); this.ArtificialAmbientLightCheckBox.Name = "ArtificialAmbientLightCheckBox"; this.ArtificialAmbientLightCheckBox.Size = new System.Drawing.Size(124, 17); - this.ArtificialAmbientLightCheckBox.TabIndex = 36; + this.ArtificialAmbientLightCheckBox.TabIndex = 37; this.ArtificialAmbientLightCheckBox.Text = "Artificial ambient light"; this.ArtificialAmbientLightCheckBox.UseVisualStyleBackColor = true; this.ArtificialAmbientLightCheckBox.CheckedChanged += new System.EventHandler(this.ArtificialAmbientLightCheckBox_CheckedChanged); @@ -2440,7 +2442,7 @@ namespace CodeWalker this.NaturalAmbientLightCheckBox.Location = new System.Drawing.Point(10, 115); this.NaturalAmbientLightCheckBox.Name = "NaturalAmbientLightCheckBox"; this.NaturalAmbientLightCheckBox.Size = new System.Drawing.Size(122, 17); - this.NaturalAmbientLightCheckBox.TabIndex = 35; + this.NaturalAmbientLightCheckBox.TabIndex = 36; this.NaturalAmbientLightCheckBox.Text = "Natural ambient light"; this.NaturalAmbientLightCheckBox.UseVisualStyleBackColor = true; this.NaturalAmbientLightCheckBox.CheckedChanged += new System.EventHandler(this.NaturalAmbientLightCheckBox_CheckedChanged); @@ -2450,10 +2452,10 @@ namespace CodeWalker this.LODLightsCheckBox.AutoSize = true; this.LODLightsCheckBox.Checked = true; this.LODLightsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; - this.LODLightsCheckBox.Location = new System.Drawing.Point(10, 93); + this.LODLightsCheckBox.Location = new System.Drawing.Point(89, 93); this.LODLightsCheckBox.Name = "LODLightsCheckBox"; this.LODLightsCheckBox.Size = new System.Drawing.Size(75, 17); - this.LODLightsCheckBox.TabIndex = 34; + this.LODLightsCheckBox.TabIndex = 35; this.LODLightsCheckBox.Text = "LOD lights"; this.LODLightsCheckBox.UseVisualStyleBackColor = true; this.LODLightsCheckBox.CheckedChanged += new System.EventHandler(this.LODLightsCheckBox_CheckedChanged); @@ -2479,7 +2481,7 @@ namespace CodeWalker this.ControlTimeOfDayCheckBox.Location = new System.Drawing.Point(10, 181); this.ControlTimeOfDayCheckBox.Name = "ControlTimeOfDayCheckBox"; this.ControlTimeOfDayCheckBox.Size = new System.Drawing.Size(166, 17); - this.ControlTimeOfDayCheckBox.TabIndex = 38; + this.ControlTimeOfDayCheckBox.TabIndex = 39; this.ControlTimeOfDayCheckBox.Text = "Control time of day (right-drag)"; this.ControlTimeOfDayCheckBox.UseVisualStyleBackColor = true; this.ControlTimeOfDayCheckBox.CheckedChanged += new System.EventHandler(this.ControlTimeOfDayCheckBox_CheckedChanged); @@ -2490,7 +2492,7 @@ namespace CodeWalker this.TimeOfDayLabel.Location = new System.Drawing.Point(75, 208); this.TimeOfDayLabel.Name = "TimeOfDayLabel"; this.TimeOfDayLabel.Size = new System.Drawing.Size(34, 13); - this.TimeOfDayLabel.TabIndex = 54; + this.TimeOfDayLabel.TabIndex = 41; this.TimeOfDayLabel.Text = "12:00"; // // label19 @@ -2499,7 +2501,7 @@ namespace CodeWalker this.label19.Location = new System.Drawing.Point(4, 208); this.label19.Name = "label19"; this.label19.Size = new System.Drawing.Size(65, 13); - this.label19.TabIndex = 53; + this.label19.TabIndex = 40; this.label19.Text = "Time of day:"; // // TimeOfDayTrackBar @@ -2512,7 +2514,7 @@ namespace CodeWalker this.TimeOfDayTrackBar.Maximum = 1440; this.TimeOfDayTrackBar.Name = "TimeOfDayTrackBar"; this.TimeOfDayTrackBar.Size = new System.Drawing.Size(188, 45); - this.TimeOfDayTrackBar.TabIndex = 39; + this.TimeOfDayTrackBar.TabIndex = 42; this.TimeOfDayTrackBar.TickFrequency = 60; this.TimeOfDayTrackBar.Value = 720; this.TimeOfDayTrackBar.Scroll += new System.EventHandler(this.TimeOfDayTrackBar_Scroll); @@ -2526,7 +2528,7 @@ namespace CodeWalker this.WeatherComboBox.Location = new System.Drawing.Point(61, 328); this.WeatherComboBox.Name = "WeatherComboBox"; this.WeatherComboBox.Size = new System.Drawing.Size(133, 21); - this.WeatherComboBox.TabIndex = 42; + this.WeatherComboBox.TabIndex = 48; this.WeatherComboBox.SelectedIndexChanged += new System.EventHandler(this.WeatherComboBox_SelectedIndexChanged); this.WeatherComboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.WeatherComboBox_KeyPress); // @@ -2536,7 +2538,7 @@ namespace CodeWalker this.label17.Location = new System.Drawing.Point(4, 331); this.label17.Name = "label17"; this.label17.Size = new System.Drawing.Size(51, 13); - this.label17.TabIndex = 39; + this.label17.TabIndex = 47; this.label17.Text = "Weather:"; // // ControlLightDirectionCheckBox @@ -2545,7 +2547,7 @@ namespace CodeWalker this.ControlLightDirectionCheckBox.Location = new System.Drawing.Point(10, 159); this.ControlLightDirectionCheckBox.Name = "ControlLightDirectionCheckBox"; this.ControlLightDirectionCheckBox.Size = new System.Drawing.Size(177, 17); - this.ControlLightDirectionCheckBox.TabIndex = 37; + this.ControlLightDirectionCheckBox.TabIndex = 38; this.ControlLightDirectionCheckBox.Text = "Control light direction (right-drag)"; this.ControlLightDirectionCheckBox.UseVisualStyleBackColor = true; this.ControlLightDirectionCheckBox.CheckedChanged += new System.EventHandler(this.ControlLightDirectionCheckBox_CheckedChanged); @@ -3590,6 +3592,19 @@ namespace CodeWalker // this.SubtitleTimer.Tick += new System.EventHandler(this.SubtitleTimer_Tick); // + // HDLightsCheckBox + // + this.HDLightsCheckBox.AutoSize = true; + this.HDLightsCheckBox.Checked = true; + this.HDLightsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.HDLightsCheckBox.Location = new System.Drawing.Point(10, 93); + this.HDLightsCheckBox.Name = "HDLightsCheckBox"; + this.HDLightsCheckBox.Size = new System.Drawing.Size(69, 17); + this.HDLightsCheckBox.TabIndex = 34; + this.HDLightsCheckBox.Text = "HD lights"; + this.HDLightsCheckBox.UseVisualStyleBackColor = true; + this.HDLightsCheckBox.CheckedChanged += new System.EventHandler(this.HDLightsCheckBox_CheckedChanged); + // // WorldForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -3962,5 +3977,6 @@ namespace CodeWalker private System.Windows.Forms.ToolStripMenuItem ToolbarRotationSnapping45Button; private System.Windows.Forms.ToolStripMenuItem ToolbarRotationSnapping90Button; private System.Windows.Forms.ToolStripMenuItem ToolbarSnapGridSizeButton; + private System.Windows.Forms.CheckBox HDLightsCheckBox; } } \ No newline at end of file diff --git a/CodeWalker/WorldForm.cs b/CodeWalker/WorldForm.cs index dd35c56..acbb530 100644 --- a/CodeWalker/WorldForm.cs +++ b/CodeWalker/WorldForm.cs @@ -7013,6 +7013,11 @@ namespace CodeWalker //Monitor.Exit(rendersyncroot); } + private void HDLightsCheckBox_CheckedChanged(object sender, EventArgs e) + { + Renderer.renderlights = HDLightsCheckBox.Checked; + } + private void LODLightsCheckBox_CheckedChanged(object sender, EventArgs e) { Renderer.renderdistlodlights = LODLightsCheckBox.Checked; diff --git a/CodeWalker/WorldForm.resx b/CodeWalker/WorldForm.resx index 70dd9c9..1ea334c 100644 --- a/CodeWalker/WorldForm.resx +++ b/CodeWalker/WorldForm.resx @@ -240,6 +240,14 @@ ufo YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB4SURBVDhP3ZC7DcAgDEQZKTMwHOvSIFriS7BlEB+HMic9 QJbvFThLUkpXzjkSpaeuzMPlEELx3jdsBauyCHBY6UWYPQI93KEljQD3jL6EGzN6x0bASyNYwkKU8Udm gd6TMnIikDJyIqjVNz8T7FgKrAwFX6lVinM3aJ05lWDPRRcAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB0SURBVDhP7ZNBCoAgEEXnSJ3BqxmetNpaMLhVv5DNRJS2 + CxIeuvA9XSjtg5mHEILPxB6U7JyLxphmSkDK1o5x9dst87SUfTXwRsYsA+paT0BGDGsVOJ92hdz3Bz4f + wGPC48uu7w5IGd+gBlpRMgYCnRwyESUj3CsQkYNFDwAAAABJRU5ErkJggg== @@ -261,12 +269,13 @@ ufo WBXYx9R1nV75RuyHKrrnzCcGjE1u9ZyD4BugoZigQ9xrngAAAABJRU5ErkJggg== - + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB0SURBVDhP7ZNBCoAgEEXnSJ3BqxmetNpaMLhVv5DNRJS2 - CxIeuvA9XSjtg5mHEILPxB6U7JyLxphmSkDK1o5x9dst87SUfTXwRsYsA+paT0BGDGsVOJ92hdz3Bz4f - wGPC48uu7w5IGd+gBlpRMgYCnRwyESUj3CsQkYNFDwAAAABJRU5ErkJggg== + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACtSURBVDhPrZBBEsIgEAR5Gy/wFV55T/wHr+KgHuCKNsVY + ZI2JiU7VVIVlp7OL+1mllIr7cb8Ie++PQwQYITnnM24NWxoBgsQYm/l+gk699bMsRA4h1JTSPsg0Xert + em/mGwh3vW1Z7MvIABSWqXG3+iZHAEw1m4wD49oVANgVOL/VeSgeDAiX1mpWeKy9BIQiI+OxWQF77tG5 + 2Fc729BmeElf/3lNhORe+oecewDObEqX49RqCgAAAABJRU5ErkJggg== @@ -295,15 +304,6 @@ ufo EcMw2DzPDMEke9AsYBrHs10vN4I1QqImwwDcFyMjQGaBHr5Bo8nEoYCnCQTGzVeI4oj6fIi+KHgoPBhC 4knCjTww9vxfbIUQNDEyiGIZ8t6tW/k0vC/AOpuiueNOLwVkUeylvju9FJCg8E1vM/2PlTv5UoervVTJ uQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACtSURBVDhPrZBBEsIgEAR5Gy/wFV55T/wHr+KgHuCKNsVY - ZI2JiU7VVIVlp7OL+1mllIr7cb8Ie++PQwQYITnnM24NWxoBgsQYm/l+gk699bMsRA4h1JTSPsg0Xert - em/mGwh3vW1Z7MvIABSWqXG3+iZHAEw1m4wD49oVANgVOL/VeSgeDAiX1mpWeKy9BIQiI+OxWQF77tG5 - 2Fc729BmeElf/3lNhORe+oecewDObEqX49RqCgAAAABJRU5ErkJggg== @@ -389,6 +389,17 @@ ufo 4BJN+IjGo5O8ZJndGVhKxpjWWts551aih0fre+0BLaVchRAezPB2NXSSV/gVwXGYPJiVUt6ns1ghCDjn UQG86w3FToVgDcWCWS9Fvi/Ao0RVAcwUjwpyhzmf4n8BFApS5HZRwRuONGMbrIJ1JIN8O2QAAAAASUVO RK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEvSURBVDhP3dK/K0dRGMfxKxRJopCSEkLya/guUhQRmQwG + WfwIkYySgYUSKUKJlOK/MBoMFMofYLUIsfJ+f3NuF3+A8tRree5zP/fcc070f6oHT/jAPTqQj6WvXvCM + TZQgG3H58gFGcYVLtGIN15jBNDbwiGNUIg4pQx8GsQuHhrCDW8yjHyns4Q0DcCXpykM5bFzgHGPYxw1G + UIVMtMHfWUUj4nIg/KurGIYrSAZYOXDGlbhXcZlegUO8Yxzb+BlQAwNW0G0jVAYK0AwHtnCEOyQDZvGC + ObTbKIIvLMA9WIYDizhFMsDjfsAZptCA9JcdfoVBvryOSbgCe4HPTuCz+BQMKEUvJmCy96ET1ehCuAf2 + 5ZF+uwdZKEYtmuBGFSIXhtejBe5PHX7dxL+qKPoEppRHcXOtiDsAAAAASUVORK5CYII= @@ -424,17 +435,6 @@ ufo rp3fhGJScIRLzKMLFTC9cMIu3nCDVUyjB6WkYA93mEWbAyH9cMImPuA+rWMA31YwBU82kF6BS32Er/aO M8zAh+OEghpcwQ2bg3uwBW8ewFd7xQkm0IA4oaAS7bh2KHjBIZbhV/D6GJkFphrdcIP8lFrAGPwPOjCO QdQiTqrAWNICd7gPnUj+xBKaU9dxfhTkjwV/FxU+AbsiGnc46OYIAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEvSURBVDhP3dK/K0dRGMfxKxRJopCSEkLya/guUhQRmQwG - WfwIkYySgYUSKUKJlOK/MBoMFMofYLUIsfJ+f3NuF3+A8tRree5zP/fcc070f6oHT/jAPTqQj6WvXvCM - TZQgG3H58gFGcYVLtGIN15jBNDbwiGNUIg4pQx8GsQuHhrCDW8yjHyns4Q0DcCXpykM5bFzgHGPYxw1G - UIVMtMHfWUUj4nIg/KurGIYrSAZYOXDGlbhXcZlegUO8Yxzb+BlQAwNW0G0jVAYK0AwHtnCEOyQDZvGC - ObTbKIIvLMA9WIYDizhFMsDjfsAZptCA9JcdfoVBvryOSbgCe4HPTuCz+BQMKEUvJmCy96ET1ehCuAf2 - 5ZF+uwdZKEYtmuBGFSIXhtejBe5PHX7dxL+qKPoEppRHcXOtiDsAAAAASUVORK5CYII= diff --git a/Shaders/LightPS.cso b/Shaders/LightPS.cso index 2447c69..0f0d80f 100644 Binary files a/Shaders/LightPS.cso and b/Shaders/LightPS.cso differ diff --git a/Shaders/LightPS_MS.cso b/Shaders/LightPS_MS.cso index b92bab2..1987339 100644 Binary files a/Shaders/LightPS_MS.cso and b/Shaders/LightPS_MS.cso differ diff --git a/Shaders/LodLightsPS.cso b/Shaders/LodLightsPS.cso index 2f0441f..257f251 100644 Binary files a/Shaders/LodLightsPS.cso and b/Shaders/LodLightsPS.cso differ diff --git a/Shaders/LodLightsPS_MS.cso b/Shaders/LodLightsPS_MS.cso index fc275ed..9944ef6 100644 Binary files a/Shaders/LodLightsPS_MS.cso and b/Shaders/LodLightsPS_MS.cso differ