Text archives Help
- From: abe@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1008 - in trunk: Engine/Display StandAlone SwigInterface
- Date: Thu, 13 Apr 2006 17:32:12 -0600 (MDT)
Author: abe
Date: Thu Apr 13 17:32:11 2006
New Revision: 1008
Added:
trunk/SwigInterface/wxManta.py (contents, props changed)
Modified:
trunk/Engine/Display/GLXImageDisplay.h
trunk/StandAlone/manta.cc
trunk/StandAlone/manta_tile_size.pl
trunk/SwigInterface/manta.i
Log:
Minor change to allow the perl script to pick up -bench performance numbers.
M StandAlone/manta_tile_size.pl
M StandAlone/manta.cc
Added example of GLXImageDisplay working with a (very simple) wxPython
program.
AM SwigInterface/wxManta.py
M SwigInterface/manta.i
M Engine/Display/GLXImageDisplay.h
Modified: trunk/Engine/Display/GLXImageDisplay.h
==============================================================================
--- trunk/Engine/Display/GLXImageDisplay.h (original)
+++ trunk/Engine/Display/GLXImageDisplay.h Thu Apr 13 17:32:11 2006
@@ -1,5 +1,5 @@
-#ifndef Manta_Engine_OpenGLDisplay_h
-#define Manta_Engine_OpenGLDisplay_h
+#ifndef Manta_Engine_GLXImageDisplay_h
+#define Manta_Engine_GLXImageDisplay_h
#include <Interface/ImageDisplay.h>
@@ -37,7 +37,7 @@
GLXImageDisplay( XVisualInfo *x_visual_info_,
GLXDrawable glx_drawable_ );
- // Create a visual to use automatically.
+ // Create a visual to use automatically.
GLXImageDisplay( bool stereo_, GLXDrawable glx_drawable_ );
~GLXImageDisplay();
Modified: trunk/StandAlone/manta.cc
==============================================================================
--- trunk/StandAlone/manta.cc (original)
+++ trunk/StandAlone/manta.cc Thu Apr 13 17:32:11 2006
@@ -153,7 +153,9 @@
double dt = Time::currentSeconds()-startTime;
double fps = numFrames/dt;
if(verbose)
- cout << "Benchmark completed in " << dt << " seconds (" << numFrames <<
" frames, " << fps << " frames per second)\n";
+ cout << "Benchmark completed in " << dt
+ << " seconds (" << numFrames << " frames, "
+ << fps << " frames per second)" << std::endl;
else
std::cout << fps << std::endl;
rtrt->finish();
Modified: trunk/StandAlone/manta_tile_size.pl
==============================================================================
--- trunk/StandAlone/manta_tile_size.pl (original)
+++ trunk/StandAlone/manta_tile_size.pl Thu Apr 13 17:32:11 2006
@@ -77,7 +77,7 @@
}
# Determine output file.
-if (($manta eq "") || ($path eq "")) {
+if ($manta eq "") {
if ($manta eq "") {
print "-manta option missing\n";
@@ -122,12 +122,14 @@
}
# Create the camera path directive.
-$camera_path = "-ui camerapath( -file $path -sync $path_sync ";
-
-if ($path_last > 0) {
- $camera_path = $camera_path . "-interval $path_start $path_last ";
+if ($path ne "") {
+ $camera_path = "-ui camerapath( -file $path -sync $path_sync ";
+
+ if ($path_last > 0) {
+ $camera_path = $camera_path . "-interval $path_start $path_last ";
+ }
+ $camera_path = $camera_path . ")\n";
}
-$camera_path = $camera_path . ")\n";
# Determine the total number of iterations.
$iter = 0;
@@ -167,6 +169,19 @@
# See if the output line contains the complete message.
if ($line =~ /COMPLETE/) {
+ last current_run;
+ }
+ elsif ($line =~ /^Benchmark completed/) {
+
+ # Read the performance of the benchmark.
+ if ($line =~ /(\d+\.\d+) frames per second/) {
+ $total_fps = $1;
+ $total_samples = 1;
+ }
+ else {
+ print "WARNING could not parse Benchmark result:
$line\n";
+ }
+
last current_run;
}
Modified: trunk/SwigInterface/manta.i
==============================================================================
--- trunk/SwigInterface/manta.i (original)
+++ trunk/SwigInterface/manta.i Thu Apr 13 17:32:11 2006
@@ -175,15 +175,21 @@
///////////////////////////////////////////////////////
// ImageDisplay
+typedef int GLXDrawable;
+
%{
#include <Interface/ImageDisplay.h>
#include <Engine/Display/SyncDisplay.h>
#include <Engine/Display/OpenGLDisplay.h>
+#include <Engine/Display/GLXImageDisplay.h>
%}
%include <Interface/ImageDisplay.h>
%include <Engine/Display/SyncDisplay.h>
%include <Engine/Display/OpenGLDisplay.h>
+%include <Engine/Display/GLXImageDisplay.h>
+
+
///////////////////////////////////////////////////////
// UI
Added: trunk/SwigInterface/wxManta.py
==============================================================================
--- (empty file)
+++ trunk/SwigInterface/wxManta.py Thu Apr 13 17:32:11 2006
@@ -0,0 +1,109 @@
+#!/usr/bin/python
+
+import wx
+import sys
+
+from manta import *
+
+
+# Number of workers.
+numworkers = 1
+
+# Determine frame resolution.
+xres = 512
+yres = 512
+
+###############################################################################
+# Default Scene.
+def createDefaultScenePython():
+ scene = manta_new(Scene())
+
scene.setBackground(manta_new(ConstantBackground(ColorDB.getNamedColor("SkyBlue3").scaled(0.5))))
+ red = manta_new(Phong(Color(RGBColor(0.6, 0, 0)),
+ Color(RGBColor(0.6,0.6,0.6)),
+ 32, 0.4))
+ checker1 = manta_new(CheckerTexture_Color(Color(RGBColor(.6,.6,.6)),
+ Color(RGBColor(0,0,0)),
+ Vector(1,0,0),
+ Vector(0,1,0)))
+ constant_color1 = manta_new(Constant_Color(Color(RGBColor(.6,.6,.6))))
+ checker2 = manta_new(CheckerTexture_ColorComponent(0.2, 0.5,
Vector(1,0,0),
+ Vector(0,1,0)))
+ plane_matl = manta_new(Phong(checker1, constant_color1, 32, checker2))
+ #
+ world = manta_new(Group())
+ floor = manta_new(Parallelogram(plane_matl, Vector(-20,-20,0),
+ Vector(40,0,0), Vector(0,40,0)))
+ uniformmap = manta_new(UniformMapper())
+ floor.setTexCoordMapper(uniformmap)
+ world.add(floor)
+ world.add(manta_new(Sphere(red, Vector(0,0,1.2), 1.0)))
+ scene.setObject(world)
+ #
+ lights = manta_new(LightSet())
+ lights.add(manta_new(PointLight(Vector(0,5,8),
Color(RGBColor(.6,.1,.1)))))
+ lights.add(manta_new(PointLight(Vector(5,0,8),
Color(RGBColor(.1,.6,.1)))))
+ lights.add(manta_new(PointLight(Vector(5,5,2),
Color(RGBColor(.2,.2,.2)))))
+ lights.setAmbientLight(manta_new(ConstantAmbient(Color.black())))
+ print lights
+ #
+ scene.setLights(lights)
+ scene.getRenderParameters().maxDepth = 5
+ return scene
+
+class App(wx.App) :
+
+
+
###########################################################################
+ ## OnInit
+
###########################################################################
+ def OnInit(self) :
+ self.frame = wx.Frame(parent=None, title='Bare', size=wx.Size(xres,
yres) )
+ self.frame.Show()
+
+
#######################################################################
+ # Setup manta.
+
+ # Basic settings.
+ self.engine = createManta()
+ self.engine.changeNumWorkers (numworkers)
+ self.engine.selectImageType ("rgba8")
+ self.engine.selectLoadBalancer ("workqueue")
+ self.engine.selectImageTraverser ("tiled")
+ self.engine.selectPixelSampler ("singlesample")
+ self.engine.selectRenderer ("raytracer")
+ self.engine.selectShadowAlgorithm("hard")
+
+ # Image display.
+ use_stereo = False
+ display = manta_new( GLXImageDisplay( use_stereo,
self.frame.GetHandle() ) )
+
+ # Create the camera.
+ camera = self.engine.createCamera("pinhole(-eye 3 3 2 -lookat 0 0
0.3 -up 0 0 1 -fov 60)")
+
+ # Create a display channel.
+ self.engine.createChannel( display, camera, use_stereo, xres, yres )
+
+ # Basic scene.
+ self.engine.setScene( createDefaultScenePython() )
+ self.engine.beginRendering(False)
+
+
#######################################################################
+ # Setup the UI events.
+ self.frame.Bind( wx.EVT_MOTION, self.onMotion )
+
+ return True
+
+
###########################################################################
+ ## onMotion
+
###########################################################################
+ def onMotion( self, event ):
+ pos = event.GetPosition()
+ print "Motion: %dx%d" % (pos.x, pos.y)
+ event.Skip()
+
+
+
+app = App()
+app.MainLoop()
+
+
- [MANTA] r1008 - in trunk: Engine/Display StandAlone SwigInterface, abe, 04/13/2006
Archive powered by MHonArc 2.6.16.