diff options
Diffstat (limited to 'src/glu/sgi')
-rw-r--r-- | src/glu/sgi/Makefile | 2 | ||||
-rw-r--r-- | src/glu/sgi/Makefile.mgw | 230 | ||||
-rw-r--r-- | src/glu/sgi/libnurbs/interface/bezierPatch.cc | 7 | ||||
-rw-r--r-- | src/glu/sgi/libnurbs/interface/glcurveval.h | 2 | ||||
-rw-r--r-- | src/glu/sgi/libnurbs/interface/glsurfeval.cc | 7 | ||||
-rw-r--r-- | src/glu/sgi/libnurbs/interface/glsurfeval.h | 2 | ||||
-rw-r--r-- | src/glu/sgi/libnurbs/interface/insurfeval.cc | 4 | ||||
-rw-r--r-- | src/glu/sgi/libutil/error.c | 2 | ||||
-rw-r--r-- | src/glu/sgi/libutil/project.c | 115 |
9 files changed, 295 insertions, 76 deletions
diff --git a/src/glu/sgi/Makefile b/src/glu/sgi/Makefile index 2ce6ac0430..bb1c0a8aba 100644 --- a/src/glu/sgi/Makefile +++ b/src/glu/sgi/Makefile @@ -136,7 +136,7 @@ $(TOP)/$(LIB_DIR): # Make the library: $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME): $(OBJECTS) - $(TOP)/bin/mklib -o $(GLU_LIB) -linker '$(CXX)' \ + $(TOP)/bin/mklib -o $(GLU_LIB) -linker '$(CXX)' -ldflags '$(LDFLAGS)' \ -major $(GLU_MAJOR) -minor $(GLU_MINOR) -patch $(GLU_TINY) \ -cplusplus $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \ $(GLU_LIB_DEPS) $(OBJECTS) diff --git a/src/glu/sgi/Makefile.mgw b/src/glu/sgi/Makefile.mgw new file mode 100644 index 0000000000..d00d97a3b6 --- /dev/null +++ b/src/glu/sgi/Makefile.mgw @@ -0,0 +1,230 @@ +# Mesa 3-D graphics library +# Version: 5.1 +# +# Copyright (C) 1999-2003 Brian Paul All Rights Reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# MinGW core makefile v1.4 for Mesa +# +# Copyright (C) 2002 - Daniel Borca +# Email : dborca@users.sourceforge.net +# Web : http://www.geocities.com/dborca + +# MinGW core-glu makefile updated for Mesa 7.0 +# +# Updated : by Heromyth, on 2007-7-21 +# Email : zxpmyth@yahoo.com.cn +# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work. +# The others havn't been tested yet. +# 2) The generated DLLs are *not* compatible with the ones built +# with the other compilers like VC8, especially for GLUT. +# 3) Although more tests are needed, it can be used individually! + +# +# Available options: +# +# Environment variables: +# CFLAGS +# +# GLIDE path to Glide3 SDK; used with FX. +# default = $(TOP)/glide3 +# FX=1 build for 3dfx Glide3. Note that this disables +# compilation of most WMesa code and requires fxMesa. +# As a consequence, you'll need the Win32 Glide3 +# library to build any application. +# default = no +# ICD=1 build the installable client driver interface +# (windows opengl driver interface) +# default = no +# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow). +# default = no +# +# Targets: +# all: build GL +# clean: remove object files +# + + + +.PHONY: all clean +.INTERMEDIATE: x86/gen_matypes.exe +.SUFFIXES: .rc .res + +# Set this to the prefix of your build tools, i.e. mingw32- +TOOLS_PREFIX = mingw32- + +TOP = ../../.. +LIBDIR = $(TOP)/lib + +LIB_NAME = glu32 +DLL_EXT = .dll +IMP_EXT = .a +LIB_PRE = lib +STRIP = -s + +AR = ar +ARFLAGS = crus +DLLTOOL = dlltool + +GLU_DLL = $(LIB_NAME)$(DLL_EXT) +GLU_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT) +GLU_DEF = $(LIB_NAME).def + +LDLIBS = -L$(LIBDIR) -lopengl32 +LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at + +CFLAGS += -DBUILD_GLU32 -D_DLL + + +CC = $(TOOLS_PREFIX)gcc +CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include -Iinclude +CXX = $(TOOLS_PREFIX)g++ +CXXFLAGS = $(CFLAGS) -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess + +AR = ar +ARFLAGS = crus + +UNLINK = del $(subst /,\,$(1)) +ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) +UNLINK = $(RM) $(1) +endif +ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),) +UNLINK = $(RM) $(1) +endif + +C_SOURCES = \ + libutil/error.c \ + libutil/glue.c \ + libutil/mipmap.c \ + libutil/project.c \ + libutil/quad.c \ + libutil/registry.c \ + libtess/dict.c \ + libtess/geom.c \ + libtess/memalloc.c \ + libtess/mesh.c \ + libtess/normal.c \ + libtess/priorityq.c \ + libtess/render.c \ + libtess/sweep.c \ + libtess/tess.c \ + libtess/tessmono.c + +CC_SOURCES = \ + libnurbs/interface/bezierEval.cc \ + libnurbs/interface/bezierPatch.cc \ + libnurbs/interface/bezierPatchMesh.cc \ + libnurbs/interface/glcurveval.cc \ + libnurbs/interface/glinterface.cc \ + libnurbs/interface/glrenderer.cc \ + libnurbs/interface/glsurfeval.cc \ + libnurbs/interface/incurveeval.cc \ + libnurbs/interface/insurfeval.cc \ + libnurbs/internals/arc.cc \ + libnurbs/internals/arcsorter.cc \ + libnurbs/internals/arctess.cc \ + libnurbs/internals/backend.cc \ + libnurbs/internals/basiccrveval.cc \ + libnurbs/internals/basicsurfeval.cc \ + libnurbs/internals/bin.cc \ + libnurbs/internals/bufpool.cc \ + libnurbs/internals/cachingeval.cc \ + libnurbs/internals/ccw.cc \ + libnurbs/internals/coveandtiler.cc \ + libnurbs/internals/curve.cc \ + libnurbs/internals/curvelist.cc \ + libnurbs/internals/curvesub.cc \ + libnurbs/internals/dataTransform.cc \ + libnurbs/internals/displaylist.cc \ + libnurbs/internals/flist.cc \ + libnurbs/internals/flistsorter.cc \ + libnurbs/internals/hull.cc \ + libnurbs/internals/intersect.cc \ + libnurbs/internals/knotvector.cc \ + libnurbs/internals/mapdesc.cc \ + libnurbs/internals/mapdescv.cc \ + libnurbs/internals/maplist.cc \ + libnurbs/internals/mesher.cc \ + libnurbs/internals/monoTriangulationBackend.cc \ + libnurbs/internals/monotonizer.cc \ + libnurbs/internals/mycode.cc \ + libnurbs/internals/nurbsinterfac.cc \ + libnurbs/internals/nurbstess.cc \ + libnurbs/internals/patch.cc \ + libnurbs/internals/patchlist.cc \ + libnurbs/internals/quilt.cc \ + libnurbs/internals/reader.cc \ + libnurbs/internals/renderhints.cc \ + libnurbs/internals/slicer.cc \ + libnurbs/internals/sorter.cc \ + libnurbs/internals/splitarcs.cc \ + libnurbs/internals/subdivider.cc \ + libnurbs/internals/tobezier.cc \ + libnurbs/internals/trimline.cc \ + libnurbs/internals/trimregion.cc \ + libnurbs/internals/trimvertpool.cc \ + libnurbs/internals/uarray.cc \ + libnurbs/internals/varray.cc \ + libnurbs/nurbtess/directedLine.cc \ + libnurbs/nurbtess/gridWrap.cc \ + libnurbs/nurbtess/monoChain.cc \ + libnurbs/nurbtess/monoPolyPart.cc \ + libnurbs/nurbtess/monoTriangulation.cc \ + libnurbs/nurbtess/partitionX.cc \ + libnurbs/nurbtess/partitionY.cc \ + libnurbs/nurbtess/polyDBG.cc \ + libnurbs/nurbtess/polyUtil.cc \ + libnurbs/nurbtess/primitiveStream.cc \ + libnurbs/nurbtess/quicksort.cc \ + libnurbs/nurbtess/rectBlock.cc \ + libnurbs/nurbtess/sampleComp.cc \ + libnurbs/nurbtess/sampleCompBot.cc \ + libnurbs/nurbtess/sampleCompRight.cc \ + libnurbs/nurbtess/sampleCompTop.cc \ + libnurbs/nurbtess/sampleMonoPoly.cc \ + libnurbs/nurbtess/sampledLine.cc \ + libnurbs/nurbtess/searchTree.cc + +SOURCES = $(C_SOURCES) $(CC_SOURCES) + +OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) + +.c.o: + $(CC) -o $@ $(CFLAGS) -c $< +.cc.o: + $(CXX) -o $@ $(CXXFLAGS) -c $< + + +all: $(LIBDIR) $(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP) + +$(LIBDIR): + mkdir -p $(LIBDIR) + +$(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP): $(OBJECTS) + $(CXX) $(LDFLAGS) -o $(LIBDIR)/$(GLU_DLL) $^ $(LDLIBS) + $(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GLU_DEF) $^ + $(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GLU_IMP) --def $(LIBDIR)/$(GLU_DEF) + + +clean: + -$(call UNLINK,libutil/*.o) + -$(call UNLINK,libtess/*.o) + -$(call UNLINK,libnurbs/interface/*.o) + -$(call UNLINK,libnurbs/internals/*.o) + -$(call UNLINK,libnurbs/nurbtess/*.o) diff --git a/src/glu/sgi/libnurbs/interface/bezierPatch.cc b/src/glu/sgi/libnurbs/interface/bezierPatch.cc index 836ae94e0a..5b7bda1a00 100644 --- a/src/glu/sgi/libnurbs/interface/bezierPatch.cc +++ b/src/glu/sgi/libnurbs/interface/bezierPatch.cc @@ -111,8 +111,11 @@ void bezierPatchDelete(bezierPatch *b) void bezierPatchDeleteList(bezierPatch *b) { bezierPatch *temp; - for(temp = b; temp != NULL; temp = temp->next) - bezierPatchDelete(temp); + while (b != NULL) { + temp = b; + b = b->next; + bezierPatchDelete(temp); + } } bezierPatch* bezierPatchInsert(bezierPatch *list, bezierPatch *b) diff --git a/src/glu/sgi/libnurbs/interface/glcurveval.h b/src/glu/sgi/libnurbs/interface/glcurveval.h index 4b44f6e847..a09a74d04c 100644 --- a/src/glu/sgi/libnurbs/interface/glcurveval.h +++ b/src/glu/sgi/libnurbs/interface/glcurveval.h @@ -93,7 +93,7 @@ public: output_triangles = flag; } #ifdef _WIN32 - void putCallBack(GLenum which, void (APIENTRY *fn)() ); + void putCallBack(GLenum which, void (GLAPIENTRY *fn)() ); #else void putCallBack(GLenum which, _GLUfuncptr fn ); #endif diff --git a/src/glu/sgi/libnurbs/interface/glsurfeval.cc b/src/glu/sgi/libnurbs/interface/glsurfeval.cc index a36b304508..b5bfab1e28 100644 --- a/src/glu/sgi/libnurbs/interface/glsurfeval.cc +++ b/src/glu/sgi/libnurbs/interface/glsurfeval.cc @@ -1184,8 +1184,11 @@ return; } -void -OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn ) +#ifdef _WIN32 +void OpenGLSurfaceEvaluator::putCallBack(GLenum which, void (GLAPIENTRY *fn)() ) +#else +void OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn ) +#endif { switch(which) { diff --git a/src/glu/sgi/libnurbs/interface/glsurfeval.h b/src/glu/sgi/libnurbs/interface/glsurfeval.h index c34a58cb9b..b7a88069f5 100644 --- a/src/glu/sgi/libnurbs/interface/glsurfeval.h +++ b/src/glu/sgi/libnurbs/interface/glsurfeval.h @@ -145,7 +145,7 @@ public: void newtmeshvert( long, long ); #ifdef _WIN32 - void putCallBack(GLenum which, void (APIENTRY *fn)() ); + void putCallBack(GLenum which, void (GLAPIENTRY *fn)() ); #else void putCallBack(GLenum which, _GLUfuncptr fn ); #endif diff --git a/src/glu/sgi/libnurbs/interface/insurfeval.cc b/src/glu/sgi/libnurbs/interface/insurfeval.cc index b314699c7a..e4ee3ef6a2 100644 --- a/src/glu/sgi/libnurbs/interface/insurfeval.cc +++ b/src/glu/sgi/libnurbs/interface/insurfeval.cc @@ -1533,8 +1533,8 @@ void OpenGLSurfaceEvaluator::inEvalVStrip(int n_left, REAL u_left, REAL* left_va } //clean up free(leftXYZ); - free(leftXYZ); - free(rightNormal); + free(rightXYZ); + free(leftNormal); free(rightNormal); } diff --git a/src/glu/sgi/libutil/error.c b/src/glu/sgi/libutil/error.c index 3d1ce9b210..c200056942 100644 --- a/src/glu/sgi/libutil/error.c +++ b/src/glu/sgi/libutil/error.c @@ -82,7 +82,7 @@ gluErrorString(GLenum errorCode) if ((errorCode >= GLU_NURBS_ERROR1) && (errorCode <= GLU_NURBS_ERROR37)) { return (const GLubyte *) __gluNURBSErrorString(errorCode - (GLU_NURBS_ERROR1 - 1)); } - if ((errorCode >= GLU_TESS_ERROR1) && (errorCode <= GLU_TESS_ERROR8)) { + if ((errorCode >= GLU_TESS_ERROR1) && (errorCode <= GLU_TESS_ERROR6)) { return (const GLubyte *) __gluTessErrorString(errorCode - (GLU_TESS_ERROR1 - 1)); } return (const GLubyte *) 0; diff --git a/src/glu/sgi/libutil/project.c b/src/glu/sgi/libutil/project.c index 2b20ad4fb3..356b46b899 100644 --- a/src/glu/sgi/libutil/project.c +++ b/src/glu/sgi/libutil/project.c @@ -168,74 +168,57 @@ static void __gluMultMatrixVecd(const GLdouble matrix[16], const GLdouble in[4], } /* -** inverse = invert(src) -** New, faster implementation by Shan Hao Bo, April 2006. +** Invert 4x4 matrix. +** Contributed by David Moore (See Mesa bug #6748) */ -static int __gluInvertMatrixd(const GLdouble src[16], GLdouble inverse[16]) +static int __gluInvertMatrixd(const GLdouble m[16], GLdouble invOut[16]) { - int i, j, k; - double t; - GLdouble temp[4][4]; - - for (i=0; i<4; i++) { - for (j=0; j<4; j++) { - temp[i][j] = src[i*4+j]; - } - } - __gluMakeIdentityd(inverse); - - for (i = 0; i < 4; i++) { - if (temp[i][i] == 0.0f) { - /* - ** Look for non-zero element in column - */ - for (j = i + 1; j < 4; j++) { - if (temp[j][i] != 0.0f) { - break; - } - } - - if (j != 4) { - /* - ** Swap rows. - */ - for (k = 0; k < 4; k++) { - t = temp[i][k]; - temp[i][k] = temp[j][k]; - temp[j][k] = t; - - t = inverse[i*4+k]; - inverse[i*4+k] = inverse[j*4+k]; - inverse[j*4+k] = t; - } - } - else { - /* - ** No non-zero pivot. The matrix is singular, -which shouldn't - ** happen. This means the user gave us a bad -matrix. - */ - return GL_FALSE; - } - } - - t = 1.0f / temp[i][i]; - for (k = 0; k < 4; k++) { - temp[i][k] *= t; - inverse[i*4+k] *= t; - } - for (j = 0; j < 4; j++) { - if (j != i) { - t = temp[j][i]; - for (k = 0; k < 4; k++) { - temp[j][k] -= temp[i][k]*t; - inverse[j*4+k] -= inverse[i*4+k]*t; - } - } - } - } - return GL_TRUE; + double inv[16], det; + int i; + + inv[0] = m[5]*m[10]*m[15] - m[5]*m[11]*m[14] - m[9]*m[6]*m[15] + + m[9]*m[7]*m[14] + m[13]*m[6]*m[11] - m[13]*m[7]*m[10]; + inv[4] = -m[4]*m[10]*m[15] + m[4]*m[11]*m[14] + m[8]*m[6]*m[15] + - m[8]*m[7]*m[14] - m[12]*m[6]*m[11] + m[12]*m[7]*m[10]; + inv[8] = m[4]*m[9]*m[15] - m[4]*m[11]*m[13] - m[8]*m[5]*m[15] + + m[8]*m[7]*m[13] + m[12]*m[5]*m[11] - m[12]*m[7]*m[9]; + inv[12] = -m[4]*m[9]*m[14] + m[4]*m[10]*m[13] + m[8]*m[5]*m[14] + - m[8]*m[6]*m[13] - m[12]*m[5]*m[10] + m[12]*m[6]*m[9]; + inv[1] = -m[1]*m[10]*m[15] + m[1]*m[11]*m[14] + m[9]*m[2]*m[15] + - m[9]*m[3]*m[14] - m[13]*m[2]*m[11] + m[13]*m[3]*m[10]; + inv[5] = m[0]*m[10]*m[15] - m[0]*m[11]*m[14] - m[8]*m[2]*m[15] + + m[8]*m[3]*m[14] + m[12]*m[2]*m[11] - m[12]*m[3]*m[10]; + inv[9] = -m[0]*m[9]*m[15] + m[0]*m[11]*m[13] + m[8]*m[1]*m[15] + - m[8]*m[3]*m[13] - m[12]*m[1]*m[11] + m[12]*m[3]*m[9]; + inv[13] = m[0]*m[9]*m[14] - m[0]*m[10]*m[13] - m[8]*m[1]*m[14] + + m[8]*m[2]*m[13] + m[12]*m[1]*m[10] - m[12]*m[2]*m[9]; + inv[2] = m[1]*m[6]*m[15] - m[1]*m[7]*m[14] - m[5]*m[2]*m[15] + + m[5]*m[3]*m[14] + m[13]*m[2]*m[7] - m[13]*m[3]*m[6]; + inv[6] = -m[0]*m[6]*m[15] + m[0]*m[7]*m[14] + m[4]*m[2]*m[15] + - m[4]*m[3]*m[14] - m[12]*m[2]*m[7] + m[12]*m[3]*m[6]; + inv[10] = m[0]*m[5]*m[15] - m[0]*m[7]*m[13] - m[4]*m[1]*m[15] + + m[4]*m[3]*m[13] + m[12]*m[1]*m[7] - m[12]*m[3]*m[5]; + inv[14] = -m[0]*m[5]*m[14] + m[0]*m[6]*m[13] + m[4]*m[1]*m[14] + - m[4]*m[2]*m[13] - m[12]*m[1]*m[6] + m[12]*m[2]*m[5]; + inv[3] = -m[1]*m[6]*m[11] + m[1]*m[7]*m[10] + m[5]*m[2]*m[11] + - m[5]*m[3]*m[10] - m[9]*m[2]*m[7] + m[9]*m[3]*m[6]; + inv[7] = m[0]*m[6]*m[11] - m[0]*m[7]*m[10] - m[4]*m[2]*m[11] + + m[4]*m[3]*m[10] + m[8]*m[2]*m[7] - m[8]*m[3]*m[6]; + inv[11] = -m[0]*m[5]*m[11] + m[0]*m[7]*m[9] + m[4]*m[1]*m[11] + - m[4]*m[3]*m[9] - m[8]*m[1]*m[7] + m[8]*m[3]*m[5]; + inv[15] = m[0]*m[5]*m[10] - m[0]*m[6]*m[9] - m[4]*m[1]*m[10] + + m[4]*m[2]*m[9] + m[8]*m[1]*m[6] - m[8]*m[2]*m[5]; + + det = m[0]*inv[0] + m[1]*inv[4] + m[2]*inv[8] + m[3]*inv[12]; + if (det == 0) + return GL_FALSE; + + det = 1.0 / det; + + for (i = 0; i < 16; i++) + invOut[i] = inv[i] * det; + + return GL_TRUE; } static void __gluMultMatricesd(const GLdouble a[16], const GLdouble b[16], |