Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r867 - in trunk: Engine/Control Engine/Display Interface Model/Groups Model/Materials Model/Readers Model/Textures fox/FManta fox/dm_demo scenes


Chronological Thread 
  • From: abe@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r867 - in trunk: Engine/Control Engine/Display Interface Model/Groups Model/Materials Model/Readers Model/Textures fox/FManta fox/dm_demo scenes
  • Date: Wed, 25 Jan 2006 21:35:10 -0700 (MST)

Author: abe
Date: Wed Jan 25 21:35:09 2006
New Revision: 867

Added:
   trunk/Engine/Display/MultiDisplay.cc
   trunk/Engine/Display/MultiDisplay.h
   trunk/Model/Materials/Transparent.cc
   trunk/Model/Materials/Transparent.h
   trunk/fox/FManta/FMantaCapture.cc
   trunk/fox/FManta/FMantaCapture.h
Modified:
   trunk/Engine/Control/RTRT.cc
   trunk/Engine/Control/RTRT.h
   trunk/Engine/Display/CMakeLists.txt
   trunk/Engine/Display/FileDisplay.cc
   trunk/Engine/Display/FileDisplay.h
   trunk/Interface/MantaInterface.h
   trunk/Model/Groups/Group.cc
   trunk/Model/Groups/Group.h
   trunk/Model/Groups/KDTree.h
   trunk/Model/Materials/CMakeLists.txt
   trunk/Model/Readers/PlyReader.cc
   trunk/Model/Textures/NormalTexture.cc
   trunk/Model/Textures/NormalTexture.h
   trunk/fox/FManta/CMakeLists.txt
   trunk/fox/FManta/FMantaKdExplorer.cc
   trunk/fox/FManta/FMantaKdExplorer.h
   trunk/fox/dm_demo/dm_demo.cc
   trunk/scenes/boeing777.cc
Log:


Updated materials for debugging purposes.
M    scenes/boeing777.cc

M    fox/FManta/CMakeLists.txt
M    fox/FManta/FMantaKdExplorer.cc
M    fox/FManta/FMantaKdExplorer.h

Added accessors to the Group class.
M    Model/Groups/Group.cc
M    Model/Groups/Group.h
M    Model/Readers/PlyReader.cc
M    Model/Groups/KDTree.h

Added transparent material-- takes a diffuse texture for lambertian shading 
as well as an alpha texture. Uses secondary rays to provide transparency.
A    Model/Materials/Transparent.cc
A    Model/Materials/Transparent.h
M    Model/Materials/CMakeLists.txt

Modified the wireframe texture to 
M    Model/Textures/NormalTexture.cc
M    Model/Textures/NormalTexture.h

Added methods to access/change the imagedisplay of a channel.
M    Interface/MantaInterface.h
M    Engine/Control/RTRT.cc
M    Engine/Control/RTRT.h

Added a dialog box for capturing images which are displayed to files. 
MultiDisplay is an image display which sends the displayImage command to any 
number of child image displays. The dialog switches the current image display 
for a multi-image display and then adds a file image display.
A    fox/FManta/FMantaCapture.h
A    fox/FManta/FMantaCapture.cc
A    Engine/Display/MultiDisplay.cc
A    Engine/Display/MultiDisplay.h
M    Engine/Display/FileDisplay.cc
M    Engine/Display/FileDisplay.h
M    Engine/Display/CMakeLists.txt
M    fox/dm_demo/dm_demo.cc

Modified: trunk/Engine/Control/RTRT.cc
==============================================================================
--- trunk/Engine/Control/RTRT.cc        (original)
+++ trunk/Engine/Control/RTRT.cc        Wed Jan 25 21:35:09 2006
@@ -691,6 +691,20 @@
     pipelineNeedsSetup = true;
 }
 
+ImageDisplay *RTRT::getImageDisplay( int channel ) {
+
+  return channels[channel]->display;
+}
+
+void RTRT::setImageDisplay( int channel, ImageDisplay *display ) {
+
+  channels[channel]->display = display;
+  
+  // Setup the image display with the pipeline.
+  pipelineNeedsSetup = true;
+}
+
+
 void RTRT::setupPipelines(int numProcs)
 {
   // Total number of channels.

Modified: trunk/Engine/Control/RTRT.h
==============================================================================
--- trunk/Engine/Control/RTRT.h (original)
+++ trunk/Engine/Control/RTRT.h Wed Jan 25 21:35:09 2006
@@ -50,7 +50,9 @@
     virtual void getResolution(int channel, bool& stereo, int& xres, int& 
yres);
     virtual void changeResolution(int channel, int xres, int yres,
                                   bool changePipeline);
-
+    virtual ImageDisplay *getImageDisplay( int channel );
+    virtual void setImageDisplay( int channel, ImageDisplay *display );
+    
     // Image Traversers
     virtual void setImageTraverser( ImageTraverser *image_traverser_ );
     virtual bool selectImageTraverser(const string& spec);

Modified: trunk/Engine/Display/CMakeLists.txt
==============================================================================
--- trunk/Engine/Display/CMakeLists.txt (original)
+++ trunk/Engine/Display/CMakeLists.txt Wed Jan 25 21:35:09 2006
@@ -4,6 +4,8 @@
      Display/FileDisplay.h
      Display/GLXImageDisplay.cc
      Display/GLXImageDisplay.h
+     Display/MultiDisplay.cc
+     Display/MultiDisplay.h
      Display/NullDisplay.cc
      Display/NullDisplay.h
      Display/OpenGLDisplay.cc

Modified: trunk/Engine/Display/FileDisplay.cc
==============================================================================
--- trunk/Engine/Display/FileDisplay.cc (original)
+++ trunk/Engine/Display/FileDisplay.cc Wed Jan 25 21:35:09 2006
@@ -100,6 +100,25 @@
   }
 }
 
+FileDisplay::FileDisplay(const string &prefix_, const string &type_, int 
offset_, int skip_, bool fps_ ) :
+  display_fps( fps_ ),
+  current_frame( 0 ),
+  file_number( offset_ ),
+  skip_frames( skip_ ),
+  prefix( prefix_ ),
+  type_extension( type_ )
+  
+{
+
+  // Determine which writer to use.
+  if (type_extension == "tga") {
+    writer = TGA_WRITER;
+  }
+  else {
+    writer = NRRD_WRITER;
+  }
+}
+
 FileDisplay::~FileDisplay() {
 }
 

