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()
41 DVisDrawer::~DVisDrawer()
49 //////////////////////////////////////////////////////////////////////
51 //////////////////////////////////////////////////////////////////////
53 void DVisDrawer::Draw2D(VIEWTYPE vt)
58 g_QglTable.m_pfn_qglPushAttrib(GL_ALL_ATTRIB_BITS);
60 g_QglTable.m_pfn_qglDisable(GL_BLEND);
61 g_QglTable.m_pfn_qglDisable(GL_LINE_SMOOTH);
63 g_QglTable.m_pfn_qglPushMatrix();
70 g_QglTable.m_pfn_qglRotatef(270.0f, 1.0f, 0.0f, 0.0f);
73 g_QglTable.m_pfn_qglRotatef(270.0f, 1.0f, 0.0f, 0.0f);
74 g_QglTable.m_pfn_qglRotatef(270.0f, 0.0f, 0.0f, 1.0f);
78 g_QglTable.m_pfn_qglLineWidth(1.0f);
79 g_QglTable.m_pfn_qglColor4f(1.0f, 0.0f, 0.0f, 0.5f);
81 g_QglTable.m_pfn_qglEnable(GL_BLEND);
82 g_QglTable.m_pfn_qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
83 g_QglTable.m_pfn_qglDisable(GL_POLYGON_SMOOTH);
85 g_QglTable.m_pfn_qglDepthFunc(GL_ALWAYS);
88 list<DWinding *>::const_iterator l=m_list->begin();
90 for(; l != m_list->end(); l++)
94 g_QglTable.m_pfn_qglColor4f(w->clr[0], w->clr[1], w->clr[2], 0.5f);
96 g_QglTable.m_pfn_qglBegin(GL_POLYGON);
97 for(int i = 0; i < w->numpoints; i++) {
98 g_QglTable.m_pfn_qglVertex3f((w->p[i])[0], (w->p[i])[1], (w->p[i])[2]);
100 g_QglTable.m_pfn_qglEnd();
104 g_QglTable.m_pfn_qglPopMatrix();
106 g_QglTable.m_pfn_qglPopAttrib();
109 void DVisDrawer::Draw3D()
114 g_QglTable.m_pfn_qglPushAttrib(GL_ALL_ATTRIB_BITS);
116 g_QglTable.m_pfn_qglColor4f(1.0, 0.0, 0.0, 0.5f);
118 // g_QglTable.m_pfn_qglHint(GL_FOG_HINT, GL_NICEST);
120 // g_QglTable.m_pfn_qglDisable(GL_CULL_FACE);
121 g_QglTable.m_pfn_qglDisable(GL_LINE_SMOOTH);
123 // g_QglTable.m_pfn_qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
124 // g_QglTable.m_pfn_qglShadeModel(GL_SMOOTH);
126 g_QglTable.m_pfn_qglEnable(GL_BLEND);
127 g_QglTable.m_pfn_qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
128 g_QglTable.m_pfn_qglDisable(GL_POLYGON_SMOOTH);
130 g_QglTable.m_pfn_qglDepthFunc(GL_ALWAYS);
133 list<DWinding *>::const_iterator l=m_list->begin();
135 for(; l != m_list->end(); l++)
139 g_QglTable.m_pfn_qglColor4f(w->clr[0], w->clr[1], w->clr[2], 0.5f);
141 g_QglTable.m_pfn_qglBegin(GL_POLYGON);
142 for(int i = 0; i < w->numpoints; i++) {
143 g_QglTable.m_pfn_qglVertex3f((w->p[i])[0], (w->p[i])[1], (w->p[i])[2]);
145 g_QglTable.m_pfn_qglEnd();
148 g_QglTable.m_pfn_qglPopAttrib();
151 void DVisDrawer::Register()
153 g_QglTable.m_pfnHookGL2DWindow( this );
154 g_QglTable.m_pfnHookGL3DWindow( this );
158 void DVisDrawer::UnRegister()
160 g_QglTable.m_pfnUnHookGL2DWindow( this );
161 g_QglTable.m_pfnUnHookGL3DWindow( this );
165 void DVisDrawer::SetList(list<DWinding*> *pointList)
173 void DVisDrawer::ClearPoints()
175 list<DWinding *>::const_iterator deadPoint=m_list->begin();
176 for(; deadPoint!=m_list->end(); deadPoint++)