ReactOS  0.4.14-dev-342-gdc047f9
bezierPatch.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  bezierPatch
 

Typedefs

typedef struct bezierPatch bezierPatch
 

Functions

bezierPatchbezierPatchMake (float umin, float vmin, float umax, float vmax, int urder, int vorder, int dimension)
 
bezierPatchbezierPatchMake2 (float umin, float vmin, float umax, float vmax, int urder, int vorder, int dimension, int ustride, int vstride, float *ctlpoints)
 
bezierPatchbezierPatchInsert (bezierPatch *list, bezierPatch *b)
 
void bezierPatchDelete (bezierPatch *b)
 
void bezierPatchDeleteList (bezierPatch *b)
 
void bezierPatchPrint (bezierPatch *b)
 
void bezierPatchPrintList (bezierPatch *list)
 
void bezierPatchEval (bezierPatch *b, float u, float v, float ret[])
 
void bezierPatchEvalNormal (bezierPatch *b, float u, float v, float retNormal[])
 
void bezierPatchDraw (bezierPatch *bpatch, int u_reso, int v_reso)
 
void bezierPatchListDraw (bezierPatch *list, int u_reso, int v_reso)
 

Typedef Documentation

◆ bezierPatch

Function Documentation

◆ bezierPatchDelete()

void bezierPatchDelete ( bezierPatch b)

Definition at line 101 of file bezierPatch.cc.

102 {
103  free(b->ctlpoints);
104  free(b);
105 }
#define free
Definition: debug_ros.c:5
GLboolean GLboolean GLboolean b
Definition: glext.h:6204

Referenced by bezierPatchDeleteList(), and bezierPatchMeshDelete().

◆ bezierPatchDeleteList()

void bezierPatchDeleteList ( bezierPatch b)

Definition at line 109 of file bezierPatch.cc.

110 {
111  bezierPatch *temp;
112  while (b != NULL) {
113  temp = b;
114  b = b->next;
116  }
117 }
void bezierPatchDelete(bezierPatch *b)
Definition: bezierPatch.cc:101
smooth NULL
Definition: ftsmooth.c:416
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
static calc_node_t temp
Definition: rpn_ieee.c:38
struct define * next
Definition: compiler.c:65

◆ bezierPatchDraw()

void bezierPatchDraw ( bezierPatch bpatch,
int  u_reso,
int  v_reso 
)

Definition at line 175 of file bezierPatch.cc.

176 {
177  if(bpatch->dimension == 3)
178  glMap2f(GL_MAP2_VERTEX_3, bpatch->umin, bpatch->umax, 3*bpatch->vorder, bpatch->uorder, bpatch->vmin, bpatch->vmax,3, bpatch->vorder, (GLfloat*) bpatch->ctlpoints);
179  else
180  glMap2f(GL_MAP2_VERTEX_4, bpatch->umin, bpatch->umax, 4*bpatch->vorder, bpatch->uorder, bpatch->vmin, bpatch->vmax,3, bpatch->vorder, (GLfloat*) bpatch->ctlpoints);
181 
182  glMapGrid2f(u_reso, bpatch->umin, bpatch->umax,
183  v_reso, bpatch->vmin, bpatch->vmax);
184  glEvalMesh2(GL_LINE, 0, u_reso, 0, v_reso);
185 }
float * ctlpoints
Definition: bezierPatch.h:58
GLAPI void GLAPIENTRY glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
float vmin
Definition: bezierPatch.h:37
#define GL_LINE
Definition: gl.h:266
#define GL_MAP2_VERTEX_4
Definition: gl.h:568
float umax
Definition: bezierPatch.h:37
GLAPI void GLAPIENTRY glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
float vmax
Definition: bezierPatch.h:37
#define GL_MAP2_VERTEX_3
Definition: gl.h:567
float umin
Definition: bezierPatch.h:37
float GLfloat
Definition: gl.h:161
GLAPI void GLAPIENTRY glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)

Referenced by bezierPatchListDraw().

◆ bezierPatchEval()

void bezierPatchEval ( bezierPatch b,
float  u,
float  v,
float  ret[] 
)

Definition at line 142 of file bezierPatch.cc.

