2 ===========================================================================
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
26 ===========================================================================
29 #include "../../idlib/precompiled.h"
41 lSize = sizeof(m_bEnabled);
42 if (!LoadRegistryInfo("radiant_ZClipEnabled", &m_bEnabled, &lSize))
45 lSize = sizeof(m_iZClipTop);
46 if (!LoadRegistryInfo("radiant_ZClipTop", &m_iZClipTop, &lSize))
49 lSize = sizeof(m_iZClipBottom);
50 if (!LoadRegistryInfo("radiant_ZClipBottom", &m_iZClipBottom, &lSize))
58 // TODO: registry save
60 SaveRegistryInfo("radiant_ZClipEnabled", &m_bEnabled, sizeof(m_bEnabled));
61 SaveRegistryInfo("radiant_ZClipTop", &m_iZClipTop, sizeof(m_iZClipTop));
62 SaveRegistryInfo("radiant_ZClipBottom", &m_iZClipBottom, sizeof(m_iZClipBottom));
65 void CZClip::Reset(void)
67 m_iZClipTop = 64; // arb. starting values, but must be at least 64 apart
75 int CZClip::GetTop(void)
80 int CZClip::GetBottom(void)
82 return m_iZClipBottom;
85 void CZClip::Legalise(void)
89 if (m_iZClipTop < m_iZClipBottom)
91 int iTemp = m_iZClipTop;
92 m_iZClipTop = m_iZClipBottom;
93 m_iZClipBottom = iTemp;
96 // too close together?
98 #define ZCLIP_MIN_SPACING 64
100 if (abs(m_iZClipTop - m_iZClipBottom) < ZCLIP_MIN_SPACING)
101 m_iZClipBottom = m_iZClipTop - ZCLIP_MIN_SPACING;
105 void CZClip::SetTop(int iNewZ)
112 void CZClip::SetBottom(int iNewZ)
114 m_iZClipBottom = iNewZ;
119 bool CZClip::IsEnabled(void)
125 bool CZClip::Enable(bool bOnOff)
127 m_bEnabled = !m_bEnabled;
131 #define ZCLIP_BAR_THICKNESS 8
132 #define ZCLIP_ARROWHEIGHT (ZCLIP_BAR_THICKNESS*8)
134 void CZClip::Paint(void)
137 int xCam = z.width/4; // hmmm, a rather unpleasant and obscure global name, but it was already called that so...
139 qglColor3f (ZCLIP_COLOUR);//1.0, 0.0, 1.0);
141 // draw TOP marker...
149 qglBegin(GL_LINE_LOOP);
151 qglVertex3f (x-xCam,y,0);
152 qglVertex3f (x-xCam,y+ZCLIP_BAR_THICKNESS,0);
153 qglVertex3f (x+xCam,y+ZCLIP_BAR_THICKNESS,0);
154 qglVertex3f (x+xCam,y,0);
157 qglColor3f (ZCLIP_COLOUR_DIM);//0.8, 0.0, 0.8);
160 qglBegin(GL_TRIANGLES);
162 qglBegin(GL_LINE_LOOP);
163 qglVertex3f (x,(y+ZCLIP_BAR_THICKNESS),0);
164 qglVertex3f (x-xCam,(y+ZCLIP_BAR_THICKNESS)+(ZCLIP_ARROWHEIGHT/2),0);
165 qglVertex3f (x+xCam,(y+ZCLIP_BAR_THICKNESS)+(ZCLIP_ARROWHEIGHT/2),0);
168 // draw bottom marker...
170 qglColor3f (ZCLIP_COLOUR);//1.0, 0.0, 1.0);
177 qglBegin(GL_LINE_LOOP);
178 qglVertex3f (x-xCam,y,0);
179 qglVertex3f (x-xCam,y-ZCLIP_BAR_THICKNESS,0);
180 qglVertex3f (x+xCam,y-ZCLIP_BAR_THICKNESS,0);
181 qglVertex3f (x+xCam,y,0);
184 qglColor3f (ZCLIP_COLOUR_DIM);//0.8, 0.0, 0.8);
187 qglBegin(GL_TRIANGLES);
189 qglBegin(GL_LINE_LOOP);
190 qglVertex3f (x,(y-ZCLIP_BAR_THICKNESS),0);
191 qglVertex3f (x-xCam,(y-ZCLIP_BAR_THICKNESS)-(ZCLIP_ARROWHEIGHT/2),0);
192 qglVertex3f (x+xCam,(y-ZCLIP_BAR_THICKNESS)-(ZCLIP_ARROWHEIGHT/2),0);
197 ///////////////// eof ///////////////////