diff --git a/Dev/Cpp/Viewer/Graphics/Platform/DX11/Shader/efk.GraphicsDX11.PostFX_Blend_PS.h b/Dev/Cpp/Viewer/Graphics/Platform/DX11/Shader/efk.GraphicsDX11.PostFX_Blend_PS.h index 09a5978e15..b18073b0c8 100644 --- a/Dev/Cpp/Viewer/Graphics/Platform/DX11/Shader/efk.GraphicsDX11.PostFX_Blend_PS.h +++ b/Dev/Cpp/Viewer/Graphics/Platform/DX11/Shader/efk.GraphicsDX11.PostFX_Blend_PS.h @@ -43,30 +43,29 @@ dcl_resource_texture2d (float,float,float,float) t3 dcl_input_ps linear v1.xy dcl_output o0.xyzw dcl_temps 2 -sample r0.xyz, v1.xyxx, t1.xyzw, s0 -mul r0.xyz, r0.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000) -sample r1.xyz, v1.xyxx, t0.xyzw, s0 -mad r0.xyz, r1.xyzx, l(0.250000, 0.250000, 0.250000, 0.000000), r0.xyzx +sample r0.xyz, v1.xyxx, t0.xyzw, s0 +sample r1.xyz, v1.xyxx, t1.xyzw, s0 +add r0.xyz, r0.xyzx, r1.xyzx sample r1.xyz, v1.xyxx, t2.xyzw, s0 add r0.xyz, r0.xyzx, r1.xyzx sample r1.xyz, v1.xyxx, t3.xyzw, s0 -mad o0.xyz, r1.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), r0.xyzx +add o0.xyz, r0.xyzx, r1.xyzx mov o0.w, l(1.000000) ret -// Approximately 10 instruction slots used +// Approximately 9 instruction slots used #endif const BYTE g_PS[] = { - 68, 88, 66, 67, 130, 142, - 8, 212, 33, 142, 21, 7, - 153, 211, 128, 225, 79, 8, - 117, 224, 1, 0, 0, 0, - 52, 4, 0, 0, 5, 0, + 68, 88, 66, 67, 25, 39, + 231, 154, 37, 213, 54, 0, + 117, 245, 139, 140, 54, 73, + 182, 235, 1, 0, 0, 0, + 228, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 96, 1, 0, 0, 184, 1, 0, 0, 236, 1, 0, 0, - 184, 3, 0, 0, 82, 68, + 104, 3, 0, 0, 82, 68, 69, 70, 36, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, @@ -140,9 +139,9 @@ const BYTE g_PS[] = 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 97, 114, 103, 101, 116, 0, 171, 171, - 83, 72, 68, 82, 196, 1, + 83, 72, 68, 82, 116, 1, 0, 0, 65, 0, 0, 0, - 113, 0, 0, 0, 106, 8, + 93, 0, 0, 0, 106, 8, 0, 1, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, @@ -165,29 +164,19 @@ const BYTE g_PS[] = 114, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 69, 0, 0, 9, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 16, 16, 0, + 1, 0, 0, 0, 70, 126, 16, 0, 1, 0, 0, 0, 0, 96, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 10, + 0, 0, 0, 0, 0, 7, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, - 0, 63, 0, 0, 0, 0, - 69, 0, 0, 9, 114, 0, - 16, 0, 1, 0, 0, 0, - 70, 16, 16, 0, 1, 0, - 0, 0, 70, 126, 16, 0, - 0, 0, 0, 0, 0, 96, - 16, 0, 0, 0, 0, 0, - 50, 0, 0, 12, 114, 0, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 1, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 128, 62, 0, 0, - 128, 62, 0, 0, 128, 62, 0, 0, 0, 0, 70, 2, - 16, 0, 0, 0, 0, 0, + 16, 0, 1, 0, 0, 0, 69, 0, 0, 9, 114, 0, 16, 0, 1, 0, 0, 0, 70, 16, 16, 0, 1, 0, @@ -204,38 +193,34 @@ const BYTE g_PS[] = 16, 0, 1, 0, 0, 0, 70, 126, 16, 0, 3, 0, 0, 0, 0, 96, 16, 0, - 0, 0, 0, 0, 50, 0, - 0, 12, 114, 32, 16, 0, - 0, 0, 0, 0, 70, 2, - 16, 0, 1, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 64, 0, 0, 0, 64, - 0, 0, 0, 64, 0, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 54, 0, - 0, 5, 130, 32, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 62, 0, 0, 1, 83, 84, - 65, 84, 116, 0, 0, 0, - 10, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, + 0, 7, 114, 32, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 62, 0, + 0, 1, 83, 84, 65, 84, + 116, 0, 0, 0, 9, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0 + 0, 0, 0, 0, 0, 0 }; diff --git a/Dev/Cpp/Viewer/Graphics/Platform/DX11/Shader/postfx_blend_PS.fx b/Dev/Cpp/Viewer/Graphics/Platform/DX11/Shader/postfx_blend_PS.fx index 5ba13a7431..9f911c649d 100644 --- a/Dev/Cpp/Viewer/Graphics/Platform/DX11/Shader/postfx_blend_PS.fx +++ b/Dev/Cpp/Viewer/Graphics/Platform/DX11/Shader/postfx_blend_PS.fx @@ -13,10 +13,9 @@ struct PS_Input float4 PS( const PS_Input Input ) : SV_Target { - const float4 gain = float4(0.25, 0.5, 1.0, 2.0); - float3 c0 = g_texture0.Sample(g_sampler, Input.UV).rgb * gain.x; - float3 c1 = g_texture1.Sample(g_sampler, Input.UV).rgb * gain.y; - float3 c2 = g_texture2.Sample(g_sampler, Input.UV).rgb * gain.z; - float3 c3 = g_texture3.Sample(g_sampler, Input.UV).rgb * gain.w; + float3 c0 = g_texture0.Sample(g_sampler, Input.UV).rgb; + float3 c1 = g_texture1.Sample(g_sampler, Input.UV).rgb; + float3 c2 = g_texture2.Sample(g_sampler, Input.UV).rgb; + float3 c3 = g_texture3.Sample(g_sampler, Input.UV).rgb; return float4(c0 + c1 + c2 + c3, 1.0); } diff --git a/Dev/Cpp/Viewer/Graphics/Platform/GL/efk.PostEffectsGL.cpp b/Dev/Cpp/Viewer/Graphics/Platform/GL/efk.PostEffectsGL.cpp index 6c852c1df9..0b9ca55c51 100644 --- a/Dev/Cpp/Viewer/Graphics/Platform/GL/efk.PostEffectsGL.cpp +++ b/Dev/Cpp/Viewer/Graphics/Platform/GL/efk.PostEffectsGL.cpp @@ -74,12 +74,11 @@ uniform sampler2D u_Texture0; uniform sampler2D u_Texture1; uniform sampler2D u_Texture2; uniform sampler2D u_Texture3; -const vec4 gain = vec4(0.25, 0.5, 1.0, 2.0); void main() { - vec3 c0 = TEX2D(u_Texture0, v_TexCoord).rgb * gain.x; - vec3 c1 = TEX2D(u_Texture1, v_TexCoord).rgb * gain.y; - vec3 c2 = TEX2D(u_Texture2, v_TexCoord).rgb * gain.z; - vec3 c3 = TEX2D(u_Texture3, v_TexCoord).rgb * gain.w; + vec3 c0 = TEX2D(u_Texture0, v_TexCoord).rgb; + vec3 c1 = TEX2D(u_Texture1, v_TexCoord).rgb; + vec3 c2 = TEX2D(u_Texture2, v_TexCoord).rgb; + vec3 c3 = TEX2D(u_Texture3, v_TexCoord).rgb; FRAGCOLOR = vec4(c0 + c1 + c2 + c3, 1.0); } )"; diff --git a/Dev/Editor/Effekseer/GUI/Dock/Dynamic.cs b/Dev/Editor/Effekseer/GUI/Dock/Dynamic.cs index e5b5a84357..a0a4871863 100644 --- a/Dev/Editor/Effekseer/GUI/Dock/Dynamic.cs +++ b/Dev/Editor/Effekseer/GUI/Dock/Dynamic.cs @@ -81,6 +81,10 @@ protected override void UpdateInternal() Manager.NativeManager.Text(Resources.GetString("DynamicEquation")); + float width = Manager.NativeManager.GetContentRegionAvail().X; + + Manager.NativeManager.PushItemWidth(width - Manager.NativeManager.GetTextLineHeight() * 5.5f); + var nextParam = Component.DynamicSelector.Select("", "", Core.Dynamic.Equations.Selected, false, true); if (Core.Dynamic.Equations.Selected != nextParam) @@ -88,7 +92,11 @@ protected override void UpdateInternal() Core.Dynamic.Equations.Selected = nextParam; } - if(Manager.NativeManager.Button(Resources.GetString("DynamicAdd") + "###DynamicAdd")) + Manager.NativeManager.PopItemWidth(); + + Manager.NativeManager.SameLine(); + + if (Manager.NativeManager.Button(Resources.GetString("DynamicAdd") + "###DynamicAdd")) { Core.Dynamic.Equations.Add(); } @@ -98,27 +106,29 @@ protected override void UpdateInternal() if (Manager.NativeManager.Button(Resources.GetString("DynamicDelete") + "###DynamicDelete")) { Core.Dynamic.Equations.Delete(Core.Dynamic.Equations.Selected); - Core.Dynamic.Equations.Selected = null; } paramerterList.Update(); - // TODO make good GUI - if (Manager.NativeManager.Button(Resources.GetString("Compile") + "###DynamicCompile")) + if (Core.Dynamic.Equations.Selected != null) { - var selected = Core.Dynamic.Equations.Selected; - if(selected != null) + // TODO make good GUI + if (Manager.NativeManager.Button(Resources.GetString("Compile") + "###DynamicCompile")) { - var compiler = new InternalScript.Compiler(); - var result = compiler.Compile(selected.Code.Value); - - if(result.Error != null) - { - compileResult = Utils.CompileErrorGenerator.Generate(selected.Code.Value, result.Error); - } - else + var selected = Core.Dynamic.Equations.Selected; + if (selected != null) { - compileResult = "OK"; + var compiler = new InternalScript.Compiler(); + var result = compiler.Compile(selected.Code.Value); + + if (result.Error != null) + { + compileResult = Utils.CompileErrorGenerator.Generate(selected.Code.Value, result.Error); + } + else + { + compileResult = "OK"; + } } } } diff --git a/Dev/Editor/EffekseerCore/Data/Dynamic.cs b/Dev/Editor/EffekseerCore/Data/Dynamic.cs index 6887a7d345..111fad2893 100644 --- a/Dev/Editor/EffekseerCore/Data/Dynamic.cs +++ b/Dev/Editor/EffekseerCore/Data/Dynamic.cs @@ -18,18 +18,16 @@ public DynamicInput() public class DynamicEquation { - public const string DefaultName = "Eq"; - public Value.String Name { get; private set; } public Value.String Code { get; private set; } DynamicEquationCollection parent = null; - public DynamicEquation(string name, DynamicEquationCollection parent) + public DynamicEquation(DynamicEquationCollection parent) { - Name = new Value.String(name); - Code = new Value.String(); + Name = new Value.String(""); + Code = new Value.String(""); Code.IsMultiLine = true; this.parent = parent; } @@ -147,15 +145,20 @@ public bool Add() { if (values.Count >= 16) return false; + var old_selected = selected; var old_value = values; var new_value = new List(values); - new_value.Add(new DynamicEquation(DynamicEquation.DefaultName, this)); + var value = new DynamicEquation(this); + value.Name.SetValue("New Expression"); + value.Code.SetValue("@O.x = @1"); + new_value.Add(value); var cmd = new Command.DelegateCommand( () => { values = new_value; + selected = new_value[new_value.Count - 1]; if (OnChanged != null) { OnChanged(this, null); @@ -164,6 +167,7 @@ public bool Add() () => { values = old_value; + selected = old_selected; if (OnChanged != null) { OnChanged(this, null); @@ -180,6 +184,7 @@ public bool Delete(DynamicEquation o) if (o == null) return false; + var old_index = values.IndexOf(o); var old_value = values; var new_value = new List(values); new_value.Remove(o); @@ -188,6 +193,11 @@ public bool Delete(DynamicEquation o) () => { values = new_value; + + if (old_index < values.Count) selected = new_value[old_index]; + else if (old_index > 0 && values.Count > 0) selected = new_value[old_index - 1]; + else selected = null; + if (OnChanged != null) { OnChanged(this, null); @@ -196,6 +206,7 @@ public bool Delete(DynamicEquation o) () => { values = old_value; + selected = o; if (OnChanged != null) { OnChanged(this, null); diff --git a/Dev/Editor/EffekseerCore/Data/IO.cs b/Dev/Editor/EffekseerCore/Data/IO.cs index 1bea57e2bb..2aa582c770 100644 --- a/Dev/Editor/EffekseerCore/Data/IO.cs +++ b/Dev/Editor/EffekseerCore/Data/IO.cs @@ -304,9 +304,13 @@ public static XmlElement SaveToElement(XmlDocument doc, string element_name, Dat var e = doc.CreateElement(element_name); for (int i = 0; i < collection.Values.Count; i++) { + var name = collection.Values[i].GetType().Name; // a node must be generated - var e_node = SaveToElement(doc, collection.Values[i].GetType().Name, collection.Values[i], true); - e.AppendChild(e_node); + var e_node = SaveToElement(doc, name, collection.Values[i], true); + if (e_node != null) + { + e.AppendChild(e_node); + } } return e; @@ -1046,7 +1050,7 @@ public static void LoadFromElement(XmlElement e, Data.DynamicEquationCollection for (var i = 0; i < e.ChildNodes.Count; i++) { var e_child = e.ChildNodes[i] as XmlElement; - var element = new DynamicEquation(DynamicEquation.DefaultName, collection); + var element = new DynamicEquation(collection); LoadFromElement(e_child, element, isClip); collection.Values.Add(element); } diff --git a/Release/Sample/00_Basic/Emissive.efkmat b/Release/Sample/00_Basic/Emissive.efkmat new file mode 100644 index 0000000000..97ff9f7e72 Binary files /dev/null and b/Release/Sample/00_Basic/Emissive.efkmat differ diff --git a/Release/Sample/00_Basic/Material/Emissive.efkmat b/Release/Sample/00_Basic/Material/Emissive.efkmat new file mode 100644 index 0000000000..95274a89de Binary files /dev/null and b/Release/Sample/00_Basic/Material/Emissive.efkmat differ diff --git a/Release/Sample/00_Basic/Simple_Turbulence_Fireworks.efkefc b/Release/Sample/00_Basic/Simple_Turbulence_Fireworks.efkefc new file mode 100644 index 0000000000..0c2dcb26c6 Binary files /dev/null and b/Release/Sample/00_Basic/Simple_Turbulence_Fireworks.efkefc differ diff --git a/Release/Sample/00_Basic/Simple_Turbulence_Particles.efkefc b/Release/Sample/00_Basic/Simple_Turbulence_Particles.efkefc new file mode 100644 index 0000000000..e326f7a644 Binary files /dev/null and b/Release/Sample/00_Basic/Simple_Turbulence_Particles.efkefc differ