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,2009 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (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                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 *********************************************************************************
00021 * $Id: FXGLSphere.h,v 1.23 2009/01/06 13:07:24 fox Exp $                        *
00022 ********************************************************************************/
00023 #ifndef FXGLSPHERE_H
00024 #define FXGLSPHERE_H
00025 
00026 #ifndef FXGLSHAPE_H
00027 #include "FXGLShape.h"
00028 #endif
00029 
00030 namespace FX {
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   virtual void setRadius(FXfloat 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 
00085 #endif

Copyright © 1997-2009 Jeroen van der Zijp