2 ** License Applicability. Except to the extent portions of this file are
3 ** made subject to an alternative license as permitted in the SGI Free
4 ** Software License B, Version 1.1 (the "License"), the contents of this
5 ** file are subject only to the provisions of the License. You may not use
6 ** this file except in compliance with the License. You may obtain a copy
7 ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
8 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
10 ** http://oss.sgi.com/projects/FreeB
12 ** Note that, as provided in the License, the Software is distributed on an
13 ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
14 ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
15 ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
16 ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
18 ** Original Code. The Original Code is: OpenGL Sample Implementation,
19 ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
20 ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
21 ** Copyright in any portions created by third parties is as indicated
22 ** elsewhere herein. All Rights Reserved.
24 ** Additional Notice Provisions: The application programming interfaces
25 ** established by SGI in conjunction with the Original Code are The
26 ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
27 ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
28 ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
29 ** Window System(R) (Version 1.3), released October 19, 1998. This software
30 ** was created using the OpenGL(R) version 1.2.1 Sample Implementation
31 ** published by SGI, but has not been independently verified as being
32 ** compliant with the OpenGL(R) version 1.2.1 Specification.
42 #include "definitions.h"
44 #include "primitiveStream.h"
53 /*cache the coordinate values for efficiency.
54 *these are redundant information when
57 Real
* u_values
; /*size is n_ulines*/
58 Real
* v_values
; /*size is n_vlines*/
63 //uniform grid constructor
64 gridWrap(Int nUlines
, Int nVlines
,
69 //nonuniform grid constructor.
70 gridWrap(Int nUlines
, Real
*uvals
,
71 Int nVlines
, Real
*vvlas
76 Int
get_n_ulines() {return n_ulines
;}
77 Int
get_n_vlines() {return n_vlines
;}
78 Real
get_u_min() {return u_min
;}
79 Real
get_u_max() {return u_max
;}
80 Real
get_v_min() {return v_min
;}
81 Real
get_v_max() {return v_max
;}
83 Real
get_u_value(Int i
)
86 /*if(i>=n_ulines){printf("ERROR, n_ulines=%i,i=%i\n",n_ulines,i);exit(0);}*/
88 Real
get_v_value(Int j
) {return v_values
[j
];}
90 Real
* get_u_values() {return u_values
;}
91 Real
* get_v_values() {return v_values
;}
93 void outputFanWithPoint(Int v
, Int uleft
, Int uright
,
94 Real vert
[2], primStream
* pStream
);
98 Int
isUniform() {return is_uniform
;}
101 class gridBoundaryChain
{
105 Int
* ulineIndices
; /*each v line has a boundary*/
106 Int
* innerIndices
; /*the segment of the vertical gridline from */
107 /*(innerIndices[i], i) to (innerIndices[i+1], i-1) */
108 /*is inside the polygon: i=1,...,nVlines-1*/
110 Real2
* vertices
; /*one grid point at each grid V-line, cached for efficiency*/
113 gridBoundaryChain(gridWrap
* gr
, Int first_vline_index
, Int n_vlines
, Int
* uline_indices
, Int
* inner_indices
);
122 /*i indexes the vlines in this chain.
124 Int
getVlineIndex(Int i
) {return firstVlineIndex
-i
;}
125 Int
getUlineIndex(Int i
) {return ulineIndices
[i
];}
126 Real
get_u_value(Int i
) {return vertices
[i
][0];}
127 Real
get_v_value(Int i
) {return vertices
[i
][1];}
128 Int
get_nVlines() {return nVlines
;}
129 Int
getInnerIndex(Int i
) {return innerIndices
[i
];}
130 Real
getInner_u_value(Int i
) {return grid
->get_u_value(innerIndices
[i
]);}
132 Real
* get_vertex(Int i
) {return vertices
[i
];}
133 gridWrap
* getGrid() {return grid
;}
134 void leftEndFan(Int i
, primStream
* pStream
);
135 void rightEndFan(Int i
, primStream
* pStream
);
137 Int
lookfor(Real v
, Int i1
, Int i2
); //find i in [i1,i2] so that vertices[i][1]>= v > vertices[i+1][1]