1 /***********************************************************************/
2 /* Open Visualization Data Explorer */
3 /* (C) Copyright IBM Corp. 1989,1999 */
4 /* ALL RIGHTS RESERVED */
5 /* This code licensed under the */
6 /* "IBM PUBLIC LICENSE - Open Visualization Data Explorer" */
7 /***********************************************************************/
8
9 #include <dxconfig.h>
10
11
12 /*---------------------------------------------------------------------------*\
13 $Source: /src/master/dx/src/exec/hwrender/starbase/hwBoundingBoxDrawSB.c,v $
14 Author:
15 \*---------------------------------------------------------------------------*/
16
17
18 #include <starbase.c.h>
19 #include "hwDeclarations.h"
20 #include "hwPortSB.h"
21 #include "hwMemory.h"
22 #include "hwXfield.h"
23
24 #include "hwDebug.h"
25
26 int
_dxfBoundingBoxDraw(tdmPortHandleP portHandle,xfieldP xf,int clip_status)27 _dxfBoundingBoxDraw (tdmPortHandleP portHandle, xfieldP xf, int clip_status)
28 {
29 DEFPORT(portHandle);
30 dxObject retobj = NULL ;
31 Point *boxpts ;
32 int i ;
33 int faceverts[] =
34 {
35 0, 1, 3, 2, 0, /* one face */
36 4, 5, 7, 6, 4 /* opposite face */
37 } ;
38 register float *clist = 0;
39 int vertex_flags;
40 int num_coords;
41 register int vsize, dV ;
42 int cOffs, nOffs, oOffs ;
43 int k;
44
45 ENTRY(("_dxfBoundingBoxDraw(0x%x, 0x%x, %d)", portHandle, xf, clip_status));
46
47 if (clip_status)
48 {
49 EXIT(("clipping bounding boxes not implemented"));
50 return 0 ;
51 }
52
53 vertex_flags = 0 ;
54 num_coords = 3;
55 vsize = 6;
56 cOffs = 3;
57 vertex_format(FILDES, num_coords, 3, 1, False, 0);
58
59 /* allocate coordinate list */
60 clist = (float *)tdmAllocateLocal(2 * vsize * sizeof(float));
61
62 /* Set colors to white */
63 clist[3] = 1.0;
64 clist[4] = 1.0;
65 clist[5] = 1.0;
66 clist[9] = 1.0;
67 clist[10] = 1.0;
68 clist[11] = 1.0;
69
70 boxpts = xf->box ;
71 for (k = 0; k < 9; k++)
72 {
73 /* copy vertex coordinates into clist */
74 for (i=0, dV=0; i<2 ; i++, dV+=vsize)
75 *(Point *)(clist+dV) = boxpts[faceverts[k + i]];
76
77 polyline3d(FILDES, clist, 2, False);
78 }
79 for (k = 1; k < 4; k++)
80 {
81 /* copy vertex coordinates into clist */
82 *(Point *)(clist) = boxpts[k];
83 *(Point *)(clist+vsize) = boxpts[k + 4];
84
85 polyline3d (FILDES, clist, 2, False);
86 }
87 tdmFree(clist) ;
88 vertex_format(FILDES, 0, 0, 0, False, 1);
89
90 EXIT((""));
91 return 1 ;
92 }
93