    QtOgreViewer plugin for SOFA.

This plugin contains a qt viewer compatible which relies on OGRE for the
rendering as well as several sofa components to support visualmodels 
based on OGRE.
This plugin has been tested using Ogre SDK 1.7.2, under windows and ubuntu 10.04.
MacOs support is untested and undocumented but should not be a problem. 

SECTIONS
1. INSTALLATION
  1.1 Windows
  1.2 Ubuntu
2. USAGE
  2.1 From the command line
  2.2 From the GUI
  2.3 Example scenes
3. LIMITATIONS

-----------------------------------------------------------------------------
1.INSTALLATION

1.1 Windows :
-----------------------------
Note: the installation requires you to build OGRE from source since
the prebuilt SDK is quite cumbersome to use with SOFA because of the multiple 
version of boost to handle.
The plugin has been tested using OGRE SDK 1.7.2 and visual studio 2008 SP1.

- Download OGRE source for your version of visual studio and dependencies at 
http://www.ogre3d.org/download/source
- Download and install CMake http://www.cmake.org/ 
- Follow the build instructions it is really straightforward. 
- Build in release mode. 
- Build in debug mode if you want to be able to build the plugin in debug mode. 
- open your sofa-default.cfg or sofa-local.cfg located at the root of your Sofa directory.
- uncomment and set the OGRE_HOME variable to your Ogre SDK directory. it should contains 
the following : OGRE/include, OGRE/lib 
- uncomment the variable SOFA_HAVE_QTOGREVIEWER
- regenerate the project files using "Project VC9.bat" (visual2008) 
or "Project VC8.bat" (visual2005)
- build your Sofa.sln using visual studio. It should contains the QtOgreViewerPlugin project
- open and edit $SOFA_DIR/config/share/plugin_win.cfg and follow the instructions.
- open and edit $SOFA_DIR/config/share/plugin_win_d.cfg and follow the instructions. 
- finally make sure the OGRE dlls belong to your PATH variable in your environment settings ! 

1.2 Ubuntu :
---------------------------
Note: the installation has been tested with ubuntu 10.04. 

- download the OGRE ubuntu package. The instructions are explained in 
http://www.ogre3d.org/download/sdk
- open your sofa-default.cfg or sofa-local.cfg located at the root of your Sofa directory.
- uncomment the variable SOFA_HAVE_QTOGREVIEWER
- regenerate the makefiles for Sofa using qmake at the root of your SOFA directory. 
- launch make to build QtOgreViewerPlugin. 

-----------------------------------------------------------------------------
2. USAGE

2.1 From the command line.
-----------------------------
runSofa.exe -g ogre -l ..\lib\sofa-plugins\qtogreviewerplugin.dll (windows release)
runSofad.exe -g ogre -l ..\lib\sofa-plugins\qtogreviewerplugind.dll (windows debug)
runSofa -g ogre -l ..\lib\sofa-plugins\libqtogreviewerplugin.so (linux release)
runSofad -g ogre -l ..\lib\sofa-plugins\libqtogreviewerplugind.so (linux debug)

2.2 From the gui
-----------------------------
in the Edit->Plugin Manager... menu, add the qtogreviewerplugin. 
in the View menu, select OgreViewer. 

2.3 Example Scenes
-----------------------------
There are 3 example scenes so far which demonstrate the usage of some ogre specific 
sofa components.
You can find them in the examples directory of the plugin 


-----------------------------------------------------------------------------
3. LIMITATIONS

- The debug draw of some components may not work. This is likely because their 
draw() method do not use the DrawManager API described in sofa::helper::gl
- voxelcutting scenes don t display well. 
- there seems to be some corner cases where switching back and forth between ogre 
and another viewer can cause a crash.
- Texturing of obj files don t always give consistent result with other viewers. 
- Most of the limitations could be overcome by having a cleaner VisualModelImpl 
API (for material handling notably, which are difficult to extend for Ogre)
- Finally we could use Ogre::HardwareVertexBuffers and Ogre::HardwareIndexBuffers
instead of Ogre pseudo direct mode to draw the primitives. It is probably 
faster, and should provide a cleaner code, much similar to the existing one in 
OglModel.














  
 
