• R/O
  • SSH
  • HTTPS

freetrain: Commit


Commit MetaInfo

Revision102 (tree)
Zeit2013-06-25 23:22:01
Autorc477

Log Message

Fix bug that MDI window cannot created.
Add DepthBias property for I3DObject.

Ändern Zusammenfassung

Diff

--- NeoFT/xna/NFT.XNA/XnaTerrain.cs (revision 101)
+++ NeoFT/xna/NFT.XNA/XnaTerrain.cs (revision 102)
@@ -139,6 +139,7 @@
139139 protected UInt32 _id = 0;
140140 protected object _tag;
141141 protected XnaFilter filter;
142+ protected float _bias;
142143 private Vector3 pos;
143144 protected TerrainTemplate template;
144145
@@ -149,6 +150,7 @@
149150 this._id = id;
150151 this.template = templ;
151152 this.filter = null;
153+ this._bias = 0f;
152154 this.pos = Vector3.Zero;
153155 this._tag = null;
154156 }
@@ -190,6 +192,10 @@
190192 filter = (XnaFilter)value;
191193 }
192194 }
195+ public float DepthBias {
196+ get { return _bias; }
197+ set { _bias = value; }
198+ }
193199 #endregion
194200
195201 public virtual void RenderSelf(XnaSurface surface, DefaultEffect effect) {
@@ -197,6 +203,13 @@
197203 Matrix wback = effect.World;
198204 effect.World = Matrix.CreateTranslation(Position3D);
199205 effect.HitTestID = this.ID;
206+ if (_bias > 0f) {
207+ RasterizerState state = new RasterizerState();
208+ state.DepthBias = this._bias;
209+ surface.GraphicsDevice.RasterizerState = state;
210+ } else {
211+ surface.GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;
212+ }
200213 template.Draw(effect, this);
201214 }
202215
--- NeoFT/xna/NFT.XNA/Xna3DObject.cs (revision 101)
+++ NeoFT/xna/NFT.XNA/Xna3DObject.cs (revision 102)
@@ -19,6 +19,7 @@
1919 protected UInt32 _id = 0;
2020 protected object _tag;
2121 protected XnaFilter filter;
22+ protected float _bias = 0f;
2223 private XnaTexture texture;
2324
2425 public X3DObject(UInt32 id, XnaTexture texture, object tag)
@@ -70,6 +71,11 @@
7071 filter = (XnaFilter)value;
7172 }
7273 }
74+
75+ public float DepthBias {
76+ get { return _bias; }
77+ set { _bias = value; }
78+ }
7379 #endregion
7480
7581 public virtual void RenderSelf(XnaSurface surface, DefaultEffect ef)
--- NeoFT/xna/NFT.XNA/XnaStructure.cs (revision 101)
+++ NeoFT/xna/NFT.XNA/XnaStructure.cs (revision 102)
@@ -14,6 +14,7 @@
1414
1515 public class Structure : X3DObject, ICubicStructure
1616 {
17+ //private static RasterizerState state = new RasterizerState();
1718 private Vector3 size;
1819 private Vector3 pos;
1920 private XnaRect region;
@@ -82,6 +83,13 @@
8283 //effect.VertexColorEnabled = false;
8384 //effect.TextureEnabled = true;
8485 GraphicsDevice.SetVertexBuffer(vertexBuffer);
86+ if (_bias > 0f) {
87+ RasterizerState state = new RasterizerState();
88+ state.DepthBias = this._bias;
89+ GraphicsDevice.RasterizerState = state;
90+ } else {
91+ GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;
92+ }
8593
8694 // 平行移動を適用
8795 Matrix wback = effect.World;
--- NeoFT/framework/framework/drawing/I3DObject.cs (revision 101)
+++ NeoFT/framework/framework/drawing/I3DObject.cs (revision 102)
@@ -73,6 +73,7 @@
7373 UInt32 ID { get; set; }
7474 //object Tag { get; set; }
7575 IEffectFilter Effect { get; set; }
76+ float DepthBias { get; set; }
7677 }
7778
7879 public interface IEffectFilter{
--- NeoFT/framework/ui/mainframe/MainFrame.cs (revision 101)
+++ NeoFT/framework/ui/mainframe/MainFrame.cs (revision 102)
@@ -165,7 +165,6 @@
165165 this.panelCenter.BackColor = System.Drawing.SystemColors.AppWorkspace;
166166 this.panelCenter.Dock = System.Windows.Forms.DockStyle.Fill;
167167 this.panelCenter.DockBackColor = System.Drawing.SystemColors.AppWorkspace;
168- this.panelCenter.DocumentStyle = WeifenLuo.WinFormsUI.Docking.DocumentStyle.SystemMdi;
169168 this.panelCenter.Location = new System.Drawing.Point(0, 24);
170169 this.panelCenter.Name = "panelCenter";
171170 this.panelCenter.Size = new System.Drawing.Size(992, 677);
--- NeoFT/framework/ui/mainframe/MdiChildFrame.cs (revision 101)
+++ NeoFT/framework/ui/mainframe/MdiChildFrame.cs (revision 102)
@@ -59,9 +59,12 @@
5959 //
6060 // MdiChildFrame
6161 //
62+ this.AllowEndUserDocking = false;
6263 this.ClientSize = new System.Drawing.Size(640, 480);
64+ this.DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.Document;
6365 this.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
6466 this.Name = "MdiChildFrame";
67+ this.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.Document;
6568 this.Text = "MdiChildFrame";
6669 this.ResumeLayout(false);
6770
Show on old repository browser