ReactOS 0.4.15-dev-7958-gcd0bb1a
gridWrap.h
Go to the documentation of this file.
1/*
2 * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
3 * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice including the dates of first publication and
13 * either this permission notice or a reference to
14 * http://oss.sgi.com/projects/FreeB/
15 * shall be included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 *
25 * Except as contained in this notice, the name of Silicon Graphics, Inc.
26 * shall not be used in advertising or otherwise to promote the sale, use or
27 * other dealings in this Software without prior written authorization from
28 * Silicon Graphics, Inc.
29 */
30/*
31*/
32
33#ifndef _GRIDWRAP_H
34#define _GRIDWRAP_H
35
36//#include <stdio.h>
37//#include "definitions.h"
38
39#include "primitiveStream.h"
40//#include "zlassert.h"
41
47
48 /*cache the coordinate values for efficiency.
49 *these are redundant information when
50 *the grid is uniform.
51 */
52 Real* u_values; /*size is n_ulines*/
53 Real* v_values; /*size is n_vlines*/
54
56
57public:
58 //uniform grid constructor
59 gridWrap(Int nUlines, Int nVlines,
60 Real uMin, Real uMax,
62 );
63
64 //nonuniform grid constructor.
65 gridWrap(Int nUlines, Real *uvals,
66 Int nVlines, Real *vvlas
67 );
68 ~gridWrap();
69
70 void print();
73 Real get_u_min() {return u_min;}
74 Real get_u_max() {return u_max;}
75 Real get_v_min() {return v_min;}
76 Real get_v_max() {return v_max;}
77
79 {
81 /*if(i>=n_ulines){printf("ERROR, n_ulines=%i,i=%i\n",n_ulines,i);exit(0);}*/
82 return u_values[i];}
84
87
88 void outputFanWithPoint(Int v, Int uleft, Int uright,
89 Real vert[2], primStream* pStream);
90
91 void draw();
92
94};
95
100 Int* ulineIndices; /*each v line has a boundary*/
101 Int* innerIndices; /*the segment of the vertical gridline from */
102 /*(innerIndices[i], i) to (innerIndices[i+1], i-1) */
103 /*is inside the polygon: i=1,...,nVlines-1*/
104
105 Real2* vertices; /*one grid point at each grid V-line, cached for efficiency*/
106
107public:
108 gridBoundaryChain(gridWrap* gr, Int first_vline_index, Int n_vlines, Int* uline_indices, Int* inner_indices);
109
111 {
114 free(vertices);
115 }
116
117 /*i indexes the vlines in this chain.
118 */
126
128 gridWrap* getGrid() {return grid;}
129 void leftEndFan(Int i, primStream* pStream);
130 void rightEndFan(Int i, primStream* pStream);
131
132 Int lookfor(Real v, Int i1, Int i2); //find i in [i1,i2] so that vertices[i][1]>= v > vertices[i+1][1]
133 void draw();
134 void drawInner();
135};
136
137#endif
gridWrap * grid
Definition: gridWrap.h:97
Real getInner_u_value(Int i)
Definition: gridWrap.h:125
Int * ulineIndices
Definition: gridWrap.h:100
Int getVlineIndex(Int i)
Definition: gridWrap.h:119
Int lookfor(Real v, Int i1, Int i2)
Definition: gridWrap.cc:232
Int * innerIndices
Definition: gridWrap.h:101
Real get_v_value(Int i)
Definition: gridWrap.h:122
Int getInnerIndex(Int i)
Definition: gridWrap.h:124
Real get_u_value(Int i)
Definition: gridWrap.h:121
Int getUlineIndex(Int i)
Definition: gridWrap.h:120
void leftEndFan(Int i, primStream *pStream)
Definition: gridWrap.cc:273
Real * get_vertex(Int i)
Definition: gridWrap.h:127
void rightEndFan(Int i, primStream *pStream)
Definition: gridWrap.cc:249
Real2 * vertices
Definition: gridWrap.h:105
gridWrap * getGrid()
Definition: gridWrap.h:128
Real u_max
Definition: gridWrap.h:45
Int is_uniform
Definition: gridWrap.h:55
Real v_max
Definition: gridWrap.h:46
Real get_u_min()
Definition: gridWrap.h:73
Real * get_v_values()
Definition: gridWrap.h:86
Int get_n_vlines()
Definition: gridWrap.h:72
Real get_v_max()
Definition: gridWrap.h:76
Int n_vlines
Definition: gridWrap.h:44
void draw()
Definition: gridWrap.cc:127
void print()
Definition: gridWrap.cc:47
Real v_min
Definition: gridWrap.h:46
Real * u_values
Definition: gridWrap.h:52
Real * v_values
Definition: gridWrap.h:53
Int isUniform()
Definition: gridWrap.h:93
Real get_u_max()
Definition: gridWrap.h:74
~gridWrap()
Definition: gridWrap.cc:121
Real get_v_min()
Definition: gridWrap.h:75
Real get_v_value(Int j)
Definition: gridWrap.h:83
Real u_min
Definition: gridWrap.h:45
Real get_u_value(Int i)
Definition: gridWrap.h:78
Int n_ulines
Definition: gridWrap.h:43
Real * get_u_values()
Definition: gridWrap.h:85
void outputFanWithPoint(Int v, Int uleft, Int uright, Real vert[2], primStream *pStream)
Definition: gridWrap.cc:137
Int get_n_ulines()
Definition: gridWrap.h:71
#define free
Definition: debug_ros.c:5
int Int
Definition: definitions.h:37
float Real
Definition: definitions.h:36
Real Real2[2]
Definition: definitions.h:38
#define assert(x)
Definition: debug.h:53
const GLdouble * v
Definition: gl.h:2040
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
int vMax
Definition: tritemp.h:142
int vMin
Definition: tritemp.h:142