Modified: trunk/Engine/Display/FileDisplay.h
==============================================================================
--- trunk/Engine/Display/FileDisplay.h  (original)
+++ trunk/Engine/Display/FileDisplay.h  Wed Jan 25 21:35:09 2006
@@ -45,6 +45,8 @@
     enum { TGA_WRITER, NRRD_WRITER };
     
     FileDisplay(const vector<string>& args);
+    FileDisplay(const string &prefix, const string &type, int offset = 0, 
int skip = 0, bool fps = false );
+    
     virtual ~FileDisplay();
     virtual void setupDisplayChannel(SetupContext&);
     virtual void displayImage(const DisplayContext& context,

Added: trunk/Engine/Display/MultiDisplay.cc
==============================================================================
--- (empty file)
+++ trunk/Engine/Display/MultiDisplay.cc        Wed Jan 25 21:35:09 2006
@@ -0,0 +1,55 @@
+
+/*
+  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.
+*/
+
+
+#include <Engine/Display/MultiDisplay.h>
+#include <Core/Exceptions/IllegalArgument.h>
+#include <Core/Util/NotFinished.h>
+#include <Interface/Context.h>
+
+using namespace Manta;
+
+MultiDisplay::~MultiDisplay() {
+  
+}
+
+void MultiDisplay::setupDisplayChannel(SetupContext& context) {
+
+  // Pass the setup call along.
+  for (int i=0;i<display.size();++i) {
+    display[i]->setupDisplayChannel( context );
+  }
+}
+
+void MultiDisplay::displayImage(const DisplayContext& context, const Image* 
image) {
+
+  for (int i=0;i<display.size();++i) {
+    display[i]->displayImage( context, image );
+  }  
+}

Added: trunk/Engine/Display/MultiDisplay.h
==============================================================================
--- (empty file)
+++ trunk/Engine/Display/MultiDisplay.h Wed Jan 25 21:35:09 2006
@@ -0,0 +1,63 @@
+
+#ifndef Manta_Engine_MultiDisplay_h
+#define Manta_Engine_MultiDisplay_h
+
+/*
+  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.
+*/
+
+
+#include <Interface/ImageDisplay.h>
+
+#include <vector>
+
+namespace Manta {
+
+  using std::vector;
+  
+  class MultiDisplay : public ImageDisplay {
+  public:
+    MultiDisplay() { };
+    virtual ~MultiDisplay();
+
+    void add( ImageDisplay *d ) { display.push_back( d ); };
+    void set( int i, ImageDisplay *d ) { display[i] = d; };
+    ImageDisplay *get( int i ) { return display[i]; }
+    int  getSize() { return display.size(); }
+    
+    virtual void setupDisplayChannel(SetupContext&);
+    virtual void displayImage(const DisplayContext& context, const Image* 
image);
+        
+  private:
+    MultiDisplay(const MultiDisplay&);
+    MultiDisplay& operator=(const MultiDisplay&);
+
+    vector<ImageDisplay *> display;
+  };
+}
+
+#endif

Modified: trunk/Interface/MantaInterface.h
==============================================================================
--- trunk/Interface/MantaInterface.h    (original)
+++ trunk/Interface/MantaInterface.h    Wed Jan 25 21:35:09 2006
@@ -42,6 +42,8 @@
     // Create a channel given a pointer to the ImageDisplay for the channel.
     virtual int createChannel( ImageDisplay *image_display, Camera *camera,
                                bool stereo, int xres, int yres) = 0;
+    virtual ImageDisplay *getImageDisplay( int channel ) = 0;
+    virtual void setImageDisplay( int channel, ImageDisplay *display ) = 0;
                                                
     virtual void registerComponent(const string& name, ImageDisplayCreator 
display) = 0;
     virtual listType listImageDisplays() const = 0;

Modified: trunk/Model/Groups/Group.cc
==============================================================================
--- trunk/Model/Groups/Group.cc (original)
+++ trunk/Model/Groups/Group.cc Wed Jan 25 21:35:09 2006
@@ -1,5 +1,6 @@
 
 #include <Model/Groups/Group.h>
+#include <SCIRun/Core/Util/Assert.h>
 
 using namespace Manta;
 
@@ -25,6 +26,16 @@
   objs.push_back(obj);
 }
 
+void Group::set(int i, Object *obj) {
+  ASSERT( i < objs.size() );
+  objs[i] = obj;
+}
+
+Object *Group::get( int i ) {
+  ASSERT( i < objs.size() );
+  return objs[i];
+}
+
 void Group::shrinkTo(int firstNumObjs, bool deleteRemainder) 
 {
     if (deleteRemainder)
@@ -33,9 +44,9 @@
     objs.resize(firstNumObjs);
 }
 
-int Group::getNumObjs() 
+int Group::getSize() 
 {
-    return static_cast<int>(objs.size());
+  return static_cast<int>(objs.size());
 }
 
 void Group::preprocess(const PreprocessContext& context)

Modified: trunk/Model/Groups/Group.h
==============================================================================
--- trunk/Model/Groups/Group.h  (original)
+++ trunk/Model/Groups/Group.h  Wed Jan 25 21:35:09 2006
@@ -17,8 +17,11 @@
     virtual ~Group();
 
     void add(Object* obj);
+    void set( int i, Object *obj );
+    Object *get( int i );
+
     void shrinkTo(int firstNumObjs, bool deleteRemainder);
-    int getNumObjs();
+    int getSize();
 
     virtual void preprocess(const PreprocessContext&);
     virtual void intersect(const RenderContext& context, RayPacket& rays) 
const;

Modified: trunk/Model/Groups/KDTree.h
==============================================================================
--- trunk/Model/Groups/KDTree.h (original)
+++ trunk/Model/Groups/KDTree.h Wed Jan 25 21:35:09 2006
@@ -283,6 +283,7 @@
     public:
       virtual void        setRootNode( KDTreeNode *node ) = 0;
       virtual KDTreeNode *getRootNode()                   = 0;
