Text archives Help
- From: bigler@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r365 - swig/SwigInterface
- Date: Mon, 6 Jun 2005 11:36:34 -0600 (MDT)
Author: bigler
Date: Mon Jun 6 11:36:34 2005
New Revision: 365
Added:
swig/SwigInterface/manta-run.py
swig/SwigInterface/manta.cc
Modified:
swig/SwigInterface/CMakeLists.txt
swig/SwigInterface/manta.i
Log:
Get the default scene to start up in python.
CMakeLists.txt
Added manta.cc to swig extension.
manta-run.py
Example python script to start up manta.
manta.cc
createDefaultScene function defined.
manta.i
Added UserInterface definition.
Added a bunch of pipeline functions for RTRTInterface class.
Removed weird double class definition that I suspect was
supposed to be RTRT (not RTRTInterface). Anyway you don't need it.
Added extern to createDefaultScene found in manta.cc
Modified: swig/SwigInterface/CMakeLists.txt
==============================================================================
--- swig/SwigInterface/CMakeLists.txt (original)
+++ swig/SwigInterface/CMakeLists.txt Mon Jun 6 11:36:34 2005
@@ -17,7 +17,7 @@
SET_SOURCE_FILES_PROPERTIES(manta.i PROPERTIES CPLUSPLUS ON)
#SET_SOURCE_FILES_PROPERTIES(manta.i PROPERTIES SWIG_FLAGS "-includeall")
-SWIG_ADD_MODULE(manta python manta.i)
+SWIG_ADD_MODULE(manta python manta.i manta.cc)
SWIG_LINK_LIBRARIES(manta
${PYTHON_LIBRARIES}
Added: swig/SwigInterface/manta-run.py
==============================================================================
--- (empty file)
+++ swig/SwigInterface/manta-run.py Mon Jun 6 11:36:34 2005
@@ -0,0 +1,18 @@
+import manta
+
+engine = manta.createRTRT()
+engine.changeNumWorkers(1)
+engine.selectImageType("rgba8")
+engine.selectLoadBalancer("workqueue")
+engine.selectImageTraverser("tiled")
+engine.selectPixelSampler("singlesample")
+engine.selectRenderer("raytracer")
+engine.selectShadowAlgorithm("hard")
+currentCamera = engine.createCamera("pinhole(-eye 3 3 2 -lookat 0 0 0.3 -up
0 0 1 -fov 60)")
+xres = 512
+yres = 512
+xinterface = engine.createUserInterface("X")
+xinterface.startup()
+engine.createChannel("opengl", currentCamera, 0, xres, yres)
+engine.setScene(manta.createDefaultScene())
+engine.beginRendering(1)
Added: swig/SwigInterface/manta.cc
==============================================================================
--- (empty file)
+++ swig/SwigInterface/manta.cc Mon Jun 6 11:36:34 2005
@@ -0,0 +1,60 @@
+//#include <Interface/RTRTInterface.h>
+#include <Core/Color/ColorDB.h>
+//#include <Core/Util/Args.h>
+//#include <Interface/Callback.h>
+#include <Interface/Scene.h>
+//#include <Interface/UserInterface.h>
+
+#include <Interface/LightSet.h>
+#include <Model/AmbientLights/ConstantAmbient.h>
+#include <Model/Backgrounds/ConstantBackground.h>
+#include <Model/Lights/PointLight.h>
+#include <Model/Textures/Constant.h>
+#include <Model/Textures/CheckerTexture.h>
+#include <Model/Materials/Phong.h>
+#include <Model/Groups/Group.h>
+#include <Model/Primitives/Parallelogram.h>
+#include <Model/Primitives/Sphere.h>
+#include <Model/TexCoordMappers/UniformMapper.h>
+
+using namespace Manta;
+
+Manta::Scene* createDefaultScene()
+{
+ // Create a default scene. This scene is used for benchmarks, so
+ // please do not change it. Please create a new scene instead
+ Scene* scene = new Scene();
+ scene->setBackground(new
ConstantBackground(ColorDB::getNamedColor("SkyBlue3")*0.5));
+ Material* red=new Phong(Color(RGBColor(.6,0,0)),
+ Color(RGBColor(.6,.6,.6)), 32, 0.4);
+
+ Material* plane_matl = new Phong(new
CheckerTexture<Color>(Color(RGBColor(.6,.6,.6)),
+
Color(RGBColor(0,0,0)),
+ Vector(1,0,0),
+ Vector(0,1,0)),
+ new
Constant<Color>(Color(RGBColor(.6,.6,.6))),
+ 32,
+ new CheckerTexture<double>(0.2, 0.5,
+ Vector(1,0,0),
+ Vector(0,1,0)));
+
+
+ Group* world = new Group();
+ Primitive* floor = new Parallelogram(plane_matl, Point(-20,-20,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);
+ world->add(floor);
+ world->add(new Sphere(red, Point(0,0,1.2), 1.0));
+ scene->setObject(world);
+
+ LightSet* lights = new LightSet();
+ lights->add(new PointLight(Point(0,5,8), Color(RGBColor(.6,.1,.1))));
+ lights->add(new PointLight(Point(5,0,8), Color(RGBColor(.1,.6,.1))));
+ lights->add(new PointLight(Point(5,5,2), Color(RGBColor(.2,.2,.2))));
+ lights->setAmbientLight(new ConstantAmbient(Color::black()));
+ scene->setLights(lights);
+ scene->getRenderParameters().maxDepth = 5;
+ return scene;
+}
Modified: swig/SwigInterface/manta.i
==============================================================================
--- swig/SwigInterface/manta.i (original)
+++ swig/SwigInterface/manta.i Mon Jun 6 11:36:34 2005
@@ -4,29 +4,67 @@
%include "std_vector.i"
%{
#include <Interface/RTRTInterface.h>
+#include <Interface/UserInterface.h>
%}
namespace std {
%template(vectorStr) vector<string>;
};
+
+%{
+ typedef std::vector<std::string> Manta::listType;
+%}
+
+%include <Interface/UserInterface.h>
namespace Manta {
using namespace std;
class Camera;
+ class Scene;
class RTRTInterface {
public:
+ virtual int createChannel(const string& modespec, Camera* camera,
+ bool stereo, int xres, int yres) = 0;
+ virtual void changeResolution(int channel, int xres, int yres,
+ bool changePipeline) = 0;
+ virtual bool selectImageTraverser(const string& spec) = 0;
+ virtual bool selectImageType(const string& spec) = 0;
+ virtual bool selectLoadBalancer(const string& spec) = 0;
+ virtual bool selectPixelSampler(const string& spec) = 0;
+ virtual bool selectRenderer(const string& spec) = 0;
+ virtual bool selectShadowAlgorithm(const string& spec) = 0;
+ virtual bool addIdleMode(const string& spec) = 0;
+ virtual Camera* createCamera(const string& spec) = 0;
+ virtual UserInterface* createUserInterface(const string& spec) = 0;
+
+ virtual listType listImageTraversers() const = 0;
+ virtual listType listImageTypes() const = 0;
+ virtual listType listLoadBalancers() const = 0;
+ virtual listType listPixelSamplers() const = 0;
+ virtual listType listRenderers() const = 0;
+ virtual listType listShadowAlgorithms() const = 0;
+ virtual listType listIdleModes() const = 0;
+ virtual listType listCameras() const = 0;
+ virtual listType listGroups() const = 0;
+
+ // Scenes
+ virtual bool haveScene() = 0;
+ virtual void setScene(Scene* scene) = 0;
+ virtual bool readScene(const string& sceneSpec) = 0;
virtual void setScenePath(const string& path) = 0;
+
+ // Workers
virtual void changeNumWorkers(int new_num_procs) = 0;
- virtual Camera* createCamera(const string& spec) = 0;
- };
- class RTRTInterface: public RTRTInterface {
- virtual void setScenePath(const string& path);
- virtual void changeNumWorkers(int new_num_procs);
- virtual Camera* createCamera(const string& spec);
+ // Control
+ virtual void beginRendering(bool blockUntilFinished) = 0;
+ virtual void blockUntilFinished() = 0;
+ virtual void finish() = 0;
};
RTRTInterface* createRTRT();
}
+
+extern Manta::Scene* createDefaultScene();
- [MANTA] r365 - swig/SwigInterface, bigler, 06/06/2005
Archive powered by MHonArc 2.6.16.