Text archives Help
- From: abe@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r399 - in branches/itanium2: Engine/Display fox
- Date: Mon, 20 Jun 2005 19:33:49 -0600 (MDT)
Author: abe
Date: Mon Jun 20 19:33:46 2005
New Revision: 399
Modified:
branches/itanium2/Engine/Display/CMakeLists.txt
branches/itanium2/fox/FMantaWindow.cc
branches/itanium2/fox/FMantaWindow.h
branches/itanium2/fox/fox_manta.cc
Log:
Quake camera works..
Modified: branches/itanium2/Engine/Display/CMakeLists.txt
==============================================================================
--- branches/itanium2/Engine/Display/CMakeLists.txt (original)
+++ branches/itanium2/Engine/Display/CMakeLists.txt Mon Jun 20 19:33:46
2005
@@ -10,6 +10,6 @@
Display/FileDisplay.cc
Display/GLXImageDisplay.h
Display/GLXImageDisplay.cc
- Display/RawImageDisplay.h
- Display/RawImageDisplay.cc
+
+
)
Modified: branches/itanium2/fox/FMantaWindow.cc
==============================================================================
--- branches/itanium2/fox/FMantaWindow.cc (original)
+++ branches/itanium2/fox/FMantaWindow.cc Mon Jun 20 19:33:46 2005
@@ -13,9 +13,15 @@
FXDEFMAP(FMantaWindow) FMantaWindowMap[] = {
//////////////////////////////////////////////////////////////////////////////
// Message_Type ID
Message_Handler
- FXMAPFUNC(SEL_COMMAND, FMantaWindow::ID_QUIT, FMantaWindow::onQuit ),
- FXMAPFUNC(SEL_CHANGED, FMantaWindow::ID_SPEED_SLIDER,
FMantaWindow::onSpeedSlider ),
- FXMAPFUNC(SEL_COMMAND, FMantaWindow::ID_BOOKMARK_LIST,
FMantaWindow::onCameraBookmark )
+ FXMAPFUNC(SEL_COMMAND, FMantaWindow::ID_QUIT,
FMantaWindow::onQuit ),
+ FXMAPFUNC(SEL_COMMAND, FXApp::ID_QUIT,
FMantaWindow::onQuit ),
+
+ FXMAPFUNC(SEL_CHANGED, FMantaWindow::ID_SPEED_SLIDER,
FMantaWindow::onSpeedSlider ),
+ FXMAPFUNC(SEL_COMMAND, FMantaWindow::ID_BOOKMARK_LIST,
FMantaWindow::onCameraBookmark ),
+
+ // Shadows.
+ FXMAPFUNC(SEL_COMMAND, FMantaWindow::ID_HARD_SHADOWS,
FMantaWindow::onShadowAlgorithm ),
+ FXMAPFUNC(SEL_COMMAND, FMantaWindow::ID_NO_SHADOWS,
FMantaWindow::onShadowAlgorithm )
};
FXIMPLEMENT(FMantaWindow,FXMainWindow,FMantaWindowMap,ARRAYNUMBER(FMantaWindowMap));
@@ -36,8 +42,12 @@
new FXMenuTitle ( menu_bar, "File", 0, file_menu );
// Manta Menu.
- manta_menu = new FXMenuPane( this );
- new FXMenuTitle( menu_bar, "Manta", 0, manta_menu );
+ shadow_menu = new FXMenuPane( this );
+ new FXMenuCommand( shadow_menu, "Hard Shadows", 0, this,
ID_HARD_SHADOWS );
+ new FXMenuCommand( shadow_menu, "No Shadows", 0, this, ID_NO_SHADOWS
);
+ new FXMenuTitle ( menu_bar, "Shadows", 0, shadow_menu );
+
+ //
// Create the content of the window.
FXComposite *frame = new FXHorizontalFrame( this, LAYOUT_FILL );
@@ -55,22 +65,20 @@
// Camera bookmarks.
camera_bookmark_list = new FXListBox( viewers, this,
ID_BOOKMARK_LIST, LAYOUT_FILL_X|LAYOUT_BOTTOM|COMBOBOX_REPLACE,0,0,0,20 );
-
- // Default camera for default scene.
- // camera_bookmark_list->appendItem( "pinhole(-eye 3 3 2 -lookat 0 0
0.3 -up 0 0 1 -fov 60)" );
+ camera_bookmark_list->setNumVisible( 5 );
}
// Quit the program.
long FMantaWindow::onQuit( FXObject *sender, FXSelector key, void *data ) {
// Hard quit.
- if (fast_quit) {
+ // if (fast_quit) {
SCIRun::Thread::exitAll( 0 );
- }
+ //}
// Add a quit command to manta.
-
manta_interface->addTransaction("Quit",Callback::create(manta_interface,&RTRTInterface::finish));
- fast_quit = true;
+ //
manta_interface->addTransaction("Quit",Callback::create(manta_interface,&RTRTInterface::finish));
+ // fast_quit = true;
return 1;
};
@@ -100,6 +108,28 @@
return 1;
}
+long FMantaWindow::onShadowAlgorithm( FXObject *sender, FXSelector key, void
*data ) {
+
+ // Determine which shadow algorithm to use.
+ int id = FXSELID( key );
+
+ switch (id) {
+ case ID_HARD_SHADOWS:
+ manta_interface->addTransaction("Shadow Algorithm.",
+
Callback::create(this,&FMantaWindow::mantaShadowAlgorithm,string("hard")));
+ break;
+ case ID_NO_SHADOWS:
+ manta_interface->addTransaction("Shadow Algorithm.",
+
Callback::create(this,&FMantaWindow::mantaShadowAlgorithm,string("noshadows")));
+ break;
+ }
+
+ return 1;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+
void FMantaWindow::mantaThreadBookmark( const string camera_text ) const {
// Determine the channel number.
@@ -115,6 +145,19 @@
manta_interface->setCamera( channel, camera );
}
}
+
+void FMantaWindow::mantaShadowAlgorithm( const string text ) const {
+
+ // Determine the channel number.
+ int channel = manta_frame->getMantaChannel();
+
+ // Update the shadow algorithm.
+ if (!manta_interface->selectShadowAlgorithm( text )) {
+ std::cout << "Could not select shadow algorithm " << text <<
std::endl;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
void FMantaWindow::addCameraBookmark( const string &description, const
string &camera_text ) {
Modified: branches/itanium2/fox/FMantaWindow.h
==============================================================================
--- branches/itanium2/fox/FMantaWindow.h (original)
+++ branches/itanium2/fox/FMantaWindow.h Mon Jun 20 19:33:46 2005
@@ -34,7 +34,8 @@
// Fox GUI Components.
FXMenuBar *menu_bar;
FXMenuPane *file_menu;
- FXMenuPane *manta_menu;
+ FXMenuPane *shadow_menu;
+ FXMenuPane *cutting_menu;
FXRealSlider *speed_slider;
FXLabel *speed_text;
@@ -52,6 +53,11 @@
ID_QUIT = FXMainWindow::ID_LAST, // Sent when the
application must quit.
ID_SPEED_SLIDER, // Control speed
slider was changed.
ID_BOOKMARK_LIST, // User selected a
camera bookmark.
+
+ // Shadow options.
+ ID_HARD_SHADOWS,
+ ID_NO_SHADOWS,
+
ID_LAST
};
@@ -61,6 +67,9 @@
FXIcon *ic=NULL,FXIcon *mi=NULL,FXuint
opts=(DECOR_ALL),
FXint
x=20,FXint y=20,FXint w=256,FXint h=256,FXint pl=0,FXint pr=0,FXint
pt=0,FXint pb=0,FXint hs=0,FXint vs=0);
+ // Setup
+ void addCameraBookmark( const string &description, const
string &camera_text );
+
// Create the window.
void create() { FXMainWindow::create(); show(
PLACEMENT_DEFAULT ); };
@@ -68,6 +77,7 @@
long onQuit( FXObject *sender, FXSelector key, void *data );
long onSpeedSlider( FXObject *sender, FXSelector key, void
*data );
long onCameraBookmark( FXObject *sender, FXSelector key, void
*data );
+ long onShadowAlgorithm( FXObject *sender, FXSelector key,
void *data );
// Accessors.
void setMantaInterface( RTRTInterface *manta_interface_, int
manta_channel_ ) {
@@ -77,10 +87,12 @@
RTRTInterface *getMantaInterface() { return
manta_interface; };
FMantaImageFrame *getMantaFrame() { return manta_frame; };
- void addCameraBookmark( const string &description, const
string &camera_text );
-
// This method is called by the manta thread to replace the
camera.
void mantaThreadBookmark( const string camera_text ) const;
+
+ // This method is called by the manta thread to replace the
shadow algorithm.
+ void mantaShadowAlgorithm( const string shadow_text ) const;
+
};
};
Modified: branches/itanium2/fox/fox_manta.cc
==============================================================================
--- branches/itanium2/fox/fox_manta.cc (original)
+++ branches/itanium2/fox/fox_manta.cc Mon Jun 20 19:33:46 2005
@@ -30,6 +30,7 @@
// Parse args.
int np = 1;
char *scene_text = 0;
+ string nav_text;
// Look for specific args.
for (int i=0;i<argc;++i) {
@@ -40,6 +41,9 @@
else if (arg == "-scene") {
scene_text = argv[++i];
}
+ else if (arg == "-nav") {
+ nav_text = argv[++i];
+ }
}
std::cerr << "Using " << np << " workers plus one gui thread." <<
std::endl;
@@ -54,13 +58,6 @@
// Add an FMantaWindow.
FMantaWindow manta_window( &app, "Open-Source MANTA. Silicon Graphics
Inc. and SCI Institute, University of Utah", width, height );
-
- manta_window.addCameraBookmark( "Left Engine Cross-Section",
"pinhole( -eye 1038.31 -517.053 108.78 -lookat 1057.9 169.557 123.655 -up
0.0107751 -0.392417 0.919724 -fov 60 )" );
- manta_window.addCameraBookmark( "Whole Cross-Section",
"pinhole( -eye 1408.56 -2172.05 110.736 -lookat 1350.55 188.313 354.277 -up
0.0117111 -0.465077 0.885192 -fov 60 )" );
- manta_window.addCameraBookmark( "Cockpit Cross-Section",
"pinhole( -eye 312.31 -315.671 199.735 -lookat 280.305 98.0706 184.652 -up
0.0256952 -0.337005 0.941152 -fov 60 )" );
- manta_window.addCameraBookmark( "Top View",
"pinhole( -eye 1821.5 -29.356 2323.27 -lookat 1446.55 13.6745 -591.948 -up
-0.323033 -0.85584 0.403966 -fov 60 )" );
- manta_window.addCameraBookmark( "Cargo Area",
"pinhole( -eye 1858.79 -33.8248 155.066 -lookat 1273.5 -40.34 146.295 -up
0.357763 0.0232703 0.933523 -fov 60 )" );
- manta_window.addCameraBookmark( "Inside Cockpit",
"pinhole( -eye 209.886 14.2034 244.021 -lookat -241.326 -158.379 185.454
-up 0.216817 0.154821 0.963858 -fov 56.8882 )" );
// Create the application's windows.
app.create();
@@ -77,8 +74,8 @@
manta_interface->selectRenderer ( "raytracer" );
manta_interface->selectShadowAlgorithm( "hard" );
- // Camera *camera = manta_interface->createCamera( "pinhole(-eye 1 1
1 -lookat 0 -1.0 0 -up 0 0 1 -fov 60)" );
- 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 );
+ Camera *camera = manta_interface->createCamera( "pinhole(-eye 3 3 2
-lookat 0 0 0.3 -up 0 0 1 -fov 60)" );
+ // 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();
@@ -88,15 +85,23 @@
(Window) manta_frame->id() );
// Create a navigator for the image frame.
- FMantaQuakeNav *quake_nav = new FMantaQuakeNav();
- quake_nav->setMantaInterface( manta_interface );
-
- // Create a uniform navigator.
- FMantaUniformNav *uniform_nav = new FMantaUniformNav();
- uniform_nav->setMantaInterface( manta_interface );
- uniform_nav->setMantaChannel( 0 );
+ FMantaNavigator *nav = 0;
+ if (nav_text == "uniform") {
+ // Create a uniform navigator.
+ FMantaUniformNav *uniform_nav = new FMantaUniformNav();
+ uniform_nav->setMantaInterface( manta_interface );
+ uniform_nav->setMantaChannel( 0 );
+
+ nav = uniform_nav;
+ }
+ else {
+ // Create a default quake navigator.
+ std::cerr << "Using default video game navigator." <<
std::endl;
+ FMantaQuakeNav *quake_nav = new FMantaQuakeNav();
+ quake_nav->setMantaInterface( manta_interface );
+ nav = quake_nav;
+ }
- FMantaNavigator *nav = quake_nav;
manta_window.setNavigator( nav );
// Create manta channel for the interface.
@@ -107,6 +112,18 @@
if ((scene_text == 0) || (!manta_interface->readScene( scene_text )))
{
// Create a default scene.
manta_interface->setScene( createDefaultScene() );
+
+ // Add a camera bookmark for the default camera.
+ manta_window.addCameraBookmark( "Default", "pinhole(-eye 3 3
2 -lookat 0 0 0.3 -up 0 0 1 -fov 60)" );
+ }
+ else {
+ // Assume we are viewing the boeing scene.
+ manta_window.addCameraBookmark( "Left Engine Cross-Section",
"pinhole( -eye 1038.31 -517.053 108.78 -lookat 1057.9 169.557 123.655 -up
0.0107751 -0.392417 0.919724 -fov 60 )" );
+ manta_window.addCameraBookmark( "Whole Cross-Section",
"pinhole( -eye 1408.56 -2172.05 110.736 -lookat 1350.55 188.313 354.277 -up
0.0117111 -0.465077 0.885192 -fov 60 )" );
+ manta_window.addCameraBookmark( "Cockpit Cross-Section",
"pinhole( -eye 312.31 -315.671 199.735 -lookat 280.305 98.0706 184.652 -up
0.0256952 -0.337005 0.941152 -fov 60 )" );
+ manta_window.addCameraBookmark( "Top View",
"pinhole( -eye 1821.5 -29.356 2323.27 -lookat 1446.55 13.6745 -591.948 -up
-0.323033 -0.85584 0.403966 -fov 60 )" );
+ manta_window.addCameraBookmark( "Cargo Area",
"pinhole( -eye 1858.79 -33.8248 155.066 -lookat 1273.5 -40.34 146.295 -up
0.357763 0.0232703 0.933523 -fov 60 )" );
+ manta_window.addCameraBookmark( "Inside Cockpit",
"pinhole( -eye 209.886 14.2034 244.021 -lookat -241.326 -158.379 185.454
-up 0.216817 0.154821 0.963858 -fov 56.8882 )" );
}
// Set the manta interface for the application.
- [MANTA] r399 - in branches/itanium2: Engine/Display fox, abe, 06/20/2005
Archive powered by MHonArc 2.6.16.