+      virtual void        computeBounds( BBox &bounds ) const   = 0;
     };
     
     
///////////////////////////////////////////////////////////////////////////
@@ -384,13 +385,13 @@
 
       // Primitive Interface.
       virtual void intersect(const RenderContext& context, RayPacket& rays) 
const;
-      void computeNormal (const RenderContext& context, RayPacket& rays) 
const;
-      void computeBounds (const PreprocessContext& /*context*/,
+      virtual void computeNormal (const RenderContext& context, RayPacket& 
rays) const;
+      virtual void computeBounds (const PreprocessContext& /*context*/,
                           BBox &box_ ) const
       {
         box_.extendByBox( bbox );
       }
-      void computeBounds ( BBox &box_ ) const { box_.extendByBox( bbox ); }
+      virtual void computeBounds ( BBox &box_ ) const { box_.extendByBox( 
bbox ); }
 
       // This function is called to load the data.
       // np specifies the number of workers, for certain loading functions.

Modified: trunk/Model/Materials/CMakeLists.txt
==============================================================================
--- trunk/Model/Materials/CMakeLists.txt        (original)
+++ trunk/Model/Materials/CMakeLists.txt        Wed Jan 25 21:35:09 2006
@@ -16,4 +16,6 @@
      Materials/MetalMaterial.cc
      Materials/Phong.h
      Materials/Phong.cc
+     Materials/Transparent.cc
+     Materials/Transparent.h
      )

Added: trunk/Model/Materials/Transparent.cc
==============================================================================
--- (empty file)
+++ trunk/Model/Materials/Transparent.cc        Wed Jan 25 21:35:09 2006
@@ -0,0 +1,159 @@
+
+/*
+  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.
+*/
+
+#include <Model/Materials/Transparent.h>
+#include <Interface/Light.h>
+#include <Interface/LightSet.h>
+#include <Interface/Primitive.h>
+#include <Interface/RayPacket.h>
+#include <Interface/Renderer.h>
+#include <Interface/AmbientLight.h>
+#include <Interface/Context.h>
+#include <Interface/ShadowAlgorithm.h>
+#include <Model/Textures/Constant.h>
+
+using namespace Manta;
+
+Transparent::Transparent(const Color& color_, ColorComponent alpha_ )
+{
+  color = new Constant<Color>(color_);
+  alpha = new Constant<ColorComponent>(alpha_);
+}
+
+Transparent::Transparent(const Texture<Color>* color_, const 
Texture<ColorComponent> *alpha_ )
+  : color(color_), alpha(alpha_)
+{
+}
+
+Transparent::~Transparent()
+{
+}
+
+void Transparent::shade(const RenderContext& context, RayPacket& rays) const 
{
+
+  
/////////////////////////////////////////////////////////////////////////////
+  // Determine lambertian contribution.
+
+  // Compute normals
+  rays.computeNormals(context);
+  rays.computeHitPositions();
+
+  // Compute colors
+  Color diffuse[RayPacket::MaxSize];
+  color->mapValues(context, rays, diffuse);
+
+  // Compute ambient contributions for all rays
+  ColorArray totalLight;
+  activeLights->getAmbientLight()->computeAmbient(context, rays, totalLight);
+
+  // We normalized directions for proper dot product computation.
+  rays.normalizeDirections();
+
+  ShadowAlgorithm::StateBuffer stateBuffer;
+  bool firstTime = true;
+  bool done;
+  int count = 0;
+  do {
+    int map[RayPacket::MaxSize];
+    RayPacketData shadowData;
+    RayPacket shadowRays(shadowData, 0, 0, rays.getDepth(), 0);
+
+    // Call the shadowalgorithm(sa) to generate shadow rays.  We may not be
+    // able to compute all of them, so we pass along a buffer for the sa
+    // object to store it's state.  The firstTime flag tells the sa to fill
+    // in the state rather than using anything in the state buffer.  Most
+    // sas will only need to store an int or two in the statebuffer.
+    done = context.shadowAlgorithm->computeShadows(context, activeLights,
+                                                   rays, map, shadowRays,
+                                                   firstTime, stateBuffer);
+
+    // We need normalized directions for proper dot product computation.
+    shadowRays.normalizeDirections();
+
+    for(int j=shadowRays.begin(); j < shadowRays.end(); j++){
+      if(!shadowRays.wasHit(j)){
+        // Not in shadow, so compute the direct and specular contributions.
+        int to = map[j];
+        Vector normal = rays.getNormal(to);
+        Vector shadowdir = shadowRays.getDirection(j);
+        ColorComponent cos_theta = Dot(shadowdir, normal);
+        Color light = shadowRays.getColor(j);
+        for(int k = 0; k < Color::NumComponents;k++)
+          totalLight[k][to] += light[k]*cos_theta;
+      }
+    }
+    firstTime = false;
+  } while(!done);
+
+  // Sum up diffuse/specular contributions
+  for(int i = rays.begin(); i < rays.end(); i++){
+    Color result;
+    for(int j=0;j<Color::NumComponents;j++) {
+      result[j] = totalLight[j][i] * diffuse[i][j];
+    }
+
+    rays.setColor( i, result );
+  }
+
+  // Check to see what the alpha value is for this location.
+  ColorComponent alpha_values[RayPacket::MaxSize];
+  alpha->mapValues( context, rays, alpha_values );
+
+  RayPacketData secondaryData;
+  RayPacket secondaryRays(secondaryData, 0, 0, rays.getDepth(), 0);
+  int map[RayPacket::MaxSize];
+  
+  // Shoot a secondary ray for all 1.0 alpha values.
+  int size = 0;
+  for (int i=rays.begin();i<rays.end();++i) {
+    if (alpha_values[i] < (ColorComponent)1.0) {
+      secondaryRays.setOrigin   ( size, rays.getHitPosition( i ) );
+      secondaryRays.setDirection( size, rays.getDirection  ( i ) );
+      map[size] = i;
+      ++size;
+    }
+  }
+
+  // Send the secondary rays.
+  secondaryRays.resize( size );
+  context.renderer->traceRays( context, secondaryRays );
+
+  // Blend the result of each secondary ray.
+  for (int i=secondaryRays.begin();i<secondaryRays.end();++i) {
+    
+    Color second = secondaryRays.getColor( i );
+    Color first  = rays.getColor( map[i] );
+
+    // Blend the secondary ray color based on the alpha.
+    rays.setColor( map[i],
+                   (second*((ColorComponent)1.0-alpha_values[map[i]])) +
+                   (first*(alpha_values[map[i]])));
+  }
+  
+}

