Fix compilation errors and warnings for NURBS support. (Robert Bergkvist)

This commit is contained in:
Karl Schultz
2001-11-29 16:16:55 +00:00
parent 4e6c835210
commit 9c8cbe6950
13 changed files with 79 additions and 70 deletions

View File

@@ -1,14 +1,5 @@
# Makefile for Win32
#
# Sept 12, 2001
# Note: The nurbs code is not being built at this time.
# If you want to work on it, uncomment the definitions
# noted below to try to compile the sources.
# There are numerous problems, some of which may be solved
# by setting some #defines.
#
!include <win32.mak>
.SUFFIXES : .cc
@@ -116,16 +107,14 @@ all : gludll
gludll : $(GLUDLL)
CFLAGS = $(cvarsdll) $(CFLAGS) -D_OPENGL32_ -Iinclude -DBUILD_GL32
CFLAGS = $(cvarsdll) $(CFLAGS) -D_OPENGL32_ -Iinclude -DBUILD_GL32 -DLIBRARYBUILD
LFLAGS = $(dlllflags) $(lcommon) $(LFLAGS)
OBJS = $(GLU_SRCS:.c=.obj)
LIBS = ../lib/$(MESALIB) winmm.lib $(guilibsdll)
# Uncomment these definitions to try to compile the NURBS code.
#OBJS = $(GLU_SRCS_CC:.cc=.obj) $(GLU_SRCS:.c=.obj)
#NURBSINC = -Ilibnurbs\interface -Ilibnurbs\internals -Ilibnurbs\nurbtess
#CFLAGS = $(CFLAGS) $(NURBSINC)
OBJS = $(GLU_SRCS_CC:.cc=.obj) $(GLU_SRCS:.c=.obj)
NURBSINC = -Ilibnurbs\interface -Ilibnurbs\internals -Ilibnurbs\nurbtess
CFLAGS = $(CFLAGS) $(NURBSINC)
$(GLUDLL): $(OBJS) glu.def
$(link) $(LFLAGS) -out:$(GLUDLL) -def:glu.def $(OBJS) $(LIBS)

View File

@@ -2,7 +2,10 @@ DESCRIPTION 'Mesa GLU (OpenGL work-alike) for Win32'
VERSION 3.5
EXPORTS
gluBeginCurve
gluBeginPolygon
gluBeginSurface
gluBeginTrim
gluBuild1DMipmapLevels
gluBuild1DMipmaps
gluBuild2DMipmapLevels
@@ -11,22 +14,36 @@ EXPORTS
gluBuild3DMipmaps
gluCheckExtension
gluCylinder
gluDeleteNurbsRenderer
gluDeleteQuadric
gluDeleteTess
gluDisk
gluEndCurve
gluEndPolygon
gluEndSurface
gluEndTrim
gluErrorString
gluGetNurbsProperty
gluGetString
gluGetTessProperty
gluLoadSamplingMatrices
gluLookAt
gluNewNurbsRenderer
gluNewQuadric
gluNewTess
gluNextContour
gluNurbsCallback
gluNurbsCallbackData
gluNurbsCallbackDataEXT
gluNurbsCurve
gluNurbsProperty
gluNurbsSurface
gluOrtho2D
gluPartialDisk
gluPerspective
gluPickMatrix
gluProject
gluPwlCurve
gluQuadricCallback
gluQuadricDrawStyle
gluQuadricNormals

View File

