Text archives Help
- From: bigler@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1181 - in trunk: Core/Geometry Engine/Control Interface SwigInterface fox/FManta
- Date: Wed, 16 Aug 2006 15:48:08 -0600 (MDT)
Author: bigler
Date: Wed Aug 16 15:48:01 2006
New Revision: 1181
Modified:
trunk/Core/Geometry/Vector.h
trunk/Engine/Control/RTRT.h
trunk/Interface/MantaInterface.h
trunk/SwigInterface/KDTreeDynFrame.py
trunk/SwigInterface/manta.i
trunk/SwigInterface/wxManta.py
trunk/fox/FManta/FMantaImageFrame.cc
trunk/fox/FManta/FMantaTrackballNav.cc
trunk/fox/FManta/FMantaWindow.h
Log:
Core/Geometry/Vector.h
Removed get() function. That was only used by Swig, and I fixed the
__getitem__ function to return a regular value.
Engine/Control/RTRT.h
shootOneRay is now a virtual function from MantaInterface.
Interface/MantaInterface.h
shootOneRay is now a virtual function from MantaInterface.
SwigInterface/KDTreeDynFrame.py
Don't use Vector.get() anymore. Use Vector[].
SwigInterface/manta.i
Added interface for numProcessors() function from Thread library.
SwigInterface/wxManta.py
Can pass a size to mantaGLCanvas.
Fixed shootOneRay functionality. This generates a transaction that
calls the shootOneRay function and prints out the coordinates to
stdout.
Default the number of threads to the number of processors in the
system.
fox/FManta/FMantaImageFrame.cc
fox/FManta/FMantaTrackballNav.cc
fox/FManta/FMantaWindow.h
Fixed some includes that were caused by removing the includes in
RTRT.h that were there for shootOneRay.
Modified: trunk/Core/Geometry/Vector.h
==============================================================================
--- trunk/Core/Geometry/Vector.h (original)
+++ trunk/Core/Geometry/Vector.h Wed Aug 16 15:48:01 2006
@@ -98,9 +98,6 @@
Real z() const {
return data[2];
}
- Real get(int i) const {
- return data[i];
- }
#ifndef SWIG
const Real& operator[] (int i) const {
@@ -111,7 +108,7 @@
}
#else
%extend {
- Real& __getitem__( int i ) {
+ Real __getitem__( int i ) {
return self->operator[](i);
}
void __setitem__(int i,Real val) {
Modified: trunk/Engine/Control/RTRT.h
==============================================================================
--- trunk/Engine/Control/RTRT.h (original)
+++ trunk/Engine/Control/RTRT.h Wed Aug 16 15:48:01 2006
@@ -17,11 +17,6 @@
#include <vector>
#include <list>
-// The following are used by shootOneRay (experimental)
-#include <MantaTypes.h>
-#include <Interface/RayPacket.h>
-#include <Core/Color/Color.h>
-
namespace SCIRun {
class Thread;
}
@@ -153,7 +148,7 @@
virtual void addTransaction(TransactionBase* );
// Debug:
- void shootOneRay( Color &result_color, RayPacket
&result_rays, Real image_x, Real image_y, int channel_index );
+ virtual void shootOneRay( Color &result_color, RayPacket
&result_rays, Real image_x, Real image_y, int channel_index );
protected:
Modified: trunk/Interface/MantaInterface.h
==============================================================================
--- trunk/Interface/MantaInterface.h (original)
+++ trunk/Interface/MantaInterface.h Wed Aug 16 15:48:01 2006
@@ -5,6 +5,7 @@
#include <Interface/Callback.h>
#include <Interface/Transaction.h>
#include <SCIRun/Core/Exceptions/Exception.h>
+#include <MantaTypes.h>
#include <sgi_stl_warnings_off.h>
#include <string>
@@ -29,6 +30,7 @@
class SetupCallback;
class ShadowAlgorithm;
class UserInterface;
+ class RayPacket;
class MantaInterface {
public:
@@ -180,6 +182,11 @@
addTransaction(new CallbackTransaction(name, callback, flag ));
}
+ // Others
+
+ // This should only be called from within a transaction called function.
+ virtual void shootOneRay( Color &result_color, RayPacket
&result_rays, Real image_x, Real image_y, int channel_index ) = 0;
+
protected:
MantaInterface();
Modified: trunk/SwigInterface/KDTreeDynFrame.py
==============================================================================
--- trunk/SwigInterface/KDTreeDynFrame.py (original)
+++ trunk/SwigInterface/KDTreeDynFrame.py Wed Aug 16 15:48:01 2006
@@ -124,7 +124,7 @@
# Check to see if the plane group already has a parallelogram.
if (self.plane_group.getSize() == 2):
- old = self.plane_group.get(1)
+ old = self.plane_group[1]
manta_delete( old )
self.plane_group.set(1,parallelogram)
else:
Modified: trunk/SwigInterface/manta.i
==============================================================================
--- trunk/SwigInterface/manta.i (original)
+++ trunk/SwigInterface/manta.i Wed Aug 16 15:48:01 2006
@@ -499,6 +499,21 @@
////////////////////////////////////////////////
+// Thread stuff
+%{
+#include <SCIRun/Core/Thread/Thread.h>
+%}
+
+%include <SCIRun/Core/Thread/Thread.h>
+
+// namespace SCIRun {
+// struct Thread {
+// public:
+// static int numProcessors();
+// };
+// }
+
+////////////////////////////////////////////////
// Python specific code
%pythoncode %{
Modified: trunk/SwigInterface/wxManta.py
==============================================================================
--- trunk/SwigInterface/wxManta.py (original)
+++ trunk/SwigInterface/wxManta.py Wed Aug 16 15:48:01 2006
@@ -15,7 +15,6 @@
import FloatSpin as FS
-
# Determine frame resolution.
xres = 512
yres = 512
@@ -92,9 +91,10 @@
class mantaGLCanvas(wxGLCanvas):
# updateFramerate is a function that you call to update the framerate
- def __init__(self, parent, sync_display, opengl_display,
updateFramerate):
- wxGLCanvas.__init__(self, parent, -1, style=wx.NO_BORDER,
- size=wx.Size(xres, yres) )
+ def __init__(self, parent, sync_display, opengl_display, updateFramerate,
+ size=wx.Size(xres,yres)):
+ wxGLCanvas.__init__(self, parent, -1, style=wx.NO_BORDER, size=size)
+
self.sync_display = sync_display
self.opengl_display = opengl_display
# We bind the paint event to allow for some initialization
@@ -112,6 +112,7 @@
def OnSize(self, event):
pass
+ event.Skip(True)
def OnPaint(self, event):
# Note that you must always generate a wxPaintDC object,
@@ -369,7 +370,8 @@
self.sync_display.setChild(manta_new( NullDisplay(vectorStr()) ))
opengl_display = manta_new(PureOpenGLDisplay(""))
self.canvas = mantaGLCanvas(self.panel, self.sync_display,
- opengl_display, self.updateFramerate)
+ opengl_display, self.updateFramerate,
+ size = renderSize)
self.sync_thread = DisplayThread(self.canvas, self.sync_display)
# Create a display channel.
@@ -638,6 +640,13 @@
xpos = 2.0*mouse_pos.x/window_size.width - 1.0
ypos = 1.0 - 2.0*mouse_pos.y/window_size.height
+ self.engine.addTransaction("shootOneRay",
+
manta_new(createMantaTransaction(self.shootOneRay, (xpos, ypos,
self.channelID) )))
+
+ event.Skip()
+
+ def shootOneRay( self, xpos, ypos, channel_index ):
+
# Construct a ray packet.
data = RayPacketData()
rays = RayPacket( data, RayPacket.UnknownShape, 0, 1, 0, 0 )
@@ -645,19 +654,16 @@
# Shoot one ray.
color = Color(RGBColor())
- rtrt.shootOneRay( color, rays, xpos, ypos, 0 )
+ self.engine.shootOneRay( color, rays, xpos, ypos, channel_index )
if (rays.wasHit(0)):
position = rays.getHitPosition(0)
- print position.x
- print position.y
- print position.z
+ print "Location = (%s, %s, %s)" % (position.x(), position.y(),
position.z())
else:
print "Missed"
- event.Skip()
-
+
###########################################################################
## mouseRotate
###########################################################################
@@ -755,7 +761,7 @@
class MantaApp(wx.App) :
def __init__(self,
initialize_callback_ = createDefaultScenePython,
- num_workers = 1,
+ num_workers = Thread.numProcessors(),
renderSize = wx.Size(xres,yres),
redirect=False,
filename=None):
Modified: trunk/fox/FManta/FMantaImageFrame.cc
==============================================================================
--- trunk/fox/FManta/FMantaImageFrame.cc (original)
+++ trunk/fox/FManta/FMantaImageFrame.cc Wed Aug 16 15:48:01 2006
@@ -1,4 +1,6 @@
+#include <Interface/RayPacket.h>
+
#include <FManta/FMantaImageFrame.h>
// #include <sc_demo/MediaFusionApp.h>
Modified: trunk/fox/FManta/FMantaTrackballNav.cc
==============================================================================
--- trunk/fox/FManta/FMantaTrackballNav.cc (original)
+++ trunk/fox/FManta/FMantaTrackballNav.cc Wed Aug 16 15:48:01 2006
@@ -5,6 +5,7 @@
using namespace Manta;
using namespace fox_manta;
+#include <Interface/Object.h>
#include <Interface/Scene.h>
#include <Interface/Context.h>
#include <Core/Geometry/BBox.h>
Modified: trunk/fox/FManta/FMantaWindow.h
==============================================================================
--- trunk/fox/FManta/FMantaWindow.h (original)
+++ trunk/fox/FManta/FMantaWindow.h Wed Aug 16 15:48:01 2006
@@ -5,6 +5,7 @@
#include <fx3d.h>
#include <Interface/MantaInterface.h>
+#include <Interface/Object.h>
#include <Engine/Display/GLXImageDisplay.h>
#include <FManta/FMantaImageFrame.h>
- [MANTA] r1181 - in trunk: Core/Geometry Engine/Control Interface SwigInterface fox/FManta, bigler, 08/16/2006
Archive powered by MHonArc 2.6.16.