2 // "$Id: CubeView.h 7913 2010-11-29 18:18:27Z greg.ercolano $"
4 // CubeView class definitions for the Fast Light Tool Kit (FLTK).
6 // Copyright 1998-2010 by Bill Spitzak and others.
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
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 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library 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
23 // Please report all bugs and problems on the following page:
25 // http://www.fltk.org/str.php
33 # include <FL/Fl_Gl_Window.H>
36 # include <FL/Fl_Box.H>
42 class CubeView
: public Fl_Gl_Window
{
44 class CubeView
: public Fl_Box
{
48 // this value determines the scaling factor used to draw the cube.
51 CubeView(int x
,int y
,int w
,int h
,const char *l
=0);
53 /* Set the rotation about the vertical (y ) axis.
55 * This function is called by the horizontal roller in CubeViewUI and the
56 * initialize button in CubeViewUI.
58 void v_angle(float angle
){vAng
=angle
;};
60 // Return the rotation about the vertical (y ) axis.
61 float v_angle(){return vAng
;};
63 /* Set the rotation about the horizontal (x ) axis.
65 * This function is called by the vertical roller in CubeViewUI and the
66 * initialize button in CubeViewUI.
69 void h_angle(float angle
){hAng
=angle
;};
71 // the rotation about the horizontal (x ) axis.
72 float h_angle(){return hAng
;};
74 /* Sets the x shift of the cube view camera.
76 * This function is called by the slider in CubeViewUI and the
77 * initialize button in CubeViewUI.
79 void panx(float x
){xshift
=x
;};
80 /* Sets the y shift of the cube view camera.
82 * This function is called by the slider in CubeViewUI and the
83 * initialize button in CubeViewUI.
85 void pany(float y
){yshift
=y
;};
88 /*The widget class draw() override.
90 *The draw() function initialize Gl for another round o f drawing
91 * then calls specialized functions for drawing each of the
92 * entities displayed in the cube view.
99 /* Draw the cube boundaries
101 *Draw the faces of the cube using the boxv[] vertices, using
102 * GL_LINE_LOOP for the faces. The color is \#defined by CUBECOLOR.
114 float boxv0
[3];float boxv1
[3];
115 float boxv2
[3];float boxv3
[3];
116 float boxv4
[3];float boxv5
[3];
117 float boxv6
[3];float boxv7
[3];
123 // End of "$Id: CubeView.h 7913 2010-11-29 18:18:27Z greg.ercolano $".