From Alexandre Amalric, Fox example
From Robert Osfield, CMake build support for FOX example
This commit is contained in:
parent
fee5bc9f8c
commit
6b4e2fbdf2
@ -141,6 +141,7 @@ FIND_PACKAGE(FreeType)
|
||||
FIND_PACKAGE(FLTK)
|
||||
FIND_PACKAGE(GLUT)
|
||||
FIND_PACKAGE(SDL)
|
||||
FIND_PACKAGE(FOX)
|
||||
FIND_PACKAGE(Inventor)
|
||||
FIND_PACKAGE(Jasper)
|
||||
FIND_PACKAGE(COLLADA)
|
||||
|
74
CMakeModules/FindFOX.cmake
Normal file
74
CMakeModules/FindFOX.cmake
Normal file
@ -0,0 +1,74 @@
|
||||
# Locate gdal
|
||||
# This module defines
|
||||
# FOX_LIBRARY
|
||||
# FOX_FOUND, if false, do not try to link to gdal
|
||||
# FOX_INCLUDE_DIR, where to find the headers
|
||||
#
|
||||
# $FOX_DIR is an environment variable that would
|
||||
# correspond to the ./configure --prefix=$FOX_DIR
|
||||
#
|
||||
# Created by Robert Osfield.
|
||||
|
||||
FIND_PATH(FOX_INCLUDE_DIR fx.h
|
||||
$ENV{FOX_DIR}/include/fox-1.6
|
||||
$ENV{FOX_DIR}/fox-1.6
|
||||
$ENV{OSGDIR}/include/fox-1.6
|
||||
$ENV{OSGDIR}/fox-1.6
|
||||
$ENV{OSG_ROOT}/include/fox-1.6
|
||||
~/Library/Frameworks/fox-1.6
|
||||
/Library/Frameworks/fox-1.6
|
||||
/usr/local/include/fox-1.6
|
||||
/usr/include/fox-1.6
|
||||
/sw/include/fox-1.6 # Fink
|
||||
/opt/local/include/fox-1.6 # DarwinPorts
|
||||
/opt/csw/include/fox-1.6 # Blastwave
|
||||
/opt/include/fox-1.6
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include/fox-1.6
|
||||
/usr/freeware/include/fox-1.6
|
||||
$ENV{FOX_DIR}/include
|
||||
$ENV{FOX_DIR}
|
||||
$ENV{OSGDIR}/include
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/include
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
/sw/include # Fink
|
||||
/opt/local/include # DarwinPorts
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
|
||||
/usr/freeware/include
|
||||
)
|
||||
|
||||
MACRO(FIND_FOX_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
|
||||
FIND_LIBRARY(${MYLIBRARY}
|
||||
NAMES ${MYLIBRARYNAME}
|
||||
PATHS
|
||||
$ENV{FOX_DIR}/lib
|
||||
$ENV{FOX_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
/sw/lib
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
ENDMACRO(FIND_FOX_LIBRARY LIBRARY LIBRARYNAME)
|
||||
|
||||
FIND_FOX_LIBRARY(FOX_LIBRARY FOX-1.6)
|
||||
|
||||
SET(FOX_FOUND "NO")
|
||||
IF(FOX_LIBRARY AND FOX_INCLUDE_DIR)
|
||||
SET(FOX_FOUND "YES")
|
||||
ENDIF(FOX_LIBRARY AND FOX_INCLUDE_DIR)
|
@ -105,6 +105,10 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
||||
ADD_SUBDIRECTORY(osgviewerSDL)
|
||||
ENDIF(SDL_FOUND)
|
||||
|
||||
IF (FOX_FOUND)
|
||||
ADD_SUBDIRECTORY(osgviewerFOX)
|
||||
ENDIF(FOX_FOUND)
|
||||
|
||||
IF (wxWidgets_FOUND)
|
||||
ADD_SUBDIRECTORY(osgviewerWX)
|
||||
ENDIF(wxWidgets_FOUND)
|
||||
|
9
examples/osgviewerFOX/CMakeLists.txt
Normal file
9
examples/osgviewerFOX/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
||||
SET(TARGET_SRC FOX_OSG.cpp FOX_OSG_MDIView.cpp osgviewerFOX.cpp )
|
||||
|
||||
SET(TARGET_H FOX_OSG_MDIView.h osgviewerFOX.cpp osgviewerFOX.h)
|
||||
|
||||
INCLUDE_DIRECTORIES( ${FOX_INCLUDE_DIR} )
|
||||
SET(TARGET_EXTERNAL_LIBRARIES ${FOX_LIBRARY} )
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_EXAMPLE(osgviewerFOX)
|
193
examples/osgviewerFOX/FOX_OSG.cpp
Normal file
193
examples/osgviewerFOX/FOX_OSG.cpp
Normal file
@ -0,0 +1,193 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "FOX_OSG.h"
|
||||
|
||||
// Map
|
||||
FXDEFMAP(GraphicsWindowFOX) GraphicsWindowFOX_Map[] = {
|
||||
//________Message_Type_________ ___ID___ ________Message_Handler________
|
||||
FXMAPFUNC(SEL_CONFIGURE, 0, GraphicsWindowFOX::onConfigure),
|
||||
FXMAPFUNC(SEL_KEYPRESS, 0, GraphicsWindowFOX::onKeyPress),
|
||||
FXMAPFUNC(SEL_KEYRELEASE, 0, GraphicsWindowFOX::onKeyRelease),
|
||||
FXMAPFUNC(SEL_LEFTBUTTONPRESS, 0, GraphicsWindowFOX::onLeftBtnPress),
|
||||
FXMAPFUNC(SEL_LEFTBUTTONRELEASE, 0, GraphicsWindowFOX::onLeftBtnRelease),
|
||||
FXMAPFUNC(SEL_MIDDLEBUTTONPRESS, 0, GraphicsWindowFOX::onMiddleBtnPress),
|
||||
FXMAPFUNC(SEL_MIDDLEBUTTONRELEASE, 0, GraphicsWindowFOX::onMiddleBtnRelease),
|
||||
FXMAPFUNC(SEL_RIGHTBUTTONPRESS, 0, GraphicsWindowFOX::onRightBtnPress),
|
||||
FXMAPFUNC(SEL_RIGHTBUTTONRELEASE, 0, GraphicsWindowFOX::onRightBtnRelease),
|
||||
FXMAPFUNC(SEL_MOTION, 0, GraphicsWindowFOX::onMotion)
|
||||
};
|
||||
|
||||
FXIMPLEMENT(GraphicsWindowFOX, FXGLCanvas, GraphicsWindowFOX_Map, ARRAYNUMBER(GraphicsWindowFOX_Map))
|
||||
|
||||
GraphicsWindowFOX::GraphicsWindowFOX(FXComposite *parent, FXGLVisual *vis,
|
||||
FXObject *tgt, FXSelector sel,
|
||||
FXuint opts, FXint x, FXint y,
|
||||
FXint w, FXint h)
|
||||
: FXGLCanvas(parent, vis, tgt, sel, opts, x, y, w, h)
|
||||
{
|
||||
// default cursor to standard
|
||||
_oldCursor = new FXCursor(parent->getApp(),CURSOR_CROSS);
|
||||
|
||||
_traits = new GraphicsContext::Traits;
|
||||
_traits->x = x;
|
||||
_traits->y = y;
|
||||
_traits->width = w;
|
||||
_traits->height = h;
|
||||
_traits->windowDecoration = false;
|
||||
_traits->doubleBuffer = true;
|
||||
_traits->sharedContext = 0;
|
||||
|
||||
init();
|
||||
|
||||
}
|
||||
|
||||
void GraphicsWindowFOX::init()
|
||||
{
|
||||
if (valid())
|
||||
{
|
||||
setState( new osg::State );
|
||||
getState()->setGraphicsContext(this);
|
||||
|
||||
if (_traits.valid() && _traits->sharedContext)
|
||||
{
|
||||
getState()->setContextID( _traits->sharedContext->getState()->getContextID() );
|
||||
incrementContextIDUsageCount( getState()->getContextID() );
|
||||
}
|
||||
else
|
||||
{
|
||||
getState()->setContextID( osg::GraphicsContext::createNewContextID() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GraphicsWindowFOX::~GraphicsWindowFOX()
|
||||
{
|
||||
}
|
||||
|
||||
void GraphicsWindowFOX::grabFocus()
|
||||
{
|
||||
// focus this window
|
||||
setFocus();
|
||||
}
|
||||
|
||||
void GraphicsWindowFOX::grabFocusIfPointerInWindow()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void GraphicsWindowFOX::useCursor(bool cursorOn)
|
||||
{
|
||||
if (cursorOn) {
|
||||
// show the old cursor
|
||||
setDefaultCursor(_oldCursor);
|
||||
}
|
||||
else {
|
||||
setDefaultCursor(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
bool GraphicsWindowFOX::makeCurrentImplementation()
|
||||
{
|
||||
FXGLCanvas::makeCurrent();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GraphicsWindowFOX::releaseContext()
|
||||
{
|
||||
FXGLCanvas::makeNonCurrent();
|
||||
return true;
|
||||
}
|
||||
|
||||
void GraphicsWindowFOX::swapBuffersImplementation()
|
||||
{
|
||||
FXGLCanvas::swapBuffers();
|
||||
}
|
||||
|
||||
|
||||
long GraphicsWindowFOX::onConfigure(FXObject *sender, FXSelector sel, void* ptr)
|
||||
{
|
||||
// set GL viewport (not called by FXGLCanvas::onConfigure on all platforms...)
|
||||
// update the window dimensions, in case the window has been resized.
|
||||
getEventQueue()->windowResize(0, 0, getWidth(), getHeight());
|
||||
resized(0, 0, getWidth(), getHeight());
|
||||
|
||||
return FXGLCanvas::onConfigure(sender, sel, ptr);
|
||||
}
|
||||
|
||||
long GraphicsWindowFOX::onKeyPress(FXObject *sender, FXSelector sel, void* ptr)
|
||||
{
|
||||
int key = ((FXEvent*)ptr)->code;
|
||||
getEventQueue()->keyPress(key);
|
||||
|
||||
return FXGLCanvas::onKeyPress(sender, sel, ptr);
|
||||
}
|
||||
|
||||
long GraphicsWindowFOX::onKeyRelease(FXObject *sender, FXSelector sel, void* ptr)
|
||||
{
|
||||
int key = ((FXEvent*)ptr)->code;
|
||||
getEventQueue()->keyRelease(key);
|
||||
|
||||
return FXGLCanvas::onKeyRelease(sender, sel, ptr);
|
||||
}
|
||||
|
||||
long GraphicsWindowFOX::onLeftBtnPress(FXObject *sender, FXSelector sel, void* ptr)
|
||||
{
|
||||
handle(this,FXSEL(SEL_FOCUS_SELF,0),ptr);
|
||||
|
||||
FXEvent* event=(FXEvent*)ptr;
|
||||
getEventQueue()->mouseButtonPress(event->click_x, event->click_y, 1);
|
||||
|
||||
return FXGLCanvas::onLeftBtnPress(sender, sel, ptr);
|
||||
}
|
||||
|
||||
long GraphicsWindowFOX::onLeftBtnRelease(FXObject *sender, FXSelector sel, void* ptr)
|
||||
{
|
||||
FXEvent* event=(FXEvent*)ptr;
|
||||
getEventQueue()->mouseButtonRelease(event->click_x, event->click_y, 1);
|
||||
|
||||
return FXGLCanvas::onLeftBtnRelease(sender, sel, ptr);
|
||||
}
|
||||
|
||||
long GraphicsWindowFOX::onMiddleBtnPress(FXObject *sender, FXSelector sel, void* ptr)
|
||||
{
|
||||
handle(this,FXSEL(SEL_FOCUS_SELF,0),ptr);
|
||||
|
||||
FXEvent* event=(FXEvent*)ptr;
|
||||
getEventQueue()->mouseButtonPress(event->click_x, event->click_y, 2);
|
||||
|
||||
return FXGLCanvas::onMiddleBtnPress(sender, sel, ptr);
|
||||
}
|
||||
|
||||
long GraphicsWindowFOX::onMiddleBtnRelease(FXObject *sender, FXSelector sel, void* ptr)
|
||||
{
|
||||
FXEvent* event=(FXEvent*)ptr;
|
||||
getEventQueue()->mouseButtonRelease(event->click_x, event->click_y, 2);
|
||||
|
||||
return FXGLCanvas::onMiddleBtnRelease(sender, sel, ptr);
|
||||
}
|
||||
|
||||
long GraphicsWindowFOX::onRightBtnPress(FXObject *sender, FXSelector sel, void* ptr)
|
||||
{
|
||||
handle(this,FXSEL(SEL_FOCUS_SELF,0),ptr);
|
||||
|
||||
FXEvent* event=(FXEvent*)ptr;
|
||||
getEventQueue()->mouseButtonPress(event->click_x, event->click_y, 3);
|
||||
|
||||
return FXGLCanvas::onRightBtnPress(sender, sel, ptr);
|
||||
}
|
||||
|
||||
long GraphicsWindowFOX::onRightBtnRelease(FXObject *sender, FXSelector sel, void* ptr)
|
||||
{
|
||||
FXEvent* event=(FXEvent*)ptr;
|
||||
getEventQueue()->mouseButtonRelease(event->click_x, event->click_y, 3);
|
||||
|
||||
return FXGLCanvas::onRightBtnRelease(sender, sel, ptr);
|
||||
}
|
||||
|
||||
long GraphicsWindowFOX::onMotion(FXObject *sender, FXSelector sel, void* ptr)
|
||||
{
|
||||
FXEvent* event=(FXEvent*)ptr;
|
||||
getEventQueue()->mouseMotion(event->win_x, event->win_y);
|
||||
|
||||
return FXGLCanvas::onMotion(sender, sel, ptr);
|
||||
}
|
63
examples/osgviewerFOX/FOX_OSG.h
Normal file
63
examples/osgviewerFOX/FOX_OSG.h
Normal file
@ -0,0 +1,63 @@
|
||||
#ifndef _FOXOSG_H_
|
||||
#define _FOXOSG_H_
|
||||
|
||||
#include <osgViewer/Viewer>
|
||||
#include <string>
|
||||
|
||||
#include <fx.h>
|
||||
#include <fx3d.h>
|
||||
|
||||
using namespace FX;
|
||||
|
||||
class GraphicsWindowFOX: public FXGLCanvas, public osgViewer::GraphicsWindow{
|
||||
|
||||
FXDECLARE(GraphicsWindowFOX);
|
||||
|
||||
public:
|
||||
GraphicsWindowFOX(FXComposite *parent, FXGLVisual *vis,
|
||||
FXObject *tgt=NULL, FXSelector sel=0,
|
||||
FXuint opts=0, FXint x=0, FXint y=0,
|
||||
FXint w=0, FXint h=0);
|
||||
|
||||
virtual ~GraphicsWindowFOX();
|
||||
|
||||
// callback
|
||||
long onConfigure(FXObject*, FXSelector, void*);
|
||||
long onKeyPress(FXObject*, FXSelector, void*);
|
||||
long onKeyRelease(FXObject*, FXSelector, void*);
|
||||
long onLeftBtnPress(FXObject*, FXSelector, void*);
|
||||
long onLeftBtnRelease(FXObject*, FXSelector, void*);
|
||||
long onMiddleBtnPress(FXObject*, FXSelector, void*);
|
||||
long onMiddleBtnRelease(FXObject*, FXSelector, void*);
|
||||
long onRightBtnPress(FXObject*, FXSelector, void*);
|
||||
long onRightBtnRelease(FXObject*, FXSelector, void*);
|
||||
long onMotion(FXObject*, FXSelector, void*);
|
||||
|
||||
void init();
|
||||
|
||||
//
|
||||
// GraphicsWindow interface
|
||||
//
|
||||
void grabFocus();
|
||||
void grabFocusIfPointerInWindow();
|
||||
void useCursor(bool cursorOn);
|
||||
|
||||
bool makeCurrentImplementation();
|
||||
bool releaseContext();
|
||||
void swapBuffersImplementation();
|
||||
|
||||
// note implemented yet...just use dummy implementation to get working.
|
||||
virtual bool valid() const { return true; }
|
||||
virtual bool realizeImplementation() { return true; }
|
||||
virtual bool isRealizedImplementation() const { return true; }
|
||||
virtual void closeImplementation() {}
|
||||
virtual bool releaseContextImplementation() { return true; }
|
||||
|
||||
protected:
|
||||
GraphicsWindowFOX(){};
|
||||
|
||||
private:
|
||||
FXCursor* _oldCursor;
|
||||
};
|
||||
|
||||
#endif // _FOXOSG_H_
|
72
examples/osgviewerFOX/FOX_OSG_MDIView.cpp
Normal file
72
examples/osgviewerFOX/FOX_OSG_MDIView.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
#include "FOX_OSG_MDIView.h"
|
||||
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
|
||||
#include <osgGA/TrackballManipulator>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
|
||||
|
||||
// Map
|
||||
FXDEFMAP(FOX_OSG_MDIView) FOX_OSG_MDIView_Map[] = {
|
||||
//________Message_Type_________ ___ID___ ________Message_Handler________
|
||||
FXMAPFUNC(SEL_CHORE, FOX_OSG_MDIView::ID_CHORE, FOX_OSG_MDIView::OnIdle)
|
||||
};
|
||||
|
||||
FXIMPLEMENT(FOX_OSG_MDIView, FXMDIChild, FOX_OSG_MDIView_Map, ARRAYNUMBER(FOX_OSG_MDIView_Map))
|
||||
|
||||
FOX_OSG_MDIView::FOX_OSG_MDIView(FXMDIClient *p, const FXString &name,
|
||||
FXIcon *ic, FXPopup *pup, FXuint opt,
|
||||
FXint x, FXint y, FXint w, FXint h)
|
||||
: FXMDIChild(p, name, ic, pup, opt, x, y, w, h)
|
||||
{
|
||||
// A visual to drag OpenGL in double-buffered mode; note the glvisual is
|
||||
// shared between all windows which need the same depths and numbers of buffers
|
||||
// Thus, while the first visual may take some time to initialize, each subsequent
|
||||
// window can be created very quickly; we need to determine grpaphics hardware
|
||||
// characteristics only once.
|
||||
FXGLVisual* glVisual=new FXGLVisual(getApp(),VISUAL_DOUBLEBUFFER|VISUAL_STEREO);
|
||||
|
||||
m_gwFox = new GraphicsWindowFOX(this, glVisual, NULL, NULL, LAYOUT_FILL_X|LAYOUT_FILL_Y, x, y, w, h );
|
||||
|
||||
osgViewer::Viewer *viewer = new osgViewer::Viewer;
|
||||
viewer->getCamera()->setGraphicsContext(m_gwFox);
|
||||
viewer->getCamera()->setViewport(0,0,w,h);
|
||||
viewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
|
||||
|
||||
// load the scene.
|
||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile("cow.osg");
|
||||
if (!loadedModel)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
// add the stats handler
|
||||
viewer->addEventHandler(new osgViewer::StatsHandler);
|
||||
|
||||
viewer->setSceneData(loadedModel.get());
|
||||
|
||||
viewer->setCameraManipulator(new osgGA::TrackballManipulator);
|
||||
|
||||
SetViewer(viewer);
|
||||
|
||||
getApp()->addChore(this,ID_CHORE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
FOX_OSG_MDIView::~FOX_OSG_MDIView()
|
||||
{
|
||||
}
|
||||
|
||||
long FOX_OSG_MDIView::OnIdle(FXObject *sender, FXSelector sel, void* ptr)
|
||||
{
|
||||
m_osgViewer->frame();
|
||||
getApp()->addChore(this, ID_CHORE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void FOX_OSG_MDIView::SetViewer(osgViewer::Viewer* viewer)
|
||||
{
|
||||
m_osgViewer = viewer;
|
||||
}
|
41
examples/osgviewerFOX/FOX_OSG_MDIView.h
Normal file
41
examples/osgviewerFOX/FOX_OSG_MDIView.h
Normal file
@ -0,0 +1,41 @@
|
||||
#ifndef _FOXOSGMDIVIEW_H_
|
||||
#define _FOXOSGMDIVIEW_H_
|
||||
|
||||
#include "FOX_OSG.h"
|
||||
|
||||
#include <fx.h>
|
||||
|
||||
#include <osgViewer/Viewer>
|
||||
|
||||
using namespace FX;
|
||||
|
||||
class FOX_OSG_MDIView : public FXMDIChild{
|
||||
|
||||
FXDECLARE(FOX_OSG_MDIView);
|
||||
|
||||
public:
|
||||
FOX_OSG_MDIView(FXMDIClient *p, const FXString &name,
|
||||
FXIcon *ic=NULL, FXPopup *pup=NULL, FXuint opts=0,
|
||||
FXint x=0, FXint y=0, FXint w=0, FXint h=0);
|
||||
|
||||
virtual ~FOX_OSG_MDIView();
|
||||
|
||||
enum{
|
||||
ID_CHORE=FXMDIChild::ID_LAST,
|
||||
ID_LAST
|
||||
};
|
||||
|
||||
// callback
|
||||
long OnIdle(FXObject* , FXSelector, void*);
|
||||
|
||||
void SetViewer(osgViewer::Viewer *viewer);
|
||||
|
||||
protected:
|
||||
FOX_OSG_MDIView(){};
|
||||
|
||||
private:
|
||||
osg::ref_ptr<osgViewer::Viewer> m_osgViewer;
|
||||
GraphicsWindowFOX* m_gwFox;
|
||||
};
|
||||
|
||||
#endif // _FOXOSGMDIVIEW_H_
|
202
examples/osgviewerFOX/Makefile
Normal file
202
examples/osgviewerFOX/Makefile
Normal file
@ -0,0 +1,202 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 2.5
|
||||
|
||||
# Default target executed when no arguments are given to make.
|
||||
default_target: all
|
||||
|
||||
#=============================================================================
|
||||
# Special targets provided by cmake.
|
||||
|
||||
# Disable implicit rules so canoncical targets will work.
|
||||
.SUFFIXES:
|
||||
|
||||
.SUFFIXES: .hpux_make_needs_suffix_list
|
||||
|
||||
# Suppress display of executed commands.
|
||||
$(VERBOSE).SILENT:
|
||||
|
||||
# A target that is always out of date.
|
||||
cmake_force:
|
||||
|
||||
#=============================================================================
|
||||
# Set environment variables for the build.
|
||||
|
||||
# The shell in which to execute make rules.
|
||||
SHELL = /bin/sh
|
||||
|
||||
# The CMake executable.
|
||||
CMAKE_COMMAND = /usr/local/bin/cmake
|
||||
|
||||
# The command to remove a file.
|
||||
RM = /usr/local/bin/cmake -E remove -f
|
||||
|
||||
# The program to use to edit the cache.
|
||||
CMAKE_EDIT_COMMAND = /usr/local/bin/ccmake
|
||||
|
||||
# The top-level source directory on which CMake was run.
|
||||
CMAKE_SOURCE_DIR = /home/robert/OpenSceneGraph
|
||||
|
||||
# The top-level build directory on which CMake was run.
|
||||
CMAKE_BINARY_DIR = /home/robert/OpenSceneGraph
|
||||
|
||||
# Include the progress variables for this target.
|
||||
include CMakeFiles/progress.make
|
||||
|
||||
#=============================================================================
|
||||
# Targets provided globally by CMake.
|
||||
|
||||
# Special rule for the target edit_cache
|
||||
edit_cache:
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
|
||||
cd /home/robert/OpenSceneGraph/examples/osgviewerFOX && /usr/local/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
|
||||
|
||||
# Special rule for the target edit_cache
|
||||
edit_cache/fast: edit_cache
|
||||
|
||||
# Special rule for the target install
|
||||
install: preinstall
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
|
||||
cd /home/robert/OpenSceneGraph/examples/osgviewerFOX && /usr/local/bin/cmake -P cmake_install.cmake
|
||||
|
||||
# Special rule for the target install
|
||||
install/fast: preinstall/fast
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
|
||||
cd /home/robert/OpenSceneGraph/examples/osgviewerFOX && /usr/local/bin/cmake -P cmake_install.cmake
|
||||
|
||||
# Special rule for the target install/local
|
||||
install/local: preinstall
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
|
||||
cd /home/robert/OpenSceneGraph/examples/osgviewerFOX && /usr/local/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
|
||||
|
||||
# Special rule for the target install/local
|
||||
install/local/fast: install/local
|
||||
|
||||
# Special rule for the target install/strip
|
||||
install/strip: preinstall
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
|
||||
cd /home/robert/OpenSceneGraph/examples/osgviewerFOX && /usr/local/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
|
||||
|
||||
# Special rule for the target install/strip
|
||||
install/strip/fast: install/strip
|
||||
|
||||
# Special rule for the target list_install_components
|
||||
list_install_components:
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Only default component available"
|
||||
|
||||
# Special rule for the target list_install_components
|
||||
list_install_components/fast: list_install_components
|
||||
|
||||
# Special rule for the target rebuild_cache
|
||||
rebuild_cache:
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
|
||||
cd /home/robert/OpenSceneGraph/examples/osgviewerFOX && /usr/local/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
|
||||
|
||||
# Special rule for the target rebuild_cache
|
||||
rebuild_cache/fast: rebuild_cache
|
||||
|
||||
# The main all target
|
||||
all: cmake_check_build_system
|
||||
cd /home/robert/OpenSceneGraph && $(CMAKE_COMMAND) -E cmake_progress_start /home/robert/OpenSceneGraph/CMakeFiles $(CMAKE_ALL_PROGRESS)
|
||||
cd /home/robert/OpenSceneGraph && $(MAKE) -f CMakeFiles/Makefile2 examples/osgviewerFOX/all
|
||||
$(CMAKE_COMMAND) -E cmake_progress_start /home/robert/OpenSceneGraph/CMakeFiles 0
|
||||
|
||||
# The main clean target
|
||||
clean:
|
||||
cd /home/robert/OpenSceneGraph && $(MAKE) -f CMakeFiles/Makefile2 examples/osgviewerFOX/clean
|
||||
|
||||
# The main clean target
|
||||
clean/fast: clean
|
||||
|
||||
# Prepare targets for installation.
|
||||
preinstall: all
|
||||
cd /home/robert/OpenSceneGraph && $(MAKE) -f CMakeFiles/Makefile2 examples/osgviewerFOX/preinstall
|
||||
|
||||
# Prepare targets for installation.
|
||||
preinstall/fast:
|
||||
cd /home/robert/OpenSceneGraph && $(MAKE) -f CMakeFiles/Makefile2 examples/osgviewerFOX/preinstall
|
||||
|
||||
# clear depends
|
||||
depend:
|
||||
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
|
||||
|
||||
# Convenience name for target.
|
||||
examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/rule:
|
||||
cd /home/robert/OpenSceneGraph && $(MAKE) -f CMakeFiles/Makefile2 examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/rule
|
||||
|
||||
# Convenience name for target.
|
||||
example_osgviewerFOX: examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/rule
|
||||
|
||||
# fast build rule for target.
|
||||
example_osgviewerFOX/fast:
|
||||
cd /home/robert/OpenSceneGraph && $(MAKE) -f examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/build.make examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/build
|
||||
|
||||
# target to build an object file
|
||||
FOX_OSG.o:
|
||||
cd /home/robert/OpenSceneGraph && $(MAKE) -f examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/build.make examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/FOX_OSG.o
|
||||
|
||||
# target to preprocess a source file
|
||||
FOX_OSG.i:
|
||||
cd /home/robert/OpenSceneGraph && $(MAKE) -f examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/build.make examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/FOX_OSG.i
|
||||
|
||||
# target to generate assembly for a file
|
||||
FOX_OSG.s:
|
||||
cd /home/robert/OpenSceneGraph && $(MAKE) -f examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/build.make examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/FOX_OSG.s
|
||||
|
||||
# target to build an object file
|
||||
FOX_OSG_MDIView.o:
|
||||
cd /home/robert/OpenSceneGraph && $(MAKE) -f examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/build.make examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/FOX_OSG_MDIView.o
|
||||
|
||||
# target to preprocess a source file
|
||||
FOX_OSG_MDIView.i:
|
||||
cd /home/robert/OpenSceneGraph && $(MAKE) -f examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/build.make examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/FOX_OSG_MDIView.i
|
||||
|
||||
# target to generate assembly for a file
|
||||
FOX_OSG_MDIView.s:
|
||||
cd /home/robert/OpenSceneGraph && $(MAKE) -f examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/build.make examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/FOX_OSG_MDIView.s
|
||||
|
||||
# target to build an object file
|
||||
osgviewerFOX.o:
|
||||
cd /home/robert/OpenSceneGraph && $(MAKE) -f examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/build.make examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/osgviewerFOX.o
|
||||
|
||||
# target to preprocess a source file
|
||||
osgviewerFOX.i:
|
||||
cd /home/robert/OpenSceneGraph && $(MAKE) -f examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/build.make examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/osgviewerFOX.i
|
||||
|
||||
# target to generate assembly for a file
|
||||
osgviewerFOX.s:
|
||||
cd /home/robert/OpenSceneGraph && $(MAKE) -f examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/build.make examples/osgviewerFOX/CMakeFiles/example_osgviewerFOX.dir/osgviewerFOX.s
|
||||
|
||||
# Help Target
|
||||
help::
|
||||
@echo "The following are some of the valid targets for this Makefile:"
|
||||
@echo "... all (the default if no target is provided)"
|
||||
@echo "... clean"
|
||||
@echo "... depend"
|
||||
@echo "... edit_cache"
|
||||
@echo "... example_osgviewerFOX"
|
||||
@echo "... install"
|
||||
@echo "... install/local"
|
||||
@echo "... install/strip"
|
||||
@echo "... list_install_components"
|
||||
@echo "... rebuild_cache"
|
||||
@echo "... FOX_OSG.o"
|
||||
@echo "... FOX_OSG.i"
|
||||
@echo "... FOX_OSG.s"
|
||||
@echo "... FOX_OSG_MDIView.o"
|
||||
@echo "... FOX_OSG_MDIView.i"
|
||||
@echo "... FOX_OSG_MDIView.s"
|
||||
@echo "... osgviewerFOX.o"
|
||||
@echo "... osgviewerFOX.i"
|
||||
@echo "... osgviewerFOX.s"
|
||||
|
||||
|
||||
|
||||
#=============================================================================
|
||||
# Special targets to cleanup operation of make.
|
||||
|
||||
# Special rule to run CMake to check the build system integrity.
|
||||
# No rule that depends on this can have commands that come from listfiles
|
||||
# because they might be regenerated.
|
||||
cmake_check_build_system:
|
||||
cd /home/robert/OpenSceneGraph && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
|
||||
|
75
examples/osgviewerFOX/osgviewerFOX.cpp
Normal file
75
examples/osgviewerFOX/osgviewerFOX.cpp
Normal file
@ -0,0 +1,75 @@
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "osgviewerFOX.h"
|
||||
|
||||
#include "FOX_OSG_MDIView.h"
|
||||
|
||||
/* My frame constructor */
|
||||
MainFrame::MainFrame(FXApp *app, const FXString &name, FXIcon *ic, FXIcon *mi, FXuint opts, FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb, FXint hs, FXint vs) : FXMainWindow(app, name, ic, mi, opts, x, y, w, h, pl, pr, pt, pb, hs, vs)
|
||||
{
|
||||
|
||||
|
||||
// Site where to dock
|
||||
FXDockSite* topdock=new FXDockSite(this,DOCKSITE_NO_WRAP|LAYOUT_SIDE_TOP|LAYOUT_FILL_X);
|
||||
|
||||
// Menubar 1
|
||||
m_fxToolbarShell1=new FXToolBarShell(this,FRAME_RAISED);
|
||||
FXMenuBar* menubar=new FXMenuBar(topdock,m_fxToolbarShell1,LAYOUT_DOCK_SAME|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|FRAME_RAISED);
|
||||
new FXToolBarGrip(menubar,menubar,FXMenuBar::ID_TOOLBARGRIP,TOOLBARGRIP_DOUBLE);
|
||||
|
||||
// Contents
|
||||
FXHorizontalFrame *frame=new FXHorizontalFrame(this,LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,0,0, 0,0,0,0, 4,4);
|
||||
|
||||
// Nice sunken box around GL viewer
|
||||
FXVerticalFrame *box=new FXVerticalFrame(frame,FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,0,0, 0,0,0,0);
|
||||
|
||||
// MDI Client
|
||||
FXMDIClient* mdiclient=new FXMDIClient(box,LAYOUT_FILL_X|LAYOUT_FILL_Y);
|
||||
|
||||
// Make MDI Window Menu
|
||||
FXMDIMenu* mdimenu=new FXMDIMenu(this,mdiclient);
|
||||
|
||||
// MDI buttons in menu:- note the message ID's!!!!!
|
||||
// Normally, MDI commands are simply sensitized or desensitized;
|
||||
// Under the menubar, however, they're hidden if the MDI Client is
|
||||
// not maximized. To do this, they must have different ID's.
|
||||
new FXMDIWindowButton(menubar,mdimenu,mdiclient,FXMDIClient::ID_MDI_MENUWINDOW,LAYOUT_LEFT|LAYOUT_CENTER_Y);
|
||||
new FXMDIDeleteButton(menubar,mdiclient,FXMDIClient::ID_MDI_MENUCLOSE,FRAME_RAISED|LAYOUT_RIGHT|LAYOUT_CENTER_Y);
|
||||
new FXMDIRestoreButton(menubar,mdiclient,FXMDIClient::ID_MDI_MENURESTORE,FRAME_RAISED|LAYOUT_RIGHT|LAYOUT_CENTER_Y);
|
||||
new FXMDIMinimizeButton(menubar,mdiclient,FXMDIClient::ID_MDI_MENUMINIMIZE,FRAME_RAISED|LAYOUT_RIGHT|LAYOUT_CENTER_Y);
|
||||
|
||||
// Make an MDI Child
|
||||
FOX_OSG_MDIView* mdichild=new FOX_OSG_MDIView(mdiclient,"FOX osgViewer", NULL, mdimenu,MDI_TRACKING|MDI_MAXIMIZED,30,30,300,200);
|
||||
mdichild->setFocus();
|
||||
|
||||
// Make it active
|
||||
mdiclient->setActiveChild(mdichild);
|
||||
|
||||
}
|
||||
|
||||
// Create and initialize
|
||||
void MainFrame::create(){
|
||||
FXMainWindow::create();
|
||||
m_fxToolbarShell1->create();
|
||||
show(PLACEMENT_SCREEN);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv){
|
||||
|
||||
// Make application
|
||||
FXApp application("OSGViewer","FoxTest");
|
||||
|
||||
// Open the display
|
||||
application.init(argc,argv);
|
||||
|
||||
// Make window
|
||||
new MainFrame(&application, "Fox Toolkit OSG Sample", NULL, NULL, DECOR_ALL, 100, 100, 800, 600);
|
||||
|
||||
// Create the application's windows
|
||||
application.create();
|
||||
|
||||
// Run the application
|
||||
return application.run();
|
||||
}
|
32
examples/osgviewerFOX/osgviewerFOX.h
Normal file
32
examples/osgviewerFOX/osgviewerFOX.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef _FOXSIMPLEVIEWERFOX_H_
|
||||
#define _FOXSIMPLEVIEWERFOX_H_
|
||||
|
||||
|
||||
#include <fx.h>
|
||||
|
||||
using namespace FX;
|
||||
|
||||
class MainFrame : public FXMainWindow{
|
||||
|
||||
public:
|
||||
MainFrame(FXApp *a, const FXString &name,
|
||||
FXIcon *ic=NULL, FXIcon *mi=NULL,
|
||||
FXuint opts=DECOR_ALL,
|
||||
FXint x=0, FXint y=0,
|
||||
FXint w=0, FXint h=0,
|
||||
FXint pl=0, FXint pr=0, FXint pt=0, FXint pb=0,
|
||||
FXint hs=0, FXint vs=0);
|
||||
|
||||
|
||||
// Initialize
|
||||
virtual void create();
|
||||
|
||||
protected:
|
||||
MainFrame(){};
|
||||
|
||||
private:
|
||||
// GUI elements
|
||||
FXToolBarShell* m_fxToolbarShell1;
|
||||
};
|
||||
|
||||
#endif // _FOXSIMPLEVIEWERFOX_H_
|
@ -97,8 +97,7 @@ class OSGTERRAIN_EXPORT CartesianLocator : public osgTerrain::Locator
|
||||
{
|
||||
public:
|
||||
|
||||
CartesianLocator(double originX, double originY, double lengthX, double lengthY, double height = 0.0f, double heightScale =
|
||||
1.0f);
|
||||
CartesianLocator(double originX, double originY, double lengthX, double lengthY, double height = 0.0f, double heightScale = 1.0f);
|
||||
|
||||
void setExtents(double originX, double originY, double lengthX, double lengthY, double height = 0.0f, double heightScale = 1.0f);
|
||||
|
||||
|
@ -134,7 +134,7 @@ bool EllipsoidLocator::convertModelToLocal(const osg::Vec3d& world, osg::Vec3d&
|
||||
|
||||
CartesianLocator::CartesianLocator(double originX, double originY, double lengthX, double lengthY, double height, double heightScale)
|
||||
{
|
||||
setExtents(originX, originY, lengthY, lengthY, height, heightScale);
|
||||
setExtents(originX, originY, lengthX, lengthY, height, heightScale);
|
||||
}
|
||||
|
||||
void CartesianLocator::setExtents(double originX, double originY, double lengthX, double lengthY, double height, double heightScale)
|
||||
|
Loading…
Reference in New Issue
Block a user