Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
seto77 committed May 11, 2020
1 parent 6542ee1 commit ed1a863
Show file tree
Hide file tree
Showing 19 changed files with 375 additions and 244 deletions.
12 changes: 6 additions & 6 deletions Crystallography.Controls/Crystal/BondControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ public BondInputControl()
table = dataSet.DataTableBond;
}

#region Bondsクラスを画面下部 から生成 / にセット
#region Bondsクラスを画面下部 から生成 / にセット. 表示の単位は Å だが、中身は nm 単位.
public Bonds GetFromInterface()
{
if (ElementList.Length < 1 || comboBoxBondingAtom1.Text == "" || comboBoxBondingAtom2.Text == "")
return null;
else
return new Bonds(
true, ElementList, comboBoxBondingAtom1.Text, comboBoxBondingAtom2.Text,
numericBoxBondMinLength.Value, numericBoxBondMaxLength.Value,
checkBoxShowBonds.Checked, numericBoxBondRadius.Value, numericBoxBondAlpha.Value,
numericBoxBondMinLength.Value / 10.0, numericBoxBondMaxLength.Value / 10.0,
checkBoxShowBonds.Checked, numericBoxBondRadius.Value / 10.0, numericBoxBondAlpha.Value,
checkBoxShowPolyhedron.Checked, checkBoxShowCenterAtom.Checked, checkBoxShowVertexAtoms.Checked,
checkBoxShowInnerBonds.Checked, numericBoxPolyhedronAlpha.Value,
checkBoxShowEdges.Checked,numericBoxEdgeWidth.Value);
Expand All @@ -67,9 +67,9 @@ public void SetToInterface(Bonds b)
checkBoxShowBonds.Checked = b.ShowBond;
comboBoxBondingAtom1.Text = b.Element1;
comboBoxBondingAtom2.Text = b.Element2;
numericBoxBondMinLength.Value = b.MinLength;
numericBoxBondMaxLength.Value = b.MaxLength;
numericBoxBondRadius.Value = b.Radius;
numericBoxBondMinLength.Value = b.MinLength * 10;
numericBoxBondMaxLength.Value = b.MaxLength * 10;
numericBoxBondRadius.Value = b.Radius * 10;
numericBoxBondAlpha.Value = b.BondTransParency;
colorControlBond.Color = Color.FromArgb(b.ArgbBond);
numericBoxPolyhedronAlpha.Value = b.PolyhedronTransParency;
Expand Down
3 changes: 2 additions & 1 deletion Crystallography.Controls/Crystal/BoundControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public BoundControl()
}

#region Boundを画面下部から生成 / Boundを画面下部にセット
public Bound GetFromInterface() => new Bound(true, Crystal, index.H, index.K, index.L, equivalency, numericBoxDistance.Value/10, colorControl.Argb);
public Bound GetFromInterface()
=> new Bound(true, Crystal, index.H, index.K, index.L, equivalency, numericBoxDistance.Value / 10, colorControl.Argb);

