wrote out the ipow function so its easier to mentally parse

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1401 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2012-11-18 03:31:47 +00:00
parent 82cfc20eac
commit 5a0d107a9c

View File

@ -894,7 +894,18 @@ DECLARE_SHAPE_CACHE(tetrahedron,Tetrahedron,TETRAHEDRON)
/* -- Sierpinski Sponge -- */
static unsigned int ipow (int x, unsigned int y)
{
return y==0? 1: y==1? x: (y%2? x: 1) * ipow(x*x, y/2);
/* return y==0? 1: y==1? x: (y%2? x: 1) * ipow(x*x, y/2); */
if (y==0)
return 1;
else
{
if (y==1)
return x;
else
{
return (y%2? x: 1) * ipow(x*x, y/2);
}
}
}
static void fghSierpinskiSpongeGenerate ( int numLevels, double offset[3], GLfloat scale, GLfloat* vertices, GLfloat* normals )