Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r2120 - in trunk: Interface Model/Lights SwigInterface UserInterface scenes/csafe/python


Chronological Thread 
  • From: brownlee@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r2120 - in trunk: Interface Model/Lights SwigInterface UserInterface scenes/csafe/python
  • Date: Mon, 25 Feb 2008 15:44:18 -0700 (MST)

Author: brownlee
Date: Mon Feb 25 15:44:16 2008
New Revision: 2120

Modified:
   trunk/Interface/Light.cc
   trunk/Interface/Light.h
   trunk/Model/Lights/PointLight.cc
   trunk/Model/Lights/PointLight.h
   trunk/SwigInterface/manta.i
   trunk/SwigInterface/wxManta.py
   trunk/UserInterface/XWindowUI.cc
   trunk/scenes/csafe/python/Configuration.py
   trunk/scenes/csafe/python/Histogram.py
   trunk/scenes/csafe/python/SceneMenus.py
   trunk/scenes/csafe/python/csafe_demo.py
Log:
removed addRenderable from Light.h, instead lights now have lightType which 
can be used to typecast them and generate your own visualizations of them, 
currently it is disabled in wxManta for now until I figure out how to get 
swig to correctly typecast a Light* to a PointLight*

Modified: trunk/Interface/Light.cc
==============================================================================
--- trunk/Interface/Light.cc    (original)
+++ trunk/Interface/Light.cc    Mon Feb 25 15:44:16 2008
@@ -5,6 +5,7 @@
 
 Light::Light()
 {
+    type = LIGHT_DEFAULT;
 }
 
 Light::~Light()

Modified: trunk/Interface/Light.h
==============================================================================
--- trunk/Interface/Light.h     (original)
+++ trunk/Interface/Light.h     Mon Feb 25 15:44:16 2008
@@ -34,7 +34,10 @@
 
     void readwrite(Archive* archive);
        //! create a visible representation of the light
-       virtual Object* createRenderable() { return NULL; }
+       enum LightType { LIGHT_DEFAULT, LIGHT_POINTLIGHT };
+    int getType() { return type; }
+  protected:
+    int type;
   private:
     // Lights may not be copied.
     Light( const Light & );

Modified: trunk/Model/Lights/PointLight.cc
==============================================================================
--- trunk/Model/Lights/PointLight.cc    (original)
+++ trunk/Model/Lights/PointLight.cc    Mon Feb 25 15:44:16 2008
@@ -18,6 +18,7 @@
 PointLight::PointLight(const Vector& position, const Color& color)
   : position(position), color(color)
 {
+    type = Light::LIGHT_POINTLIGHT;
 }
 
 PointLight::~PointLight()
@@ -84,10 +85,4 @@
   MantaRTTI<Light>::readwrite(archive, *this);
   archive->readwrite("position", position);
   archive->readwrite("color", color);
-}
-
-Object* PointLight::createRenderable()
-{
-    //TODO: radius preset for now, but could be set from bounds of scene or 
something... -Carson
-    return new PrimaryRaysOnly(new Sphere(new CopyTextureMaterial(color), 
position, 0.5f));
 }

Modified: trunk/Model/Lights/PointLight.h
==============================================================================
--- trunk/Model/Lights/PointLight.h     (original)
+++ trunk/Model/Lights/PointLight.h     Mon Feb 25 15:44:16 2008
@@ -28,7 +28,6 @@
     void setColor(Color new_c) { color = new_c; }
 
     void readwrite(ArchiveElement* archive);
-    virtual Object* createRenderable();
   private:
     Vector position;
     Color color;

Modified: trunk/SwigInterface/manta.i
==============================================================================
--- trunk/SwigInterface/manta.i (original)
+++ trunk/SwigInterface/manta.i Mon Feb 25 15:44:16 2008
@@ -227,6 +227,7 @@
 %{
 // #include <Model/Materials/OpaqueShadower.h>
 // #include <Model/Materials/LitMaterial.h>
+#include <Model/Materials/CopyTextureMaterial.h>
 #include <Model/Materials/Phong.h>
 #include <Model/Materials/Lambertian.h>
 #include <Model/Materials/OrenNayar.h>
@@ -240,6 +241,7 @@
 #include <Model/Primitives/Cube.h>
 #include <Model/Primitives/Parallelogram.h>
 #include <Model/Primitives/Plane.h>
+#include <Model/Primitives/PrimaryRaysOnly.h>
 #include <Model/Primitives/Ring.h>
 #include <Model/Primitives/Sphere.h>
 #include <Model/TexCoordMappers/UniformMapper.h>
@@ -248,6 +250,7 @@
 
 //%include <Model/Materials/OpaqueShadower.h>
 // %include <Model/Materials/LitMaterial.h>
+%include <Model/Materials/CopyTextureMaterial.h>
 %include <Model/Materials/Phong.h>
 %include <Model/Materials/Lambertian.h>
 %include <Model/Materials/OrenNayar.h>
@@ -261,6 +264,7 @@
 %include <Model/Primitives/Cube.h>
 %include <Model/Primitives/Parallelogram.h>
 %include <Model/Primitives/Plane.h>
+%include <Model/Primitives/PrimaryRaysOnly.h>
 %include <Model/Primitives/Ring.h>
 %include <Model/Primitives/Sphere.h>
 %include <Model/TexCoordMappers/UniformMapper.h>

Modified: trunk/SwigInterface/wxManta.py
==============================================================================
--- trunk/SwigInterface/wxManta.py      (original)
+++ trunk/SwigInterface/wxManta.py      Mon Feb 25 15:44:16 2008
@@ -476,11 +476,12 @@
                 self.originalObject = scene.getObject()
                 group.add(self.originalObject)
                 lights = scene.getLights()
-                for i in range(lights.numLights()):
-                    renderable = lights.getLight(i).createRenderable()
-                    if renderable != None:
-                        group.add(renderable)
-                        self.lightsRenderables.append(renderable)
+ #               for i in range(lights.numLights()):
+#                    if lights.getLight(i).getType() == 
Light.LIGHT_POINTLIGHT:
+#                        renderable = manta_new( PrimaryRaysOnly(manta_new( 
Sphere(manta_new( CopyTextureMaterial( 
((PointLight*)lights.getLight(i)).getColor())), 
((PointLight*)lights.getLight(i)).getPosition(), 0.5))) )
+ #                   if renderable != None:
+ #                       group.add(renderable)
+ #                       self.lightsRenderables.append(renderable)
                 scene.setObject(group)
                 
     
###########################################################################

Modified: trunk/UserInterface/XWindowUI.cc
==============================================================================
--- trunk/UserInterface/XWindowUI.cc    (original)
+++ trunk/UserInterface/XWindowUI.cc    Mon Feb 25 15:44:16 2008
@@ -11,9 +11,13 @@
 #include <Interface/Scene.h>
 #include <Interface/Object.h>
 #include <Interface/Light.h>
+#include <Model/Lights/PointLight.h>
+#include <Model/Primitives/PrimaryRaysOnly.h>
 #include <Interface/LightSet.h>
 #include <Interface/RayPacket.h>
 #include <Model/Groups/Group.h>
+#include <Model/Primitives/Sphere.h>
+#include <Model/Materials/CopyTextureMaterial.h>
 #include <Engine/PixelSamplers/TimeViewSampler.h>
 #include <Core/Exceptions/ErrnoException.h>
 #include <Core/Exceptions/InternalError.h>
@@ -689,12 +693,15 @@
                LightSet* lights = scene->getLights();
                for(unsigned int i = 0; i < lights->numLights(); i++)
                {
-                       Object* renderable = 
lights->getLight(i)->createRenderable();
-                       if (renderable != NULL)
-                       {
-                               group->add(renderable);
-                               lightsRenderables.push_back(renderable);
-                       }
+            if (lights->getLight(i)->getType() == Light::LIGHT_POINTLIGHT)
+            {
+                Object* renderable = new PrimaryRaysOnly(new Sphere(new 
CopyTextureMaterial(((PointLight*)lights->getLight(i))->getColor()), 
((PointLight*)lights->getLight(i))->getPosition(), 0.5f));
+                if (renderable != NULL)
+                {
+                    group->add(renderable);
+                    lightsRenderables.push_back(renderable);
+                }
+            }
                }
                scene->setObject(group);
        }