public void SetToInterface(Bound b)
{
Expand Down
76 changes: 38 additions & 38 deletions Crystallography.Controls/Crystal/CrystalControl.resx

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Crystallography.Controls/DataSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ private DataTableBondRow createRow(Bonds bonds)
dr[EnabledColumn] = bonds.Enabled;
dr[CenterColumn] = bonds.Element1;
dr[VertexColumn] = bonds.Element2;
dr[_Max_len_Column] = bonds.MaxLength;
dr[_Min_len_Column] = bonds.MinLength;
dr[_Max_len_Column] = (bonds.MaxLength * 10.0).ToString("f4");//表示はÅ単位
dr[_Min_len_Column] = (bonds.MinLength * 10.0).ToString("f4");//表示はÅ単位
//dr[Bond_colorColumn] = ColorImage(bonds.ArgbBond);
//dr[Polyhedron_colorColumn] = ColorImage(bonds.ArgbPolyhedron);
dr[Show_bondsColumn] = bonds.ShowBond;
Expand Down
4 changes: 2 additions & 2 deletions Crystallography.Controls/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2020.5.10.1057")]
[assembly: AssemblyFileVersion("2020.5.10.1057")]
[assembly: AssemblyVersion("2020.5.11.1632")]
[assembly: AssemblyFileVersion("2020.5.11.1632")]
10 changes: 4 additions & 6 deletions Crystallography.OpenGL/GLControlAlpha.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ public string VersionStr
/// <summary>
/// Z-sortのために最低必要なOpenGLのバージョン (3桁整数, 330など)
/// </summary>
public int VersionForZsort { get; } = 330;
public int VersionForZsort { get; } = 150;
/// <summary>
/// Z-sortのために最低必要なOpenGLのバージョン (文字列, 3.3.0など)
/// </summary>
public string VersionForZsortStr { get => "3.3.0"; }
public string VersionForZsortStr { get => "1.5.0"; }

/// <summary>
/// Z-sortのために最低必要なOpenGLのバージョン (3桁整数, 330など)
Expand Down Expand Up @@ -457,7 +457,7 @@ private void SetGLcontrol(bool renewControl)

Controls.Clear();
// glControlのコンストラクタで、GraphicsModeを指定する必要があるが、これをするとデザイナが壊れるので、ここに書く。
var gMode = new GraphicsMode(GraphicsMode.Default.ColorFormat, GraphicsMode.Default.Depth, 8, fragShader == FragShaders.ZSORT ? 1 : 0);
var gMode = new GraphicsMode(GraphicsMode.Default.ColorFormat,24 /*GraphicsMode.Default.Depth*/, 8, fragShader == FragShaders.ZSORT ? 1 : 0);
glControl = new GLControl(gMode)
{
AutoScaleMode = AutoScaleMode.Dpi,
Expand Down Expand Up @@ -733,8 +733,6 @@ public void Render()

if (FragShader == FragShaders.OIT)//oitモードの時
{


var bgcolor = BackgroundColor.ToV4f();
GL.Uniform4(GL.GetUniformLocation(Program, "BgColor"), ref bgcolor);

Expand All @@ -758,7 +756,7 @@ public void Render()
GL.UniformMatrix4(viewMatrixIndex, false, ref m4id);
GL.UniformMatrix4(projMatrixIndex, false, ref m4id);
GL.UniformMatrix4(worldMatrixIndex, false, ref m4id);
quad.Generate(Program, false);//理由はよく分からんが、Generateしておかないと、うまく描画できないことが多い
quad?.Generate(Program, false);//理由はよく分からんが、Generateしておかないと、うまく描画できないことが多い
quad?.Render(null);// Draw a screen filler
}
else//Zsortモードの時
Expand Down
4 changes: 2 additions & 2 deletions Crystallography.OpenGL/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます
// 以下のように '*' を使用します:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2020.5.10.1057")]
[assembly: AssemblyFileVersion("2020.5.10.1057")]
[assembly: AssemblyVersion("2020.5.11.1632")]
[assembly: AssemblyFileVersion("2020.5.11.1632")]
2 changes: 1 addition & 1 deletion Crystallography.OpenGL/Shaders/fragOIT.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ layout(binding = 0, std430) buffer linkedLists {
NodeType nodes[];
};

layout(location = 0) out vec4 FragColor;
/*layout(location = 0) */out vec4 FragColor;

subroutine void RenderPassType();
subroutine uniform RenderPassType RenderPass;
Expand Down
4 changes: 2 additions & 2 deletions Crystallography.OpenGL/Shaders/fragZSORT.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#version 330 core
#version 150 core

//#pragma optionNV(ifcvt none)
//#pragma optionNV(inline all)
Expand Down Expand Up @@ -32,7 +32,7 @@ in VertexData
float Z;//Depth
} fs_in;

layout(location = 0) out vec4 FragColor;
/*layout(location = 0) */out vec4 FragColor;

void main()
{
Expand Down
8 changes: 4 additions & 4 deletions Crystallography.OpenGL/Shaders/vert.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#version 330 core
#version 150 core

//#pragma optionNV(ifcvt none)
//#pragma optionNV(inline all)
//#pragma optionNV(strict on)
//#pragma optionNV(unroll all)

// Per-vertex inputs
layout(location = 2) in vec4 Position;
layout(location = 3) in vec3 Normal;
layout(location = 4) in vec4 Color;
/*layout(location = 2) */in vec4 Position;
/*layout(location = 3) */in vec3 Normal;
/*layout(location = 4) */in vec4 Color;

uniform mat4 WorldMatrix; //world matrix
uniform mat4 ViewMatrix; // view matrix
Expand Down
18 changes: 13 additions & 5 deletions Crystallography/BondsAndPolyhedra.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ public class Bonds
[Key(1)]
public string Element2;
[Key(2)]
public float MinLength;
public float MinLength;//nm単位
[Key(3)]
public float MaxLength;
public float MaxLength;//nm単位
[Key(4)]
public float Radius;
public float Radius;//nm単位
[Key(5)]
public float BondTransParency;
[Key(6)]
Expand All @@ -43,14 +43,20 @@ public class Bonds
[Key(15)]
public int ArgbEdge;

public string[] ElementList;

[Key(16)]
public bool Enabled = true;
[Key(17)]
public bool ShowBond = true;
[Key(18)]
public bool UseFixedColor = false;


public string[] ElementList;

//2020/05/11追加 (標準の単位をnmに変更したための対処)
public bool NanometerUnit = false;


[XmlIgnore]
//[ProtoIgnore]
[IgnoreMember]
Expand Down Expand Up @@ -91,6 +97,8 @@ public Bonds(bool enabled,
EdgeLineWidth = edgeLineWidth;

UseFixedColor = false;

NanometerUnit = true;
}

public Bonds(bool enabled,
Expand Down
23 changes: 19 additions & 4 deletions Crystallography/ConvertCrystalData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,31 @@ public static Crystal[] ConvertToCrystalList(string filename)
{
System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(Crystal[]));
cry = (Crystal[])serializer.Deserialize(fs);
//fs.Close();
#region //Bondクラスの単位を オングストロームからnmに変更したための対処
foreach(var c in cry)
{
foreach(var b in c.Bonds)
if(!b.NanometerUnit)
{
b.MaxLength *= 0.1f;
b.MinLength *= 0.1f;
b.Radius *= 0.1f;
b.NanometerUnit = true;
}
}

#endregion


}
}
catch { }
}
else if (filename.EndsWith("out"))//SMAP形式を読み込んだとき
{
List<string> stringList = new List<string>();
var stringList = new List<string>();
string strTemp;
System.IO.StreamReader reader = new System.IO.StreamReader(filename);
var reader = new System.IO.StreamReader(filename);
while ((strTemp = reader.ReadLine()) != null)
stringList.Add(strTemp);
reader.Close();
Expand Down Expand Up @@ -856,7 +871,7 @@ public static void SetOpenGL_property(Crystal c)
if (list2.Contains(e1) && list2.Contains(e2))
{
bonds.Add(new Bonds(true, list, list[list2.IndexOf(e1)], list[list2.IndexOf(e2)],
min, max, true, 0.1, 1, false, true, true, true, 0.7, true, 0));
min / 10.0, max / 10.0, true, 0.01, 1, false, true, true, true, 0.7, true, 0));
}
}
c.Bonds = bonds.ToArray();
Expand Down
4 changes: 2 additions & 2 deletions Crystallography/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
// 下にあるように、'*' を使って、すべての値を指定するか、
// ビルドおよびリビジョン番号を既定値にすることができます。

[assembly: AssemblyVersion("2020.5.10.1057")]
[assembly: AssemblyVersion("2020.5.11.1632")]

//
// アセンブリに署名するには、使用するキーを指定しなければなりません。
Expand Down Expand Up @@ -57,5 +57,5 @@
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
[assembly: ComVisibleAttribute(true)]
[assembly: AssemblyFileVersion("2020.5.10.1057")]
[assembly: AssemblyFileVersion("2020.5.11.1632")]

14 changes: 11 additions & 3 deletions ReciPro/FormMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ed1a863

Please sign in to comment.