Skip to content

Commit

Permalink
Added local post processing volumes with transitions, added parallel …
Browse files Browse the repository at this point in the history
…scripts and order of execution.
  • Loading branch information
JunaMeinhold committed May 8, 2024
1 parent 7c19451 commit b0f6ce5
Show file tree
Hide file tree
Showing 40 changed files with 1,542 additions and 220 deletions.
2 changes: 1 addition & 1 deletion HexaEngine.Core/Graphics/Texture2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public static Texture2D LoadFromAssets(AssetRef assetRef, TextureDimension force
/// </summary>
/// <param name="description">The <see cref="TextureFileDescription"/> used to create the texture.</param>
/// <returns>A task that represents the asynchronous operation and contains the created <see cref="Texture2D"/>.</returns>
[Obsolete("")]
[Obsolete("For legacy code, don't use.")]
public static Task<Texture2D> CreateTextureAsync(TextureFileDescription description)
{
return Task.Factory.StartNew((object state) =>
Expand Down
2 changes: 1 addition & 1 deletion HexaEngine.Core/IO/Binary/Terrains/TerrainLayerGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void RemoveAt(int index)
return;
}

Array.Copy(layers, index + 1, layers, index, count - index);
Array.Copy(layers, index + 1, layers, index, count - index - 1);
count--;
return;
}
Expand Down
36 changes: 34 additions & 2 deletions HexaEngine.Editor/Editors/VolumeObjectEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using HexaEngine.PostFx;
using HexaEngine.Volumes;
using System;
using System.Numerics;
using System.Reflection;

public class VolumeObjectEditor : IObjectEditor
Expand Down Expand Up @@ -70,13 +71,44 @@ public unsafe bool Draw(IGraphicsContext context)
switch (shape)
{
case VolumeShape.Box:

Vector3 min = volume.BoundingBox.Min;
Vector3 max = volume.BoundingBox.Max;
if (ImGui.InputFloat3("Min", ref min))
{
volume.BoundingBox = new(min, max);
}
if (ImGui.InputFloat3("Max", ref max))
{
volume.BoundingBox = new(min, max);
}
break;

case VolumeShape.Sphere:
Vector3 center = volume.BoundingSphere.Center;
float radius = volume.BoundingSphere.Radius;
if (ImGui.InputFloat3("Center", ref center))
{
volume.BoundingSphere = new(center, radius);
}
if (ImGui.InputFloat("Radius", ref radius))
{
volume.BoundingSphere = new(center, radius);
}
break;
}

VolumeTransitionMode transitionMode = volume.TransitionMode;
if (ComboEnumHelper<VolumeTransitionMode>.Combo("Transition Mode", ref transitionMode))
{
volume.TransitionMode = transitionMode;
}

int transitionDuration = volume.TransitionDuration;
if (ImGui.InputInt("Transition Duration", ref transitionDuration))
{
volume.TransitionDuration = transitionDuration;
}

ImGui.TableNextRow();
ImGui.TableSetColumnIndex(0);

Expand Down Expand Up @@ -179,7 +211,7 @@ private static void DrawEnable(int id, IPostFx effect, PostFxProxy proxy, bool i

if ((effect.Flags & (PostFxFlags.AlwaysEnabled | PostFxFlags.Optional)) == 0)
{
bool enabled = effect.Enabled;
bool enabled = proxy.Enabled;
if (ImGui.Checkbox($"{effect.DisplayName.Id}Enable", ref enabled))
{
effect.Enabled = enabled;
Expand Down
9 changes: 2 additions & 7 deletions HexaEngine.Editor/Widgets/InputManagerWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ private void OnKeyDown(object? sender, Core.Input.Events.KeyboardEventArgs e)

private void Load()
{
if (Platform.AppConfig == null || !Platform.AppConfig.Variables.TryGetValue("InputMap", out var xml))
if (Platform.AppConfig == null)
{
return;
}

inputMap = InputMap.LoadFromText(xml);
inputMap = Platform.AppConfig.InputMap;
}

private void Save()
Expand All @@ -113,7 +113,6 @@ private void Save()
return;
}

Platform.AppConfig.Variables["InputMap"] = inputMap.SaveAsText();
Platform.AppConfig.Save();
}

Expand Down Expand Up @@ -185,10 +184,6 @@ public override unsafe void DrawContent(IGraphicsContext context)
return;
}

{
// AxisContextMenu(axisName, currentAxis);
}

ImGui.SeparatorText("Bindings");

ImGui.BeginTable("##Table", 2, ImGuiTableFlags.SizingFixedFit);
Expand Down
4 changes: 0 additions & 4 deletions HexaEngine.Editor/Widgets/ScriptBehaviorWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
{
using HexaEngine.Core.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class ScriptBehaviorWidget : EditorWindow
{
Expand Down
Loading

0 comments on commit b0f6ce5

Please sign in to comment.