X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmath%2Fm_eval.c;h=f0c7190b799d6c29d33ef9e4b2aff5cce613bac7;hb=5306ee736ebcce0c1cf899589c2344acdedc2162;hp=c182bbff01b300096757531e9bdb4c51f85a7f3d;hpb=b51b0a847d7e7daaea69f77ab569086ef81c24a2;p=mesa.git diff --git a/src/mesa/math/m_eval.c b/src/mesa/math/m_eval.c index c182bbff01b..f0c7190b799 100644 --- a/src/mesa/math/m_eval.c +++ b/src/mesa/math/m_eval.c @@ -1,10 +1,8 @@ -/* $Id: m_eval.c,v 1.2 2001/03/07 05:06:12 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 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"), @@ -19,9 +17,10 @@ * 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. + * THE AUTHORS OR COPYRIGHT HOLDERS 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. */ @@ -38,8 +37,8 @@ */ -#include "glheader.h" -#include "config.h" +#include "main/glheader.h" +#include "main/config.h" #include "m_eval.h" static GLfloat inv_tab[MAX_EVAL_ORDER]; @@ -72,32 +71,31 @@ static GLfloat inv_tab[MAX_EVAL_ORDER]; void -_math_horner_bezier_curve(const GLfloat *cp, GLfloat *out, GLfloat t, +_math_horner_bezier_curve(const GLfloat * cp, GLfloat * out, GLfloat t, GLuint dim, GLuint order) { - GLfloat s, powert; - GLuint i, k, bincoeff; + GLfloat s, powert, bincoeff; + GLuint i, k; - if(order >= 2) - { - bincoeff = order-1; - s = 1.0-t; + if (order >= 2) { + bincoeff = (GLfloat) (order - 1); + s = 1.0F - t; - for(k=0; k constant curve */ - { - for(k=0; k constant curve */ + + for (k = 0; k < dim; k++) out[k] = cp[k]; } } @@ -117,69 +115,64 @@ _math_horner_bezier_curve(const GLfloat *cp, GLfloat *out, GLfloat t, */ void -_math_horner_bezier_surf(GLfloat *cn, GLfloat *out, GLfloat u, GLfloat v, +_math_horner_bezier_surf(GLfloat * cn, GLfloat * out, GLfloat u, GLfloat v, GLuint dim, GLuint uorder, GLuint vorder) { - GLfloat *cp = cn + uorder*vorder*dim; - GLuint i, uinc = vorder*dim; + GLfloat *cp = cn + uorder * vorder * dim; + GLuint i, uinc = vorder * dim; - if(vorder > uorder) - { - if(uorder >= 2) - { - GLfloat s, poweru; - GLuint j, k, bincoeff; + if (vorder > uorder) { + if (uorder >= 2) { + GLfloat s, poweru, bincoeff; + GLuint j, k; /* Compute the control polygon for the surface-curve in u-direction */ - for(j=0; j cn defines a curve in v */ + else /* uorder=1 -> cn defines a curve in v */ _math_horner_bezier_curve(cn, out, v, dim, vorder); } - else /* vorder <= uorder */ - { - if(vorder > 1) - { + else { /* vorder <= uorder */ + + if (vorder > 1) { GLuint i; /* Compute the control polygon for the surface-curve in u-direction */ - for(i=0; i cn defines a curve in u */ + else /* vorder=1 -> cn defines a curve in u */ _math_horner_bezier_curve(cn, out, u, dim, uorder); } } @@ -199,15 +192,15 @@ _math_horner_bezier_surf(GLfloat *cn, GLfloat *out, GLfloat u, GLfloat v, */ void -_math_de_casteljau_surf(GLfloat *cn, GLfloat *out, GLfloat *du, GLfloat *dv, - GLfloat u, GLfloat v, GLuint dim, +_math_de_casteljau_surf(GLfloat * cn, GLfloat * out, GLfloat * du, + GLfloat * dv, GLfloat u, GLfloat v, GLuint dim, GLuint uorder, GLuint vorder) { - GLfloat *dcn = cn + uorder*vorder*dim; - GLfloat us = 1.0-u, vs = 1.0-v; + GLfloat *dcn = cn + uorder * vorder * dim; + GLfloat us = 1.0F - u, vs = 1.0F - v; GLuint h, i, j, k; GLuint minorder = uorder < vorder ? uorder : vorder; - GLuint uinc = vorder*dim; + GLuint uinc = vorder * dim; GLuint dcuinc = vorder; /* Each component is evaluated separately to save buffer space */ @@ -218,267 +211,234 @@ _math_de_casteljau_surf(GLfloat *cn, GLfloat *out, GLfloat *du, GLfloat *dv, #define CN(I,J,K) cn[(I)*uinc+(J)*dim+(K)] #define DCN(I, J) dcn[(I)*dcuinc+(J)] - if(minorder < 3) - { - if(uorder==vorder) - { - for(k=0; k