48void drawStrips(
float *vertex_array,
float *normal_array,
int *length_array,
GLenum *type_array,
int num_strips)
53 for(
i=0;
i<num_strips;
i++)
56 for(
j=0;
j<length_array[
i];
j++)
100bezierPatchMesh *
bezierPatchMeshMake(
int maptype,
float umin,
float umax,
int ustride,
int uorder,
float vmin,
float vmax,
int vstride,
int vorder,
float *ctlpoints,
int size_UVarray,
int size_length_array)
110 fprintf(
stderr,
"error in inMap2f, maptype=%i is wrong, maptype,map is invalid\n", maptype);
123 the_ustride =
vorder * dimension;
124 the_vstride = dimension;
127 for(
k=0;
k<dimension;
k++)
131 ret->size_UVarray = size_UVarray;
132 ret->size_length_array = size_length_array;
133 ret->UVarray = (
float*)
malloc(
sizeof(
float) * size_UVarray);
135 ret->length_array = (
int *)
malloc(
sizeof(
int) * size_length_array);
140 ret->index_UVarray = 0;
141 ret->index_length_array = 0;
162 ret->size_UVarray = size_UVarray;
163 ret->size_length_array = size_length_array;
164 ret->UVarray = (
float*)
malloc(
sizeof(
float) * size_UVarray);
166 ret->length_array = (
int *)
malloc(
sizeof(
int) * size_length_array);
171 ret->index_UVarray = 0;
172 ret->index_length_array = 0;
183void bezierPatchMeshPutPatch(
bezierPatchMesh *bpm,
int maptype,
float umin,
float umax,
int ustride,
int uorder,
float vmin,
float vmax,
int vstride,
int vorder,
float *ctlpoints)
214 fprintf(
stderr,
"error in bezierPatchMeshPutPatch, maptype=%i is wrong, maptype,map is invalid\n", maptype);
329 printf(
"the bezier patch is\n");
339 printf(
"length_array is\n");
369 sum +=
temp->index_length_array;
420 fprintf(
stderr,
"error in bezierPatchMeshListNumTriangles, type invalid\n");
429 if(bpm ==
NULL)
return;
431 int *new_length_array;
433 int index_new_length_array;
435 int index_new_UVarray;
444 index_new_length_array = 0;
453 new_UVarray[index_new_UVarray++] = bpm->
UVarray[
k++];
455 new_length_array[index_new_length_array] = bpm->
length_array[
i];
456 new_type_array[index_new_length_array] = bpm->
type_array[
i];
457 index_new_length_array++;
507 bezierSurfEval(u0,
u1,
uorder,
v0,
v1,
vorder, dimension, ctlpoints,
ustride,
vstride,
u,
v, bpm->
vertex_array+
l);
508 bezierSurfEvalNormal(u0,
u1,
uorder,
v0,
v1,
vorder, dimension, ctlpoints,
ustride,
vstride,
u,
v, bpm->
normal_array+
l);
556 (*vertex_array) = (
float *)
malloc(
sizeof(
float) * total_num_vertices*3);
558 (*normal_array) = (
float *)
malloc(
sizeof(
float) * total_num_vertices*3);
563 *length_array = (
int*)
malloc(
sizeof(
int) * (*num_strips));
574 for(
i=0;
i<
temp->index_length_array;
i++)
576 for(
j=0;
j<
temp->length_array[
i];
j++)
578 (*vertex_array)[
k] =
temp->vertex_array[
x];
579 (*vertex_array)[
k+1] =
temp->vertex_array[
x+1];
580 (*vertex_array)[
k+2] =
temp->vertex_array[
x+2];
582 (*normal_array)[
k] =
temp->normal_array[
x];
583 (*normal_array)[
k+1] =
temp->normal_array[
x+1];
584 (*normal_array)[
k+2] =
temp->normal_array[
x+2];
589 (*type_array)[
l] =
temp->type_array[
i];
590 (*length_array)[
l++] =
temp->length_array[
i];
599 if( (
A[0] ==
B[0] &&
A[1]==
B[1]) ||
600 (
A[0] ==
C[0] &&
A[1]==
C[1]) ||
601 (
B[0] ==
C[0] &&
B[1]==
C[1])
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[])
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[])
void bezierPatchMeshListDraw(bezierPatchMesh *list)
int bezierPatchMeshListNumTriangles(bezierPatchMesh *list)
int bezierPatchMeshNumTriangles(bezierPatchMesh *bpm)
void bezierPatchMeshInsertUV(bezierPatchMesh *bpm, float u, float v)
void bezierPatchMeshEndStrip(bezierPatchMesh *bpm)
void bezierPatchMeshDraw(bezierPatchMesh *bpm)
void bezierPatchMeshPutPatch(bezierPatchMesh *bpm, int maptype, float umin, float umax, int ustride, int uorder, float vmin, float vmax, int vstride, int vorder, float *ctlpoints)
void bezierPatchMeshBeginStrip(bezierPatchMesh *bpm, GLenum type)
void bezierPatchMeshListPrint(bezierPatchMesh *list)
void bezierPatchMeshListDelete(bezierPatchMesh *list)
void bezierPatchMeshListEval(bezierPatchMesh *list)
bezierPatchMesh * bezierPatchMeshMake(int maptype, float umin, float umax, int ustride, int uorder, float vmin, float vmax, int vstride, int vorder, float *ctlpoints, int size_UVarray, int size_length_array)
void bezierPatchMeshListCollect(bezierPatchMesh *list, float **vertex_array, float **normal_array, int **length_array, GLenum **type_array, int *num_strips)
bezierPatchMesh * bezierPatchMeshListReverse(bezierPatchMesh *list)
int bezierPatchMeshListTotalStrips(bezierPatchMesh *list)
int bezierPatchMeshListTotalVert(bezierPatchMesh *list)
bezierPatchMesh * bezierPatchMeshListInsert(bezierPatchMesh *list, bezierPatchMesh *bpm)
void bezierPatchMeshEval(bezierPatchMesh *bpm)
void bezierPatchMeshPrint(bezierPatchMesh *bpm)
void drawStrips(float *vertex_array, float *normal_array, int *length_array, GLenum *type_array, int num_strips)
bezierPatchMesh * bezierPatchMeshMake2(int size_UVarray, int size_length_array)
static int isDegenerate(float A[2], float B[2], float C[2])
void bezierPatchMeshListDelDeg(bezierPatchMesh *list)
void bezierPatchMeshDelDeg(bezierPatchMesh *bpm)
void bezierPatchMeshDelete(bezierPatchMesh *bpm)
bezierPatch * bezierPatchMake2(float umin, float vmin, float umax, float vmax, int uorder, int vorder, int dimension, int ustride, int vstride, float *ctlpoints)
void bezierPatchPrint(bezierPatch *b)
void bezierPatchDelete(bezierPatch *b)
bezierPatch * bezierPatchMake(float umin, float vmin, float umax, float vmax, int uorder, int vorder, int dimension)
#define GL_MAP2_TEXTURE_COORD_2
GLint GLint GLint GLint GLint x
#define GL_MAP2_TEXTURE_COORD_4
GLuint GLuint GLsizei GLenum type
GLAPI void GLAPIENTRY glBegin(GLenum mode)
GLAPI void GLAPIENTRY glVertex3fv(const GLfloat *v)
GLAPI void GLAPIENTRY glEnd(void)
#define GL_MAP2_TEXTURE_COORD_1
#define GL_MAP2_TEXTURE_COORD_3
#define GL_TRIANGLE_STRIP
GLAPI void GLAPIENTRY glNormal3fv(const GLfloat *v)
GLdouble GLdouble GLint ustride
GLdouble GLdouble GLint GLint uorder
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint vorder
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint vstride
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
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
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
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static int sum(int x_, int y_)
struct bezierPatchMesh * next
bezierPatch * bpatch_color
bezierPatch * bpatch_texcoord
bezierPatch * bpatch_normal