Fix bug that MDI window cannot created.
Add DepthBias property for I3DObject.
@@ -139,6 +139,7 @@ | ||
139 | 139 | protected UInt32 _id = 0; |
140 | 140 | protected object _tag; |
141 | 141 | protected XnaFilter filter; |
142 | + protected float _bias; | |
142 | 143 | private Vector3 pos; |
143 | 144 | protected TerrainTemplate template; |
144 | 145 |
@@ -149,6 +150,7 @@ | ||
149 | 150 | this._id = id; |
150 | 151 | this.template = templ; |
151 | 152 | this.filter = null; |
153 | + this._bias = 0f; | |
152 | 154 | this.pos = Vector3.Zero; |
153 | 155 | this._tag = null; |
154 | 156 | } |
@@ -190,6 +192,10 @@ | ||
190 | 192 | filter = (XnaFilter)value; |
191 | 193 | } |
192 | 194 | } |
195 | + public float DepthBias { | |
196 | + get { return _bias; } | |
197 | + set { _bias = value; } | |
198 | + } | |
193 | 199 | #endregion |
194 | 200 | |
195 | 201 | public virtual void RenderSelf(XnaSurface surface, DefaultEffect effect) { |
@@ -197,6 +203,13 @@ | ||
197 | 203 | Matrix wback = effect.World; |
198 | 204 | effect.World = Matrix.CreateTranslation(Position3D); |
199 | 205 | 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 | + } | |
200 | 213 | template.Draw(effect, this); |
201 | 214 | } |
202 | 215 |
@@ -19,6 +19,7 @@ | ||
19 | 19 | protected UInt32 _id = 0; |
20 | 20 | protected object _tag; |
21 | 21 | protected XnaFilter filter; |
22 | + protected float _bias = 0f; | |
22 | 23 | private XnaTexture texture; |
23 | 24 | |
24 | 25 | public X3DObject(UInt32 id, XnaTexture texture, object tag) |
@@ -70,6 +71,11 @@ | ||
70 | 71 | filter = (XnaFilter)value; |
71 | 72 | } |
72 | 73 | } |
74 | + | |
75 | + public float DepthBias { | |
76 | + get { return _bias; } | |
77 | + set { _bias = value; } | |
78 | + } | |
73 | 79 | #endregion |
74 | 80 | |
75 | 81 | public virtual void RenderSelf(XnaSurface surface, DefaultEffect ef) |
@@ -14,6 +14,7 @@ | ||
14 | 14 | |
15 | 15 | public class Structure : X3DObject, ICubicStructure |
16 | 16 | { |
17 | + //private static RasterizerState state = new RasterizerState(); | |
17 | 18 | private Vector3 size; |
18 | 19 | private Vector3 pos; |
19 | 20 | private XnaRect region; |
@@ -82,6 +83,13 @@ | ||
82 | 83 | //effect.VertexColorEnabled = false; |
83 | 84 | //effect.TextureEnabled = true; |
84 | 85 | 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 | + } | |
85 | 93 | |
86 | 94 | // 平行移動を適用 |
87 | 95 | Matrix wback = effect.World; |
@@ -73,6 +73,7 @@ | ||
73 | 73 | UInt32 ID { get; set; } |
74 | 74 | //object Tag { get; set; } |
75 | 75 | IEffectFilter Effect { get; set; } |
76 | + float DepthBias { get; set; } | |
76 | 77 | } |
77 | 78 | |
78 | 79 | public interface IEffectFilter{ |
@@ -165,7 +165,6 @@ | ||
165 | 165 | this.panelCenter.BackColor = System.Drawing.SystemColors.AppWorkspace; |
166 | 166 | this.panelCenter.Dock = System.Windows.Forms.DockStyle.Fill; |
167 | 167 | this.panelCenter.DockBackColor = System.Drawing.SystemColors.AppWorkspace; |
168 | - this.panelCenter.DocumentStyle = WeifenLuo.WinFormsUI.Docking.DocumentStyle.SystemMdi; | |
169 | 168 | this.panelCenter.Location = new System.Drawing.Point(0, 24); |
170 | 169 | this.panelCenter.Name = "panelCenter"; |
171 | 170 | this.panelCenter.Size = new System.Drawing.Size(992, 677); |
@@ -59,9 +59,12 @@ | ||
59 | 59 | // |
60 | 60 | // MdiChildFrame |
61 | 61 | // |
62 | + this.AllowEndUserDocking = false; | |
62 | 63 | this.ClientSize = new System.Drawing.Size(640, 480); |
64 | + this.DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.Document; | |
63 | 65 | this.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); |
64 | 66 | this.Name = "MdiChildFrame"; |
67 | + this.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.Document; | |
65 | 68 | this.Text = "MdiChildFrame"; |
66 | 69 | this.ResumeLayout(false); |
67 | 70 |