143 {
144  if( u >= b->umin && u<= b->umax
145  && v >= b->vmin && v<= b->vmax)
146  {
147 
148  bezierSurfEval(b->umin, b->umax, b->uorder, b->vmin, b->vmax, b->vorder, b->dimension, b->ctlpoints, b->dimension * b->vorder, b->dimension, u, v, ret);
149 
150  }
151  else if(b->next != NULL)
152  bezierPatchEval(b->next, u,v, ret);
153  else
154  bezierSurfEval(b->umin, b->umax, b->uorder, b->vmin, b->vmax, b->vorder, b->dimension, b->ctlpoints, b->dimension * b->vorder, b->dimension, u, v, ret);
155 }
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 * u
Definition: glfuncs.h:240
smooth NULL
Definition: ftsmooth.c:416
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
void bezierPatchEval(bezierPatch *b, float u, float v, float ret[])
Definition: bezierPatch.cc:142
int ret
void bezierSurfEval(float u0, float u1, int uorder, float v0, float v1, int vorder, int dimension, float *ctlpoints, int ustride, int vstride, float u, float v, float ret[])
Definition: bezierEval.cc:192
const GLdouble * v
Definition: gl.h:2040

Referenced by bezierPatchEval().

◆ bezierPatchEvalNormal()

void bezierPatchEvalNormal ( bezierPatch b,
float  u,
float  v,
float  retNormal[] 
)

Definition at line 159 of file bezierPatch.cc.

160 {
161  bezierSurfEvalNormal(b->umin, b->umax, b->uorder, b->vmin, b->vmax, b->vorder, b->dimension, b->ctlpoints, b->dimension * b->vorder, b->dimension, u, v, ret);
162 
163  if( u >= b->umin && u<= b->umax
164  && v >= b->vmin && v<= b->vmax)
165  {
166  bezierSurfEvalNormal(b->umin, b->umax, b->uorder, b->vmin, b->vmax, b->vorder, b->dimension, b->ctlpoints, b->dimension * b->vorder, b->dimension, u, v, ret);
167  }
168  else if(b->next != NULL)
169  bezierPatchEvalNormal(b->next, u,v, ret);
170  else
171  bezierSurfEvalNormal(b->umin, b->umax, b->uorder, b->vmin, b->vmax, b->vorder, b->dimension, b->ctlpoints, b->dimension * b->vorder, b->dimension, u, v, ret);
172 
173 }
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 * u
Definition: glfuncs.h:240
void bezierPatchEvalNormal(bezierPatch *b, float u, float v, float ret[])
Definition: bezierPatch.cc:159
smooth NULL
Definition: ftsmooth.c:416
void bezierSurfEvalNormal(float u0, float u1, int uorder, float v0, float v1, int vorder, int dimension, float *ctlpoints, int ustride, int vstride, float u, float v, float retNormal[])
Definition: bezierEval.cc:202
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
int ret
const GLdouble * v
Definition: gl.h:2040

Referenced by bezierPatchEvalNormal().

◆ bezierPatchInsert()

bezierPatch* bezierPatchInsert ( bezierPatch list,
bezierPatch b 
)

Definition at line 119 of file bezierPatch.cc.

120 {
121  b->next = list;
122  return b;
123 }
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define list
Definition: rosglue.h:35

◆ bezierPatchListDraw()

void bezierPatchListDraw ( bezierPatch list,
int  u_reso,
int  v_reso 
)

Definition at line 187 of file bezierPatch.cc.

188 {
189  bezierPatch *temp;
195 glColor3f(1,0,0);
196 #ifdef DEBUG
197 printf("mapmap\n");
198 #endif
199 
200 
201  for(temp = list; temp != NULL; temp = temp->next)
202  bezierPatchDraw(temp, u_reso, v_reso);
203 }
#define GL_LIGHT0
Definition: gl.h:311
smooth NULL
Definition: ftsmooth.c:416
#define GL_LIGHTING
Definition: gl.h:310
#define GL_AUTO_NORMAL
Definition: gl.h:550
#define GL_MAP2_VERTEX_3
Definition: gl.h:567
void bezierPatchDraw(bezierPatch *bpatch, int u_reso, int v_reso)
Definition: bezierPatch.cc:175
GLAPI void GLAPIENTRY glEnable(GLenum cap)
Definition: _list.h:228
#define GL_NORMALIZE
Definition: gl.h:343
static calc_node_t temp
Definition: rpn_ieee.c:38
GLAPI void GLAPIENTRY glColor3f(GLfloat red, GLfloat green, GLfloat blue)
#define printf
Definition: config.h:203

