Removed osgGLUT and Demos/*.
Integrated Marco's updated examples/*/*.dsp's.
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* 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
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
// The following symbol has a underscore suffix for compatibility.
|
||||
#ifndef OSGGLUT_EXPORT_
|
||||
#define OSGGLUT_EXPORT_ 1
|
||||
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
#pragma warning( disable : 4244 )
|
||||
#pragma warning( disable : 4251 )
|
||||
#pragma warning( disable : 4267 )
|
||||
#pragma warning( disable : 4275 )
|
||||
#pragma warning( disable : 4290 )
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined( __BCPLUSPLUS__) || defined( __MWERKS__)
|
||||
# ifdef OSGGLUT_LIBRARY
|
||||
# define OSGGLUT_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
# define OSGGLUT_EXPORT __declspec(dllimport)
|
||||
#endif /* OSGGLUT_LIBRARY */
|
||||
#else
|
||||
#define OSGGLUT_EXPORT
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* 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
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGGLUT_GLUTEVENTADAPTER
|
||||
#define OSGGLUT_GLUTEVENTADAPTER 1
|
||||
|
||||
#include <osgGA/GUIEventAdapter>
|
||||
|
||||
#include <osgGLUT/Export>
|
||||
|
||||
namespace osgGLUT{
|
||||
|
||||
/** Class for adapting GLUT events so that they can be used as input to osgGA::CameraManipulators.*/
|
||||
class OSGGLUT_EXPORT GLUTEventAdapter : public osgGA::GUIEventAdapter
|
||||
{
|
||||
|
||||
public:
|
||||
GLUTEventAdapter();
|
||||
virtual ~GLUTEventAdapter() {}
|
||||
|
||||
/** Get the EventType of the GUI event.*/
|
||||
virtual EventType getEventType() const { return _eventType; }
|
||||
|
||||
/** key pressed, return -1 if inappropriate for this event. */
|
||||
virtual int getKey() const { return _key; }
|
||||
|
||||
/** button pressed/released, return -1 if inappropriate for this event.*/
|
||||
virtual int getButton() const { return _button; }
|
||||
|
||||
/** window minimum x. */
|
||||
virtual int getXmin() const { return _Xmin; }
|
||||
|
||||
/** window maximum x. */
|
||||
virtual int getXmax() const { return _Xmax; }
|
||||
|
||||
/** window minimum y. */
|
||||
virtual int getYmin() const { return _Ymin; }
|
||||
|
||||
/** window maximum y. */
|
||||
virtual int getYmax() const { return _Ymax; }
|
||||
|
||||
/** current mouse x position.*/
|
||||
virtual int getX() const { return _mx; }
|
||||
|
||||
/** current mouse y position.*/
|
||||
virtual int getY() const { return _my; }
|
||||
|
||||
/** current mouse button state */
|
||||
virtual unsigned int getButtonMask() const { return _buttonMask; }
|
||||
|
||||
/** current modkey state */
|
||||
virtual unsigned int getModKeyMask() const;
|
||||
|
||||
/** time in seconds of event. */
|
||||
virtual double time() const { return _time; }
|
||||
|
||||
|
||||
/** static method for setting window dimensions.*/
|
||||
static void setWindowSize(int Xmin, int Ymin, int Xmax, int Ymax);
|
||||
|
||||
/** static method for setting button state.*/
|
||||
static void setButtonMask(unsigned int buttonMask);
|
||||
|
||||
/** method for adapting resize events. */
|
||||
void adaptResize(double t, int Xmin, int Ymin, int Xmax, int Ymax);
|
||||
|
||||
/** method for adapting mouse motion events whilst mouse buttons are pressed.*/
|
||||
void adaptMouseMotion(double t, int x, int y);
|
||||
|
||||
/** method for adapting mouse motion events whilst no mouse button are pressed.*/
|
||||
void adaptMousePassiveMotion(double t,int x, int y);
|
||||
|
||||
/** method for adapting mouse button pressed/released events.*/
|
||||
void adaptMouse(double t,int button, int state, int x, int y);
|
||||
|
||||
/** method for adapting keyboard events.*/
|
||||
void adaptKeyboard( double t, unsigned char key,
|
||||
int x, int y, bool keydown );
|
||||
|
||||
/** method for adapting frame events, i.e. idle/display callback.*/
|
||||
void adaptFrame(double t);
|
||||
|
||||
void copyStaticVariables();
|
||||
|
||||
protected:
|
||||
|
||||
EventType _eventType;
|
||||
int _key;
|
||||
int _button;
|
||||
int _Xmin,_Xmax;
|
||||
int _Ymin,_Ymax;
|
||||
int _mx;
|
||||
int _my;
|
||||
unsigned int _buttonMask;
|
||||
double _time;
|
||||
|
||||
// used to accumulate the button mask state, it represents
|
||||
// the current button mask state, which is modified by the
|
||||
// adaptMouse() method which then copies it to value _buttonMask
|
||||
// which required the mouse buttons state at the time of the event.
|
||||
static unsigned int _s_accumulatedButtonMask;
|
||||
|
||||
// used to store current button value
|
||||
static int _s_button;
|
||||
|
||||
// used to store window min and max values.
|
||||
static int _s_Xmin;
|
||||
static int _s_Xmax;
|
||||
static int _s_Ymin;
|
||||
static int _s_Ymax;
|
||||
static int _s_mx;
|
||||
static int _s_my;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,48 +0,0 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* 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
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGGLUT_VERSION
|
||||
#define OSGGLUT_VERSION 1
|
||||
|
||||
#include <osgGLUT/Export>
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
/**
|
||||
* osgGLUTGetVersion() returns the library version number.
|
||||
* Numbering convention : osg_src-0.8.31 will return 0.8.31.
|
||||
*
|
||||
* This C function can be also used to check for the existence of the OpenSceneGraph
|
||||
* library using autoconf and its m4 macro AC_CHECK_LIB.
|
||||
*
|
||||
* Here is the code to add to your configure.in:
|
||||
\verbatim
|
||||
#
|
||||
# Check for the OpenSceneGraph (OSG) GLUT library
|
||||
#
|
||||
AC_CHECK_LIB(osg, osgGLUTGetVersion, ,
|
||||
[AC_MSG_ERROR(OpenSceneGraph GLUT library not found. See http://www.openscenegraph.org)],)
|
||||
\endverbatim
|
||||
*/
|
||||
extern OSGGLUT_EXPORT const char* osgGLUTGetVersion();
|
||||
|
||||
/**
|
||||
* getLibraryName_osgGLUT() returns the library name in human friendly form.
|
||||
*/
|
||||
extern OSGGLUT_EXPORT const char* osgGLUTGetLibraryName();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,219 +0,0 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* 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
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGGLUT_VIEWER
|
||||
#define OSGGLUT_VIEWER 1
|
||||
|
||||
#include <osg/Light>
|
||||
#include <osg/NodeVisitor>
|
||||
#include <osg/Geode>
|
||||
#include <osg/Timer>
|
||||
#include <osg/DisplaySettings>
|
||||
#include <osg/ArgumentParser>
|
||||
|
||||
#include <osgGA/GUIEventAdapter>
|
||||
#include <osgGA/CameraManipulator>
|
||||
#include <osgGA/GUIEventHandler>
|
||||
#include <osgGA/AnimationPathManipulator>
|
||||
|
||||
#include <osgUtil/SceneView>
|
||||
|
||||
#include <osgGLUT/Window>
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
namespace osgGLUT
|
||||
{
|
||||
|
||||
/** A basic viewer base class which provides a window, simple keyboard and mouse interaction.
|
||||
* Please note, this viewer class has been developed via a rather haphazard
|
||||
* path and <i>needs</i> a total rewrite. It currently suffices for osg demos
|
||||
* but shouldn't be viewed as the be all and end of osg viewer classes.
|
||||
* Someone please rewrite it :-)
|
||||
*/
|
||||
class OSGGLUT_EXPORT Viewer : public Window, public osgGA::GUIActionAdapter
|
||||
{
|
||||
public:
|
||||
|
||||
Viewer();
|
||||
Viewer(osg::ArgumentParser& arguments);
|
||||
|
||||
virtual ~Viewer();
|
||||
|
||||
/** read the command line string list, removing any matched control sequences.*/
|
||||
void readCommandLine(osg::ArgumentParser& arguments);
|
||||
|
||||
/** init is deprecated, you should use addViewport instead. init is
|
||||
* only available for backwards compatibility.*/
|
||||
virtual void init(osg::Node* rootnode);
|
||||
|
||||
virtual unsigned int addViewport(osgUtil::SceneView* sv,
|
||||
float x = 0.0, float y = 0.0,
|
||||
float width = 1.0, float height = 1.0);
|
||||
|
||||
virtual unsigned int addViewport(osg::Node*,
|
||||
float x = 0.0, float y = 0.0,
|
||||
float width = 1.0, float height = 1.0);
|
||||
|
||||
unsigned int getNumViewports() const { return _viewportList.size(); }
|
||||
|
||||
osgUtil::SceneView* getViewportSceneView(unsigned int pos)
|
||||
{ return _viewportList[pos].sceneView.get(); }
|
||||
|
||||
virtual bool open();
|
||||
virtual bool run();
|
||||
|
||||
// called on each frame redraw..return the time in ms for each operation.
|
||||
virtual float update(unsigned int viewport);
|
||||
virtual float cull(unsigned int viewport);
|
||||
virtual float draw(unsigned int viewport);
|
||||
|
||||
// initialize the clock.
|
||||
long initClock();
|
||||
// time since initClock() in seconds.
|
||||
double clockSeconds() { return _timer.delta_s(_initialTick,clockTick()); }
|
||||
|
||||
// update the number of ticks since the last frame update.
|
||||
osg::Timer_t updateFrameTick();
|
||||
|
||||
// time from the current frame update and the previous one in seconds.
|
||||
double frameSeconds() { return _timer.delta_s(_lastFrameTick,_frameTick); }
|
||||
double frameRate() { return 1.0/frameSeconds(); }
|
||||
|
||||
void help(std::ostream& fout);
|
||||
|
||||
// handle multiple camera.
|
||||
unsigned int registerCameraManipulator(osgGA::CameraManipulator* cm,
|
||||
unsigned int viewport = 0);
|
||||
void selectCameraManipulator(unsigned int pos,
|
||||
unsigned int viewport = 0);
|
||||
|
||||
/// Set focusable
|
||||
void setFocusable( unsigned int viewp, bool focusable )
|
||||
{ _viewportList[viewp]._focusable = focusable; };
|
||||
|
||||
void prependEventHandler(osgGA::GUIEventHandler* handler,unsigned int viewport = 0);
|
||||
void appendEventHandler(osgGA::GUIEventHandler* handler,unsigned int viewport = 0);
|
||||
|
||||
// derived from osgGA::GUIActionAdapter
|
||||
virtual void requestRedraw() {} // redraw always by idle callback done.
|
||||
virtual void requestContinuousUpdate(bool /*needed*/) {} // continuous update always
|
||||
virtual void requestWarpPointer(int x,int y);
|
||||
virtual void requestShutdown() { exit(1); };
|
||||
|
||||
/// Toggle fullscreen
|
||||
virtual void toggleFullScreen();
|
||||
|
||||
void setDisplaySettings(osg::DisplaySettings* ds) { _displaySettings = ds; }
|
||||
osg::DisplaySettings* getDisplaySettings() { return _displaySettings.get(); }
|
||||
const osg::DisplaySettings* getDisplaySettings() const { return _displaySettings.get(); }
|
||||
|
||||
typedef std::vector<osg::ref_ptr<osgGA::CameraManipulator> > CameraManipList;
|
||||
typedef std::list<osg::ref_ptr<osgGA::GUIEventHandler> > EventHandlerList;
|
||||
|
||||
|
||||
void setRecordingAnimationPath(bool on) { _recordingAnimationPath = on; }
|
||||
bool getRecordingAnimationPath() const { return _recordingAnimationPath; }
|
||||
|
||||
void setAnimationPath(osg::AnimationPath* path) { _animationPath = path; }
|
||||
osg::AnimationPath* getAnimationPath() { return _animationPath.get(); }
|
||||
const osg::AnimationPath* getAnimationPath() const { return _animationPath.get(); }
|
||||
|
||||
int mapWindowXYToViewport(int x, int y);
|
||||
|
||||
protected:
|
||||
|
||||
void initialize();
|
||||
|
||||
virtual void clear();
|
||||
|
||||
virtual void display();
|
||||
virtual void reshape(GLint w, GLint h);
|
||||
virtual void mouseMotion(int x, int y);
|
||||
virtual void mousePassiveMotion(int x, int y);
|
||||
virtual void mouse(int button, int state, int x, int y);
|
||||
virtual void keyboard(int key, int x, int y, bool keydown = true);
|
||||
|
||||
void setFocusedViewport(unsigned int pos);
|
||||
|
||||
void showStats(unsigned int i); // gwm 24.09.01 pass the viewport to collect sta for each viewport
|
||||
|
||||
static Viewer* s_theViewer;
|
||||
|
||||
|
||||
struct ViewportDef
|
||||
{
|
||||
osg::ref_ptr<osgUtil::SceneView> sceneView;
|
||||
float viewport[4]; // Win-size-relative [0,1]
|
||||
|
||||
bool _focusable;
|
||||
|
||||
osg::ref_ptr<osgGA::CameraManipulator> _cameraManipulator;
|
||||
CameraManipList _cameraManipList;
|
||||
|
||||
EventHandlerList _eventHandlerList;
|
||||
};
|
||||
|
||||
typedef std::vector<ViewportDef> ViewportList;
|
||||
ViewportList _viewportList;
|
||||
unsigned int _focusedViewport;
|
||||
|
||||
std::string _saveFileName;
|
||||
|
||||
bool _viewFrustumCullingActive;
|
||||
bool _smallFeatureCullingActive;
|
||||
|
||||
int polymode;
|
||||
int texture;
|
||||
int backface;
|
||||
int lighting;
|
||||
int flat_shade;
|
||||
float frRate; // gwm Jul 2001 added convolved ('averaged') frame rate
|
||||
int _printStats; // gwm Jul 2001 change from bool
|
||||
|
||||
struct StatsRecord
|
||||
{ // gwm Jul 2001, added for display of statistics
|
||||
StatsRecord():
|
||||
timeUpdate(0), timeCull(0), timeDraw(0), timeFrame(0),
|
||||
frameend(0) {}
|
||||
|
||||
float timeUpdate, timeCull, timeDraw, timeFrame;
|
||||
osg::Timer_t frameend;
|
||||
};
|
||||
StatsRecord times[3]; // store up to 3 frames worth of times
|
||||
|
||||
bool _useDisplayLists;
|
||||
|
||||
osg::Timer _timer;
|
||||
osg::Timer_t _initialTick;
|
||||
osg::Timer_t _lastFrameTick;
|
||||
osg::Timer_t _frameTick;
|
||||
|
||||
// system tick.
|
||||
osg::Timer_t clockTick();
|
||||
osg::Timer_t frameTick();
|
||||
|
||||
|
||||
osg::ref_ptr<osg::FrameStamp> _frameStamp;
|
||||
osg::ref_ptr<osg::DisplaySettings> _displaySettings;
|
||||
|
||||
bool _recordingAnimationPath;
|
||||
osg::ref_ptr<osg::AnimationPath> _animationPath;
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // SG_VIEWIER_H
|
||||
@@ -1,93 +0,0 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* 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
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGGLUT_GLUTWINDOW
|
||||
#define OSGGLUT_GLUTWINDOW 1
|
||||
|
||||
#include <osgGLUT/Export>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace osgGLUT
|
||||
{
|
||||
|
||||
/** A basic GLUTWindow base class which provides a just a basic window. */
|
||||
class OSGGLUT_EXPORT Window
|
||||
{
|
||||
public:
|
||||
|
||||
Window();
|
||||
virtual ~Window();
|
||||
|
||||
void setWindowOrigin(int x, int y) { _wx = x, _wy = y; };
|
||||
void setWindowSize(int width, int height) { _ww = width, _wh = height; };
|
||||
void setWindowTitle(const std::string& title) { _title = title; }
|
||||
void setDisplayMode(unsigned int displayMode) { _displayMode = displayMode; }
|
||||
|
||||
virtual bool open();
|
||||
virtual bool run();
|
||||
virtual void display();
|
||||
|
||||
protected:
|
||||
|
||||
virtual void clear();
|
||||
|
||||
static void displayCB();
|
||||
static void reshapeCB(int w, int h);
|
||||
static void visibilityCB(int state);
|
||||
static void mouseMotionCB(int x, int y);
|
||||
static void mousePassiveMotionCB(int x, int y);
|
||||
static void mouseCB(int button, int state, int x, int y);
|
||||
static void keyboardCB(unsigned char key, int x, int y );
|
||||
static void keyboardUpCB(unsigned char key, int x, int y );
|
||||
|
||||
static void specialCB(int key, int x, int y);
|
||||
static void specialUpCB(int key, int x, int y);
|
||||
static void spaceballMotionCB(int x, int y, int z);
|
||||
static void spaceballRotateCB(int x, int y, int z);
|
||||
static void spaceballButtonCB(int button, int state);
|
||||
|
||||
virtual void reshape(GLint w, GLint h);
|
||||
virtual void visibility(int state);
|
||||
virtual void mouseMotion(int x, int y);
|
||||
virtual void mousePassiveMotion(int x, int y);
|
||||
virtual void mouse(int button, int state, int x, int y);
|
||||
virtual void keyboard(int key, int x, int y, bool keydown);
|
||||
|
||||
virtual void special(int key, int x, int y, bool keydown);
|
||||
virtual void spaceballMotion(int x, int y, int z);
|
||||
virtual void spaceballRotate(int x, int y, int z);
|
||||
virtual void spaceballButton(int button, int state);
|
||||
|
||||
|
||||
static Window* s_theWindow;
|
||||
|
||||
std::string _title;
|
||||
int _wx, _wy, _ww, _wh;
|
||||
unsigned int _displayMode;
|
||||
int _is_open;
|
||||
|
||||
int _mx, _my, _mbutton;
|
||||
bool _fullscreen;
|
||||
int _saved_wx, _saved_wy, _saved_ww,_saved_wh;
|
||||
|
||||
bool _exit;
|
||||
void check_if_exit();
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // SG_VIEWIER_H
|
||||
@@ -1,29 +0,0 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* 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
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSG_GLUT
|
||||
#define OSG_GLUT 1
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(__DARWIN_OSX__)
|
||||
#include <GLUT/glut.h>
|
||||
#else
|
||||
#if defined(__hpux__)
|
||||
#include <glut.h>
|
||||
#else
|
||||
#include <GL/glut.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // __osgGLUT_h
|
||||
Reference in New Issue
Block a user