swiss ok, needs more benchmark
This commit is contained in:
+16
-10
@@ -2,8 +2,8 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// file="MatrixTest"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
// AuthorGroup: Nitload
|
||||
// Copyright (c) Nitload. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -25,7 +25,6 @@
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using StgSharp.Mathematics.Memory;
|
||||
using StgSharp.Mathematics.Numeric;
|
||||
using System;
|
||||
@@ -55,12 +54,18 @@ namespace StgSharp
|
||||
unchecked {
|
||||
hlsf = new((nuint)size, 32, size);
|
||||
}
|
||||
Matrix<T> m = Matrix<T>.Create(sideLength, sideLength, MatrixLayout.DenseRectangle, hlsf);
|
||||
MatrixCompute.Fill(m, 1.0f);
|
||||
Matrix<T> n = Matrix<T>.Create(sideLength, sideLength, MatrixLayout.DenseRectangle, hlsf);
|
||||
MatrixCompute.Fill(n, 1.0f);
|
||||
Matrix<T> p = Matrix<T>.Create(sideLength, sideLength, MatrixLayout.DenseRectangle, hlsf);
|
||||
MatrixCompute.Fill(p, 0.0f);
|
||||
Matrix<T> m = Matrix<T>.Create(sideLength, sideLength, MatrixLayout.DenseRectangle,
|
||||
hlsf);
|
||||
|
||||
// MatrixCompute.Fill(m, 1.0f);
|
||||
Matrix<T> n = Matrix<T>.Create(sideLength, sideLength, MatrixLayout.DenseRectangle,
|
||||
hlsf);
|
||||
|
||||
// MatrixCompute.Fill(n, 1.0f);
|
||||
Matrix<T> p = Matrix<T>.Create(sideLength, sideLength, MatrixLayout.DenseRectangle,
|
||||
hlsf);
|
||||
|
||||
// MatrixCompute.Fill(p, 0.0f);
|
||||
|
||||
/*
|
||||
for (int j = 0; j < 20; j++)
|
||||
@@ -73,7 +78,8 @@ namespace StgSharp
|
||||
|
||||
/**/
|
||||
Console.WriteLine("===================================================");
|
||||
MatrixCompute.Mul(n, m, p);
|
||||
|
||||
// MatrixCompute.Mul(n, m, p);
|
||||
/**/
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
using StgSharp.Controls;
|
||||
using StgSharp.Geometries;
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Graphics.OpenGL;
|
||||
@@ -192,6 +191,7 @@ namespace StgSharp
|
||||
GL.Assert(false);
|
||||
}
|
||||
|
||||
/*
|
||||
public void RenderButton(
|
||||
ButtonStatus status,
|
||||
float statusBegin,
|
||||
@@ -200,7 +200,7 @@ namespace StgSharp
|
||||
{
|
||||
provider.UpdateFromImage(i);
|
||||
}
|
||||
|
||||
/**/
|
||||
internal static Vec3 DefaultRotation(
|
||||
TimeSpanProvider provider,
|
||||
out float rotation
|
||||
@@ -208,7 +208,7 @@ namespace StgSharp
|
||||
{
|
||||
rotation = 1.0f / 60;
|
||||
float angle = (float)provider.CurrentSecond * 2;
|
||||
return (new Vec3(Scalar.Cos(angle), Scalar.Sin(angle),
|
||||
return (new Vec3(MathF.Cos(angle), MathF.Sin(angle),
|
||||
0)) * rotation;
|
||||
}
|
||||
|
||||
@@ -222,16 +222,16 @@ namespace StgSharp
|
||||
buffer = new PlainInstancingBuffer<ParticleOnPlain>();
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
float ai = Scalar.Abs(i - 5.0f);
|
||||
float ai = MathF.Abs(i - 5.0f);
|
||||
for (int t = 0; t < 10; t++)
|
||||
{
|
||||
float at = Scalar.Abs(t - 5.0f);
|
||||
float at = MathF.Abs(t - 5.0f);
|
||||
|
||||
ParticleOnPlain p = new ParticleOnPlain(buffer);
|
||||
((IInstancing)p).Coord = new Vec3(
|
||||
(((-5) + i) * 0.2f) + 0.1f, (((-5) + t) * 0.2f) + 0.1f, 0);
|
||||
((IInstancing)p).Scale =
|
||||
Scalar.MinOf(i, t) * 0.15f;
|
||||
float.Min(i, t) * 0.15f;
|
||||
((IInstancing)p).Motion = new GeometryMotion(
|
||||
true, TimeProvider, DefaultRotation);
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 430 core
|
||||
|
||||
in vec3 texCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = texture(tex, texCoord.xy);
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 430 core
|
||||
|
||||
layout(location = 0)in vec3 coord;
|
||||
layout(location = 1)in vec3 tCoord;
|
||||
|
||||
out vec3 texCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(coord.xyz,1.0f);
|
||||
texCoord = tCoord;
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 29 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 40 KiB |
@@ -1,13 +0,0 @@
|
||||
#version 430 core
|
||||
|
||||
in vec3 texCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = texture(tex, texCoord.xy);
|
||||
//fragColor = vec4(0.099f,0.226f,0.335f,0.0f);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0)in vec3 coord;
|
||||
layout(location = 1)in vec3 tCoord;
|
||||
|
||||
out vec3 texCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(coord.xyz,1.0f);
|
||||
texCoord = tCoord;
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#version 330 core
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform vec4 color;
|
||||
uniform sampler2D ourTexture;
|
||||
uniform sampler2D ourTexture2;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 tex1 = texture(ourTexture, TexCoord);
|
||||
vec4 tex2 = texture(ourTexture2,TexCoord);
|
||||
FragColor = mix(tex1 * vec4( color.xyz, 1.0), tex2, 0.2) /* *vec4( TexColor,1.0) /**/;
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec3 aPos;
|
||||
layout(location = 1) in vec3 aColor;
|
||||
layout(location = 2) in vec2 aTextCoord;
|
||||
|
||||
out vec2 TexCoord;
|
||||
|
||||
uniform mat4x4 camera;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
TexCoord = aTextCoord;
|
||||
vec4 temp = vec4(aPos.xyz,1.0);
|
||||
gl_Position = /**/ camera * /**/ temp;
|
||||
}
|
||||
|
||||
//struct
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 460 core
|
||||
|
||||
uniform float time;
|
||||
|
||||
out vec3 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
fragColor = vec3( 0.5f,0.336f,mod( (0.9961f + time),1.0f) );
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
#version 460 core
|
||||
|
||||
|
||||
layout(location = 0) in vec3 singleCoord;
|
||||
layout(location = 1) in vec3 locations;
|
||||
layout(location = 2) in float rotation;
|
||||
layout(location = 3) in float scale;
|
||||
|
||||
uniform mat4x4 Camera;
|
||||
|
||||
void main()
|
||||
{
|
||||
/**/
|
||||
mat4x4 scalingMat = mat4x4
|
||||
(
|
||||
scale,0,0,0,
|
||||
0,scale,0,0,
|
||||
0,0,scale,0,
|
||||
0,0,0,1
|
||||
);
|
||||
/**/
|
||||
/**/
|
||||
|
||||
mat4x4 rotationMat = mat4x4
|
||||
(
|
||||
cos(rotation),-sin(rotation),0,0,
|
||||
sin(rotation),cos(rotation),0,0,
|
||||
0,0,1,0,
|
||||
0,0,0,1
|
||||
);
|
||||
|
||||
/**/
|
||||
|
||||
gl_Position = Camera * ( rotationMat * scalingMat * vec4( singleCoord.xyz , 1) + vec4( locations.xyz , 0));
|
||||
|
||||
}
|
||||
@@ -17,32 +17,5 @@
|
||||
<ProjectReference Include="..\StgSharp.RegularAnalysis\StgSharp.RegularAnalysis.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Shader\awesomeface.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Shader\fbo.frag">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Shader\fbo.vert">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Shader\Image1.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Shader\main.frag">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Shader\main.vert">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Shader\particle.vert">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Shader\particle.frag">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// file="TestSwiss"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
// AuthorGroup: Nitload
|
||||
// Copyright (c) Nitload. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -41,21 +41,23 @@ namespace StgSharp
|
||||
public static void TestSwiss()
|
||||
{
|
||||
SwissTable swiss = SwissTable.Create();
|
||||
for (int i = 0; i < 10000; i++)
|
||||
for (int i = 0; i < 5000; i++)
|
||||
{
|
||||
Console.Write($"Set {i}: ");
|
||||
_ = swiss.TryAddOrSet(i, i * 2, out _);
|
||||
Console.WriteLine($"Set a kvp of ({i},{i * 2})");
|
||||
}
|
||||
Random rand = new Random();
|
||||
for (int i = 0; i < 10000; i++)
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
int key = rand.Next(0, 10000);
|
||||
Console.Write($"Get {i}: ");
|
||||
int key = rand.Next(4000, 5000);
|
||||
if (swiss.TryGet(key, out nint value))
|
||||
{
|
||||
Console.WriteLine($"Get a kvp of ({key},{value})");
|
||||
Console.WriteLine($"Success in get a kvp of ({key},{value})");
|
||||
} else
|
||||
{
|
||||
Console.WriteLine($"Failed to get a kvp of ({key},?)");
|
||||
Console.WriteLine($"Failed to get a kvp of ({key},?)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="Control.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Controlling.UsrActivity;
|
||||
using StgSharp.MVVM;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public partial class ViewMain
|
||||
{
|
||||
|
||||
protected class Control : ViewResponder<ViewMain>
|
||||
{
|
||||
|
||||
public Control( ViewMain view ) : base( view ) { }
|
||||
|
||||
public override void CustomizedInitialize(
|
||||
Func<IClickTrigger, string, Action> keyRegister ) { }
|
||||
|
||||
public override bool ValidateInitializing()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="Design.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Controlling;
|
||||
using StgSharp.Controlling.UsrActivity;
|
||||
using StgSharp.Controls;
|
||||
|
||||
using StgSharp.Geometries;
|
||||
using StgSharp.Graphics;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public partial class ViewMain
|
||||
{
|
||||
|
||||
internal DemoButtonGroup Group { get; set; }
|
||||
|
||||
internal TriggerButton OnlyButton { get; set; }
|
||||
|
||||
internal class Design : ViewDesigner<ViewMain>
|
||||
{
|
||||
|
||||
public Design( ViewMain view ) : base( view ) { }
|
||||
|
||||
public override sealed void CustomizedInitialize()
|
||||
{
|
||||
Binding.Group = CreateKeyboardButtonGroup<DemoButtonGroup>(
|
||||
new KeyTrigger( KeyboardKey.Left, KeyStatus.PRESS ),
|
||||
new KeyTrigger( KeyboardKey.Right, KeyStatus.PRESS ),
|
||||
new KeyTrigger( KeyboardKey.Up, KeyStatus.PRESS ),
|
||||
new KeyTrigger( KeyboardKey.Down, KeyStatus.PRESS ),
|
||||
new KeyTrigger( KeyboardKey.Enter, KeyStatus.PRESS ) );
|
||||
Binding.OnlyButton = CreateKeyboardButton(
|
||||
Binding.Stream.ButtonBounding, Binding.Stream.ButtonTextureProvider, true );
|
||||
Binding.OnlyButton.RenderButtonTexture += Binding.Stream.RenderButton;
|
||||
}
|
||||
|
||||
public override bool ValidateInitializing()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class DemoButtonGroup : KeyboardButtonGroup
|
||||
{
|
||||
|
||||
public override sealed void Confirm()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
// file="NewRender"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Internal;
|
||||
|
||||
using StgSharp.Mathematics;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public partial class ViewMain
|
||||
{
|
||||
|
||||
public ParticleRenderStream Stream { get; set; }
|
||||
|
||||
private class NewRender : ViewRender<ViewMain>
|
||||
{
|
||||
|
||||
public NewRender(ViewMain view) : base(view) { }
|
||||
|
||||
public override void CustomizedInitialize()
|
||||
{
|
||||
Binding.Stream = CreateRenderStream<ParticleRenderStream>();
|
||||
Render["only".AsLabel()] = Binding.Stream;
|
||||
}
|
||||
|
||||
public override bool ValidateInitializing()
|
||||
{
|
||||
return Binding.Stream != null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ViewMain.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.MVVM;
|
||||
using StgSharp.MVVM.ViewModel;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public partial class ViewMain : ViewBase
|
||||
{
|
||||
|
||||
private Dictionary<string, DataBindingEntry> _databindingIndexMap;
|
||||
|
||||
public ViewMain()
|
||||
{
|
||||
_databindingIndexMap = new Dictionary<string, DataBindingEntry>();
|
||||
}
|
||||
|
||||
public override void CustomizedInitialize( [NotNull]ViewModelBase viewModelBinding )
|
||||
{
|
||||
Designer = new Design( this );
|
||||
Responder = new Control( this );
|
||||
Render = new NewRender( this );
|
||||
|
||||
Render.Initialize();
|
||||
Designer.Initialize();
|
||||
Responder.Initialize( viewModelBinding.MethodLookup );
|
||||
}
|
||||
|
||||
public override bool TryGetObjectReference( string name, out DataBindingEntry entry )
|
||||
{
|
||||
if( _databindingIndexMap.TryGetValue( name, out entry ) ) {
|
||||
return true;
|
||||
}
|
||||
try
|
||||
{
|
||||
entry = name switch
|
||||
{
|
||||
_ => default( DataBindingEntry ),
|
||||
};
|
||||
return !entry.ExactEqual( default( DataBindingEntry ) );
|
||||
}
|
||||
catch( Exception )
|
||||
{
|
||||
entry = default( DataBindingEntry );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Show()
|
||||
{
|
||||
Stream.RenderStart();
|
||||
|
||||
//Stream.NothingMain();
|
||||
|
||||
Stream.Main();
|
||||
Stream.ButtonMain( OnlyButton );
|
||||
Stream.RenderEnd();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ViewModelMain.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Graphics;
|
||||
|
||||
using StgSharp.MVVM;
|
||||
using StgSharp.MVVM.ViewModel;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class ViewModelMain : ViewModelBase
|
||||
{
|
||||
|
||||
private Dictionary<string, DataBindingEntry> dataBindingEntryIndexMap;
|
||||
|
||||
public ViewModelMain( ViewPort vp )
|
||||
: base( vp, 60 )
|
||||
{
|
||||
dataBindingEntryIndexMap = new Dictionary<string, DataBindingEntry>();
|
||||
}
|
||||
|
||||
public override void CustomizeInitialize() { }
|
||||
|
||||
public override bool TryGetObjectReference( string name, out DataBindingEntry entry )
|
||||
{
|
||||
if( dataBindingEntryIndexMap.TryGetValue( name, out entry ) ) {
|
||||
return true;
|
||||
}
|
||||
entry = name switch
|
||||
{
|
||||
_ => DataBindingEntry.NullBinding,
|
||||
};
|
||||
|
||||
if( entry.ExactEqual( DataBindingEntry.NullBinding ) ) {
|
||||
return false;
|
||||
}
|
||||
dataBindingEntryIndexMap.Add( name, entry );
|
||||
return true;
|
||||
}
|
||||
|
||||
}//------------------------------------- End of Class ------------------------------------------
|
||||
}
|
||||
Reference in New Issue
Block a user