[brlcad-commits] SF.net SVN: brlcad:[34714]
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <ra...@us...> - 2009-06-11 03:26:16
|
Revision: 34714 http://brlcad.svn.sourceforge.net/brlcad/?rev=34714&view=rev Author: ralith Date: 2009-06-11 03:26:08 +0000 (Thu, 11 Jun 2009) Log Message: ----------- Untested Ogre Qt widget Modified Paths: -------------- rt^3/trunk/src/g3d/CMakeLists.txt Added Paths: ----------- rt^3/trunk/src/g3d/OgreGLWidget.cxx rt^3/trunk/src/g3d/OgreGLWidget.h Modified: rt^3/trunk/src/g3d/CMakeLists.txt =================================================================== --- rt^3/trunk/src/g3d/CMakeLists.txt 2009-06-11 00:46:26 UTC (rev 34713) +++ rt^3/trunk/src/g3d/CMakeLists.txt 2009-06-11 03:26:08 UTC (rev 34714) @@ -13,8 +13,61 @@ #source_group("Source Files" FILES ${SOURCES}) #source_group("Header Files" FILES ${HEADERS}) set(PROGNAME "g3d") -file(GLOB G3D_SOURCES *.cxx) -file(GLOB G3D_HEADERS *.h) +set(G3D_SOURCES + Application.cxx + CameraManager.cxx + CameraMode.cxx + CameraModeBlender.cxx + CameraModeMGED.cxx + CameraModeOrbital.cxx + Command.cxx + CommandInterpreter.cxx + GedCommand.cxx + GedData.cxx + GeometryConversion.cxx + GuiBaseWindow.cxx + GuiCamera.cxx + GuiCommandOverlay.cxx + GuiConsole.cxx + GuiWidgetRotation.cxx + GuiWindowManager.cxx + History.cxx + Logger.cxx + Observer.cxx + OgreGLWidget.cxx + main.cxx + ) + +set(G3D_HEADERS + Application.h + CameraManager.h + CameraMode.h + CameraModeBlender.h + CameraModeMGED.h + CameraModeOrbital.h + Command.h + Commands.h + CommandInterpreter.h + GedCommand.h + GedCommands.h + GedData.h + GeometryConversion.h + GuiBaseWindow.h + GuiCamera.h + GuiCommandOverlay.h + GuiConsole.h + GuiWidgetRotation.h + GuiWindowManager.h + History.h + Logger.h + Observer.h + ) + +# Qt stuff that needs preprocessing +set(G3D_MOC_HEADERS + OgreGLWidget.h + ) + set(RBGUI_DIR "../../data/g3d/RBGui") add_definitions( -DDATA_DIR='"${CMAKE_INSTALL_PREFIX}/share/g3d/"' ) @@ -66,6 +119,9 @@ INCLUDE(${QT_USE_FILE}) set(LIBS ${LIBS} ${QT_LIBRARIES}) +# Preprocess Qt stuff +qt4_wrap_cpp(G3D_MOC_OUTFILES ${G3D_MOC_HEADERS}) + if(CANNOT_BUILD) message(FATAL_ERROR "Missing essential libraries, aborting") else(CANNOT_BUILD) @@ -91,7 +147,7 @@ #link_libraries( g3d ${OGRE_LIBRARIES} ${OIS_LIBRARIES} ${Mocha_LIBRARIES} ${RBGui_LIBRARIES} ) #add_definitions(${PC_CFLAGS} ${BRLCAD_CFLAGS}) - add_executable( g3d ${G3D_SOURCES} ${G3D_HEADERS} ) + add_executable( g3d ${G3D_SOURCES} ${G3D_MOC_OUTFILES} ${G3D_HEADERS} ) target_link_libraries( g3d ${LIBS} ) # OGRE config files Added: rt^3/trunk/src/g3d/OgreGLWidget.cxx =================================================================== --- rt^3/trunk/src/g3d/OgreGLWidget.cxx (rev 0) +++ rt^3/trunk/src/g3d/OgreGLWidget.cxx 2009-06-11 03:26:08 UTC (rev 34714) @@ -0,0 +1,81 @@ +/* A P P L I C A T I O N . C X X + * BRL-CAD + * + * Copyright (c) 2008-2009 United States Government as represented by the + * U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ + +/** @file Application.cxx + * + * @author Benjamin Saunders <ra...@us...> + * + * @brief + * Ogre Qt OpenGL widget + */ + +#include "OgreGLWidget.h" + +#define OGRE_PLUGIN_FILE (DATA_DIR "ogreplugins.cfg") +#define OGRE_CFG_FILE (DATA_DIR "ogre.cfg") +#define OGRE_LOG_FILE (DATA_DIR "ogre.log") + +OgreGLWidget::OgreGLWidget(QWidget *parent) : QGLWidget(parent) +{ +} + +OgreGLWidget::~OgreGLWidget() +{ + _renderWindow->removeAllViewports(); + _renderWindow->destroy(); + + delete _root; _root = 0; +} + + +void OgreGLWidget::initializeGL() +{ + _root = new Ogre::Root(OGRE_PLUGIN_FILE, OGRE_CFG_FILE, OGRE_LOG_FILE); + _root->restoreConfig(); + _root->initialise(false); + + Ogre::NameValuePairList params; + params["currentGLContext"] = Ogre::String("True"); + + _renderWindow = _root->createRenderWindow("MainRenderWindow", 640, 480, false, ¶ms); + _renderWindow->setVisible(true); +} + +void OgreGLWidget::resizeGL(int width, int height) +{ + _renderWindow->windowMovedOrResized(); +} + +void OgreGLWidget::paintGL() +{ + _root->renderOneFrame(); +} + + + +/* + * Local Variables: + * mode: C++ + * tab-width: 8 + * indent-tabs-mode: t + * c-file-style: "stroustrup" + * End: + * ex: shiftwidth=4 tabstop=8 + */ Property changes on: rt^3/trunk/src/g3d/OgreGLWidget.cxx ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: rt^3/trunk/src/g3d/OgreGLWidget.h =================================================================== --- rt^3/trunk/src/g3d/OgreGLWidget.h (rev 0) +++ rt^3/trunk/src/g3d/OgreGLWidget.h 2009-06-11 03:26:08 UTC (rev 34714) @@ -0,0 +1,62 @@ +/* A P P L I C A T I O N . C X X + * BRL-CAD + * + * Copyright (c) 2008-2009 United States Government as represented by the + * U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ + +/** @file Application.cxx + * + * @author Benjamin Saunders <ra...@us...> + * + * @brief + * Ogre Qt OpenGL widget header + */ + +#ifndef __G3D_GLWIDGET_H__ +#define __G3D_GLWIDGET_H__ + +#include <QGLWidget> +#include <OGRE/Ogre.h> + +class OgreGLWidget : public QGLWidget +{ + Q_OBJECT + +public: + OgreGLWidget(QWidget *parent = 0); + ~OgreGLWidget(); + +protected: + void initializeGL(); + void resizeGL( int, int ); + void paintGL(); + + Ogre::Root *_root; + Ogre::RenderWindow *_renderWindow; +}; + +#endif + +/* + * Local Variables: + * mode: C++ + * tab-width: 8 + * indent-tabs-mode: t + * c-file-style: "stroustrup" + * End: + * ex: shiftwidth=4 tabstop=8 + */ Property changes on: rt^3/trunk/src/g3d/OgreGLWidget.h ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |