fltk/test/CubeView.h
Greg Ercolano 4f4a8fc3c7 Modifications to all LGPL headers for STR #2685.
(to clarify static exception LGPL by changing license references)



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8864 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-07-19 04:49:30 +00:00

116 lines
2.8 KiB
C++

//
// "$Id$"
//
// CubeView class definitions for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2010 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// http://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
//
#ifndef CUBEVIEW_H
#define CUBEVIEW_H 1
#include <config.h>
#include <FL/Fl.H>
#if HAVE_GL
# include <FL/Fl_Gl_Window.H>
# include <FL/gl.h>
#else
# include <FL/Fl_Box.H>
#endif /* HAVE_GL */
#include <stdlib.h>
#if HAVE_GL
class CubeView : public Fl_Gl_Window {
#else
class CubeView : public Fl_Box {
#endif /* HAVE_GL */
public:
// this value determines the scaling factor used to draw the cube.
double size;
CubeView(int x,int y,int w,int h,const char *l=0);
/* Set the rotation about the vertical (y ) axis.
*
* This function is called by the horizontal roller in CubeViewUI and the
* initialize button in CubeViewUI.
*/
void v_angle(float angle){vAng=angle;};
// Return the rotation about the vertical (y ) axis.
float v_angle(){return vAng;};
/* Set the rotation about the horizontal (x ) axis.
*
* This function is called by the vertical roller in CubeViewUI and the
* initialize button in CubeViewUI.
*/
void h_angle(float angle){hAng=angle;};
// the rotation about the horizontal (x ) axis.
float h_angle(){return hAng;};
/* Sets the x shift of the cube view camera.
*
* This function is called by the slider in CubeViewUI and the
* initialize button in CubeViewUI.
*/
void panx(float x){xshift=x;};
/* Sets the y shift of the cube view camera.
*
* This function is called by the slider in CubeViewUI and the
* initialize button in CubeViewUI.
*/
void pany(float y){yshift=y;};
#if HAVE_GL
/*The widget class draw() override.
*
*The draw() function initialize Gl for another round o f drawing
* then calls specialized functions for drawing each of the
* entities displayed in the cube view.
*
*/
void draw();
#endif /* HAVE_GL */
private:
/* Draw the cube boundaries
*
*Draw the faces of the cube using the boxv[] vertices, using
* GL_LINE_LOOP for the faces. The color is \#defined by CUBECOLOR.
*/
#if HAVE_GL
void drawCube();
#else
void drawCube() { }
#endif /* HAVE_GL */
float vAng,hAng;
float xshift,yshift;
float boxv0[3];float boxv1[3];
float boxv2[3];float boxv3[3];
float boxv4[3];float boxv5[3];
float boxv6[3];float boxv7[3];
};
#endif
//
// End of "$Id$".
//