Main Page   Class Hierarchy   Compound List   File List   Compound Members  

RoundedCube.h

00001 // A class that represents a cube with rounded edges.
00002 // Copyright (C) 2002  Martin Geisler <gimpster@gimpster.com>
00003 //
00004 // This program is free software; you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation; either version 2 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful, but
00010 // WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00012 // General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 #ifndef ROUNDEDCUBE_H
00019 #define ROUNDEDCUBE_H
00020 
00021 #ifdef HAVE_CONFIG_H
00022 #include <config.h>
00023 #endif
00024 
00025 #include <GL/glut.h>
00026 #include <math.h>
00027 
00039 class RoundedCube {
00040 
00041  private:
00042   float side_length;
00043   float round_width;
00044   int round_steps;
00045 
00046   void CopyColor(float a[], float b[]);
00047   void RotateColors(int a, int b, int c, int d);
00048 
00049   void MakeCornerSphere();
00050   void MakeRoundedSide();
00051   void DrawMarker();
00052   void DrawArrow(float x1, float y1, float z1,
00053                  float x2, float y2, float z2);
00054 
00055   float sides[6][3];
00056   float sides_specular[4];
00057   float sides_shininess[1];
00058   float bevel_diffuse[4];
00059   float bevel_specular[4];
00060   float bevel_shininess[1];
00061 
00062  public:
00064   enum axis { Xaxis, Yaxis, Zaxis };
00065 
00068   bool draw_normals;
00069 
00081   RoundedCube(float s_length = 0.8, float r_width = 0.1, int r_steps = 2);
00082 
00085   void render();
00086 
00097   void rotate(axis a, bool direction);
00098 
00099 };
00100 
00101 #endif

Generated on Wed Jan 23 17:53:15 2002 for rubik by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001