#include <ModelPreview.h>
Public Member Functions | |
ModelPreview () | |
~ModelPreview () | |
void | setSize (int size) |
void | initialisePreview () |
void | setModel (const std::string &model) |
void | setSkin (const std::string &skin) |
operator GtkWidget * () | |
model::IModel * | getModel () |
Static Private Member Functions | |
static void | callbackGLDraw (GtkWidget *, GdkEventExpose *, ModelPreview *) |
static void | callbackGLMotion (GtkWidget *, GdkEventMotion *, ModelPreview *) |
static void | callbackGLScroll (GtkWidget *, GdkEventScroll *, ModelPreview *) |
static void | callbackToggleBBox (GtkToggleToolButton *, ModelPreview *) |
Private Attributes | |
GtkWidget * | _widget |
GtkWidget * | _glWidget |
GtkToolItem * | _drawBBox |
model::IModelPtr | _model |
GLfloat | _camDist |
Matrix4 | _rotation |
Preview widget for models and skins. This class encapsulates the GTK widgets to render a specified model and skin using OpenGL, and return a single GTK widget to be packed into the parent window. The model and skin is changed with setModel() and setSkin(). This class handles zooming and rotating the model itself.
Definition at line 18 of file ModelPreview.h.
ui::ModelPreview::ModelPreview | ( | ) |
Construct a ModelPreview widget.
ui::ModelPreview::~ModelPreview | ( | ) |
Destructor for destroying loaded models
static void ui::ModelPreview::callbackGLDraw | ( | GtkWidget * | , | |
GdkEventExpose * | , | |||
ModelPreview * | ||||
) | [static, private] |
static void ui::ModelPreview::callbackGLMotion | ( | GtkWidget * | , | |
GdkEventMotion * | , | |||
ModelPreview * | ||||
) | [static, private] |
static void ui::ModelPreview::callbackGLScroll | ( | GtkWidget * | , | |
GdkEventScroll * | , | |||
ModelPreview * | ||||
) | [static, private] |
static void ui::ModelPreview::callbackToggleBBox | ( | GtkToggleToolButton * | , | |
ModelPreview * | ||||
) | [static, private] |
model::IModel* ui::ModelPreview::getModel | ( | ) | [inline] |
Get the model from the widget, in order to display properties about it.
Definition at line 93 of file ModelPreview.h.
References _model.
void ui::ModelPreview::initialisePreview | ( | ) |
Initialise the GL preview. This clears the window and sets up the initial matrices and lights.
ui::ModelPreview::operator GtkWidget * | ( | ) | [inline] |
Operator cast to GtkWidget*, for packing into the parent window.
Definition at line 86 of file ModelPreview.h.
References _widget.
void ui::ModelPreview::setModel | ( | const std::string & | model | ) |
Set the widget to display the given model. If the model name is the empty string, the widget will release the currently displayed model.
model | String name of the model to display. |
void ui::ModelPreview::setSize | ( | int | size | ) |
Set the pixel size of the ModelPreview widget. The widget is always square.
size | The pixel size of the square widget. |
void ui::ModelPreview::setSkin | ( | const std::string & | skin | ) |
Set the skin to apply on the currently-displayed model.
skin | Name of the skin to apply. |
GLfloat ui::ModelPreview::_camDist [private] |
Definition at line 33 of file ModelPreview.h.
GtkToolItem* ui::ModelPreview::_drawBBox [private] |
Definition at line 27 of file ModelPreview.h.
GtkWidget* ui::ModelPreview::_glWidget [private] |
Definition at line 24 of file ModelPreview.h.
model::IModelPtr ui::ModelPreview::_model [private] |
Definition at line 30 of file ModelPreview.h.
Referenced by getModel().
Matrix4 ui::ModelPreview::_rotation [private] |
Definition at line 36 of file ModelPreview.h.
GtkWidget* ui::ModelPreview::_widget [private] |
Definition at line 21 of file ModelPreview.h.
Referenced by operator GtkWidget *().