Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1365 - in trunk: Engine/ImageTraversers Engine/Shadows Interface SwigInterface


Chronological Thread 
  • From: abe@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1365 - in trunk: Engine/ImageTraversers Engine/Shadows Interface SwigInterface
  • Date: Thu, 3 May 2007 13:56:15 -0600 (MDT)

Author: abe
Date: Thu May  3 13:56:15 2007
New Revision: 1365

Added:
   trunk/SwigInterface/objviewer.py
Modified:
   trunk/Engine/ImageTraversers/TiledImageTraverser.cc
   trunk/Engine/ImageTraversers/TiledImageTraverser.h
   trunk/Engine/Shadows/HardShadows.h
   trunk/Engine/Shadows/NoShadows.h
   trunk/Interface/ShadowAlgorithm.h
   trunk/SwigInterface/manta.i
   trunk/SwigInterface/mantainterface.i
Log:


Added python based .obj file viewer.
A    SwigInterface/objviewer.py

Added shadows and tiled image traverser to swig interface. Added constructors 
where necessary.
M    SwigInterface/manta.i
M    SwigInterface/mantainterface.i
M    Interface/ShadowAlgorithm.h
M    Engine/ImageTraversers/TiledImageTraverser.cc
M    Engine/ImageTraversers/TiledImageTraverser.h
M    Engine/Shadows/NoShadows.h
M    Engine/Shadows/HardShadows.h


Modified: trunk/Engine/ImageTraversers/TiledImageTraverser.cc
==============================================================================
--- trunk/Engine/ImageTraversers/TiledImageTraverser.cc (original)
+++ trunk/Engine/ImageTraversers/TiledImageTraverser.cc Thu May  3 13:56:15 
2007
@@ -49,6 +49,16 @@
   return new TiledImageTraverser(args);
 }
 