◆ bezierPatchMake()

bezierPatch* bezierPatchMake ( float  umin,
float  vmin,
float  umax,
float  vmax,
int  urder,
int  vorder,
int  dimension 
)

Definition at line 52 of file bezierPatch.cc.

53 {
55  assert(ret);
56  ret->umin = umin;
57  ret->vmin = vmin;
58  ret->umax = umax;
59  ret->vmax = vmax;
60  ret->uorder = uorder;
61  ret->vorder = vorder;
62  ret->dimension = dimension;
63  ret->ctlpoints = (float*) malloc(sizeof(float) * dimension * uorder * vorder);
64  assert(ret->ctlpoints);
65 
66  ret->next = NULL;
67 
68  return ret;
69 }
#define assert(x)
Definition: debug.h:53
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint vorder
Definition: glext.h:8308
smooth NULL
Definition: ftsmooth.c:416
GLdouble GLdouble GLint GLint uorder
Definition: glext.h:8308
int ret
#define malloc
Definition: debug_ros.c:4

Referenced by bezierPatchMeshMake().

◆ bezierPatchMake2()

bezierPatch* bezierPatchMake2 ( float  umin,
float  vmin,
float  umax,
float  vmax,
int  urder,
int  vorder,
int  dimension,
int  ustride,
int  vstride,
float *  ctlpoints 
)

Definition at line 71 of file bezierPatch.cc.

72 {
74  assert(ret);
75  ret->umin = umin;
76  ret->vmin = vmin;
77  ret->umax = umax;
78  ret->vmax = vmax;
79  ret->uorder = uorder;
80  ret->vorder = vorder;
81  ret->dimension = dimension;
82  ret->ctlpoints = (float*) malloc(sizeof(float) * dimension * uorder * vorder);
83  assert(ret->ctlpoints);
84 
85  /*copy the control points there*/
86  int the_ustride = vorder * dimension;
87  int the_vstride = dimension;
88  for(int i=0; i<uorder; i++)
89  for(int j=0; j<vorder; j++)
90  for(int k=0; k<dimension; k++)
91  ret->ctlpoints[i * the_ustride + j*the_vstride+k] = ctlpoints[i*ustride+j*vstride+k];
92 
93  ret->next = NULL;
94 
95  return ret;
96 }
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint vstride
Definition: glext.h:8308
GLdouble GLdouble GLint ustride
Definition: glext.h:8308
#define assert(x)
Definition: debug.h:53
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint vorder
Definition: glext.h:8308
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
smooth NULL
Definition: ftsmooth.c:416
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
GLdouble GLdouble GLint GLint uorder
Definition: glext.h:8308
int ret
#define malloc
Definition: debug_ros.c:4
int k
Definition: mpi.c:3369

Referenced by bezierPatchMeshPutPatch().

◆ bezierPatchPrint()

void bezierPatchPrint ( bezierPatch b)

Definition at line 126 of file bezierPatch.cc.

127 {
128  printf("bezierPatch:\n");
129  printf("umin,umax=(%f,%f), (vmin, vmax)=(%f,%f)\n", b->umin, b->umax, b->vmin, b->vmax);
130  printf("uorder=%i, vorder=%i\n", b->uorder, b->vorder);
131  printf("idmension = %i\n", b->dimension);
132 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define printf
Definition: config.h:203

Referenced by bezierPatchMeshPrint(), and bezierPatchPrintList().

◆ bezierPatchPrintList()

void bezierPatchPrintList ( bezierPatch list)

Definition at line 135 of file bezierPatch.cc.

136 {
137  bezierPatch* temp;
138  for(temp=list; temp != NULL; temp = temp->next)
140 }
void bezierPatchPrint(bezierPatch *b)
Definition: bezierPatch.cc:126
smooth NULL
Definition: ftsmooth.c:416
Definition: _list.h:228
static calc_node_t temp
Definition: rpn_ieee.c:38