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

FXGLSphere.h

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,2002 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.12 2002/01/18 22:42:53 jeroen Exp $                     *
00023 ********************************************************************************/
00024 #ifndef FXGLSPHERE_H
00025 #define FXGLSPHERE_H
00026 
00027 #ifndef FXGLSHAPE_H
00028 #include "FXGLShape.h"
00029 #endif
00030 
00031 
00032 
00033 /// OpenGL Sphere Object
00034 class FXAPI FXGLSphere : public FXGLShape {
00035   FXDECLARE(FXGLSphere)
00036 public:
00037   FXfloat radius;   // Radius of sphere
00038   FXint   slices;   // Longitudinal subdivision
00039   FXint   stacks;   // Latitudinal subdivision
00040 protected:
00041   FXGLSphere();
00042   virtual void drawshape(FXGLViewer* viewer);
00043 public:
00044   enum {
00045     ID_LAST=FXGLShape::ID_LAST
00046     };
00047 public:
00048 
00049   /// Construct with specified origin and radius
00050   FXGLSphere(FXfloat x,FXfloat y,FXfloat z,FXfloat r=1.0f);
00051 
00052   /// Construct with specified origin, radius and material
00053   FXGLSphere(FXfloat x,FXfloat y,FXfloat z,FXfloat r,const FXMaterial& mtl);
00054 
00055   /// Copy constructor
00056   FXGLSphere(const FXGLSphere& orig);
00057 
00058   /// Copy this object
00059   virtual FXGLObject* copy();
00060 
00061   /// Change radius
00062   void setRadius(FXfloat r){ radius=r; }
00063   FXfloat getRadius() const { return radius; }
00064 
00065   /// Change slices
00066   void setSlices(FXint s){ slices=s; }
00067   FXint getSlices() const { return slices; }
00068 
00069   /// Change stacks
00070   void setStacks(FXint s){ stacks=s; }
00071   FXint getStacks() const { return stacks; }
00072 
00073   /// Save to a stream
00074   virtual void save(FXStream& store) const;
00075 
00076   /// Load from a stream
00077   virtual void load(FXStream& store);
00078 
00079   /// Destroy
00080   virtual ~FXGLSphere();
00081   };
00082 
00083 
00084 #endif