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

glcube.h

00001 /***************************************************************************
00002                           glcube.h  -  description
00003                              -------------------
00004     begin                : Wed Aug 20 2003
00005     copyright            : (C) 2003 by Jacques Gasselin de Richebourg
00006     email                : jacquesgasselin@hotmail.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU Lesser General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef GLCUBE_H
00019 #define GLCUBE_H
00020 
00021 #include <vector>
00022 #include "glgeometricobject.h"
00023 #include "gllocalcoordinatesystem.h"
00024 #include "glquad.h"
00025 #include "glsphere.h"
00026 
00027 
00031 namespace GLScene
00032 {
00033   
00034    class GLCube : public GLGeometricObject,
00035                   public GLLocalCoordinateSystem
00036    {
00037       bool changed;
00038       //x,y,z
00039       GLQuad quads[6];
00040       GLfloat width, height, length;
00041    public: 
00042       GLCube(GLfloat _w = 1 , GLfloat _h = 1, GLfloat _l = 1);
00043     ~GLCube();
00044 
00045       SML_TAG(cube);
00046       
00047    /*   virtual GLVector getVectorToFurthestPoint(const GLVector& fromPoint)
00048       { return getPosition() - fromPoint; };
00049       virtual GLVector getVectorToNearestPoint(const GLVector& fromPoint)
00050       { return getPosition() - fromPoint; };*/
00051 
00052       virtual bool intersection( GLGeometricObject* obj ) { return obj->intersection((GLCube*)this); };
00053       virtual bool intersection( GLCube* ) { exit(1); return false; };
00054       virtual bool intersection( GLSphere* sp );
00055       virtual bool inclusion( GLGeometricObject*) { exit(1); return false;};
00056 
00057       inline void setWidth(GLfloat v) { width = v/2; changed = true; };
00058       inline void setHeight(GLfloat v) { height = v/2; changed = true; };
00059       inline void setLength(GLfloat v) { length = v/2; changed = true; };
00060 
00061       inline GLfloat getWidth() { return 2*width; };
00062       inline GLfloat getHeight() { return 2*height; };
00063       inline GLfloat getLength() { return 2*length; };
00064       
00065       GLPlane* const getPlanes();
00066       virtual void render( );
00067       void renderForSelection(GLuint& previousName);
00068 
00069       protected:
00070       
00071       void makeQuads();
00072 
00073       /*
00074       void loadFromStream(std::istream&);
00075       void saveToStream(std::ostream&);
00076       */
00077    };
00078 };
00079 #endif

Generated on Wed Feb 4 23:11:33 2004 by doxygen 1.3.3