2 BobToolz plugin for GtkRadiant
3 Copyright (C) 2001 Gordon Biggans
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // BobView.cpp: implementation of the DVisDrawer class.
22 //////////////////////////////////////////////////////////////////////
26 #include "DVisDrawer.h"
28 #include "funchandlers.h"
30 //////////////////////////////////////////////////////////////////////
31 // Construction/Destruction
32 //////////////////////////////////////////////////////////////////////
34 DVisDrawer::DVisDrawer(){
40 DVisDrawer::~DVisDrawer(){
48 //////////////////////////////////////////////////////////////////////
50 //////////////////////////////////////////////////////////////////////
52 void DVisDrawer::Draw2D( VIEWTYPE vt ){
57 g_QglTable.m_pfn_qglPushAttrib( GL_ALL_ATTRIB_BITS );
59 g_QglTable.m_pfn_qglDisable( GL_BLEND );
60 g_QglTable.m_pfn_qglDisable( GL_LINE_SMOOTH );
62 g_QglTable.m_pfn_qglPushMatrix();
69 g_QglTable.m_pfn_qglRotatef( 270.0f, 1.0f, 0.0f, 0.0f );
72 g_QglTable.m_pfn_qglRotatef( 270.0f, 1.0f, 0.0f, 0.0f );
73 g_QglTable.m_pfn_qglRotatef( 270.0f, 0.0f, 0.0f, 1.0f );
77 g_QglTable.m_pfn_qglLineWidth( 1.0f );
78 g_QglTable.m_pfn_qglColor4f( 1.0f, 0.0f, 0.0f, 0.5f );
80 g_QglTable.m_pfn_qglEnable( GL_BLEND );
81 g_QglTable.m_pfn_qglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
82 g_QglTable.m_pfn_qglDisable( GL_POLYGON_SMOOTH );
84 g_QglTable.m_pfn_qglDepthFunc( GL_ALWAYS );
87 list<DWinding *>::const_iterator l = m_list->begin();
89 for (; l != m_list->end(); l++ )
93 g_QglTable.m_pfn_qglColor4f( w->clr[0], w->clr[1], w->clr[2], 0.5f );
95 g_QglTable.m_pfn_qglBegin( GL_POLYGON );
96 for ( int i = 0; i < w->numpoints; i++ ) {
97 g_QglTable.m_pfn_qglVertex3f( ( w->p[i] )[0], ( w->p[i] )[1], ( w->p[i] )[2] );
99 g_QglTable.m_pfn_qglEnd();
103 g_QglTable.m_pfn_qglPopMatrix();
105 g_QglTable.m_pfn_qglPopAttrib();
108 void DVisDrawer::Draw3D(){
113 g_QglTable.m_pfn_qglPushAttrib( GL_ALL_ATTRIB_BITS );
115 g_QglTable.m_pfn_qglColor4f( 1.0, 0.0, 0.0, 0.5f );
117 // g_QglTable.m_pfn_qglHint(GL_FOG_HINT, GL_NICEST);
119 // g_QglTable.m_pfn_qglDisable(GL_CULL_FACE);
120 g_QglTable.m_pfn_qglDisable( GL_LINE_SMOOTH );
122 // g_QglTable.m_pfn_qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
123 // g_QglTable.m_pfn_qglShadeModel(GL_SMOOTH);
125 g_QglTable.m_pfn_qglEnable( GL_BLEND );
126 g_QglTable.m_pfn_qglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
127 g_QglTable.m_pfn_qglDisable( GL_POLYGON_SMOOTH );
129 g_QglTable.m_pfn_qglDepthFunc( GL_ALWAYS );
132 list<DWinding *>::const_iterator l = m_list->begin();
134 for (; l != m_list->end(); l++ )
138 g_QglTable.m_pfn_qglColor4f( w->clr[0], w->clr[1], w->clr[2], 0.5f );
140 g_QglTable.m_pfn_qglBegin( GL_POLYGON );
141 for ( int i = 0; i < w->numpoints; i++ ) {
142 g_QglTable.m_pfn_qglVertex3f( ( w->p[i] )[0], ( w->p[i] )[1], ( w->p[i] )[2] );
144 g_QglTable.m_pfn_qglEnd();
147 g_QglTable.m_pfn_qglPopAttrib();
150 void DVisDrawer::Register(){
151 g_QglTable.m_pfnHookGL2DWindow( this );
152 g_QglTable.m_pfnHookGL3DWindow( this );
156 void DVisDrawer::UnRegister(){
157 g_QglTable.m_pfnUnHookGL2DWindow( this );
158 g_QglTable.m_pfnUnHookGL3DWindow( this );
162 void DVisDrawer::SetList( list<DWinding*> *pointList ){
170 void DVisDrawer::ClearPoints(){
171 list<DWinding *>::const_iterator deadPoint = m_list->begin();
172 for (; deadPoint != m_list->end(); deadPoint++ )