Modified: trunk/scenes/csafe/python/Configuration.py
==============================================================================
--- trunk/scenes/csafe/python/Configuration.py  (original)
+++ trunk/scenes/csafe/python/Configuration.py  Mon Feb 25 15:44:16 2008
@@ -114,7 +114,7 @@
                        histValues1 = []
                        for i in range(100):
                                histValues1.append(5.0)
-                       histoGroup = Histogram.HistogramGroup(scene.frame, 
histValues1, cropColorMin, cropColorMax, 300.0, 40.0, 
scene.frame.transferFunctions[transferFID], scene.frame.tPanel, scene, 
transferFID, name)
+                       histoGroup = 
Histogram.HistogramGroup(scene.frame.panel, histValues1, cropColorMin, 
cropColorMax, 300.0, 40.0, scene.frame.transferFunctions[transferFID], 
scene.frame.tPanel, scene, transferFID, name)
                        histoGroup.SetBackgroundColour(wx.Colour(90,90,90))
                        histoGroup.group = group
                        scene.frame.histoGroups.append(histoGroup)

Modified: trunk/scenes/csafe/python/Histogram.py
==============================================================================
--- trunk/scenes/csafe/python/Histogram.py      (original)
+++ trunk/scenes/csafe/python/Histogram.py      Mon Feb 25 15:44:16 2008
@@ -599,7 +599,7 @@
            # self.vs.SetSize(100, 100)
             #self.vs.Layout()
             #self.SetMaxSize((100, 10))
-            self.parent.GetSizer().Layout()
+            self.scene.frame.panel.GetSizer().Layout()
             self.parent.Refresh()
         else:
             #self.SetSizer(self.vs)

Modified: trunk/scenes/csafe/python/SceneMenus.py
==============================================================================
--- trunk/scenes/csafe/python/SceneMenus.py     (original)
+++ trunk/scenes/csafe/python/SceneMenus.py     Mon Feb 25 15:44:16 2008
@@ -18,6 +18,7 @@
 
 
        sizer = wx.BoxSizer(wx.VERTICAL)
+       sizer.Add(wx.StaticText(panel,-1, "Sphere data nrrds/nhdrs: "))
        sizer.Add(self.lb1, -1, wx.ALL|wx.ALIGN_CENTER, 5)
        hSizer1 = wx.BoxSizer(wx.HORIZONTAL)
        self.addButton = wx.Button(panel,wx.ID_ADD)
@@ -27,6 +28,7 @@
        sizer.Add(hSizer1, 0, wx.ALL|wx.ALIGN_CENTER, 5)
 
        self.lb2 = wx.ListBox(panel, -1, (0,0), (600, 200), [], 
wx.LB_EXTENDED)
+       sizer.Add(wx.StaticText(panel,-1, "Volume data nrrds/nhdrs: "))
        sizer.Add(self.lb2, -1, wx.ALL|wx.ALIGN_CENTER, 5)
        hSizer2 = wx.BoxSizer(wx.HORIZONTAL)
        

Modified: trunk/scenes/csafe/python/csafe_demo.py
==============================================================================
--- trunk/scenes/csafe/python/csafe_demo.py     (original)
+++ trunk/scenes/csafe/python/csafe_demo.py     Mon Feb 25 15:44:16 2008
@@ -39,6 +39,8 @@
 from manta import *
 import sys, os, time, traceback, types
 import wx
+import wx.lib.scrolledpanel as scrolled
+from wx.lib.wordwrap import wordwrap
 from csafe import *
 
 
@@ -59,8 +61,8 @@
 class MyFrame(wx.Frame):
     def __init__(self, parent, ID, title):
         wx.Frame.__init__(self, parent, ID, title, 
-        wx.DefaultPosition, wx.Size(200, 150))
-        self.panel = wx.Panel(self,1)
+        wx.DefaultPosition, wx.Size(400, 450))
+        self.panel = scrolled.ScrolledPanel(self,-1, style= wx.TAB_TRAVERSAL)
         self.scene = SceneInfo.Scene()
         #self.SetForegroundColour(wx.Colour(255,0,0))
         self.SetBackgroundColour(self.scene.bgColor)
@@ -104,7 +106,17 @@
 #      self.SetBackgroundColour(self.scene.bgColor)
 
     def Menu101(self, evt):