@@ -31,10 +31,10 @@
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
**
** $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $
*/
/*
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/bezierEval.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/bezierEval.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $
*/
#include <stdlib.h>
@@ -72,8 +72,8 @@ void bezierCurveEval(float u0, float u1, int order, float *ctlpoints, int stride
{
float uprime = (u-u0)/(u1-u0);
float *ctlptr = ctlpoints;
float oneMinusX = 1.0-uprime;
float XPower = 1.0;
float oneMinusX = 1.0f-uprime;
float XPower = 1.0f;
int i,k;
for(k=0; k<dimension; k++)
@@ -171,7 +171,7 @@ void bezierCurveEvalDerGen(int der, float u0, float u1, int order, float *ctlpoi
*/
void bezierSurfEvalDerGen(int uder, int vder, 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[])
{
int i,j,k;
int i;
float newPoints[MAX_ORDER][MAX_DIMENSION];
for(i=0; i<uorder; i++){
@@ -229,7 +229,7 @@ void bezierSurfEvalNormal(float u0, float u1, int uorder, float v0, float v1, in
/*if size is 0, then nothing is done*/
static void normalize(float vec[3])
{
float size = sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]);
float size = (float)sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]);
if(size < TOLERANCE)
{

View File

@@ -35,8 +35,8 @@
/*
* mapdesc.c++
*
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mapdesc.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
* $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mapdesc.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $
*/
#include <stdio.h>
@@ -372,13 +372,13 @@ Mapdesc::xformAndCullCheck(
unsigned int bits = clipbits( cpts );
outbits |= bits;
inbits &= bits;
if( ( outbits == mask ) && ( inbits != mask ) ) return CULL_ACCEPT;
if( ( outbits == (unsigned int)mask ) && ( inbits != (unsigned int)mask ) ) return CULL_ACCEPT;
}
}
if( outbits != mask ) {
if( outbits != (unsigned int)mask ) {
return CULL_TRIVIAL_REJECT;
} else if( inbits == mask ) {
} else if( inbits == (unsigned int)mask ) {
return CULL_TRIVIAL_ACCEPT;
} else {
return CULL_ACCEPT;
@@ -404,13 +404,13 @@ Mapdesc::cullCheck( REAL *pts, int uorder, int ustride, int vorder, int vstride
unsigned int bits = clipbits( q );
outbits |= bits;
inbits &= bits;
if( ( outbits == mask ) && ( inbits != mask ) ) return CULL_ACCEPT;
if( ( outbits == (unsigned int)mask ) && ( inbits != (unsigned int)mask ) ) return CULL_ACCEPT;
}
}
if( outbits != mask ) {
if( outbits != (unsigned int)mask ) {
return CULL_TRIVIAL_REJECT;
} else if( inbits == mask ) {
} else if( inbits == (unsigned int)mask ) {
return CULL_TRIVIAL_ACCEPT;
} else {
return CULL_ACCEPT;
@@ -434,12 +434,12 @@ Mapdesc::cullCheck( REAL *pts, int order, int stride )
unsigned int bits = clipbits( p );
outbits |= bits;
inbits &= bits;
if( ( outbits == mask ) && ( inbits != mask ) ) return CULL_ACCEPT;
if( ( outbits == (unsigned int)mask ) && ( inbits != (unsigned int)mask ) ) return CULL_ACCEPT;
}
if( outbits != mask ) {
if( outbits != (unsigned int)mask ) {
return CULL_TRIVIAL_REJECT;
} else if( inbits == mask ) {
} else if( inbits == (unsigned int)mask ) {
return CULL_TRIVIAL_ACCEPT;
} else {
return CULL_ACCEPT;

View File

@@ -35,8 +35,8 @@
/*
* mesher.c++
*
* $Date: 2001/08/07 17:34:11 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mesher.cc,v 1.2 2001/08/07 17:34:11 brianp Exp $
* $Date: 2001/11/29 16:16:55 $ $Revision: 1.3 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mesher.cc,v 1.3 2001/11/29 16:16:55 kschultz Exp $
*/
#include "glimports.h"
@@ -82,7 +82,7 @@ Mesher::init( unsigned int npts )
inline void
Mesher::push( GridTrimVertex *gt )
{
assert( itop+1 != stacksize );
assert( itop+1 != (int)stacksize );
vdata[++itop] = gt;
}

View File

@@ -35,8 +35,8 @@
/*
* sorter.c++
*
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/sorter.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
* $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/sorter.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $
*/
#include "glimports.h"
@@ -84,7 +84,7 @@ Sorter::qs1( char *a, char *l )
unsigned int n;
start:
if((n=l-a) <= es)
if((n=l-a) <= (unsigned int)es)
return;
n = es * (n / (2*es));
hp = lp = a+n;

View File

@@ -31,10 +31,10 @@
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
**
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $
*/
/*
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/directedLine.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/directedLine.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $
*/
#include <stdlib.h>
@@ -596,7 +596,7 @@ Real directedLine::polyArea()
y2 = temp->next->head()[1];
ret += -( x2*y1-x1*y2);
}
return 0.5*ret;
return Real(0.5)*ret;
}
/*******************split or combine polygons begin********************/

View File

@@ -31,10 +31,10 @@
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
**
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $
*/
/*
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/partitionY.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/partitionY.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $
*/
#include <stdlib.h>
@@ -231,7 +231,7 @@ Int sweepRangeEqual(sweepRange* src1, sweepRange* src2)
*/
inline/*static*/ Real intersectHoriz(Real x1, Real y1, Real x2, Real y2, Real y)
{
return ((y2==y1)? (x1+x2)*0.5 : x1 + ((y-y1)/(y2-y1)) * (x2-x1));
return ((y2==y1)? (x1+x2)*Real(0.5) : x1 + ((y-y1)/(y2-y1)) * (x2-x1));
/*
if(y2 == y1) return (x1+x2)*0.5;
else return x1 + ((y-y1)/(y2-y1)) * (x2-x1);
@@ -309,7 +309,7 @@ static Int compEdges(directedLine *e1, directedLine *e2)
Real Ymax = min(e1_Ymax, e2_Ymax);
Real Ymin = max(e1_Ymin, e2_Ymin);
Real y = 0.5*(Ymax + Ymin);
Real y = Real(0.5)*(Ymax + Ymin);
/* Real x1 = intersectHoriz(e1->head()[0], e1->head()[1], e1->tail()[0], e1->tail()[1], y);
Real x2 = intersectHoriz(e2->head()[0], e2->head()[1], e2->tail()[0], e2->tail()[1], y);

View File

@@ -31,10 +31,10 @@
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
**
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $
*/
/*
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $
*/
#include <stdlib.h>
@@ -395,7 +395,7 @@ poly->printList();
*/
/*for debug purpose*/
assert( (DBG_rayIntersectPoly(v,1,0,poly) % 2 )
== (DBG_rayIntersectPoly(v,1,0.1234, poly) % 2 )
== (DBG_rayIntersectPoly(v,1,Real(0.1234), poly) % 2 )
);
if(DBG_rayIntersectPoly(v, 1, 0, poly) % 2 == 1)
return 1;

View File

@@ -31,20 +31,24 @@
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
**
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $
*/
/*
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/polyUtil.h,v 1.1 2001/03/17 00:25:41 brianp Exp $
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/polyUtil.h,v 1.2 2001/11/29 16:16:55 kschultz Exp $
*/
#ifndef _POLYUTIL_H
#define _POLYUTIL_H
#include "definitions.h"
#ifdef __cplusplus
extern "C" {
#endif
Real area(Real A[2], Real B[2], Real C[2]);
Int pointLeftLine(Real A[2], Real B[2], Real P[2]);
Int pointLeft2Lines(Real A[2], Real B[2], Real C[2], Real P[2]);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -31,10 +31,10 @@
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
**
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $
*/
/*
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $
*/
#include <stdlib.h>
@@ -327,7 +327,7 @@ Int findBotSeparator(vertexArray* leftChain,
{
oldLeftI = leftCorner-1;
oldRightI = rightCorner;
leftMax = leftChain->getVertex(leftCorner)[0] - 1.0 ; //initilize to be left of leftCorner
leftMax = leftChain->getVertex(leftCorner)[0] - Real(1.0) ; //initilize to be left of leftCorner
rightMin = rightChain->getVertex(rightCorner)[0];
}
else //rightlower
@@ -335,7 +335,7 @@ Int findBotSeparator(vertexArray* leftChain,
oldLeftI = leftCorner;
oldRightI = rightCorner-1;
leftMax = leftChain->getVertex(leftCorner)[0];
rightMin = rightChain->getVertex(rightCorner)[0] + 1.0;
rightMin = rightChain->getVertex(rightCorner)[0] + Real(1.0);
}
//i: the current working leftChain Index

View File

@@ -31,10 +31,10 @@
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
**
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $
*/
/*
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $
*/
#include <stdlib.h>
@@ -343,7 +343,7 @@ Int findTopSeparator(vertexArray* leftChain,
{
oldLeftI = leftEndIndex+1;
oldRightI = rightEndIndex;
leftMax = leftChain->getVertex(leftEndIndex)[0] - 1.0; //initilza to left of leftU
leftMax = leftChain->getVertex(leftEndIndex)[0] - Real(1.0); //initilza to left of leftU
rightMin = rightChain->getVertex(rightEndIndex)[0];
}
else
@@ -351,7 +351,7 @@ Int findTopSeparator(vertexArray* leftChain,
oldLeftI = leftEndIndex;
oldRightI = rightEndIndex+1;
leftMax = leftChain->getVertex(leftEndIndex)[0];
rightMin = rightChain->getVertex(rightEndIndex)[0] + 1.0;
rightMin = rightChain->getVertex(rightEndIndex)[0] + Real(1.0);
}
//i: the current working leftChain index,
@@ -826,19 +826,19 @@ static void sampleCompTopSimpleOpt(gridWrap* grid,
//find l in [j, k-1] so that dec_chain[l][0] 0 is closest to
// inc_chain[i]
int l;
Real tempI = j;
Real tempMin = fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(j)[0]);
Real tempI = Real(j);
Real tempMin = (Real)fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(j)[0]);
for(l=j+1; l<= k-1; l++)
{
if(fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(l)[0])
<= tempMin)
{
tempMin = fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(l)[0]);
tempI = l;
tempMin = (Real)fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(l)[0]);
tempI = (Real)l;
}
}
//inc_chain[i] and dec_chain[tempI] are connected.
monoTriangulationRecGenOpt(dec_chain->getVertex(tempI),
monoTriangulationRecGenOpt(dec_chain->getVertex((int)tempI),
botVertex,
inc_chain, i, inc_end,
dec_chain, (int)(tempI+1), dec_end,
@@ -866,12 +866,12 @@ static void sampleCompTopSimpleOpt(gridWrap* grid,
//inc_chain[l][0] is the closet to dec_chain[j][0]
int tempI = i;
int l;
Real tempMin = fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(j)[0]);
Real tempMin = (Real)fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(j)[0]);
for(l=i+1; l<=k-1; l++)
{
if(fabs(inc_chain->getVertex(l)[0] - dec_chain->getVertex(j)[0]) <= tempMin)
{
tempMin = fabs(inc_chain->getVertex(l)[0] - dec_chain->getVertex(j)[0]);
tempMin = (Real)fabs(inc_chain->getVertex(l)[0] - dec_chain->getVertex(j)[0]);
tempI = l;
}
}

View File

@@ -31,10 +31,10 @@
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
**
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
** $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $
*/
/*
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $
*/
#include <stdlib.h>
@@ -96,7 +96,6 @@ sampledLine::sampledLine(Int n_points, Real2 pts[])
sampledLine::sampledLine(Real pt1[2], Real pt2[2])
{
int i;
npoints = 2;
points = (Real2*) malloc(sizeof(Real2) * 2);
assert(points);