/*************************************************************************** * Copyright (C) 2009 by Stefan Bühler * * stbuehler@web.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef TORUSCHESSFIELD3D_H #define TORUSCHESSFIELD3D_H #include #include "toruschess.h" #include "piecelibrary.h" /** @author Stefan Bühler */ namespace toruschess { class Field3D : public QGLWidget { Q_OBJECT public: Field3D(Game *game, QWidget *parent = 0); virtual ~Field3D(); void markMoves(const QList &moves); virtual QSize sizeHint() const; protected: virtual void initializeGL(); virtual void resizeGL(int w, int h); virtual void paintGL(); private: void updateCam(); void createTexture(); void freeTexture(); void updateTexture(); void createTorus(); void freeTorus(); Game *m_game; PieceLibrary *m_lib; bool m_marked[8][8]; QList m_markedMoves; /* Texture data */ QImage *m_textureBuffer; GLuint m_textureID; /* Cam data */ double m_camDist, m_camRotX, m_camRotY, m_camRotZ; static const int m_textureSize = 1024; }; } #endif