Added: trunk/Model/Materials/Transparent.h
==============================================================================
--- (empty file)
+++ trunk/Model/Materials/Transparent.h Wed Jan 25 21:35:09 2006
@@ -0,0 +1,57 @@
+
+#ifndef Manta_Model_Transparent_h
+#define Manta_Model_Transparent_h
+
+/*
+  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.
+*/
+
+
+#include <Model/Materials/LitMaterial.h>
+#include <Core/Color/Color.h>
+#include <Interface/Texture.h>
+
+namespace Manta{
+  
+  class LightSet;
+
+  class Transparent : public LitMaterial {
+  public:
+    Transparent( const Color& color, ColorComponent alpha_ );
+    Transparent( const Texture<Color>* color_, const Texture<ColorComponent> 
*alpha_ );
+    Transparent() {  };
+    virtual ~Transparent();
+
+    virtual void shade(const RenderContext& context, RayPacket& rays) const;
+
+  private:
+    const Texture<Color>* color;
+    const Texture<ColorComponent> *alpha;
+  };
+}
+
+#endif

Modified: trunk/Model/Readers/PlyReader.cc
==============================================================================
--- trunk/Model/Readers/PlyReader.cc    (original)
+++ trunk/Model/Readers/PlyReader.cc    Wed Jan 25 21:35:09 2006
@@ -122,7 +122,7 @@
 Manta::readPlyFile(const string fileName, AffineTransform &_t, 
                   Group *g, int gridsize, Material *m) {
      long nVertices;
-     int originalSize = g->getNumObjs();
+     int originalSize = g->getSize();
 
      t = &_t;
      

Modified: trunk/Model/Textures/NormalTexture.cc
==============================================================================
--- trunk/Model/Textures/NormalTexture.cc       (original)
+++ trunk/Model/Textures/NormalTexture.cc       Wed Jan 25 21:35:09 2006
@@ -104,14 +104,15 @@
 
///////////////////////////////////////////////////////////////////////////////
 
///////////////////////////////////////////////////////////////////////////////
 
-template<class ScratchPadInfo>
-WireframeTexture<ScratchPadInfo>::WireframeTexture( const Color &color_ ) {
-
-  texture = new Constant<Color>( color_ );
+template<class ScratchPadInfo, class ValueType>
+WireframeTexture<ScratchPadInfo, ValueType>::WireframeTexture( const 
ValueType &color_, const ValueType &wire_value_ ) :
+  wire_value( wire_value_ )
+{
+  texture = new Constant<ValueType>( color_ );
 }
 
 template<>
-void WireframeTexture<HeavyTriangle::TriangleHit>::getBarycentricCoords( 
RayPacket &rays, int which, Real &a, Real &b, Real &c ) const {
+void 
WireframeTexture<HeavyTriangle::TriangleHit,Color>::getBarycentricCoords( 
RayPacket &rays, int which, Real &a, Real &b, Real &c ) const {
 
   HeavyTriangle::TriangleHit &th =
     rays.scratchpad<HeavyTriangle::TriangleHit>(which);
@@ -122,7 +123,19 @@
 }
 
 template<>
-void WireframeTexture<Kdtree::KDTree::ScratchPadInfo>::
+void WireframeTexture<Kdtree::KDTree::ScratchPadInfo,Color>::
+getBarycentricCoords( RayPacket &rays, int which, Real &a, Real &b, Real &c 
) const {
+
+  Kdtree::KDTree::ScratchPadInfo &info =
+    rays.scratchpad<Kdtree::KDTree::ScratchPadInfo>(which);
+
+  a = info.a;
+  b = info.b;
+  c = ((Real)1.0 - info.a - info.b);
+}
+
+template<>
+void WireframeTexture<Kdtree::KDTree::ScratchPadInfo,ColorComponent>::
 getBarycentricCoords( RayPacket &rays, int which, Real &a, Real &b, Real &c 
) const {
 
   Kdtree::KDTree::ScratchPadInfo &info =
@@ -133,14 +146,14 @@
   c = ((Real)1.0 - info.a - info.b);
 }
 
-template<class ScratchPadInfo>
-void WireframeTexture<ScratchPadInfo>::mapValues(const RenderContext 
&context, RayPacket& rays, Color results[]) const {
+template<class ScratchPadInfo, class ValueType>
+void WireframeTexture<ScratchPadInfo,ValueType>::mapValues(const 
RenderContext &context, RayPacket& rays, ValueType results[]) const {
 
   // Compute the normal for each ray.
   rays.computeNormals( context );
 
   // Lookup dependent texture values.
-  Color texture_values[RayPacket::MaxSize];
+  ValueType texture_values[RayPacket::MaxSize];
   texture->mapValues( context, rays, texture_values );
 
   // Iterate over the packet and set the colors.
@@ -150,22 +163,8 @@
     Real a, b, c;
     getBarycentricCoords( rays, i, a, b, c );
 
-    // Add a wireframe.
-#if 0
-    if ((a > 0.9) && (b < 0.1) && (c < 0.1)) {
-      results[i] = Color( RGB( normal[0],normal[1], normal[2] ));      
-    }
-    else if ((b > 0.9) && (c < 0.1) && (a < 0.1)) {
-      results[i] = Color( RGB( normal[0],normal[1], normal[2] ));
-    }
-    else if ((c > 0.9) && (a < 0.1) && (b < 0.1)) {
-      results[i] = Color( RGB( normal[0],normal[1], normal[2] ));
-    }
-    else
-#endif
-      
     if ((a < 0.05) || (b < 0.05) || (c < 0.05)) {
-      results[i] = Color(RGB(0.0,0.0,0.0));
+      results[i] = wire_value;
     }
     else {
       results[i] = texture_values[i];
@@ -174,5 +173,7 @@
        }
 }
 
-template class WireframeTexture<HeavyTriangle::TriangleHit>;
-template class WireframeTexture<Kdtree::KDTree::ScratchPadInfo>;
+
+template class WireframeTexture<HeavyTriangle::TriangleHit,Color>;
+template class WireframeTexture<Kdtree::KDTree::ScratchPadInfo,Color>;
+template class 
WireframeTexture<Kdtree::KDTree::ScratchPadInfo,ColorComponent>;

Modified: trunk/Model/Textures/NormalTexture.h
==============================================================================
--- trunk/Model/Textures/NormalTexture.h        (original)
+++ trunk/Model/Textures/NormalTexture.h        Wed Jan 25 21:35:09 2006
@@ -56,15 +56,15 @@
     virtual void mapValues(const RenderContext&, RayPacket& rays, Color 
results[]) const;
   };  
   
-  template<class ScratchPadInfo>
-  class WireframeTexture : public Texture<Color> {
+  template<class ScratchPadInfo, class ValueType = Color >
+  class WireframeTexture : public Texture<ValueType> {
   public:
-    WireframeTexture( Texture<Color> *texture_ ) :
-      texture( texture_ ) { };
-    WireframeTexture( const Color &color_ );
+    WireframeTexture( Texture<ValueType> *texture_, const ValueType 
&wire_value_ ) :
+      texture( texture_ ), wire_value( wire_value_ ) { };
+    WireframeTexture( const ValueType &color_, const ValueType &wire_value_ 
);
     virtual ~WireframeTexture() { }
     
-    virtual void mapValues(const RenderContext&, RayPacket& rays, Color 
results[]) const;
+    virtual void mapValues(const RenderContext&, RayPacket& rays, ValueType 
results[]) const;
   private:
     
     
///////////////////////////////////////////////////////////////////////////
@@ -72,8 +72,10 @@
     // type explicitly. It is responsible for copying the coordinates out of 
the
     // ray packet scratch pad.
     void getBarycentricCoords( RayPacket &rays, int which,
-                               Real &a, Real &b, Real &c ) const;    
-    Texture<Color> *texture;
+                               Real &a, Real &b, Real &c ) const;
+
+    ValueType wire_value;
+    Texture<ValueType> *texture;
   };           
 
 };

Modified: trunk/fox/FManta/CMakeLists.txt
==============================================================================
--- trunk/fox/FManta/CMakeLists.txt     (original)
+++ trunk/fox/FManta/CMakeLists.txt     Wed Jan 25 21:35:09 2006
@@ -30,6 +30,8 @@
 
   # ADD_LIBRARY(FManta
   SET(FMANTA_STATIC_SRC
+    FMantaCapture.cc
+    FMantaCapture.h
     FMantaImageFrame.cc
     FMantaImageFrame.h
     FMantaKdExplorer.cc

Added: trunk/fox/FManta/FMantaCapture.cc
==============================================================================
--- (empty file)
+++ trunk/fox/FManta/FMantaCapture.cc   Wed Jan 25 21:35:09 2006
@@ -0,0 +1,160 @@
+/*
+   For more information, please see: http://software.sci.utah.edu
+
+   The MIT License
+
+   Copyright (c) 2005
+   Silicon Graphics Inc. Mountain View California.
+
+   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.
+*/
+
+#include <Engine/Display/FileDisplay.h>
+#include <Engine/Display/MultiDisplay.h>
+#include <Interface/MantaInterface.h>
+
+#include <FManta/FMantaCapture.h>
+
+
+
+
+
+
+using namespace FX;
+using namespace Manta;
+using namespace fox_manta;
+
+FXDEFMAP(FMantaCaptureDialog) FMantaCaptureDialogMap[] = {
+  
//////////////////////////////////////////////////////////////////////////////
+  //        Message_Type ID                                   Message_Handler
+  FXMAPFUNC(SEL_COMMAND, FMantaCaptureDialog::ID_RECORD,        
FMantaCaptureDialog::onRecord ),
+  FXMAPFUNC(SEL_COMMAND, FMantaCaptureDialog::ID_STOP,          
FMantaCaptureDialog::onStop ),
+};
+
+FXIMPLEMENT(FMantaCaptureDialog,FXDialogBox,FMantaCaptureDialogMap,ARRAYNUMBER(FMantaCaptureDialogMap));
+
+FMantaCaptureDialog::FMantaCaptureDialog( FMantaWindow *manta_window_,
+                                          const FXString &name, FXuint opts,
+                                          FXint x, FXint y, FXint w, FXint 
h, FXint pl,
+                                          FXint pr, FXint pt, FXint pb, 
FXint hs, FXint vs )
+
+  :
+  
+  FXDialogBox ( manta_window_->getApp(), name, opts, x, y, w, h, pl, pr, pt, 
pb, hs, vs ),
+  manta_window( manta_window_ )
+
+  
+{
+
+  FXHorizontalFrame *frame = new FXHorizontalFrame( this );
+
+  new FXLabel( frame, "Prefix: " );
+  prefix_field = new FXTextField( frame, 32 );
+  
+  type_box = new FXComboBox( frame, 4 );
+  type_box->setEditable( false );
+  type_box->appendItem( "png" );
+  type_box->appendItem( "nrrd" );
+  type_box->appendItem( "tga" );
+  
+  frame = new FXHorizontalFrame( this );
+  new FXLabel( frame, "Record every " );
+  skip_spinner = new FXSpinner( frame, 3 );
+  new FXLabel( frame, " frames." );
+  
+  record_button = new FXButton( frame, "Start", 0, this, ID_RECORD );
+  stop_button   = new FXButton( frame, "Stop", 0, this, ID_STOP );
+
+}
+
+long FMantaCaptureDialog::onRecord( FXObject *sender, FXSelector key, void 
*data ) {
+
+  string prefix = prefix_field->getText().text();
+  string type   = type_box->getText().text();
+  int    skip   = skip_spinner->getValue();
+
+  std::cerr << "Prefix: " << prefix << " Type: " << type << "\n";
+
+  manta_window->getMantaInterface()->addTransaction("capture record",
+                                                    Callback::create(this, 
&FMantaCaptureDialog::mantaRecord,
+                                                                     prefix, 
type, skip ));
+
+  skip_spinner->disable();
+  record_button->disable();
+  stop_button->enable();
+  
+  return 1;
+}
+
+long FMantaCaptureDialog::onStop( FXObject *sender, FXSelector key, void 
*data ) {
+
+  manta_window->getMantaInterface()->addTransaction("capture stop",
+                                                    Callback::create(this, 
&FMantaCaptureDialog::mantaStop ));  
+
+  skip_spinner->enable();
+  record_button->enable();
+  stop_button->disable();
+
+  return 1;
+}
+
+void FMantaCaptureDialog::mantaRecord( string prefix, string type, int skip 
) {
+
+  MantaInterface *manta_interface = manta_window->getMantaInterface();
+  
+  int channel = 0;
+
+  // Create a file image display.
+  ImageDisplay *file_display = new FileDisplay( prefix, type, 0, skip );
+  
+  // Obtain the current image display.
+  ImageDisplay *current = manta_interface->getImageDisplay( channel );
+  
+  // Create a multi-display with the current display and a new file display.
+  MultiDisplay *multi = new MultiDisplay;
+
+  multi->add( current );
+  multi->add( file_display );
+
+  // Set the multi-display for the channel.
+  manta_interface->setImageDisplay( channel, multi );
+}
+
+void FMantaCaptureDialog::mantaStop() {
+
+  MantaInterface *manta_interface = manta_window->getMantaInterface();
+  
+  int channel = 0;
+
+  // Obtain the current image display.
+  ImageDisplay *current = manta_interface->getImageDisplay( channel );
+  
+  // Create a multi-display with the current display and a new file display.
+  MultiDisplay *multi = dynamic_cast<MultiDisplay *>( current );
+  if (multi) {
+    // Restore the previous display.
+    ImageDisplay *prev = multi->get( 0 );
+    manta_interface->setImageDisplay( channel, prev );
+
+    // Delete the file and multi displays.
+    delete multi->get( 1 );
+    delete multi;
+  }
+}

Added: trunk/fox/FManta/FMantaCapture.h
==============================================================================
--- (empty file)
+++ trunk/fox/FManta/FMantaCapture.h    Wed Jan 25 21:35:09 2006
@@ -0,0 +1,93 @@
+/*
+   For more information, please see: http://software.sci.utah.edu
+
+   The MIT License
+
+   Copyright (c) 2005
+   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.
+*/
+
+#ifndef __FMANTACAPTURE_H__
+#define __FMANTACAPTURE_H__
+
+
+#include <FManta/FMantaWindow.h>
+#include <FManta/FMantaUniformNav.h>
+#include <FManta/FMantaQuakeNav.h>
+#include <FManta/FMantaTrackballNav.h>
+#include <FManta/FMantaWidgets.h>
+
+#include <Interface/MantaInterface.h>
+
+namespace fox_manta {
+
+  using namespace FX;
+  using namespace Manta;
+  using namespace std;
+
+  class FMantaWindow;
+  
+  
//////////////////////////////////////////////////////////////////////////////
+  
//////////////////////////////////////////////////////////////////////////////
+  // Capture Camera Dialog
+  
//////////////////////////////////////////////////////////////////////////////
+  
//////////////////////////////////////////////////////////////////////////////
+  class FMantaCaptureDialog : public FXDialogBox {
+    FXDECLARE(FMantaCaptureDialog)
+  private:
+
+    // Objects for playing paths.
+    FMantaWindow *manta_window;
+
+    FXTextField *prefix_field;
+    FXComboBox  *type_box;
+    FXSpinner   *skip_spinner;
+    
+    FXButton *record_button;
+    FXButton *stop_button;
+    
+  public:
+    enum {
+      ID_RECORD = FXDialogBox::ID_LAST,
+      ID_STOP,
+      ID_LAST
+    };
+    
+    FMantaCaptureDialog() { };
+    FMantaCaptureDialog( FMantaWindow *manta_window_,
+                        const FXString &name, FXuint opts=DECOR_ALL,
+                        FXint x=50,FXint y=50,FXint w=0,FXint h=0,FXint 
pl=10,
+                        FXint pr=10,FXint pt=10,FXint pb=10,FXint hs=4,FXint 
vs=4 );
+
+    void create() { FXDialogBox::create(); };
+
+    long onRecord( FXObject *sender, FXSelector key, void *data );
+    long onStop  ( FXObject *sender, FXSelector key, void *data );
+
+    void mantaRecord( string prefix, string type, int skip );
+    void mantaStop();
+  };
+
+};
+
+
+#endif

Modified: trunk/fox/FManta/FMantaKdExplorer.cc
==============================================================================
--- trunk/fox/FManta/FMantaKdExplorer.cc        (original)
+++ trunk/fox/FManta/FMantaKdExplorer.cc        Wed Jan 25 21:35:09 2006
@@ -1,6 +1,13 @@
 
 
 #include <FManta/FMantaKdExplorer.h>
+#include <Model/Groups/Group.h>
+#include <Model/Materials/Transparent.h>
+#include <Model/Primitives/Parallelogram.h>
+#include <Model/Primitives/Cube.h>
+#include <Interface/Scene.h>
+#include <Interface/Context.h>
+#include <Core/Geometry/BBox.h>
 
 
 using namespace fox_manta;
@@ -14,7 +21,8 @@
        FXMAPFUNC(SEL_COMMAND, FMantaKdExplorerDialog::ID_RESET_ROOT,         
FMantaKdExplorerDialog::onResetRoot ),
        FXMAPFUNC(SEL_COMMAND, FMantaKdExplorerDialog::ID_SET_PARENT,         
FMantaKdExplorerDialog::onSetParent ),
        FXMAPFUNC(SEL_COMMAND, FMantaKdExplorerDialog::ID_SET_LEFT,           
FMantaKdExplorerDialog::onSetLeft ),
-       FXMAPFUNC(SEL_COMMAND, FMantaKdExplorerDialog::ID_SET_RIGHT,          
FMantaKdExplorerDialog::onSetRight )  
+       FXMAPFUNC(SEL_COMMAND, FMantaKdExplorerDialog::ID_SET_RIGHT,          
FMantaKdExplorerDialog::onSetRight )
+
 };     
 
 
FXIMPLEMENT(FMantaKdExplorerDialog,FXDialogBox,FMantaKdExplorerDialogMap,ARRAYNUMBER(FMantaKdExplorerDialogMap));
@@ -27,11 +35,17 @@
                                                                              
                                  FXint pr,FXint pt,FXint pb,FXint hs,FXint 
vs ) : 
        manta_window( manta_window_ ),
        kdtree( kdtree_ ),
+  plane_group( 0 ),
        FXDialogBox ( manta_window_->getApp(), name, opts, x, y, w, h, pl, 
pr, pt, pb, hs, vs ) 
 {
 
   // Add the root node to the node_stack.
   node_stack.push_back( kdtree->getRootNode() );
+
+  // Add the initial bbox to the stack.
+  BBox bbox;
+  kdtree->computeBounds( bbox );
+  bbox_stack.push_back( bbox );
   
        manta_interface = manta_window->getMantaInterface();
 
@@ -56,9 +70,34 @@
 
 
   update_buttons();
+
+  
/////////////////////////////////////////////////////////////////////////////
+  // Create materials for splitting planes.
+  material[0] = new Transparent( Color( RGB(1, 0, 0 )), 0.5 );
+  material[1] = new Transparent( Color( RGB(0, 1, 0 )), 0.5 );
+  material[2] = new Transparent( Color( RGB(0, 0, 1 )), 0.5 );
+  material[3] = new Transparent( Color( RGB(0, 1, 1 )), 0.1 );
+
+}
+
+void FMantaKdExplorerDialog::show() {
+
+  FXDialogBox::show();
+  
+  BBox bbox = bbox_stack.back();
+  manta_interface->addTransaction( "Update Plane", Callback::create( this, 
&FMantaKdExplorerDialog::updatePlane, bbox ) );
+  
+}
+
+void FMantaKdExplorerDialog::hide() {
+
+  FXDialogBox::hide();
   
+  manta_interface->addTransaction( "Remove Plane", Callback::create( this, 
&FMantaKdExplorerDialog::removePlane ) );  
+
 }
 
+
 FMantaKdExplorerDialog::~FMantaKdExplorerDialog() {
 
   // Restore the root node.
@@ -124,6 +163,13 @@
   KDTreeNode *root = node_stack.front();
   node_stack.clear();
   node_stack.push_back( root );
+
+  BBox bbox = bbox_stack.front();
+  bbox_stack.clear();
+  bbox_stack.push_back( bbox );
+
+  // Update bbox and split plane.
+  manta_interface->addTransaction( "Update Plane", Callback::create( this, 
&FMantaKdExplorerDialog::updatePlane, bbox ) );
   
   // Update manta.
   manta_interface->addTransaction( "Reset Root", Callback::create( kdtree, 
&KDTreeDebug::setRootNode, root ) );
@@ -141,10 +187,16 @@
     // Get the node
     node_stack.pop_back();
     KDTreeNode *root = node_stack.back();
-  
+    
     // Update manta.
     manta_interface->addTransaction( "Set Parent", Callback::create( kdtree, 
&KDTreeDebug::setRootNode, root ) );
 
+    // Update bbox and split plane.
+    bbox_stack.pop_back();
+    BBox bbox = bbox_stack.back();
+    manta_interface->addTransaction( "Update Plane", Callback::create( this, 
&FMantaKdExplorerDialog::updatePlane, bbox ) );
+
+    
     // Update buttons.
     update_buttons();
 
@@ -169,6 +221,16 @@
     // Update manta.
     manta_interface->addTransaction( "Set Left", Callback::create( kdtree, 
&KDTreeDebug::setRootNode, child ) );
 
+    // Update bbox and plane.
+    BBox bbox = bbox_stack.back();
+    Point max = bbox[1];
+    max[root->axis()] = root->split();
+
+    BBox new_bbox( bbox[0], max );
+    bbox_stack.push_back( new_bbox );
+    
+    manta_interface->addTransaction( "Update Plane", Callback::create( this, 
&FMantaKdExplorerDialog::updatePlane, new_bbox ) );
+            
     // Update buttons.
     update_buttons();
   }
@@ -192,9 +254,93 @@
     // Update manta.
     manta_interface->addTransaction( "Set Right", Callback::create( kdtree, 
&KDTreeDebug::setRootNode, child ) );
 
+    // Update bbox and plane.
+    BBox bbox = bbox_stack.back();
+    Point min = bbox[0];
+    min[root->axis()] = root->split();
+
+    BBox new_bbox( min, bbox[1] );
+    bbox_stack.push_back( new_bbox );
+    
+    manta_interface->addTransaction( "Update Plane", Callback::create( this, 
&FMantaKdExplorerDialog::updatePlane, new_bbox ) );
+    
     // Update buttons.
     update_buttons();
   }
   
   return 1;
