Go to the source code of this file.
Data Structures | |
| struct | z_t |
Functions | |
| void | Z_Draw (void) |
| void | Z_Init (void) |
| void | Z_MouseDown (int x, int y, int buttons) |
| void | Z_MouseMoved (int x, int y, int buttons) |
| void | Z_MouseUp (int x, int y, int buttons) |
Variables | |
| z_t | z |
|
|
Definition at line 273 of file Z.CPP. References active_brushes, bottom, brush_s::brush_faces, Brush_Ray(), brush_t, qtexture_s::color, COLOR_GRIDBACK, COLOR_SELBRUSHES, SavedInfo_t::colors, QEGlobals_t::d_savedinfo, g_qeglobals, glbitClear, h(), z_t::height, brush_s::maxs, brush_s::mins, texdef_t::name, brush_s::next, z_t::origin, q, QE_CheckOpenGLForErrors(), qglBegin, qglClear, qglClearColor, qglColor3f, qglColor3fv, qglDisable, qglEnd, qglFinish, qglLoadIdentity, qglMatrixMode, qglOrtho, qglPolygonMode, qglShadeModel, qglVertex2f, qglViewport, qtexture_t, z_t::scale, selected_brushes, Sys_DoubleTime(), Sys_Printf(), face_s::texdef, Texture_ForName(), z_t::timing, top, vec3_t, VectorCopy, w, z_t::width, z, Z_DrawGrid(), and ZDrawCameraIcon(). Referenced by CZWnd::OnPaint(), and WZ_WndProc(). 00274 {
00275 brush_t *brush;
00276 float w, h;
00277 double start, end;
00278 qtexture_t *q;
00279 float top, bottom;
00280 vec3_t org_top, org_bottom, dir_up, dir_down;
00281 int xCam = z.width/3;
00282
00283 if (!active_brushes.next)
00284 return; // not valid yet
00285
00286 if (z.timing)
00287 start = Sys_DoubleTime ();
00288
00289 //
00290 // clear
00291 //
00292 qglViewport(0, 0, z.width, z.height);
00293
00294 qglClearColor (
00295 g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK][0],
00296 g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK][1],
00297 g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK][2],
00298 0);
00299
00300 /* GL Bug */
00301 /* When not using hw acceleration, gl will fault if we clear the depth
00302 buffer bit on the first pass. The hack fix is to set the GL_DEPTH_BUFFER_BIT
00303 only after Z_Draw() has been called once. Yeah, right. */
00304 qglClear(glbitClear);
00305 glbitClear |= GL_DEPTH_BUFFER_BIT;
00306
00307 qglMatrixMode(GL_PROJECTION);
00308
00309 qglLoadIdentity ();
00310 w = z.width/2 / z.scale;
00311 h = z.height/2 / z.scale;
00312 qglOrtho (-w, w, z.origin[2]-h, z.origin[2]+h, -8, 8);
00313
00314 qglDisable(GL_TEXTURE_2D);
00315 qglDisable(GL_TEXTURE_1D);
00316 qglDisable(GL_DEPTH_TEST);
00317 qglDisable(GL_BLEND);
00318
00319
00320 //
00321 // now draw the grid
00322 //
00323 Z_DrawGrid ();
00324
00325 //
00326 // draw stuff
00327 //
00328
00329 qglDisable(GL_CULL_FACE);
00330
00331 qglShadeModel (GL_FLAT);
00332
00333 qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
00334
00335 qglDisable(GL_TEXTURE_2D);
00336 qglDisable(GL_BLEND);
00337 qglDisable(GL_DEPTH_TEST);
00338
00339
00340 // draw filled interiors and edges
00341 dir_up[0] = 0 ; dir_up[1] = 0; dir_up[2] = 1;
00342 dir_down[0] = 0 ; dir_down[1] = 0; dir_down[2] = -1;
00343 VectorCopy (z.origin, org_top);
00344 org_top[2] = 4096;
00345 VectorCopy (z.origin, org_bottom);
00346 org_bottom[2] = -4096;
00347
00348 for (brush = active_brushes.next ; brush != &active_brushes ; brush=brush->next)
00349 {
00350 if (brush->mins[0] >= z.origin[0]
00351 || brush->maxs[0] <= z.origin[0]
00352 || brush->mins[1] >= z.origin[1]
00353 || brush->maxs[1] <= z.origin[1])
00354 continue;
00355
00356 if (!Brush_Ray (org_top, dir_down, brush, &top))
00357 continue;
00358 top = org_top[2] - top;
00359 if (!Brush_Ray (org_bottom, dir_up, brush, &bottom))
00360 continue;
00361 bottom = org_bottom[2] + bottom;
00362
00363 q = Texture_ForName (brush->brush_faces->texdef.name);
00364 qglColor3f (q->color[0], q->color[1], q->color[2]);
00365 qglBegin (GL_QUADS);
00366 qglVertex2f (-xCam, bottom);
00367 qglVertex2f (xCam, bottom);
00368 qglVertex2f (xCam, top);
00369 qglVertex2f (-xCam, top);
00370 qglEnd ();
00371
00372 qglColor3f (1,1,1);
00373 qglBegin (GL_LINE_LOOP);
00374 qglVertex2f (-xCam, bottom);
00375 qglVertex2f (xCam, bottom);
00376 qglVertex2f (xCam, top);
00377 qglVertex2f (-xCam, top);
00378 qglEnd ();
00379 }
00380
00381 //
00382 // now draw selected brushes
00383 //
00384 for (brush = selected_brushes.next ; brush != &selected_brushes ; brush=brush->next)
00385 {
00386 if ( !(brush->mins[0] >= z.origin[0]
00387 || brush->maxs[0] <= z.origin[0]
00388 || brush->mins[1] >= z.origin[1]
00389 || brush->maxs[1] <= z.origin[1]) )
00390 {
00391 if (Brush_Ray (org_top, dir_down, brush, &top))
00392 {
00393 top = org_top[2] - top;
00394 if (Brush_Ray (org_bottom, dir_up, brush, &bottom))
00395 {
00396 bottom = org_bottom[2] + bottom;
00397
00398 q = Texture_ForName (brush->brush_faces->texdef.name);
00399 qglColor3f (q->color[0], q->color[1], q->color[2]);
00400 qglBegin (GL_QUADS);
00401 qglVertex2f (-xCam, bottom);
00402 qglVertex2f (xCam, bottom);
00403 qglVertex2f (xCam, top);
00404 qglVertex2f (-xCam, top);
00405 qglEnd ();
00406 }
00407 }
00408 }
00409
00410 qglColor3fv(g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES]);
00411 qglBegin (GL_LINE_LOOP);
00412 qglVertex2f (-xCam, brush->mins[2]);
00413 qglVertex2f (xCam, brush->mins[2]);
00414 qglVertex2f (xCam, brush->maxs[2]);
00415 qglVertex2f (-xCam, brush->maxs[2]);
00416 qglEnd ();
00417 }
00418
00419
00420 ZDrawCameraIcon ();
00421
00422 qglFinish();
00423 QE_CheckOpenGLForErrors();
00424
00425 if (z.timing)
00426 {
00427 end = Sys_DoubleTime ();
00428 Sys_Printf ("z: %i ms\n", (int)(1000*(end-start)));
00429 }
00430 }
|
Here is the call graph for this function:

