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

FXGLSphere.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * O p e n G L S p h e r e O b j e c t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXGLSphere.h,v 1.18 2006/01/22 17:58:03 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXGLSPHERE_H
25 #define FXGLSPHERE_H
26 
27 #ifndef FXGLSHAPE_H
28 #include "FXGLShape.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /// OpenGL Sphere Object
35 class FXAPI FXGLSphere : public FXGLShape {
37 public:
38  FXfloat radius; // Radius of sphere
39  FXint slices; // Longitudinal subdivision
40  FXint stacks; // Latitudinal subdivision
41 protected:
42  FXGLSphere();
43  virtual void drawshape(FXGLViewer* viewer);
44 public:
45  enum {
46  ID_LAST=FXGLShape::ID_LAST
47  };
48 public:
49 
50  /// Construct with specified origin and radius
52 
53  /// Construct with specified origin, radius and material
54  FXGLSphere(FXfloat x,FXfloat y,FXfloat z,FXfloat r,const FXMaterial& mtl);
55 
56  /// Copy constructor
57  FXGLSphere(const FXGLSphere& orig);
58 
59  /// Copy this object
60  virtual FXGLObject* copy();
61 
62  /// Change radius
63  void setRadius(FXfloat r){ radius=r; }
64  FXfloat getRadius() const { return radius; }
65 
66  /// Change slices
67  void setSlices(FXint s){ slices=s; }
68  FXint getSlices() const { return slices; }
69 
70  /// Change stacks
71  void setStacks(FXint s){ stacks=s; }
72  FXint getStacks() const { return stacks; }
73 
74  /// Save to a stream
75  virtual void save(FXStream& store) const;
76 
77  /// Load from a stream
78  virtual void load(FXStream& store);
79 
80  /// Destroy
81  virtual ~FXGLSphere();
82  };
83 
84 }
85 
86 #endif
Definition: FXGLViewer.h:79
Basic OpenGL object.
Definition: FXGLObject.h:39
OpenGL viewer widget.
Definition: FXGLViewer.h:100
#define FXAPI
Definition: fxdefs.h:122
FXfloat radius
Definition: FXGLSphere.h:38
Leaving ample room for FXGLViewer subclasses.
Definition: FXGLObject.h:43
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:390
OpenGL Sphere Object.
Definition: FXGLSphere.h:35
OpenGL Shape Object.
Definition: FXGLShape.h:64
FXint stacks
Definition: FXGLSphere.h:40
FXint slices
Definition: FXGLSphere.h:39
float FXfloat
Definition: fxdefs.h:391
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92

Copyright © 1997-2005 Jeroen van der Zijp