Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/effekseer/Effekseer
Browse files Browse the repository at this point in the history
# Conflicts:
#	Dev/Editor/EffekseerCore/Data/IO.cs
  • Loading branch information
durswd committed Mar 15, 2020
2 parents 7079d88 + 31873d7 commit f3e19cc
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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
};
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
9 changes: 4 additions & 5 deletions Dev/Cpp/Viewer/Graphics/Platform/GL/efk.PostEffectsGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
)";
Expand Down
40 changes: 25 additions & 15 deletions Dev/Editor/Effekseer/GUI/Dock/Dynamic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,22 @@ 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)
{
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();
}
Expand All @@ -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";
}
}
}
}
Expand Down
23 changes: 17 additions & 6 deletions Dev/Editor/EffekseerCore/Data/Dynamic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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<DynamicEquation>(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);
Expand All @@ -164,6 +167,7 @@ public bool Add()
() =>
{
values = old_value;
selected = old_selected;
if (OnChanged != null)
{
OnChanged(this, null);
Expand All @@ -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<DynamicEquation>(values);
new_value.Remove(o);
Expand All @@ -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);
Expand All @@ -196,6 +206,7 @@ public bool Delete(DynamicEquation o)
() =>
{
values = old_value;
selected = o;
if (OnChanged != null)
{
OnChanged(this, null);
Expand Down
10 changes: 7 additions & 3 deletions Dev/Editor/EffekseerCore/Data/IO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Binary file added Release/Sample/00_Basic/Emissive.efkmat
Binary file not shown.
Binary file added Release/Sample/00_Basic/Material/Emissive.efkmat
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit f3e19cc

Please sign in to comment.