diff --git a/Crystallography.Controls/Crystal/AtomControl.resx b/Crystallography.Controls/Crystal/AtomControl.resx index 2b6ed0cb..c5db602b 100644 --- a/Crystallography.Controls/Crystal/AtomControl.resx +++ b/Crystallography.Controls/Crystal/AtomControl.resx @@ -247,7 +247,7 @@ numericBoxBiso - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanelIso @@ -307,7 +307,7 @@ numericalTextBoxBisoerr - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanelIso @@ -1009,7 +1009,7 @@ numericalTextBox1 - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanel8 @@ -1108,7 +1108,7 @@ numericalTextBox2 - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanel8 @@ -1258,7 +1258,7 @@ numericalTextBox3 - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanel9 @@ -1357,7 +1357,7 @@ numericalTextBox4 - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanel9 @@ -1502,7 +1502,7 @@ numericalTextBoxOccerr - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tableLayoutPanel1 @@ -1562,7 +1562,7 @@ numericTextBoxOcc - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tableLayoutPanel1 @@ -1622,7 +1622,7 @@ numericTextBoxZ - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tableLayoutPanel1 @@ -1682,7 +1682,7 @@ numericalTextBoxYerr - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tableLayoutPanel1 @@ -1742,7 +1742,7 @@ numericalTextBoxXerr - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tableLayoutPanel1 @@ -1802,7 +1802,7 @@ numericTextBoxY - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tableLayoutPanel1 @@ -1862,7 +1862,7 @@ numericTextBoxX - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tableLayoutPanel1 @@ -1922,7 +1922,7 @@ numericalTextBoxZerr - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tableLayoutPanel1 @@ -2588,7 +2588,7 @@ numericBoxOriginShiftZ - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tabPageOriginShift @@ -2648,7 +2648,7 @@ numericBoxOriginShiftY - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tabPageOriginShift @@ -2708,7 +2708,7 @@ numericBoxOriginShiftX - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tabPageOriginShift @@ -2831,7 +2831,7 @@ numericalTextBoxB22 - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanelAniso2 @@ -2888,7 +2888,7 @@ numericalTextBoxB22err - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanelAniso2 @@ -2945,7 +2945,7 @@ numericalTextBoxB23 - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanelAniso2 @@ -3002,7 +3002,7 @@ numericalTextBoxB23err - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanelAniso2 @@ -3059,7 +3059,7 @@ numericalTextBoxB33 - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanelAniso2 @@ -3116,7 +3116,7 @@ numericalTextBoxB33err - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanelAniso2 @@ -3200,7 +3200,7 @@ numericalTextBoxB11 - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanelAniso1 @@ -3257,7 +3257,7 @@ numericalTextBoxB11err - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanelAniso1 @@ -3314,7 +3314,7 @@ numericalTextBoxB12 - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanelAniso1 @@ -3371,7 +3371,7 @@ numericalTextBoxB12err - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanelAniso1 @@ -3428,7 +3428,7 @@ numericalTextBoxB13 - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanelAniso1 @@ -3485,7 +3485,7 @@ numericalTextBoxB13err - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null flowLayoutPanelAniso1 @@ -3920,7 +3920,7 @@ numericBoxAlpha - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tabPageAppearance @@ -3977,7 +3977,7 @@ numericBoxEmission - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tabPageAppearance @@ -4034,7 +4034,7 @@ numericBoxShininess - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tabPageAppearance @@ -4091,7 +4091,7 @@ numericBoxSpecular - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tabPageAppearance @@ -4148,7 +4148,7 @@ numericBoxDiffusion - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tabPageAppearance @@ -4205,7 +4205,7 @@ numericBoxAmbient - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tabPageAppearance @@ -4262,7 +4262,7 @@ numericBoxAtomRadius - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tabPageAppearance @@ -4514,7 +4514,7 @@ colorControlAtomColor - Crystallography.Controls.ColorControl, Crystallography.Controls, Version=2020.5.6.500, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.ColorControl, Crystallography.Controls, Version=2020.5.6.2316, Culture=neutral, PublicKeyToken=null tabPageAppearance diff --git a/Crystallography.Controls/Crystal/CrystalControl.cs b/Crystallography.Controls/Crystal/CrystalControl.cs index c37d50c4..9da039f8 100644 --- a/Crystallography.Controls/Crystal/CrystalControl.cs +++ b/Crystallography.Controls/Crystal/CrystalControl.cs @@ -185,7 +185,6 @@ private void checkSpecialNumber() } } } - #region Crystalクラスを画面下部 から生成/にセット diff --git a/Crystallography.Controls/Properties/AssemblyInfo.cs b/Crystallography.Controls/Properties/AssemblyInfo.cs index a84f6624..c1b777b7 100644 --- a/Crystallography.Controls/Properties/AssemblyInfo.cs +++ b/Crystallography.Controls/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2020.5.6.0925")] -[assembly: AssemblyFileVersion("2020.5.6.0925")] \ No newline at end of file +[assembly: AssemblyVersion("2020.5.9.1049")] +[assembly: AssemblyFileVersion("2020.5.9.1049")] \ No newline at end of file diff --git a/Crystallography.OpenGL/Crystallography.OpenGL.csproj b/Crystallography.OpenGL/Crystallography.OpenGL.csproj index b8f88f1f..68b7aee8 100644 --- a/Crystallography.OpenGL/Crystallography.OpenGL.csproj +++ b/Crystallography.OpenGL/Crystallography.OpenGL.csproj @@ -78,6 +78,7 @@ + diff --git a/Crystallography.OpenGL/GLControlAlpha.cs b/Crystallography.OpenGL/GLControlAlpha.cs index d8bd1b7d..fb6d0fb8 100644 --- a/Crystallography.OpenGL/GLControlAlpha.cs +++ b/Crystallography.OpenGL/GLControlAlpha.cs @@ -13,6 +13,7 @@ using Vec2d = OpenTK.Vector2d; using Vec3d = OpenTK.Vector3d; using Vec3f = OpenTK.Vector3; +using System.Management; namespace Crystallography.OpenGL { @@ -26,6 +27,7 @@ unsafe public partial class GLControlAlpha : UserControl private Clip Clip = null; private List glObjects = new List(); + private ParallelQuery glObjectsP; private GLObject quad = null; private int eyePositionIndex = 0; @@ -36,6 +38,10 @@ unsafe public partial class GLControlAlpha : UserControl private int passOIT1Index = 0; private int passOIT2Index = 0; private int passNormalIndex = 0; + + private int depthCueingNearIndex = 0; + private int depthCueingFarIndex = 0; + private int depthCueingEnabledIndex = 0; #endregion フィールド #region Enum @@ -46,7 +52,7 @@ public enum RotationModes { Object, View, Light } public enum TranslatingModes { Object, View } - public enum RenderingTransparencyModes { Always, NotAlways, Never } + public enum RenderingTransparencyModes { OIT, ZSORT} #endregion Enum @@ -54,10 +60,10 @@ public enum RenderingTransparencyModes { Always, NotAlways, Never } public new MouseEventHandler MouseMove; public new MouseEventHandler MouseDown; public new MouseEventHandler MouseUp; - + public new PaintEventHandler Paint; - + /// /// WorldMatrixが変化したときに発生するイベント. /// @@ -169,7 +175,7 @@ public string GLVersionCurrent /// Order Independent Transparency modeを有効にするかどうか /// [Category("Rendering properties")] - public RenderingTransparencyModes RenderingTransparency { get; set; } = RenderingTransparencyModes.NotAlways; + public RenderingTransparencyModes RenderingTransparency { get; set; } = RenderingTransparencyModes.ZSORT; /// /// バックグラウンドカラー @@ -235,6 +241,8 @@ public Matrix3D WorldMatrixEx } } + public List<(string Product, string Version)> GraphicsInfo { get; set; } = new List<(string Product, string Version)>(); + /// /// カメラの位置 /// @@ -324,7 +332,6 @@ private void setProjMatrix() #endregion プロパティ #region ロード関連 - private System.Timers.Timer timer = new System.Timers.Timer(100); private GLControl glControl = new GLControl(); private Graphics glControlGraphics; @@ -337,14 +344,17 @@ public GLControlAlpha() if (DesignMode) return; - // glControlのコンストラクタで、GraphicsModeを指定する必要があるが、これをするとデザイナが壊れるので、ここに書く。 - glControl = new OpenTK.GLControl(new GraphicsMode(GraphicsMode.Default.ColorFormat, GraphicsMode.Default.Depth, 8)) + glObjectsP = glObjects.AsParallel(); + + // glControlのコンストラクタで、GraphicsModeを指定する必要があるが、これをするとデザイナが壊れるので、ここに書く。 + var gMode = new GraphicsMode(GraphicsMode.Default.ColorFormat, GraphicsMode.Default.Depth, 8, 1); + glControl = new GLControl(gMode) { AutoScaleMode = AutoScaleMode.Dpi, BackColor = Color.White, Location = new Point(0, 0), Name = "glControl", - Size = new Size(this.Size.Width, this.Size.Height), + Size = new Size(Size.Width, Size.Height), Dock = DockStyle.Fill, TabIndex = 1, VSync = false, @@ -360,7 +370,23 @@ public GLControlAlpha() Controls.Add(glControl); + //ビデオカード検索 + var searcher = new ManagementObjectSearcher(new SelectQuery("Win32_VideoController")); + foreach (var envVar in searcher.Get()) + GraphicsInfo.Add((envVar["name"].ToString(), envVar["DriverVersion"].ToString())); + if (GraphicsInfo.Select(g => g.Product.ToLower()).Any(p => p.Contains("nvidia") || p.Contains("amd"))) + { + Cone.Default = (1, 16); + Pipe.Default = (1, 16); + Sphere.DefaultSlices = 3; + } + else + { + Cone.Default = (1, 8); + Pipe.Default = (1, 8); + Sphere.DefaultSlices = 2; + } } @@ -392,6 +418,10 @@ private void glControl_Load(object sender, EventArgs e) projMatrixIndex = GL.GetUniformLocation(Program, "ProjMatrix"); worldMatrixIndex = GL.GetUniformLocation(Program, "WorldMatrix"); + depthCueingEnabledIndex = GL.GetUniformLocation(Program, "DepthCueing"); + depthCueingFarIndex = GL.GetUniformLocation(Program, "Far"); + depthCueingNearIndex = GL.GetUniformLocation(Program, "Near"); + passOIT1Index = GL.GetSubroutineIndex(Program, ShaderType.FragmentShader, "passOIT1"); passOIT2Index = GL.GetSubroutineIndex(Program, ShaderType.FragmentShader, "passOIT2"); passNormalIndex = GL.GetSubroutineIndex(Program, ShaderType.FragmentShader, "passNormal"); @@ -404,14 +434,8 @@ private void glControl_Load(object sender, EventArgs e) quad = new Quads(new Vec3d(-1, -1, 1), new Vec3d(1, -1, 1), new Vec3d(1, 1, 1), new Vec3d(-1, 1, 1), new Material(1, 1, 1, 1, 1, 1, 1, 1, 1), DrawingMode.Surfaces); quad.Generate(Program); - timer.AutoReset = false; - timer.Elapsed += Timer_Elapsed; - } - - private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) - { - Render(true); - timer.Stop(); + GL.Hint(HintTarget.LineSmoothHint, HintMode.Nicest); + GL.Hint(HintTarget.PolygonSmoothHint, HintMode.Nicest); } #region Shaderの作成 @@ -521,6 +545,14 @@ public void AddObjects(IEnumerable objs) foreach (var obj in objs) obj.Generate(Program); glObjects.AddRange(objs); + + /* foreach (var obj in objs) + { + obj.Indices = null; + obj.Vertices = null; + } + GC.Collect(); + */ } public void DeleteObjects(GLObject obj) @@ -562,26 +594,20 @@ public void SetClip(Clip clip) /// /// レンダリング /// - public void Render(bool oit = false) + public void Render() { if (InvokeRequired)//別スレッドから呼び出されたとき Invokeして呼びなおす { - Invoke(new Action(() => Render(oit)), null); + Invoke(new Action(() => Render()), null); return; } - timer.Stop(); if (SkipRendering || Program < 1) return; - if (RenderingTransparency == RenderingTransparencyModes.Always) - oit = true; - else if (RenderingTransparency == RenderingTransparencyModes.Never) - oit = false; - glControl.MakeCurrent(); - if (glObjects == null || glObjects.Count == 0 || glObjects.All(obj => obj.Rendered == false)) + if (glObjects == null || glObjects.Count == 0 || glObjectsP.All(obj => obj.Rendered == false)) { GL.UniformSubroutines(ShaderType.FragmentShader, 1, ref passNormalIndex); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); @@ -599,8 +625,12 @@ public void Render(bool oit = false) GL.UniformMatrix4(projMatrixIndex, false, ref projMatrixF); GL.UniformMatrix4(worldMatrixIndex, false, ref worldMatrixF); - if (oit)//oitモードの時、 CullFace無効、DepthTest無効、 + if (RenderingTransparency == RenderingTransparencyModes.OIT)//oitモードの時、 CullFace無効、DepthTest無効、 { + GL.Disable(EnableCap.LineSmooth); + GL.Disable(EnableCap.PolygonSmooth); + GL.Disable(EnableCap.Blend); + GL.Disable(EnableCap.CullFace); GL.Disable(EnableCap.DepthTest); var bgcolor = BackgroundColor.ToV4f(); @@ -630,6 +660,11 @@ public void Render(bool oit = false) } else//通常モードの時、 CullFace有効、DepthTest有効 { + GL.Enable(EnableCap.LineSmooth); + GL.Enable(EnableCap.PolygonSmooth); + GL.Enable(EnableCap.Blend); + GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); + GL.Enable(EnableCap.CullFace); GL.CullFace(CullFaceMode.Back); GL.Enable(EnableCap.DepthTest); @@ -638,14 +673,22 @@ public void Render(bool oit = false) GL.UniformSubroutines(ShaderType.FragmentShader, 1, ref passNormalIndex); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.ClearColor(BackgroundColor); + + //描画対称に透明なものが一つでもあるとき + if (glObjectsP.Any(o => o.Rendered && o.Material.ColorV.W != 1)) + { + var rot = worldMatrix.Inverted(); + glObjectsP.ForAll(o => o.Z = !o.Rendered || o.Material.ColorV.W == 1 ? double.NegativeInfinity : rot.Mult(o.CircumscribedSphereCenter).Z); + glObjects.Sort((o1, o2) => o1.Z.CompareTo(o2.Z)); + } + glObjects.ForEach(o => o.Render(Clip));// draw scene } + glControl.SwapBuffers();//swap GL.Finish(); Paint?.Invoke(this, new PaintEventArgs(glControlGraphics, glControl.ClientRectangle)); - - timer.Start(); } #endregion @@ -685,13 +728,7 @@ private void glControl_MouseMove(object sender, MouseEventArgs e) else if (e.Button == MouseButtons.Right && AllowMouseScaling) { if ((ModifierKeys & Keys.Control) == Keys.Control && ProjectionMode == ProjectionModes.Perspective) - { - SkipRendering = true; - viewFrom *= (float)(1 + dy * 0.005); - setViewMatrix(); - SkipRendering = false; - setProjMatrix(); - } + SetPerspectiveDistance(viewFrom.Length * (float)(1 + dy * 0.005)); else { var coeff = 1 + dy * 0.005; @@ -703,6 +740,8 @@ private void glControl_MouseMove(object sender, MouseEventArgs e) lastMousePosition = new Point(e.X, e.Y); } + + private void GlControl_MouseWheel(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.None && AllowMouseScaling) @@ -730,6 +769,16 @@ private void glControl_MouseUp(object sender, MouseEventArgs e) #endregion + public void SetPerspectiveDistance(double distance) + { + SkipRendering = true; + viewFrom = viewFrom.Normalized() * distance; + setViewMatrix(); + SkipRendering = false; + setProjMatrix(); + + } + #region GLControlのイベント private void glControl_Paint(object sender, PaintEventArgs e) @@ -758,6 +807,20 @@ public Bitmap GenerateBitmap() return BitmapConverter.FlipVertically(bmp); } + #endregion + + #region Depth Cueingの設定 + + public void SetDepthCueing(bool enabled, double near, double far) + { + GL.Uniform1(depthCueingEnabledIndex, enabled ? 1 : 0); + GL.Uniform1(depthCueingNearIndex, (float)near); + GL.Uniform1(depthCueingFarIndex, (float)far); + GL.Finish(); + Render(); + } + + #endregion } } \ No newline at end of file diff --git a/Crystallography.OpenGL/GLObject.cs b/Crystallography.OpenGL/GLObject.cs index 4726cbe3..854714f8 100644 --- a/Crystallography.OpenGL/GLObject.cs +++ b/Crystallography.OpenGL/GLObject.cs @@ -130,14 +130,50 @@ public enum DrawingMode { Surfaces = 1, Edges = 2, SurfacesAndEdges = 4, Points /// abstract public class GLObject { + #region static private なフィールド + static internal int EmissionLocation { get; set; } = -1; + + static internal int AmbientLocation { get; set; } = -1; + static internal int DiffuseLocation { get; set; } = -1; + static internal int SpecularLocation { get; set; } = -1; + static internal int SpecularPowerLocation { get; set; } = -1; + + static internal int UseFixedColorLocation { get; set; } = -1; + static internal int FixedColorLocation { get; set; } = -1; + static internal int IgnoreNormalSidesLocation { get; set; } = -1; + static internal int RenderPassLocation { get; set; } = -1; + + static internal int PassOIT1Index { get; set; } = -1; + static internal int PassOIT2Index { get; set; } = -1; + + static internal int PassNormalIndex = -1; + + static internal int PositionLocation { get; set; } = -1; + static internal int NormalLocation { get; set; } = -1; + static internal int ColorLocation { get; set; } = -1; + + + #endregion + + internal int VBO, VAO, EBO; internal int Program = -1; + /// + /// 頂点 + /// internal Vertex[] Vertices; + /// + /// タイプ + /// internal PT[] Types; - internal int[][] Indices; - internal int EmissionLocation = -1, AmbientLocation = -1, DiffuseLocation = -1, SpecularLocation = -1, SpecularPowerLocation = -1; - internal int UseFixedColorLocation = -1, FixedColorLocation = -1, IgnoreNormalSidesLocation = -1, RenderPassLocation = -1; - internal int passOIT1Index = -1, passOIT2Index = -1, passNormalIndex = -1; + /// + /// 頂点の順番リスト (全てのタイプが連結されている) + /// + internal uint[] Indices; + /// + /// 各タイプの順番リストの長さ + /// + internal int[] TypeCounts; #region publicなフィールド @@ -189,12 +225,15 @@ abstract public class GLObject /// /// trueの時は(Vertexの色ではなく)Material構造体中のColorが使われる /// - public bool UseFixedColor = false; + public bool UseFixedColor = true; - #endregion publicなフィールド + /// + /// Z sorting で透明度を計算する時のZを一時期的に格納する変数 + /// + public double Z; + #endregion publicなフィールド - /// /// コンストラクタ /// @@ -231,108 +270,132 @@ public void Generate(int program) GL.BufferData(BufferTarget.ArrayBuffer, new IntPtr(Vertices.Length * Vertex.Stride), Vertices, BufferUsageHint.DynamicDraw); // EBO作成 - var indicesList = new List(); - for (int i = 0; i < Indices.Length; i++) - indicesList.AddRange(Indices[i].ToArray()); - var indices = indicesList.Select(i => (uint)i).ToArray(); GL.GenBuffers(1, out EBO); GL.BindBuffer(BufferTarget.ElementArrayBuffer, EBO); - GL.BufferData(BufferTarget.ElementArrayBuffer, new IntPtr(sizeof(uint) * indices.Length), indices, BufferUsageHint.DynamicDraw); + GL.BufferData(BufferTarget.ElementArrayBuffer, new IntPtr(sizeof(uint) * Indices.Length), Indices, BufferUsageHint.DynamicDraw); // VAO作成 GL.GenVertexArrays(1, out VAO); GL.BindVertexArray(VAO); GL.BindBuffer(BufferTarget.ArrayBuffer, VBO); - var positionLocation = GL.GetAttribLocation(Program, "Position"); - var normalLocation = GL.GetAttribLocation(Program, "Normal"); - var colorLocation = GL.GetAttribLocation(Program, "Color"); - if (positionLocation == -1 || normalLocation == -1 || colorLocation == -1) - throw new Exception("cannot find location!"); + //Locationを取得 + if (EmissionLocation == -1) + SetLocation(program); //頂点位置 - GL.EnableVertexAttribArray(positionLocation); - GL.VertexAttribPointer(positionLocation, 4, VertexAttribPointerType.Float, false, Vertex.Stride, 0); + GL.EnableVertexAttribArray(PositionLocation); + GL.VertexAttribPointer(PositionLocation, 4, VertexAttribPointerType.Float, false, Vertex.Stride, 0); //法線 - GL.EnableVertexAttribArray(normalLocation); - GL.VertexAttribPointer(normalLocation, 3, VertexAttribPointerType.Float, true, Vertex.Stride, V4f.SizeInBytes); + GL.EnableVertexAttribArray(NormalLocation); + GL.VertexAttribPointer(NormalLocation, 3, VertexAttribPointerType.Float, true, Vertex.Stride, V4f.SizeInBytes); //色 - GL.EnableVertexAttribArray(colorLocation); - GL.VertexAttribPointer(colorLocation, 4, VertexAttribPointerType.Float, false, Vertex.Stride, V4f.SizeInBytes + V3f.SizeInBytes); + GL.EnableVertexAttribArray(ColorLocation); + GL.VertexAttribPointer(ColorLocation, 4, VertexAttribPointerType.Float, false, Vertex.Stride, V4f.SizeInBytes + V3f.SizeInBytes); + + } + + /// + /// パラメータのロケーションをセット + /// + /// + public void SetLocation(int Program) + { + PositionLocation = GL.GetAttribLocation(Program, "Position"); + NormalLocation = GL.GetAttribLocation(Program, "Normal"); + ColorLocation = GL.GetAttribLocation(Program, "Color"); + if (PositionLocation == -1 || NormalLocation == -1 || ColorLocation == -1) + throw new Exception("cannot find location!"); - //インデックスを取得 EmissionLocation = GL.GetUniformLocation(Program, "Emission"); AmbientLocation = GL.GetUniformLocation(Program, "Ambient"); DiffuseLocation = GL.GetUniformLocation(Program, "Diffuse"); SpecularLocation = GL.GetUniformLocation(Program, "Specular"); SpecularPowerLocation = GL.GetUniformLocation(Program, "SpecularPower"); - UseFixedColorLocation = GL.GetUniformLocation(program, "UseFixedColor"); - IgnoreNormalSidesLocation = GL.GetUniformLocation(program, "IgnoreNormalSides"); - FixedColorLocation = GL.GetUniformLocation(program, "FixedColor"); - passOIT1Index = GL.GetSubroutineIndex(Program, ShaderType.FragmentShader, "passOIT1"); - passOIT2Index = GL.GetSubroutineIndex(Program, ShaderType.FragmentShader, "passOIT2"); - passNormalIndex = GL.GetSubroutineIndex(Program, ShaderType.FragmentShader, "passNormal"); + UseFixedColorLocation = GL.GetUniformLocation(Program, "UseFixedColor"); + IgnoreNormalSidesLocation = GL.GetUniformLocation(Program, "IgnoreNormalSides"); + FixedColorLocation = GL.GetUniformLocation(Program, "FixedColor"); + + PassOIT1Index = GL.GetSubroutineIndex(Program, ShaderType.FragmentShader, "passOIT1"); + PassOIT2Index = GL.GetSubroutineIndex(Program, ShaderType.FragmentShader, "passOIT2"); + PassNormalIndex = GL.GetSubroutineIndex(Program, ShaderType.FragmentShader, "passNormal"); RenderPassLocation = GL.GetSubroutineUniformLocation(Program, ShaderType.FragmentShader, "RenderPass"); } - /// - /// 物体の材質をGPUに送信する。Render()関数から呼び出される。 - /// - /// Surfaceモードか否か - private void SetMatetrial(bool drawSurfaces) - { - GL.Uniform1(EmissionLocation, drawSurfaces ? Material.Emission : 0); - GL.Uniform1(AmbientLocation, drawSurfaces ? Material.Ambient : 1); - GL.Uniform1(DiffuseLocation, drawSurfaces ? Material.Diffuse : 0); - GL.Uniform1(SpecularLocation, drawSurfaces ? Material.Specular : 0); - GL.Uniform1(SpecularPowerLocation, Material.SpecularPower); - GL.Uniform1(IgnoreNormalSidesLocation, IgnoreNormalSides ? 1 : 0);//true - - if (UseFixedColor) - { - GL.Uniform1(UseFixedColorLocation, 1);//true - GL.Uniform4(FixedColorLocation, ref Material.ColorV); - } - else - GL.Uniform1(UseFixedColorLocation, 0); - } - - /// /// レンダリングを実行. Progaramが正しくセットされていない(Generate()をしていない)場合は例外が発生 /// private void Render() { GL.BindVertexArray(VAO); GL.BindBuffer(BufferTarget.ElementArrayBuffer, EBO); - int offset = 0; - for (int i = 0; i < Types.Length; i++) + for (int i = 0, offset = 0; i < Types.Length; i++) { - if ((Types[i] == PT.Triangles || Types[i] == PT.TriangleStrip || Types[i] == PT.TriangleFan || Types[i] == PT.Quads) && (Mode == DrawingMode.Surfaces || Mode == DrawingMode.SurfacesAndEdges)) - SetMaterialAndDrawElements(true, Types[i], Indices[i].Length, offset); + var t = Types[i]; + var len = TypeCounts[i]; + if ((t == PT.Triangles || t == PT.TriangleStrip || t == PT.TriangleFan || t== PT.Quads) + && (Mode == DrawingMode.Surfaces || Mode == DrawingMode.SurfacesAndEdges)) + SetMaterialAndDrawElements(true, t, len, offset); else { - if ((Types[i] == PT.Lines || Types[i] == PT.LinesAdjacency || Types[i] == PT.LineLoop) && (Mode == DrawingMode.Edges || Mode == DrawingMode.SurfacesAndEdges)) - SetMaterialAndDrawElements(false, Types[i], Indices[i].Length, offset); - else if (Types[i] == PT.Points && Mode == DrawingMode.Points) - SetMaterialAndDrawElements(false, Types[i], Indices[i].Length, offset); + if ((t == PT.Lines || t == PT.LinesAdjacency || t== PT.LineLoop) && (Mode == DrawingMode.Edges || Mode == DrawingMode.SurfacesAndEdges)) + SetMaterialAndDrawElements(false, Types[i], len, offset); + else if (t == PT.Points && Mode == DrawingMode.Points) + SetMaterialAndDrawElements(false, t, len, offset); } - offset += Indices[i].Length * sizeof(uint); + offset += len * sizeof(uint); } } + /// + /// 物体の材質と要素をGPUに送信する。Render()関数から呼び出される。 + /// + /// Surfaceモードか否か private void SetMaterialAndDrawElements(bool drawSurfaces, PT mode, int count, int offset) { - SetMatetrial(drawSurfaces); + var renew = prms.Program != Program; + + (float emi, float amb, float dif, float spe) = drawSurfaces ? + (Material.Emission, Material.Ambient, Material.Diffuse, Material.Specular) : (0f, 1f, 0f, 0f); + + if(renew || emi != prms.emi) + GL.Uniform1(EmissionLocation, emi); + + if (renew || amb != prms.amb) + GL.Uniform1(AmbientLocation, amb); + + if (renew || dif != prms.dif) + GL.Uniform1(DiffuseLocation, dif); + + if (renew || spe != prms.spe) + GL.Uniform1(SpecularLocation, spe); + + if (renew || prms.spePow != Material.SpecularPower) + GL.Uniform1(SpecularPowerLocation, Material.SpecularPower); + + if (renew || prms.UseFixedColor != UseFixedColor) + GL.Uniform1(UseFixedColorLocation, UseFixedColor ? 1 : 0); + + if (renew || prms.col != Material.ColorV) + GL.Uniform4(FixedColorLocation, ref Material.ColorV); + + if (renew || IgnoreNormalSides != prms.ignoreNormal) + GL.Uniform1(IgnoreNormalSidesLocation, IgnoreNormalSides ? 1 : 0); + if (IgnoreNormalSides) { - GL.Disable(EnableCap.CullFace);//CullFace無効化 + GLable(false, EnableCap.CullFace);//CullFace無効化 GL.DrawElements(mode, count, DrawElementsType.UnsignedInt, offset); GL.GetUniformSubroutine(ShaderType.FragmentShader, RenderPassLocation, out int renderPassIndex); //レンダーパスを取得 - GLable(renderPassIndex == passNormalIndex, EnableCap.CullFace);//CullFaceを元に戻す + GLable(renderPassIndex == PassNormalIndex, EnableCap.CullFace);//CullFaceを元に戻す } else GL.DrawElements(mode, count, DrawElementsType.UnsignedInt, offset); + + prms = (Program, emi, amb,dif,spe, Material.SpecularPower,Material.ColorV, IgnoreNormalSides, UseFixedColor); } + static private (int Program, float emi, float amb, float dif, float spe, float spePow, V4f col, bool ignoreNormal, bool UseFixedColor) + prms = (-1, 0 ,0, 0, 0, 0, new V4f(), false, false); + /// /// レンダリングを実行. Progaramが正しくセットされていない(Generate()をしていない)場合は例外が発生. OITモードはCullFaceとDepthTestが無効、通常モードはCullFaceとDepthTestが有効 @@ -365,7 +428,7 @@ public void Render(Clip clip = null) foreach (var i in indices) { DepthTest(false);//Depthテスト無効 - GL.UniformSubroutines(ShaderType.FragmentShader, 1, ref passNormalIndex);//サブルーチンを通常パスにする + GL.UniformSubroutines(ShaderType.FragmentShader, 1, ref PassNormalIndex);//サブルーチンを通常パスにする GL.Clear(ClearBufferMask.StencilBufferBit);//ステンシルバッファークリア GL.ColorMask(false, false, false, false); //色は全くかきこまない GL.Enable(EnableCap.CullFace);//CullFace有効 @@ -387,10 +450,10 @@ public void Render(Clip clip = null) GL.StencilFunc(StencilFunction.Notequal, 0, ~0); //ステンシル値が0でない部分が描画(切断面の描画). ~0 は補数(11111111) GL.Disable(EnableCap.CullFace);//CullFace無効化 clip.EnableClips(indices.Where(j => j != i));//i番目のクリップ以外を有効化 - DepthTest(renderPassIndex == passNormalIndex);//Depthテストを元に戻す (通常モードは有効) + DepthTest(renderPassIndex == PassNormalIndex);//Depthテストを元に戻す (通常モードは有効) clip.Render(i, Material);//i番目のクリップ面を描画 } - GLable(renderPassIndex == passNormalIndex, EnableCap.CullFace);//CullFaceを元に戻す (通常モードは有効) + GLable(renderPassIndex == PassNormalIndex, EnableCap.CullFace);//CullFaceを元に戻す (通常モードは有効) GL.Disable(EnableCap.StencilTest);//Stencilテスト無効化 clip.EnableClips(indices);//全クリップ有効化 Render(); //物体全体の描画 @@ -494,7 +557,13 @@ public static void DisableAllClips() /// public class Polygon : GLObject { - public Polygon(Vector3DBase[] vertices, Material mat, DrawingMode mode) : this(vertices.Select(v => new V3d(v.X, v.Y, v.Z)).ToArray(), mat, mode) + public Polygon(Material mat, DrawingMode mode) : base(mat, mode) + { + + } + + public Polygon(Vector3DBase[] vertices, Material mat, DrawingMode mode) + : this(vertices.Select(v => new V3d(v.X, v.Y, v.Z)).ToArray(), mat, mode) { } @@ -543,7 +612,8 @@ public Polygon(V3d[] vertices, Material mat, DrawingMode mode) : base(mat, mode) lists.Add(indicesList.ToArray()); types.Add(PT.Points); - Indices = lists.ToArray(); + Indices = lists.SelectMany(i=>i).Select(i=>(uint)i).ToArray(); + TypeCounts = lists.Select(i => i.Length).ToArray(); Types = types.ToArray(); } } @@ -678,8 +748,47 @@ public Polyhedron(V3d[] vertices, Material mat, DrawingMode mode) : base(mat, mo } Vertices = vList.ToArray(); - Indices = iList2.ToArray(); + Indices = iList2.SelectMany(i => i).Select(i => (uint)i).ToArray(); + TypeCounts = iList2.Select(i => i.Length).ToArray(); Types = types.ToArray(); + + + } + + /// + /// PolyhedronをPolygonに分解する + /// + public Polygon[] ToPolygons() + { + var p =new Polygon[Types.Length / 3]; + + for(int i=0, offsetIndices = 0, offsetVetices = 0; i< p.Length; i++) + { + p[i] = new Polygon(Material, Mode); + + p[i].TypeCounts = new[] { TypeCounts[i * 3], TypeCounts[i * 3 + 1], TypeCounts[i * 3 + 2] }; + + p[i].Types = new[] { Types[i * 3], Types[i * 3 + 1], Types[i * 3 + 2] }; + + p[i].Indices = new uint[p[i].TypeCounts.Sum()]; + Array.Copy(Indices, offsetIndices, p[i].Indices, 0, p[i].Indices.Length); + p[i].Indices = p[i].Indices.Select(i => (uint)(i - offsetVetices)).ToArray(); + offsetIndices += p[i].Indices.Length; + + p[i].Vertices = new Vertex[p[i].Indices.Distinct().Count()]; + Array.Copy(Vertices, offsetVetices, p[i].Vertices, 0, p[i].Vertices.Length); + offsetVetices += p[i].Vertices.Length; + + var center = new V3f(p[i].Vertices.Average(v => v.Position.X), p[i].Vertices.Average(v => v.Position.Y), p[i].Vertices.Average(v => v.Position.Z)); + p[i].CircumscribedSphereCenter = new V4d(center.X, center.Y, center.Z, 1); + p[i].CircumscribedSphereRadius = p[i].Vertices.Max(v => (new V3f(v.Position) - center).Length); + p[i].Rendered = Rendered; + p[i].IgnoreNormalSides = true; + p[i].ShowClippedSection = false; + p[i].Tag = Tag; + } + return p; + } } @@ -701,14 +810,14 @@ public Parallelepiped(V3d o, V3d a, V3d b, V3d c, Material mat, DrawingMode mode /// public class Ellipsoid : GLObject { - public const int DefaultSlices = 3; + public static int DefaultSlices = 2; public V3d Origin { get; set; } public V3d RadiusVector1 { get; set; } public V3d RadiusVector2 { get; set; } public V3d RadiusVector3 { get; set; } - public Ellipsoid(Vector3DBase o, Vector3DBase a, Vector3DBase b, Vector3DBase c, Material mat, DrawingMode mode, int slices = DefaultSlices) + public Ellipsoid(Vector3DBase o, Vector3DBase a, Vector3DBase b, Vector3DBase c, Material mat, DrawingMode mode, int slices = 0) : this(new V3d(o.X, o.Y, o.Z), new V3d(a.X, a.Y, a.Z), new V3d(b.X, b.Y, b.Z), new V3d(c.X, c.Y, c.Z), mat, mode, slices) { } /// @@ -721,7 +830,7 @@ public Ellipsoid(Vector3DBase o, Vector3DBase a, Vector3DBase b, Vector3DBase c, /// 素材 /// 描画モード /// 分割数. 6*(2*slices+1)^2 の頂点が生成される. - public Ellipsoid(V3d o, V3d a, V3d b, V3d c, Material mat, DrawingMode mode, int slices = DefaultSlices) : base(mat, mode) + public Ellipsoid(V3d o, V3d a, V3d b, V3d c, Material mat, DrawingMode mode, int slices = 0) : base(mat, mode) { Origin = o; RadiusVector1 = a; @@ -739,16 +848,27 @@ public Ellipsoid(V3d o, V3d a, V3d b, V3d c, Material mat, DrawingMode mode, int Column3 = new V4d(o, 1) }; - if (slices == DefaultSlices && a.LengthSquared == b.LengthSquared && b.LengthSquared == c.LengthSquared && Sphere.DefaultIndices != null) + if (slices == 0) { - Vertices = Sphere.DefaultVertices.Select(v => new Vertex(transMat.Mult(v.Position), v.Normal, mat.ColorV)).ToArray(); - Indices = Sphere.DefaultIndices; - Types = Sphere.DefaultTypes; + if (a.LengthSquared == b.LengthSquared && b.LengthSquared == c.LengthSquared) + { + if (Sphere.DefaultIndices != null) + { + Vertices = Sphere.DefaultVertices.Select(v => new Vertex(transMat.Mult(v.Position), v.Normal, mat.ColorV)).ToArray(); + Indices = Sphere.DefaultIndices; + TypeCounts = Sphere.DefaultTypeCounts; + Types = Sphere.DefaultTypes; + return; + } + else + slices = Sphere.DefaultSlices; + } + else + slices = DefaultSlices; } - else - { - //さいころの6面方向 - var rot = new[] { + + //さいころの6面方向 + var rot = new[] { new M3d(1, 0, 0, 0, 1, 0, 0, 0, 1), new M3d(1, 0, 0, 0, 0, -1, 0, 1, 0), new M3d(1, 0, 0, 0, -1, 0, 0, 0, -1), @@ -756,47 +876,48 @@ public Ellipsoid(V3d o, V3d a, V3d b, V3d c, Material mat, DrawingMode mode, int new M3d(0, 0, 1, 0, 1, 0, -1, 0, 0), new M3d(0, 0, -1, 0, 1, 0, 1, 0, 0), }; - var vList = new List(); - for (int i = 0; i < rot.Length; i++) - for (int h = -slices; h <= slices; h++) - for (int w = -slices; w <= slices; w++) - { - var n = new V4d(V3d.Normalize(rot[i].Mult(new V3d(w, h, slices))), 1); - var v = transMat.Mult(n); - vList.Add(new Vertex(v.ToV3f(), n.ToV3f(), mat.ColorV)); - } - Vertices = vList.ToArray(); + var vList = new List(); + for (int i = 0; i < rot.Length; i++) + for (int h = -slices; h <= slices; h++) + for (int w = -slices; w <= slices; w++) + { + var n = new V4d(V3d.Normalize(rot[i].Mult(new V3d(w, h, slices))), 1); + var v = transMat.Mult(n); + vList.Add(new Vertex(v.ToV3f(), n.ToV3f(), mat.ColorV)); + } + Vertices = vList.ToArray(); - var types = new List(); - var indices = new List(); + var types = new List(); + var indices = new List(); + + types.Add(PT.Points); + indices.Add(Enumerable.Range(0, Vertices.Length).ToArray()); + + var indexListSurfaces = new List(); + var indexListEdges = new List(); + for (int i = 0; i < rot.Length; i++) + for (int h = 0; h < 2 * slices; h++) + for (int w = 0; w < 2 * slices; w++) + { + int current = i * (2 * slices + 1) * (2 * slices + 1) + h * (2 * slices + 1) + w; + indexListSurfaces.AddRange(new[] { current, current + 1, current + 2 * slices + 2, current + 2 * slices + 1 }); + + indexListEdges.AddRange(new[] { current, current + 1, current, current + 2 * slices + 1 }); + if (h == 2 * slices - 1) + indexListEdges.AddRange(new[] { current + 2 * slices + 2, current + 2 * slices + 1 }); + if (w == 2 * slices - 1) + indexListEdges.AddRange(new[] { current + 1, current + 2 * slices + 2 }); + } + types.Add(PT.Quads); + indices.Add(indexListSurfaces.ToArray()); + + types.Add(PT.Lines); + indices.Add(indexListEdges.ToArray()); + + Indices = indices.SelectMany(i => i).Select(i => (uint)i).ToArray(); + TypeCounts = indices.Select(i => i.Length).ToArray(); + Types = types.ToArray(); - types.Add(PT.Points); - indices.Add(Enumerable.Range(0, Vertices.Length).ToArray()); - - var indexListSurfaces = new List(); - var indexListEdges = new List(); - for (int i = 0; i < rot.Length; i++) - for (int h = 0; h < 2 * slices; h++) - for (int w = 0; w < 2 * slices; w++) - { - int current = i * (2 * slices + 1) * (2 * slices + 1) + h * (2 * slices + 1) + w; - indexListSurfaces.AddRange(new[] { current, current + 1, current + 2 * slices + 2, current + 2 * slices + 1 }); - - indexListEdges.AddRange(new[] { current, current + 1, current, current + 2 * slices + 1 }); - if (h == 2 * slices - 1) - indexListEdges.AddRange(new[] { current + 2 * slices + 2, current + 2 * slices + 1 }); - if (w == 2 * slices - 1) - indexListEdges.AddRange(new[] { current + 1, current + 2 * slices + 2 }); - } - types.Add(PT.Quads); - indices.Add(indexListSurfaces.ToArray()); - - types.Add(PT.Lines); - indices.Add(indexListEdges.ToArray()); - - Indices = indices.ToArray(); - Types = types.ToArray(); - } } } @@ -805,9 +926,18 @@ public Ellipsoid(V3d o, V3d a, V3d b, V3d c, Material mat, DrawingMode mode, int /// public class Sphere : Ellipsoid { + private static int defaultSlices = 2; + public new static int DefaultSlices { + get =>defaultSlices; + set + { + defaultSlices = value; + SetDefaultSphere(); + } + } public double Radius; - public Sphere(Vector3DBase o, double radius, Material mat, DrawingMode mode, int slices = DefaultSlices) + public Sphere(Vector3DBase o, double radius, Material mat, DrawingMode mode, int slices = 0) : this(new V3d(o.X, o.Y, o.Z), radius, mat, mode, slices) { } /// @@ -818,18 +948,28 @@ public Sphere(Vector3DBase o, double radius, Material mat, DrawingMode mode, int /// 素材 /// 描画モード /// 分割数. 6*(2*slices+1)^2 の頂点が生成される - public Sphere(V3d o, double radius, Material mat, DrawingMode mode, int slices = DefaultSlices) + public Sphere(V3d o, double radius, Material mat, DrawingMode mode, int slices = 0) : base(o, new V3d(radius, 0, 0), new V3d(0, radius, 0), new V3d(0, 0, radius), mat, mode, slices) { Radius = radius; } - public static readonly Vertex[] DefaultVertices; - public static readonly int[][] DefaultIndices; - public static readonly PT[] DefaultTypes; + public static Vertex[] DefaultVertices; + public static uint[] DefaultIndices; + public static int[] DefaultTypeCounts; + public static PT[] DefaultTypes; static Sphere() { + SetDefaultSphere(); + } + static void SetDefaultSphere() + { + DefaultVertices = null; + DefaultIndices = null; + DefaultTypeCounts = null; + DefaultTypes = null; var sphere = new Sphere(new V3d(0, 0, 0), 1, new Material(0, 0, 0, 0, 0, 0), DrawingMode.Edges, DefaultSlices); DefaultIndices = sphere.Indices; + DefaultTypeCounts = sphere.TypeCounts; DefaultVertices = sphere.Vertices; DefaultTypes = sphere.Types; } @@ -837,7 +977,7 @@ static Sphere() #endregion - + #region パイプ、円錐、円柱 /// @@ -846,17 +986,16 @@ static Sphere() /// public class Pipe : GLObject { - public const int DefaultSlices = 4; - public const int DefaultStacks = 8; + public static (int Slices, int Stacks) Default = (1, 8); public double Radius1, Radius2; public V3d Origin, Vector; - public Pipe(Vector3DBase o, Vector3DBase vec, double r1, double r2, Material mat, DrawingMode mode, int slices = DefaultSlices, int stacks = DefaultStacks) - : this(new V3d(o.X, o.Y, o.Z), new V3d(vec.X, vec.Y, vec.Z), r1, r2, mat, mode, slices, stacks) { } + public Pipe(Vector3DBase o, Vector3DBase vec, double r1, double r2, Material mat, DrawingMode mode, bool sole = true, int slices = 0, int stacks = 0) + : this(new V3d(o.X, o.Y, o.Z), new V3d(vec.X, vec.Y, vec.Z), r1, r2, mat, mode,sole, slices, stacks) { } - public Pipe(V3d o, V3d vec, double r1, double r2, Material mat, DrawingMode mode, int slices = DefaultSlices, int stacks = DefaultStacks) - : this(o, vec, r1, r2, mat, mat, mode, slices, stacks) { } + public Pipe(V3d o, V3d vec, double r1, double r2, Material mat, DrawingMode mode, bool sole =true, int slices = 0, int stacks = 0) + : this(o, vec, r1, r2, mat, mat, mode, sole, slices, stacks) { } /// /// パイプ @@ -870,84 +1009,112 @@ public Pipe(V3d o, V3d vec, double r1, double r2, Material mat, DrawingMode mode /// trueの場合は底面を描画する /// 高さの分割数 /// 円周の分割数 - public Pipe(V3d o, V3d vec, double r1, double r2, Material mat1, Material mat2, DrawingMode mode, int slices = DefaultSlices, int stacks = DefaultStacks) + public Pipe(V3d o, V3d vec, double r1, double r2, Material mat1, Material mat2, DrawingMode mode, bool sole=true, int slices = 0, int stacks = 0) : base(mat1, mode) { - ShowClippedSection = true; + + + ShowClippedSection = false; Origin = o; Vector = vec; + var rotMat = GLGeometry.CreateRotationFromZ(vec);//回転行列を計算 + Radius1 = r1; Radius2 = r2; if (mat1.Color == mat2.Color && mat1.Ambient == mat2.Ambient && mat1.Emission == mat2.Emission && mat1.Diffuse == mat2.Diffuse && mat1.Specular == mat2.Specular && mat1.SpecularPower == mat2.SpecularPower) UseFixedColor = true; + else + UseFixedColor = false; var height = vec.Length; CircumscribedSphereCenter = new V4d(new V3d(o + vec / 2.0), 1); var maxR = Math.Max(r1, r2); CircumscribedSphereRadius = Math.Sqrt(height * height / 4 + maxR * maxR); - if (slices == DefaultSlices && stacks == DefaultStacks && r1 == r2 && Cylinder.DefaultIndices != null && UseFixedColor)//デフォルトのシリンダーの場合 + if (slices == 0 && stacks == 0) { - var rotMat = GLGeometry.CreateRotationFromZ(vec);//回転行列を計算 - var transMat = new M4d(rotMat) * new M4d(r1, 0, 0, 0, 0, r1, 0, 0, 0, 0, vec.Length, 0, 0, 0, 0, 1); - transMat.Column3 = new V4d(o, 1); - - Vertices = Cylinder.DefaultVertices.Select(v => new Vertex(transMat.Mult(v.Position), rotMat.Mult(v.Normal), mat1.ColorV)).ToArray(); - Indices = Cylinder.DefaultIndices; - Types = Cylinder.DefaultTypes; - } - else if (slices == DefaultSlices && stacks == DefaultStacks && r2 ==0 && Cone.DefaultIndices != null && UseFixedColor)//デフォルトのコーンの場合 - { - var rotMat = GLGeometry.CreateRotationFromZ(vec);//回転行列を計算 - var transMat = new M4d(rotMat) * new M4d(r2, 0, 0, 0, 0, r2, 0, 0, 0, 0, vec.Length, 0, 0, 0, 0, 1); - transMat.Column3 = new V4d(o, 1); - - Vertices = Cone.DefaultVertices.Select(v => new Vertex(transMat.Mult(v.Position), rotMat.Mult(v.Normal), mat1.ColorV)).ToArray(); - Indices = Cone.DefaultIndices; - Types = Cone.DefaultTypes; - } - else - { - List v = new List(), n = new List(); - List c = new List(); - //まず側面 - for (int h = 0; h <= slices; h++) - for (int t = 0; t < stacks; t++) + if (r1 == r2)//Crylinderの場合 + { + if (Cylinder.DefaultIndices != null && UseFixedColor) { - double sin = Math.Sin((double)t / stacks * Math.PI * 2), cos = Math.Cos((double)t / stacks * Math.PI * 2); - double r = r1 * (1 - (double)h / slices) + r2 * h / slices; - double z = (double)h / slices * height; - v.Add(new V3d(r * sin, r * cos, z)); - n.Add(new V3d(r2 * height * sin, r2 * height * cos, -r2 * (r2 - r1))); - c.Add(h < slices / 2 ? mat1.ColorV : mat2.ColorV); + var transMat = new M4d(rotMat) * new M4d(r1, 0, 0, 0, 0, r1, 0, 0, 0, 0, vec.Length, 0, 0, 0, 0, 1); + transMat.Column3 = new V4d(o, 1); + + Vertices = Cylinder.DefaultVertices.Select(v => new Vertex(transMat.Mult(v.Position), rotMat.Mult(v.Normal), mat1.ColorV)).ToArray(); + Indices = Cylinder.DefaultIndices; + TypeCounts = Cylinder.DefaultTypeCounts; + Types = Cylinder.DefaultTypes; + return; } - - var current = 0; - var indiceSide = new List(); - for (int h = 0; h < slices; h++) - for (int t = 0; t < stacks; t++) + slices = Cylinder.Default.Slices; + stacks = Cylinder.Default.Stacks; + } + else if (r2 == 0)//Coneの場合 + { + if (Cone.DefaultIndices != null && UseFixedColor) { - current = h * stacks + t; - if (t < stacks - 1) - indiceSide.AddRange(new[] { current, current + stacks, current + 1 + stacks, current + 1 }); - else - indiceSide.AddRange(new[] { current, current + stacks, current + 1, current + 1 - stacks }); + var transMat = new M4d(rotMat) * new M4d(r2, 0, 0, 0, 0, r2, 0, 0, 0, 0, vec.Length, 0, 0, 0, 0, 1); + transMat.Column3 = new V4d(o, 1); + + Vertices = Cone.DefaultVertices.Select(v => new Vertex(transMat.Mult(v.Position), rotMat.Mult(v.Normal), mat1.ColorV)).ToArray(); + Indices = Cone.DefaultIndices; + TypeCounts = Cone.DefaultTypeCounts; + Types = Cone.DefaultTypes; + return; } - var types = new List(); - var indices = new List(); + slices = Cone.Default.Slices; + stacks = Cone.Default.Stacks; + } + else + { + slices = Default.Slices; + stacks = Default.Stacks; + } - types.Add(PT.Quads); - indices.Add(indiceSide.ToArray()); + } - types.Add(PT.LineLoop); - indices.Add(indiceSide.ToArray()); + List v = new List(), n = new List(); + List c = new List(); + //まず側面 + for (int h = 0; h <= slices; h++) + for (int t = 0; t < stacks; t++) + { + double sin = Math.Sin((double)t / stacks * Math.PI * 2), cos = Math.Cos((double)t / stacks * Math.PI * 2); + double r = r1 * (1 - (double)h / slices) + r2 * h / slices; + double z = (double)h / slices * height; + v.Add(new V3d(r * sin, r * cos, z)); + n.Add(new V3d(r2 * height * sin, r2 * height * cos, -r2 * (r2 - r1))); + c.Add(h < slices / 2 ? mat1.ColorV : mat2.ColorV); + } - types.Add(PT.Points); - indices.Add(Enumerable.Range(0, v.Count).ToArray()); + var current = 0; + var indiceSide = new List(); + for (int h = 0; h < slices; h++) + for (int t = 0; t < stacks; t++) + { + current = h * stacks + t; + if (t < stacks - 1) + indiceSide.AddRange(new[] { current, current + stacks, current + 1 + stacks, current + 1 }); + else + indiceSide.AddRange(new[] { current, current + stacks, current + 1, current + 1 - stacks }); + } + var types = new List(); + var indices = new List(); + + types.Add(PT.Quads); + indices.Add(indiceSide.ToArray()); + + types.Add(PT.LineLoop); + indices.Add(indiceSide.ToArray()); - //底面 + types.Add(PT.Points); + indices.Add(Enumerable.Range(0, v.Count).ToArray()); + + //底面 + if (sole) + { //始点側 if (r1 > 0) { @@ -986,17 +1153,16 @@ public Pipe(V3d o, V3d vec, double r1, double r2, Material mat1, Material mat2, types.Add(PT.TriangleFan); indices.Add(indicesBottom.ToArray()); } + } - var rotMat = GLGeometry.CreateRotationFromZ(vec); - - var vList = new List(); - for (int i = 0; i < v.Count; i++) - vList.Add(new Vertex((rotMat.Mult(v[i]) + o).ToV3f(), rotMat.Mult(n[i]).ToV3f(), c[i])); + var vList = new List(); + for (int i = 0; i < v.Count; i++) + vList.Add(new Vertex((rotMat.Mult(v[i]) + o).ToV3f(), rotMat.Mult(n[i]).ToV3f(), c[i])); - Vertices = vList.ToArray(); - Indices = indices.ToArray(); - Types = types.ToArray(); - } + Vertices = vList.ToArray(); + Indices = indices.SelectMany(i => i).Select(i => (uint)i).ToArray(); + TypeCounts = indices.Select(i => i.Length).ToArray(); + Types = types.ToArray(); } } @@ -1006,12 +1172,25 @@ public Pipe(V3d o, V3d vec, double r1, double r2, Material mat1, Material mat2, /// public class Cone : Pipe { - public static readonly Vertex[] DefaultVertices; - public static readonly int[][] DefaultIndices; - public static readonly PT[] DefaultTypes; + private static (int Slices,int Stacks) _Default = (1,8); + public new static (int Slices, int Stacks) Default + { + get => _Default; + set + { + _Default = value; + SetDefaultCone(); + } + } + + + public static Vertex[] DefaultVertices; + public static uint[] DefaultIndices; + public static int[] DefaultTypeCounts; + public static PT[] DefaultTypes; - public Cone(Vector3DBase o, Vector3DBase vec, double r, Material mat, DrawingMode mode, int slices = DefaultSlices, int stacks = DefaultStacks) - : this(new V3d(o.X, o.Y, o.Z), new V3d(vec.X, vec.Y, vec.Z), r, mat, mode, slices, stacks) { } + public Cone(Vector3DBase o, Vector3DBase vec, double r, Material mat, DrawingMode mode, bool sole = true, int slices = 0, int stacks = 0) + : this(new V3d(o.X, o.Y, o.Z), new V3d(vec.X, vec.Y, vec.Z), r, mat, mode,sole, slices, stacks) { } /// /// 円錐 @@ -1024,17 +1203,27 @@ public Cone(Vector3DBase o, Vector3DBase vec, double r, Material mat, DrawingMod /// trueの場合は底面を描画する /// 高さの分割数 /// 経線の分割数 - public Cone(V3d o, V3d vec, double r, Material mat, DrawingMode mode, int slices = DefaultSlices, int stacks = DefaultStacks) - : base(o, vec, 0, r, mat, mode, slices, stacks) + public Cone(V3d o, V3d vec, double r, Material mat, DrawingMode mode, bool sole = true, int slices = 0, int stacks = 0) + : base(o, vec, 0, r, mat, mode, sole, slices, stacks) { } static Cone() { - var cone = new Cone(new V3d(0, 0, 0), new V3d(0, 0, 1), 1, new Material(0, 0, 0, 0, 0, 0), DrawingMode.Edges, DefaultSlices, DefaultStacks); + SetDefaultCone(); + } + static void SetDefaultCone() + { + DefaultVertices = null; + DefaultIndices = null; + DefaultTypeCounts = null; + DefaultTypes = null; + var cone = new Cone(new V3d(0, 0, 0), new V3d(0, 0, 1), 1, new Material(0, 0, 0, 0, 0, 0), DrawingMode.Edges,true, 0, 0); DefaultIndices = cone.Indices; + DefaultTypeCounts = cone.TypeCounts; DefaultVertices = cone.Vertices; DefaultTypes = cone.Types; } + } /// @@ -1043,15 +1232,27 @@ static Cone() /// public class Cylinder : Pipe { - public static readonly Vertex[] DefaultVertices; - public static readonly int[][] DefaultIndices; - public static readonly PT[] DefaultTypes; - public Cylinder(Vector3DBase o, Vector3DBase vec, double r, Material mat, DrawingMode mode, int slices = DefaultSlices, int stacks = DefaultStacks) - : this(new V3d(o.X, o.Y, o.Z), new V3d(vec.X, vec.Y, vec.Z), r, mat, mode, slices, stacks) { } + private static (int Slices, int Stacks) _Default = (1, 8); + public new static (int Slices, int Stacks) Default + { + get => _Default; + set + { + _Default = value; + SetDefaultCylinder(); + } + } + public static Vertex[] DefaultVertices; + public static uint[] DefaultIndices; + public static int[] DefaultTypeCounts; + public static PT[] DefaultTypes; + public Cylinder(Vector3DBase o, Vector3DBase vec, double r, Material mat, DrawingMode mode, bool sole = true, int slices = 0, int stacks = 0) + : this(new V3d(o.X, o.Y, o.Z), new V3d(vec.X, vec.Y, vec.Z), r, mat, mode,sole, slices, stacks) { } - public Cylinder(Vector3DBase o, Vector3DBase vec, double r, Material mat1, Material mat2, DrawingMode mode, int slices = DefaultSlices, int stacks = DefaultStacks) - : this(new V3d(o.X, o.Y, o.Z), new V3d(vec.X, vec.Y, vec.Z), r, mat1, mat2, mode, slices, stacks) { } + + public Cylinder(Vector3DBase o, Vector3DBase vec, double r, Material mat1, Material mat2, DrawingMode mode, bool sole = true, int slices = 0, int stacks = 0) + : this(new V3d(o.X, o.Y, o.Z), new V3d(vec.X, vec.Y, vec.Z), r, mat1, mat2, mode,sole, slices, stacks) { } @@ -1066,16 +1267,26 @@ public Cylinder(Vector3DBase o, Vector3DBase vec, double r, Material mat1, Mater /// trueの場合は底面を描画する /// 高さの分割数 /// 経線の分割数 - public Cylinder(V3d o, V3d vec, double r, Material mat, DrawingMode mode, int slices = DefaultSlices, int stacks = DefaultStacks) - : base(o, vec, r, r, mat, mode, slices, stacks) { } + public Cylinder(V3d o, V3d vec, double r, Material mat, DrawingMode mode, bool sole =true, int slices = 0, int stacks = 0) + : base(o, vec, r, r, mat, mode,sole, slices, stacks) { } - public Cylinder(V3d o, V3d vec, double r, Material mat1, Material mat2, DrawingMode mode, int slices = DefaultSlices, int stacks = DefaultStacks) - : base(o, vec, r, r, mat1, mat2, mode, slices, stacks) { } + public Cylinder(V3d o, V3d vec, double r, Material mat1, Material mat2, DrawingMode mode, bool sole = true, int slices = 0, int stacks = 0) + : base(o, vec, r, r, mat1, mat2, mode,sole, slices, stacks) { } static Cylinder() { - var cylinder = new Cylinder(new V3d(0, 0, 0), new V3d(0, 0, 1), 1, new Material(0, 0, 0, 0, 0, 0), DrawingMode.Edges, DefaultSlices, DefaultStacks); + SetDefaultCylinder(); + } + + static void SetDefaultCylinder() + { + DefaultVertices = null; + DefaultIndices = null; + DefaultTypeCounts = null; + DefaultTypes = null; + var cylinder = new Cylinder(new V3d(0, 0, 0), new V3d(0, 0, 1), 1, new Material(0, 0, 0, 0, 0, 0), DrawingMode.Edges, true, 0, 0); DefaultIndices = cylinder.Indices; + DefaultTypeCounts = cylinder.TypeCounts; DefaultVertices = cylinder.Vertices; DefaultTypes = cylinder.Types; } @@ -1184,13 +1395,14 @@ public Torus(V3d origin, V3d norm, double r1, double r2, Material mat, DrawingMo types.Add(PT.Lines); indices.Add(indexListEdges.ToArray()); - Indices = indices.ToArray(); + Indices = indices.SelectMany(i => i).Select(i => (uint)i).ToArray(); + TypeCounts = indices.Select(i => i.Length).ToArray(); Types = types.ToArray(); } } #endregion - + #region メッシュ /// /// メッシュ @@ -1243,7 +1455,8 @@ public Mesh(double[] data, int width, Material mat, DrawingMode mode) : base(mat } Vertices = vList.ToArray(); - Indices = new[] { indicesList.ToArray() }; + Indices = indicesList.Select(i=>(uint)i).ToArray(); + TypeCounts = new[] { indicesList.Count() }; Types = new[] { PrimitiveType.Quads }; } diff --git a/Crystallography.OpenGL/Properties/AssemblyInfo.cs b/Crystallography.OpenGL/Properties/AssemblyInfo.cs index 531b8021..de4e9fda 100644 --- a/Crystallography.OpenGL/Properties/AssemblyInfo.cs +++ b/Crystallography.OpenGL/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます // 以下のように '*' を使用します: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2020.5.6.0925")] -[assembly: AssemblyFileVersion("2020.5.6.0925")] \ No newline at end of file +[assembly: AssemblyVersion("2020.5.9.1049")] +[assembly: AssemblyFileVersion("2020.5.9.1049")] \ No newline at end of file diff --git a/Crystallography.OpenGL/Shaders/frag.c b/Crystallography.OpenGL/Shaders/frag.c index d9d3d19e..564ac7ee 100644 --- a/Crystallography.OpenGL/Shaders/frag.c +++ b/Crystallography.OpenGL/Shaders/frag.c @@ -1,13 +1,13 @@ #version 430 core -//#pragma optionNV(ifcvt none) -//#pragma optionNV(inline all) -//#pragma optionNV(strict on) -//#pragma optionNV(unroll all) +#pragma optionNV(ifcvt none) +#pragma optionNV(inline all) +#pragma optionNV(strict on) +#pragma optionNV(unroll all) layout(early_fragment_tests) in; -#define MAX_FRAGMENTS 75 +#define MAX_FRAGMENTS 200 uniform uint MaxNodes; @@ -21,6 +21,11 @@ uniform float SpecularPower = 128.0; uniform vec4 BgColor = vec4(1, 1, 1, 1); uniform bool IgnoreNormalSides = false; +//Depth Cueing +uniform bool DepthCueing = false; +uniform float Far = -2.5; +uniform float Near = 0.5; + // Input from vertex shader in VertexData { @@ -28,6 +33,7 @@ in VertexData vec3 Light;//Light direction vec3 View;//View direction vec4 Color;//Color + float Z;//Depth } fs_in; struct NodeType { @@ -72,7 +78,19 @@ vec4 setColor() emission = max(dot(normal, view), 0.0) * Emission * c; diffuse = max(dot(normal, light), 0.0) * Diffuse * c; } - return vec4(diffuse + specular + ambient + emission, fs_in.Color.a); + + vec4 color = vec4(diffuse + specular + ambient + emission, fs_in.Color.a); + + if(DepthCueing) + if (fs_in.Z < Near) + { + if (fs_in.Z < Far) + color = BgColor; + else + color = mix(color, BgColor, (Near - fs_in.Z) / (Near - Far)); + } + + return color; } subroutine(RenderPassType) @@ -157,8 +175,9 @@ void passOIT2() } */ - /* + //bubble sort + /* int j, i; NodeType tempNode; for(i = 0; i < count - 1; i++) @@ -175,8 +194,9 @@ void passOIT2() } */ - /* + //merge sort + /* int i, j1, j2, k; int a, b, c; int step = 1; @@ -235,9 +255,7 @@ void passOIT2() // Traverse the array, and combine the colors using the alpha channel. vec4 color = BgColor; for (int i = 0; i < count; i++) - { color = mix(color, frags[i].color, frags[i].color.a); - } color.a = 1; // Output the final color FragColor = color; @@ -252,4 +270,8 @@ void passNormal() void main() { RenderPass(); -} \ No newline at end of file +} + + + + diff --git a/Crystallography.OpenGL/Shaders/vert.c b/Crystallography.OpenGL/Shaders/vert.c index 0ec3498b..cac8ec57 100644 --- a/Crystallography.OpenGL/Shaders/vert.c +++ b/Crystallography.OpenGL/Shaders/vert.c @@ -1,9 +1,9 @@ #version 430 core -//#pragma optionNV(ifcvt none) -//#pragma optionNV(inline all) -//#pragma optionNV(strict on) -//#pragma optionNV(unroll all) +#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; @@ -31,6 +31,7 @@ out VertexData vec3 Light;//Light direction vec3 View;//View direction vec4 Color;//Color + float Z;//Depth } vs_out; void main(void) @@ -38,6 +39,9 @@ void main(void) // Calculate view-space coordinate vec4 P = WorldMatrix * Position; + // Calculate the clip-space position of each vertex + vec4 pos = ProjMatrix * ViewMatrix * P; + // Calculate normal in view-space vs_out.Normal = mat3(WorldMatrix) * Normal; @@ -47,19 +51,21 @@ void main(void) // Calculate view vector vs_out.View = EyePosition - P.xyz; + //Z depth + vs_out.Z = P.z; + //Copy color - if (UseFixedColor) - vs_out.Color = FixedColor; + if (UseFixedColor) + vs_out.Color= FixedColor; else vs_out.Color = Color; // Calculate the clip-space position of each vertex - gl_Position = ProjMatrix * ViewMatrix * P; - for (int i = 0; i < ClipNum; i++) { gl_ClipDistance[i] = dot(Position, ClipPlanes[i]); } -} + gl_Position = pos; +} //Sellers, Graham.OpenGL Superbible : Comprehensive Tutorial and Reference(Kindle の位置No.15531 - 15557).Pearson Education.Kindle 版. \ No newline at end of file diff --git a/Crystallography/Properties/AssemblyInfo.cs b/Crystallography/Properties/AssemblyInfo.cs index c7b8e121..69b2d588 100644 --- a/Crystallography/Properties/AssemblyInfo.cs +++ b/Crystallography/Properties/AssemblyInfo.cs @@ -26,7 +26,7 @@ // ɂ悤ɁA'*' gāAׂĂ̒lw肷邩A // rhуrWԍlɂ邱Ƃł܂B -[assembly: AssemblyVersion("2020.5.6.0925")] +[assembly: AssemblyVersion("2020.5.9.1049")] // // AZuɏɂ́AgpL[w肵Ȃ΂Ȃ܂B @@ -57,5 +57,5 @@ [assembly: AssemblyKeyFile("")] [assembly: AssemblyKeyName("")] [assembly: ComVisibleAttribute(true)] -[assembly: AssemblyFileVersion("2020.5.6.0925")] +[assembly: AssemblyFileVersion("2020.5.9.1049")] diff --git a/ReciPro/FormMain.cs b/ReciPro/FormMain.cs index 28f4d36b..c4ae008f 100644 --- a/ReciPro/FormMain.cs +++ b/ReciPro/FormMain.cs @@ -200,7 +200,7 @@ private void FormMain_Load(object sender, EventArgs e) NodeCoefficient = 1, ProjectionMode = GLControlAlpha.ProjectionModes.Orhographic, ProjWidth = 4D, - RenderingTransparency = GLControlAlpha.RenderingTransparencyModes.Never, + RenderingTransparency = GLControlAlpha.RenderingTransparencyModes.ZSORT, RotationMode = GLControlAlpha.RotationModes.Object, TranslatingMode = GLControlAlpha.TranslatingModes.View }; @@ -212,11 +212,12 @@ private void FormMain_Load(object sender, EventArgs e) glControlAxes.Dock = DockStyle.Fill; glControlAxes.BringToFront(); } - catch + catch(Exception ex) { + MessageBox.Show(ex.Message); RegistryKey regKey = Registry.CurrentUser.CreateSubKey("Software\\Crystallography\\ReciPro"); regKey.SetValue("DisableOpenGL", true); - this.Close(); + // this.Close(); } commonDialog.Text = "Now Loading...Initializing OpenGL."; @@ -538,10 +539,10 @@ private void formCalculator_FormClosing(object sender, FormClosingEventArgs e) private void FormMain_FormClosing(object sender, FormClosingEventArgs e) { - FormCalculator.Close(); - FormStereonet.Close(); - FormStructureViewer.Close(); - FormDiffractionSimulator.Close(); + //FormCalculator.Close(); + //FormStereonet.Close(); + //FormStructureViewer.Close(); + //FormDiffractionSimulator.Close(); e.Cancel = false; SaveInitialRegistry(); ChangeClipboardChain(this.Handle, NextHandle); diff --git a/ReciPro/FormRotation.Designer.cs b/ReciPro/FormRotation.Designer.cs index d6b6dca6..1bd5aaad 100644 --- a/ReciPro/FormRotation.Designer.cs +++ b/ReciPro/FormRotation.Designer.cs @@ -590,7 +590,7 @@ private void InitializeComponent() this.glControlExpObjects.NodeCoefficient = 1; this.glControlExpObjects.ProjectionMode = Crystallography.OpenGL.GLControlAlpha.ProjectionModes.Orhographic; this.glControlExpObjects.ProjWidth = 0.8D; - this.glControlExpObjects.RenderingTransparency = Crystallography.OpenGL.GLControlAlpha.RenderingTransparencyModes.Never; + this.glControlExpObjects.RenderingTransparency = Crystallography.OpenGL.GLControlAlpha.RenderingTransparencyModes.ZSORT; this.glControlExpObjects.RotationMode = Crystallography.OpenGL.GLControlAlpha.RotationModes.Object; this.glControlExpObjects.Size = new System.Drawing.Size(130, 130); this.glControlExpObjects.TabIndex = 96; @@ -614,7 +614,7 @@ private void InitializeComponent() this.glControlExpAxes.NodeCoefficient = 1; this.glControlExpAxes.ProjectionMode = Crystallography.OpenGL.GLControlAlpha.ProjectionModes.Orhographic; this.glControlExpAxes.ProjWidth = 2.4D; - this.glControlExpAxes.RenderingTransparency = Crystallography.OpenGL.GLControlAlpha.RenderingTransparencyModes.Never; + this.glControlExpAxes.RenderingTransparency = Crystallography.OpenGL.GLControlAlpha.RenderingTransparencyModes.ZSORT; this.glControlExpAxes.RotationMode = Crystallography.OpenGL.GLControlAlpha.RotationModes.Object; this.glControlExpAxes.Size = new System.Drawing.Size(130, 130); this.glControlExpAxes.TabIndex = 96; @@ -640,7 +640,7 @@ private void InitializeComponent() this.glControlExpGonio.NodeCoefficient = 1; this.glControlExpGonio.ProjectionMode = Crystallography.OpenGL.GLControlAlpha.ProjectionModes.Orhographic; this.glControlExpGonio.ProjWidth = 4D; - this.glControlExpGonio.RenderingTransparency = Crystallography.OpenGL.GLControlAlpha.RenderingTransparencyModes.Never; + this.glControlExpGonio.RenderingTransparency = Crystallography.OpenGL.GLControlAlpha.RenderingTransparencyModes.ZSORT; this.glControlExpGonio.RotationMode = Crystallography.OpenGL.GLControlAlpha.RotationModes.Object; this.glControlExpGonio.Size = new System.Drawing.Size(264, 264); this.glControlExpGonio.TabIndex = 96; @@ -913,7 +913,7 @@ private void InitializeComponent() this.glControlReciProObjects.NodeCoefficient = 1; this.glControlReciProObjects.ProjectionMode = Crystallography.OpenGL.GLControlAlpha.ProjectionModes.Orhographic; this.glControlReciProObjects.ProjWidth = 0.8D; - this.glControlReciProObjects.RenderingTransparency = Crystallography.OpenGL.GLControlAlpha.RenderingTransparencyModes.Never; + this.glControlReciProObjects.RenderingTransparency = Crystallography.OpenGL.GLControlAlpha.RenderingTransparencyModes.ZSORT; this.glControlReciProObjects.RotationMode = Crystallography.OpenGL.GLControlAlpha.RotationModes.Object; this.glControlReciProObjects.Size = new System.Drawing.Size(130, 130); this.glControlReciProObjects.TabIndex = 96; @@ -937,7 +937,7 @@ private void InitializeComponent() this.glControlReciProAxes.NodeCoefficient = 1; this.glControlReciProAxes.ProjectionMode = Crystallography.OpenGL.GLControlAlpha.ProjectionModes.Orhographic; this.glControlReciProAxes.ProjWidth = 2.4D; - this.glControlReciProAxes.RenderingTransparency = Crystallography.OpenGL.GLControlAlpha.RenderingTransparencyModes.Never; + this.glControlReciProAxes.RenderingTransparency = Crystallography.OpenGL.GLControlAlpha.RenderingTransparencyModes.ZSORT; this.glControlReciProAxes.RotationMode = Crystallography.OpenGL.GLControlAlpha.RotationModes.Object; this.glControlReciProAxes.Size = new System.Drawing.Size(130, 130); this.glControlReciProAxes.TabIndex = 96; @@ -963,7 +963,7 @@ private void InitializeComponent() this.glControlReciProGonio.NodeCoefficient = 1; this.glControlReciProGonio.ProjectionMode = Crystallography.OpenGL.GLControlAlpha.ProjectionModes.Orhographic; this.glControlReciProGonio.ProjWidth = 4D; - this.glControlReciProGonio.RenderingTransparency = Crystallography.OpenGL.GLControlAlpha.RenderingTransparencyModes.Never; + this.glControlReciProGonio.RenderingTransparency = Crystallography.OpenGL.GLControlAlpha.RenderingTransparencyModes.ZSORT; this.glControlReciProGonio.RotationMode = Crystallography.OpenGL.GLControlAlpha.RotationModes.Object; this.glControlReciProGonio.Size = new System.Drawing.Size(264, 264); this.glControlReciProGonio.TabIndex = 96; diff --git a/ReciPro/Properties/AssemblyInfo.cs b/ReciPro/Properties/AssemblyInfo.cs index 1c52bc54..7a765ed8 100644 --- a/ReciPro/Properties/AssemblyInfo.cs +++ b/ReciPro/Properties/AssemblyInfo.cs @@ -28,5 +28,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("2020.5.6.0943")] -[assembly: AssemblyFileVersion("2020.5.6.0943")] \ No newline at end of file +[assembly: AssemblyVersion("2020.5.9.1049")] +[assembly: AssemblyFileVersion("2020.5.9.1049")] \ No newline at end of file diff --git a/ReciPro/ReciPro.csproj b/ReciPro/ReciPro.csproj index 9a4a3acd..8f121df2 100644 --- a/ReciPro/ReciPro.csproj +++ b/ReciPro/ReciPro.csproj @@ -154,6 +154,7 @@ + diff --git a/ReciPro/StructureViewer/FormStructureViewer.cs b/ReciPro/StructureViewer/FormStructureViewer.cs index 4dd8513f..c3888279 100644 --- a/ReciPro/StructureViewer/FormStructureViewer.cs +++ b/ReciPro/StructureViewer/FormStructureViewer.cs @@ -105,10 +105,8 @@ private void FormStructureViewer_Load(object sender, EventArgs e) formAtom.formStructureViewer = this; AddOwnedForm(formAtom); - //GLRg[lj - // + #region fUCiȂ悤ɂGLRg[lj // glControlAxes - // glControlAxes = new GLControlAlpha { AllowMouseRotation = false, @@ -122,25 +120,22 @@ private void FormStructureViewer_Load(object sender, EventArgs e) NodeCoefficient = 1, ProjectionMode = GLControlAlpha.ProjectionModes.Orhographic, ProjWidth = 4D, - RenderingTransparency = GLControlAlpha.RenderingTransparencyModes.Never, + RenderingTransparency = GLControlAlpha.RenderingTransparencyModes.ZSORT, RotationMode = GLControlAlpha.RotationModes.Object, TranslatingMode = GLControlAlpha.TranslatingModes.View, Location = new Point(0, 0), - Size = new Size(60, 60), + Size = new Size(numericBoxAxesSize.ValueInteger, numericBoxAxesSize.ValueInteger), Anchor = AnchorStyles.Bottom | AnchorStyles.Left }; glControlAxes.MouseMove += glControlAxes_MouseMove; - - // // glControlLight - // - glControlLight = new Crystallography.OpenGL.GLControlAlpha + glControlLight = new GLControlAlpha { AllowMouseRotation = false, AllowMouseScaling = false, AllowMouseTranslating = false, - BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D, + BorderStyle = BorderStyle.Fixed3D, DisablingOpenGL = false, MaxHeight = 1, MaxWidth = 1, @@ -148,20 +143,18 @@ private void FormStructureViewer_Load(object sender, EventArgs e) NodeCoefficient = 1, ProjectionMode = GLControlAlpha.ProjectionModes.Orhographic, ProjWidth = 4D, - RenderingTransparency = GLControlAlpha.RenderingTransparencyModes.Never, + RenderingTransparency = GLControlAlpha.RenderingTransparencyModes.ZSORT, RotationMode = GLControlAlpha.RotationModes.Object, TranslatingMode = GLControlAlpha.TranslatingModes.View, Location = new Point(0, 0), - Size = new Size(60, 60), + Size = new Size(numericBoxLightSize.ValueInteger, numericBoxLightSize.ValueInteger), Anchor = AnchorStyles.Top | AnchorStyles.Left - }; + }; glControlLight.MouseMove += glControlLight_MouseMove; - // // glControlMain - // - glControlMain = new Crystallography.OpenGL.GLControlAlpha + glControlMain = new GLControlAlpha { AllowMouseRotation = false, AllowMouseScaling = true, @@ -174,7 +167,7 @@ private void FormStructureViewer_Load(object sender, EventArgs e) NodeCoefficient = 4, ProjectionMode = GLControlAlpha.ProjectionModes.Orhographic, ProjWidth = 4D, - RenderingTransparency = GLControlAlpha.RenderingTransparencyModes.NotAlways, + RenderingTransparency = GLControlAlpha.RenderingTransparencyModes.ZSORT, RotationMode = GLControlAlpha.RotationModes.Object, TranslatingMode = GLControlAlpha.TranslatingModes.View, Dock = DockStyle.Fill @@ -182,25 +175,38 @@ private void FormStructureViewer_Load(object sender, EventArgs e) glControlMain.MouseDown += panelMain_MouseDown; glControlMain.MouseMove += glControlMain_MouseMove; - - // - // splitContainer1.Panel1 - // + // splitContainer1.Panel1glControllj splitContainer1.Panel1.Controls.Add(glControlAxes); splitContainer1.Panel1.Controls.Add(glControlLight); splitContainer1.Panel1.Controls.Add(glControlMain); glControlAxes.Location = new Point(0, glControlMain.Height - glControlAxes.Height); + #endregion + #region GLRg[̏ glControlLight.AddObjects(new Sphere(new V3(0, 0, 0), 1.0, new Material(C4.Gray, 0.2, 0.7, 0.7, 50, 0.2), DrawingMode.Surfaces)); glControlMain.LightPosition = glControlLight.LightPosition = glControlAxes.LightPosition = new V3(100, 100, 100); glControlMain.ViewFrom = glControlLight.ViewFrom = glControlAxes.ViewFrom = new V3(0, 0, 50); glControlLight.ProjWidth = glControlAxes.ProjWidth = 2.2; glControlMain.ProjWidth = 3f; + #endregion - tabControlBoundOption.ItemSize = new Size(0, 1); + #region rfIJ[h̐ݒ + foreach (var info in glControlMain.GraphicsInfo) + { + labelGraphicsCard.Text += info.Product + " "; + labelGraphicsDriver.Text += info.Version + " "; + } + labelOpenGLversion.Text += glControlMain.GLVersionCurrent; + + if (glControlMain.GraphicsInfo.Select(g => g.Product.ToLower()).Any(p => p.Contains("nvidia") || p.Contains("amd"))) + comboBoxRenderignQuality.SelectedIndex = 1; + else + comboBoxRenderignQuality.SelectedIndex = 0; - //e탆[U[Rg[ + #endregion + + #region e탆[U[Rg[̒lj boundControl = formMain.crystalControl.boundControl; latticePlaneControl = formMain.crystalControl.latticePlaneControl; atomControl = formMain.crystalControl.atomControl; @@ -217,8 +223,22 @@ private void FormStructureViewer_Load(object sender, EventArgs e) bondControl.ItemsChanged += BondControl_BondsChanged; atomControl.ItemsChanged += AtomControl_ItemsChanged; + #endregion + + + #region Rg[̒ljݒ flowLayoutPanelLegend.AutoSize = true; + flowLayoutPanelLegend.SendToBack(); + + tabControlBoundOption.ItemSize = new Size(0, 1); + + comboBoxProjectionMode.SelectedIndex = 0; + comboBoxTransparency.SelectedIndex = 0; + + checkBoxDepthCueing_CheckedChanged(new object(), new EventArgs()); + + #endregion } @@ -226,7 +246,7 @@ private void FormStructureViewer_Load(object sender, EventArgs e) #endregion RXgN^ #region sݒ - private void initAxesMatrix() + private void initAxesMatrix() { axes.Row0 = new V3(Crystal.A_Axis.X, Crystal.B_Axis.X, Crystal.C_Axis.X); @@ -252,6 +272,8 @@ private void initAxesMatrix() /// private void initBounds() { + + sw.Restart(); bounds = new List<(V4 prm, Color color)>(); @@ -363,7 +385,6 @@ public void setAtoms() textBoxInformation.AppendText("Generation of aoms: " + sw.ElapsedMilliseconds + "ms.\r\n"); } - public void setAtomsP() { var list = new List<(int Index, V3 Pos, Material Mat, double Radius)>(); @@ -394,14 +415,15 @@ private void setBondsAndPolyhera() { sw.Restart(); //܂A_q̎ + + var bonds = bondControl.GetAll().Where(b => b.Enabled).ToList(); var dic = new Dictionary(); - var GLObjectsP = GLObjects.AsParallel(); - foreach (var bond in bondControl.GetAll().Where(b => b.Enabled)) + bonds.ForEach(bond => { foreach (var element in new[] { bond.Element1, bond.Element2 }) { if (!dic.ContainsKey(element)) - dic.Add(element, GLObjectsP.Select((Obj, Index) => (Obj, Index)) + dic.Add(element, GLObjects.Select((Obj, Index) => (Obj, Index)) .Where(e => e.Obj.Tag is atomID id && Crystal.Atoms[id.Index].ElementName == element).Select(e => { var s = e.Obj as Sphere; @@ -410,13 +432,14 @@ private void setBondsAndPolyhera() return (e.Index, s.Origin, s.Radius, (s.Tag as atomID).IsInside, BondMat, PolyMat, s.SerialNumber); }).ToArray()); } - } + }); //bondspolyhedralj - foreach (var bond in bondControl.GetAll().Where(b => b.Enabled)) + bonds.ForEach(bond => { double min2 = bond.MinLength * bond.MinLength * 0.01, max2 = bond.MaxLength * bond.MaxLength * 0.01; double radius = bond.Radius * 0.1; + var polyhedronMode = bond.ShowEdges ? DrawingMode.SurfacesAndEdges : DrawingMode.Surfaces; Parallel.ForEach(dic[bond.Element1].Where(e => e.IsInside), c => @@ -427,21 +450,27 @@ private void setBondsAndPolyhera() { foreach (var v in vertices) //Bond { - var d = Math.Min(c.Radius, v.Radius) / 2;//CenteraOriginȁ̔̒lH܂B - var vec1 = v.Origin - c.Origin;//SԂԃxNg - var length1 = (v.Origin - c.Origin).Length;//SԂԃxNg̒ - var o = c.Origin + (c.Radius - d) / length1 * vec1; - var vec = (1 + (d * 2 - c.Radius - v.Radius) / length1) * vec1; + var vec = v.Origin - c.Origin;//SԂԃxNg + var length = vec.Length;//SԂԃxNg̒ + var m = c.Origin + (length - c.Radius - v.Radius) * vec / length;//Ԓn_ - var cylinder = new Cylinder(o, vec, radius, c.BondMat, v.BondMat, DrawingMode.Surfaces, 8, 8) + var cylinder1 = new Cylinder(c.Origin, m - c.Origin, radius, c.BondMat, DrawingMode.Surfaces) + { Tag = new bondID(c.SerialNumber, v.SerialNumber), ShowClippedSection = false, Rendered = bond.ShowBond }; + + var cylinder2 = new Cylinder(m, v.Origin - m, radius, v.BondMat, DrawingMode.Surfaces) { Tag = new bondID(c.SerialNumber, v.SerialNumber), ShowClippedSection = false, Rendered = bond.ShowBond }; lock (lockObj) - GLObjects.Add(cylinder); + { + GLObjects.Add(cylinder1); + GLObjects.Add(cylinder2); + GLObjects[v.Index].Rendered = true; + } } if (vertices.Count == 3) { - var polygon = new Polygon(vertices.Select(v => v.Origin).ToArray(), c.PolyMat, polyhedronMode) { Rendered = bond.ShowPolyhedron }; + var polygon = new Polygon(vertices.Select(v => v.Origin).ToArray(), c.PolyMat, polyhedronMode) + { Rendered = bond.ShowPolyhedron }; lock (lockObj) GLObjects.Add(polygon); } @@ -449,16 +478,13 @@ private void setBondsAndPolyhera() { var polyhedron = new Polyhedron(vertices.Select(v => v.Origin).ToArray(), c.PolyMat, polyhedronMode) { Rendered = bond.ShowPolyhedron, ShowClippedSection = false }; + lock (lockObj) - GLObjects.Add(polyhedron); + GLObjects.AddRange(polyhedron.ToPolygons()); } - - lock (lockObj) - vertices.ForEach(v => GLObjects[v.Index].Rendered = true); - } }); - } + }); textBoxInformation.AppendText("Generation of bonds & polyhedra: " + sw.ElapsedMilliseconds + "ms.\r\n"); } @@ -491,6 +517,8 @@ private void removeObjects() } #endregion + #region GLObjectsVF[_ɓ] + /// /// GLObjects] /// @@ -502,7 +530,8 @@ private void transferGLObjects() toolStripLabelStatusInitialization.Text += " and sent to OpenGL (" + sw.ElapsedMilliseconds + " ms.) "; textBoxInformation.AppendText("Trasfer: " + sw.ElapsedMilliseconds + "ms.\r\n"); - } + } + #endregion #region PʊiqʃIuWFNg𐶐 /// @@ -520,11 +549,12 @@ private void setUnitCellPlanes() var cellVertices = new[] { new V3(0), axes.Column0, axes.Column1, axes.Column2, axes.Column0 + axes.Column1, axes.Column1 + axes.Column2, axes.Column2 + axes.Column0, axes.Column0 + axes.Column1 + axes.Column2 }; var translation = axes.Mult(new V3(numericBoxCellTransrationA.Value, numericBoxCellTransrationB.Value, numericBoxCellTransrationC.Value)) + shift; - cellVertices = cellVertices.Select(v => v - translation).ToArray(); + var cellPlaneMat = new Material(colorControlCellPlane.Argb, numericBoxCellPlaneAlpha.Value, 0.2, 0.8, 0.8, 50, 0.2); var cellPlane = new Polyhedron(cellVertices, cellPlaneMat, DrawingMode.Surfaces); cellPlane.Tag = new cellID(); + var cellEdgeMat = new Material(colorControlCellEdge.Argb, 1, 0.2, 0.8, 0.8, 50, 0.2); var cellEdge = new Polyhedron(cellVertices, cellEdgeMat, DrawingMode.Edges); cellEdge.Tag = new cellID(); @@ -539,10 +569,13 @@ private void setUnitCellPlanes() cellEdge.Rendered = checkBoxCellShowEdge.Checked; } - GLObjects.Add(cellPlane); - glControlMain.AddObjects(cellPlane); - GLObjects.Add(cellEdge); - glControlMain.AddObjects(cellEdge); + var planes = cellPlane.ToPolygons(); + GLObjects.AddRange(planes); + glControlMain.AddObjects(planes); + + var edges = cellEdge.ToPolygons(); + GLObjects.AddRange(edges); + glControlMain.AddObjects(edges); textBoxInformation.AppendText("Generation of cell planes: " + sw.ElapsedMilliseconds + "ms.\r\n"); @@ -635,6 +668,8 @@ private void setAxesControl() } #endregion + #region \ZbeBO (SetGLObjects) + /// /// \ZbeBO /// @@ -683,7 +718,8 @@ public void SetGLObjects(Crystal _crystal = null) setAxesControl();//\GLControl Draw(); // - } + } + #endregion #region Draw @@ -1020,7 +1056,7 @@ private void saveImageToolStripMenuItem_Click(object sender, EventArgs e) private void toolStripButtonLightingBall_CheckedChanged(object sender, EventArgs e) => glControlLight.Visible = toolStripButtonLightDirection.Checked; private void toolStripButtonBoost_CheckedChanged(object sender, EventArgs e) - => glControlMain.RenderingTransparency = toolStripButtonBoost.Checked ? GLControlAlpha.RenderingTransparencyModes.NotAlways : GLControlAlpha.RenderingTransparencyModes.Always; + => glControlMain.RenderingTransparency = toolStripButtonBoost.Checked ? GLControlAlpha.RenderingTransparencyModes.ZSORT : GLControlAlpha.RenderingTransparencyModes.OIT; private void toolStripButtonLegend_CheckedChanged(object sender, EventArgs e) => SetLegend(); @@ -1204,6 +1240,9 @@ private void SetLegend() glControlMain.SkipRendering = true; var atoms = atomControl.GetAll(); + if (atoms.Length == 0) + return; + flowLayoutPanelLegend.SuspendLayout(); for (int i = 0; i < Math.Max(atoms.Length, legendControls.Count); i++) @@ -1222,7 +1261,7 @@ private void SetLegend() NodeCoefficient = 1, ProjectionMode = GLControlAlpha.ProjectionModes.Orhographic, ProjWidth = 2.2D, - RenderingTransparency = GLControlAlpha.RenderingTransparencyModes.Never, + RenderingTransparency = GLControlAlpha.RenderingTransparencyModes.ZSORT, LightPosition = glControlLight.LightPosition, WorldMatrix = glControlLight.WorldMatrix, ViewFrom = glControlLight.ViewFrom @@ -1271,7 +1310,6 @@ private void SetLegend() #endregion #region }AÃTCYύX - private void numericBoxLegendSize_ValueChanged(object sender, EventArgs e) { SetLegend(); @@ -1305,9 +1343,87 @@ private void buttonLikeVesta_Click(object sender, EventArgs e) SetGLObjects(formMain.crystalControl.Crystal); } - + #endregion + + #region `i + private void comboBoxRenderignQuality_SelectedIndexChanged(object sender, EventArgs e) + { + if (comboBoxRenderignQuality.SelectedIndex == 0) + { + glControlMain.NodeCoefficient = 4; + Cone.Default = (1, 8); + Cylinder.Default = (1, 8); + Sphere.DefaultSlices = 2; + + } + else if (comboBoxRenderignQuality.SelectedIndex == 1) + { + glControlMain.NodeCoefficient = 16; + Cone.Default = (1, 16); + Cylinder.Default = (1, 16); + Sphere.DefaultSlices = 3; + + } + else + { + glControlMain.NodeCoefficient = 32; + Cone.Default = (1, 32); + Cylinder.Default = (1, 32); + Sphere.DefaultSlices = 5; + } + if (atomControl != null) + SetGLObjects(formMain.crystalControl.Crystal); + } + + private void comboBoxTransparency_SelectedIndexChanged(object sender, EventArgs e) + { + if(comboBoxTransparency.SelectedIndex==0) + glControlMain.RenderingTransparency = GLControlAlpha.RenderingTransparencyModes.ZSORT; + else + glControlMain.RenderingTransparency = GLControlAlpha.RenderingTransparencyModes.OIT; + + if (atomControl != null) + SetGLObjects(formMain.crystalControl.Crystal); + } + + #endregion + + #region ProjectionMode (PerspectiveAOrhographic)Ȃǂ̐ݒ + private void comboBoxProjectionMode_SelectedIndexChanged(object sender, EventArgs e) + { + trackBarPerspective.Enabled = comboBoxProjectionMode.SelectedIndex == 1; + + glControlMain.ProjectionMode = comboBoxProjectionMode.SelectedIndex == 0 ? + GLControlAlpha.ProjectionModes.Orhographic : GLControlAlpha.ProjectionModes.Perspective; + } + + private void trackBarPerspective_Scroll(object sender, EventArgs e) + { + var x = Math.Pow(51.0, 1.0 / 100.0); + glControlMain.SetPerspectiveDistance(Math.Pow(x,trackBarPerspective.Value)-1); + } + + #endregion + + #region Depth cueing̐ݒ + + private void checkBoxDepthCueing_CheckedChanged(object sender, EventArgs e) + { + groupBoxDepthCueing.Enabled = checkBoxDepthCueing.Checked; + //ȂXVȂƂ̂ŁA2s + glControlMain.SetDepthCueing(checkBoxDepthCueing.Checked, trackBarAdvancedDepthCueingNear.Value / 10.0, trackBarAdvancedDepthCueingFar.Value / 10.0); + glControlMain.SetDepthCueing(checkBoxDepthCueing.Checked, trackBarAdvancedDepthCueingNear.Value / 10.0, trackBarAdvancedDepthCueingFar.Value / 10.0); + } + private bool trackBarAdvanced2_ValueChanged(object sender, double value) + { + checkBoxDepthCueing_CheckedChanged(sender, new EventArgs()); + return false; + } + #endregion + + } } \ No newline at end of file diff --git a/ReciPro/StructureViewer/FormStructureViewer.designer.cs b/ReciPro/StructureViewer/FormStructureViewer.designer.cs index acafe866..581e098b 100644 --- a/ReciPro/StructureViewer/FormStructureViewer.designer.cs +++ b/ReciPro/StructureViewer/FormStructureViewer.designer.cs @@ -41,7 +41,6 @@ private void InitializeComponent() this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormStructureViewer)); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.flowLayoutPanelLegend = new System.Windows.Forms.FlowLayoutPanel(); this.tabControl = new System.Windows.Forms.TabControl(); this.tabPageBounds = new System.Windows.Forms.TabPage(); @@ -102,11 +101,25 @@ private void InitializeComponent() this.atomCoordinateTable1 = new Crystallography.Controls.AtomCoordinateTable(); this.tabPageInformation = new System.Windows.Forms.TabPage(); this.textBoxInformation = new System.Windows.Forms.TextBox(); + this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel(); + this.labelGraphicsCard = new System.Windows.Forms.Label(); + this.labelGraphicsDriver = new System.Windows.Forms.Label(); + this.labelOpenGLversion = new System.Windows.Forms.Label(); this.tabPage1 = new System.Windows.Forms.TabPage(); - this.buttonLikeVesta = new System.Windows.Forms.Button(); - this.numericBoxLightSize = new Crystallography.Controls.NumericBox(); - this.numericBoxAxesSize = new Crystallography.Controls.NumericBox(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); this.numericBoxLegendSize = new Crystallography.Controls.NumericBox(); + this.numericBoxAxesSize = new Crystallography.Controls.NumericBox(); + this.numericBoxLightSize = new Crystallography.Controls.NumericBox(); + this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.comboBoxTransparency = new System.Windows.Forms.ComboBox(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.comboBoxRenderignQuality = new System.Windows.Forms.ComboBox(); + this.checkBoxDepthCueing = new System.Windows.Forms.CheckBox(); + this.groupBoxDepthCueing = new System.Windows.Forms.GroupBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.comboBoxProjectionMode = new System.Windows.Forms.ComboBox(); + this.trackBarPerspective = new System.Windows.Forms.TrackBar(); + this.buttonLikeVesta = new System.Windows.Forms.Button(); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.toolStripButtonBoost = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); @@ -151,6 +164,10 @@ private void InitializeComponent() this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.trackBarAdvancedDepthCueingFar = new Crystallography.Controls.TrackBarAdvanced(); + this.trackBarAdvancedDepthCueingNear = new Crystallography.Controls.TrackBarAdvanced(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -171,7 +188,14 @@ private void InitializeComponent() this.flowLayoutPanel3.SuspendLayout(); this.tabPageCoordinateInfromatin.SuspendLayout(); this.tabPageInformation.SuspendLayout(); + this.flowLayoutPanel4.SuspendLayout(); this.tabPage1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox5.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.groupBoxDepthCueing.SuspendLayout(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.trackBarPerspective)).BeginInit(); this.toolStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); @@ -181,17 +205,14 @@ private void InitializeComponent() resources.ApplyResources(this.splitContainer1, "splitContainer1"); this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; this.splitContainer1.Name = "splitContainer1"; - // // splitContainer1.Panel1 - // + // this.splitContainer1.Panel1.Controls.Add(this.flowLayoutPanelLegend); - // // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.tabControl); - // // flowLayoutPanelLegend // @@ -338,7 +359,7 @@ private void InitializeComponent() this.numericBoxCRange.ShowFraction = true; this.numericBoxCRange.ShowPositiveSign = false; this.numericBoxCRange.ShowUpDown = true; - this.numericBoxCRange.SkipEventDuringInput = false; + this.numericBoxCRange.SkipEventDuringInput = true; this.numericBoxCRange.SmartIncrement = false; this.numericBoxCRange.TextBoxBackColor = System.Drawing.SystemColors.Window; this.numericBoxCRange.TextBoxForeColor = System.Drawing.SystemColors.WindowText; @@ -372,7 +393,7 @@ private void InitializeComponent() this.numericBoxBRange.ShowFraction = true; this.numericBoxBRange.ShowPositiveSign = false; this.numericBoxBRange.ShowUpDown = true; - this.numericBoxBRange.SkipEventDuringInput = false; + this.numericBoxBRange.SkipEventDuringInput = true; this.numericBoxBRange.SmartIncrement = false; this.numericBoxBRange.TextBoxBackColor = System.Drawing.SystemColors.Window; this.numericBoxBRange.TextBoxForeColor = System.Drawing.SystemColors.WindowText; @@ -406,7 +427,7 @@ private void InitializeComponent() this.numericBoxARange.ShowFraction = true; this.numericBoxARange.ShowPositiveSign = false; this.numericBoxARange.ShowUpDown = true; - this.numericBoxARange.SkipEventDuringInput = false; + this.numericBoxARange.SkipEventDuringInput = true; this.numericBoxARange.SmartIncrement = false; this.numericBoxARange.TextBoxBackColor = System.Drawing.SystemColors.Window; this.numericBoxARange.TextBoxForeColor = System.Drawing.SystemColors.WindowText; @@ -440,7 +461,7 @@ private void InitializeComponent() this.numericBoxCCenter.ShowFraction = true; this.numericBoxCCenter.ShowPositiveSign = false; this.numericBoxCCenter.ShowUpDown = true; - this.numericBoxCCenter.SkipEventDuringInput = false; + this.numericBoxCCenter.SkipEventDuringInput = true; this.numericBoxCCenter.SmartIncrement = false; this.numericBoxCCenter.TextBoxBackColor = System.Drawing.SystemColors.Window; this.numericBoxCCenter.TextBoxForeColor = System.Drawing.SystemColors.WindowText; @@ -474,7 +495,7 @@ private void InitializeComponent() this.numericBoxBCenter.ShowFraction = true; this.numericBoxBCenter.ShowPositiveSign = false; this.numericBoxBCenter.ShowUpDown = true; - this.numericBoxBCenter.SkipEventDuringInput = false; + this.numericBoxBCenter.SkipEventDuringInput = true; this.numericBoxBCenter.SmartIncrement = false; this.numericBoxBCenter.TextBoxBackColor = System.Drawing.SystemColors.Window; this.numericBoxBCenter.TextBoxForeColor = System.Drawing.SystemColors.WindowText; @@ -508,7 +529,7 @@ private void InitializeComponent() this.numericBoxACenter.ShowFraction = true; this.numericBoxACenter.ShowPositiveSign = false; this.numericBoxACenter.ShowUpDown = true; - this.numericBoxACenter.SkipEventDuringInput = false; + this.numericBoxACenter.SkipEventDuringInput = true; this.numericBoxACenter.SmartIncrement = false; this.numericBoxACenter.TextBoxBackColor = System.Drawing.SystemColors.Window; this.numericBoxACenter.TextBoxForeColor = System.Drawing.SystemColors.WindowText; @@ -728,12 +749,12 @@ private void InitializeComponent() // // colorControlCellPlane // - this.colorControlCellPlane.Argb = -4144897; + this.colorControlCellPlane.Argb = -4144960; resources.ApplyResources(this.colorControlCellPlane, "colorControlCellPlane"); - this.colorControlCellPlane.Blue = 255; - this.colorControlCellPlane.BlueF = 1F; + this.colorControlCellPlane.Blue = 192; + this.colorControlCellPlane.BlueF = 0.7529412F; this.colorControlCellPlane.BoxSize = new System.Drawing.Size(20, 20); - this.colorControlCellPlane.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255))))); + this.colorControlCellPlane.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(192))))); this.colorControlCellPlane.FlowDirection = System.Windows.Forms.FlowDirection.LeftToRight; this.colorControlCellPlane.Green = 192; this.colorControlCellPlane.GreenF = 0.7529412F; @@ -744,12 +765,12 @@ private void InitializeComponent() // // colorControlCellEdge // - this.colorControlCellEdge.Argb = -8355585; + this.colorControlCellEdge.Argb = -8355712; resources.ApplyResources(this.colorControlCellEdge, "colorControlCellEdge"); - this.colorControlCellEdge.Blue = 255; - this.colorControlCellEdge.BlueF = 1F; + this.colorControlCellEdge.Blue = 128; + this.colorControlCellEdge.BlueF = 0.5019608F; this.colorControlCellEdge.BoxSize = new System.Drawing.Size(20, 20); - this.colorControlCellEdge.Color = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255))))); + this.colorControlCellEdge.Color = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(128))))); this.colorControlCellEdge.FlowDirection = System.Windows.Forms.FlowDirection.LeftToRight; this.colorControlCellEdge.Green = 128; this.colorControlCellEdge.GreenF = 0.5019608F; @@ -1032,9 +1053,9 @@ private void InitializeComponent() // tabPageInformation // this.tabPageInformation.Controls.Add(this.textBoxInformation); + this.tabPageInformation.Controls.Add(this.flowLayoutPanel4); resources.ApplyResources(this.tabPageInformation, "tabPageInformation"); this.tabPageInformation.Name = "tabPageInformation"; - this.tabPageInformation.UseVisualStyleBackColor = true; // // textBoxInformation // @@ -1042,55 +1063,83 @@ private void InitializeComponent() this.textBoxInformation.Name = "textBoxInformation"; this.textBoxInformation.ReadOnly = true; // + // flowLayoutPanel4 + // + resources.ApplyResources(this.flowLayoutPanel4, "flowLayoutPanel4"); + this.flowLayoutPanel4.Controls.Add(this.labelGraphicsCard); + this.flowLayoutPanel4.Controls.Add(this.labelGraphicsDriver); + this.flowLayoutPanel4.Controls.Add(this.labelOpenGLversion); + this.flowLayoutPanel4.Name = "flowLayoutPanel4"; + // + // labelGraphicsCard + // + resources.ApplyResources(this.labelGraphicsCard, "labelGraphicsCard"); + this.labelGraphicsCard.Name = "labelGraphicsCard"; + // + // labelGraphicsDriver + // + resources.ApplyResources(this.labelGraphicsDriver, "labelGraphicsDriver"); + this.labelGraphicsDriver.Name = "labelGraphicsDriver"; + // + // labelOpenGLversion + // + resources.ApplyResources(this.labelOpenGLversion, "labelOpenGLversion"); + this.labelOpenGLversion.Name = "labelOpenGLversion"; + // // tabPage1 // + this.tabPage1.Controls.Add(this.groupBox2); + this.tabPage1.Controls.Add(this.groupBox5); + this.tabPage1.Controls.Add(this.groupBox3); + this.tabPage1.Controls.Add(this.checkBoxDepthCueing); + this.tabPage1.Controls.Add(this.groupBoxDepthCueing); + this.tabPage1.Controls.Add(this.groupBox1); this.tabPage1.Controls.Add(this.buttonLikeVesta); - this.tabPage1.Controls.Add(this.numericBoxLightSize); - this.tabPage1.Controls.Add(this.numericBoxAxesSize); - this.tabPage1.Controls.Add(this.numericBoxLegendSize); resources.ApplyResources(this.tabPage1, "tabPage1"); this.tabPage1.Name = "tabPage1"; // - // buttonLikeVesta + // groupBox2 // - resources.ApplyResources(this.buttonLikeVesta, "buttonLikeVesta"); - this.buttonLikeVesta.Name = "buttonLikeVesta"; - this.buttonLikeVesta.UseVisualStyleBackColor = true; - this.buttonLikeVesta.Click += new System.EventHandler(this.buttonLikeVesta_Click); + this.groupBox2.Controls.Add(this.numericBoxLegendSize); + this.groupBox2.Controls.Add(this.numericBoxAxesSize); + this.groupBox2.Controls.Add(this.numericBoxLightSize); + resources.ApplyResources(this.groupBox2, "groupBox2"); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.TabStop = false; // - // numericBoxLightSize + // numericBoxLegendSize // - this.numericBoxLightSize.AllowMouseControl = false; - resources.ApplyResources(this.numericBoxLightSize, "numericBoxLightSize"); - this.numericBoxLightSize.BackColor = System.Drawing.Color.Transparent; - this.numericBoxLightSize.DecimalPlaces = 0; - this.numericBoxLightSize.FooterBackColor = System.Drawing.Color.Transparent; - this.numericBoxLightSize.FooterForeColor = System.Drawing.SystemColors.ControlText; - this.numericBoxLightSize.HeaderBackColor = System.Drawing.Color.Transparent; - this.numericBoxLightSize.HeaderForeColor = System.Drawing.SystemColors.ControlText; - this.numericBoxLightSize.HeaderMargin = new System.Windows.Forms.Padding(0); - this.numericBoxLightSize.Maximum = 200D; - this.numericBoxLightSize.Minimum = 0D; - this.numericBoxLightSize.MouseDirection = Crystallography.VH_DirectionEnum.Horizontal; - this.numericBoxLightSize.MouseSpeed = 1D; - this.numericBoxLightSize.Multiline = false; - this.numericBoxLightSize.Name = "numericBoxLightSize"; - this.numericBoxLightSize.RadianValue = 1.3962634015954636D; - this.numericBoxLightSize.ReadOnly = true; - this.numericBoxLightSize.RestrictLimitValue = true; - this.numericBoxLightSize.ShowFraction = false; - this.numericBoxLightSize.ShowPositiveSign = false; - this.numericBoxLightSize.ShowUpDown = true; - this.numericBoxLightSize.SkipEventDuringInput = true; - this.numericBoxLightSize.SmartIncrement = true; - this.numericBoxLightSize.TextBoxBackColor = System.Drawing.SystemColors.Window; - this.numericBoxLightSize.TextBoxForeColor = System.Drawing.SystemColors.WindowText; - this.numericBoxLightSize.TextFont = new System.Drawing.Font("Segoe UI Symbol", 9.75F); - this.numericBoxLightSize.ThonsandsSeparator = true; - this.numericBoxLightSize.UpDown_Increment = 1D; - this.numericBoxLightSize.Value = 80D; - this.numericBoxLightSize.WordWrap = true; - this.numericBoxLightSize.ValueChanged += new Crystallography.Controls.NumericBox.MyEventHandler(this.numericBoxLightSize_ValueChanged); + this.numericBoxLegendSize.AllowMouseControl = false; + resources.ApplyResources(this.numericBoxLegendSize, "numericBoxLegendSize"); + this.numericBoxLegendSize.BackColor = System.Drawing.Color.Transparent; + this.numericBoxLegendSize.DecimalPlaces = 0; + this.numericBoxLegendSize.FooterBackColor = System.Drawing.Color.Transparent; + this.numericBoxLegendSize.FooterForeColor = System.Drawing.SystemColors.ControlText; + this.numericBoxLegendSize.HeaderBackColor = System.Drawing.Color.Transparent; + this.numericBoxLegendSize.HeaderForeColor = System.Drawing.SystemColors.ControlText; + this.numericBoxLegendSize.HeaderMargin = new System.Windows.Forms.Padding(0); + this.numericBoxLegendSize.Maximum = 200D; + this.numericBoxLegendSize.Minimum = 0D; + this.numericBoxLegendSize.MouseDirection = Crystallography.VH_DirectionEnum.Horizontal; + this.numericBoxLegendSize.MouseSpeed = 1D; + this.numericBoxLegendSize.Multiline = false; + this.numericBoxLegendSize.Name = "numericBoxLegendSize"; + this.numericBoxLegendSize.RadianValue = 0.87266462599716477D; + this.numericBoxLegendSize.ReadOnly = false; + this.numericBoxLegendSize.RestrictLimitValue = true; + this.numericBoxLegendSize.ShowFraction = false; + this.numericBoxLegendSize.ShowPositiveSign = false; + this.numericBoxLegendSize.ShowUpDown = true; + this.numericBoxLegendSize.SkipEventDuringInput = true; + this.numericBoxLegendSize.SmartIncrement = true; + this.numericBoxLegendSize.TextBoxBackColor = System.Drawing.SystemColors.Window; + this.numericBoxLegendSize.TextBoxForeColor = System.Drawing.SystemColors.WindowText; + this.numericBoxLegendSize.TextFont = new System.Drawing.Font("Segoe UI Symbol", 9.75F); + this.numericBoxLegendSize.ThonsandsSeparator = true; + this.numericBoxLegendSize.UpDown_Increment = 1D; + this.numericBoxLegendSize.Value = 50D; + this.numericBoxLegendSize.WordWrap = true; + this.numericBoxLegendSize.ValueChanged += new Crystallography.Controls.NumericBox.MyEventHandler(this.numericBoxLegendSize_ValueChanged); // // numericBoxAxesSize // @@ -1126,39 +1175,132 @@ private void InitializeComponent() this.numericBoxAxesSize.WordWrap = true; this.numericBoxAxesSize.ValueChanged += new Crystallography.Controls.NumericBox.MyEventHandler(this.numericBoxAxesSize_ValueChanged); // - // numericBoxLegendSize + // numericBoxLightSize // - this.numericBoxLegendSize.AllowMouseControl = false; - resources.ApplyResources(this.numericBoxLegendSize, "numericBoxLegendSize"); - this.numericBoxLegendSize.BackColor = System.Drawing.Color.Transparent; - this.numericBoxLegendSize.DecimalPlaces = 0; - this.numericBoxLegendSize.FooterBackColor = System.Drawing.Color.Transparent; - this.numericBoxLegendSize.FooterForeColor = System.Drawing.SystemColors.ControlText; - this.numericBoxLegendSize.HeaderBackColor = System.Drawing.Color.Transparent; - this.numericBoxLegendSize.HeaderForeColor = System.Drawing.SystemColors.ControlText; - this.numericBoxLegendSize.HeaderMargin = new System.Windows.Forms.Padding(0); - this.numericBoxLegendSize.Maximum = 200D; - this.numericBoxLegendSize.Minimum = 0D; - this.numericBoxLegendSize.MouseDirection = Crystallography.VH_DirectionEnum.Horizontal; - this.numericBoxLegendSize.MouseSpeed = 1D; - this.numericBoxLegendSize.Multiline = false; - this.numericBoxLegendSize.Name = "numericBoxLegendSize"; - this.numericBoxLegendSize.RadianValue = 0.87266462599716477D; - this.numericBoxLegendSize.ReadOnly = false; - this.numericBoxLegendSize.RestrictLimitValue = true; - this.numericBoxLegendSize.ShowFraction = false; - this.numericBoxLegendSize.ShowPositiveSign = false; - this.numericBoxLegendSize.ShowUpDown = true; - this.numericBoxLegendSize.SkipEventDuringInput = true; - this.numericBoxLegendSize.SmartIncrement = true; - this.numericBoxLegendSize.TextBoxBackColor = System.Drawing.SystemColors.Window; - this.numericBoxLegendSize.TextBoxForeColor = System.Drawing.SystemColors.WindowText; - this.numericBoxLegendSize.TextFont = new System.Drawing.Font("Segoe UI Symbol", 9.75F); - this.numericBoxLegendSize.ThonsandsSeparator = true; - this.numericBoxLegendSize.UpDown_Increment = 1D; - this.numericBoxLegendSize.Value = 50D; - this.numericBoxLegendSize.WordWrap = true; - this.numericBoxLegendSize.ValueChanged += new Crystallography.Controls.NumericBox.MyEventHandler(this.numericBoxLegendSize_ValueChanged); + this.numericBoxLightSize.AllowMouseControl = false; + resources.ApplyResources(this.numericBoxLightSize, "numericBoxLightSize"); + this.numericBoxLightSize.BackColor = System.Drawing.Color.Transparent; + this.numericBoxLightSize.DecimalPlaces = 0; + this.numericBoxLightSize.FooterBackColor = System.Drawing.Color.Transparent; + this.numericBoxLightSize.FooterForeColor = System.Drawing.SystemColors.ControlText; + this.numericBoxLightSize.HeaderBackColor = System.Drawing.Color.Transparent; + this.numericBoxLightSize.HeaderForeColor = System.Drawing.SystemColors.ControlText; + this.numericBoxLightSize.HeaderMargin = new System.Windows.Forms.Padding(0); + this.numericBoxLightSize.Maximum = 200D; + this.numericBoxLightSize.Minimum = 0D; + this.numericBoxLightSize.MouseDirection = Crystallography.VH_DirectionEnum.Horizontal; + this.numericBoxLightSize.MouseSpeed = 1D; + this.numericBoxLightSize.Multiline = false; + this.numericBoxLightSize.Name = "numericBoxLightSize"; + this.numericBoxLightSize.RadianValue = 1.3962634015954636D; + this.numericBoxLightSize.ReadOnly = true; + this.numericBoxLightSize.RestrictLimitValue = true; + this.numericBoxLightSize.ShowFraction = false; + this.numericBoxLightSize.ShowPositiveSign = false; + this.numericBoxLightSize.ShowUpDown = true; + this.numericBoxLightSize.SkipEventDuringInput = true; + this.numericBoxLightSize.SmartIncrement = true; + this.numericBoxLightSize.TextBoxBackColor = System.Drawing.SystemColors.Window; + this.numericBoxLightSize.TextBoxForeColor = System.Drawing.SystemColors.WindowText; + this.numericBoxLightSize.TextFont = new System.Drawing.Font("Segoe UI Symbol", 9.75F); + this.numericBoxLightSize.ThonsandsSeparator = true; + this.numericBoxLightSize.UpDown_Increment = 1D; + this.numericBoxLightSize.Value = 80D; + this.numericBoxLightSize.WordWrap = true; + this.numericBoxLightSize.ValueChanged += new Crystallography.Controls.NumericBox.MyEventHandler(this.numericBoxLightSize_ValueChanged); + // + // groupBox5 + // + this.groupBox5.Controls.Add(this.comboBoxTransparency); + resources.ApplyResources(this.groupBox5, "groupBox5"); + this.groupBox5.Name = "groupBox5"; + this.groupBox5.TabStop = false; + // + // comboBoxTransparency + // + this.comboBoxTransparency.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxTransparency.DropDownWidth = 250; + this.comboBoxTransparency.FormattingEnabled = true; + this.comboBoxTransparency.Items.AddRange(new object[] { + resources.GetString("comboBoxTransparency.Items"), + resources.GetString("comboBoxTransparency.Items1")}); + resources.ApplyResources(this.comboBoxTransparency, "comboBoxTransparency"); + this.comboBoxTransparency.Name = "comboBoxTransparency"; + this.comboBoxTransparency.SelectedIndexChanged += new System.EventHandler(this.comboBoxTransparency_SelectedIndexChanged); + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.comboBoxRenderignQuality); + resources.ApplyResources(this.groupBox3, "groupBox3"); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.TabStop = false; + // + // comboBoxRenderignQuality + // + this.comboBoxRenderignQuality.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxRenderignQuality.FormattingEnabled = true; + this.comboBoxRenderignQuality.Items.AddRange(new object[] { + resources.GetString("comboBoxRenderignQuality.Items"), + resources.GetString("comboBoxRenderignQuality.Items1"), + resources.GetString("comboBoxRenderignQuality.Items2")}); + resources.ApplyResources(this.comboBoxRenderignQuality, "comboBoxRenderignQuality"); + this.comboBoxRenderignQuality.Name = "comboBoxRenderignQuality"; + this.comboBoxRenderignQuality.SelectedIndexChanged += new System.EventHandler(this.comboBoxRenderignQuality_SelectedIndexChanged); + // + // checkBoxDepthCueing + // + resources.ApplyResources(this.checkBoxDepthCueing, "checkBoxDepthCueing"); + this.checkBoxDepthCueing.Checked = true; + this.checkBoxDepthCueing.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxDepthCueing.Name = "checkBoxDepthCueing"; + this.checkBoxDepthCueing.UseVisualStyleBackColor = true; + this.checkBoxDepthCueing.CheckedChanged += new System.EventHandler(this.checkBoxDepthCueing_CheckedChanged); + // + // groupBoxDepthCueing + // + this.groupBoxDepthCueing.Controls.Add(this.trackBarAdvancedDepthCueingNear); + this.groupBoxDepthCueing.Controls.Add(this.label6); + this.groupBoxDepthCueing.Controls.Add(this.trackBarAdvancedDepthCueingFar); + this.groupBoxDepthCueing.Controls.Add(this.label5); + resources.ApplyResources(this.groupBoxDepthCueing, "groupBoxDepthCueing"); + this.groupBoxDepthCueing.Name = "groupBoxDepthCueing"; + this.groupBoxDepthCueing.TabStop = false; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.comboBoxProjectionMode); + this.groupBox1.Controls.Add(this.trackBarPerspective); + resources.ApplyResources(this.groupBox1, "groupBox1"); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.TabStop = false; + // + // comboBoxProjectionMode + // + this.comboBoxProjectionMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxProjectionMode.FormattingEnabled = true; + this.comboBoxProjectionMode.Items.AddRange(new object[] { + resources.GetString("comboBoxProjectionMode.Items"), + resources.GetString("comboBoxProjectionMode.Items1")}); + resources.ApplyResources(this.comboBoxProjectionMode, "comboBoxProjectionMode"); + this.comboBoxProjectionMode.Name = "comboBoxProjectionMode"; + this.comboBoxProjectionMode.SelectedIndexChanged += new System.EventHandler(this.comboBoxProjectionMode_SelectedIndexChanged); + // + // trackBarPerspective + // + resources.ApplyResources(this.trackBarPerspective, "trackBarPerspective"); + this.trackBarPerspective.Maximum = 120; + this.trackBarPerspective.Name = "trackBarPerspective"; + this.trackBarPerspective.SmallChange = 10; + this.trackBarPerspective.TickFrequency = 3; + this.trackBarPerspective.Value = 100; + this.trackBarPerspective.Scroll += new System.EventHandler(this.trackBarPerspective_Scroll); + // + // buttonLikeVesta + // + resources.ApplyResources(this.buttonLikeVesta, "buttonLikeVesta"); + this.buttonLikeVesta.Name = "buttonLikeVesta"; + this.buttonLikeVesta.UseVisualStyleBackColor = true; + this.buttonLikeVesta.Click += new System.EventHandler(this.buttonLikeVesta_Click); // // toolStrip1 // @@ -1457,6 +1599,50 @@ private void InitializeComponent() this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4"; this.dataGridViewTextBoxColumn4.ReadOnly = true; // + // trackBarAdvancedDepthCueingFar + // + resources.ApplyResources(this.trackBarAdvancedDepthCueingFar, "trackBarAdvancedDepthCueingFar"); + this.trackBarAdvancedDepthCueingFar.ControlHeight = 24; + this.trackBarAdvancedDepthCueingFar.DecimalPlaces = 1; + this.trackBarAdvancedDepthCueingFar.LogScrollBar = false; + this.trackBarAdvancedDepthCueingFar.Maximum = 30D; + this.trackBarAdvancedDepthCueingFar.Minimum = -30D; + this.trackBarAdvancedDepthCueingFar.Name = "trackBarAdvancedDepthCueingFar"; + this.trackBarAdvancedDepthCueingFar.NumericBoxSize = 84; + this.trackBarAdvancedDepthCueingFar.Orientation = System.Windows.Forms.Orientation.Vertical; + this.trackBarAdvancedDepthCueingFar.Smart_Increment = true; + this.trackBarAdvancedDepthCueingFar.TickStyle = System.Windows.Forms.TickStyle.BottomRight; + this.trackBarAdvancedDepthCueingFar.UpDown_Increment = 1D; + this.trackBarAdvancedDepthCueingFar.Value = -15D; + this.trackBarAdvancedDepthCueingFar.ValueChanged += new Crystallography.Controls.TrackBarAdvanced.ValueChangedDelegate(this.trackBarAdvanced2_ValueChanged); + // + // trackBarAdvancedDepthCueingNear + // + resources.ApplyResources(this.trackBarAdvancedDepthCueingNear, "trackBarAdvancedDepthCueingNear"); + this.trackBarAdvancedDepthCueingNear.ControlHeight = 24; + this.trackBarAdvancedDepthCueingNear.DecimalPlaces = 1; + this.trackBarAdvancedDepthCueingNear.LogScrollBar = false; + this.trackBarAdvancedDepthCueingNear.Maximum = 30D; + this.trackBarAdvancedDepthCueingNear.Minimum = -30D; + this.trackBarAdvancedDepthCueingNear.Name = "trackBarAdvancedDepthCueingNear"; + this.trackBarAdvancedDepthCueingNear.NumericBoxSize = 84; + this.trackBarAdvancedDepthCueingNear.Orientation = System.Windows.Forms.Orientation.Vertical; + this.trackBarAdvancedDepthCueingNear.Smart_Increment = true; + this.trackBarAdvancedDepthCueingNear.TickStyle = System.Windows.Forms.TickStyle.BottomRight; + this.trackBarAdvancedDepthCueingNear.UpDown_Increment = 1D; + this.trackBarAdvancedDepthCueingNear.Value = 5D; + this.trackBarAdvancedDepthCueingNear.ValueChanged += new Crystallography.Controls.TrackBarAdvanced.ValueChangedDelegate(this.trackBarAdvanced2_ValueChanged); + // + // label5 + // + resources.ApplyResources(this.label5, "label5"); + this.label5.Name = "label5"; + // + // label6 + // + resources.ApplyResources(this.label6, "label6"); + this.label6.Name = "label6"; + // // FormStructureViewer // resources.ApplyResources(this, "$this"); @@ -1500,8 +1686,17 @@ private void InitializeComponent() this.tabPageCoordinateInfromatin.ResumeLayout(false); this.tabPageInformation.ResumeLayout(false); this.tabPageInformation.PerformLayout(); + this.flowLayoutPanel4.ResumeLayout(false); + this.flowLayoutPanel4.PerformLayout(); this.tabPage1.ResumeLayout(false); this.tabPage1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox5.ResumeLayout(false); + this.groupBox3.ResumeLayout(false); + this.groupBoxDepthCueing.ResumeLayout(false); + this.groupBoxDepthCueing.PerformLayout(); + this.groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.trackBarPerspective)).EndInit(); this.toolStrip1.ResumeLayout(false); this.toolStrip1.PerformLayout(); this.menuStrip1.ResumeLayout(false); @@ -1626,5 +1821,23 @@ private void InitializeComponent() private System.Windows.Forms.Button buttonLikeVesta; private System.Windows.Forms.ToolStripMenuItem toolToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem iLikeVESTAToolStripMenuItem; + private System.Windows.Forms.Label labelGraphicsDriver; + private System.Windows.Forms.Label labelGraphicsCard; + private System.Windows.Forms.Label labelOpenGLversion; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.TrackBar trackBarPerspective; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel4; + private System.Windows.Forms.CheckBox checkBoxDepthCueing; + private System.Windows.Forms.GroupBox groupBoxDepthCueing; + private System.Windows.Forms.ComboBox comboBoxRenderignQuality; + private System.Windows.Forms.ComboBox comboBoxProjectionMode; + private System.Windows.Forms.GroupBox groupBox5; + private System.Windows.Forms.ComboBox comboBoxTransparency; + private Crystallography.Controls.TrackBarAdvanced trackBarAdvancedDepthCueingNear; + private Crystallography.Controls.TrackBarAdvanced trackBarAdvancedDepthCueingFar; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; } } \ No newline at end of file diff --git a/ReciPro/StructureViewer/FormStructureViewer.resx b/ReciPro/StructureViewer/FormStructureViewer.resx index 5c167e36..2fe69694 100644 --- a/ReciPro/StructureViewer/FormStructureViewer.resx +++ b/ReciPro/StructureViewer/FormStructureViewer.resx @@ -128,94 +128,6 @@ Horizontal - - Bottom, Left - - - Segoe UI Symbol, 9pt - - - 0, 416 - - - 0, 0, 0, 0 - - - 80, 80 - - - - 1 - - - glControlAxes - - - Crystallography.OpenGL.GLControlAlpha, Crystallography.OpenGL, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null - - - splitContainer1.Panel1 - - - 0 - - - Segoe UI Symbol, 9pt - - - 0, 0 - - - 0, 0, 0, 0 - - - 80, 80 - - - 0 - - - glControlLight - - - Crystallography.OpenGL.GLControlAlpha, Crystallography.OpenGL, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null - - - splitContainer1.Panel1 - - - 1 - - - Fill - - - Segoe UI Symbol, 9pt - - - 0, 0 - - - 0, 0, 0, 0 - - - 601, 496 - - - 1 - - - glControlMain - - - Crystallography.OpenGL.GLControlAlpha, Crystallography.OpenGL, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null - - - splitContainer1.Panel1 - - - 2 - GrowAndShrink @@ -234,6 +146,7 @@ 54, 496 + 96 @@ -247,7 +160,7 @@ splitContainer1.Panel1 - 3 + 0 splitContainer1.Panel1 @@ -547,7 +460,7 @@ numericBoxCRange - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null tabPageBoundUnitcell @@ -604,7 +517,7 @@ numericBoxBRange - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null tabPageBoundUnitcell @@ -661,7 +574,7 @@ numericBoxARange - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null tabPageBoundUnitcell @@ -718,7 +631,7 @@ numericBoxCCenter - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null tabPageBoundUnitcell @@ -775,7 +688,7 @@ numericBoxBCenter - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null tabPageBoundUnitcell @@ -832,7 +745,7 @@ numericBoxACenter - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null tabPageBoundUnitcell @@ -1150,7 +1063,7 @@ numericBoxBoundPlanesOpacity - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null flowLayoutPanel1 @@ -1565,7 +1478,7 @@ numericBoxCellPlaneAlpha - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null groupBoxShowUnitCell @@ -1619,7 +1532,7 @@ colorControlCellPlane - Crystallography.Controls.ColorControl, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.ColorControl, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null groupBoxShowUnitCell @@ -1673,7 +1586,7 @@ colorControlCellEdge - Crystallography.Controls.ColorControl, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.ColorControl, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null groupBoxShowUnitCell @@ -1730,7 +1643,7 @@ numericBoxCellTransrationC - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null groupBoxShowUnitCell @@ -1787,7 +1700,7 @@ numericBoxCellTransrationB - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null groupBoxShowUnitCell @@ -1844,7 +1757,7 @@ numericBoxCellTransrationA - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null groupBoxShowUnitCell @@ -2318,7 +2231,7 @@ numericBoxLatticePlaneOpacity - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null flowLayoutPanel3 @@ -2405,7 +2318,7 @@ atomCoordinateTable1 - Crystallography.Controls.AtomCoordinateTable, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.AtomCoordinateTable, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null tabPageCoordinateInfromatin @@ -2450,7 +2363,7 @@ Vertical - 641, 227 + 641, 214 0 @@ -2467,6 +2380,135 @@ 0 + + True + + + GrowAndShrink + + + True + + + Segoe UI Symbol, 8pt + + + 3, 0 + + + 86, 13 + + + 2 + + + Graphics card: + + + labelGraphicsCard + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + flowLayoutPanel4 + + + 0 + + + True + + + Segoe UI Symbol, 8pt + + + NoControl + + + 95, 0 + + + 93, 13 + + + 2 + + + Graphics driver: + + + labelGraphicsDriver + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + flowLayoutPanel4 + + + 1 + + + True + + + Segoe UI Symbol, 8pt + + + NoControl + + + 194, 0 + + + 98, 13 + + + 2 + + + OpenGL version: + + + labelOpenGLversion + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + flowLayoutPanel4 + + + 2 + + + Bottom + + + TopDown + + + 3, 217 + + + 641, 13 + + + 7 + + + flowLayoutPanel4 + + + System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPageInformation + + + 1 + 4, 26 @@ -2494,98 +2536,62 @@ 6 - - Top, Right - - - True - - - GrowAndShrink - - - NoControl - - - 556, 6 - - - 88, 27 - - - 1 - - - I like Vesta!! - - - buttonLikeVesta - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage1 - - - 0 - - + GrowAndShrink - + Segoe UI Symbol, 9.75pt - + Segoe UI Symbol, 9.75pt - + 0, 0, 0, 0 - + - + Segoe UI Symbol, 9.75pt - - Light ball size + + Legend size - - 16, 86 + + 4, 23 - + 0, 0, 0, 0 - + 1000, 27 - + 1, 25 - + 0, 0, 1, 0 - - 133, 27 + + 123, 27 - + 0 - + - - numericBoxLightSize + + numericBoxLegendSize - - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null - - tabPage1 + + groupBox2 - - 1 + + 0 GrowAndShrink @@ -2609,7 +2615,7 @@ Axes size - 42, 51 + 133, 23 0, 0, 0, 0 @@ -2636,71 +2642,506 @@ numericBoxAxesSize - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null - tabPage1 + groupBox2 - 2 + 1 - + GrowAndShrink - + Segoe UI Symbol, 9.75pt - + Segoe UI Symbol, 9.75pt - + 0, 0, 0, 0 - + - + Segoe UI Symbol, 9.75pt - - Legend size + + Light ball size - - 26, 16 + + 247, 23 - + 0, 0, 0, 0 - + 1000, 27 - + 1, 25 - + 0, 0, 1, 0 - - 123, 27 + + 133, 27 - + 0 - + - - numericBoxLegendSize + + numericBoxLightSize - - Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.6.912, Culture=neutral, PublicKeyToken=null + + Crystallography.Controls.NumericBox, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null - + + groupBox2 + + + 2 + + + 3, 0 + + + 387, 52 + + + 5 + + + Sub control size + + + groupBox2 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tabPage1 - + + 0 + + + Approximate (Z depth sorting) + + + Perfect (Order Independent Transparency) + + + 6, 21 + + + 128, 25 + + + 7 + + + comboBoxTransparency + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 0 + + + 416, 58 + + + 140, 52 + + + 6 + + + Transparency mode + + + groupBox5 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage1 + + + 1 + + + Low + + + Middle + + + High + + + 6, 21 + + + 128, 25 + + + 7 + + + comboBoxRenderignQuality + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 0 + + + 416, 0 + + + 140, 52 + + + 6 + + + Rendering quality + + + groupBox3 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage1 + + + 2 + + + True + + + 10, 112 + + + 104, 21 + + + 0 + + + Depth cueing + + + checkBoxDepthCueing + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage1 + + + 3 + + + GrowAndShrink + + + メイリオ, 9pt + + + Segoe UI Symbol, 9.75pt + + + + + + Segoe UI Symbol, 9.75pt + + + + + + 45, 52 + + + 0, 0, 0, 0 + + + 335, 24 + + + 7 + + + trackBarAdvancedDepthCueingNear + + + Crystallography.Controls.TrackBarAdvanced, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null + + + groupBoxDepthCueing + + + 0 + + + True + + + NoControl + + + 16, 28 + + + 26, 17 + + + 1 + + + Far + + + label6 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBoxDepthCueing + + + 1 + + + GrowAndShrink + + + メイリオ, 9pt + + + Segoe UI Symbol, 9.75pt + + + + + + Segoe UI Symbol, 9.75pt + + + + + + 45, 23 + + + 0, 0, 0, 0 + + + 335, 24 + + + 7 + + + trackBarAdvancedDepthCueingFar + + + Crystallography.Controls.TrackBarAdvanced, Crystallography.Controls, Version=2020.5.9.1002, Culture=neutral, PublicKeyToken=null + + + groupBoxDepthCueing + + + 2 + + + True + + + 5, 57 + + + 37, 17 + + + 1 + + + Near + + + label5 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBoxDepthCueing + + 3 + + 3, 113 + + + 387, 83 + + + 4 + + + + + + groupBoxDepthCueing + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage1 + + + 4 + + + Orhographic + + + Perspective + + + 4, 21 + + + 99, 25 + + + 7 + + + comboBoxProjectionMode + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 0 + + + False + + + 105, 21 + + + 0, 0, 0, 0 + + + 275, 24 + + + 5 + + + trackBarPerspective + + + System.Windows.Forms.TrackBar, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 1 + + + 3, 55 + + + 387, 52 + + + 4 + + + Projection + + + groupBox1 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage1 + + + 5 + + + Bottom, Right + + + True + + + GrowAndShrink + + + NoControl + + + 560, 206 + + + 88, 27 + + + 1 + + + I like Vesta!! + + + buttonLikeVesta + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage1 + + + 6 + 4, 26 diff --git a/ReciPro/Version.cs b/ReciPro/Version.cs index 456d27b3..652994e6 100644 --- a/ReciPro/Version.cs +++ b/ReciPro/Version.cs @@ -10,6 +10,7 @@ internal static class Version static public string History = "History" + + "\r\n ver4.770(2020/05/09) Improved rendering quality of 'Structure Viewer'." + "\r\n ver4.769(2020/05/06) Improved GUI on 'Structure Viewer'." + "\r\n ver4.768(2020/05/06) Improved GUI on 'Structure Viewer'." + "\r\n ver4.767(2020/05/05) Improved rendering speed of 'Structure Viewer' and fixed some bugs." +