+}
+
+void FMantaKdExplorerDialog::updatePlane( const BBox bbox ) {
+
+  // Check to see what is on top of the scene graph.
+  if (plane_group == 0) {
+    
+    // Add a group to the top of the scene graph.
+    plane_group = new Group;
+
+    Object *scene_root = manta_interface->getScene()->getObject();
+    plane_group->add( scene_root );
+
+    manta_interface->getScene()->setObject( plane_group );
+  }
+  
+  // Create a parallelogram and add it to the plane group.
+  KDTreeNode *node = kdtree->getRootNode();
+  Point anchor = bbox[0];
+  anchor[node->axis()] = node->split();
+
+  Point amax = bbox[1];
+  amax[node->axis()] = node->split();
+
+  Vector diag = amax - anchor;
+
+  int v1i = (node->axis()+1)%3;
+  int v2i = (node->axis()+2)%3;
+
+  Vector v1 = diag;
+  Vector v2 = diag;
+
+  v1[v1i] = 0;
+  v2[v2i] = 0;
+
+  Object *parallelogram = new Parallelogram( material[node->axis()],
+                                 anchor, v1, v2 );
+
+  Object *bounds = new Cube( material[3], bbox[0], bbox[1] );
+
+  // Preprocess.
+  PreprocessContext context( manta_interface, 
manta_interface->getScene()->getLights() );
+  parallelogram->preprocess( context );
+  bounds->preprocess( context );
+  
+  // Check to see if the plane group already has a parallelogram.
+  // If so delete it.
+  if (plane_group->getSize() == 3) {
+    Object *old = plane_group->get(1);
+    delete old;
+    old = plane_group->get(2);
+    delete old;
+    
+    plane_group->set( 1, parallelogram );
+    plane_group->set( 2, bounds );
+  }
+  else {
+    plane_group->add( parallelogram );
+    plane_group->add( bounds );
+  }
+  
+}
+
+void FMantaKdExplorerDialog::removePlane() {
+
+  if (plane_group) {
+
+    // Replace the plane group in the kdtree.
+    manta_interface->getScene()->setObject( plane_group->get( 0 ) );
+    
+    // Clean up the plane group.
+    delete plane_group;
+    plane_group = 0;
+  }
 }

