-void XYWnd::XY_Draw()
-{
- //
- // clear
- //
- glViewport(0, 0, m_nWidth, m_nHeight);
- glClearColor (g_xywindow_globals.color_gridback[0],
- g_xywindow_globals.color_gridback[1],
- g_xywindow_globals.color_gridback[2],0);
-
- glClear(GL_COLOR_BUFFER_BIT);
-
- //
- // set up viewpoint
- //
-
- glMatrixMode(GL_PROJECTION);
- glLoadMatrixf(reinterpret_cast<const float*>(&m_projection));
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glScalef(m_fScale, m_fScale, 1);
- int nDim1 = (m_viewType == YZ) ? 1 : 0;
- int nDim2 = (m_viewType == XY) ? 1 : 2;
- glTranslatef(-m_vOrigin[nDim1], -m_vOrigin[nDim2], 0);
-
- glDisable (GL_LINE_STIPPLE);
- glLineWidth(1);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDisableClientState(GL_NORMAL_ARRAY);
- glDisableClientState(GL_COLOR_ARRAY);
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_LIGHTING);
- glDisable(GL_COLOR_MATERIAL);
- glDisable(GL_DEPTH_TEST);
-
- if (m_backgroundActivated)
- XY_DrawBackground();
- XY_DrawGrid();
-
- if ( g_xywindow_globals_private.show_blocks)
- XY_DrawBlockGrid();
-
- glLoadMatrixf(reinterpret_cast<const float*>(&m_modelview));
-
- unsigned int globalstate = RENDER_COLOURARRAY | RENDER_COLOURWRITE | RENDER_POLYGONSMOOTH | RENDER_LINESMOOTH;
- if(!g_xywindow_globals.m_bNoStipple)
- {
- globalstate |= RENDER_LINESTIPPLE;
- }
-
- {
- XYRenderer renderer(globalstate, m_state_selected);
-
- Scene_Render(renderer, m_view);
-
- GlobalOpenGL_debugAssertNoErrors();
- renderer.render(m_modelview, m_projection);
- GlobalOpenGL_debugAssertNoErrors();
- }
-
- glDepthMask(GL_FALSE);
-
- GlobalOpenGL_debugAssertNoErrors();
-
- glLoadMatrixf(reinterpret_cast<const float*>(&m_modelview));
-
- GlobalOpenGL_debugAssertNoErrors();
- glDisable(GL_LINE_STIPPLE);
- GlobalOpenGL_debugAssertNoErrors();
- glLineWidth(1);
- GlobalOpenGL_debugAssertNoErrors();
- if(GlobalOpenGL().GL_1_3())
- {
- glActiveTexture(GL_TEXTURE0);
- glClientActiveTexture(GL_TEXTURE0);
- }
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- GlobalOpenGL_debugAssertNoErrors();
- glDisableClientState(GL_NORMAL_ARRAY);
- GlobalOpenGL_debugAssertNoErrors();
- glDisableClientState(GL_COLOR_ARRAY);
- GlobalOpenGL_debugAssertNoErrors();
- glDisable(GL_TEXTURE_2D);
- GlobalOpenGL_debugAssertNoErrors();
- glDisable(GL_LIGHTING);
- GlobalOpenGL_debugAssertNoErrors();
- glDisable(GL_COLOR_MATERIAL);
- GlobalOpenGL_debugAssertNoErrors();
-
- GlobalOpenGL_debugAssertNoErrors();
-
-
- // size info
- if(g_xywindow_globals_private.m_bSizePaint && GlobalSelectionSystem().countSelected() != 0)
- {
- Vector3 min, max;
- Select_GetBounds(min, max);
- PaintSizeInfo(nDim1, nDim2, min, max);
- }
-
- if (g_bCrossHairs)
- {
- glColor4f(0.2f, 0.9f, 0.2f, 0.8f);
- glBegin (GL_LINES);
- if (m_viewType == XY)
- {
- glVertex2f(2.0f * g_MinWorldCoord, m_mousePosition[1]);
- glVertex2f(2.0f * g_MaxWorldCoord, m_mousePosition[1]);
- glVertex2f(m_mousePosition[0], 2.0f * g_MinWorldCoord);
- glVertex2f(m_mousePosition[0], 2.0f * g_MaxWorldCoord);
- }
- else if (m_viewType == YZ)
- {
- glVertex3f(m_mousePosition[0], 2.0f * g_MinWorldCoord, m_mousePosition[2]);
- glVertex3f(m_mousePosition[0], 2.0f * g_MaxWorldCoord, m_mousePosition[2]);
- glVertex3f(m_mousePosition[0], m_mousePosition[1], 2.0f * g_MinWorldCoord);
- glVertex3f(m_mousePosition[0], m_mousePosition[1], 2.0f * g_MaxWorldCoord);
- }
- else
- {
- glVertex3f (2.0f * g_MinWorldCoord, m_mousePosition[1], m_mousePosition[2]);
- glVertex3f (2.0f * g_MaxWorldCoord, m_mousePosition[1], m_mousePosition[2]);
- glVertex3f(m_mousePosition[0], m_mousePosition[1], 2.0f * g_MinWorldCoord);
- glVertex3f(m_mousePosition[0], m_mousePosition[1], 2.0f * g_MaxWorldCoord);
- }
- glEnd();
- }
-
- if (ClipMode())
- {
- GlobalClipPoints_Draw(m_fScale);
- }
-
- GlobalOpenGL_debugAssertNoErrors();
-
- // reset modelview
- glLoadIdentity();
- glScalef(m_fScale, m_fScale, 1);
- glTranslatef(-m_vOrigin[nDim1], -m_vOrigin[nDim2], 0);
-
- DrawCameraIcon (Camera_getOrigin(*g_pParentWnd->GetCamWnd()), Camera_getAngles(*g_pParentWnd->GetCamWnd()));
-
- Feedback_draw2D( m_viewType );
-
- if (g_xywindow_globals_private.show_outline)
- {
- if (Active())
- {
- glMatrixMode (GL_PROJECTION);
- glLoadIdentity();
- glOrtho (0, m_nWidth, 0, m_nHeight, 0, 1);
-
- glMatrixMode (GL_MODELVIEW);
- glLoadIdentity();
-
- // four view mode doesn't colorize
- if (g_pParentWnd->CurrentStyle() == MainFrame::eSplit)
- glColor3fv(vector3_to_array(g_xywindow_globals.color_viewname));
- else
- {
- switch(m_viewType)
- {
- case YZ:
- glColor3fv(vector3_to_array(g_xywindow_globals.AxisColorX));
- break;
- case XZ:
- glColor3fv(vector3_to_array(g_xywindow_globals.AxisColorY));
- break;
- case XY:
- glColor3fv(vector3_to_array(g_xywindow_globals.AxisColorZ));
- break;
- }
- }
- glBegin (GL_LINE_LOOP);
- glVertex2i (0, 0);
- glVertex2i (m_nWidth-1, 0);
- glVertex2i (m_nWidth-1, m_nHeight-1);
- glVertex2i (0, m_nHeight-1);
- glEnd();
- }
- }
-
- GlobalOpenGL_debugAssertNoErrors();
-
- glFinish();
-}
-
-void XYWnd_MouseToPoint(XYWnd* xywnd, int x, int y, Vector3& point)
-{
- xywnd->XY_ToPoint(x, y, point);
- xywnd->XY_SnapToGrid(point);
+void XYWnd::XY_Draw(){
+ //
+ // clear
+ //
+ glViewport( 0, 0, m_nWidth, m_nHeight );
+ glClearColor( g_xywindow_globals.color_gridback[0],
+ g_xywindow_globals.color_gridback[1],
+ g_xywindow_globals.color_gridback[2],0 );
+
+ glClear( GL_COLOR_BUFFER_BIT );
+
+ //
+ // set up viewpoint
+ //
+
+ glMatrixMode( GL_PROJECTION );
+ glLoadMatrixf( reinterpret_cast<const float*>( &m_projection ) );
+
+ glMatrixMode( GL_MODELVIEW );
+ glLoadIdentity();
+ glScalef( m_fScale, m_fScale, 1 );
+ int nDim1 = ( m_viewType == YZ ) ? 1 : 0;
+ int nDim2 = ( m_viewType == XY ) ? 1 : 2;
+ glTranslatef( -m_vOrigin[nDim1], -m_vOrigin[nDim2], 0 );
+
+ glDisable( GL_LINE_STIPPLE );
+ glLineWidth( 1 );
+ glDisableClientState( GL_TEXTURE_COORD_ARRAY );
+ glDisableClientState( GL_NORMAL_ARRAY );
+ glDisableClientState( GL_COLOR_ARRAY );
+ glDisable( GL_TEXTURE_2D );
+ glDisable( GL_LIGHTING );
+ glDisable( GL_COLOR_MATERIAL );
+ glDisable( GL_DEPTH_TEST );
+
+ if ( m_backgroundActivated ) {
+ XY_DrawBackground();
+ }
+ XY_DrawGrid();
+
+ if ( g_xywindow_globals_private.show_blocks ) {
+ XY_DrawBlockGrid();
+ }
+
+ glLoadMatrixf( reinterpret_cast<const float*>( &m_modelview ) );
+
+ unsigned int globalstate = RENDER_COLOURARRAY | RENDER_COLOURWRITE | RENDER_POLYGONSMOOTH | RENDER_LINESMOOTH;
+ if ( !g_xywindow_globals.m_bNoStipple ) {
+ globalstate |= RENDER_LINESTIPPLE;
+ }
+
+ {
+ XYRenderer renderer( globalstate, m_state_selected );
+
+ Scene_Render( renderer, m_view );
+
+ GlobalOpenGL_debugAssertNoErrors();
+ renderer.render( m_modelview, m_projection );
+ GlobalOpenGL_debugAssertNoErrors();
+ }
+
+ glDepthMask( GL_FALSE );
+
+ GlobalOpenGL_debugAssertNoErrors();
+
+ glLoadMatrixf( reinterpret_cast<const float*>( &m_modelview ) );
+
+ GlobalOpenGL_debugAssertNoErrors();
+ glDisable( GL_LINE_STIPPLE );
+ GlobalOpenGL_debugAssertNoErrors();
+ glLineWidth( 1 );
+ GlobalOpenGL_debugAssertNoErrors();
+ if ( GlobalOpenGL().GL_1_3() ) {
+ glActiveTexture( GL_TEXTURE0 );
+ glClientActiveTexture( GL_TEXTURE0 );
+ }
+ glDisableClientState( GL_TEXTURE_COORD_ARRAY );
+ GlobalOpenGL_debugAssertNoErrors();
+ glDisableClientState( GL_NORMAL_ARRAY );
+ GlobalOpenGL_debugAssertNoErrors();
+ glDisableClientState( GL_COLOR_ARRAY );
+ GlobalOpenGL_debugAssertNoErrors();
+ glDisable( GL_TEXTURE_2D );
+ GlobalOpenGL_debugAssertNoErrors();
+ glDisable( GL_LIGHTING );
+ GlobalOpenGL_debugAssertNoErrors();
+ glDisable( GL_COLOR_MATERIAL );
+ GlobalOpenGL_debugAssertNoErrors();
+
+ GlobalOpenGL_debugAssertNoErrors();
+
+
+ // size info
+ if ( g_xywindow_globals_private.m_bSizePaint && GlobalSelectionSystem().countSelected() != 0 ) {
+ Vector3 min, max;
+ Select_GetBounds( min, max );
+ PaintSizeInfo( nDim1, nDim2, min, max );
+ }
+
+ if ( g_bCrossHairs ) {
+ glColor4f( 0.2f, 0.9f, 0.2f, 0.8f );
+ glBegin( GL_LINES );
+ if ( m_viewType == XY ) {
+ glVertex2f( 2.0f * g_MinWorldCoord, m_mousePosition[1] );
+ glVertex2f( 2.0f * g_MaxWorldCoord, m_mousePosition[1] );
+ glVertex2f( m_mousePosition[0], 2.0f * g_MinWorldCoord );
+ glVertex2f( m_mousePosition[0], 2.0f * g_MaxWorldCoord );
+ }
+ else if ( m_viewType == YZ ) {
+ glVertex3f( m_mousePosition[0], 2.0f * g_MinWorldCoord, m_mousePosition[2] );
+ glVertex3f( m_mousePosition[0], 2.0f * g_MaxWorldCoord, m_mousePosition[2] );
+ glVertex3f( m_mousePosition[0], m_mousePosition[1], 2.0f * g_MinWorldCoord );
+ glVertex3f( m_mousePosition[0], m_mousePosition[1], 2.0f * g_MaxWorldCoord );
+ }
+ else
+ {
+ glVertex3f( 2.0f * g_MinWorldCoord, m_mousePosition[1], m_mousePosition[2] );
+ glVertex3f( 2.0f * g_MaxWorldCoord, m_mousePosition[1], m_mousePosition[2] );
+ glVertex3f( m_mousePosition[0], m_mousePosition[1], 2.0f * g_MinWorldCoord );
+ glVertex3f( m_mousePosition[0], m_mousePosition[1], 2.0f * g_MaxWorldCoord );
+ }
+ glEnd();
+ }
+
+ if ( ClipMode() ) {
+ GlobalClipPoints_Draw( m_fScale );
+ }
+
+ GlobalOpenGL_debugAssertNoErrors();
+
+ // reset modelview
+ glLoadIdentity();
+ glScalef( m_fScale, m_fScale, 1 );
+ glTranslatef( -m_vOrigin[nDim1], -m_vOrigin[nDim2], 0 );
+
+ DrawCameraIcon( Camera_getOrigin( *g_pParentWnd->GetCamWnd() ), Camera_getAngles( *g_pParentWnd->GetCamWnd() ) );
+
+ Feedback_draw2D( m_viewType );
+
+ if ( g_xywindow_globals_private.show_outline ) {
+ if ( Active() ) {
+ glMatrixMode( GL_PROJECTION );
+ glLoadIdentity();
+ glOrtho( 0, m_nWidth, 0, m_nHeight, 0, 1 );
+
+ glMatrixMode( GL_MODELVIEW );
+ glLoadIdentity();
+
+ // four view mode doesn't colorize
+ if ( g_pParentWnd->CurrentStyle() == MainFrame::eSplit ) {
+ glColor3fv( vector3_to_array( g_xywindow_globals.color_viewname ) );
+ }
+ else
+ {
+ switch ( m_viewType )
+ {
+ case YZ:
+ glColor3fv( vector3_to_array( g_xywindow_globals.AxisColorX ) );
+ break;
+ case XZ:
+ glColor3fv( vector3_to_array( g_xywindow_globals.AxisColorY ) );
+ break;
+ case XY:
+ glColor3fv( vector3_to_array( g_xywindow_globals.AxisColorZ ) );
+ break;
+ }
+ }
+ glBegin( GL_LINE_LOOP );
+ glVertex2f( 0.5, 0.5 );
+ glVertex2f( m_nWidth - 0.5, 1 );
+ glVertex2f( m_nWidth - 0.5, m_nHeight - 0.5 );
+ glVertex2f( 0.5, m_nHeight - 0.5 );
+ glEnd();
+ }
+ }
+
+ GlobalOpenGL_debugAssertNoErrors();