|
|
Definition at line 35 of file Z.CPP. References z_t::origin, z_t::scale, and z. Referenced by QE_Init(). 00036 {
00037 z.origin[0] = 0;
00038 z.origin[1] = 20;
00039 z.origin[2] = 46;
00040
00041 z.scale = 1;
00042 }
|
|
||||||||||||||||
|
Definition at line 61 of file Z.CPP. References b, brush_t, CCamWnd::Camera(), cursorx, cursory, Drag_Begin(), g_pParentWnd, g_PrefsDlg, CMainFrame::GetCamera(), z_t::height, CPrefsDlg::m_nMouseButtons, brush_s::maxs, brush_s::mins, brush_s::next, camera_t::origin, z_t::origin, z_t::scale, selected_brushes, Sys_GetCursorPos(), Sys_UpdateWindows(), vec3_t, VectorCopy, vright, vup, W_CAMERA, W_XY_OVERLAY, W_Z, x, y, and z. Referenced by CZWnd::OnLButtonDown(), CZWnd::OnMButtonDown(), CZWnd::OnRButtonDown(), and WZ_WndProc(). 00062 {
00063 vec3_t org, dir, vup, vright;
00064 brush_t *b;
00065
00066 Sys_GetCursorPos (&cursorx, &cursory);
00067
00068 vup[0] = 0; vup[1] = 0; vup[2] = 1/z.scale;
00069
00070 VectorCopy (z.origin, org);
00071 org[2] += (y - (z.height/2))/z.scale;
00072 org[1] = -8192;
00073
00074 b = selected_brushes.next;
00075 if (b != &selected_brushes)
00076 {
00077 org[0] = (b->mins[0] + b->maxs[0])/2;
00078 }
00079
00080 dir[0] = 0; dir[1] = 1; dir[2] = 0;
00081
00082 vright[0] = 0; vright[1] = 0; vright[2] = 0;
00083
00084 // LBUTTON = manipulate selection
00085 // shift-LBUTTON = select
00086 // middle button = grab texture
00087 // ctrl-middle button = set entire brush to texture
00088 // ctrl-shift-middle button = set single face to texture
00089
00090 int nMouseButton = g_PrefsDlg.m_nMouseButtons == 2 ? MK_RBUTTON : MK_MBUTTON;
00091 if ( (buttons == MK_LBUTTON)
00092 || (buttons == (MK_LBUTTON | MK_SHIFT))
00093 || (buttons == MK_MBUTTON)
00094 // || (buttons == (MK_MBUTTON|MK_CONTROL))
00095 || (buttons == (nMouseButton|MK_SHIFT|MK_CONTROL)) )
00096 {
00097 Drag_Begin (x, y, buttons,
00098 vright, vup,
00099 org, dir);
00100 return;
00101 }
00102
00103 // control mbutton = move camera
00104 if ((buttons == (MK_CONTROL|nMouseButton) ) || (buttons == (MK_CONTROL|MK_LBUTTON)))
00105 {
00106 g_pParentWnd->GetCamera()->Camera().origin[2] = org[2] ;
00107 Sys_UpdateWindows (W_CAMERA|W_XY_OVERLAY|W_Z);
00108 }
00109
00110
00111 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 128 of file Z.CPP. References CCamWnd::Camera(), cursorx, cursory, Drag_MouseMoved(), g_pParentWnd, g_PrefsDlg, CMainFrame::GetCamera(), z_t::height, CPrefsDlg::m_nMouseButtons, camera_t::origin, z_t::origin, z_t::scale, Sys_GetCursorPos(), Sys_SetCursorPos(), Sys_UpdateWindows(), W_CAMERA, W_CAMERA_IFON, W_XY, W_XY_OVERLAY, W_Z, x, y, and z. Referenced by CZWnd::OnMouseMove(), and WZ_WndProc(). 00129 {
00130 if (!buttons)
00131 return;
00132 if (buttons == MK_LBUTTON)
00133 {
00134 Drag_MouseMoved (x, y, buttons);
00135 Sys_UpdateWindows (W_Z|W_CAMERA_IFON|W_XY);
00136 return;
00137 }
00138 // rbutton = drag z origin
00139 if (buttons == MK_RBUTTON)
00140 {
00141 Sys_GetCursorPos (&x, &y);
00142 if ( y != cursory)
00143 {
00144 z.origin[2] += y-cursory;
00145 Sys_SetCursorPos (cursorx, cursory);
00146 Sys_UpdateWindows (W_Z);
00147 }
00148 return;
00149 }
00150 // control mbutton = move camera
00151 int nMouseButton = g_PrefsDlg.m_nMouseButtons == 2 ? MK_RBUTTON : MK_MBUTTON;
00152 if ((buttons == (MK_CONTROL|nMouseButton) ) || (buttons == (MK_CONTROL|MK_LBUTTON)))
00153 {
00154 g_pParentWnd->GetCamera()->Camera().origin[2] = (y - (z.height/2))/z.scale;
00155 Sys_UpdateWindows (W_CAMERA|W_XY_OVERLAY|W_Z);
00156 }
00157
00158 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 118 of file Z.CPP. References Drag_MouseUp(). Referenced by CZWnd::OnLButtonUp(), CZWnd::OnMButtonUp(), CZWnd::OnRButtonUp(), and WZ_WndProc(). 00119 {
00120 Drag_MouseUp ();
00121 }
|
Here is the call graph for this function:

|
|
Definition at line 746 of file QGL_WIN.CPP. |
1.3.9.1