Text archives Help
- From: abe@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r700 - in branches/itanium2: Core/Shm Engine/Display fox
- Date: Sat, 5 Nov 2005 17:11:57 -0700 (MST)
Author: abe
Date: Sat Nov 5 17:11:55 2005
New Revision: 700
Modified:
branches/itanium2/Core/Shm/MFStreamData.cc
branches/itanium2/Core/Shm/MFStreamData.h
branches/itanium2/Engine/Display/GLXImageDisplay.cc
branches/itanium2/Engine/Display/GLXImageDisplay.h
branches/itanium2/Engine/Display/OpenGLDisplay.cc
branches/itanium2/fox/FMantaImageFrame.cc
branches/itanium2/fox/FMantaImageFrame.h
branches/itanium2/fox/FMantaWindow.cc
branches/itanium2/fox/FMantaWindow.h
branches/itanium2/fox/MediaFusionBridge.cc
branches/itanium2/fox/MediaFusionBridge.h
branches/itanium2/fox/dm_demo.cc
branches/itanium2/fox/sc_demo.cc
Log:
This commit should work with mf-packaged 11/4 distribution. It removes the
dependency on GLX from the fox gui.
This allows the gui to be run on an Xvnc server.
M Core/Shm/MFStreamData.cc
M Core/Shm/MFStreamData.h
M fox/FMantaWindow.cc
M fox/FMantaWindow.h
M fox/MediaFusionBridge.cc
M fox/MediaFusionBridge.h
M fox/FMantaImageFrame.cc
M fox/FMantaImageFrame.h
Fixed FMantaImageDisplay so that it will run on a X server that doesn't
support glx.
M fox/dm_demo.cc
M fox/sc_demo.cc
Added the ability to not specify a glx visual.
M Engine/Display/GLXImageDisplay.cc
M Engine/Display/GLXImageDisplay.h
M Engine/Display/OpenGLDisplay.cc
Modified: branches/itanium2/Core/Shm/MFStreamData.cc
==============================================================================
--- branches/itanium2/Core/Shm/MFStreamData.cc (original)
+++ branches/itanium2/Core/Shm/MFStreamData.cc Sat Nov 5 17:11:55 2005
@@ -234,6 +234,7 @@
int size = numSSCMD;
for (i=0; i<size; ++i) {
packet.index[i] = ssINDEX[i];
+ packet.pid[i] = ssPID[i];
packet.command[i] = ssCMD[i];
packet.data [i] = ssDATA[i];
}
Modified: branches/itanium2/Core/Shm/MFStreamData.h
==============================================================================
--- branches/itanium2/Core/Shm/MFStreamData.h (original)
+++ branches/itanium2/Core/Shm/MFStreamData.h Sat Nov 5 17:11:55 2005
@@ -51,7 +51,7 @@
TEXTURE_Y_RES = 2048,
TEXTURE_Z_RES = 4,
MAX_NUM_UPDATES = 1024,
- MAX_NUM_SSCMD = 16, // Specific stream commands.
+ MAX_NUM_SSCMD = 64, // Specific stream commands.
RECT_X_ORIG = 0,
RECT_Y_ORIG = 1,
@@ -98,6 +98,7 @@
// Input commands from media fusion.
int ssINDEX[MAX_NUM_SSCMD];
+ int ssPID [MAX_NUM_SSCMD];
int ssCMD [MAX_NUM_SSCMD];
int ssDATA [MAX_NUM_SSCMD];
int numSSCMD;
@@ -130,7 +131,8 @@
MODRELEASE = 107
};
- int index [MAX_NUM_SSCMD];
+ int index [MAX_NUM_SSCMD]; // Unique serial index per command.
+ int pid [MAX_NUM_SSCMD]; // id of the gfx engine connection.
int command[MAX_NUM_SSCMD];
int data [MAX_NUM_SSCMD];
int size;
Modified: branches/itanium2/Engine/Display/GLXImageDisplay.cc
==============================================================================
--- branches/itanium2/Engine/Display/GLXImageDisplay.cc (original)
+++ branches/itanium2/Engine/Display/GLXImageDisplay.cc Sat Nov 5 17:11:55
2005
@@ -2,16 +2,20 @@
#include <GL/glu.h>
#include <X11/Xutil.h>
-
+#include <SCIRun/Core/Exceptions/Exception.h>
+#include <Core/Exceptions/InternalError.h>
#include <Engine/Display/GLXImageDisplay.h>
#include <Image/SimpleImage.h>
#include <Image/Pixel.h>
#include <Interface/Image.h>
#include <Interface/Context.h>
-#include <iostream>
+#include <iostream>
+#include <vector>
using namespace Manta;
+using namespace SCIRun;
+using std::vector;
// Note that the GLXImage display must be passed a GLX context by the
// application it is embedded inside of.
@@ -24,6 +28,15 @@
}
+GLXImageDisplay::GLXImageDisplay( bool use_stereo_, GLXDrawable
glx_drawable_ )
+ :
+ use_stereo( use_stereo_ ),
+ x_visual_info( 0 ),
+ glx_drawable( glx_drawable_ ),
+ x_display( 0 )
+{
+}
+
GLXImageDisplay::~GLXImageDisplay() {
// Close the X display.
@@ -60,8 +73,34 @@
// Get the default screen for the display.
int x_screen = DefaultScreen( x_display );
-
- // (Like we have a prayer this will work...)
+
+ // Check to see if a visual info was specified.
+ if (x_visual_info == 0) {
+
+ // Form attributes for the visual
+ vector<int> attributes;
+ attributes.push_back(GLX_RGBA);
+ attributes.push_back(GLX_RED_SIZE); attributes.push_back(1);
+ attributes.push_back(GLX_GREEN_SIZE); attributes.push_back(1);
+ attributes.push_back(GLX_BLUE_SIZE); attributes.push_back(1);
+ attributes.push_back(GLX_ALPHA_SIZE); attributes.push_back(0);
+ attributes.push_back(GLX_DEPTH_SIZE); attributes.push_back(0);
+
+ // Require stereo.
+ if (use_stereo) {
+ attributes.push_back(GLX_STEREO);
+ }
+
+ attributes.push_back(GLX_DOUBLEBUFFER); // This must be the last one
+ attributes.push_back(None);
+
+ // Choose the visual
+ if ((x_visual_info = glXChooseVisual(x_display, x_screen,
&attributes[0])) == 0) {
+ throw InternalError( "Could not find glx visual.", __FILE__, __LINE__
);
+ }
+ }
+
+ // Create the glx context.
glx_context = glXCreateContext( x_display, x_visual_info, 0, true );
// Call make current to associate with this thread
Modified: branches/itanium2/Engine/Display/GLXImageDisplay.h
==============================================================================
--- branches/itanium2/Engine/Display/GLXImageDisplay.h (original)
+++ branches/itanium2/Engine/Display/GLXImageDisplay.h Sat Nov 5 17:11:55
2005
@@ -20,14 +20,21 @@
GLXDrawable glx_drawable; // Or window id.
Display *x_display;
XVisualInfo *x_visual_info;
-
+
+ bool use_stereo; // Setup parameter used when creating the visual
int manta_channel; // The last channel number to call
setupDisplayChannel.
-
+
+ static createVisual( bool stereo_ );
+
public:
// Note that the GLXImage display must be passed a GLX
context by the
// application it is embedded inside of.
GLXImageDisplay( XVisualInfo *x_visual_info_,
GLXDrawable glx_drawable_ );
+
+ // Create a visual to use automatically.
+ GLXImageDisplay( bool stereo_, GLXDrawable glx_drawable_ );
+
~GLXImageDisplay();
// Manta ImageDisplay interface.
Modified: branches/itanium2/Engine/Display/OpenGLDisplay.cc
==============================================================================
--- branches/itanium2/Engine/Display/OpenGLDisplay.cc (original)
+++ branches/itanium2/Engine/Display/OpenGLDisplay.cc Sat Nov 5 17:11:55
2005
@@ -101,7 +101,7 @@
}
int screen=DefaultScreen(dpy);
- // Form the criteria for the
+ // Form the criteria for the visual
vector<int> attribList;
attribList.push_back(GLX_RGBA);
attribList.push_back(GLX_RED_SIZE); attribList.push_back(1);
Modified: branches/itanium2/fox/FMantaImageFrame.cc
==============================================================================
--- branches/itanium2/fox/FMantaImageFrame.cc (original)
+++ branches/itanium2/fox/FMantaImageFrame.cc Sat Nov 5 17:11:55 2005
@@ -39,11 +39,11 @@
FXMAPFUNC(SEL_KEYPRESS, MediaFusionApp::ID_MEDIA_FUSION_APP,
FMantaImageFrame::onKeyPress ),
};
-FXIMPLEMENT(FMantaImageFrame,FXGLCanvas,FMantaImageFrameMap,ARRAYNUMBER(FMantaImageFrameMap));
+FXIMPLEMENT(FMantaImageFrame,FXCanvas,FMantaImageFrameMap,ARRAYNUMBER(FMantaImageFrameMap));
// Constructor, creates a GLX Visual with a double buffer.
FMantaImageFrame::FMantaImageFrame( FXComposite *p, FXApp *app, FXObject
*target_, int width, int height, RTRTInterface *manta_interface_ )
- : FXGLCanvas( p, new FXGLVisual( app, VISUAL_DOUBLEBUFFER |
VISUAL_STEREO ), this, ID_IMAGE,
+ : FXCanvas( p, /*new FXGLVisual( app, VISUAL_DOUBLEBUFFER | VISUAL_STEREO
),*/ this, ID_IMAGE,
LAYOUT_FILL|LAYOUT_TOP, 0, 0, width, height ),
fox_target( target_ ),
manta_interface( manta_interface_ )
Modified: branches/itanium2/fox/FMantaImageFrame.h
==============================================================================
--- branches/itanium2/fox/FMantaImageFrame.h (original)
+++ branches/itanium2/fox/FMantaImageFrame.h Sat Nov 5 17:11:55 2005
@@ -16,7 +16,7 @@
// This class contains the GLX context and window that will be used
by a manta
// channel to render into.
- class FMantaImageFrame : public FXGLCanvas {
+ class FMantaImageFrame : public FXCanvas {
FXDECLARE(FMantaImageFrame)
private:
// Fox components.
@@ -34,7 +34,7 @@
public:
// Message types.
enum {
- ID_IMAGE = FXGLCanvas::ID_LAST, // Messages from the
gl canvas.
+ ID_IMAGE = FXCanvas::ID_LAST, // Messages from the gl
canvas.
ID_PIXEL_SELECT, // Sent to fox_target when the user
double clicks, FXEvent * is passed along.
Modified: branches/itanium2/fox/FMantaWindow.cc
==============================================================================
--- branches/itanium2/fox/FMantaWindow.cc (original)
+++ branches/itanium2/fox/FMantaWindow.cc Sat Nov 5 17:11:55 2005
@@ -80,6 +80,7 @@
FXIMPLEMENT(FMantaWindow,FXMainWindow,FMantaWindowMap,ARRAYNUMBER(FMantaWindowMap));
FMantaWindow::FMantaWindow( FXApp *app, const FXString &name,
+ bool use_glx,
int width, int height,
int xres, int yres,
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 )
@@ -637,7 +638,7 @@
dstLookAt = lookat[3];
dstUp = up[3];
- Real delta_t = 1.0/dist, delta_time = 0.03;
+ Real delta_t = 1.0/dist, delta_time = delta_t*5.0;
automator = new CameraPathAutomator(
manta_interface, 0, 0,
Modified: branches/itanium2/fox/FMantaWindow.h
==============================================================================
--- branches/itanium2/fox/FMantaWindow.h (original)
+++ branches/itanium2/fox/FMantaWindow.h Sat Nov 5 17:11:55 2005
@@ -123,7 +123,9 @@
// Constructors.
FMantaWindow() : manta_interface( 0 ), fast_quit( false ) {
};
FMantaWindow( FXApp *app, const FXString &name,
-
+
+ bool use_glx = true,
+
int width = 512, int height = 512, // Dimensions of the gui
int xres = 512, int yres = 512, // Dimensions of the
image.
Modified: branches/itanium2/fox/MediaFusionBridge.cc
==============================================================================
--- branches/itanium2/fox/MediaFusionBridge.cc (original)
+++ branches/itanium2/fox/MediaFusionBridge.cc Sat Nov 5 17:11:55 2005
@@ -38,10 +38,12 @@
using namespace fox_manta;
MediaFusionBridge::MediaFusionBridge( Window window_id_, Window root_id_,
Display *target_display_,
- int shm_key_, double polling_interval_
) :
+ int shm_key_,
+ double timeout_seconds_,
+ double polling_interval_ ) :
this_thread( 0 ),
window_id( window_id_ ),
- root_id( root_id_ ),
+ root_id( 0 ),
target_display( target_display_ ),
display( 0 ),
shm_key( shm_key_ ),
@@ -51,7 +53,12 @@
// Initialize mouse state to zero.
mouse_button( 0 ),
mouse_state( 0 ),
- modifier_state( 0 )
+ modifier_state( 0 ),
+
+ // Mouse ownership
+ owner_pid( 0 ),
+ owner_timestamp( 0 ),
+ timeout_seconds( timeout_seconds_ )
{
}
@@ -71,6 +78,8 @@
<< shm_key
<< "..." << std::endl;
+ // std::cerr << "Ownership timeout: " << timeout_seconds << std::endl;
+
try {
stream_data = new( shm_key, false ) MFStreamData;
}
@@ -99,14 +108,9 @@
// Begin polling the shm segment.
for (;;) {
- // std::cerr << "Before read commands" << std::endl;
-
// Read commands from the stream.
stream_data->read_commands( packet );
- // std::cerr << "After read commands" << std::endl;
-
-
// Find the next command that we have not processed in the packet.
int i = 0;
// while ((packet.index[i] <= last_index) && (i < packet.size)) {
@@ -130,153 +134,190 @@
#endif
last_index = packet.index[i];
- // std::cerr << "Received command from media fusion" << std::endl;
-
- // Dispatch the command.
- switch (packet.command[i]) {
-
- case MFSPacket::MODRELEASE:
+ // Check to see if the command stream is owned by a certain process.
+ double time = SCIRun::Time::currentSeconds();
+ bool timed_out = (time - owner_timestamp) > timeout_seconds;
+ // timed_out = false;
+
+ if ((!owner_pid) || (packet.pid[i] == owner_pid) || timed_out) {
+
+ // std::cerr << "Received command from media fusion from "
+ // << packet.pid[i] << std::endl;
+
+ // Check for a timeout.
+ if ((packet.pid[i] != owner_pid) && timed_out) {
+ std::cerr << "Owner " << owner_pid << " timed out." << std::endl;
+ owner_pid = 0;
+ }
- // Send a key press event.
- key_event( KeyRelease, packet.data[i] );
- break;
+ // Update the owner time stamp.
+ owner_timestamp = time;
+
+ // Dispatch the command.
+ switch (packet.command[i]) {
+
+ case MFSPacket::MODRELEASE:
+
+ // Send a key press event.
+ key_event( KeyRelease, packet.data[i] );
+ break;
- case MFSPacket::MODPRESS:
- case MFSPacket::KEYPRESS:
+ case MFSPacket::MODPRESS:
+ case MFSPacket::KEYPRESS:
- // Send a key press event.
- key_event( KeyPress, packet.data[i] );
+ // Send a key press event.
+ key_event( KeyPress, packet.data[i] );
- break;
- case MFSPacket::DEVPRESS:
- // std::cerr << "DEVPRESS: " << packet.data[i] << std::endl;
+ break;
+ case MFSPacket::DEVPRESS:
+ // std::cerr << "DEVPRESS: " << packet.data[i] << std::endl;
- // Function keys etc.
+ // Function keys etc.
- break;
- case MFSPacket::MOUSE_X:
- // std::cerr << "MOUSE_X: " << packet.data[i] << std::endl;
+ break;
+ case MFSPacket::MOUSE_X:
+ // std::cerr << "MOUSE_X: " << packet.data[i] << std::endl;
+
+ // Update mouse coordinate.
+ mouse_x = packet.data[i];
+
+ // Send a mouse motion event.
+ motion_event();
+
+ break;
+ case MFSPacket::MOUSE_Y:
+ // std::cerr << "MOUSE_Y: " << packet.data[i] << std::endl;
- // Update mouse coordinate.
- mouse_x = packet.data[i];
-
- // Send a mouse motion event.
- motion_event();
-
- break;
- case MFSPacket::MOUSE_Y:
- // std::cerr << "MOUSE_Y: " << packet.data[i] << std::endl;
-
- // Update mouse coordinate.
- mouse_y = (stream_data->yres - packet.data[i]);
+ // Update mouse coordinate.
+ mouse_y = (stream_data->yres - packet.data[i]);
- // Send a mouse motion event.
- motion_event();
+ // Send a mouse motion event.
+ motion_event();
- break;
- case MFSPacket::MOUSE_BTN:
- // std::cerr << "MOUSE_BTN: " << packet.data[i] << std::endl;
+ break;
+ case MFSPacket::MOUSE_BTN:
+ // std::cerr << "MOUSE_BTN: " << packet.data[i] << std::endl;
- mf_button = packet.data[i];
+ mf_button = packet.data[i];
#if 0
- // Avoid out of range commands.
- if ((mf_button != 0) && !(
- (mf_button & MFSPacket::MOUSE_STATE_LEFT) ||
- (mf_button & MFSPacket::MOUSE_STATE_LEFT) ||
- (mf_button & MFSPacket::MOUSE_STATE_LEFT)))
- break;
+ // Avoid out of range commands.
+ if ((mf_button != 0) && !(
+ (mf_button & MFSPacket::MOUSE_STATE_LEFT)
||
+ (mf_button & MFSPacket::MOUSE_STATE_LEFT)
||
+ (mf_button &
MFSPacket::MOUSE_STATE_LEFT)))
+ break;
#endif
-
///////////////////////////////////////////////////////////////////////
- // Update the button state.
- prev = mouse_state;
- event_type = ButtonRelease;
-
- // Determine the new state.
- if (mf_button == MFSPacket::MOUSE_STATE_NONE) {
- mouse_state &= (~Button1Mask);
- mouse_state &= (~Button2Mask);
- mouse_state &= (~Button3Mask);
- }
- else {
-
- // Check for each button indivdually.
- if (mf_button & MFSPacket::MOUSE_STATE_LEFT)
- mouse_state |= (Button1Mask);
- if (mf_button & MFSPacket::MOUSE_STATE_MIDDLE)
- mouse_state |= (Button2Mask);
- if (mf_button & MFSPacket::MOUSE_STATE_RIGHT)
- mouse_state |= (Button3Mask);
- }
-
-
///////////////////////////////////////////////////////////////////////
- // Determine which buttons changed the state, send a button event for
- // each button whose state change.
-
- // If media fusion has set left button and previously button1 was
pressed
- // (or the other way around)
- if (bool(mf_button & MFSPacket::MOUSE_STATE_LEFT) != bool(prev &
Button1Mask)) {
- mouse_button = Button1;
-
- if (mf_button & MFSPacket::MOUSE_STATE_LEFT)
- event_type = ButtonPress;
-
- // std::cerr << "Button1 changed " << event_type << std::endl;
-
- button_event( event_type );
- }
-
- if (bool(mf_button & MFSPacket::MOUSE_STATE_MIDDLE) != bool(prev &
Button2Mask)) {
- mouse_button = Button2;
-
- if (mf_button & MFSPacket::MOUSE_STATE_MIDDLE)
- event_type = ButtonPress;
-
- // std::cerr << "Button2 changed " << event_type << std::endl;
-
- button_event( event_type );
- }
-
- if (bool(mf_button & MFSPacket::MOUSE_STATE_RIGHT) != bool(prev &
Button3Mask)) {
- mouse_button = Button3;
-
- if (mf_button & MFSPacket::MOUSE_STATE_RIGHT)
- event_type = ButtonPress;
-
- // std::cerr << "Button3 changed " << event_type << std::endl;
-
- button_event( event_type );
- }
-
- // Otherwise nothing changed.
-
- // Send mouse update event.
-
- // button_press_event();
- // printf( "After mouse_state: 0x%x\nCurrent mouse_button: 0x%x\n",
mouse_state, mouse_button );
- break;
- case MFSPacket::MOUSE_MOD:
- // std::cerr << "MOUSE_MOD: " << packet.data[i] << std::endl;
+
///////////////////////////////////////////////////////////////////////
+ // Update the button state.
+ prev = mouse_state;
+ event_type = ButtonRelease;
+
+ // Determine the new state.
+ if (mf_button == MFSPacket::MOUSE_STATE_NONE) {
+ mouse_state &= (~Button1Mask);
+ mouse_state &= (~Button2Mask);
+ mouse_state &= (~Button3Mask);
+ }
+ else {
+
+ // Check for each button indivdually.
+ if (mf_button & MFSPacket::MOUSE_STATE_LEFT)
+ mouse_state |= (Button1Mask);
+ if (mf_button & MFSPacket::MOUSE_STATE_MIDDLE)
+ mouse_state |= (Button2Mask);
+ if (mf_button & MFSPacket::MOUSE_STATE_RIGHT)
+ mouse_state |= (Button3Mask);
+ }
+
+
///////////////////////////////////////////////////////////////////////
+ // Determine which buttons changed the state, send a button event
for
+ // each button whose state change.
+
+ // If media fusion has set left button and previously button1 was
pressed
+ // (or the other way around)
+ if (bool(mf_button & MFSPacket::MOUSE_STATE_LEFT) != bool(prev &
Button1Mask)) {
+ mouse_button = Button1;
+
+ if (mf_button & MFSPacket::MOUSE_STATE_LEFT)
+ event_type = ButtonPress;
+
+ // std::cerr << "Button1 changed " << event_type << std::endl;
+
+ button_event( event_type );
+ }
+
+ if (bool(mf_button & MFSPacket::MOUSE_STATE_MIDDLE) != bool(prev &
Button2Mask)) {
+ mouse_button = Button2;
+
+ if (mf_button & MFSPacket::MOUSE_STATE_MIDDLE)
+ event_type = ButtonPress;
+
+ // std::cerr << "Button2 changed " << event_type << std::endl;
+
+ button_event( event_type );
+ }
+
+ if (bool(mf_button & MFSPacket::MOUSE_STATE_RIGHT) != bool(prev &
Button3Mask)) {
+ mouse_button = Button3;
+
+ if (mf_button & MFSPacket::MOUSE_STATE_RIGHT)
+ event_type = ButtonPress;
+
+ // std::cerr << "Button3 changed " << event_type << std::endl;
+
+ button_event( event_type );
+ }
+
+ // Otherwise nothing changed.
+
+ // Send mouse update event.
+
+ // button_press_event();
+ // printf( "After mouse_state: 0x%x\nCurrent mouse_button: 0x%x\n",
mouse_state, mouse_button );
+
+
+ // Set the owner if the button is pressed.
+ if (event_type == ButtonPress) {
+ owner_pid = packet.pid[i];
+ std::cerr << "*** Owner " << owner_pid << " set." << std::endl;
+ }
+
+ // Otherwise clear the owner.
+ else {
+ std::cerr << "*** Owner " << owner_pid << " cleared." <<
std::endl;
+ owner_pid = 0;
+ }
+
+ break;
+ case MFSPacket::MOUSE_MOD:
+ // std::cerr << "MOUSE_MOD: " << packet.data[i] << std::endl;
#if 0
- state = packet.data[i];
- modifier_state = 0x0;
-
- // There is probably a simpler way to mask out just the bits I need
but
- // I don't know all the possible values for packet.data[i]
- if ((state & MFSPacket::Shift_L) || (state & MFSPacket::Shift_R))
- modifier_state |= ShiftMask;
-
- if ((state & MFSPacket::Ctrl_L) || (state & MFSPacket::Ctrl_R))
- modifier_state |= ControlMask;
-
- if ((state & MFSPacket::Alt_L) || (state & MFSPacket::Alt_R))
- modifier_state |= ShiftMask;
+ state = packet.data[i];
+ modifier_state = 0x0;
+
+ // There is probably a simpler way to mask out just the bits I need
but
+ // I don't know all the possible values for packet.data[i]
+ if ((state & MFSPacket::Shift_L) || (state & MFSPacket::Shift_R))
+ modifier_state |= ShiftMask;
+
+ if ((state & MFSPacket::Ctrl_L) || (state & MFSPacket::Ctrl_R))
+ modifier_state |= ControlMask;
+
+ if ((state & MFSPacket::Alt_L) || (state & MFSPacket::Alt_R))
+ modifier_state |= ShiftMask;
#endif
- break;
-
- default:
- std::cerr << "Unknown MFSPacket command: " << packet.command[i] <<
std::endl;
+ break;
+
+ default:
+ std::cerr << "Unknown MFSPacket command: " << packet.command[i] <<
std::endl;
+ }
+
+ }
+ else {
+ std::cerr << "Skipped command from " << packet.pid[i] << " current
owner is "
+ << owner_pid << std::endl;
}
}
Modified: branches/itanium2/fox/MediaFusionBridge.h
==============================================================================
--- branches/itanium2/fox/MediaFusionBridge.h (original)
+++ branches/itanium2/fox/MediaFusionBridge.h Sat Nov 5 17:11:55 2005
@@ -60,6 +60,12 @@
int mouse_x, mouse_y;
int mouse_state, mouse_button;
int modifier_state;
+
+ // Mouse and keyboard owner.
+ // The owner is set by a mouse down and release either by a mouse up or
after a timeout.
+ int owner_pid;
+ double owner_timestamp;
+ double timeout_seconds;
// Helper methods.
void key_event( int type, int keysym );
@@ -68,11 +74,17 @@
public:
MediaFusionBridge() :
- this_thread( 0 ), window_id( 0 ), display( 0 ), stream_data( 0 ),
polling_interval( 0.1 ) { };
+ this_thread( 0 ),
+ window_id( 0 ),
+ display( 0 ),
+ stream_data( 0 ),
+ polling_interval( 0.1 )
+ { };
MediaFusionBridge( Window window_id_,
Window root_id_,
Display *target_display_,
int shm_key,
+ double timeout_seconds = 3.0,
double polling_interval_ = 0.1 );
~MediaFusionBridge();
Modified: branches/itanium2/fox/dm_demo.cc
==============================================================================
--- branches/itanium2/fox/dm_demo.cc (original)
+++ branches/itanium2/fox/dm_demo.cc Sat Nov 5 17:11:55 2005
@@ -64,16 +64,13 @@
#include <Model/Materials/CopyColorMaterial.h>
using namespace Manta::Kdtree;
-
-
-
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// XXX to be replaced!
namespace fox_manta {
-TransparentKDTree *__global_transparent_kdtree = NULL;
-KDTree *__global_kdtree = NULL;
+ TransparentKDTree *__global_transparent_kdtree = NULL;
+ KDTree *__global_kdtree = NULL;
}
Scene* createDefaultScene();
@@ -127,165 +124,187 @@
int height = 512;
// Add an FMantaWindow.
- FMantaWindow manta_window( &app, "Open-Source MANTA. Silicon Graphics
Inc. and SCI Institute, University of Utah", width, height );
+ FMantaWindow manta_window( &app,
+ "Open-Source MANTA. Silicon Graphics Inc. and
SCI Institute, University of Utah",
+ true,
+ width, height );
// Create the application's windows.
app.create();
- // Construct Manta.
- RTRTInterface *manta_interface = createRTRT();
+ // Setup the manta pipeline.
+ RTRTInterface *manta_interface = 0;
+ GLXImageDisplay *glx_image_display = 0;
+
+ try {
+
+ // Construct Manta.
+ manta_interface = createRTRT();
- manta_interface->setScenePath (".");
- manta_interface->changeNumWorkers ( np );
- manta_interface->selectImageType ( "rgba8" );
- // manta_interface->selectImageType ( "rgbafloat" );
- manta_interface->selectLoadBalancer ( "workqueue" );
- manta_interface->selectImageTraverser ( "tiled" );
- // manta_interface->selectPixelSampler ( "jittersample(
-numberOfSamples 4 )" );
- // manta_interface->setPixelSampler ( new
Histx_Manta::SingleSamplerCounter );
- manta_interface->selectPixelSampler ( "singlesample" );
- manta_interface->selectRenderer ( "raytracer" );
- manta_interface->selectShadowAlgorithm( "hard" );
-
- // Camera *camera = new PinholeCamera( Point ( 0.0, 0.0, 0.0 ), Point
( 0.0, -1.0, 0.0 ), Vector( 0.0, 0.0, 1.0 ), 60 );
-
- // Create the manta image frame.
- FMantaImageFrame *manta_frame = manta_window.getMantaFrame();
-
- // Create a glx image display.
- GLXImageDisplay glx_image_display( (XVisualInfo
*)manta_frame->getVisual()->getInfo(),
- (Window) manta_frame->id() );
+ manta_interface->setScenePath (".");
+ manta_interface->changeNumWorkers ( np );
+ manta_interface->selectImageType ( "rgba8" );
+ // manta_interface->selectImageType ( "rgbafloat" );
+ manta_interface->selectLoadBalancer ( "workqueue" );
+ manta_interface->selectImageTraverser ( "tiled" );
+ // manta_interface->selectPixelSampler ( "jittersample(
-numberOfSamples 4 )" );
+ // manta_interface->setPixelSampler ( new
Histx_Manta::SingleSamplerCounter );
+ manta_interface->selectPixelSampler ( "singlesample" );
+ manta_interface->selectRenderer ( "raytracer" );
+ manta_interface->selectShadowAlgorithm( "hard" );
+
+ // Camera *camera = new PinholeCamera( Point ( 0.0, 0.0, 0.0 ), Point (
0.0, -1.0, 0.0 ), Vector( 0.0, 0.0, 1.0 ), 60 );
+
+ // Create the manta image frame.
+ FMantaImageFrame *manta_frame = manta_window.getMantaFrame();
+
+ // Create a glx image display.
+ glx_image_display = new GLXImageDisplay( use_stereo, (Window)
manta_frame->id() );
+
+ // std::cout << "X Window id: " << manta_frame->id() << std::endl;
+
+
///////////////////////////////////////////////////////////////////////////
+ // Try to load a scene.
+ if ((scene_text == 0) || (!manta_interface->readScene( scene_text ))) {
+ // Create a default scene.
+ manta_interface->setScene( createDefaultScene() );
+ }
- std::cout << "X Window id: " << manta_frame->id() << std::endl;
-
- // Try to load a scene.
- if ((scene_text == 0) || (!manta_interface->readScene( scene_text )))
{
- // Create a default scene.
- manta_interface->setScene( createDefaultScene() );
- }
+ Object *root_object = manta_interface->getScene()->getObject();
- Object *root_object = manta_interface->getScene()->getObject();
-
- // Check to see if the camera should be automatically positioned.
- if (default_camera == "auto") {
+
///////////////////////////////////////////////////////////////////////////
+ // Check to see if the camera should be automatically positioned.
+ if (default_camera == "auto") {
- // Find the bounds of the model.
- BBox bounds;
- PreprocessContext context;
- root_object->computeBounds( context, bounds );
-
- Point lookat = bounds[0] + (bounds[1] - bounds[0]) * 0.5;
- Point eye = lookat + Vector( 0, bounds.diagonal().length(), 0 );
- Vector up( 0, 0, 1 );
+ // Find the bounds of the model.
+ BBox bounds;
+ PreprocessContext context;
+ root_object->computeBounds( context, bounds );
- ostringstream oss;
- oss << "pinhole( -eye " << eye << " -lookat " << lookat << " -up " << up
<< " -fov 60 )";
+ Point lookat = bounds[0] + (bounds[1] - bounds[0]) * 0.5;
+ Point eye = lookat + Vector( 0, bounds.diagonal().length(), 0 );
+ Vector up( 0, 0, 1 );
- default_camera = oss.str();
+ ostringstream oss;
+ oss << "pinhole( -eye " << eye << " -lookat " << lookat << " -up " <<
up << " -fov 60 )";
- std::cerr << "Auto camera: " << default_camera << std::endl;
- }
+ default_camera = oss.str();
- // Check to see if a bookmark file was specified.
- if (bookmark_file_name.size() > 0) {
+ std::cerr << "Auto camera: " << default_camera << std::endl;
+ }
- char description[128];
- char specification[128];
- ifstream file( bookmark_file_name.c_str() );
+
///////////////////////////////////////////////////////////////////////////
+ // Check to see if a bookmark file was specified.
+ if (bookmark_file_name.size() > 0) {
+
+ char description[128];
+ char specification[128];
+ ifstream file( bookmark_file_name.c_str() );
- if (file.is_open()) {
- while (!file.eof()) {
+ if (file.is_open()) {
+ while (!file.eof()) {
- file.getline( description, 128 );
- if (string(description).size() > 0) {
+ file.getline( description, 128 );
+ if (string(description).size() > 0) {
- file.getline( specification, 128 );
- if (string(specification).size() > 0)
{
-
manta_window.addCameraBookmark( description, specification );
- }
- }
- }
+ file.getline( specification, 128 );
+ if (string(specification).size() > 0) {
+ manta_window.addCameraBookmark( description, specification );
+ }
+ }
+ }
- file.close();
- }
- else {
- std::cerr << "Could not load bookmark file." <<
std::endl;
- }
- }
+ file.close();
+ }
+ else {
+ std::cerr << "Could not load bookmark file." << std::endl;
+ }
+ }
- // Add a camera bookmark for the default camera.
- manta_window.addCameraBookmark( "Default", default_camera );
+ // Add a camera bookmark for the default camera.
+ manta_window.addCameraBookmark( "Default", default_camera );
- // Create the camera using the first camera bookmark.
- Camera *camera = manta_interface->createCamera(
manta_window.getCameraBookmark( 0 ) );
+ // Create the camera using the first camera bookmark.
+ Camera *camera = manta_interface->createCamera(
manta_window.getCameraBookmark( 0 ) );
- // Create a default quake navigator.
- FMantaQuakeNav *quake_nav = new FMantaQuakeNav( false );
- quake_nav->setMantaInterface( manta_interface );
- manta_window.addNavigatorOption( "Video Game", quake_nav );
-
- // Create a default quake navigator.
- FMantaQuakeNav *fly_nav = new FMantaQuakeNav( true );
- fly_nav->setMantaInterface( manta_interface );
- manta_window.addNavigatorOption( "Fly", fly_nav );
-
- // Create a navigator for the image frame.
- FMantaTrackballNav *trackball_nav = new FMantaTrackballNav();
- trackball_nav->setMantaInterface( manta_interface );
- trackball_nav->setMantaFrame( manta_frame );
- trackball_nav->setMantaChannel( 0 );
- manta_window.addNavigatorOption("Trackball", trackball_nav );
-
- // Use the quake nav by default.
- quake_nav->resetToCamera(
camera->getPosition(),camera->getLookAt(),camera->getUp());
- manta_window.setNavigator( quake_nav );
-
- // Create manta channel for the interface.
- int manta_channel = 0; // !!! See XWindowUI.cc line: 586
- manta_interface->createChannel( &glx_image_display, camera,
use_stereo, width, height );
-
- // Set the manta interface for the application.
- manta_window.setMantaInterface( manta_interface, manta_channel );
-
- // Check to see if we should enable the stereo dialog.
- if (use_stereo) {
- manta_window.addExtraOptionsDialog( "Stereo", new FMantaStereoDialog(
&manta_window, "Stereo" ));
- }
+ // Create a default quake navigator.
+ FMantaQuakeNav *quake_nav = new FMantaQuakeNav( false );
+ quake_nav->setMantaInterface( manta_interface );
+ manta_window.addNavigatorOption( "Video Game", quake_nav );
+
+ // Create a default quake navigator.
+ FMantaQuakeNav *fly_nav = new FMantaQuakeNav( true );
+ fly_nav->setMantaInterface( manta_interface );
+ manta_window.addNavigatorOption( "Fly", fly_nav );
+
+ // Create a navigator for the image frame.
+ FMantaTrackballNav *trackball_nav = new FMantaTrackballNav();
+ trackball_nav->setMantaInterface( manta_interface );
+ trackball_nav->setMantaFrame( manta_frame );
+ trackball_nav->setMantaChannel( 0 );
+ manta_window.addNavigatorOption("Trackball", trackball_nav );
+
+ // Use the quake nav by default.
+ quake_nav->resetToCamera(
camera->getPosition(),camera->getLookAt(),camera->getUp());
+ manta_window.setNavigator( quake_nav );
+
+ // Create manta channel for the interface.
+ int manta_channel = 0; // !!! See XWindowUI.cc line: 586
+ manta_interface->createChannel( glx_image_display, camera, use_stereo,
width, height );
+
+ // Set the manta interface for the application.
+ manta_window.setMantaInterface( manta_interface, manta_channel );
+
+ // Check to see if we should enable the stereo dialog.
+ if (use_stereo) {
+ manta_window.addExtraOptionsDialog( "Stereo", new FMantaStereoDialog(
&manta_window, "Stereo" ));
+ }
- // Check to see if the default scene was a kdtree.
+ // Check to see if the default scene was a kdtree.
-
/////////////////////////////////////////////////////////////////////////////
- // Create any necessary dialogs now since everything else should be
initialized.
- KDTree *kdtree = 0;
- if ((kdtree = dynamic_cast<KDTree *>( root_object ))) {
+
/////////////////////////////////////////////////////////////////////////////
+ // Create any necessary dialogs now since everything else should be
initialized.
+ KDTree *kdtree = 0;
+ if ((kdtree = dynamic_cast<KDTree *>( root_object ))) {
- std::cout << "Building transparent tree." << std::endl;
+ std::cout << "Building transparent tree." << std::endl;
- // Create a transparent kdtree.
- TransparentKDTree *transparent_kdtree =
- new TransparentKDTree( kdtree, new
KDTreeCopyColorMaterial );
-
- // XXX to be replaced
- __global_transparent_kdtree = transparent_kdtree;
- __global_kdtree = kdtree;
+ // Create a transparent kdtree.
+ TransparentKDTree *transparent_kdtree =
+ new TransparentKDTree( kdtree, new KDTreeCopyColorMaterial );
+
+ // XXX to be replaced
+ __global_transparent_kdtree = transparent_kdtree;
+ __global_kdtree = kdtree;
- // Create a transparency dialog
- manta_window.addExtraOptionsDialog( "Transparency",
- new FMantaTransparentDialog( &manta_window, kdtree,
transparent_kdtree, "Transparency" ));
-
- // Create a kdtree explorer dialog.
- manta_window.addExtraOptionsDialog( "kd-Tree Explorer",
- new FMantaKdExplorerDialog( &manta_window, kdtree, "kd-Tree Explorer"
));
- }
-
-
+ // Create a transparency dialog
+ manta_window.addExtraOptionsDialog( "Transparency",
+ new FMantaTransparentDialog(
&manta_window, kdtree, transparent_kdtree, "Transparency" ));
+
+ // Create a kdtree explorer dialog.
+ manta_window.addExtraOptionsDialog( "kd-Tree Explorer",
+ new FMantaKdExplorerDialog(
&manta_window, kdtree, "kd-Tree Explorer" ));
+ }
+
+ }
+ catch (SCIRun::Exception &e) {
+ std::cerr << "Could not setup Manta: " << e.message() << std::endl;
+ exit( 1 );
+ }
+
/////////////////////////////////////////////////////////////////////////////
// Start up manta.
- manta_interface->beginRendering(false);
-
- // Start fox control loop.
- return app.run();
+ try {
+ manta_interface->beginRendering(false);
+
+ // Start fox control loop.
+ return app.run();
+ }
+ catch (SCIRun::Exception &e) {
+ std::cerr << "Caught exception at top level: " << e.message() <<
std::endl;
+ Thread::exitAll( 1 );
+ }
}
#include <Interface/LightSet.h>
Modified: branches/itanium2/fox/sc_demo.cc
==============================================================================
--- branches/itanium2/fox/sc_demo.cc (original)
+++ branches/itanium2/fox/sc_demo.cc Sat Nov 5 17:11:55 2005
@@ -1,30 +1,30 @@
/*
- For more information, please see:
http://software.sci.utah.edu
+ For more information, please see:
http://software.sci.utah.edu
- The MIT License
+ The MIT License
- Copyright (c) 2005
- Silicon Graphics Inc. Mountain View California.
+ Copyright (c) 2005
+ Silicon Graphics Inc. Mountain View California.
- License for the specific language governing rights and limitations under
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
+ License for the specific language governing rights and limitations under
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
- */
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
#include <Interface/RTRTInterface.h>
#include <Core/Color/ColorDB.h>
@@ -73,30 +73,30 @@
// XXX to be replaced!
namespace fox_manta {
-TransparentKDTree *__global_transparent_kdtree = NULL;
-KDTree *__global_kdtree = NULL;
+ TransparentKDTree *__global_transparent_kdtree = NULL;
+ KDTree *__global_kdtree = NULL;
}
Scene* createDefaultScene();
int main( int argc, char *argv[]) {
- // Make sure the necessary environment is setup.
- if (getenv("THREAD_NO_CATCH_SIGNALS") == 0) {
- cerr << "ALERT: setenv THREAD_NO_CATCH_SIGNALS 1 to avoid
instability on exit." << std::endl;
- };
- if (getenv("FGL_MACRO_TILE_FB") == 0) {
- cerr << "ALERT: setenv FGL_MACRO_TILE_FB 1 to improve
performance over vizserver." << std::endl;
- }
+ // Make sure the necessary environment is setup.
+ if (getenv("THREAD_NO_CATCH_SIGNALS") == 0) {
+ cerr << "ALERT: setenv THREAD_NO_CATCH_SIGNALS 1 to avoid instability on
exit." << std::endl;
+ };
+ if (getenv("FGL_MACRO_TILE_FB") == 0) {
+ cerr << "ALERT: setenv FGL_MACRO_TILE_FB 1 to improve performance over
vizserver." << std::endl;
+ }
- // Parse args.
- int np = 1;
- char *scene_text = 0;
- string bookmark_file_name;
+ // Parse args.
+ int np = 1;
+ char *scene_text = 0;
+ string bookmark_file_name;
string default_camera = "pinhole(-eye 3 3 2 -lookat 0 0 0.3 -up 0 0 1 -fov
60)";
bool use_stereo = false;
int shm_key = 100;
-
+ double timeout_seconds = 10.0;
int width = 512; // Dimensions of the gui.
int height = 256;
@@ -104,18 +104,18 @@
int xres = 512; // Dimensions of the image.
int yres = 512;
- // Look for specific args.
- for (int i=0;i<argc;++i) {
- string arg = argv[i];
- if (arg == "-np") {
- np = atoi( argv[++i] );
- }
- else if (arg == "-scene") {
- scene_text = argv[++i];
- }
- else if (arg == "-bookmarks") {
- bookmark_file_name = argv[++i];
- }
+ // Look for specific args.
+ for (int i=0;i<argc;++i) {
+ string arg = argv[i];
+ if (arg == "-np") {
+ np = atoi( argv[++i] );
+ }
+ else if (arg == "-scene") {
+ scene_text = argv[++i];
+ }
+ else if (arg == "-bookmarks") {
+ bookmark_file_name = argv[++i];
+ }
else if (arg == "-stereo") {
use_stereo = true;
}
@@ -125,51 +125,56 @@
else if (arg == "-key") {
shm_key = atoi( argv[++i] );
}
+ else if (arg == "-ownertimeout") {
+ timeout_seconds = atof( argv[++i] );
+ }
else if(arg == "-res"){
if(!getResolutionArg( (argv[++i]), xres, yres)){
std::cerr << "Error parsing resolution should be in form NxM" <<
std::endl;
}
}
- }
+ }
- std::cerr << "Using " << np << " workers plus one gui thread." <<
std::endl;
+ std::cerr << "Using " << np << " workers plus one gui thread." <<
std::endl;
-
/////////////////////////////////////////////////////////////////////////////
- // Make a fox application object.
+
/////////////////////////////////////////////////////////////////////////////
+ // Make a fox application object.
MediaFusionApp app( "", "Abe Stephens -- SGI" );
- app.init( argc, argv );
+ app.init( argc, argv );
- // Add an FMantaWindow.
- FMantaWindow manta_window( &app, "Open-Source MANTA. Silicon Graphics
Inc. and SCI Institute, University of Utah",
- width, height, xres, yres );
+ // Add an FMantaWindow.
+ FMantaWindow manta_window( &app,
+ "Open-Source MANTA. Silicon Graphics Inc. and
SCI Institute, University of Utah",
+ false,
+ width, height, xres, yres );
- // Create the manta image frame.
- FMantaImageFrame *manta_frame = manta_window.getMantaFrame();
+ // Create the manta image frame.
+ FMantaImageFrame *manta_frame = manta_window.getMantaFrame();
// Hide the GLX Image frame since we will be using media fusion.
manta_frame->hide();
- // Create the application's windows.
- app.create();
+ // Create the application's windows.
+ app.create();
// Instruct the MediaFusionApp to intercept events for the frame.
app.setTargetId( manta_frame->id() );
/////////////////////////////////////////////////////////////////////////////
- // Construct Manta.
- RTRTInterface *manta_interface = createRTRT();
+ // Construct Manta.
+ RTRTInterface *manta_interface = createRTRT();
- manta_interface->setScenePath (".");
- manta_interface->changeNumWorkers ( np );
- manta_interface->selectImageType ( "rgba8" );
- // manta_interface->selectImageType ( "rgbafloat" );
- manta_interface->selectLoadBalancer ( "workqueue" );
- manta_interface->selectImageTraverser ( "tiled" );
- // manta_interface->selectPixelSampler ( "jittersample(
-numberOfSamples 4 )" );
- // manta_interface->setPixelSampler ( new
Histx_Manta::SingleSamplerCounter );
- manta_interface->selectPixelSampler ( "singlesample" );
- manta_interface->selectRenderer ( "raytracer" );
- manta_interface->selectShadowAlgorithm( "hard" );
+ manta_interface->setScenePath (".");
+ manta_interface->changeNumWorkers ( np );
+ manta_interface->selectImageType ( "rgba8" );
+ // manta_interface->selectImageType ( "rgbafloat" );
+ manta_interface->selectLoadBalancer ( "workqueue" );
+ manta_interface->selectImageTraverser ( "tiled" );
+ // manta_interface->selectPixelSampler ( "jittersample( -numberOfSamples
4 )" );
+ // manta_interface->setPixelSampler ( new
Histx_Manta::SingleSamplerCounter );
+ manta_interface->selectPixelSampler ( "singlesample" );
+ manta_interface->selectRenderer ( "raytracer" );
+ manta_interface->selectShadowAlgorithm( "hard" );
/////////////////////////////////////////////////////////////////////////////
// Create a SHMImageDisplay.
@@ -189,17 +194,19 @@
MediaFusionBridge mf_bridge( (Window)manta_frame->id(),
(Window)manta_frame->getRoot()->id(),
(Display *)app.getDisplay(),
- shm_key, 0.5 );
+ shm_key,
+ timeout_seconds,
+ 0.5 );
// Have manta start the media fusion bridge after it has setup the
SHMImageDisplay
manta_interface->addOneShotCallback(RTRTInterface::Absolute, 2,
- Callback::create( &mf_bridge,
&MediaFusionBridge::startup_callback));
+ Callback::create( &mf_bridge,
&MediaFusionBridge::startup_callback));
- // Try to load a scene.
- if ((scene_text == 0) || (!manta_interface->readScene( scene_text )))
{
- // Create a default scene.
- manta_interface->setScene( createDefaultScene() );
- }
+ // Try to load a scene.
+ if ((scene_text == 0) || (!manta_interface->readScene( scene_text ))) {
+ // Create a default scene.
+ manta_interface->setScene( createDefaultScene() );
+ }
Object *root_object = manta_interface->getScene()->getObject();
@@ -224,99 +231,99 @@
}
- // Check to see if a bookmark file was specified.
- if (bookmark_file_name.size() > 0) {
+ // Check to see if a bookmark file was specified.
+ if (bookmark_file_name.size() > 0) {
- char description[128];
- char specification[128];
- ifstream file( bookmark_file_name.c_str() );
+ char description[128];
+ char specification[128];
+ ifstream file( bookmark_file_name.c_str() );
- if (file.is_open()) {
- while (!file.eof()) {
+ if (file.is_open()) {
+ while (!file.eof()) {
- file.getline( description, 128 );
- if (string(description).size() > 0) {
+ file.getline( description, 128 );
+ if (string(description).size() > 0) {
- file.getline( specification, 128 );
- if (string(specification).size() > 0)
{
-
manta_window.addCameraBookmark( description, specification );
- }
- }
- }
-
- file.close();
- }
- else {
- std::cerr << "Could not load bookmark file." <<
std::endl;
- }
+ file.getline( specification, 128 );
+ if (string(specification).size() > 0) {
+ manta_window.addCameraBookmark( description, specification );
+ }
}
+ }
+
+ file.close();
+ }
+ else {
+ std::cerr << "Could not load bookmark file." << std::endl;
+ }
+ }
// Add a camera bookmark for the default camera.
manta_window.addCameraBookmark( "Default", default_camera );
- // Create the camera using the first camera bookmark.
- Camera *camera = manta_interface->createCamera(
manta_window.getCameraBookmark( 0 ) );
+ // Create the camera using the first camera bookmark.
+ Camera *camera = manta_interface->createCamera(
manta_window.getCameraBookmark( 0 ) );
- // Create a default quake navigator.
- FMantaQuakeNav *quake_nav = new FMantaQuakeNav( false );
- quake_nav->setMantaInterface( manta_interface );
- manta_window.addNavigatorOption( "Video Game", quake_nav );
-
- // Create a default quake navigator.
- FMantaQuakeNav *fly_nav = new FMantaQuakeNav( true );
- fly_nav->setMantaInterface( manta_interface );
- manta_window.addNavigatorOption( "Fly", fly_nav );
-
- // Create a navigator for the image frame.
- FMantaTrackballNav *trackball_nav = new FMantaTrackballNav();
- trackball_nav->setMantaInterface( manta_interface );
- trackball_nav->setMantaFrame( manta_frame );
- trackball_nav->setMantaChannel( 0 );
- manta_window.addNavigatorOption("Trackball", trackball_nav );
-
- // Use the quake nav by default.
- quake_nav->resetToCamera(
camera->getPosition(),camera->getLookAt(),camera->getUp());
- manta_window.setNavigator( quake_nav );
-
- // Create manta channel for the interface.
- int manta_channel = 0; // !!! See XWindowUI.cc line: 586
- manta_interface->createChannel( &image_display, camera, use_stereo,
width, height );
+ // Create a default quake navigator.
+ FMantaQuakeNav *quake_nav = new FMantaQuakeNav( false );
+ quake_nav->setMantaInterface( manta_interface );
+ manta_window.addNavigatorOption( "Video Game", quake_nav );
+
+ // Create a default quake navigator.
+ FMantaQuakeNav *fly_nav = new FMantaQuakeNav( true );
+ fly_nav->setMantaInterface( manta_interface );
+ manta_window.addNavigatorOption( "Fly", fly_nav );
+
+ // Create a navigator for the image frame.
+ FMantaTrackballNav *trackball_nav = new FMantaTrackballNav();
+ trackball_nav->setMantaInterface( manta_interface );
+ trackball_nav->setMantaFrame( manta_frame );
+ trackball_nav->setMantaChannel( 0 );
+ manta_window.addNavigatorOption("Trackball", trackball_nav );
+
+ // Use the quake nav by default.
+ quake_nav->resetToCamera(
camera->getPosition(),camera->getLookAt(),camera->getUp());
+ manta_window.setNavigator( quake_nav );
+
+ // Create manta channel for the interface.
+ int manta_channel = 0; // !!! See XWindowUI.cc line: 586
+ manta_interface->createChannel( &image_display, camera, use_stereo, width,
height );
- // Set the manta interface for the application.
- manta_window.setMantaInterface( manta_interface, manta_channel );
+ // Set the manta interface for the application.
+ manta_window.setMantaInterface( manta_interface, manta_channel );
// Check to see if we should enable the stereo dialog.
if (use_stereo) {
manta_window.addExtraOptionsDialog( "Stereo", new FMantaStereoDialog(
&manta_window, "Stereo" ));
}
-
/////////////////////////////////////////////////////////////////////////////
- // Create any necessary dialogs now since everything else should be
initialized.
- KDTree *kdtree = 0;
- if ((kdtree = dynamic_cast<KDTree *>( root_object ))) {
+
/////////////////////////////////////////////////////////////////////////////
+ // Create any necessary dialogs now since everything else should be
initialized.
+ KDTree *kdtree = 0;
+ if ((kdtree = dynamic_cast<KDTree *>( root_object ))) {
- std::cout << "Building transparent tree." << std::endl;
+ std::cout << "Building transparent tree." << std::endl;
- // Create a transparent kdtree.
- TransparentKDTree *transparent_kdtree =
- new TransparentKDTree( kdtree, new
KDTreeCopyColorMaterial );
-
- // XXX to be replaced
- __global_transparent_kdtree = transparent_kdtree;
- __global_kdtree = kdtree;
+ // Create a transparent kdtree.
+ TransparentKDTree *transparent_kdtree =
+ new TransparentKDTree( kdtree, new KDTreeCopyColorMaterial );
+
+ // XXX to be replaced
+ __global_transparent_kdtree = transparent_kdtree;
+ __global_kdtree = kdtree;
- // Create a new extra options dialog.
- manta_window.addExtraOptionsDialog( "Transparency",
- new FMantaTransparentDialog( &manta_window, kdtree,
transparent_kdtree, "Transparency" ));
+ // Create a new extra options dialog.
+ manta_window.addExtraOptionsDialog( "Transparency",
+ new FMantaTransparentDialog(
&manta_window, kdtree, transparent_kdtree, "Transparency" ));
- }
+ }
-
/////////////////////////////////////////////////////////////////////////////
- // Start up manta.
- manta_interface->beginRendering(false);
+
/////////////////////////////////////////////////////////////////////////////
+ // Start up manta.
+ manta_interface->beginRendering(false);
- // Start fox control loop.
- return app.run();
+ // Start fox control loop.
+ return app.run();
}
#include <Interface/LightSet.h>
@@ -348,7 +355,7 @@
Vector(0,1,0)),
new
Constant<Color>(Color(RGBColor(.6,.6,.6))),
32,
- new
CheckerTexture<ColorComponent>
+ new CheckerTexture<ColorComponent>
((ColorComponent)0.2,
(ColorComponent)0.5,
Vector(1,0,0),
@@ -356,7 +363,7 @@
Group* world = new Group();
Primitive* floor = new Parallelogram(plane_matl, Point(-20,-20,0),
-
Vector(40,0,0), Vector(0,40,0));
+ Vector(40,0,0), Vector(0,40,0));
// Setup world-space texture coordinates for the checkerboard floor
UniformMapper* uniformmap = new UniformMapper();
floor->setTexCoordMapper(uniformmap);
- [MANTA] r700 - in branches/itanium2: Core/Shm Engine/Display fox, abe, 11/05/2005
Archive powered by MHonArc 2.6.16.