Beispiel #1
0
                public void             Draw(DebuggerForm _owner, bool _isSelected)
                {
                    // Render the plane
                    float4 color = m_isValid ? m_isClosing ? new float4(1, 0.5f, 0.2f, 0.2f) : new float4(1, 1, 1, 0.2f) : new float4(1, 0, 0, 0.2f);

                    if (_isSelected && _owner.checkBoxDebugPlane.Checked)
                    {
                        color = _owner.SelectedPlaneColor(color);
                    }

                    if (!_owner.checkBoxHidePlanes.Checked || _isSelected)
                    {
                        _owner.DrawPlane(m_wsPosition, m_wsNormal, ComputeTangent(), 10.0f, 10.0f, 10.0f, color, false);
                    }

                    // Render the lines
                    for (int lineIndex = 0; lineIndex < m_lines.Count; lineIndex++)
                    {
                        m_lines[lineIndex].Draw(_owner, !m_isValid, _isSelected && lineIndex == _owner.integerTrackbarControlLine.Value);
                    }

                    if (!_owner.checkBoxHideRemovedLines.Checked || (_isSelected && _owner.checkBoxDebugPlane.Checked))
                    {
                        for (int lineIndex = 0; lineIndex < m_removedLines.Count; lineIndex++)
                        {
                            m_removedLines[lineIndex].Draw(_owner, true, false);
                        }
                    }
                }
Beispiel #2
0
            public void             Draw(DebuggerForm _owner, bool _isSelected)
            {
                float4 cellColor = new float4(1, 0, 0, 1);

                if (_isSelected && _owner.checkBoxDebugCell.Checked)
                {
                    cellColor = _owner.SelectedCellColor(cellColor);
                }
                _owner.DrawPoint(m_wsPosition, -10.0f, cellColor);

                for (int planeIndex = 0; planeIndex < m_planes.Count; planeIndex++)
                {
                    m_planes[planeIndex].Draw(_owner, _isSelected && planeIndex == _owner.integerTrackbarControlPlane.Value);
                }
            }
Beispiel #3
0
                    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);
                    }
Beispiel #4
0
                    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 );
                    }
Beispiel #5
0
                public void Draw( DebuggerForm _owner, bool _isSelected )
                {
                    // Render the plane
                    float4	color = m_isValid ? m_isClosing ? new float4( 1, 0.5f, 0.2f, 0.2f ) : new float4( 1, 1, 1, 0.2f ) : new float4( 1, 0, 0, 0.2f );
                    if ( _isSelected && _owner.checkBoxDebugPlane.Checked )
                        color = _owner.SelectedPlaneColor( color );

                    if ( !_owner.checkBoxHidePlanes.Checked || _isSelected )
                        _owner.DrawPlane( m_wsPosition, m_wsNormal, ComputeTangent(), 10.0f, 10.0f, 10.0f, color, false );

                    // Render the lines
                    for ( int lineIndex=0; lineIndex < m_lines.Count; lineIndex++ ) {
                        m_lines[lineIndex].Draw( _owner, !m_isValid, _isSelected && lineIndex == _owner.integerTrackbarControlLine.Value );
                    }

                    if ( !_owner.checkBoxHideRemovedLines.Checked || (_isSelected && _owner.checkBoxDebugPlane.Checked) )
                        for ( int lineIndex=0; lineIndex < m_removedLines.Count; lineIndex++ ) {
                            m_removedLines[lineIndex].Draw( _owner, true, false );
                        }
                }
Beispiel #6
0
            public void Draw( DebuggerForm _owner, bool _isSelected )
            {
                float4	cellColor = new float4( 1, 0, 0, 1 );
                if ( _isSelected && _owner.checkBoxDebugCell.Checked )
                    cellColor = _owner.SelectedCellColor( cellColor );
                _owner.DrawPoint( m_wsPosition, -10.0f, cellColor );

                for ( int planeIndex=0; planeIndex < m_planes.Count; planeIndex++ )
                    m_planes[planeIndex].Draw( _owner, _isSelected && planeIndex == _owner.integerTrackbarControlPlane.Value );
            }