2007-11-04 03:51:54 +00:00
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
Copyright (C) 1999-2007 id Software, Inc. and contributors.
|
|
|
|
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
This file is part of GtkRadiant.
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
GtkRadiant is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
GtkRadiant is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GtkRadiant; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
2007-11-04 03:51:54 +00:00
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
//#include "qe3.h"
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
#define PAGEFLIPS 2
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
z_t z;
|
2007-11-04 03:51:54 +00:00
|
|
|
|
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
============
|
|
|
|
Z_Init
|
|
|
|
============
|
|
|
|
*/
|
|
|
|
void Z_Init( void ){
|
2007-11-04 03:51:54 +00:00
|
|
|
z.origin[0] = 0;
|
|
|
|
z.origin[1] = 20;
|
|
|
|
z.origin[2] = 46;
|
|
|
|
|
|
|
|
z.scale = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
============================================================================
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
MOUSE ACTIONS
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
============================================================================
|
|
|
|
*/
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
static int cursorx, cursory;
|
2007-11-04 03:51:54 +00:00
|
|
|
|
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
==============
|
|
|
|
Z_MouseDown
|
|
|
|
==============
|
|
|
|
*/
|
|
|
|
void Z_MouseDown( int x, int y, int buttons ){
|
|
|
|
vec3_t org, dir, vup, vright;
|
|
|
|
brush_t *b;
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
Sys_GetCursorPos( &cursorx, &cursory );
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
vup[0] = 0; vup[1] = 0; vup[2] = 1 / z.scale;
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
VectorCopy( z.origin, org );
|
|
|
|
org[2] += ( y - ( z.height / 2 ) ) / z.scale;
|
2007-11-04 03:51:54 +00:00
|
|
|
org[1] = g_MinWorldCoord;
|
|
|
|
|
|
|
|
b = selected_brushes.next;
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( b != &selected_brushes ) {
|
|
|
|
org[0] = ( b->mins[0] + b->maxs[0] ) / 2;
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dir[0] = 0; dir[1] = 1; dir[2] = 0;
|
|
|
|
|
|
|
|
vright[0] = 0; vright[1] = 0; vright[2] = 0;
|
|
|
|
|
|
|
|
// LBUTTON = manipulate selection
|
|
|
|
// shift-LBUTTON = select
|
|
|
|
// middle button = grab texture
|
|
|
|
// ctrl-middle button = set entire brush to texture
|
|
|
|
// ctrl-shift-middle button = set single face to texture
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
int nMouseButton = g_PrefsDlg.m_nMouseButtons == 2 ? MK_RBUTTON : MK_MBUTTON;
|
|
|
|
if ( ( buttons == MK_LBUTTON )
|
|
|
|
|| ( buttons == ( MK_LBUTTON | MK_SHIFT ) )
|
|
|
|
|| ( buttons == MK_MBUTTON )
|
2007-11-04 03:51:54 +00:00
|
|
|
// || (buttons == (MK_MBUTTON|MK_CONTROL))
|
2012-03-17 20:01:54 +00:00
|
|
|
|| ( buttons == ( nMouseButton | MK_SHIFT | MK_CONTROL ) ) ) {
|
|
|
|
Drag_Begin( x, y, buttons,
|
|
|
|
vright, vup,
|
|
|
|
org, dir );
|
2007-11-04 03:51:54 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// control mbutton = move camera
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( ( buttons == ( MK_CONTROL | nMouseButton ) ) || ( buttons == ( MK_CONTROL | MK_LBUTTON ) ) ) {
|
2007-11-04 03:51:54 +00:00
|
|
|
g_pParentWnd->GetCamWnd()->Camera()->origin[2] = org[2] ;
|
2012-03-17 20:01:54 +00:00
|
|
|
Sys_UpdateWindows( W_CAMERA | W_XY_OVERLAY | W_Z );
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
==============
|
|
|
|
Z_MouseUp
|
|
|
|
==============
|
|
|
|
*/
|
|
|
|
void Z_MouseUp( int x, int y, int buttons ){
|
|
|
|
Drag_MouseUp();
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
==============
|
|
|
|
Z_MouseMoved
|
|
|
|
==============
|
|
|
|
*/
|
|
|
|
void Z_MouseMoved( int x, int y, int buttons ){
|
|
|
|
if ( !buttons ) {
|
2007-11-04 03:51:54 +00:00
|
|
|
return;
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
if ( buttons == MK_LBUTTON ) {
|
|
|
|
Drag_MouseMoved( x, y, buttons );
|
|
|
|
Sys_UpdateWindows( W_Z | W_CAMERA_IFON | W_XY );
|
2007-11-04 03:51:54 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// rbutton = drag z origin
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( buttons == MK_RBUTTON ) {
|
|
|
|
Sys_GetCursorPos( &x, &y );
|
|
|
|
if ( y != cursory ) {
|
|
|
|
z.origin[2] += y - cursory;
|
|
|
|
Sys_SetCursorPos( cursorx, cursory );
|
|
|
|
Sys_UpdateWindows( W_Z );
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2012-03-17 20:01:54 +00:00
|
|
|
// control mbutton = move camera
|
|
|
|
int nMouseButton = g_PrefsDlg.m_nMouseButtons == 2 ? MK_RBUTTON : MK_MBUTTON;
|
|
|
|
if ( ( buttons == ( MK_CONTROL | nMouseButton ) ) || ( buttons == ( MK_CONTROL | MK_LBUTTON ) ) ) {
|
|
|
|
g_pParentWnd->GetCamWnd()->Camera()->origin[2] = ( y - ( z.height / 2 ) ) / z.scale;
|
|
|
|
Sys_UpdateWindows( W_CAMERA | W_XY_OVERLAY | W_Z );
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
============================================================================
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
DRAWING
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
============================================================================
|
|
|
|
*/
|
2007-11-04 03:51:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
==============
|
|
|
|
Z_DrawGrid
|
|
|
|
==============
|
|
|
|
*/
|
|
|
|
void Z_DrawGrid( void ){
|
|
|
|
float zz, zb, ze;
|
|
|
|
float w, h;
|
|
|
|
char text[32];
|
|
|
|
|
|
|
|
w = ( z.width / 2 / z.scale );
|
|
|
|
h = ( z.height / 2 / z.scale );
|
2007-11-04 03:51:54 +00:00
|
|
|
|
|
|
|
zb = z.origin[2] - h;
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( zb < region_mins[2] ) {
|
2007-11-04 03:51:54 +00:00
|
|
|
zb = region_mins[2];
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
zb = 64 * floor( zb / 64 );
|
2007-11-04 03:51:54 +00:00
|
|
|
|
|
|
|
ze = z.origin[2] + h;
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( ze > region_maxs[2] ) {
|
2007-11-04 03:51:54 +00:00
|
|
|
ze = region_maxs[2];
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
ze = 64 * ceil( ze / 64 );
|
2007-11-04 03:51:54 +00:00
|
|
|
|
|
|
|
// draw major blocks
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_GRIDMAJOR] );
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( g_qeglobals.d_showgrid ) {
|
|
|
|
if ( g_qeglobals.d_gridsize < 128 ) {
|
|
|
|
qglBegin( GL_LINES );
|
|
|
|
|
|
|
|
qglVertex2f( 0, zb );
|
|
|
|
qglVertex2f( 0, ze );
|
|
|
|
|
|
|
|
for ( zz = zb ; zz < ze ; zz += 64 )
|
|
|
|
{
|
|
|
|
qglVertex2f( -w, zz );
|
|
|
|
qglVertex2f( w, zz );
|
|
|
|
}
|
|
|
|
|
|
|
|
qglEnd();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
qglBegin( GL_LINES );
|
|
|
|
|
|
|
|
qglVertex2f( 0, zb );
|
|
|
|
qglVertex2f( 0, ze );
|
|
|
|
|
|
|
|
for ( zz = zb ; zz < ze ; zz += 64 )
|
|
|
|
{
|
|
|
|
// d_gridsize >= 128 .. it's an int for sure
|
|
|
|
if ( ( (int)zz & ( (int)g_qeglobals.d_gridsize - 1 ) ) != 0 ) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
qglVertex2f( -w, zz );
|
|
|
|
qglVertex2f( w, zz );
|
|
|
|
}
|
|
|
|
|
|
|
|
qglEnd();
|
|
|
|
}
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// draw minor blocks
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( g_qeglobals.d_showgrid && g_qeglobals.d_gridsize * z.scale >= 4 &&
|
|
|
|
g_qeglobals.d_savedinfo.colors[COLOR_GRIDMINOR] != g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK] ) {
|
|
|
|
qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_GRIDMINOR] );
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
qglBegin( GL_LINES );
|
|
|
|
for ( zz = zb ; zz < ze ; zz += g_qeglobals.d_gridsize )
|
2007-11-04 03:51:54 +00:00
|
|
|
{
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( !( (int)zz & 63 ) ) {
|
2007-11-04 03:51:54 +00:00
|
|
|
continue;
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
qglVertex2f( -w, zz );
|
|
|
|
qglVertex2f( w, zz );
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
2012-03-17 20:01:54 +00:00
|
|
|
qglEnd();
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// draw coordinate text if needed
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( g_qeglobals.d_savedinfo.show_coordinates ) {
|
|
|
|
qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_GRIDTEXT] );
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
int step = (int)( g_qeglobals.d_gridsize > 64 ? g_qeglobals.d_gridsize : 64 );
|
2007-11-04 03:51:54 +00:00
|
|
|
zb = z.origin[2] - h;
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( zb < region_mins[2] ) {
|
2007-11-04 03:51:54 +00:00
|
|
|
zb = region_mins[2];
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
zb = step * floor( zb / step );
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
for ( zz = zb ; zz < ze ; zz += step )
|
2007-11-04 03:51:54 +00:00
|
|
|
{
|
2012-03-17 20:01:54 +00:00
|
|
|
qglRasterPos2f( -w + ( 1 / z.scale ), zz );
|
|
|
|
sprintf( text, "%i",(int)zz );
|
|
|
|
gtk_glwidget_print_string( text );
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
void ZDrawCameraIcon( void ){
|
|
|
|
float x, y;
|
|
|
|
float xCam = z.width / 4 / z.scale, gizmo = 8 / z.scale, height = 48 / z.scale;
|
2007-11-04 03:51:54 +00:00
|
|
|
|
|
|
|
x = 0;
|
|
|
|
y = g_pParentWnd->GetCamWnd()->Camera()->origin[2];
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
qglColor3f( 0.0, 0.0, 1.0 );
|
|
|
|
qglBegin( GL_LINE_STRIP );
|
|
|
|
qglVertex3f( x - xCam,y,0 );
|
|
|
|
qglVertex3f( x,y + gizmo,0 );
|
|
|
|
qglVertex3f( x + xCam,y,0 );
|
|
|
|
qglVertex3f( x,y - gizmo,0 );
|
|
|
|
qglVertex3f( x - xCam,y,0 );
|
|
|
|
qglVertex3f( x + xCam,y,0 );
|
|
|
|
qglVertex3f( x + xCam,y - height,0 );
|
|
|
|
qglVertex3f( x - xCam,y - height,0 );
|
|
|
|
qglVertex3f( x - xCam,y,0 );
|
|
|
|
qglEnd();
|
2007-11-04 03:51:54 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
GLbitfield glbitClear = GL_COLOR_BUFFER_BIT; //HACK
|
|
|
|
|
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
==============
|
|
|
|
Z_Draw
|
|
|
|
==============
|
|
|
|
*/
|
|
|
|
void Z_Draw( void ){
|
2007-11-04 03:51:54 +00:00
|
|
|
#ifdef DBG_WINDOWPOS
|
2012-03-17 20:01:54 +00:00
|
|
|
CheckWatchit( "Z_Draw" );
|
2007-11-04 03:51:54 +00:00
|
|
|
#endif
|
2012-03-17 20:01:54 +00:00
|
|
|
brush_t *brush;
|
|
|
|
float w, h;
|
|
|
|
double start, end;
|
|
|
|
qtexture_t *q;
|
|
|
|
float top, bottom;
|
|
|
|
vec3_t org_top, org_bottom, dir_up, dir_down;
|
|
|
|
int xCam = z.width / 3;
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( !active_brushes.next ) {
|
|
|
|
return; // not valid yet
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
if ( z.timing ) {
|
|
|
|
start = Sys_DoubleTime();
|
|
|
|
}
|
2007-11-04 03:51:54 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// clear
|
|
|
|
//
|
2012-03-17 20:01:54 +00:00
|
|
|
qglViewport( 0, 0, z.width, z.height );
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
qglClearColor(
|
2007-11-04 03:51:54 +00:00
|
|
|
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK][0],
|
|
|
|
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK][1],
|
|
|
|
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK][2],
|
2012-03-17 20:01:54 +00:00
|
|
|
0 );
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
/* GL Bug */
|
|
|
|
/* When not using hw acceleration, gl will fault if we clear the depth
|
|
|
|
buffer bit on the first pass. The hack fix is to set the GL_DEPTH_BUFFER_BIT
|
|
|
|
only after Z_Draw() has been called once. Yeah, right. */
|
|
|
|
qglClear( glbitClear );
|
2007-11-04 03:51:54 +00:00
|
|
|
glbitClear |= GL_DEPTH_BUFFER_BIT;
|
2012-03-17 20:01:54 +00:00
|
|
|
qglMatrixMode( GL_PROJECTION );
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
qglLoadIdentity();
|
|
|
|
w = z.width / 2 / z.scale;
|
|
|
|
h = z.height / 2 / z.scale;
|
|
|
|
qglOrtho( -w, w, z.origin[2] - h, z.origin[2] + h, -8, 8 );
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
qglDisable( GL_TEXTURE_2D );
|
|
|
|
qglDisable( GL_TEXTURE_1D );
|
|
|
|
qglDisable( GL_DEPTH_TEST );
|
|
|
|
qglDisable( GL_BLEND );
|
2007-11-04 03:51:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// now draw the grid
|
|
|
|
//
|
2012-03-17 20:01:54 +00:00
|
|
|
Z_DrawGrid();
|
2007-11-04 03:51:54 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// draw stuff
|
|
|
|
//
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
qglDisable( GL_CULL_FACE );
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
qglShadeModel( GL_FLAT );
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
qglPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
qglDisable( GL_TEXTURE_2D );
|
|
|
|
qglDisable( GL_BLEND );
|
|
|
|
qglDisable( GL_DEPTH_TEST );
|
2007-11-04 03:51:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
// draw filled interiors and edges
|
|
|
|
dir_up[0] = 0 ; dir_up[1] = 0; dir_up[2] = 1;
|
|
|
|
dir_down[0] = 0 ; dir_down[1] = 0; dir_down[2] = -1;
|
2012-03-17 20:01:54 +00:00
|
|
|
VectorCopy( z.origin, org_top );
|
2007-11-04 03:51:54 +00:00
|
|
|
org_top[2] = g_MaxWorldCoord;
|
2012-03-17 20:01:54 +00:00
|
|
|
VectorCopy( z.origin, org_bottom );
|
2007-11-04 03:51:54 +00:00
|
|
|
org_bottom[2] = g_MinWorldCoord;
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
for ( brush = active_brushes.next ; brush != &active_brushes ; brush = brush->next )
|
2007-11-04 03:51:54 +00:00
|
|
|
{
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( brush->bFiltered ) {
|
2007-11-04 03:51:54 +00:00
|
|
|
continue;
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( brush->mins[0] >= z.origin[0]
|
|
|
|
|| brush->maxs[0] <= z.origin[0]
|
|
|
|
|| brush->mins[1] >= z.origin[1]
|
|
|
|
|| brush->maxs[1] <= z.origin[1] ) {
|
2007-11-04 03:51:54 +00:00
|
|
|
continue;
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( !Brush_Ray( org_top, dir_down, brush, &top ) ) {
|
2007-11-04 03:51:54 +00:00
|
|
|
continue;
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
2007-11-04 03:51:54 +00:00
|
|
|
top = org_top[2] - top;
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( !Brush_Ray( org_bottom, dir_up, brush, &bottom ) ) {
|
2007-11-04 03:51:54 +00:00
|
|
|
continue;
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
2007-11-04 03:51:54 +00:00
|
|
|
bottom = org_bottom[2] + bottom;
|
|
|
|
|
|
|
|
q = brush->brush_faces->pShader->getTexture();
|
2012-03-17 20:01:54 +00:00
|
|
|
qglColor3f( q->color[0], q->color[1], q->color[2] );
|
|
|
|
qglBegin( GL_QUADS );
|
|
|
|
qglVertex2f( -xCam, bottom );
|
|
|
|
qglVertex2f( xCam, bottom );
|
|
|
|
qglVertex2f( xCam, top );
|
|
|
|
qglVertex2f( -xCam, top );
|
|
|
|
qglEnd();
|
|
|
|
|
|
|
|
qglColor3f( 1,1,1 );
|
|
|
|
qglBegin( GL_LINE_LOOP );
|
|
|
|
qglVertex2f( -xCam, bottom );
|
|
|
|
qglVertex2f( xCam, bottom );
|
|
|
|
qglVertex2f( xCam, top );
|
|
|
|
qglVertex2f( -xCam, top );
|
|
|
|
qglEnd();
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// now draw selected brushes
|
|
|
|
//
|
2012-03-17 20:01:54 +00:00
|
|
|
for ( brush = selected_brushes.next ; brush != &selected_brushes ; brush = brush->next )
|
2007-11-04 03:51:54 +00:00
|
|
|
{
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( !( brush->mins[0] >= z.origin[0]
|
|
|
|
|| brush->maxs[0] <= z.origin[0]
|
|
|
|
|| brush->mins[1] >= z.origin[1]
|
|
|
|
|| brush->maxs[1] <= z.origin[1] ) ) {
|
|
|
|
if ( Brush_Ray( org_top, dir_down, brush, &top ) ) {
|
2007-11-04 03:51:54 +00:00
|
|
|
top = org_top[2] - top;
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( Brush_Ray( org_bottom, dir_up, brush, &bottom ) ) {
|
2007-11-04 03:51:54 +00:00
|
|
|
bottom = org_bottom[2] + bottom;
|
|
|
|
|
|
|
|
q = brush->brush_faces->pShader->getTexture();
|
2012-03-17 20:01:54 +00:00
|
|
|
qglColor3f( q->color[0], q->color[1], q->color[2] );
|
|
|
|
qglBegin( GL_QUADS );
|
|
|
|
qglVertex2f( -xCam, bottom );
|
|
|
|
qglVertex2f( xCam, bottom );
|
|
|
|
qglVertex2f( xCam, top );
|
|
|
|
qglVertex2f( -xCam, top );
|
|
|
|
qglEnd();
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES] );
|
|
|
|
qglBegin( GL_LINE_LOOP );
|
|
|
|
qglVertex2f( -xCam, brush->mins[2] );
|
|
|
|
qglVertex2f( xCam, brush->mins[2] );
|
|
|
|
qglVertex2f( xCam, brush->maxs[2] );
|
|
|
|
qglVertex2f( -xCam, brush->maxs[2] );
|
|
|
|
qglEnd();
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
ZDrawCameraIcon();
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
qglFinish();
|
2007-11-04 03:51:54 +00:00
|
|
|
QE_CheckOpenGLForErrors();
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( z.timing ) {
|
|
|
|
end = Sys_DoubleTime();
|
|
|
|
Sys_Printf( "z: %i ms\n", (int)( 1000 * ( end - start ) ) );
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
}
|