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 "gtkr_list.h"
31 #include "DVisDrawer.h"
34 #include "funchandlers.h"
36 //////////////////////////////////////////////////////////////////////
37 // Construction/Destruction
38 //////////////////////////////////////////////////////////////////////
40 DVisDrawer::DVisDrawer()
47 DVisDrawer::~DVisDrawer()
55 //////////////////////////////////////////////////////////////////////
57 //////////////////////////////////////////////////////////////////////
59 void DVisDrawer::Draw2D(VIEWTYPE vt)
64 __QGLTABLENAME.m_pfn_qglPushAttrib(GL_ALL_ATTRIB_BITS);
66 __QGLTABLENAME.m_pfn_qglDisable(GL_BLEND);
67 __QGLTABLENAME.m_pfn_qglDisable(GL_LINE_SMOOTH);
69 __QGLTABLENAME.m_pfn_qglPushMatrix();
76 __QGLTABLENAME.m_pfn_qglRotatef(270.0f, 1.0f, 0.0f, 0.0f);
79 __QGLTABLENAME.m_pfn_qglRotatef(270.0f, 1.0f, 0.0f, 0.0f);
80 __QGLTABLENAME.m_pfn_qglRotatef(270.0f, 0.0f, 0.0f, 1.0f);
84 __QGLTABLENAME.m_pfn_qglLineWidth(1.0f);
85 __QGLTABLENAME.m_pfn_qglColor4f(1.0f, 0.0f, 0.0f, 0.5f);
87 __QGLTABLENAME.m_pfn_qglEnable(GL_BLEND);
88 __QGLTABLENAME.m_pfn_qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
89 __QGLTABLENAME.m_pfn_qglDisable(GL_POLYGON_SMOOTH);
91 __QGLTABLENAME.m_pfn_qglDepthFunc(GL_ALWAYS);
94 list<DWinding *>::const_iterator l=m_list->begin();
96 for(; l != m_list->end(); l++)
100 __QGLTABLENAME.m_pfn_qglColor4f(w->clr[0], w->clr[1], w->clr[2], 0.5f);
102 __QGLTABLENAME.m_pfn_qglBegin(GL_POLYGON);
103 for(int i = 0; i < w->numpoints; i++) {
104 __QGLTABLENAME.m_pfn_qglVertex3f((w->p[i])[0], (w->p[i])[1], (w->p[i])[2]);
106 __QGLTABLENAME.m_pfn_qglEnd();
110 __QGLTABLENAME.m_pfn_qglPopMatrix();
112 __QGLTABLENAME.m_pfn_qglPopAttrib();
115 void DVisDrawer::Draw3D()
120 __QGLTABLENAME.m_pfn_qglPushAttrib(GL_ALL_ATTRIB_BITS);
122 __QGLTABLENAME.m_pfn_qglColor4f(1.0, 0.0, 0.0, 0.5f);
124 // __QGLTABLENAME.m_pfn_qglHint(GL_FOG_HINT, GL_NICEST);
126 // __QGLTABLENAME.m_pfn_qglDisable(GL_CULL_FACE);
127 __QGLTABLENAME.m_pfn_qglDisable(GL_LINE_SMOOTH);
129 // __QGLTABLENAME.m_pfn_qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
130 // __QGLTABLENAME.m_pfn_qglShadeModel(GL_SMOOTH);
132 __QGLTABLENAME.m_pfn_qglEnable(GL_BLEND);
133 __QGLTABLENAME.m_pfn_qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
134 __QGLTABLENAME.m_pfn_qglDisable(GL_POLYGON_SMOOTH);
136 __QGLTABLENAME.m_pfn_qglDepthFunc(GL_ALWAYS);
139 list<DWinding *>::const_iterator l=m_list->begin();
141 for(; l != m_list->end(); l++)
145 __QGLTABLENAME.m_pfn_qglColor4f(w->clr[0], w->clr[1], w->clr[2], 0.5f);
147 __QGLTABLENAME.m_pfn_qglBegin(GL_POLYGON);
148 for(int i = 0; i < w->numpoints; i++) {
149 __QGLTABLENAME.m_pfn_qglVertex3f((w->p[i])[0], (w->p[i])[1], (w->p[i])[2]);
151 __QGLTABLENAME.m_pfn_qglEnd();
154 __QGLTABLENAME.m_pfn_qglPopAttrib();
157 void DVisDrawer::Register()
159 __QGLTABLENAME.m_pfnHookGL2DWindow( this );
160 __QGLTABLENAME.m_pfnHookGL3DWindow( this );
164 void DVisDrawer::UnRegister()
166 __QGLTABLENAME.m_pfnUnHookGL2DWindow( this );
167 __QGLTABLENAME.m_pfnUnHookGL3DWindow( this );
171 void DVisDrawer::SetList(std::list<DWinding*> *pointList)
179 void DVisDrawer::ClearPoints()
181 list<DWinding *>::const_iterator deadPoint=m_list->begin();
182 for(; deadPoint!=m_list->end(); deadPoint++)