Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXGLSphere.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                   O p e n G L   S p h e r e   O b j e c t                     *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1998,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXGLSphere.h,v 1.18 2006/01/22 17:58:03 fox Exp $                        *
00023 ********************************************************************************/
00024 #ifndef FXGLSPHERE_H
00025 #define FXGLSPHERE_H
00026 
00027 #ifndef FXGLSHAPE_H
00028 #include "FXGLShape.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 /// OpenGL Sphere Object
00035 class FXAPI FXGLSphere : public FXGLShape {
00036   FXDECLARE(FXGLSphere)
00037 public:
00038   FXfloat radius;   // Radius of sphere
00039   FXint   slices;   // Longitudinal subdivision
00040   FXint   stacks;   // Latitudinal subdivision
00041 protected:
00042   FXGLSphere();
00043   virtual void drawshape(FXGLViewer* viewer);
00044 public:
00045   enum {
00046     ID_LAST=FXGLShape::ID_LAST
00047     };
00048 public:
00049 
00050   /// Construct with specified origin and radius
00051   FXGLSphere(FXfloat x,FXfloat y,FXfloat z,FXfloat r=1.0f);
00052 
00053   /// Construct with specified origin, radius and material
00054   FXGLSphere(FXfloat x,FXfloat y,FXfloat z,FXfloat r,const FXMaterial& mtl);
00055 
00056   /// Copy constructor
00057   FXGLSphere(const FXGLSphere& orig);
00058 
00059   /// Copy this object
00060   virtual FXGLObject* copy();
00061 
00062   /// Change radius
00063   void setRadius(FXfloat r){ radius=r; }
00064   FXfloat getRadius() const { return radius; }
00065 
00066   /// Change slices
00067   void setSlices(FXint s){ slices=s; }
00068   FXint getSlices() const { return slices; }
00069 
00070   /// Change stacks
00071   void setStacks(FXint s){ stacks=s; }
00072   FXint getStacks() const { return stacks; }
00073 
00074   /// Save to a stream
00075   virtual void save(FXStream& store) const;
00076 
00077   /// Load from a stream
00078   virtual void load(FXStream& store);
00079 
00080   /// Destroy
00081   virtual ~FXGLSphere();
00082   };
00083 
00084 }
00085 
00086 #endif

Copyright © 1997-2005 Jeroen van der Zijp