+TiledImageTraverser::TiledImageTraverser( const int xtilesize_, const int 
ytilesize_ )
+  : xtilesize( xtilesize_ ), ytilesize( ytilesize_ )
+{
+  if (xtilesize == ytilesize)
+    shape = Fragment::SquareShape;
+  else
+    shape = Fragment::LineShape;
+  
+}
+
 TiledImageTraverser::TiledImageTraverser(const vector<string>& args)
 {
   xtilesize = Fragment::MaxSize;

Modified: trunk/Engine/ImageTraversers/TiledImageTraverser.h
==============================================================================
--- trunk/Engine/ImageTraversers/TiledImageTraverser.h  (original)
+++ trunk/Engine/ImageTraversers/TiledImageTraverser.h  Thu May  3 13:56:15 
2007
@@ -43,6 +43,8 @@
   class TiledImageTraverser : public ImageTraverser {
   public:
     TiledImageTraverser(const vector<string>& args);
+    TiledImageTraverser( const int xtilesize_, const int ytilesize );
+    
     virtual ~TiledImageTraverser();
     virtual void setupBegin(SetupContext&, int numChannels);
     virtual void setupDisplayChannel(SetupContext&);

Modified: trunk/Engine/Shadows/HardShadows.h
==============================================================================
--- trunk/Engine/Shadows/HardShadows.h  (original)
+++ trunk/Engine/Shadows/HardShadows.h  Thu May  3 13:56:15 2007
@@ -14,11 +14,14 @@
   public:
     HardShadows() {}
     HardShadows(const vector<string>& args);
+    HardShadows(const bool attenuateShadows_ ) :
+      attenuateShadows( attenuateShadows_ ) { }
+    
     virtual ~HardShadows();
-
+#ifndef SWIG
     virtual void computeShadows(const RenderContext& context, StateBuffer& 
stateBuffer,
                                 const LightSet* lights, RayPacket& source, 
RayPacket& shadowRays);
-
+#endif
     static ShadowAlgorithm* create(const vector<string>& args);
 
     virtual string getName() const;

Modified: trunk/Engine/Shadows/NoShadows.h
==============================================================================
--- trunk/Engine/Shadows/NoShadows.h    (original)
+++ trunk/Engine/Shadows/NoShadows.h    Thu May  3 13:56:15 2007
@@ -15,9 +15,10 @@
     NoShadows(const vector<string>& args);
     virtual ~NoShadows();
 
+#ifndef SWIG
     virtual void computeShadows(const RenderContext& context, StateBuffer& 
stateBuffer,
                                 const LightSet* lights, RayPacket& source, 
RayPacket& shadowRays);
-
+#endif
     static ShadowAlgorithm* create(const vector<string>& args);
 
     virtual string getName() const;

Modified: trunk/Interface/ShadowAlgorithm.h
==============================================================================
--- trunk/Interface/ShadowAlgorithm.h   (original)
+++ trunk/Interface/ShadowAlgorithm.h   Thu May  3 13:56:15 2007
@@ -19,6 +19,7 @@
     ShadowAlgorithm();
     virtual ~ShadowAlgorithm();
 
+#ifndef SWIG
     struct StateBuffer {
       // Most shadowAlgorithms will only need to store an int or two in the
       // state buffer, so we can get alignment guarantees and avoid cast
@@ -59,6 +60,7 @@
 
     virtual void computeShadows(const RenderContext& context, StateBuffer& 
stateBuffer,
                                 const LightSet* lights, RayPacket& source, 
RayPacket& shadowRays) = 0;
+#endif
     
     virtual std::string getName() const = 0;
     virtual std::string getSpecs() const = 0;

Modified: trunk/SwigInterface/manta.i
==============================================================================
--- trunk/SwigInterface/manta.i (original)
+++ trunk/SwigInterface/manta.i Thu May  3 13:56:15 2007
@@ -65,6 +65,18 @@
 #include <Engine/Display/OpenGLDisplay.h>
 #include <Engine/Display/PureOpenGLDisplay.h>
 #include <Engine/Display/NullDisplay.h>
+
+#include <Engine/ImageTraversers/NullImageTraverser.h>
+#include <Engine/ImageTraversers/DeadlineImageTraverser.h>
+#include <Engine/ImageTraversers/TiledImageTraverser.h>
+#include <Engine/ImageTraversers/DissolveImageTraverser.h>
+#include <Engine/ImageTraversers/DissolveTiledImageTraverser.h>
+#include <Engine/ImageTraversers/DissolveImageTraverser.h>
+#include <Engine/ImageTraversers/DissolveTiledImageTraverser.h>
+#include <Engine/ImageTraversers/FilteredImageTraverser.h>
+
+#include <Engine/Shadows/HardShadows.h>
+#include <Engine/Shadows/NoShadows.h>
 %}
 
 %manta_Release_PythonGIL(Manta::SyncDisplay::waitOnFrameReady);
@@ -75,6 +87,18 @@
 %include <Engine/Display/OpenGLDisplay.h>
 %include <Engine/Display/PureOpenGLDisplay.h>
 %include <Engine/Display/NullDisplay.h>
+
+%include <Engine/ImageTraversers/NullImageTraverser.h>
+%include <Engine/ImageTraversers/DeadlineImageTraverser.h>
+%include <Engine/ImageTraversers/TiledImageTraverser.h>
+%include <Engine/ImageTraversers/DissolveImageTraverser.h>
+%include <Engine/ImageTraversers/DissolveTiledImageTraverser.h>
+%include <Engine/ImageTraversers/DissolveImageTraverser.h>
+%include <Engine/ImageTraversers/DissolveTiledImageTraverser.h>
+%include <Engine/ImageTraversers/FilteredImageTraverser.h>
+
+%include <Engine/Shadows/HardShadows.h>
+%include <Engine/Shadows/NoShadows.h>
 
 ///////////////////////////////////////////////////////
 // UI

Modified: trunk/SwigInterface/mantainterface.i
==============================================================================
--- trunk/SwigInterface/mantainterface.i        (original)
+++ trunk/SwigInterface/mantainterface.i        Thu May  3 13:56:15 2007
@@ -155,6 +155,7 @@
 #include <Core/Util/About.h>
 #include <Interface/RayPacket.h>
 #include <Interface/AccelerationStructure.h>
+#include <Interface/ShadowAlgorithm.h>
 %}
 
 typedef int CloneDepth;
@@ -170,7 +171,7 @@
 %include <Core/Util/About.h>
 %include <Interface/RayPacket.h>
 %include <Interface/AccelerationStructure.h>
-
+%include <Interface/ShadowAlgorithm.h>
 
 
 %manta_IllegalArgument_exception(create);
@@ -405,9 +406,11 @@
 
 %{
 #include <Interface/PixelSampler.h>
+#include <Interface/ImageTraverser.h>
 %}
 
 %include <Interface/PixelSampler.h>
+%include <Interface/ImageTraverser.h>
 
 ////////////////////////////////////////////////
 // Thread stuff

Added: trunk/SwigInterface/objviewer.py
==============================================================================
--- (empty file)
+++ trunk/SwigInterface/objviewer.py    Thu May  3 13:56:15 2007
@@ -0,0 +1,127 @@
+#
+#  For more information, please see: http://software.sci.utah.edu
+#
+#  The MIT License
+#
+#  Copyright (c) 2005-2006
+#  Scientific Computing and Imaging Institute, University of Utah
+#
+#  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 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.
+#
+
+# Import wxManta gui and some system modules.
+import wxManta
+import getopt, sys
+
+# Import the manta module, the mantainterface module which was %import'ed
+# into swig/example.i is automatically included by the manta module.
+from manta import *
+
+filename = ""
+
+# Re-create the default scene using the example texture.
+def initialize_scene( frame, engine ):
+
+    # Create a scene object.
+    scene = manta_new(Scene())
+    
scene.setBackground(manta_new(ConstantBackground(ColorDB.getNamedColor("white"))))
+
+    # Load an obj file
+    
+    global filename
+    print "File: " + filename
+    
+    try:
+        obj = manta_new( ObjGroup( filename ) )
+    except InputError,e:
+        print "Error: " + e.message()
+        exit(1)
+        
+    # Create a bvh.
+    bvh = manta_new( DynBVH() )
+    bvh.rebuild( obj )
+    
+    # scene.setObject(world)
+    scene.setObject( bvh )
+    
+    # Lights.
+    lights = manta_new(LightSet())
+    lights.add(manta_new(HeadLight(1.0, Color(RGBColor(.8,.8,.9)) )))
+    lights.setAmbientLight(manta_new(ConstantAmbient(Color.black())))
+    #
+    scene.setLights(lights)
+    scene.getRenderParameters().maxDepth = 5
+
+    engine.setScene( scene )
+
+def usage():
+    print "Usage: python test.py [options]"
+    print "Where options contains one or more of:"
+    print "-n --np=<threads>"
+    print "-f --file=<filename"
+
+def main():
+
+    # Default options.
+    num_workers = 1
+
+    # Parse command line options. Note these have to conform to getopt
+    # So -np would be parsed as -n <space> p. Use --np=<threads> instead.
+    try:
+        opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["np=","file="] )
+
+    except getopt.GetoptError:
+        usage()
+        sys.exit(2)
+
+    global filename
+        
+    for o, a in opts:
+        if o in ("-n", "--np"):
+            try:
+                num_workers = int(a)
+            except ValueError:
+                usage()
+                sys.exit(2)
+                
+        if o in ("-f", "--file"):
+            filename = a
+
+        # Add additional command line args here.
+        
+
+    
###########################################################################
+    # Create the application.
+    app = wxManta.MantaApp( initialize_scene,
+                            num_workers )
+
+    
###########################################################################
+    # Perform any additional setup
+
+    app.frame.engine.setImageTraverser( manta_new( TiledImageTraverser( 32, 
32 ) ) )
+    app.frame.engine.setShadowAlgorithm( manta_new( HardShadows( True ) ) )
+
+    # Start rendering.
+    app.MainLoop()
+
+if __name__ == "__main__":
+    main()
+
+




  • [MANTA] r1365 - in trunk: Engine/ImageTraversers Engine/Shadows Interface SwigInterface, abe, 05/03/2007

Archive powered by MHonArc 2.6.16.

Top of page