-        self.log.write("about")
+        info = wx.AboutDialogInfo()
+        info.Name = "Manta - CSAFE Demo"
+        info.Version = "0.1"
+        info.Copyright = "(C) 2008 Steven G Parker"
+        info.Description = wordwrap(
+            "A program for running and modifying particle and volume 
datasets. By: Steve Parker, James Bigler, Carson Brownlee. MIT License.",  
+            350, wx.ClientDC(self))
+        info.WebSite = ("http://code.sci.utah.edu/Manta/index.php/CSAFE", ;
"Manta Home Page")
+
+        # Then we call wx.AboutBox giving it that info object
+        wx.AboutBox(info)
 
     def Menu102(self, evt):
        print "writing file: " + self.scene.sceneName
@@ -212,6 +224,7 @@
        self.test.setVolCMinMax(300, 2100)
        self.test.loadVolNrrds()
        self.BuildHistograms()
+        self.slider.SetRange(1, int(max(len(self.scene.nrrdFiles), 
len(self.scene.nrrdFiles2))))
 
     def BuildHistograms(self):
        for i in range(len(self.histoGroups)):
@@ -454,6 +467,9 @@
        self.playB.SetBackgroundColour(self.scene.bgColor)
        self.forwardB = wx.BitmapButton(self.panel, -1, self.forwardBmp, 
(20,20), style=wx.NO_BORDER)
        self.backB = wx.BitmapButton(self.panel, -1, self.backBmp, (20,20), 
style=wx.NO_BORDER)
+        self.slider = wx.Slider(self.panel, 100, 0, 0, 0, (30, 60), (250, 
-1), wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS )
+        self.slider.SetTickFreq(1,1)
+        self.Bind(wx.EVT_SLIDER, self.OnSlider, self.slider)
        
 #      self.Bind(wx.EVT_BUTTON, self.OnClickBack, self.backB)
 #      self.Bind(wx.EVT_BUTTON, self.OnClickPlay, self.playB)
@@ -486,9 +502,9 @@
        self.vs = vs = wx.BoxSizer( wx.VERTICAL )
         self.scene.histoVS = hvs = wx.BoxSizer(wx.VERTICAL)
        for i in range(len(self.histoGroups)):
-                hvs.Add(self.histoGroups[i], -1,wx.ALIGN_TOP, 1)
-        hvs.Add(self.tPanel, 0, wx.ALIGN_TOP, 1 )
-       vs.Add(hvs,0,wx.ALIGN_TOP,1)
+                hvs.Add(self.histoGroups[i], 0,wx.ALIGN_TOP|wx.ALIGN_CENTER, 
5)
+        hvs.Add(self.tPanel, 0, wx.ALIGN_TOP,5 )
+       vs.Add(hvs,0,wx.ALIGN_TOP|wx.ALIGN_CENTER,5)
 
        hvs2 = wx.BoxSizer(wx.HORIZONTAL)
        animCtrlTitle = wx.StaticBox(self.panel, -1, "")
@@ -504,6 +520,7 @@
         hvs2.Add(self.playB,0,wx.ALIGN_CENTER,2)
         hvs2.Add(self.forwardB,0,wx.ALIGN_CENTER,2)
         vs.Add(hvs2,0,wx.ALIGN_BOTTOM|wx.ALIGN_CENTER)
+        vs.Add(self.slider, 0, wx.ALIGN_BOTTOM|wx.ALIGN_CENTER, 1)
         #TODO: can't get the staticbox to friggin work with the buttons
 #        vs.Add( animCtrlSizer, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
         #if (self.scene.mantaFrame != None):
@@ -516,12 +533,20 @@
 
        vs.Layout()
        self.panel.SetSizer(vs)
-       vs.Fit(self)
+#      vs.Fit(self)
+#      self.panel.SetAutoLayout(True)
+       self.panel.SetupScrolling()
        #self.SetSizer(vs)
        #self.SetAutoLayout(True)
        #vs.Fit(self)
        #self.SetBackgroundColour(self.scene.bgColor)
+       self.panel.Refresh()
        self.Refresh()
+       
+    def OnSlider(self, e):
+        print str("on slider:") + str(self.slider.GetValue())
+        if (int(self.slider.GetValue()) > 0):
+           self.test.gotoFrame(int(self.slider.GetValue()) - 1)
 
     def OnClickBack(self, evt):
        self.test.backAnimation()





Archive powered by MHonArc 2.6.16.

Top of page