Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
8eb41670
Commit
8eb41670
authored
Aug 13, 2009
by
ebaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ADD
#50
,
#51
,
#52
]
- added basic graphics engine - added basic class stubs for Kernel, Modules
parent
19a975fc
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
1586 additions
and
63 deletions
+1586
-63
src/CMakeLists.txt
src/CMakeLists.txt
+3
-1
src/graphicsEngine/CMakeLists.txt
src/graphicsEngine/CMakeLists.txt
+8
-4
src/graphicsEngine/WGEGraphicsWindow.cpp
src/graphicsEngine/WGEGraphicsWindow.cpp
+174
-0
src/graphicsEngine/WGEGraphicsWindow.h
src/graphicsEngine/WGEGraphicsWindow.h
+167
-0
src/graphicsEngine/WGEScene.cpp
src/graphicsEngine/WGEScene.cpp
+35
-0
src/graphicsEngine/WGEScene.h
src/graphicsEngine/WGEScene.h
+53
-0
src/graphicsEngine/WGEViewer.cpp
src/graphicsEngine/WGEViewer.cpp
+166
-0
src/graphicsEngine/WGEViewer.h
src/graphicsEngine/WGEViewer.h
+131
-0
src/graphicsEngine/WGraphicsEngine.cpp
src/graphicsEngine/WGraphicsEngine.cpp
+42
-0
src/graphicsEngine/WGraphicsEngine.h
src/graphicsEngine/WGraphicsEngine.h
+72
-0
src/graphicsEngine/exceptions/CMakeLists.txt
src/graphicsEngine/exceptions/CMakeLists.txt
+5
-0
src/graphicsEngine/exceptions/WGEException.cpp
src/graphicsEngine/exceptions/WGEException.cpp
+38
-0
src/graphicsEngine/exceptions/WGEException.h
src/graphicsEngine/exceptions/WGEException.h
+58
-0
src/graphicsEngine/exceptions/WGEInitFailed.cpp
src/graphicsEngine/exceptions/WGEInitFailed.cpp
+37
-0
src/graphicsEngine/exceptions/WGEInitFailed.h
src/graphicsEngine/exceptions/WGEInitFailed.h
+58
-0
src/gui/qt4/WMainApplication.cpp
src/gui/qt4/WMainApplication.cpp
+1
-1
src/gui/qt4/WMainWindow.cpp
src/gui/qt4/WMainWindow.cpp
+3
-3
src/gui/qt4/WQtGLWidget.cpp
src/gui/qt4/WQtGLWidget.cpp
+100
-21
src/gui/qt4/WQtGLWidget.h
src/gui/qt4/WQtGLWidget.h
+130
-31
src/kernel/CMakeLists.txt
src/kernel/CMakeLists.txt
+3
-0
src/kernel/WKernel.cpp
src/kernel/WKernel.cpp
+15
-1
src/kernel/WKernel.h
src/kernel/WKernel.h
+28
-1
src/kernel/WModule.cpp
src/kernel/WModule.cpp
+52
-0
src/kernel/WModule.h
src/kernel/WModule.h
+77
-0
src/kernel/WTestModule.cpp
src/kernel/WTestModule.cpp
+52
-0
src/kernel/WTestModule.h
src/kernel/WTestModule.h
+78
-0
No files found.
src/CMakeLists.txt
View file @
8eb41670
...
...
@@ -36,7 +36,7 @@ FIND_PACKAGE( OpenGL REQUIRED )
### CxxTest ###
FIND_PACKAGE
(
CxxTest QUIET
)
MARK_AS_ADVANCED
(
CXXTEST_PERL_TESTGEN_EXECUTABLE
)
FIND_PACKAGE
(
OpenSceneGraph REQUIRED osgUtil osgDB osgViewer
)
# Platform dependencies
IF
(
OPENWALNUT_PLATFORM MATCHES
${
OPENWALNUT_PLATFORM_WINDOWS
}
)
...
...
@@ -83,6 +83,8 @@ SET( CMAKE_CXX_FLAGS_STATIC "-O3" CACHE STRING "" FORCE )
MARK_AS_ADVANCED
(
CMAKE_CXX_FLAGS_STATIC
)
SET
(
CMAKE_CXX_FLAGS_RELWITHDEBINFO
"-g -DDEBUG -O2"
CACHE STRING
""
FORCE
)
INCLUDE_DIRECTORIES
(
${
OPENSCENEGRAPH_INCLUDE_DIRS
}
)
IF
(
NOT CMAKE_BUILD_TYPE STREQUAL
"Static"
)
ADD_SUBDIRECTORY
(
math
)
ADD_SUBDIRECTORY
(
dataHandler
)
...
...
src/graphicsEngine/CMakeLists.txt
View file @
8eb41670
# Package dependencies:
FIND_PACKAGE
(
GLEW REQUIRED
)
FIND_PACKAGE
(
GLEW REQUIRED
)
# required anymore?
ADD_SUBDIRECTORY
(
exceptions
)
# Includes:
INCLUDE_DIRECTORIES
(
${
GLEW_INCLUDE_PATH
}
)
FILE
(
GLOB GE_SRC
"*.cpp"
)
FILE
(
GLOB GE_EXCEPTIONS_SRC
"exceptions/*.cpp"
)
FILE
(
GLOB GE_SRC
"*.cpp"
)
ADD_LIBRARY
(
ge SHARED
${
GE_SRC
}
${
GE_EXCEPTIONS_SRC
}
)
TARGET_LINK_LIBRARIES
(
ge
"common"
${
OPENGL_gl_LIBRARY
}
${
GLEW_LIBRARY
}
${
OPENSCENEGRAPH_LIBRARIES
}
)
ADD_LIBRARY
(
ge SHARED
${
GE_SRC
}
)
TARGET_LINK_LIBRARIES
(
ge
${
OPENGL_gl_LIBRARY
}
${
GLEW_LIBRARY
}
)
src/graphicsEngine/WGEGraphicsWindow.cpp
0 → 100644
View file @
8eb41670
//---------------------------------------------------------------------------
//
// Project: OpenWalnut
//
// Copyright 2009 SomeCopyrightowner
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include <iostream>
#include "WGEGraphicsWindow.h"
#include "exceptions/WGEInitFailed.h"
WGEGraphicsWindow
::
WGEGraphicsWindow
(
boost
::
shared_ptr
<
WindowData
>
wdata
,
int
x
,
int
y
,
int
width
,
int
height
)
{
m_WindowData
=
wdata
;
// initialize context
try
{
createContext
(
x
,
y
,
width
,
height
);
}
catch
(
...
)
{
// use our own exceptions
throw
WGEInitFailed
(
"Initialization of OpenGL graphics context failed."
);
}
}
WGEGraphicsWindow
::~
WGEGraphicsWindow
()
{
// cleanup
}
boost
::
shared_ptr
<
osgViewer
::
GraphicsWindow
>
WGEGraphicsWindow
::
getGraphicsWindow
()
{
return
m_GraphicsWindow
;
}
void
WGEGraphicsWindow
::
createContext
(
int
x
,
int
y
,
int
width
,
int
height
)
{
// Create traits for graphics contest request
osg
::
DisplaySettings
*
ds
=
osg
::
DisplaySettings
::
instance
();
osg
::
ref_ptr
<
osg
::
GraphicsContext
::
Traits
>
traits
=
new
osg
::
GraphicsContext
::
Traits
;
// ensure correct $DISPLAY variable
traits
->
readDISPLAY
();
if
(
traits
->
displayNum
<
0
)
{
traits
->
displayNum
=
0
;
}
// set a lot of values
traits
->
windowName
=
"OpenWalnut"
;
traits
->
screenNum
=
0
;
// XXX is this a good idea?
traits
->
x
=
x
;
traits
->
y
=
y
;
traits
->
width
=
width
;
traits
->
height
=
height
;
traits
->
alpha
=
ds
->
getMinimumNumAlphaBits
();
traits
->
stencil
=
ds
->
getMinimumNumStencilBits
();
// traits->windowDecoration = false;
traits
->
doubleBuffer
=
true
;
traits
->
sharedContext
=
0
;
traits
->
sampleBuffers
=
ds
->
getMultiSamples
();
traits
->
samples
=
ds
->
getNumMultiSamples
();
traits
->
inheritedWindowData
=
m_WindowData
.
get
();
// Stereo
// TODO(ebaum): test whether it works
if
(
ds
->
getStereo
()
)
{
switch
(
ds
->
getStereoMode
()
)
{
case
(
osg
::
DisplaySettings
::
QUAD_BUFFER
):
traits
->
quadBufferStereo
=
true
;
break
;
case
(
osg
::
DisplaySettings
::
VERTICAL_INTERLACE
):
case
(
osg
::
DisplaySettings
::
CHECKERBOARD
):
case
(
osg
::
DisplaySettings
::
HORIZONTAL_INTERLACE
):
traits
->
stencil
=
8
;
break
;
default:
break
;
}
}
// finally create graphics context and window
m_GraphicsContext
=
osg
::
GraphicsContext
::
createGraphicsContext
(
traits
.
get
()
);
m_GraphicsWindow
=
boost
::
shared_ptr
<
osgViewer
::
GraphicsWindow
>
(
static_cast
<
osgViewer
::
GraphicsWindow
*>
(
m_GraphicsContext
)
);
// get around dearanged traits on X11 (MTCompositeViewer only)
traits
->
x
=
x
;
traits
->
y
=
x
;
traits
->
width
=
width
;
traits
->
height
=
height
;
}
void
WGEGraphicsWindow
::
resize
(
int
width
,
int
height
)
{
m_GraphicsWindow
->
getEventQueue
()
->
windowResize
(
0
,
0
,
width
,
height
);
m_GraphicsWindow
->
resized
(
0
,
0
,
width
,
height
);
}
void
WGEGraphicsWindow
::
close
()
{
m_GraphicsWindow
->
getEventQueue
()
->
closeWindow
();
}
void
WGEGraphicsWindow
::
keyEvent
(
KeyEvents
eventType
,
int
key
)
{
switch
(
eventType
)
{
case
KEYPRESS
:
m_GraphicsWindow
->
getEventQueue
()
->
keyPress
(
static_cast
<
osgGA
::
GUIEventAdapter
::
KeySymbol
>
(
key
)
);
break
;
case
KEYRELEASE
:
m_GraphicsWindow
->
getEventQueue
()
->
keyRelease
(
static_cast
<
osgGA
::
GUIEventAdapter
::
KeySymbol
>
(
key
)
);
break
;
}
}
void
WGEGraphicsWindow
::
mouseEvent
(
MouseEvents
eventType
,
int
x
,
int
y
,
int
button
)
{
switch
(
eventType
)
{
case
MOUSEPRESS
:
m_GraphicsWindow
->
getEventQueue
()
->
mouseButtonPress
(
x
,
y
,
button
);
break
;
case
MOUSERELEASE
:
m_GraphicsWindow
->
getEventQueue
()
->
mouseButtonRelease
(
x
,
y
,
button
);
break
;
case
MOUSEDOUBLECLICK
:
m_GraphicsWindow
->
getEventQueue
()
->
mouseDoubleButtonPress
(
x
,
y
,
button
);
break
;
case
MOUSEMOVE
:
m_GraphicsWindow
->
getEventQueue
()
->
mouseMotion
(
x
,
y
);
break
;
}
}
src/graphicsEngine/WGEGraphicsWindow.h
0 → 100644
View file @
8eb41670
//---------------------------------------------------------------------------
//
// Project: OpenWalnut
//
// Copyright 2009 SomeCopyrightowner
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WGEGRAPHICSWINDOW_H
#define WGEGRAPHICSWINDOW_H
#if defined( WIN32 ) && !defined( __CYGWIN__ )
#include <osgViewer/api/Win32/GraphicsWindowWin32>
typedef
HWND
WindowHandle
;
typedef
osgViewer
::
GraphicsWindowWin32
::
WindowData
WindowData
;
#elif defined( __APPLE__ ) // Assume using Carbon on Mac.
#include <osgViewer/api/Carbon/GraphicsWindowCarbon>
typedef
WindowRef
WindowHandle
;
typedef
osgViewer
::
GraphicsWindowCarbon
::
WindowData
WindowData
;
#else // all other unix
#include <osgViewer/api/X11/GraphicsWindowX11>
typedef
Window
WindowHandle
;
typedef
osgViewer
::
GraphicsWindowX11
::
WindowData
WindowData
;
#endif
#include <boost/shared_ptr.hpp>
/**
* \par Description:
* Class managing a single graphics context and OSG GraphicsWindow.
*/
class
WGEGraphicsWindow
{
public:
/**
* \par Description
* Default constructor.
*
* \param wdata the WindowData instance for the widget to use as render widget
* \param x X coordinate of widget where to create the context.
* \param y Y coordinate of widget where to create the context.
* \param width Width of the widget.
* \param height Height of the Widget.
* \exception WGEInitFailed thrown if initialization of graphics context or graphics window has failed.
*/
WGEGraphicsWindow
(
boost
::
shared_ptr
<
WindowData
>
wdata
,
int
x
,
int
y
,
int
width
,
int
height
);
/**
* \par Description
* Destructor.
*/
virtual
~
WGEGraphicsWindow
();
/**
* \par Description
* Getter for m_GraphicsWindow.
*
* \return the OSG GraphicsWindow instance.
*/
boost
::
shared_ptr
<
osgViewer
::
GraphicsWindow
>
getGraphicsWindow
();
/**
* \par Description
* Event types for the keyEvent() handler.
*/
enum
KeyEvents
{
KEYPRESS
,
KEYRELEASE
};
/**
* \par Description
* Mouse event types for the mouseEvent() handler.
*/
enum
MouseEvents
{
MOUSEPRESS
,
MOUSERELEASE
,
MOUSEDOUBLECLICK
,
MOUSEMOVE
};
/**
* \par Description
* Updates size information.
*
* \param width new width.
* \param height new height.
*/
virtual
void
resize
(
int
width
,
int
height
);
/**
* \par Description
* Initiates a close event for this viewer. It destroys the graphics context and invalidates the viewer.
* This should be called whenever a QT Widget closes to also free its OSG Viewer resources.
*/
virtual
void
close
();
/**
* \par Description
* Handles key events (if forwarded to this Viewer instance).
*
* \param key the key code.
* \param eventType the type of event.
*/
virtual
void
keyEvent
(
KeyEvents
eventType
,
int
key
);
/**
* \par Description
* Handles mouse events forwarded from widget.
*
* \param eventType the event type.
* \param x x coordinate of event.
* \param y y coordinate of event.
* \param button mouse button.
*/
virtual
void
mouseEvent
(
MouseEvents
eventType
,
int
x
,
int
y
,
int
button
);
protected:
/**
* \par Description
* Creates a new OpenGL context in the calling thread. Needs to be called before any other OpenGL operation.
*
* \param x X coordinate of widget where to create the context.
* \param y Y coordinate of widget where to create the context.
* \param width Width of the widget.
* \param height Height of the Widget.
*/
void
createContext
(
int
x
,
int
y
,
int
width
,
int
height
);
/**
* \par Description
* OpenSceneGraph render window.
*/
boost
::
shared_ptr
<
osgViewer
::
GraphicsWindow
>
m_GraphicsWindow
;
/**
* \par Description
* OpenSceneGraph render context. This is required to be a "normal" pointer since using shared_ptr causes
* the code not to work (unknown reason for now). But since we do not offer a getter for it -> no prob.
*/
osg
::
GraphicsContext
*
m_GraphicsContext
;
/**
* \par Description
* Widget window data.
*/
boost
::
shared_ptr
<
WindowData
>
m_WindowData
;
private:
};
#endif // WGEGRAPHICSWINDOW_H
src/graphicsEngine/WGEScene.cpp
0 → 100644
View file @
8eb41670
//---------------------------------------------------------------------------
//
// Project: OpenWalnut
//
// Copyright 2009 SomeCopyrightowner
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include "WGEScene.h"
WGEScene
::
WGEScene
()
{
// initialize members
}
WGEScene
::~
WGEScene
()
{
// cleanup
}
src/graphicsEngine/WGEScene.h
0 → 100644
View file @
8eb41670
//---------------------------------------------------------------------------
//
// Project: OpenWalnut
//
// Copyright 2009 SomeCopyrightowner
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WGESCENE_H
#define WGESCENE_H
/**
* \par Description:
* Class for managing the OpenSceneGraph root node. It can handle new nodes, removing nodes and so on.
*/
class
WGEScene
{
public:
/**
* \par Description
* Default constructor.
*/
WGEScene
();
/**
* \par Description
* Destructor.
*/
virtual
~
WGEScene
();
protected:
private:
};
#endif // WGESCENE_H
src/graphicsEngine/WGEViewer.cpp
0 → 100644
View file @
8eb41670
//---------------------------------------------------------------------------
//
// Project: OpenWalnut
//
// Copyright 2009 SomeCopyrightowner
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include <iostream>
#include <osg/ShapeDrawable>
#include <osg/Geode>
#include <osgGA/TrackballManipulator>
#include <osgGA/FlightManipulator>
#include <osgGA/DriveManipulator>
#include <osgGA/UFOManipulator>
#include <osgGA/KeySwitchMatrixManipulator>
#include <osgGA/StateSetManipulator>
#include <osgGA/AnimationPathManipulator>
#include <osgGA/TerrainManipulator>
#include <osgViewer/ViewerEventHandlers>
#include <osgDB/ReadFile>
#include "WGEViewer.h"
#include "exceptions/WGEInitFailed.h"
WGEViewer
::
WGEViewer
(
boost
::
shared_ptr
<
WindowData
>
wdata
,
int
x
,
int
y
,
int
width
,
int
height
)
:
WGEGraphicsWindow
(
wdata
,
x
,
y
,
width
,
height
)
{
try
{
// initialize OSG render window
m_Viewer
=
boost
::
shared_ptr
<
osgViewer
::
CompositeViewer
>
(
new
osgViewer
::
CompositeViewer
()
);
m_Viewer
->
setThreadingModel
(
osgViewer
::
Viewer
::
DrawThreadPerContext
);
// m_Viewer->setThreadingModel( osgViewer::Viewer::SingleThreaded );
m_View
=
boost
::
shared_ptr
<
osgViewer
::
Viewer
>
(
new
osgViewer
::
Viewer
()
);
m_View
->
getCamera
()
->
setGraphicsContext
(
m_GraphicsContext
);
m_View
->
getCamera
()
->
setProjectionMatrixAsPerspective
(
30.0
f
,
1.333
,
1.0
,
1000.0
);
m_View
->
getCamera
()
->
setViewport
(
new
osg
::
Viewport
(
0
,
0
,
10
,
10
)
);
// add the stats handler
m_View
->
addEventHandler
(
new
osgViewer
::
StatsHandler
);
// camera manipulator
m_Manipulator
=
new
osgGA
::
TrackballManipulator
();
m_View
->
setCameraManipulator
(
m_Manipulator
);
// finally add view
// there is the possibility to use ONE single composite viewer instance for every view, but
// currently this possibility is not used.
m_Viewer
->
addView
(
m_View
.
get
()
);
// load the sample scene.
osg
::
Geode
*
sceneDataGeode
=
new
osg
::
Geode
();
// 20 units into the screen
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Box
(
osg
::
Vec3
(
-
6
,
5
,
-
20
),
1.0
)
)
);
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Sphere
(
osg
::
Vec3
(
-
3
,
5
,
-
20
),
1.0
)
)
);
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Cone
(
osg
::
Vec3
(
0
,
5
,
-
20
),
1.0
,
1.0
)
)
);
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Cylinder
(
osg
::
Vec3
(
3
,
5
,
-
20
),
1.0
,
1.0
)
)
);
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Capsule
(
osg
::
Vec3
(
6
,
5
,
-
20
),
1.0
,
1.0
)
)
);
// 25 units into the screen
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Box
(
osg
::
Vec3
(
-
6
,
0
,
-
25
),
1.0
)
)
);
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Sphere
(
osg
::
Vec3
(
-
3
,
0
,
-
25
),
1.0
)
)
);
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Cone
(
osg
::
Vec3
(
0
,
0
,
-
25
),
1.0
,
1.0
)
)
);
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Cylinder
(
osg
::
Vec3
(
3
,
0
,
-
25
),
1.0
,
1.0
)
)
);
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Capsule
(
osg
::
Vec3
(
6
,
0
,
-
25
),
1.0
,
1.0
)
)
);
// 30 units into the screen
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Box
(
osg
::
Vec3
(
-
6
,
-
5
,
-
30
),
1.0
)
)
);
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Sphere
(
osg
::
Vec3
(
-
3
,
-
5
,
-
30
),
1.0
)
)
);
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Cone
(
osg
::
Vec3
(
0
,
-
5
,
-
30
),
1.0
,
1.0
)
)
);
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Cylinder
(
osg
::
Vec3
(
3
,
-
5
,
-
30
),
1.0
,
1.0
)
)
);
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Capsule
(
osg
::
Vec3
(
6
,
-
5
,
-
30
),
1.0
,
1.0
)
)
);
// 35 units into the screen
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Box
(
osg
::
Vec3
(
-
6
,
-
10
,
-
35
),
1.0
)
)
);
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Sphere
(
osg
::
Vec3
(
-
3
,
-
10
,
-
35
),
1.0
)
)
);
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Cone
(
osg
::
Vec3
(
0
,
-
10
,
-
35
),
1.0
,
1.0
)
)
);
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Cylinder
(
osg
::
Vec3
(
3
,
-
10
,
-
35
),
1.0
,
1.0
)
)
);
sceneDataGeode
->
addDrawable
(
new
osg
::
ShapeDrawable
(
new
osg
::
Capsule
(
osg
::
Vec3
(
6
,
-
10
,
-
35
),
1.0
,
1.0
)
)
);
m_View
->
setSceneData
(
sceneDataGeode
);
}
catch
(
...
)
{
throw
WGEInitFailed
(
"Initialization of WGEViewer failed"
);
}
}
WGEViewer
::~
WGEViewer
()
{
// cleanup
}
boost
::
shared_ptr
<
osgViewer
::
CompositeViewer
>
WGEViewer
::
getViewer
()