Modified: trunk/fox/FManta/FMantaKdExplorer.h
==============================================================================
--- trunk/fox/FManta/FMantaKdExplorer.h (original)
+++ trunk/fox/FManta/FMantaKdExplorer.h Wed Jan 25 21:35:09 2006
@@ -9,6 +9,11 @@
 using namespace Manta;
 
 #include <Model/Groups/KDTree.h>
+#include <Interface/Material.h>
+
+namespace Manta {
+  class Group;
+};
 
 using namespace Manta::Kdtree;
 
@@ -50,9 +55,16 @@
 
     // Saved nodes.
     list<KDTreeNode *> node_stack;
+    list<BBox>         bbox_stack;
+
+    // Split plane
+    Group *plane_group;
+    Material *material[4];
 
     // Helper functions
     void update_buttons();
+    void updatePlane( const BBox bbox );
+    void removePlane();
     
   public:
     enum {
@@ -71,13 +83,15 @@
                   FXint pr=10,FXint pt=10,FXint pb=10,FXint hs=4,FXint vs=4 
);
     virtual ~FMantaKdExplorerDialog();
                
-    void create() { FXDialogBox::create(); show( PLACEMENT_DEFAULT ); };
+    void create() { FXDialogBox::create(); /*show( PLACEMENT_DEFAULT );*/ 
show(); };
        
     long onResetRoot( FXObject *sender, FXSelector key, void *data );
     long onSetParent( FXObject *sender, FXSelector key, void *data );
     long onSetLeft  ( FXObject *sender, FXSelector key, void *data );
     long onSetRight ( FXObject *sender, FXSelector key, void *data );
 
