public void Read(BinaryReader _R) { m_wsPosition.Set(_R.ReadSingle(), _R.ReadSingle(), _R.ReadSingle()); m_planes.Clear(); int planesCount = _R.ReadInt32(); for (int planeIndex = 0; planeIndex < planesCount; planeIndex++) { plane_t P = new plane_t(this); m_planes.Add(P); P.Read(_R); } }
public line_t(plane_t _owner) { m_owner = _owner; }
public line_t( plane_t _owner ) { m_owner = _owner; }
public void Draw(DebuggerForm _owner, bool _isRemovedLine, bool _isSelected) { if (_owner.checkBoxHideNonPlaneLines.Checked && m_owner.m_index != _owner.integerTrackbarControlPlane.Value) { return; // Hide lines that are not part of the currently selected plane } float offset = _owner.floatTrackbarControlLinesOffset.Value; float4 color = _isRemovedLine ? new float4(1, 0, 0, 0.25f) : (m_clipperPlaneIndex == ~0U ? new float4(1, 1, 0, 1) : new float4(0.1f, 0.5f, 0, 1)); if (_isSelected && _owner.checkBoxDebugLine.Checked) { color = _owner.SelectedLineColor(color); } if (!_isRemovedLine) { if (!m_owner.m_owner.m_planes[(int)m_planeIndices[1]].m_isValid) { color = _owner.FlashError(color); // It's an error for a line to reference an invalid plane and still be part of this plane! } } float3 wsPosition = m_wsPosition + offset * m_wsOrthoDirection; float length0 = Math.Max(-1000.0f, m_vertices[0].m_linePosition) + offset; float length1 = Math.Min(1000.0f, m_vertices[1].m_linePosition) - offset; float3 wsStart = wsPosition + length0 * m_wsDirection; float3 wsEnd = wsPosition + length1 * m_wsDirection; _owner.DrawLine(wsStart, wsEnd, m_wsOrthoDirection, -1.0f, color); // Draw ortho arrow pointing inward const float arrowSize = 0.2f; float3 wsCenter = 0.5f * (wsStart + wsEnd); if (_owner.checkBoxShowLineNormals.Checked) { _owner.DrawArrow(wsCenter, wsCenter + arrowSize * m_wsOrthoDirection, m_owner.m_wsNormal, color); } if (_owner.checkBoxShowLineDirections.Checked) { _owner.DrawArrow(wsCenter, wsCenter + m_wsDirection, m_wsOrthoDirection, color); // Draw line direction } if (_isRemovedLine) { return; } // Draw vertices bool isInvalidStart = false; float4 startVertexColor = new float4(0, 1, 0, 0.5f); if (m_vertices[0].m_planeIndex == ~0U) { startVertexColor = new float4(1, 1, 1, 0.2f); } else { plane_t cuttingPlane = m_owner.m_owner.m_planes[(int)m_vertices[0].m_planeIndex]; if (!cuttingPlane.m_isValid) { startVertexColor = _owner.FlashError(startVertexColor); // It's an error for a vertex to reference an invalid plane and still be part of this plane! isInvalidStart = true; } } if (_isSelected && _owner.checkBoxDebugVertex.Checked && _owner.integerTrackbarControlVertex.Value == 0) { startVertexColor = _owner.SelectedVertexColor(startVertexColor); } bool isInvalidEnd = false; float4 endVertexColor = new float4(0, 1, 0, 0.5f); if (m_vertices[1].m_planeIndex == ~0U) { endVertexColor = new float4(1, 1, 1, 0.2f); } else { plane_t cuttingPlane = m_owner.m_owner.m_planes[(int)m_vertices[1].m_planeIndex]; if (!cuttingPlane.m_isValid) { endVertexColor = _owner.FlashError(endVertexColor); // It's an error for a vertex to reference an invalid plane and still be part of this plane! isInvalidEnd = true; } } if (_isSelected && _owner.checkBoxDebugVertex.Checked && _owner.integerTrackbarControlVertex.Value == 1) { endVertexColor = _owner.SelectedVertexColor(endVertexColor); } _owner.DrawPoint(wsStart, isInvalidStart ? -8.0f : -4.0f, startVertexColor); _owner.DrawPoint(wsEnd, isInvalidEnd ? -8.0f : -4.0f, endVertexColor); }
public void Read( BinaryReader _R ) { m_wsPosition.Set( _R.ReadSingle(), _R.ReadSingle(), _R.ReadSingle() ); m_planes.Clear(); int planesCount = _R.ReadInt32(); for ( int planeIndex=0; planeIndex < planesCount; planeIndex++ ) { plane_t P = new plane_t( this ); m_planes.Add( P ); P.Read( _R ); } }