+    virtual void show();
+    virtual void hide();
   };
 
 };

Modified: trunk/fox/dm_demo/dm_demo.cc
==============================================================================
--- trunk/fox/dm_demo/dm_demo.cc        (original)
+++ trunk/fox/dm_demo/dm_demo.cc        Wed Jan 25 21:35:09 2006
@@ -50,6 +50,7 @@
 #include <FManta/FMantaWidgets.h>
 
 #include <FManta/FMantaStereo.h>
+#include <FManta/FMantaCapture.h>
 #include <FManta/FMantaTransparent.h>
 #include <FManta/FMantaKdExplorer.h>
 
@@ -152,7 +153,7 @@
        
     manta_interface->setScenePath         (".");
     manta_interface->changeNumWorkers     ( np );
-    manta_interface->selectImageType      ( "rgba8" );
+    manta_interface->selectImageType      ( "rgb8" );
     manta_interface->selectLoadBalancer   ( "workqueue" );
     manta_interface->selectRenderer       ( "raytracer" );
     manta_interface->selectShadowAlgorithm( "hard" );    
@@ -278,6 +279,9 @@
     // Set the manta interface for the application.
     manta_window.setMantaInterface( manta_interface, manta_channel );
 
+    // Add an image capture dialog.
+    manta_window.addExtraOptionsDialog( "Capture", new FMantaCaptureDialog( 
&manta_window, "Capture" ));
+    
     // Check to see if we should enable the stereo dialog.
     if (use_stereo) {
       manta_window.addExtraOptionsDialog( "Stereo", new FMantaStereoDialog( 
&manta_window, "Stereo" ));

Modified: trunk/scenes/boeing777.cc
==============================================================================
--- trunk/scenes/boeing777.cc   (original)
+++ trunk/scenes/boeing777.cc   Wed Jan 25 21:35:09 2006
@@ -65,6 +65,7 @@
 
 #include <Model/Materials/AmbientOcclusion.h>
 #include <Model/Materials/Flat.h>
+#include <Model/Materials/Transparent.h>
 #include <Model/Textures/Constant.h>
 
 
@@ -217,10 +218,10 @@
     kd_material = new Flat( new NormalTexture() );
     break;
   case MTL_RAYDIRECTION:
-    kd_material = new Lambertian( new 
WireframeTexture<KDTree::ScratchPadInfo>( new RaySignTexture() ) );
+    kd_material = new Lambertian( new 
WireframeTexture<KDTree::ScratchPadInfo>( new RaySignTexture(), Color(RGB(0, 
0, 0)) ) );
     break;
   case MTL_WIRE:
-    kd_material = new Flat( new WireframeTexture<KDTree::ScratchPadInfo>( 
new KDTreeTexture() ) );
+    kd_material = new Transparent( new NormalTexture(), new 
WireframeTexture<KDTree::ScratchPadInfo,ColorComponent>( (ColorComponent)0.1, 
(ColorComponent)1.0) );
     break;
   };
        




  • [MANTA] r867 - in trunk: Engine/Control Engine/Display Interface Model/Groups Model/Materials Model/Readers Model/Textures fox/FManta fox/dm_demo scenes, abe, 01/25/2006

Archive powered by MHonArc 2.6.16.

Top of page