Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r557 - in branches/AFR: . Core Core/Color Core/Geometry Engine Engine/Control Engine/Display Engine/IdleModes Engine/ImageTraversers Engine/LoadBalancers Engine/PixelSamplers Engine/Renderers Engine/Shadows Image Interface Model Model/Cameras Model/Groups Model/Intersections Model/Lights Model/Materials Model/MiscObjects Model/Primitives Model/Readers Model/Readers/glm Model/TexCoordMappers Model/Textures Readers Readers/DoubleEagle SCIRun/Core StandAlone UserInterface fox glfw histx scenes


Chronological Thread 
  • From: abe@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r557 - in branches/AFR: . Core Core/Color Core/Geometry Engine Engine/Control Engine/Display Engine/IdleModes Engine/ImageTraversers Engine/LoadBalancers Engine/PixelSamplers Engine/Renderers Engine/Shadows Image Interface Model Model/Cameras Model/Groups Model/Intersections Model/Lights Model/Materials Model/MiscObjects Model/Primitives Model/Readers Model/Readers/glm Model/TexCoordMappers Model/Textures Readers Readers/DoubleEagle SCIRun/Core StandAlone UserInterface fox glfw histx scenes
  • Date: Mon, 19 Sep 2005 03:34:30 -0600 (MDT)

Author: abe
Date: Mon Sep 19 03:34:20 2005
New Revision: 557

Added:
   branches/AFR/Engine/Display/GLXImageDisplay.cc
      - copied, changed from r510, 
branches/itanium2/Engine/Display/GLXImageDisplay.cc
   branches/AFR/Engine/Display/GLXImageDisplay.h
      - copied, changed from r510, 
branches/itanium2/Engine/Display/GLXImageDisplay.h
   branches/AFR/Model/Groups/FrustumKDTree.cc
      - copied unchanged from r556, 
branches/itanium2/Model/Groups/FrustumKDTree.cc
   branches/AFR/Model/Groups/FrustumKDTree.h
      - copied unchanged from r556, 
branches/itanium2/Model/Groups/FrustumKDTree.h
   branches/AFR/Model/Groups/KDTree.cc
      - copied unchanged from r556, branches/itanium2/Model/Groups/KDTree.cc
   branches/AFR/Model/Groups/KDTree.h
      - copied unchanged from r556, branches/itanium2/Model/Groups/KDTree.h
   branches/AFR/Model/Groups/KDTreeLoader.cc
      - copied unchanged from r556, 
branches/itanium2/Model/Groups/KDTreeLoader.cc
   branches/AFR/Model/Groups/KDTreeLoader.h
      - copied unchanged from r556, 
branches/itanium2/Model/Groups/KDTreeLoader.h
   branches/AFR/Model/Groups/PsiGammaTable.cc
      - copied unchanged from r556, 
branches/itanium2/Model/Groups/PsiGammaTable.cc
   branches/AFR/Model/Groups/PsiGammaTable.h
      - copied unchanged from r556, 
branches/itanium2/Model/Groups/PsiGammaTable.h
   branches/AFR/Model/Groups/RealisticBvh.cc
      - copied unchanged from r556, 
branches/itanium2/Model/Groups/RealisticBvh.cc
   branches/AFR/Model/Groups/RealisticBvh.h
      - copied unchanged from r556, 
branches/itanium2/Model/Groups/RealisticBvh.h
   branches/AFR/Model/Groups/TransparentKDTree.cc
      - copied unchanged from r556, 
branches/itanium2/Model/Groups/TransparentKDTree.cc
   branches/AFR/Model/Groups/TransparentKDTree.h
      - copied unchanged from r556, 
branches/itanium2/Model/Groups/TransparentKDTree.h
   branches/AFR/Model/Groups/VolumeDesc.h
      - copied unchanged from r556, 
branches/itanium2/Model/Groups/VolumeDesc.h
   branches/AFR/Model/Groups/VolumeGrid.h
      - copied unchanged from r556, 
branches/itanium2/Model/Groups/VolumeGrid.h
   branches/AFR/Model/Groups/varray.h   (props changed)
      - copied unchanged from r556, branches/itanium2/Model/Groups/varray.h
   branches/AFR/Model/Intersections/
      - copied from r510, branches/itanium2/Model/Intersections/
   branches/AFR/Model/Intersections/AxisAlignedBox.cc
      - copied unchanged from r556, 
branches/itanium2/Model/Intersections/AxisAlignedBox.cc
   branches/AFR/Model/Intersections/AxisAlignedBox.h
      - copied unchanged from r556, 
branches/itanium2/Model/Intersections/AxisAlignedBox.h
   branches/AFR/Model/Intersections/CMakeLists.txt
      - copied unchanged from r556, 
branches/itanium2/Model/Intersections/CMakeLists.txt
   branches/AFR/Model/Intersections/Plane.h
      - copied, changed from r556, 
branches/itanium2/Model/Intersections/Plane.h
   branches/AFR/Model/Intersections/TriangleEdge.h
      - copied unchanged from r556, 
branches/itanium2/Model/Intersections/TriangleEdge.h
   branches/AFR/Model/Lights/HeadLight.cc
      - copied unchanged from r556, 
branches/itanium2/Model/Lights/HeadLight.cc
   branches/AFR/Model/Lights/HeadLight.h
      - copied unchanged from r556, branches/itanium2/Model/Lights/HeadLight.h
   branches/AFR/Model/Materials/AmbientOcclusion.cc
      - copied unchanged from r556, 
branches/itanium2/Model/Materials/AmbientOcclusion.cc
   branches/AFR/Model/Materials/AmbientOcclusion.h
      - copied unchanged from r556, 
branches/itanium2/Model/Materials/AmbientOcclusion.h
   branches/AFR/Model/Materials/CopyColorMaterial.cc
      - copied unchanged from r556, 
branches/itanium2/Model/Materials/CopyColorMaterial.cc
   branches/AFR/Model/Materials/CopyColorMaterial.h
      - copied unchanged from r556, 
branches/itanium2/Model/Materials/CopyColorMaterial.h
   branches/AFR/Model/Materials/LambertianAlt.cc
      - copied unchanged from r556, 
branches/itanium2/Model/Materials/LambertianAlt.cc
   branches/AFR/Model/Materials/LambertianAlt.h
      - copied unchanged from r556, 
branches/itanium2/Model/Materials/LambertianAlt.h
   branches/AFR/Model/Materials/NormalMaterial.cc
      - copied unchanged from r556, 
branches/itanium2/Model/Materials/NormalMaterial.cc
   branches/AFR/Model/Materials/NormalMaterial.h
      - copied unchanged from r556, 
branches/itanium2/Model/Materials/NormalMaterial.h
   branches/AFR/Model/MiscObjects/CuttingPlane.cc
      - copied unchanged from r510, 
branches/itanium2/Model/MiscObjects/CuttingPlane.cc
   branches/AFR/Model/MiscObjects/CuttingPlane.h
      - copied, changed from r510, 
branches/itanium2/Model/MiscObjects/CuttingPlane.h
   branches/AFR/Model/Primitives/BvhTriangleMesh.cc
      - copied unchanged from r556, 
branches/itanium2/Model/Primitives/BvhTriangleMesh.cc
   branches/AFR/Model/Primitives/BvhTriangleMesh.h
      - copied unchanged from r556, 
branches/itanium2/Model/Primitives/BvhTriangleMesh.h
   branches/AFR/Model/Readers/glm/
      - copied from r556, branches/itanium2/Model/Readers/glm/
   branches/AFR/Model/Readers/glm/glm.cc
      - copied unchanged from r556, branches/itanium2/Model/Readers/glm/glm.cc
   branches/AFR/Model/Readers/glm/glm.h
      - copied unchanged from r556, branches/itanium2/Model/Readers/glm/glm.h
   branches/AFR/Model/Textures/CMakeLists.txt
      - copied unchanged from r556, 
branches/itanium2/Model/Textures/CMakeLists.txt
   branches/AFR/Readers/DoubleEagle/
      - copied from r556, branches/itanium2/Readers/DoubleEagle/
   branches/AFR/Readers/DoubleEagle/vn2v3c1.cc
      - copied unchanged from r556, 
branches/itanium2/Readers/DoubleEagle/vn2v3c1.cc
   branches/AFR/StandAlone/barrier_test.cc
      - copied unchanged from r556, 
branches/itanium2/StandAlone/barrier_test.cc
   branches/AFR/StandAlone/frust-test.cc
      - copied unchanged from r556, branches/itanium2/StandAlone/frust-test.cc
   branches/AFR/StandAlone/manta_tile_size.pl
      - copied unchanged from r556, 
branches/itanium2/StandAlone/manta_tile_size.pl
   branches/AFR/fox/
      - copied from r510, branches/itanium2/fox/
   branches/AFR/fox/CMakeLists.txt
      - copied, changed from r556, branches/itanium2/fox/CMakeLists.txt
   branches/AFR/fox/FMantaImageFrame.cc
      - copied unchanged from r556, branches/itanium2/fox/FMantaImageFrame.cc
   branches/AFR/fox/FMantaImageFrame.h
      - copied unchanged from r556, branches/itanium2/fox/FMantaImageFrame.h
   branches/AFR/fox/FMantaNavigator.cc
      - copied unchanged from r556, branches/itanium2/fox/FMantaNavigator.cc
   branches/AFR/fox/FMantaNavigator.h
      - copied unchanged from r556, branches/itanium2/fox/FMantaNavigator.h
   branches/AFR/fox/FMantaQuakeNav.cc
      - copied unchanged from r556, branches/itanium2/fox/FMantaQuakeNav.cc
   branches/AFR/fox/FMantaQuakeNav.h
      - copied unchanged from r556, branches/itanium2/fox/FMantaQuakeNav.h
   branches/AFR/fox/FMantaTrackballNav.cc
      - copied unchanged from r556, 
branches/itanium2/fox/FMantaTrackballNav.cc
   branches/AFR/fox/FMantaTrackballNav.h
      - copied unchanged from r556, branches/itanium2/fox/FMantaTrackballNav.h
   branches/AFR/fox/FMantaUniformNav.cc
      - copied unchanged from r556, branches/itanium2/fox/FMantaUniformNav.cc
   branches/AFR/fox/FMantaUniformNav.h
      - copied unchanged from r556, branches/itanium2/fox/FMantaUniformNav.h
   branches/AFR/fox/FMantaWidgets.cc
      - copied unchanged from r556, branches/itanium2/fox/FMantaWidgets.cc
   branches/AFR/fox/FMantaWidgets.h
      - copied unchanged from r556, branches/itanium2/fox/FMantaWidgets.h
   branches/AFR/fox/FMantaWindow.cc
      - copied unchanged from r556, branches/itanium2/fox/FMantaWindow.cc
   branches/AFR/fox/FMantaWindow.h
      - copied unchanged from r556, branches/itanium2/fox/FMantaWindow.h
   branches/AFR/fox/dm_demo.cc
      - copied, changed from r556, branches/itanium2/fox/dm_demo.cc
   branches/AFR/glfw/
      - copied from r556, branches/itanium2/glfw/
   branches/AFR/glfw/CMakeLists.txt
      - copied unchanged from r556, branches/itanium2/glfw/CMakeLists.txt
   branches/AFR/histx/
      - copied from r556, branches/itanium2/histx/
   branches/AFR/histx/CMakeLists.txt
      - copied unchanged from r556, branches/itanium2/histx/CMakeLists.txt
   branches/AFR/histx/Counter.h
      - copied unchanged from r556, branches/itanium2/histx/Counter.h
   branches/AFR/histx/DerivedMonitor.cc
      - copied unchanged from r556, branches/itanium2/histx/DerivedMonitor.cc
   branches/AFR/histx/DerivedMonitor.h
      - copied unchanged from r556, branches/itanium2/histx/DerivedMonitor.h
   branches/AFR/histx/IA64Monitors.cc
      - copied unchanged from r556, branches/itanium2/histx/IA64Monitors.cc
   branches/AFR/histx/IA64Monitors.h
      - copied unchanged from r556, branches/itanium2/histx/IA64Monitors.h
   branches/AFR/histx/MmTimer.h
      - copied unchanged from r556, branches/itanium2/histx/MmTimer.h
   branches/AFR/histx/SingleSamplerCounter.cc
      - copied unchanged from r556, 
branches/itanium2/histx/SingleSamplerCounter.cc
   branches/AFR/histx/SingleSamplerCounter.h
      - copied unchanged from r556, 
branches/itanium2/histx/SingleSamplerCounter.h
   branches/AFR/manta-commands.txt
      - copied unchanged from r556, branches/itanium2/manta-commands.txt
   branches/AFR/scenes/boeing777.cc
      - copied unchanged from r556, branches/itanium2/scenes/boeing777.cc
   branches/AFR/scenes/cube.cc
      - copied unchanged from r556, branches/itanium2/scenes/cube.cc
   branches/AFR/scenes/objviewer.cc
      - copied unchanged from r556, branches/itanium2/scenes/objviewer.cc
   branches/AFR/scenes/volume.cc
      - copied unchanged from r556, branches/itanium2/scenes/volume.cc
Modified:
   branches/AFR/CMakeLists.txt
   branches/AFR/Core/CMakeLists.txt
   branches/AFR/Core/Color/ColorSpace.h
   branches/AFR/Core/Geometry/BBox.h
   branches/AFR/Core/Geometry/PointVector.cc
   branches/AFR/Core/Geometry/PointVector.h
   branches/AFR/Engine/CMakeLists.txt
   branches/AFR/Engine/Control/AFRPipeline.cc
   branches/AFR/Engine/Control/AFRPipeline.h
   branches/AFR/Engine/Control/RTRT.cc
   branches/AFR/Engine/Control/RTRT.h
   branches/AFR/Engine/Display/CMakeLists.txt
   branches/AFR/Engine/Display/FileDisplay.cc
   branches/AFR/Engine/Display/FileDisplay.h
   branches/AFR/Engine/IdleModes/CMakeLists.txt
   branches/AFR/Engine/ImageTraversers/AFImageTraverser.cc
   branches/AFR/Engine/LoadBalancers/CMakeLists.txt
   branches/AFR/Engine/PixelSamplers/CMakeLists.txt
   branches/AFR/Engine/PixelSamplers/JitterSampler.cc
   branches/AFR/Engine/Renderers/CMakeLists.txt
   branches/AFR/Engine/Shadows/BeamShadows.cc
   branches/AFR/Engine/Shadows/BeamShadows.h
   branches/AFR/Engine/Shadows/CMakeLists.txt
   branches/AFR/Engine/Shadows/HardShadows.cc
   branches/AFR/Engine/Shadows/NoShadows.cc
   branches/AFR/Image/CMakeLists.txt
   branches/AFR/Image/SimpleImage.h
   branches/AFR/Image/SimpleImage_templates.cc
   branches/AFR/Interface/CMakeLists.txt
   branches/AFR/Interface/Callback.h
   branches/AFR/Interface/CallbackHelpers.h
   branches/AFR/Interface/Camera.h
   branches/AFR/Interface/Context.h
   branches/AFR/Interface/Fragment.cc
   branches/AFR/Interface/Fragment.h
   branches/AFR/Interface/HitInfo.cc
   branches/AFR/Interface/HitInfo.h
   branches/AFR/Interface/Light.h
   branches/AFR/Interface/LightSet.cc
   branches/AFR/Interface/LightSet.h
   branches/AFR/Interface/Material.h
   branches/AFR/Interface/Object.h
   branches/AFR/Interface/Parameters.h
   branches/AFR/Interface/Primitive.h
   branches/AFR/Interface/RTRTInterface.h
   branches/AFR/Interface/RayPacket.h
   branches/AFR/Interface/RenderParameters.h
   branches/AFR/Model/CMakeLists.txt
   branches/AFR/Model/Cameras/CMakeLists.txt
   branches/AFR/Model/Cameras/EnvironmentCamera.cc
   branches/AFR/Model/Cameras/EnvironmentCamera.h
   branches/AFR/Model/Cameras/FisheyeCamera.h
   branches/AFR/Model/Cameras/OrthogonalCamera.cc
   branches/AFR/Model/Cameras/OrthogonalCamera.h
   branches/AFR/Model/Cameras/PinholeCamera.cc
   branches/AFR/Model/Cameras/PinholeCamera.h
   branches/AFR/Model/Groups/CMakeLists.txt
   branches/AFR/Model/Lights/CMakeLists.txt
   branches/AFR/Model/Lights/PointLight.cc
   branches/AFR/Model/Lights/PointLight.h
   branches/AFR/Model/Materials/CMakeLists.txt
   branches/AFR/Model/Materials/Dielectric.cc
   branches/AFR/Model/Materials/Dielectric.h
   branches/AFR/Model/Materials/Lambertian.cc
   branches/AFR/Model/Materials/Lambertian.h
   branches/AFR/Model/Materials/MetalMaterial.cc
   branches/AFR/Model/Materials/Phong.cc
   branches/AFR/Model/Materials/Phong.h
   branches/AFR/Model/MiscObjects/CMakeLists.txt
   branches/AFR/Model/Primitives/CMakeLists.txt
   branches/AFR/Model/Primitives/Cube.cc
   branches/AFR/Model/Primitives/Cube.h
   branches/AFR/Model/Primitives/PrimitiveCommon.h
   branches/AFR/Model/Primitives/Sphere.cc
   branches/AFR/Model/Primitives/Triangle.cc
   branches/AFR/Model/Primitives/Triangle.h
   branches/AFR/Model/Readers/CMakeLists.txt
   branches/AFR/Model/TexCoordMappers/CMakeLists.txt
   branches/AFR/Model/Textures/CheckerTexture.h
   branches/AFR/Model/Textures/Constant.h
   branches/AFR/Readers/CMakeLists.txt
   branches/AFR/SCIRun/Core/CMakeLists.txt
   branches/AFR/StandAlone/manta.cc
   branches/AFR/UserInterface/XWindowUI.h
   branches/AFR/scenes/CMakeLists.txt
Log:

This is a HUGE commit. I'm sorry but since svn attaches changed/added files 
to the email message, everyone gets a copy of the 
repository in their inbox.... 

Remember how I said that I had previously merged the itanium2 branch with the 
AFR branch? Either I didn't merge everything necessary
to run the boeing 777 dataset or I lost the merged copy before I committed 
it--so this evening I got to re-merge everything. Boy was it fun.



The good news is that it appears to have worked and the AFR performance isn't 
worse then it was before the merge.



Outstanding issues: 

-- The dt code isn't entirely stable. I found one persistant out of bounds 
problem on AFImageTraverser.cc:624 but there are probably some more.
   I can't seem to be able to generate large readable core files on fisher. 

-- I really don't understand why the gst code is scaling the way that it is. 

-- I don't have numbers to share with the whole 777 yet (this was the goal 
for the weekend).



A    scenes/objviewer.cc
A    scenes/cube.cc
A    scenes/volume.cc
A    scenes/boeing777.cc
M    scenes/CMakeLists.txt
M    Image/SimpleImage.h
M    Image/CMakeLists.txt
M    Image/SimpleImage_templates.cc
A    Readers/DoubleEagle
A    Readers/DoubleEagle/vn2v3c1.cc
M    Readers/CMakeLists.txt
A    StandAlone/manta_tile_size.pl
M    StandAlone/manta.cc
A    StandAlone/frust-test.cc
A    StandAlone/barrier_test.cc
M    Core/Geometry/BBox.h
M    Core/Geometry/PointVector.cc
M    Core/Geometry/PointVector.h
M    Core/CMakeLists.txt
M    Core/Color/ColorSpace.h
A    fox
A    fox/FMantaTrackballNav.cc
A    fox/FMantaTrackballNav.h
A    fox/FMantaWidgets.cc
A    fox/FMantaWindow.cc
A    fox/FMantaWidgets.h
A    fox/FMantaWindow.h
A    fox/FMantaQuakeNav.cc
A    fox/FMantaQuakeNav.h
A    fox/dm_demo.cc
A    fox/FMantaUniformNav.cc
A    fox/FMantaUniformNav.h
A    fox/FMantaNavigator.cc
A    fox/FMantaNavigator.h
A    fox/FMantaImageFrame.cc
A    fox/FMantaImageFrame.h
A    fox/CMakeLists.txt
M    UserInterface/XWindowUI.h
A    glfw
A    glfw/CMakeLists.txt
A    histx
A    histx/DerivedMonitor.h
A    histx/MmTimer.h
A    histx/IA64Monitors.cc
A    histx/IA64Monitors.h
A    histx/Counter.h
A    histx/SingleSamplerCounter.cc
A    histx/SingleSamplerCounter.h
A    histx/CMakeLists.txt
A    histx/DerivedMonitor.cc
A    Model/Groups/TransparentKDTree.cc
A    Model/Groups/TransparentKDTree.h
A    Model/Groups/FrustumKDTree.cc
A    Model/Groups/KDTreeLoader.cc
AM   Model/Groups/varray.h
A    Model/Groups/FrustumKDTree.h
A    Model/Groups/PsiGammaTable.cc
A    Model/Groups/KDTreeLoader.h
A    Model/Groups/PsiGammaTable.h
A    Model/Groups/VolumeDesc.h
A    Model/Groups/KDTree.cc
A    Model/Groups/RealisticBvh.cc
A    Model/Groups/VolumeGrid.h
A    Model/Groups/KDTree.h
A    Model/Groups/RealisticBvh.h
M    Model/Groups/CMakeLists.txt
M    Model/TexCoordMappers/CMakeLists.txt
A    Model/Materials/AmbientOcclusion.cc
A    Model/Materials/AmbientOcclusion.h
A    Model/Materials/NormalMaterial.cc
M    Model/Materials/Dielectric.cc
A    Model/Materials/NormalMaterial.h
M    Model/Materials/Dielectric.h
M    Model/Materials/Phong.cc
M    Model/Materials/Phong.h
M    Model/Materials/Lambertian.cc
A    Model/Materials/LambertianAlt.cc
M    Model/Materials/Lambertian.h
M    Model/Materials/MetalMaterial.cc
A    Model/Materials/LambertianAlt.h
A    Model/Materials/CopyColorMaterial.cc
M    Model/Materials/CMakeLists.txt
A    Model/Materials/CopyColorMaterial.h
M    Model/Textures/Constant.h
M    Model/Textures/CheckerTexture.h
A    Model/Textures/CMakeLists.txt
A    Model/Readers/glm
A    Model/Readers/glm/glm.cc
A    Model/Readers/glm/glm.h
M    Model/Readers/CMakeLists.txt
A    Model/Intersections
A    Model/Intersections/TriangleEdge.h
A    Model/Intersections/AxisAlignedBox.cc
A    Model/Intersections/Plane.h
A    Model/Intersections/AxisAlignedBox.h
A    Model/Intersections/CMakeLists.txt
A    Model/Lights/HeadLight.h
M    Model/Lights/PointLight.cc
M    Model/Lights/PointLight.h
M    Model/Lights/CMakeLists.txt
A    Model/Lights/HeadLight.cc
M    Model/Primitives/Cube.cc
A    Model/Primitives/BvhTriangleMesh.h
M    Model/Primitives/CMakeLists.txt
M    Model/Primitives/Triangle.cc
M    Model/Primitives/Triangle.h
M    Model/Primitives/Cube.h
A    Model/Primitives/BvhTriangleMesh.cc
M    Model/Primitives/PrimitiveCommon.h
M    Model/Primitives/Sphere.cc
A    Model/MiscObjects/CuttingPlane.cc
A    Model/MiscObjects/CuttingPlane.h
M    Model/MiscObjects/CMakeLists.txt
M    Model/Cameras/EnvironmentCamera.cc
M    Model/Cameras/EnvironmentCamera.h
M    Model/Cameras/OrthogonalCamera.cc
M    Model/Cameras/FisheyeCamera.h
M    Model/Cameras/OrthogonalCamera.h
M    Model/Cameras/PinholeCamera.cc
M    Model/Cameras/CMakeLists.txt
M    Model/Cameras/PinholeCamera.h
M    Model/CMakeLists.txt
M    Interface/Material.h
M    Interface/HitInfo.h
M    Interface/Fragment.cc
M    Interface/Fragment.h
M    Interface/Parameters.h
M    Interface/RenderParameters.h
M    Interface/Context.h
M    Interface/CMakeLists.txt
M    Interface/Camera.h
M    Interface/Callback.h
M    Interface/HitInfo.cc
M    Interface/Object.h
M    Interface/Light.h
M    Interface/Primitive.h
M    Interface/RTRTInterface.h
M    Interface/CallbackHelpers.h
M    Interface/LightSet.cc
M    Interface/LightSet.h
M    Interface/RayPacket.h
M    SCIRun/Core/CMakeLists.txt
M    Engine/Control/RTRT.cc
M    Engine/Control/RTRT.h
M    Engine/Control/AFRPipeline.cc
M    Engine/Control/AFRPipeline.h
M    Engine/ImageTraversers/AFImageTraverser.cc
A    Engine/Display/GLXImageDisplay.cc
M    Engine/Display/FileDisplay.cc
A    Engine/Display/GLXImageDisplay.h
M    Engine/Display/FileDisplay.h
M    Engine/Display/CMakeLists.txt
M    Engine/IdleModes/CMakeLists.txt
M    Engine/PixelSamplers/JitterSampler.cc
M    Engine/PixelSamplers/CMakeLists.txt
M    Engine/Shadows/BeamShadows.cc
M    Engine/Shadows/BeamShadows.h
M    Engine/Shadows/NoShadows.cc
M    Engine/Shadows/HardShadows.cc
M    Engine/Shadows/CMakeLists.txt
M    Engine/Renderers/CMakeLists.txt
M    Engine/LoadBalancers/CMakeLists.txt
M    Engine/CMakeLists.txt
M    CMakeLists.txt
A    manta-commands.txt


Modified: branches/AFR/CMakeLists.txt
==============================================================================
--- branches/AFR/CMakeLists.txt (original)
+++ branches/AFR/CMakeLists.txt Mon Sep 19 03:34:20 2005
@@ -31,6 +31,7 @@
 ENDIF(CMAKE_SYSTEM MATCHES IRIX)
 
 
+
 IF (APPLE)
   SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -fgcse-sm -funroll-loops 
-fstrict-aliasing -fsched-interblock -falign-loops=16 -falign-jumps=16 
-falign-functions=16 -falign-jumps-max-skip=15 -falign-loops-max-skip=15 
-ffast-math -freorder-blocks -mpowerpc-gpopt -force_cpusubtype_ALL -mtune=G5 
-mcpu=G5 -mpowerpc64 -faltivec -mabi=altivec -mpowerpc-gfxopt" CACHE STRING 
"Optimized Flags" FORCE)
 ENDIF (APPLE)
@@ -67,5 +68,22 @@
 
 SUBDIRS( ${MAIN_SUBDIRS} )
 
-
+# Check to see whether the optional glfw/ directory should be included.
+SET(BUILD_GLFW 0 CACHE BOOL "Build glfw frontend.")  
+IF(BUILD_GLFW)
+  SUBDIRS(glfw)
+ENDIF(BUILD_GLFW)
+
+# Check to see whether the optional fox/ directory should be included.
+SET(BUILD_FOX 0 CACHE BOOL "Build fox frontend.")
+IF(BUILD_FOX)
+  SUBDIRS(fox)
+ENDIF(BUILD_FOX)
+
+# Check to see whether the histx performance monitoring tools should
+# be built on IA64.
+SET(BUILD_HISTX_MANTA 0 CACHE BOOL "Build Histx-Manta tools")
+IF(BUILD_HISTX_MANTA)
+  SUBDIRS(histx)
+ENDIF(BUILD_HISTX_MANTA)
 

Modified: branches/AFR/Core/CMakeLists.txt
==============================================================================
--- branches/AFR/Core/CMakeLists.txt    (original)
+++ branches/AFR/Core/CMakeLists.txt    Mon Sep 19 03:34:20 2005
@@ -1,24 +1,36 @@
 
 SET (CORE_SOURCES)
 SET (CORE_SOURCES ${CORE_SOURCES}
+     Color/ColorDB.h
      Color/ColorDB.cc
-     Color/RGBColor.cc
-     Color/GrayColor.cc)
+     Color/RGBColor.h
+     Color/ColorSpace.h)
 SET (CORE_SOURCES ${CORE_SOURCES}
+     Geometry/Ray.h
+     Geometry/PointVector.h
      Geometry/PointVector.cc
+     Geometry/BBox.h
      )
 SET (CORE_SOURCES ${CORE_SOURCES}
+     Exceptions/BadPrimitive.h
      Exceptions/BadPrimitive.cc
+     Exceptions/IllegalArgument.h
      Exceptions/IllegalArgument.cc
+     Exceptions/UnknownColor.h
      Exceptions/UnknownColor.cc
      )
 SET (CORE_SOURCES ${CORE_SOURCES}
+     Math/MT_RNG.h
      Math/MT_RNG.cc
-     Math/Noise.cc)
+     Math/Noise.h
+     Math/Noise.cc
+     Math/ipow.h)
 SET (CORE_SOURCES ${CORE_SOURCES}
+     Util/Args.h
      Util/Args.cc)
 SET (CORE_SOURCES ${CORE_SOURCES}
-  Geometry/AffineTransform.cc
+     Geometry/AffineTransform.h
+     Geometry/AffineTransform.cc
   )
 
 ADD_LIBRARY (Manta_Core ${CORE_SOURCES})

Modified: branches/AFR/Core/Color/ColorSpace.h
==============================================================================
--- branches/AFR/Core/Color/ColorSpace.h        (original)
+++ branches/AFR/Core/Color/ColorSpace.h        Mon Sep 19 03:34:20 2005
@@ -6,10 +6,6 @@
 #include <Core/Color/RGBColor.h>
 #include <Core/Math/Expon.h>
 
-#include <sgi_stl_warnings_off.h>
-#include <string>
-#include <sgi_stl_warnings_on.h>
-
 namespace Manta {
   template<typename Traits>
   class ColorSpace {
@@ -17,22 +13,18 @@
     typedef typename Traits::ComponentType ComponentType;
     enum { NumComponents = Traits::NumComponents};
 
-    ColorSpace()
-    {
-    }
+    ColorSpace() { }
 
     ColorSpace(const ColorSpace<Traits>& copy)
     {
       for(int i=0;i<3;i++)
-       data[i]=copy.data[i];
+        data[i]=copy.data[i];
     }
-#ifndef SWIG
     ColorSpace& operator=(const ColorSpace<Traits> &copy) {
       for(int i=0;i<NumComponents;i++)
         data[i] = copy.data[i];
       return *this;
     }
-#endif
     ~ColorSpace() {
     }
 
@@ -50,12 +42,12 @@
 
     // Conversions to concrete color classes
 
-    // 
+    //
     // This is what I originally did, but I thought that the error
     // messages were confusing when you tried to pass the wrong thing
     // into the ctor
     //
-    //template<class C> 
+    //template<class C>
     //  explicit ColorSpace(const C& color) {
     //  Traits::convertFrom(data, color);
     //}
@@ -154,6 +146,14 @@
       return *this;
     }
 
+      double Mean() const
+      {
+          double sum = 0.0;
+          for (int i = 0; i < NumComponents; i++)
+              sum += (double)data[i];
+          return sum*(1./double(NumComponents));
+      }
+
     // Apply functor
     ColorSpace<Traits> attenuate(ComponentType scale) const {
       using SCIRun::Exp;
@@ -163,14 +163,31 @@
       return returnValue;
     }
 
-    // This a nasty function for a templated function that will be
-    // included by the world.  I don't want to have to include sstream
-    // in order to have the implementation here, so I will stick it
-    // (the implementation) in another header file called
-    // ColorSpace_fancy.h.  If you want to use this function include
-    // that header file and it will get instantiated properly.
-    std::string toString() const;
-    
+      template<typename Scalar>
+      ColorSpace<Traits> Pow(Scalar exponent) const
+      {
+          using SCIRun::Pow;
+          ColorSpace<Traits> returnValue;
+          for (int i=0; i < NumComponents; i++)
+              returnValue.data[i] = SCIRun::Pow(data[i], exponent);
+          return returnValue;
+      }
+
+      ColorSpace<Traits> Log() const
+      {
+          ColorSpace<Traits> returnValue;
+          for (int i=0; i < NumComponents; i++)
+              returnValue.data[i] = log(data[i]);
+          return returnValue;
+      }
+
+                ColorSpace<Traits> attenuate(const ColorSpace<Traits> 
&scale) const {
+      using SCIRun::Exp;
+      ColorSpace<Traits> returnValue;
+      for(int i=0;i<NumComponents;i++)
+        returnValue.data[i] = Exp(scale.data[i]*data[i]);
+      return returnValue;
+    }
   protected:
     // DO NOT MAKE THIS PUBLIC!
     ComponentType data[NumComponents];
@@ -179,6 +196,7 @@
         data[i] = fillValue;
     }
   };
+
 }
 
 #endif

Modified: branches/AFR/Core/Geometry/BBox.h
==============================================================================
--- branches/AFR/Core/Geometry/BBox.h   (original)
+++ branches/AFR/Core/Geometry/BBox.h   Mon Sep 19 03:34:20 2005
@@ -2,15 +2,22 @@
 #ifndef Manta_Core_BBox_h
 #define Manta_Core_BBox_h
 
+#include <SCIRun/Core/Math/MiscMath.h>
+
 #include <sgi_stl_warnings_off.h>
 #include <limits>
 #include <sgi_stl_warnings_on.h>
 
+#include <assert.h>
+
 namespace Manta {
   class BBox {
   public:
-    BBox(const Point& min, const Point& max)
-      : min(min), max(max) {
+               
+               template< typename T >
+    BBox(const PointT<T,3>& min_, const PointT<T,3>& max_ ) {
+      bounds[0] = min_;
+      bounds[1] = max_;
     }
     BBox() {
       // Need to initialize min and max.
@@ -18,81 +25,65 @@
     }
     ~BBox() {
     }
-
+               
     // This resets min and max to an uninitialized state that will
     // accept new bounds [MAX, -MAX].
     void reset() {
       Real max_val = std::numeric_limits<Real>::max();
-      min = Point( max_val,  max_val,  max_val);
-      max = Point(-max_val, -max_val, -max_val);
+      bounds[0] = Point( max_val,  max_val,  max_val);
+      bounds[1] = Point(-max_val, -max_val, -max_val);
     }
-
-    // Test whether the box is in the "uninitialized state"
-    bool isDefault() {
-      Real max_val = std::numeric_limits<Real>::max();
-      return ( min.x() == max_val && max.x() == -max_val &&
-               min.y() == max_val && max.y() == -max_val &&
-               min.z() == max_val && max.z() == -max_val );
-    }
-
+    
     Vector diagonal() const {
-      return max-min;
+      return bounds[1] - bounds[0];
     }
     Point center() const {
-      return Interpolate(min, max, 0.5);
+      // return SCIRun::Interpolate(bounds[0], bounds[1], 
(Point::ScalarType)0.5);
+                       return 
Point(bounds[0]+Vector(bounds[1]-bounds[0])*0.5);
     }
 
-    void extendByPoint(const Point& p) {
-      min = Min(min, p);
-      max = Max(max, p);
-    }
+               void extendByBox( const BBox &box ) {
+                       extendByPoint( box[0] );
+                       extendByPoint( box[1] );
+               }
+
+               template< typename T >
+    void extendByPoint(const PointT<T,3>& p) {
+      bounds[0] = Min(bounds[0], 
Point((Point::ScalarType)p[0],(Point::ScalarType)p[1],(Point::ScalarType)p[2]));
+      bounds[1] = Max(bounds[1], 
Point((Point::ScalarType)p[0],(Point::ScalarType)p[1],(Point::ScalarType)p[2]));
+               }
+               
     void extendBySphere(const Point& p, Real radius) {
-      min = Min(min, p-Vector(radius, radius, radius));
-      max = Max(max, p+Vector(radius, radius, radius));
+      bounds[0] = Min(bounds[0], p-Vector(radius, radius, radius));
+      bounds[1] = Max(bounds[1], p+Vector(radius, radius, radius));
     }
     void extendByDisc(const Point& p, const Vector& n, Real radius) {
       Vector v(sqrt(1-p.x()*p.x()), sqrt(1-p.y()*p.y()), 
sqrt(1-p.z()*p.z()));
-      min = Min(min, p-v*radius);
-      max = Max(max, p+v*radius);
-    }
-    void extendByBox(const BBox& b) {
-      min = Min(min, b.min);
-      max = Max(max, b.max);
+      bounds[0] = Min(bounds[0], p-v*radius);
+      bounds[1] = Max(bounds[1], p+v*radius);
     }
 
     const Point& getMin() const {
-      return min;
+      return bounds[0];
     }
     const Point& getMax() const {
-      return max;
+      return bounds[1];
     }
 
     Point getCorner(int i) const {
-      return Point(i&4?min.x():max.x(),
-                   i&2?min.y():max.y(),
-                   i&1?min.z():max.z());
-    }
-
-    double computeVolume() const
-    {
-        return ( ( max.x() - min.x() ) *
-                 ( max.y() - min.y() ) *
-                 ( max.z() - min.z() ) );
-    }
-
-    double computeArea() const
-    {
-      double lenx = max.x() - min.x();
-      double leny = max.y() - min.y();
-      double lenz = max.z() - min.z();
-      return (2.0*((lenx*leny) + (leny*lenz) + (lenx*lenz)));
+      return Point(i&4?bounds[0].x():bounds[1].x(),
+                   i&2?bounds[0].y():bounds[1].y(),
+                   i&1?bounds[0].z():bounds[1].z());
     }
 
+    inline       Point &operator[] (int i)       { return bounds[i]; }
+    inline const Point &operator[] (int i) const { return bounds[i]; }
+    
   private:
-    BBox(const BBox&);
-    BBox& operator=(const BBox&);
+    // BBox(const BBox&);
+    // BBox& operator=(const BBox&);
 
-    Point min, max;
+    Point bounds[2];
   };
 }
 

Modified: branches/AFR/Core/Geometry/PointVector.cc
==============================================================================
--- branches/AFR/Core/Geometry/PointVector.cc   (original)
+++ branches/AFR/Core/Geometry/PointVector.cc   Mon Sep 19 03:34:20 2005
@@ -21,11 +21,24 @@
   }
   
   // Explicit instantiations for ostream operators
+
+  // 3D Vectors
   template std::ostream& operator<<(std::ostream& os, const VectorT<double, 
3>&);
   template std::ostream& operator<<(std::ostream& os, const VectorT<float, 
3>&);
   template std::ostream& operator<<(std::ostream& os, const VectorT<int, 
3>&);
   
+  // 3D Points
   template std::ostream& operator<<(std::ostream& os, const PointT<double, 
3>&);
   template std::ostream& operator<<(std::ostream& os, const PointT<float, 
3>&);
   template std::ostream& operator<<(std::ostream& os, const PointT<int, 3>&);
+
+  // 2D Vectors
+  template std::ostream& operator<<(std::ostream& os, const VectorT<double, 
2>&);
+  template std::ostream& operator<<(std::ostream& os, const VectorT<float, 
2>&);
+  template std::ostream& operator<<(std::ostream& os, const VectorT<int, 
2>&);
+
+  // 2D Points
+  template std::ostream& operator<<(std::ostream& os, const PointT<double, 
2>&);
+  template std::ostream& operator<<(std::ostream& os, const PointT<float, 
2>&);
+  template std::ostream& operator<<(std::ostream& os, const PointT<int, 2>&);
 }

Modified: branches/AFR/Core/Geometry/PointVector.h
==============================================================================
--- branches/AFR/Core/Geometry/PointVector.h    (original)
+++ branches/AFR/Core/Geometry/PointVector.h    Mon Sep 19 03:34:20 2005
@@ -13,6 +13,8 @@
   template<typename T, int Dim> 
     class VectorT {
   public:
+                       typedef T ScalarType;
+                       
     VectorT() {
     }
 #ifndef SWIG
@@ -31,15 +33,17 @@
         data[i] = copy[i];
     }
 
-    VectorT(const VectorT<T, Dim>& copy) {
+               // Copy from another vector of the same size.
+               template< typename S >
+    VectorT(const VectorT<S, Dim> &copy) {
       for(int i=0;i<Dim;i++)
-        data[i] = copy[i];
+        data[i] = (T)copy[i];
     }
 
 #ifndef SWIG
     VectorT<T, Dim>& operator=(const VectorT<T, Dim>& copy) {
       for(int i=0;i<Dim;i++)
-        data[i] = copy.data[i];
+        data[i] = (T)copy[i];
       return *this;
     }
 #endif
@@ -64,7 +68,16 @@
     }
     T &operator[] ( int i ) {
       return data[i];
+    }          
+               const T *operator &() const { return data; }
+               
+#else
+    %extend {
+      T& __getitem__( int i ) {
+        return self->operator[](i);
+      }
     }
+
 #else
     %extend {
       T& __getitem__( int i ) {
@@ -72,6 +85,7 @@
       }
     }
 #endif
+
     VectorT<T, Dim> operator+(const VectorT<T, Dim>& v) const {
       VectorT<T, Dim> result;
       for(int i=0;i<Dim;i++)
@@ -230,6 +244,8 @@
   template<typename T, int Dim>
     class PointT {
   public:
+                       typedef T ScalarType;
+                       
     PointT() {
     }
 
@@ -244,9 +260,10 @@
       data[0] = x; data[1] = y; data[2] = z;
     }
     
-    PointT(const PointT<T, Dim>& copy) {
+               template< typename S >
+    PointT(const PointT<S, Dim>& copy) {
       for(int i=0;i<Dim;i++)
-        data[i] = copy.data[i];
+        data[i] = (T)copy[i];
     }
 
     explicit PointT( const VectorT<T,Dim> &copy ) {
@@ -255,9 +272,10 @@
     }
 
 #ifndef SWIG
-    PointT<T, Dim>& operator=(const PointT<T, Dim>& copy) {
+               template< typename S >
+    PointT<T, Dim>& operator=(const PointT<S, Dim>& copy) {
       for(int i=0;i<Dim;i++)
-        data[i] = copy.data[i];
+        data[i] = (T)copy[i];
       return *this;
     }
 #endif
@@ -282,6 +300,7 @@
     T &operator[](int i) {
       return data[i];
     }
+               const T *operator& () const { return data; };
 #else
     %extend {
       T& __getitem__( int i ) {
@@ -290,6 +309,7 @@
     }
 #endif
 
+
     VectorT<T, Dim> operator-(const PointT<T, Dim>& p) const {
       VectorT<T, Dim> result;
       for(int i=0;i<Dim;i++)
@@ -359,15 +379,22 @@
     T data[Dim];
   };
 
-  template<typename T, int Dim> 
-    inline VectorT<T, Dim> operator*(T s, const VectorT<T, Dim>& v)
+       // Two multiplication by a scalar operators.
+  template<typename T, int Dim, typename S > 
+    inline VectorT<T, Dim> operator*(S s, const VectorT<T, Dim>& v)
     {
       VectorT<T, Dim> result;
       for(int i=0;i<Dim;i++)
-        result[i] = s * v[i];
+        result[i] = s * (S)v[i];
       return result;
     }
 
+       template<typename T, int Dim, typename S > 
+    inline VectorT<T, Dim> operator*(const VectorT<T, Dim>& v, S s)
+       {
+      return operator*((T)s,v);
+       }
+       
   template<typename T, int Dim> 
     inline T Dot(const VectorT<T, Dim>& v1, const VectorT<T, Dim>& v2)
   {

Modified: branches/AFR/Engine/CMakeLists.txt
==============================================================================
--- branches/AFR/Engine/CMakeLists.txt  (original)
+++ branches/AFR/Engine/CMakeLists.txt  Mon Sep 19 03:34:20 2005
@@ -7,6 +7,7 @@
 INCLUDE (PixelSamplers/CMakeLists.txt)
 INCLUDE (Renderers/CMakeLists.txt)
 INCLUDE (Shadows/CMakeLists.txt)
+# INCLUDE (Animators/CMakeLists.txt)
 
 ADD_LIBRARY (Manta_Engine
              ${Manta_Control_SRCS}
@@ -17,6 +18,7 @@
              ${Manta_PixelSamplers_SRCS}
              ${Manta_Renderers_SRCS}
              ${Manta_Shadows_SRCS}
+#             ${Manta_Animators_SRCS}
              )
 
 

Modified: branches/AFR/Engine/Control/AFRPipeline.cc
==============================================================================
--- branches/AFR/Engine/Control/AFRPipeline.cc  (original)
+++ branches/AFR/Engine/Control/AFRPipeline.cc  Mon Sep 19 03:34:20 2005
@@ -613,28 +613,47 @@
 
///////////////////////////////////////////////////////////////////////////////
 // CREATE CHANNEL
 
///////////////////////////////////////////////////////////////////////////////
+
 int AFRPipeline::createChannel(const string& spec, Camera* camera, bool 
stereo, int xres, int yres)
 {
   string name;
   vector<string> args;
+
+        // Parse the arg string.
   parseSpec(spec, name, args);
+
+        // Search for an image display with the name.
   ImageDisplayMapType::iterator iter = imageDisplays.find(name);
   if(iter == imageDisplays.end())
     return 0;
+
+        // Create the channel with the image display.
+        return createChannel( (*iter->second)(args), camera, stereo, xres, 
yres );
+}
+
+int AFRPipeline::createChannel(ImageDisplay *image_display, Camera* camera, 
bool stereo, int xres, int yres)
+{
+
+  // Create the channel.
   Channel* channel = new Channel;
-  channel->id = ids++;
-  channel->display = (*iter->second)(args);
-  channel->stereo = stereo;
-  channel->xres = xres;
-  channel->yres = yres;
-  channel->active = true;
-  channel->imageCreator = 0;
+  channel->id      = ids++;
+  channel->display = image_display;
+  channel->stereo  = stereo;
+  channel->xres    = xres;
+  channel->yres    = yres;
+  channel->active  = true;
+  channel->imageCreator  = 0;
   channel->pipelineDepth = 2;
   channel->images.resize(channel->pipelineDepth);
   channel->camera = camera;
+
+  // Setup images for pipeline.
   for(int i=0;i<channel->pipelineDepth;i++)
     channel->images[i] = 0;
+
   pipelineNeedsSetup = true;
+  
+  // Add the channel to the renderer.
   channels.push_back(channel);
   return channel->id;
 }
@@ -664,6 +683,11 @@
   return channels[channel]->camera;
 }
 
+void AFRPipeline::setCamera(int channel, Camera *camera ) {
+
+        channels[channel]->camera = camera;
+}
+
 void AFRPipeline::getResolution(int channel, bool& stereo, int& xres, int& 
yres)
 {
   stereo = channels[channel]->stereo;
@@ -893,6 +917,10 @@
   return list;
 }
 
+void AFRPipeline::setPixelSampler( PixelSampler *sampler_ ) {
+  currentPixelSampler = sampler_;
+};
+
 bool AFRPipeline::selectPixelSampler(const string& spec)
 {
   string name;
@@ -1059,6 +1087,11 @@
 void AFRPipeline::setScene(Scene* newScene)
 {
   scene = newScene;
+}
+
+Scene *AFRPipeline::getScene() {
+
+  return scene;
 }
 
 bool AFRPipeline::readScene(const string& spec)

Modified: branches/AFR/Engine/Control/AFRPipeline.h
==============================================================================
--- branches/AFR/Engine/Control/AFRPipeline.h   (original)
+++ branches/AFR/Engine/Control/AFRPipeline.h   Mon Sep 19 03:34:20 2005
@@ -70,9 +70,12 @@
                        // Image Modes (opengl, file, mpeg, etc.)
                        virtual int createChannel(const string& modespec, 
Camera* camera,
                                                        bool stereo, int 
xres, int yres);
+      virtual int createChannel(ImageDisplay *image_display, Camera* camera,
+                                bool stereo, int xres, int yres);
                        virtual void registerComponent(const string& name, 
ImageDisplayCreator display);
                        virtual listType listImageDisplays() const;
                        virtual Camera* getCamera(int channel) const;
+      virtual void    setCamera(int channel, Camera *camera );
                        virtual void getResolution(int channel, bool& stereo, 
int& xres, int& yres);
                        virtual void changeResolution(int channel, int xres, 
int yres,
                                                                              
                                                                  bool 
changePipeline);
@@ -94,6 +97,7 @@
                        virtual listType listLoadBalancers() const;
 
                        // PixelSamplers
+      virtual void setPixelSampler( PixelSampler *sampler_ );
                        virtual bool selectPixelSampler(const string& spec);
                        virtual void registerComponent(const string& name, 
PixelSamplerCreator creator);
                        virtual listType listPixelSamplers() const;
@@ -121,6 +125,7 @@
                        // Scenes
                        virtual bool haveScene();
                        virtual void setScene(Scene* scene);
+      virtual Scene *getScene();
                        virtual bool readScene(const string& sceneSpec/*, 
const vector<string> &args*/);
                        virtual void setScenePath(const string& path);
 

Modified: branches/AFR/Engine/Control/RTRT.cc
==============================================================================
--- branches/AFR/Engine/Control/RTRT.cc (original)
+++ branches/AFR/Engine/Control/RTRT.cc Mon Sep 19 03:34:20 2005
@@ -29,6 +29,8 @@
 #include <Core/Util/Assert.h>
 #include <Core/Util/NotFinished.h>
 
+#include <Interface/Material.h>
+
 #include <sgi_stl_warnings_off.h>
 #include <sstream>
 #include <iostream>
@@ -546,24 +548,42 @@
 {
   string name;
   vector<string> args;
+
+        // Parse the arg string.
   parseSpec(spec, name, args);
+
+        // Search for an image display with the name.
   ImageDisplayMapType::iterator iter = imageDisplays.find(name);
   if(iter == imageDisplays.end())
     return 0;
+
+        // Create the channel with the image display.
+        return createChannel( (*iter->second)(args), camera, stereo, xres, 
yres );
+}
+
+int RTRT::createChannel(ImageDisplay *image_display, Camera* camera, bool 
stereo, int xres, int yres)
+{
+
+  // Create the channel.
   Channel* channel = new Channel;
-  channel->id = ids++;
-  channel->display = (*iter->second)(args);
-  channel->stereo = stereo;
-  channel->xres = xres;
-  channel->yres = yres;
-  channel->active = true;
-  channel->imageCreator = 0;
+  channel->id      = ids++;
+  channel->display = image_display;
+  channel->stereo  = stereo;
+  channel->xres    = xres;
+  channel->yres    = yres;
+  channel->active  = true;
+  channel->imageCreator  = 0;
   channel->pipelineDepth = 2;
   channel->images.resize(channel->pipelineDepth);
   channel->camera = camera;
+
+  // Setup images for pipeline.
   for(int i=0;i<channel->pipelineDepth;i++)
     channel->images[i] = 0;
+
   pipelineNeedsSetup = true;
+  
+  // Add the channel to the renderer.
   channels.push_back(channel);
   return channel->id;
 }
@@ -590,6 +610,11 @@
   return channels[channel]->camera;
 }
 
+void RTRT::setCamera(int channel, Camera *camera ) {
+
+        channels[channel]->camera = camera;
+}
+
 void RTRT::getResolution(int channel, bool& stereo, int& xres, int& yres)
 {
   stereo = channels[channel]->stereo;
@@ -773,6 +798,10 @@
   return list;
 }
 
+void RTRT::setPixelSampler( PixelSampler *sampler_ ) {
+  currentPixelSampler = sampler_;
+};
+
 bool RTRT::selectPixelSampler(const string& spec)
 {
   string name;
@@ -941,6 +970,11 @@
   scene = newScene;
 }
 
+Scene *RTRT::getScene() {
+
+  return scene;
+}
+
 bool RTRT::readScene(const string& spec)
 {
   string name;
@@ -1132,4 +1166,44 @@
   transaction_lock.lock();
   transactions.push_back(transaction);
   transaction_lock.unlock();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+// Experimental. Shoot one ray from the calling thread. Populates the result 
ray
+// packet datastructure. Useful for debugging. Very un-thread-safe.
+
+void RTRT::shootOneRay( Color &result_color, RayPacket &result_rays, Real 
image_x, Real image_y, int channel_index ) {
+
+        // Only shoot one ray.
+        result_rays.resize( 1 );
+
+        // Set the image space coordinates of the pixel.
+        result_rays.setPixel(0, 0, image_x, image_y, &result_color );
+        result_rays.setFlag ( RayPacket::HaveImageCoordinates );
+
+        // Get a pointer to the channel.
+        Channel *channel = channels[ channel_index ];
+
+        // Create a render context.
+        RenderContext render_context(this, channel_index, workersRendering, 
workersRendering+1, 0,
+                                                                             
                                currentLoadBalancer, currentPixelSampler,
+                                                                             
                                            currentRenderer, 
currentShadowAlgorithm,
+                                                                             
                                            channel->camera, scene );
+
+        // Send this to the renderer.
+        currentRenderer->traceEyeRays( render_context, result_rays );
+
+        // Check to see if the ray hit anything.
+        if (result_rays.hitInfo(0).wasHit()) {
+
+                // Compute hit positions.
+                result_rays.computeHitPositions();
+
+                // Compute the normal.
+                result_rays.computeNormals( render_context );
+
+                // Shade.
+                result_rays.hitInfo(0).hitMaterial()->shade( render_context, 
result_rays );
+        }
 }

Modified: branches/AFR/Engine/Control/RTRT.h
==============================================================================
--- branches/AFR/Engine/Control/RTRT.h  (original)
+++ branches/AFR/Engine/Control/RTRT.h  Mon Sep 19 03:34:20 2005
@@ -14,6 +14,11 @@
 #include <set>
 #include <vector>
 
+// The following are used by shootOneRay (experimental)
+#include <MantaTypes.h>
+#include <Interface/RayPacket.h>
+#include <Core/Color/Color.h>
+
 namespace SCIRun {
   class Thread;
 }
@@ -35,9 +40,12 @@
     // Image Modes (opengl, file, mpeg, etc.)
     virtual int createChannel(const string& modespec, Camera* camera,
                              bool stereo, int xres, int yres);
+               virtual int createChannel(ImageDisplay *image_display, 
Camera* camera,
+                                                                             
                                          bool stereo, int xres, int yres);
     virtual void registerComponent(const string& name, ImageDisplayCreator 
display);
     virtual listType listImageDisplays() const;
     virtual Camera* getCamera(int channel) const;
+               virtual void    setCamera(int channel, Camera *camera );
     virtual void getResolution(int channel, bool& stereo, int& xres, int& 
yres);
     virtual void changeResolution(int channel, int xres, int yres,
                                   bool changePipeline);
@@ -59,6 +67,7 @@
     virtual listType listLoadBalancers() const;
 
     // PixelSamplers
+               virtual void setPixelSampler( PixelSampler *sampler_ );
     virtual bool selectPixelSampler(const string& spec);
     virtual void registerComponent(const string& name, PixelSamplerCreator 
creator);
     virtual listType listPixelSamplers() const;
@@ -86,6 +95,7 @@
     // Scenes
     virtual bool haveScene();
     virtual void setScene(Scene* scene);
+               virtual Scene *getScene();
     virtual bool readScene(const string& sceneSpec/*, const vector<string> 
&args*/);
     virtual void setScenePath(const string& path);
 
@@ -131,7 +141,12 @@
 
     // Transactions
     virtual void addTransaction(TransactionBase*);
-  protected:
+               
+               // Debug:
+               void shootOneRay( Color &result_color, RayPacket 
&result_rays, Real image_x, Real image_y, int channel_index );
+  
+       
+       protected:
     friend class Worker;
     void internalRenderLoop(int workerIndex, bool lateComerFlag);
 
@@ -191,33 +206,44 @@
     // Component databases and current instances
     typedef map<string, ImageDisplayCreator> ImageDisplayMapType;
     ImageDisplayMapType imageDisplays;
+               
     typedef map<string, ImageCreator> ImageCreatorMapType;
     ImageCreatorMapType imageCreators;
-    vector<string> currentImageCreatorArgs;
+    
+               vector<string> currentImageCreatorArgs;
     ImageCreator currentImageCreator;
     typedef map<string, ImageTraverserCreator> ImageTraverserMapType;
-    ImageTraverserMapType imageTraversers;
+    
+               ImageTraverserMapType imageTraversers;
     ImageTraverser* currentImageTraverser;
-    typedef map<string, LoadBalancerCreator> LoadBalancerMapType;
+    
+               typedef map<string, LoadBalancerCreator> LoadBalancerMapType;
     LoadBalancerMapType loadBalancers;
     LoadBalancer* currentLoadBalancer;
-    typedef map<string, PixelSamplerCreator> PixelSamplerMapType;
+    
+               typedef map<string, PixelSamplerCreator> PixelSamplerMapType;
     PixelSamplerMapType pixelSamplers;
     PixelSampler* currentPixelSampler;
-    typedef map<string, RendererCreator> RendererMapType;
+    
+               typedef map<string, RendererCreator> RendererMapType;
     RendererMapType renderers;
     Renderer* currentRenderer;
-    typedef map<string, ShadowAlgorithmCreator> ShadowAlgorithmMapType;
+    
+               typedef map<string, ShadowAlgorithmCreator> 
ShadowAlgorithmMapType;
     ShadowAlgorithmMapType shadowAlgorithms;
     ShadowAlgorithm* currentShadowAlgorithm;
-    typedef map<string, IdleModeCreator> IdleModeMapType;
+    
+               typedef map<string, IdleModeCreator> IdleModeMapType;
     IdleModeMapType idleModes;
     vector<IdleMode*> currentIdleModes;
-    typedef map<string, CameraCreator> CameraMapType;
+    
+               typedef map<string, CameraCreator> CameraMapType;
     CameraMapType cameras;
-    typedef map<string, UserInterfaceCreator> UserInterfaceMapType;
+    
+               typedef map<string, UserInterfaceCreator> 
UserInterfaceMapType;
     UserInterfaceMapType userInterfaces;
-    typedef map<string, GroupCreator> GroupMapType;
+    
+               typedef map<string, GroupCreator> GroupMapType;
     GroupMapType groups;
 
     // The pipeline

Modified: branches/AFR/Engine/Display/CMakeLists.txt
==============================================================================
--- branches/AFR/Engine/Display/CMakeLists.txt  (original)
+++ branches/AFR/Engine/Display/CMakeLists.txt  Mon Sep 19 03:34:20 2005
@@ -1,6 +1,18 @@
 
 SET (Manta_Display_SRCS
+     Display/NullDisplay.h
      Display/NullDisplay.cc
+     Display/OpenGLDisplay.h
      Display/OpenGLDisplay.cc
+     Display/FileDisplay.h
      Display/FileDisplay.cc
+     Display/GLXImageDisplay.h
+     Display/GLXImageDisplay.cc
+     Display/FileDisplay.h
+     Display/FileDisplay.cc
+     Display/GLXImageDisplay.h
+     Display/GLXImageDisplay.cc
+#     Display/GLXMultipipeImageDisplay.h
+#     Display/GLXMultipipeImageDisplay.cc
+
      )

Modified: branches/AFR/Engine/Display/FileDisplay.cc
==============================================================================
--- branches/AFR/Engine/Display/FileDisplay.cc  (original)
+++ branches/AFR/Engine/Display/FileDisplay.cc  Mon Sep 19 03:34:20 2005
@@ -10,12 +10,14 @@
 #include <Image/Pixel.h>
 #include <Image/SimpleImage.h>
 #include <Image/TGAFile.h>
+#include <Interface/Context.h>
+#include <SCIRun/Core/Thread/Time.h>
 
 using namespace Manta;
 using namespace std;
 using SCIRun::IllegalValue;
 using SCIRun::InternalError;
-
+using SCIRun::Time;
 ImageDisplay *FileDisplay::create(
   const vector< string > &args )
 {
@@ -45,6 +47,9 @@
   const Image *image,
   Real performance )
 {
+  if(context.proc != 0)
+    return;
+
   bool stereo;
   int xres, yres;
   image->getResolution( stereo, xres, yres );
@@ -60,7 +65,14 @@
     stringstream ss;
     ss << baseName << "_" << setfill( '0' ) << setw( 5 ) << currentFrame << 
".tga";
     string name = ss.str();
+               
+               double start_time = Time::currentSeconds();
+               
     writeTGA( image, name, 0 );
+               
+               double end_time = Time::currentSeconds();
+               
+               std::cout << "Frame write time: " << (end_time - 
start_time)/60.0 << " minutes." << std::endl;
   }
   ++currentFrame;
 }

Modified: branches/AFR/Engine/Display/FileDisplay.h
==============================================================================
--- branches/AFR/Engine/Display/FileDisplay.h   (original)
+++ branches/AFR/Engine/Display/FileDisplay.h   Mon Sep 19 03:34:20 2005
@@ -16,7 +16,8 @@
     virtual ~FileDisplay();
     virtual void setupDisplayChannel(SetupContext&);
     virtual void displayImage(const DisplayContext& context,
-                             const Image* image, Real performance = 1.0);
+                              const Image* image,
+                              Real performance = 1.0);
     static ImageDisplay* create(const vector<string>& args);
   protected:
     string baseName;

Copied: branches/AFR/Engine/Display/GLXImageDisplay.cc (from r510, 
branches/itanium2/Engine/Display/GLXImageDisplay.cc)
==============================================================================
--- branches/itanium2/Engine/Display/GLXImageDisplay.cc (original)
+++ branches/AFR/Engine/Display/GLXImageDisplay.cc      Mon Sep 19 03:34:20 
2005
@@ -68,7 +68,7 @@
        manta_channel = context.channelIndex;
 }
 
-void GLXImageDisplay::displayImage( const DisplayContext &context, const 
Image* image ) {
+void GLXImageDisplay::displayImage( const DisplayContext &context, const 
Image* image, Real performance ) {
 
        // Check to see if this processor should display the image.
        if (context.proc == 0) {
@@ -184,4 +184,4 @@
                        std::cerr << "GLXImageDisplay: Error code from 
OpenGL: " << gluErrorString(errcode) << std::endl;
                }
        }
-}
\ No newline at end of file
+}

Copied: branches/AFR/Engine/Display/GLXImageDisplay.h (from r510, 
branches/itanium2/Engine/Display/GLXImageDisplay.h)
==============================================================================
--- branches/itanium2/Engine/Display/GLXImageDisplay.h  (original)
+++ branches/AFR/Engine/Display/GLXImageDisplay.h       Mon Sep 19 03:34:20 
2005
@@ -32,7 +32,7 @@
                
                // Manta ImageDisplay interface.
     void setupDisplayChannel( SetupContext &context );
-    void displayImage( const DisplayContext &context, const Image* image );
+    void displayImage( const DisplayContext &context, const Image* image, 
Real performance = 1.0 );
                
                // Accessors.
                int getMantaChannel() const { return manta_channel; } // NOT 
THREAD SAFE.

Modified: branches/AFR/Engine/IdleModes/CMakeLists.txt
==============================================================================
--- branches/AFR/Engine/IdleModes/CMakeLists.txt        (original)
+++ branches/AFR/Engine/IdleModes/CMakeLists.txt        Mon Sep 19 03:34:20 
2005
@@ -1,4 +1,5 @@
 
 SET (Manta_IdleModes_SRCS
+     IdleModes/ZoomIdleMode.h
      IdleModes/ZoomIdleMode.cc
      )

Modified: branches/AFR/Engine/ImageTraversers/AFImageTraverser.cc
==============================================================================
--- branches/AFR/Engine/ImageTraversers/AFImageTraverser.cc     (original)
+++ branches/AFR/Engine/ImageTraversers/AFImageTraverser.cc     Mon Sep 19 
03:34:20 2005
@@ -614,39 +614,42 @@
       }
       else
         kdtree[myID].getRandomSamplefromTile(tindex, cx, cy, 
myRandomNumber[myID]);
-     
+
+      int fi = SCIRun::Min((f+i),(chunk_size-1));
+      
       //if(cx<0) cx=0; if(cx>=xres) cx = xres-1;
       //if(cy<0) cy=0; if(cy>=yres) cy = yres-1;
       // cout << "f+i = " << f+i << endl;
       double jitterx, jittery;
       jitterx = myRandomNumber[myID].genfrand()-0.5;
       jittery = myRandomNumber[myID].genfrand()-0.5;
-      newSample[myID][f+i].viewCoord[0] = (float)cx+jitterx;
-      newSample[myID][f+i].viewCoord[1] = (float)cy+jittery;
+
+      newSample[myID][fi].viewCoord[0] = (float)cx+jitterx;
+      newSample[myID][fi].viewCoord[1] = (float)cy+jittery;
       
-      if(newSample[myID][f+i].viewCoord[0]<0) 
-        newSample[myID][f+i].viewCoord[0]=0; 
-      if(newSample[myID][f+i].viewCoord[0]>=xres) 
-        newSample[myID][f+i].viewCoord[0]= xres-1;
-      if(newSample[myID][f+i].viewCoord[1]<0) 
-        newSample[myID][f+i].viewCoord[1]=0; 
-      if(newSample[myID][f+i].viewCoord[1]>=yres) 
-        newSample[myID][f+i].viewCoord[1]= yres-1;
+      if(newSample[myID][fi].viewCoord[0]<0) 
+        newSample[myID][fi].viewCoord[0]=0; 
+      if(newSample[myID][fi].viewCoord[0]>=xres) 
+        newSample[myID][fi].viewCoord[0]= xres-1;
+      if(newSample[myID][fi].viewCoord[1]<0) 
+        newSample[myID][fi].viewCoord[1]=0; 
+      if(newSample[myID][fi].viewCoord[1]>=yres) 
+        newSample[myID][fi].viewCoord[1]= yres-1;
       // cout << "raytracing: " << cx << ", " << cy << endl;
-      newSample[myID][f+i].tileindex = tindex;
-      newSample[myID][f+i].t = t;
+      newSample[myID][fi].tileindex = tindex;
+      newSample[myID][fi].t = t;
       // normalized
       double px, py;
                        
       if(xres>yres) // let the smaller dimension be mapped to [-1,1]
         {
-          px = (double)(-1.0 + 
2.0*((double)newSample[myID][f+i].viewCoord[0])/(double)yres); 
-          py = (double)(-1.0 + 
2.0*((double)newSample[myID][f+i].viewCoord[1])/(double)yres);
+          px = (double)(-1.0 + 
2.0*((double)newSample[myID][fi].viewCoord[0])/(double)yres); 
+          py = (double)(-1.0 + 
2.0*((double)newSample[myID][fi].viewCoord[1])/(double)yres);
         }
       else
         {
-          px = (double)(-1.0 + 
2.0*((double)newSample[myID][f+i].viewCoord[0])/(double)xres); 
-          py = (double)(-1.0 + 
2.0*((double)newSample[myID][f+i].viewCoord[1])/(double)xres);
+          px = (double)(-1.0 + 
2.0*((double)newSample[myID][fi].viewCoord[0])/(double)xres); 
+          py = (double)(-1.0 + 
2.0*((double)newSample[myID][fi].viewCoord[1])/(double)xres);
         }  
                                
       // samples_done[context.proc] ++;
@@ -672,27 +675,29 @@
     
///////////////////////////////////////////////////////////////////////////
     // okay now copy from fragment to temporalQ
     for(i=0;i<size;i++) {
+
+      int fi = SCIRun::Min((f+i),(chunk_size-1));
     
       RayPacket::Element& re = rays.get(i);
       RGBColor tempcol = color[i].convertRGB();      
-      newSample[myID][f+i].c[0] = tempcol.r();
-      newSample[myID][f+i].c[1] = tempcol.g();
-      newSample[myID][f+i].c[2] = tempcol.b();
-      newSample[myID][f+i].worldCoord[0] = re.hitPosition.x();
-      newSample[myID][f+i].worldCoord[1] = re.hitPosition.y();
-      newSample[myID][f+i].worldCoord[2] = re.hitPosition.z();
+      newSample[myID][fi].c[0] = tempcol.r();
+      newSample[myID][fi].c[1] = tempcol.g();
+      newSample[myID][fi].c[2] = tempcol.b();
+      newSample[myID][fi].worldCoord[0] = re.hitPosition.x();
+      newSample[myID][fi].worldCoord[1] = re.hitPosition.y();
+      newSample[myID][fi].worldCoord[2] = re.hitPosition.z();
       // newSample[i].print();
       
       
/////////////////////////////////////////////////////////////////////////////
       // Skip reconstruction and set the image pixel.
-      image->set((int)(newSample[myID][f+i].viewCoord[0]), 
(int)(newSample[myID][f+i].viewCoord[1]), color[i]);
+      image->set((int)(newSample[myID][fi].viewCoord[0]), 
(int)(newSample[myID][fi].viewCoord[1]), color[i]);
       
       // add sample to the corresponding kdtree
-      kdtree[myID].updateStatsAddSample(&newSample[myID][f+i], 
(float)chunkTimeStamp[myID], 0.0, false, samplingrate);
+      kdtree[myID].updateStatsAddSample(&newSample[myID][fi], 
(float)chunkTimeStamp[myID], 0.0, false, samplingrate);
       //kdtree[myID].ageStats(&newSample[i], (float)chunkTimeStamp[myID]);
       
       // add this sample into the temporalQ
-      temporalQ[myID].qInsert(&newSample[myID][f+i]);
+      temporalQ[myID].qInsert(&newSample[myID][fi]);
     }
   }
   

Modified: branches/AFR/Engine/LoadBalancers/CMakeLists.txt
==============================================================================
--- branches/AFR/Engine/LoadBalancers/CMakeLists.txt    (original)
+++ branches/AFR/Engine/LoadBalancers/CMakeLists.txt    Mon Sep 19 03:34:20 
2005
@@ -1,6 +1,9 @@
 
 SET (Manta_LoadBalancers_SRCS
+     LoadBalancers/CyclicLoadBalancer.h
      LoadBalancers/CyclicLoadBalancer.cc
+     LoadBalancers/SimpleLoadBalancer.h
      LoadBalancers/SimpleLoadBalancer.cc
+     LoadBalancers/WQLoadBalancer.h
      LoadBalancers/WQLoadBalancer.cc
      )

Modified: branches/AFR/Engine/PixelSamplers/CMakeLists.txt
==============================================================================
--- branches/AFR/Engine/PixelSamplers/CMakeLists.txt    (original)
+++ branches/AFR/Engine/PixelSamplers/CMakeLists.txt    Mon Sep 19 03:34:20 
2005
@@ -1,12 +1,20 @@
 
 SET (Manta_PixelSamplers_SRCS
+     PixelSamplers/HammersleySampler.h
      PixelSamplers/HammersleySampler.cc
+     PixelSamplers/InterLeaveSampler.h
      PixelSamplers/InterLeaveSampler.cc
+     PixelSamplers/JitterSampler.h
      PixelSamplers/JitterSampler.cc
+     PixelSamplers/MultiJitterSampler.h
      PixelSamplers/MultiJitterSampler.cc
+     PixelSamplers/NullSampler.h
      PixelSamplers/NullSampler.cc
+     PixelSamplers/NRooksSampler.h
      PixelSamplers/NRooksSampler.cc
      PixelSamplers/RampSampler.cc
+     PixelSamplers/Sample.h
      PixelSamplers/Sample.cc
+     PixelSamplers/SingleSampler.h
      PixelSamplers/SingleSampler.cc
      )

Modified: branches/AFR/Engine/PixelSamplers/JitterSampler.cc
==============================================================================
--- branches/AFR/Engine/PixelSamplers/JitterSampler.cc  (original)
+++ branches/AFR/Engine/PixelSamplers/JitterSampler.cc  Mon Sep 19 03:34:20 
2005
@@ -21,26 +21,26 @@
 
 PixelSampler* JitterSampler::create(const vector<string>& args)
 {
-  
+
   return new JitterSampler(args);
 }
 
 JitterSampler::JitterSampler(const vector<string>& args):
-  num_samples(4), use_cheaprng(true)
+  num_samples(4), use_cheaprng(true), random( 0 )
 {
   int argc = static_cast<int>(args.size());
   for(int i = 0; i<argc;i++){
     string arg = args[i];
     if(arg == "-numberOfSamples"){
       if(!getIntArg(i, args, num_samples))
-       throw IllegalArgument("JitterSampler -numberOfSamples", i, args);
+        throw IllegalArgument("JitterSampler -numberOfSamples", i, args);
       if (num_samples < 1)
         throw IllegalArgument("-numberOfSamples must be greater than 0",
                               i, args);
     } else if (arg == "-nocheap") {
       use_cheaprng = false;
     }
-   
+
     else {
       throw IllegalArgument("JitterSampler", i, args);
     }
@@ -58,7 +58,15 @@
 void JitterSampler::setupBegin(const SetupContext& context, int numChannels)
 {
   channelInfo.resize(numChannels);
-  random = new MT_RNG[context.numProcs];
+  if ( !use_cheaprng )
+  {
+      random = new MT_RNG[context.numProcs];
+      for ( int i = 0; i < context.numProcs; i++ )
+      {
+          random[i] = MT_RNG();
+          random[i].seed_rng( (unsigned long) i );
+      }
+  }
   context.renderer->setupBegin(context, numChannels);
 }
 
@@ -73,7 +81,7 @@
   ci.yscale = ci.xscale;
   ci.xoffset = (-ci.xres+1)*(Real)0.5*ci.xscale; // Offset to pixel center
   ci.yoffset = (-ci.yres+1)*(Real)0.5*ci.yscale;
-  
+
   context.renderer->setupDisplayChannel(context);
 }
 
@@ -101,8 +109,11 @@
   int samples_collected = samples_collected_return;
   int current_fragment = current_fragment_return;
   Color fragment_color = Color::black();
+
   for(int sample_index = 0; sample_index < sample_color_size; 
sample_index++) {
-    fragment_color += sample_color[sample_index];
+      //double val = (double)current_fragment/(double)fragment.getSize();
+      //fragment_color += Color(RGBColor(val, val, val));
+      fragment_color += sample_color[sample_index];
     samples_collected++;
     // We've collected enough samples, so compute the average and
     // assign it to the fragment.
@@ -126,11 +137,11 @@
 }
 
 void JitterSampler::renderFragment(const RenderContext& context,
-                                  Fragment& fragment)
+                                   Fragment& fragment)
 {
   ChannelInfo& ci = channelInfo[context.channelIndex];
   int thd_num = context.proc;
-    
+
   int flags = RayPacket::HaveImageCoordinates;
   if(fragment.getFlags() & Fragment::ConstantEye)
     flags |= RayPacket::ConstantEye;
@@ -147,13 +158,14 @@
   }
 
   int depth = 0;
+
   RayPacketData raydata;
   RayPacket rays(raydata, RayPacket::MaxSize, depth, flags);
 
   Real inx = (Real)1/nx;
   Real iny = (Real)1/ny;
   Real px, py;
-  
+
   int sample_count = 0;
   Color sample_color[RayPacket::MaxSize];
   // No samples accumulated yet.
@@ -174,7 +186,7 @@
       else
         random[thd_num].seed_rng(fe0.x*ci.xres+fe0.y);
     }
-    
+
     // For each fragment start filling up the RayPacket with samples.
     // When you filled up the empty_slots compute the rays, do the
     // average, and store the results in the fragment.
@@ -191,9 +203,11 @@
           }
           px = (fe0.x+(x_sample))*ci.xscale+ci.xoffset;
           py = (fe0.y+(y_sample))*ci.yscale+ci.yoffset;
-          rays.setPixel(sample_count, 0, px, py, 
&sample_color[sample_count]);
+
+          rays.setPixel(sample_count, 0, px, py,
+                        &sample_color[sample_count]);
           sample_count++;
-          
+
           if (sample_count == RayPacket::MaxSize) {
             // Filled up the ray packet, so send them off!
             rays.resize(sample_count);
@@ -201,13 +215,14 @@
 
             computeAverages(fragment, sample_color, rays.getSize(),
                             samples_collected, current_fragment);
-            
+
             // Now reset the index, so that we can start filling up
             // the RayPacket again.
             sample_count = 0;
             // Make sure we start with a fresh slate
             rays.resetHit();
             rays.setFlags(flags);
+            //rays.setDepth(depth);
           }
         } // end sample filling loops
   } // end fragment loop
@@ -216,11 +231,11 @@
   if (sample_count > 0) {
     rays.resize(sample_count);
     context.renderer->traceEyeRays(context, rays);
-    
+
     computeAverages(fragment, sample_color, rays.getSize(),
                     samples_collected, current_fragment);
   }
-}  
+}
 
 
 

Modified: branches/AFR/Engine/Renderers/CMakeLists.txt
==============================================================================
--- branches/AFR/Engine/Renderers/CMakeLists.txt        (original)
+++ branches/AFR/Engine/Renderers/CMakeLists.txt        Mon Sep 19 03:34:20 
2005
@@ -1,6 +1,9 @@
 
 SET (Manta_Renderers_SRCS
+     Renderers/Moire.h
      Renderers/Moire.cc
+     Renderers/NullRenderer.h
      Renderers/NullRenderer.cc
+     Renderers/Raytracer.h
      Renderers/Raytracer.cc
      )

Modified: branches/AFR/Engine/Shadows/BeamShadows.cc
==============================================================================
--- branches/AFR/Engine/Shadows/BeamShadows.cc  (original)
+++ branches/AFR/Engine/Shadows/BeamShadows.cc  Mon Sep 19 03:34:20 2005
@@ -8,12 +8,9 @@
 #include <Interface/Scene.h>
 #include <Core/Util/Args.h>
 #include <Core/Exceptions/IllegalArgument.h>
-#include <Core/Math/Noise.h>
 
 using namespace Manta;
 
-static const double sqrt_two = 1.414213562373095;
-
 ShadowAlgorithm* BeamShadows::create(const vector<string>& args)
 {
   return new BeamShadows(args);
@@ -22,8 +19,6 @@
 BeamShadows::BeamShadows(const vector<string>& args)
 {
   bool gotRadius = false;
-  bool gotNoiseFreq = false;
-  bool gotNoiseAmp = false;
   int argc = static_cast<int>(args.size());
   for(int i=0; i< argc; i++){
     string arg = args[i];
@@ -31,26 +26,12 @@
       if(!getDoubleArg(i, args, radius))
         throw IllegalArgument("BeamShadows -radius", i, args);
       gotRadius = true;
-    } else if(arg == "-style") {
-      if(!getIntArg(i, args, style))
-        throw IllegalArgument("BeamShadows -style", i, args);
-    } else if(arg == "-noisefreq") {
-      if(!getDoubleArg(i, args, noisefreq))
-        throw IllegalArgument("BeamShadows -noisefreq", i, args);
-      gotNoiseFreq = true;
-    } else if(arg == "-noiseamp") {
-      if(!getDoubleArg(i, args, noiseamp))
-        throw IllegalArgument("BeamShadows -noiseamp", i, args);
-      gotNoiseAmp = true;
     } else {
       throw IllegalArgument("BeamShadows", i, args);
     }
   }
   if(!gotRadius)
     throw IllegalArgument("BeamShadows needs -radius", 0, args);
-  if(style==2&&!gotNoiseFreq&&!gotNoiseAmp)
-    throw IllegalArgument("BeamShadows style 2 needs -noisefreq and 
-noiseamp", 0, args);
-  noiseamp*=radius;
 }
 
 BeamShadows::~BeamShadows()
@@ -61,163 +42,65 @@
                               const LightSet* lights, RayPacket& rays,
                               int start, RayPacket& shadowRays)
 {
+#if 0
   int nlights = lights->numLights();
   rays.computeHitPositions();
+
   int sidx = 0;
   int end = start;
-  switch( style ) {
-    case 0:                     // Static tetrahedron
-      while(end < rays.getSize() && sidx+nlights*4 <= RayPacket::MaxSize){
-        RayPacket::Element& e = rays.get(end++);
-        e.shadowBegin = sidx;
-        for(int l = 0;l<nlights;l++){
-          Vector dir( lights->centers[l]+Vector(0,0,radius)-e.hitPosition );
-          if(Dot(dir, e.normal) > 0){
-            RayPacket::Element& s = shadowRays.get(sidx++);
-            double length = dir.normalize();
-            s.ray.set(e.hitPosition, dir);
-            s.light = lights->colors[l] * 0.25;
-            s.hitInfo.reset(length);
-          }
-          dir = 
lights->centers[l]+Vector(-2.0/3.0/sqrt_two*radius,-6.0/sqrt_two*radius,-1.0/3.0*radius)-e.hitPosition;
-          if(Dot(dir, e.normal) > 0){
-            RayPacket::Element& s = shadowRays.get(sidx++);
-            double length = dir.normalize();
-            s.ray.set(e.hitPosition, dir);
-            s.light = lights->colors[l] * 0.25;
-            s.hitInfo.reset(length);
-          }
-          dir = 
lights->centers[l]+Vector(-2.0/3.0/sqrt_two*radius,6.0/sqrt_two*radius,-1.0/3.0*radius)-e.hitPosition;
-          if(Dot(dir, e.normal) > 0){
-            RayPacket::Element& s = shadowRays.get(sidx++);
-            double length = dir.normalize();
-            s.ray.set(e.hitPosition, dir);
-            s.light = lights->colors[l] * 0.25;
-            s.hitInfo.reset(length);
-          }
-          dir = 
lights->centers[l]+Vector(4.0/3.0/sqrt_two*radius,0,-1.0/3.0*radius)-e.hitPosition;
-          if(Dot(dir, e.normal) > 0){
-            RayPacket::Element& s = shadowRays.get(sidx++);
-            double length = dir.normalize();
-            s.ray.set(e.hitPosition, dir);
-            s.light = lights->colors[l] * 0.25;
-            s.hitInfo.reset(length);
-          }
-        }
-        e.shadowEnd = sidx;
+  while(end < rays.getSize() && sidx+nlights*4 <= RayPacket::MaxSize){
+    RayPacket::Element& e = rays.get(end++);
+    e.shadowBegin = sidx;
+    for(int l = 0;l<nlights;l++){
+
+      Vector dir(lights->centers[l]+Vector(0,0,radius*0.75)-e.hitPosition);
+      if(Dot(dir, e.normal) > 0){
+        RayPacket::Element& s = shadowRays.get(sidx++);
+        double length = dir.normalize();
+        s.ray.set(e.hitPosition, dir);
+        s.light = lights->colors[l] * 0.25;
+        s.hitInfo.reset(length);
       }
-      break;
-    case 1:                     // Tetrahedron orients to illuminated spot
-      while(end < rays.getSize() && sidx+nlights*4 <= RayPacket::MaxSize){
-        RayPacket::Element& e = rays.get(end++);
-        e.shadowBegin = sidx;
-        for(int l = 0;l<nlights;l++){
-          Vector axis_z( e.hitPosition - lights->centers[l] );
-          axis_z.normalize();
-          Vector axis_y( Cross( axis_z, Vector( 0.0, 0.0, 1.0 ) ) );
-          axis_y.normalize();
-          Vector axis_x( Cross( axis_y, axis_z ) );
-          axis_x.normalize();
-          axis_x*=radius;
-          axis_y*=radius;
-          axis_z*=radius;
-          Vector dir( lights->centers[l] - e.hitPosition +
-                      axis_z );
-          if(Dot(dir, e.normal) > 0){
-            RayPacket::Element& s = shadowRays.get(sidx++);
-            double length = dir.normalize();
-            s.ray.set(e.hitPosition, dir);
-            s.light = lights->colors[l] * 0.25;
-            s.hitInfo.reset(length);
-          }
-          dir = ( lights->centers[l] - e.hitPosition +
-                  (-6.0/sqrt_two) * axis_y +
-                  (-2.0/3.0/sqrt_two) * axis_x +
-                  (-1.0/3.0) * axis_z );
-          if(Dot(dir, e.normal) > 0){
-            RayPacket::Element& s = shadowRays.get(sidx++);
-            double length = dir.normalize();
-            s.ray.set(e.hitPosition, dir);
-            s.light = lights->colors[l] * 0.25;
-            s.hitInfo.reset(length);
-          }
-          dir = ( lights->centers[l] - e.hitPosition +
-                  (6.0/sqrt_two) * axis_y +
-                  (-2.0/3.0/sqrt_two) * axis_x +
-                  (-1.0/3.0) * axis_z );
-          if(Dot(dir, e.normal) > 0){
-            RayPacket::Element& s = shadowRays.get(sidx++);
-            double length = dir.normalize();
-            s.ray.set(e.hitPosition, dir);
-            s.light = lights->colors[l] * 0.25;
-            s.hitInfo.reset(length);
-          }
-          dir = ( lights->centers[l] - e.hitPosition +
-                  (-4.0/3.0/sqrt_two) * axis_x +
-                  (-1.0/3.0) * axis_z );
-          if(Dot(dir, e.normal) > 0){
-            RayPacket::Element& s = shadowRays.get(sidx++);
-            double length = dir.normalize();
-            s.ray.set(e.hitPosition, dir);
-            s.light = lights->colors[l] * 0.25;
-            s.hitInfo.reset(length);
-          }
-        }
-        e.shadowEnd = sidx;
+
+      dir = lights->centers[l]+Vector(0,0,radius*0.25)-e.hitPosition;
+      if(Dot(dir, e.normal) > 0){
+        RayPacket::Element& s = shadowRays.get(sidx++);
+        double length = dir.normalize();
+        s.ray.set(e.hitPosition, dir);
+        s.light = lights->colors[l] * 0.25;
+        s.hitInfo.reset(length);
       }
-      break;
-    case 2:                     // Noised samples
-      while(end < rays.getSize() && sidx+nlights*4 <= RayPacket::MaxSize){
-        RayPacket::Element& e = rays.get(end++);
-        e.shadowBegin = sidx;
-        for(int l = 0;l<nlights;l++){
-          Vector dir( lights->centers[l]+Vector(0,0,radius)-e.hitPosition );
-          dir+=VectorNoise(Point(dir*noisefreq))*noiseamp;
-          if(Dot(dir, e.normal) > 0){
-            RayPacket::Element& s = shadowRays.get(sidx++);
-            double length = dir.normalize();
-            s.ray.set(e.hitPosition, dir);
-            s.light = lights->colors[l] * 0.25;
-            s.hitInfo.reset(length);
-          }
-          dir = 
lights->centers[l]+Vector(-2.0/3.0/sqrt_two*radius,-6.0/sqrt_two*radius,-1.0/3.0*radius)-e.hitPosition;
-          
dir+=VectorNoise(Point((dir+Vector(0,0,31.4159))*noisefreq))*noiseamp;
-          if(Dot(dir, e.normal) > 0){
-            RayPacket::Element& s = shadowRays.get(sidx++);
-            double length = dir.normalize();
-            s.ray.set(e.hitPosition, dir);
-            s.light = lights->colors[l] * 0.25;
-            s.hitInfo.reset(length);
-          }
-          dir = 
lights->centers[l]+Vector(-2.0/3.0/sqrt_two*radius,6.0/sqrt_two*radius,-1.0/3.0*radius)-e.hitPosition;
-          
dir+=VectorNoise(Point((dir+Vector(0,31.4159,0))*noisefreq))*noiseamp;
-          if(Dot(dir, e.normal) > 0){
-            RayPacket::Element& s = shadowRays.get(sidx++);
-            double length = dir.normalize();
-            s.ray.set(e.hitPosition, dir);
-            s.light = lights->colors[l] * 0.25;
-            s.hitInfo.reset(length);
-          }
-          dir = 
lights->centers[l]+Vector(4.0/3.0/sqrt_two*radius,0,-1.0/3.0*radius)-e.hitPosition;
-          
dir+=VectorNoise(Point((dir+Vector(31.4159,0,0))*noisefreq))*noiseamp;
-          if(Dot(dir, e.normal) > 0){
-            RayPacket::Element& s = shadowRays.get(sidx++);
-            double length = dir.normalize();
-            s.ray.set(e.hitPosition, dir);
-            s.light = lights->colors[l] * 0.25;
-            s.hitInfo.reset(length);
-          }
-        }
-        e.shadowEnd = sidx;
+
+      dir = lights->centers[l]+Vector(0,0,radius*-0.25)-e.hitPosition;
+      if(Dot(dir, e.normal) > 0){
+        RayPacket::Element& s = shadowRays.get(sidx++);
+        double length = dir.normalize();
+        s.ray.set(e.hitPosition, dir);
+        s.light = lights->colors[l] * 0.25;
+        s.hitInfo.reset(length);
       }
-      break;
+
+      dir = lights->centers[l]+Vector(0,0,radius*-0.75)-e.hitPosition;
+      if(Dot(dir, e.normal) > 0){
+        RayPacket::Element& s = shadowRays.get(sidx++);
+        double length = dir.normalize();
+        s.ray.set(e.hitPosition, dir);
+        s.light = lights->colors[l] * 0.25;
+        s.hitInfo.reset(length);
+      }
+
+    }
+    e.shadowEnd = sidx;
   }
+
   
shadowRays.setFlag(RayPacket::NormalizedDirections|RayPacket::HaveHitRecords);
   shadowRays.resize(sidx);
   if(end == start+1)
     shadowRays.setFlag(RayPacket::ConstantOrigin);
   context.scene->getObject()->intersect(context, shadowRays);
   return end;
+#endif
+       return 0;
 }
 
 string BeamShadows::getName() const {

Modified: branches/AFR/Engine/Shadows/BeamShadows.h
==============================================================================
--- branches/AFR/Engine/Shadows/BeamShadows.h   (original)
+++ branches/AFR/Engine/Shadows/BeamShadows.h   Mon Sep 19 03:34:20 2005
@@ -28,9 +28,6 @@
     BeamShadows& operator=(const BeamShadows&);
 
     double radius;
-    int style;
-    double noisefreq;
-    double noiseamp;
   };
 }
 

Modified: branches/AFR/Engine/Shadows/CMakeLists.txt
==============================================================================
--- branches/AFR/Engine/Shadows/CMakeLists.txt  (original)
+++ branches/AFR/Engine/Shadows/CMakeLists.txt  Mon Sep 19 03:34:20 2005
@@ -1,6 +1,9 @@
 
 SET (Manta_Shadows_SRCS
+     Shadows/NoShadows.h
      Shadows/NoShadows.cc
+     Shadows/HardShadows.h
      Shadows/HardShadows.cc
+     Shadows/BeamShadows.h
      Shadows/BeamShadows.cc
      )

Modified: branches/AFR/Engine/Shadows/HardShadows.cc
==============================================================================
--- branches/AFR/Engine/Shadows/HardShadows.cc  (original)
+++ branches/AFR/Engine/Shadows/HardShadows.cc  Mon Sep 19 03:34:20 2005
@@ -23,35 +23,108 @@
 }
 
 int HardShadows::computeShadows(const RenderContext& context,
-                             const LightSet* lights, RayPacket& rays,
-                             int start, RayPacket& shadowRays)
+                                                                             
                                                  const LightSet* lights, 
+                                                                             
                                                  RayPacket& rays,            
  // Input rays.
+                                                                             
                                                  int start,                  
  // Offset to start from in input rays?
+                                                                             
                                                  RayPacket& shadow_rays)     
  // Output shadow rays, already intersected.
 {
   int nlights = lights->numLights();
-  rays.computeHitPositions();
+  
+       // Compute the hit positions.
+       rays.computeHitPositions();
+       rays.computeNormals( context );
+       
+#if 0
+       // Construct a shadow ray packet.
+       // NOTE: this code won't send more then RayPacket::MaxSize shadow 
rays.
+       // Although the old code didn't either.
+       
+       Real   distance [RayPacket::MaxSize];
+       Color  color    [RayPacket::MaxSize];
+       Vector direction[RayPacket::MaxSize];
+
+       int shadow_i = 0; // Iterator over computed shadow rays.
+       int i = start;    // Iterator over initial rays used to compute 
shadow rays.
+       
+       // NEED TO MAKE SURE ORDER MATCHES MATERIAL SHADER!!
+       // WANT ALL RAYS TOWARDS ONE LIGHT TO BE COMMON PACKET.
+       // 
+       
+       // Iterate over the lights and compute directions, colors, distances.
+       for (int light=0; 
+            (light<lights->numLights()) && 
+                        (shadow_i<RayPacket::MaxSize); 
+                        ++light) {
+               
+               // Compute the info for this light.
+               lights->get(light)->getLight( distance, color, direction, 
rays, context );
+               
+               // Compute the shadow rays and append them to the shadow 
packet.
+               
+               // Set the shadow ray.
+               for (int i=0; ((shadow_i+i)<RayPacket::MaxSize) && 
(i<rays.getSize();++i) {
+                       shadow_rays.get(shadow_i+i).ray.set( 
rays[i].hitPosition, direction[i] );
+               }
+               
+               // Copy the light contribution.
+               for (int i=0; ((shadow_i+i)<RayPacket::MaxSize) && 
(i<rays.getSize();++i) {             
+                       shadow_rays.get(shadow_i+i).light = 
lights[light].color;
+               }       
+               
+               // Copy the distance.
+               for (int i=0; ((shadow_i+i)<RayPacket::MaxSize) && 
(i<rays.getSize();++i) {
+                       shadow_rays.get(shadow_i+i).hitInfo.reset( 
distance[i] );
+               }
+               
+               // Move to the next part of the shadow ray packet.
+               shadow_i += rays.getSize();
+       }
+#endif
 
   int sidx = 0;
   int end = start;
   while(end < rays.getSize() && sidx+nlights <= RayPacket::MaxSize){
+
     RayPacket::Element& e = rays.get(end++);
+
+               // Specify the beginning index for this ray in the shadow 
packet.
     e.shadowBegin = sidx;
-    for(int l = 0;l<nlights;l++){
-      Vector dir(lights->centers[l]-e.hitPosition);
-      if(Dot(dir, e.normal)  > 0){
-       RayPacket::Element& s = shadowRays.get(sidx++);
-       double length = dir.normalize();
-       s.ray.set(e.hitPosition, dir);
-       s.light = lights->colors[l];
-       s.hitInfo.reset(length);
+
+               // Iterate over the lights and create shadow rays.
+    for(int l=0;l<nlights;l++){
+               
+                       Vector dir;
+                       Color  color;
+               
+                 // Compute the contribution for this light.
+                       lights->getLight(l)->computeLight( color, dir, 
context, e );
+      
+                       // Check to see if the light is on the front face.
+      if(Dot(dir, e.normal) > 0) {
+                       
+                               // If so normalize and compute length.
+                               Real length = dir.normalize();
+                       
+                               // Populate the shadow ray.
+                               RayPacket::Element& s = 
shadow_rays.get(sidx++);
+                               s.ray.set( e.hitPosition, dir );
+                               s.light = color;
+                               s.hitInfo.reset( length );
       }
     }
     e.shadowEnd = sidx;
   }
-
-  
shadowRays.setFlag(RayPacket::NormalizedDirections|RayPacket::HaveHitRecords);
-  shadowRays.resize(sidx);
+       
+       // Send the shadow rays.
+  shadow_rays.setFlag( 
RayPacket::NormalizedDirections|RayPacket::HaveHitRecords );
+  shadow_rays.resize ( sidx );
+       
+       // Check to see if all of the shadow rays start from the same input 
ray.
   if(end == start+1)
-    shadowRays.setFlag(RayPacket::ConstantOrigin);
-  context.scene->getObject()->intersect(context, shadowRays);
+    shadow_rays.setFlag( RayPacket::ConstantOrigin );
+  
+       context.scene->getObject()->intersect(context, shadow_rays);
+       
   return end;
 }
 

Modified: branches/AFR/Engine/Shadows/NoShadows.cc
==============================================================================
--- branches/AFR/Engine/Shadows/NoShadows.cc    (original)
+++ branches/AFR/Engine/Shadows/NoShadows.cc    Mon Sep 19 03:34:20 2005
@@ -19,24 +19,32 @@
 {
 }
 
-int NoShadows::computeShadows(const RenderContext&,
-                             const LightSet* lights, RayPacket& rays,
-                             int start, RayPacket& shadowRays)
+int NoShadows::computeShadows(const RenderContext& context,
+                                                                             
                                          const LightSet* lights, RayPacket& 
rays,
+                                                                             
                                          int start, RayPacket& shadowRays)
 {
   int nlights = lights->numLights();
   rays.computeHitPositions();
-
+       
   int sidx = 0;
   while(start < rays.getSize() && sidx+nlights < RayPacket::MaxSize){
     RayPacket::Element& e = rays.get(start++);
     e.shadowBegin = sidx;
     for(int l = 0;l<nlights;l++){
+               
+                       Color color;
+                       Vector dir;
+               
+                       // Compute the direction & color of this light.
+                       
lights->getLight(l)->computeLight(color,dir,context,e);
+               
+                       // Construct the shadow ray.
       RayPacket::Element& s = shadowRays.get(sidx);
-      Vector dir(lights->centers[l]-e.hitPosition);
+                       
       if(Dot(dir, e.normal)  > 0){
-       sidx++;
-       s.ray.setDirection(dir);
-       s.light = lights->colors[l];
+                               sidx++;
+                               s.ray.setDirection(dir);
+                               s.light = color;
       }
     }
     e.shadowEnd = sidx;

Modified: branches/AFR/Image/CMakeLists.txt
==============================================================================
--- branches/AFR/Image/CMakeLists.txt   (original)
+++ branches/AFR/Image/CMakeLists.txt   Mon Sep 19 03:34:20 2005
@@ -1,3 +1,15 @@
 
-ADD_LIBRARY (Manta_Image NullImage.cc TGAFile.cc)
+ADD_LIBRARY (Manta_Image 
+             NullImage.cc
+             NullImage.h
+             Pixel.h
+             SimpleImage.h
+             SimpleImage_templates.cc
+             TGAFile.h
+             TGAFile.cc
+#             MultipipeImage.h
+#             MultipipeImage.cc  
+             )
+
+
 TARGET_LINK_LIBRARIES(Manta_Image Manta_Interface SCIRun_Core)

Modified: branches/AFR/Image/SimpleImage.h
==============================================================================
--- branches/AFR/Image/SimpleImage.h    (original)
+++ branches/AFR/Image/SimpleImage.h    Mon Sep 19 03:34:20 2005
@@ -25,7 +25,7 @@
     static Image* create(const std::vector<std::string>& args, bool stereo,
                         int xres, int yres);
 
-    const Pixel* getRaw(int which_eye) const;
+    Pixel* getRaw(int which_eye) const;
   private:
     SimpleImage(const Image&);
     SimpleImage& operator=(const SimpleImage&);
@@ -133,7 +133,7 @@
   }
 
   template<class Pixel>
-  const Pixel* SimpleImage<Pixel>::getRaw(int which_eye) const
+       Pixel* SimpleImage<Pixel>::getRaw(int which_eye) const
   {
     return eyeStart[which_eye][0];
   }

Modified: branches/AFR/Image/SimpleImage_templates.cc
==============================================================================
--- branches/AFR/Image/SimpleImage_templates.cc (original)
+++ branches/AFR/Image/SimpleImage_templates.cc Mon Sep 19 03:34:20 2005
@@ -1,5 +1,5 @@
-#include <Packages/manta/Image/SimpleImage.h>
-#include <Packages/manta/Image/Pixel.h>
+#include <Image/SimpleImage.h>
+#include <Image/Pixel.h>
 
 using namespace Manta;
 

Modified: branches/AFR/Interface/CMakeLists.txt
==============================================================================
--- branches/AFR/Interface/CMakeLists.txt       (original)
+++ branches/AFR/Interface/CMakeLists.txt       Mon Sep 19 03:34:20 2005
@@ -1,26 +1,57 @@
 
 ADD_LIBRARY(Manta_Interface
+        AmbientLight.h
         AmbientLight.cc
+        Background.h
         Background.cc
+        Camera.h
         Camera.cc
+        Context.h
+        Fragment.h
+        HitInfo.h
+        IdleMode.h
         IdleMode.cc
+        Image.h
         Image.cc
+        ImageDisplay.h
         ImageDisplay.cc
+        ImageTraverser.h
         ImageTraverser.cc
+        Light.h
         Light.cc
+        LightSet.h
         LightSet.cc
+        LoadBalancer.h
         LoadBalancer.cc
+        Material.h
         Material.cc
+        Object.h
         Object.cc
+        PixelSampler.h
         PixelSampler.cc
+        Primitive.h
         Primitive.cc
+        RayPacket.h
+        Renderer.h
         Renderer.cc
+        RenderParameters.h
+        RTRTInterface.h
         RTRTInterface.cc
+        SetupCallback.h
         SetupCallback.cc
+        Scene.h
+        ShadowAlgorithm.h
         ShadowAlgorithm.cc
+        TexCoordMapper.h
         TexCoordMapper.cc
+        Texture.h
+        Transaction.h
         Transaction.cc
+        UserInterface.h
         UserInterface.cc
+        XWindow.h
+        Callback.h
+        CallbackHelpers.h
         )
 
 TARGET_LINK_LIBRARIES(Manta_Interface SCIRun_Core)

Modified: branches/AFR/Interface/Callback.h
==============================================================================
--- branches/AFR/Interface/Callback.h   (original)
+++ branches/AFR/Interface/Callback.h   Mon Sep 19 03:34:20 2005
@@ -13,16 +13,40 @@
       return new Callback_0Data_0Arg<T>(ptr, pmf);
     }
 
+               template<class T> static
+    CallbackBase_0Data*
+    create(T* ptr, void (T::*pmf)() const) {
+      return new Callback_0Data_0Arg_const<T>(ptr, pmf);
+    }
+
     template<class T, typename Arg1> static
     CallbackBase_0Data*
     create(T* ptr, void (T::*pmf)(Arg1), Arg1 arg1) {
       return new Callback_0Data_1Arg<T, Arg1>(ptr, pmf, arg1);
     }
+               
+               template<class T, typename Arg1> static
+    CallbackBase_0Data*
+    create(T* ptr, void (T::*pmf)(Arg1) const, Arg1 arg1) {
+      return new Callback_0Data_1Arg_const<T, Arg1>(ptr, pmf, arg1);
+    }
 
     template<class T, typename Arg1, typename Arg2> static
     CallbackBase_0Data*
     create(T* ptr, void (T::*pmf)(Arg1, Arg2), Arg1 arg1, Arg2 arg2) {
       return new Callback_0Data_2Arg<T, Arg1, Arg2>(ptr, pmf, arg1, arg2);
+    }
+               
+               template<class T, typename Arg1, typename Arg2> static
+    CallbackBase_0Data*
+    create(T* ptr, void (T::*pmf)(Arg1, Arg2) const, Arg1 arg1, Arg2 arg2) {
+      return new Callback_0Data_2Arg_const<T, Arg1, Arg2>(ptr, pmf, arg1, 
arg2);
+    }
+
+               template<class T, typename Arg1, typename Arg2, typename 
Arg3, typename Arg4> static
+    CallbackBase_0Data*
+    create(T* ptr, void (T::*pmf)(Arg1, Arg2, Arg3, Arg4), Arg1 arg1, Arg2 
arg2, Arg3 arg3, Arg4 arg4) {
+      return new Callback_0Data_4Arg<T, Arg1, Arg2, Arg3, Arg4>(ptr, pmf, 
arg1, arg2, arg3, arg4);
     }
 
     template<class T, typename Data1> static

Modified: branches/AFR/Interface/CallbackHelpers.h
==============================================================================
--- branches/AFR/Interface/CallbackHelpers.h    (original)
+++ branches/AFR/Interface/CallbackHelpers.h    Mon Sep 19 03:34:20 2005
@@ -140,6 +140,26 @@
     void (T::*pmf)();
   };
 
+  template<class T>
+               class Callback_0Data_0Arg_const : public CallbackBase_0Data {
+               public:
+                       Callback_0Data_0Arg_const(T* ptr, void (T::*pmf)() 
const)
+      : ptr(ptr), pmf(pmf)
+    {
+    }
+                       virtual ~Callback_0Data_0Arg_const()
+    {
+    }
+                       virtual void call()
+    {
+                               (ptr->*pmf)();
+    }
+               private:
+                       T* ptr;
+                       void (T::*pmf)() const;
+               };
+       
+
   template<class T, typename Arg1>
   class Callback_0Data_1Arg : public CallbackBase_0Data {
   public:
@@ -160,6 +180,26 @@
     Arg1 arg1;
   };
 
+       template<class T, typename Arg1>
+       class Callback_0Data_1Arg_const : public CallbackBase_0Data {
+       public:
+               Callback_0Data_1Arg_const(T* ptr, void (T::*pmf)(Arg1) const, 
Arg1 arg1)
+               : ptr(ptr), pmf(pmf), arg1(arg1)
+       {
+       }
+               virtual ~Callback_0Data_1Arg_const()
+       {
+       }
+               virtual void call()
+       {
+                       (ptr->*pmf)(arg1);
+       }
+       private:
+               T* ptr;
+               void (T::*pmf)(Arg1) const;
+               Arg1 arg1;
+       };
+
   template<class T, typename Arg1, typename Arg2>
   class Callback_0Data_2Arg : public CallbackBase_0Data {
   public:
@@ -180,6 +220,50 @@
     Arg1 arg1;
     Arg2 arg2;
   };
+
+       template<class T, typename Arg1, typename Arg2>
+       class Callback_0Data_2Arg_const : public CallbackBase_0Data {
+       public:
+               Callback_0Data_2Arg_const(T* ptr, void (T::*pmf)(Arg1, Arg2) 
const, Arg1 arg1, Arg2 arg2)
+               : ptr(ptr), pmf(pmf), arg1(arg1), arg2(arg2)
+       {
+       }
+               virtual ~Callback_0Data_2Arg_const()
+       {
+       }
+               virtual void call()
+       {
+                       (ptr->*pmf)(arg1, arg2);
+       }
+       private:
+               T* ptr;
+               void (T::*pmf)(Arg1, Arg2) const;
+               Arg1 arg1;
+               Arg2 arg2;
+       };
+
+       template<class T, typename Arg1, typename Arg2, typename Arg3, 
typename Arg4 >
+               class Callback_0Data_4Arg : public CallbackBase_0Data {
+       public:
+                       Callback_0Data_4Arg(T* ptr, void (T::*pmf)(Arg1, 
Arg2, Arg2, Arg4), Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
+      : ptr(ptr), pmf(pmf), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4)
+    {
+    }
+                       virtual ~Callback_0Data_4Arg()
+    {
+    }
+                       virtual void call()
+    {
+                               (ptr->*pmf)(arg1, arg2, arg3, arg4);
+    }
+               private:
+                       T* ptr;
+                       void (T::*pmf)(Arg1, Arg2, Arg3, Arg4);
+                       Arg1 arg1;
+                       Arg2 arg2;
+                       Arg3 arg3;
+                       Arg4 arg4;
+               };
 
   // 1 Data
   template<class T, typename Data1>

Modified: branches/AFR/Interface/Camera.h
==============================================================================
--- branches/AFR/Interface/Camera.h     (original)
+++ branches/AFR/Interface/Camera.h     Mon Sep 19 03:34:20 2005
@@ -3,6 +3,7 @@
 #define Manta_Interface_Camera_h
 
 #include <MantaTypes.h>
+#include <ostream>
 #include <stdio.h>
 
 namespace Manta {
@@ -16,10 +17,21 @@
 
     // Camera manipulation
     virtual void scaleFOV(double) = 0;
-    virtual void translate(Vector v) = 0;
+    virtual void translate(Vector v) = 0; // Translate in image plane 
coordinates.
     virtual void dolly(double) = 0;
+               
+               // Accessors
+               virtual Point  getPosition() const = 0; // This method is 
called to get the eye point by HeadLight etc.
+               virtual Vector getUp()       const = 0; // This method 
returns the "horizontal center of rotation" about the camera.
+               virtual Point  getLookAt()   const = 0; // This method 
returns the "center of rotation point" about the look at point.
+               
+               // Reset the camera.
+               virtual void reset( const Point &eye_, const Vector &up_, 
const Point &lookat_ ) = 0;
+               
     virtual Point project(const Point &point) const = 0; // project the 3D 
point on to the camera image plane
+
     virtual void writeToFile(FILE *fp) const = 0;
+
     enum TransformCenter {
       LookAt,
       Eye,
@@ -27,6 +39,7 @@
     };
     virtual void transform(AffineTransform t, TransformCenter) = 0;
     virtual void autoview(double fov) = 0;
+               virtual void output( std::ostream &os ) { /* Default does 
nothing. */ }; // Output a text description of the camera's state.
   private:
     Camera(const Camera&);
     Camera& operator=(const Camera&);

Modified: branches/AFR/Interface/Context.h
==============================================================================
--- branches/AFR/Interface/Context.h    (original)
+++ branches/AFR/Interface/Context.h    Mon Sep 19 03:34:20 2005
@@ -174,6 +174,7 @@
   };
   class PreprocessContext {
   public:
+               PreprocessContext() {  }; // Lights are dynamic now. This 
context isn't needed.
     PreprocessContext(RTRTInterface* /*rtrt_int*/, LightSet* globalLights)
       : globalLights(globalLights)
     {

Modified: branches/AFR/Interface/Fragment.cc
==============================================================================
--- branches/AFR/Interface/Fragment.cc  (original)
+++ branches/AFR/Interface/Fragment.cc  Mon Sep 19 03:34:20 2005
@@ -1,5 +1,5 @@
 
-#include <Packages/manta/Interface/Fragment.h>
+#include <Interface/Fragment.h>
 #include <Core/Util/FancyAssert.h>
 
 using namespace Manta;

Modified: branches/AFR/Interface/Fragment.h
==============================================================================
--- branches/AFR/Interface/Fragment.h   (original)
+++ branches/AFR/Interface/Fragment.h   Mon Sep 19 03:34:20 2005
@@ -59,6 +59,7 @@
       data[size].which_eye = which_eye;
       size++;
     }
+
     // input: a rectangular tile and number of sample locations to generate
     // output: creates randomly oriented sample locations in given range
     void createRandom(const int numElements,

Modified: branches/AFR/Interface/HitInfo.cc
==============================================================================
--- branches/AFR/Interface/HitInfo.cc   (original)
+++ branches/AFR/Interface/HitInfo.cc   Mon Sep 19 03:34:20 2005
@@ -1,4 +1,4 @@
 
-#include <Packages/manta/Interface/HitInfo.h>
+#include <Interface/HitInfo.h>
 
 using namespace Manta;

Modified: branches/AFR/Interface/HitInfo.h
==============================================================================
--- branches/AFR/Interface/HitInfo.h    (original)
+++ branches/AFR/Interface/HitInfo.h    Mon Sep 19 03:34:20 2005
@@ -2,6 +2,7 @@
 #ifndef Manta_Interface_HitInfo_h
 #define Manta_Interface_HitInfo_h
 
+#include <MantaTypes.h>
 #include <Interface/Parameters.h>
 #include <Core/Util/Assert.h>
 #include <stdlib.h>
@@ -16,19 +17,19 @@
   class Material;
   class Primitive;
   class TexCoordMapper;
-
+       
   // Convenience struct to hold a material, primitive and texcoordmapper
   struct MPT {
     const Material* material;
     const Primitive* primitive;
     const TexCoordMapper* tex;
     MPT(const Material* material, const Primitive* primitive,
-       const TexCoordMapper* tex)
+                               const TexCoordMapper* tex)
       : material(material), primitive(primitive), tex(tex)
     {
     }
   };
-
+       
   // Convenience struct to hold a material, primitive and texcoordmapper
   // and a scale/inverse scale
   struct MPTscale {
@@ -38,23 +39,23 @@
     double scale;
     double inv_scale;
     MPTscale(const Material* material, const Primitive* primitive,
-            const TexCoordMapper* tex, double scale, double inv_scale)
+                                                const TexCoordMapper* tex, 
double scale, double inv_scale)
       : material(material), primitive(primitive), tex(tex),
-       scale(scale), inv_scale(inv_scale)
+                       scale(scale), inv_scale(inv_scale)
     {
     }
   };
-
+       
   class HitInfo {
-  public:
+public:
     HitInfo()
-    {
-    }
-
+       {
+       }
+               
     ~HitInfo()
-    {
-    }
-      
+       {
+       }
+               
     inline void reset() {
       hitMatl = 0;
       min_t = MAXT;
@@ -75,33 +76,38 @@
     const TexCoordMapper* hitTexCoordMapper() const {
       return hitTex;
     }
-    double minT() const {
+    Real minT() const {
       return min_t;
     }
     void scaleT(double scale) {
       if(hitMatl != 0)
-       min_t *= scale;
+                               min_t *= scale;
     }
     void overrideT(double new_mint) {
       min_t = new_mint;
     }
-
+               
     bool hit(double t, const Material* matl, const Primitive* prim,
-            const TexCoordMapper* tex) {
+                                                const TexCoordMapper* tex) {
       if(t<T_EPSILON)
-       return false;
+                               return false;
       if(t < min_t){
-       min_t=t;
-       hitMatl = matl;
-       hitPrim = prim;
-       hitTex = tex;
-       return true;
+                               min_t=t;
+                               hitMatl = matl;
+                               hitPrim = prim;
+                               hitTex = tex;
+                               return true;
       } else {
-       return false;
+                               return false;
       }
     }
     static const size_t MaxScratchpadSize = 128;
-
+               
+               void copyScratchpad( const HitInfo &info ) {
+                       for (int i=0;i<MaxScratchpadSize;++i)
+                               scratchpad_data[i] = info.scratchpad_data[i];
+               }
+               
     template<class T> T& scratchpad() {
       
       // This pragma relates to the following expression being
@@ -119,14 +125,14 @@
       return *(T*)scratchpad_data;
     }
     
-  private:
-    HitInfo(const HitInfo&);
+private:
+                       HitInfo(const HitInfo&);
     HitInfo& operator=(const HitInfo&);
-
+               
     const Primitive* hitPrim;
     const Material* hitMatl;
     const TexCoordMapper* hitTex;
-    double min_t;
+    Real min_t;
     char scratchpad_data[MaxScratchpadSize];
   };
 }

Modified: branches/AFR/Interface/Light.h
==============================================================================
--- branches/AFR/Interface/Light.h      (original)
+++ branches/AFR/Interface/Light.h      Mon Sep 19 03:34:20 2005
@@ -3,21 +3,45 @@
 #define Manta_Interface_Light_h
 
 #include <Core/Color/Color.h>
+#include <Core/Geometry/PointVector.h>
+#include <Interface/RayPacket.h>
 
 namespace Manta {
 
   class PreprocessContext;
+       class RenderContext;
+       
   class Light {
   public:
     Light();
     virtual ~Light();
+               
+    virtual void preprocess( const PreprocessContext& context ) = 0;
+    // virtual const Point& getCenter() const = 0;
+    // virtual const Color& getColor() const = 0;
 
-    virtual void preprocess(const PreprocessContext& context) = 0;
-    virtual const Point& getCenter() const = 0;
-    virtual const Color& getColor() const = 0;
+#if 0          
+               // This method is called on the light by the shadow 
algorithm. The color and direction 
+               // produced by the light may change for each ray in the 
packet, and may change based 
+               // on the render context.
+               virtual void computeLight( Real   
lightDistance[RayPacket::MaxSize], 
+                                          Color  
resultColor[RayPacket::MaxSize], 
+                                                                             
                               Vector lightDirection[RayPacket::MaxSize], 
+                                                                             
                           
+                                                                             
                           RenderContext &context, RayPacket &rays ) = 0;
+#endif
+
+               // This method is called on the light by the shadow algorithm 
to compute
+               // the direction and contribution for one ray packet element.
+               // The direction is not normalized and the distance to the 
light from 
+               // the intersection must be computed.
+               virtual void computeLight( Color &resultColor, Vector 
&lightDirection,
+                                          const RenderContext &context, 
RayPacket::Element &e ) const = 0;
+               
   private:
-    Light(const Light&);
-    Light& operator=(const Light&);
+               // Lights may not be copied.
+    Light( const Light & );
+    Light& operator = ( const Light & );
   };
 }
 

Modified: branches/AFR/Interface/LightSet.cc
==============================================================================
--- branches/AFR/Interface/LightSet.cc  (original)
+++ branches/AFR/Interface/LightSet.cc  Mon Sep 19 03:34:20 2005
@@ -3,14 +3,7 @@
 #include <Interface/AmbientLight.h>
 #include <Interface/Light.h>
 #include <Core/Util/Assert.h>
-
-#include <sgi_stl_warnings_off.h>
-#include <iostream>
-#include <sstream>
-#include <sgi_stl_warnings_on.h>
-
 using namespace Manta;
-using namespace std;
 
 LightSet* LightSet::merge(LightSet* l1, LightSet* l2)
 {
@@ -30,30 +23,14 @@
 void LightSet::preprocess(const PreprocessContext& context)
 {
   // This won't work in many of the shadow algorithms
-  ASSERT(static_cast<int>(lights.size()) <= RayPacket::MaxSize);
-  if(ambientLight){
-    AmbientLight* test = dynamic_cast<AmbientLight*>(ambientLight);
-    if (test)
-      ambientLight->preprocess(context);
-    else
-      cerr << "ambientLight is not an AmbientLight\n";
-  }
-  for(int i=0;i<static_cast<int>(lights.size());i++){
+  // ASSERT(static_cast<int>(lights.size()) <= RayPacket::MaxSize);
+  
+       // Call preprocess on ambient light.
+       ambientLight->preprocess(context);
+       
+       // Call preprocess on each light.
+  for(unsigned int i=0;i<lights.size();++i){
     lights[i]->preprocess(context);
-    centers[i] = lights[i]->getCenter();
-    colors[i] = lights[i]->getColor();
   }
 }
 
-string LightSet::toString() {
-  ostringstream out;
-  out << "ambientLight = "<<ambientLight<<"\n";
-  if (ambientLight)
-    out << ambientLight->toString();
-  out << "Num lights = "<<lights.size()<<"\n";
-  for(int i = 0; i < static_cast<int>(lights.size()); i++) {
-    out << "lights["<<i<<"] = "<<lights[i]<<"\n";
-    //    if (lights[i]) lights[i]->printme();
-  }
-  return out.str();
-}

Modified: branches/AFR/Interface/LightSet.h
==============================================================================
--- branches/AFR/Interface/LightSet.h   (original)
+++ branches/AFR/Interface/LightSet.h   Mon Sep 19 03:34:20 2005
@@ -3,10 +3,8 @@
 #define Manta_Interface_LightSet_h
 
 #include <Interface/RayPacket.h>
-
 #include <sgi_stl_warnings_off.h>
 #include <vector>
-#include <string>
 #include <sgi_stl_warnings_on.h>
 
 namespace Manta {
@@ -17,48 +15,30 @@
 
   class LightSet {
   public:
-    LightSet()
-      : ambientLight(0)
-    {
-    }
-    ~LightSet()
-    {
-    }
-
-    const AmbientLight* getAmbientLight() const
-    {
-      return ambientLight;
-    }
-    void setAmbientLight(AmbientLight* newamb)
-    {
-      ambientLight = newamb;
-    }
-
-    int numLights() const
-    {
-      return static_cast<int>(lights.size());
-    }
-    void add(Light* light)
-    {
-      lights.push_back(light);
-    }
-
-    const Light* getLight(int which) const
-    {
-      return lights[which];
-    }
-    Light* getLight(int which)
-    {
-      return lights[which];
-    }
-    static LightSet* merge(LightSet* l1, LightSet* l2);
+               LightSet()            : ambientLight(0) {  };
+               LightSet( int size_ ) : lights( size_ ), ambientLight(0) {  };
+    ~LightSet() {  }
+
+               // Get and set the ambient light for the scene.
+    const AmbientLight* getAmbientLight() const { return ambientLight; }
+    void setAmbientLight(AmbientLight* newamb) { ambientLight = newamb; }
+    
+               // Determine the size of the light set.
+               int numLights() const { return 
static_cast<int>(lights.size()); }
+
+               // Append a light to the light set.
+    void add(Light* light) { lights.push_back(light); }
+               
+               // Accessors.
+    const Light* getLight(int which) const { return lights[which]; }
+    Light* getLight(int which)             { return lights[which]; }
+    
+               // Combine two light sets.
+               static LightSet* merge(LightSet* l1, LightSet* l2);
 
+               // Calls preprocess on each light.
     void preprocess(const PreprocessContext&);
 
-    string toString();
-
-    Point centers[RayPacket::MaxSize];
-    Color colors[RayPacket::MaxSize];
   private:
     LightSet(const LightSet&);
     LightSet& operator=(const LightSet&);

Modified: branches/AFR/Interface/Material.h
==============================================================================
--- branches/AFR/Interface/Material.h   (original)
+++ branches/AFR/Interface/Material.h   Mon Sep 19 03:34:20 2005
@@ -18,8 +18,8 @@
     virtual void preprocess(const PreprocessContext&) = 0;
     virtual void shade(const RenderContext& context, RayPacket& rays) const 
= 0;
   private:
-    Material(const Material&);
-    Material& operator=(const Material&);
+    // Material(const Material&);
+    // Material& operator=(const Material&);
   };
 }
 

Modified: branches/AFR/Interface/Object.h
==============================================================================
--- branches/AFR/Interface/Object.h     (original)
+++ branches/AFR/Interface/Object.h     Mon Sep 19 03:34:20 2005
@@ -3,6 +3,7 @@
 #define Manta_Interface_Object_h
 
 namespace Manta {
+
   class BBox;
   class PreprocessContext;
   class RayPacket;
@@ -14,12 +15,11 @@
     virtual ~Object();
 
     virtual void preprocess(const PreprocessContext& context) = 0;
-    virtual void computeBounds(const PreprocessContext& context,
-                               BBox& bbox) const = 0;
+    virtual void computeBounds(const PreprocessContext& context, BBox& bbox) 
const = 0;
     virtual void intersect(const RenderContext& context, RayPacket& rays) 
const = 0;
   private:
-    Object(const Object&);
-    Object& operator=(const Object&);
+    // Object(const Object&);
+    // Object& operator=(const Object&);
   };
 }
 

Modified: branches/AFR/Interface/Parameters.h
==============================================================================
--- branches/AFR/Interface/Parameters.h (original)
+++ branches/AFR/Interface/Parameters.h Mon Sep 19 03:34:20 2005
@@ -3,6 +3,6 @@
 #define Manta_Interface_Parameters_h
 
 #define MAXCACHELINESIZE 128
-#define T_EPSILON 1.e-8
+#define T_EPSILON 1.e-3
 
 #endif

Modified: branches/AFR/Interface/Primitive.h
==============================================================================
--- branches/AFR/Interface/Primitive.h  (original)
+++ branches/AFR/Interface/Primitive.h  Mon Sep 19 03:34:20 2005
@@ -19,8 +19,9 @@
                               RayPacket& rays) const = 0;
     virtual void setTexCoordMapper(const TexCoordMapper* new_tex) = 0;
   private:
-    Primitive(const Primitive&);
-    Primitive& operator=(const Primitive&);
+         // These undefined private methods make it so that primitives 
cannot be copied.
+    // Primitive(const Primitive&);
+    // Primitive& operator=(const Primitive&);
   };
 }
 

Modified: branches/AFR/Interface/RTRTInterface.h
==============================================================================
--- branches/AFR/Interface/RTRTInterface.h      (original)
+++ branches/AFR/Interface/RTRTInterface.h      Mon Sep 19 03:34:20 2005
@@ -38,9 +38,15 @@
     typedef ImageDisplay* (*ImageDisplayCreator)(const vector<string>& args);
     virtual int createChannel(const string& modespec, Camera* camera,
                              bool stereo, int xres, int yres) = 0;
+                                               
+               // 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 void registerComponent(const string& name, ImageDisplayCreator 
display) = 0;
     virtual listType listImageDisplays() const = 0;
     virtual Camera* getCamera(int channel) const = 0;
+               virtual void    setCamera(int channel, Camera *camera ) = 0;
     virtual void getResolution(int channel, bool& stereo, int& xres, int& 
yres) = 0;
     // You can change the resolution of the rendered image without
     // having to change the pipeline.  If you want the pipeline
@@ -69,6 +75,7 @@
     virtual listType listLoadBalancers() const = 0;
 
     // PixelSamplers
+               virtual void setPixelSampler( PixelSampler *sampler_ ) = 0;
     typedef PixelSampler* (*PixelSamplerCreator)(const vector<string>& args);
     virtual bool selectPixelSampler(const string& spec) = 0;
     virtual void registerComponent(const string& name, PixelSamplerCreator 
creator) = 0;
@@ -101,6 +108,7 @@
     // Scenes
     virtual bool haveScene() = 0;
     virtual void setScene(Scene* scene) = 0;
+               virtual Scene *getScene() = 0;
     virtual bool readScene(const string& sceneSpec) = 0;
     virtual void setScenePath(const string& path) = 0;
 
@@ -149,6 +157,7 @@
 
     // Transactions
     virtual void addTransaction(TransactionBase*) = 0;
+               
     template<class T, class Op>
       void addTransaction(const char* name, TValue<T>& value, Op op)
       {

Modified: branches/AFR/Interface/RayPacket.h
==============================================================================
--- branches/AFR/Interface/RayPacket.h  (original)
+++ branches/AFR/Interface/RayPacket.h  Mon Sep 19 03:34:20 2005
@@ -13,26 +13,33 @@
   class RenderContext;
   class RayPacket {
   public:
-    static const int MaxSize = 32;
+    enum {
+      MaxSize               = 32,
+
+      // Flags.
+      ConstantOrigin        = 0x001,
+      ConstantEye           = 0x002,
+      HaveImageCoordinates  = 0x004,
+      NormalizedDirections  = 0x008,
+      HaveHitPositions      = 0x010,
+      HaveHitRecords        = 0x020,
+      HaveTexture3          = 0x040,
+      HaveTexture2          = 0x080,
+      // HaveFrame          = 0x100,
+      HaveNormals           = 0x200,
+      HaveUnitNormals       = 0x300,
+
+      HaveInverseDirections = 0x800, // signMask and inverseDirection 
computed.
+      ConstantDirections    = 0xc00  // All of the rays have the same 
signMask
+    };
+
 
-    static const int ConstantOrigin = 0x01;
-    static const int ConstantEye = 0x02;
-    static const int HaveImageCoordinates = 0x04;
-    static const int NormalizedDirections = 0x08;
-    static const int HaveHitPositions = 0x10;
-    static const int HaveHitRecords = 0x20;
-    static const int HaveTexture3 = 0x40;
-    static const int HaveTexture2 = 0x80;
-    //static const int HaveFrame = 0x100;
-    static const int HaveNormals = 0x200;
-    static const int HaveUnitNormals = 0x300;
-    static const int HaveInverseDirections = 0x800;
     inline RayPacket(RayPacketData& data, int size, int depth, int flags);
 
     // Create a subset of another raypacket
     RayPacket(RayPacket& parent, int start, int end)
       : data(parent.data+start), size(end-start), depth(parent.depth),
-       flags(parent.flags)
+        flags(parent.flags)
     {
     }
 
@@ -43,12 +50,17 @@
     int getFlags() const {
       return flags;
     }
+
+    bool getFlags( int flag ) const { return (flags & flag) == flag; };
+
+    int setFlags(int new_flags)
+    {
+      flags = new_flags;
+    }
+
     void setFlag(int flag) {
       flags |= flag;
     }
-    void setFlags(int new_flags) {
-      flags = new_flags;
-    }
     void resetFlag(int flag) {
       flags &= ~flag;
     }
@@ -57,7 +69,7 @@
     }
     void resetHit() {
       for(int i=0;i<size;i++)
-       data[i].hitInfo.reset();
+        data[i].hitInfo.reset();
       flags |= HaveHitRecords;
     }
 
@@ -68,21 +80,30 @@
 
 #ifndef SWIG // SWIG doesn't support nested structs/classes.
     struct Element {
-      Color localColor;
-      Color* color;
-      double imageX;
-      double imageY;
-      int whichEye;
-      Ray ray;
+      Color   localColor;
+      Color*  color;
+      double  imageX;
+      double  imageY;
+      Ray     ray;
       HitInfo hitInfo;
-      Vector normal;
-      Point hitPosition;
-      Point texCoords;
-      Vector inverseDirection;
+      Vector  normal;
+      Point   hitPosition;
+      Point   texCoords;
+      Vector  inverseDirection;
+
+      Color   ambientLight;
+      Color   light;
+
+      double importance; // for ray pruning
 
-      Color ambientLight;
       int shadowBegin, shadowEnd;
-      Color light;
+
+      int whichEye;
+
+      // Mask describing ray direction, 0==negative 1==positive
+      // This is set at the same time as inverse direction.
+      int signMask[3];
+
     };
 
     const Element& get(int which) const {
@@ -94,7 +115,7 @@
 #endif // SWIG
     
     void setPixel(int which, int whichEye, double imageX, double imageY,
-                 Color* color) {
+                  Color* color) {
       data[which].color = color;
       data[which].imageX = imageX;
       data[which].imageY = imageY;
@@ -102,7 +123,7 @@
     }
     void useLocalColors() {
       for(int i=0;i<size;i++)
-       data[i].color = &data[i].localColor;
+        data[i].color = &data[i].localColor;
     }
     HitInfo& hitInfo(int which) {
       return data[which].hitInfo;
@@ -116,15 +137,16 @@
     void normalizeDirections()
     {
       if(flags & NormalizedDirections)
-       return;
+        return;
+
       if(flags & HaveHitRecords){
-       for(int i=0;i<size;i++){
-         double length = data[i].ray.normalizeDirection();
-         data[i].hitInfo.scaleT(length);
-       }
+        for(int i=0;i<size;i++){
+          double length = data[i].ray.normalizeDirection();
+          data[i].hitInfo.scaleT(length);
+        }
       } else {
-       for(int i=0;i<size;i++)
-         data[i].ray.normalizeDirection();
+        for(int i=0;i<size;i++)
+          data[i].ray.normalizeDirection();
       }
       flags |= NormalizedDirections;
       flags &= ~HaveInverseDirections;
@@ -132,25 +154,37 @@
     void computeHitPositions()
     {
       if(flags & HaveHitPositions)
-       return;
-      for(int i=0;i<size;i++)
-       data[i].hitPosition = data[i].ray.origin() + data[i].ray.direction() 
* data[i].hitInfo.minT();
+        return;
+      for(int i=0;i<size;i++) {
+        data[i].hitPosition = data[i].ray.origin() +
+          data[i].ray.direction() * data[i].hitInfo.minT();
+      }
+
       flags |= HaveHitPositions;
     }
     void computeInverseDirections()
     {
       if(flags & HaveInverseDirections)
-       return;
-      for(int i=0;i<size;i++)
-       data[i].inverseDirection = Vector(1./data[i].ray.direction().x(),
+        return;
+      for(int i=0;i<size;i++) {
+        data[i].inverseDirection = Vector(1./data[i].ray.direction().x(),
                                           1./data[i].ray.direction().y(),
                                           1./data[i].ray.direction().z());
+
+        // Set the sign mask at the same time.  This shouldn't be done
+        // here.  It should be done in a different function or a
+        // function of a different name.
+        data[i].signMask[0] = (data[i].inverseDirection[0] < 0.0);
+        data[i].signMask[1] = (data[i].inverseDirection[1] < 0.0);
+        data[i].signMask[2] = (data[i].inverseDirection[2] < 0.0);
+      }
+
       flags |= HaveInverseDirections;
     }
     void computeTextureCoordinates2(const RenderContext& context)
     {
       if(flags & (HaveTexture2|HaveTexture3))
-       return;
+        return;
       Element& e0 = data[0];
       const TexCoordMapper* tex = e0.hitInfo.hitTexCoordMapper();
       tex->computeTexCoords2(context, *this);
@@ -159,7 +193,7 @@
     void computeTextureCoordinates3(const RenderContext& context)
     {
       if(flags & HaveTexture3)
-       return;
+        return;
       Element& e0 = data[0];
       const TexCoordMapper* tex = e0.hitInfo.hitTexCoordMapper();
       tex->computeTexCoords3(context, *this);
@@ -169,7 +203,7 @@
     void computeFrame(const RenderContext& context)
     {
       if(flags & HaveFrame)
-       return;
+        return;
       Element& e0 = data[0];
       const UVMapping* uv = e0.hitInfo.hitPrimitive()->getUVMapping();
       uv->computeFrame(context, *this);
@@ -180,18 +214,29 @@
     void computeNormals(const RenderContext& context)
     {
       if(flags & HaveNormals)
-       return;
+        return;
+
+      int end;
+      int i = 0;
+
       // Compute normals
-      for(int i=0;i<size;){
-       RayPacket::Element& e = data[i];
-       const Primitive* prim = e.hitInfo.hitPrimitive();
-       int end = i+1;
-       while(end < size && data[end].hitInfo.hitPrimitive() == prim)
-         end++;
-       RayPacket subPacket(*this, i, end);
-       prim->computeNormal(context, subPacket);
-       i=end;
+      while (i<size) {
+
+        RayPacket::Element& e = data[i];
+        const Primitive* prim = e.hitInfo.hitPrimitive();
+
+        end = i+1;
+
+        while(end < size && data[end].hitInfo.hitPrimitive() == prim)
+          end++;
+
+        RayPacket subPacket(*this, i, end);
+        prim->computeNormal(context, subPacket);
+
+
+        i=end;
       }
+
       flags |= HaveNormals;
     }
 
@@ -224,10 +269,10 @@
   };
 
   inline RayPacket::RayPacket(RayPacketData& data, int size,
-                             int depth, int flags)
+                              int depth, int flags)
     : data(&data.data[0]), size(size), depth(depth), flags(flags)
   {
   }
-}
+} // end namespace Manta
 
 #endif

Modified: branches/AFR/Interface/RenderParameters.h
==============================================================================
--- branches/AFR/Interface/RenderParameters.h   (original)
+++ branches/AFR/Interface/RenderParameters.h   Mon Sep 19 03:34:20 2005
@@ -6,7 +6,7 @@
   class RenderParameters {
   public:
     RenderParameters() {
-      maxDepth = 5;
+      maxDepth = 15;
     }
     int maxDepth;
   private:

Modified: branches/AFR/Model/CMakeLists.txt
==============================================================================
--- branches/AFR/Model/CMakeLists.txt   (original)
+++ branches/AFR/Model/CMakeLists.txt   Mon Sep 19 03:34:20 2005
@@ -10,6 +10,8 @@
 INCLUDE (Instances/CMakeLists.txt)
 INCLUDE (MiscObjects/CMakeLists.txt)
 INCLUDE (Readers/CMakeLists.txt)
+INCLUDE (Intersections/CMakeLists.txt)
+INCLUDE (Textures/CMakeLists.txt)
 
 SET(BUILD_SCALAR_VOLUME CACHE BOOL false)
 IF(BUILD_SCALAR_VOLUME)
@@ -24,11 +26,13 @@
              ${Manta_Lights_SRCS}
              ${Manta_Materials_SRCS}
              ${Manta_Primitives_SRCS}
-                                ${Manta_Primitives_Volume_SRCS}
+                                    ${Manta_Primitives_Volume_SRCS}
              ${Manta_TexCoordMappers_SRCS}
              ${Manta_Instances_SRCS}
              ${Manta_MiscObjects_SRCS}
-            ${Manta_Readers_SRCS}
+             ${Manta_Readers_SRCS}
+             ${Manta_Intersections_SRCS}
+             ${Manta_Textures_SRCS}
              )
 
 TARGET_LINK_LIBRARIES(Manta_Model Manta_Interface Manta_Core)

Modified: branches/AFR/Model/Cameras/CMakeLists.txt
==============================================================================
--- branches/AFR/Model/Cameras/CMakeLists.txt   (original)
+++ branches/AFR/Model/Cameras/CMakeLists.txt   Mon Sep 19 03:34:20 2005
@@ -1,6 +1,11 @@
 
 SET (Manta_Cameras_SRCS
+     Cameras/EnvironmentCamera.h
      Cameras/EnvironmentCamera.cc
+     Cameras/PinholeCamera.h
      Cameras/PinholeCamera.cc
+     Cameras/OrthogonalCamera.h
      Cameras/OrthogonalCamera.cc
-     Cameras/FisheyeCamera.cc)
+     Cameras/FisheyeCamera.h
+     Cameras/FisheyeCamera.cc
+     )

Modified: branches/AFR/Model/Cameras/EnvironmentCamera.cc
==============================================================================
--- branches/AFR/Model/Cameras/EnvironmentCamera.cc     (original)
+++ branches/AFR/Model/Cameras/EnvironmentCamera.cc     Mon Sep 19 03:34:20 
2005
@@ -165,7 +165,8 @@
   // This functionality doesn't make much sense with the environment camera
 }
 
-Point EnvironmentCamera::project(const Point &point) const
+
+Point EnvironmentCamera::project(const Point &point) const 
 {
   // NOT FINISHED
   return Point(0., 0., 0.);

Modified: branches/AFR/Model/Cameras/EnvironmentCamera.h
==============================================================================
--- branches/AFR/Model/Cameras/EnvironmentCamera.h      (original)
+++ branches/AFR/Model/Cameras/EnvironmentCamera.h      Mon Sep 19 03:34:20 
2005
@@ -15,6 +15,8 @@
   class EnvironmentCamera : public Camera {
   public:
     EnvironmentCamera(const vector<string>& args);
+               EnvironmentCamera( const Point &eye_, const Point &lookat_, 
const Vector &up_ ) :
+                       eye( eye_ ), lookat( lookat_ ), up( up_ ) { setup(); }
     virtual ~EnvironmentCamera();
     virtual void makeRays(RayPacket&) const;
 
@@ -26,7 +28,16 @@
     virtual void autoview(double fov);
     virtual Point project(const Point &point) const;  // project a 3D point 
to the camera image plane
     virtual void writeToFile(FILE *fp) const;
+
     static Camera* create(const vector<string>& args);
+
+    virtual Point  getPosition() const { return eye; }
+    virtual Point  getLookAt()   const { return lookat; };
+    virtual Vector getUp()       const { return up; };
+    
+    virtual void reset( const Point &eye_, const Vector &up_, const Point 
&lookat_ ) {
+      eye = eye_; up = up_; lookat = lookat_; setup(); };
+
   private:
     void setup();
     Point  eye;

Modified: branches/AFR/Model/Cameras/FisheyeCamera.h
==============================================================================
--- branches/AFR/Model/Cameras/FisheyeCamera.h  (original)
+++ branches/AFR/Model/Cameras/FisheyeCamera.h  Mon Sep 19 03:34:20 2005
@@ -15,6 +15,10 @@
   class FisheyeCamera : public Camera {
   public:
     FisheyeCamera(const vector<string>& args);
+    FisheyeCamera( const Point &eye_, const Point &lookat_, const Vector 
&up_, double hfov_ = 60.0 ) :
+      eye( eye_ ), up( up_ ), lookat( lookat_ ), hfov( hfov_ ) { setup(); 
hfov = hfov / 90; };
+
+
     virtual ~FisheyeCamera();
     virtual void makeRays(RayPacket&) const;
 
@@ -27,6 +31,14 @@
     virtual Point project(const Point &point) const;  // project a 3D point 
to the camera image plane
     virtual void writeToFile(FILE *fp) const;
     static Camera* create(const vector<string>& args);
+
+    virtual Point getPosition() const { return eye; }
+    virtual Point getLookAt()   const { return lookat; };
+    virtual Vector getUp()       const { return up; };
+
+    virtual void reset( const Point &eye_, const Vector &up_, const Point 
&lookat_ ) {
+      eye = eye_; up = up_; lookat = lookat_; setup(); };
+    
   private:
     void setup();
     Point  eye;

Modified: branches/AFR/Model/Cameras/OrthogonalCamera.cc
==============================================================================
--- branches/AFR/Model/Cameras/OrthogonalCamera.cc      (original)
+++ branches/AFR/Model/Cameras/OrthogonalCamera.cc      Mon Sep 19 03:34:20 
2005
@@ -158,7 +158,7 @@
   setup();
 }
 
-Point OrthogonalCamera::project(const Point &point) const 
+Point OrthogonalCamera::project(const Point &point) const
 {
        // NOT FINISHED
        return Point(0,0,0); // just a placeholder

Modified: branches/AFR/Model/Cameras/OrthogonalCamera.h
==============================================================================
--- branches/AFR/Model/Cameras/OrthogonalCamera.h       (original)
+++ branches/AFR/Model/Cameras/OrthogonalCamera.h       Mon Sep 19 03:34:20 
2005
@@ -14,6 +14,8 @@
   class OrthogonalCamera : public Camera {
   public:
     OrthogonalCamera(const vector<string>& args);
+               OrthogonalCamera( const Point &eye_, const Point &lookat_, 
const Vector &up_, Real hscale_ ) :
+                       eye( eye_ ), lookat( lookat_ ), up( up_ ), hscale( 
hscale_ ) { setup(); }
     virtual ~OrthogonalCamera();
     virtual void makeRays(RayPacket&) const;
 
@@ -23,9 +25,19 @@
     virtual void dolly(double);
     virtual void transform(AffineTransform t, TransformCenter);
     virtual void autoview(double fov);
+
     virtual Point project(const Point &point) const;
     virtual void writeToFile(FILE *fp) const;
+
     static Camera* create(const vector<string>& args);
+               
+               virtual Point getPosition() const { return eye; }
+               virtual Point getLookAt()   const { return lookat; };
+               virtual Vector getUp()       const { return up; };
+               
+               virtual void reset( const Point &eye_, const Vector &up_, 
const Point &lookat_ ) {
+                       eye = eye_; up = up_; lookat = lookat_; setup(); };
+               
   private:
     void setup();
     Point eye;

Modified: branches/AFR/Model/Cameras/PinholeCamera.cc
==============================================================================
--- branches/AFR/Model/Cameras/PinholeCamera.cc (original)
+++ branches/AFR/Model/Cameras/PinholeCamera.cc Mon Sep 19 03:34:20 2005
@@ -27,19 +27,19 @@
     string arg = args[i];
     if(arg == "-eye"){
       if(!getPointArg(i, args, eye))
-       throw IllegalArgument("PinholeCamera -eye", i, args);
+        throw IllegalArgument("PinholeCamera -eye", i, args);
       gotEye = true;
     } else if(arg == "-lookat"){
       if(!getPointArg(i, args, lookat))
-       throw IllegalArgument("PinholeCamera -lookat", i, args);
+        throw IllegalArgument("PinholeCamera -lookat", i, args);
       gotLookat = true;
     } else if(arg == "-up"){
       if(!getVectorArg(i, args, up))
-       throw IllegalArgument("PinholeCamera -up", i, args);
+        throw IllegalArgument("PinholeCamera -up", i, args);
       gotUp = true;
     } else if(arg == "-fov"){
       if(!getDoubleArg(i, args, hfov))
-       throw IllegalArgument("PinholeCamera -fov", i, args);
+        throw IllegalArgument("PinholeCamera -fov", i, args);
       gotFov = true;
     } else if(arg == "-normalizeRays"){
       normalizeRays = true;
@@ -56,6 +56,15 @@
 {
 }
 
+void PinholeCamera::output( std::ostream &os ) {
+
+        os << "pinhole( -eye " << eye
+                  << " -lookat " << lookat
+                                                << " -up " << up
+                                                << " -fov " << hfov << " )"
+                                                << std::endl;
+}
+
 Camera* PinholeCamera::create(const vector<string>& args)
 {
   return new PinholeCamera(args);
@@ -67,20 +76,27 @@
   vfov = hfov; // set field of view
   direction=lookat-eye; // the normal vector
   nearZ=direction.length(); // lenghth to near plane
-  
+
   Vector n = direction;
   n.normalize();
    
   up.normalize();
+
+  for(i=0; i<3; i++)
+    uvn[2][i] = n[i];
+
   v=Cross(direction, up);
   if(v.length2() == 0.0){
     std::cerr << __FILE__ << " line: " << __LINE__ << " Ambiguous up 
direciton...\n";
   }
   v.normalize();
-  
+
+  for(i=0; i<3; i++)
+    uvn[1][i] = v[i];
+
   u=Cross(v, direction);
   u.normalize();
-  
+
   for(i=0; i<4; i++)
     for(j=0; j<4; j++)
       proj[i][j] = mv[i][j] = 0.0;
@@ -93,7 +109,7 @@
   mv[2][0] = -1.0*n.x(); mv[2][1] = -1.0*n.y(); mv[2][2] = -1.0*n.z();
   mv[2][3] = (eye.x()*n.x()) + (eye.y()*n.y()) + (eye.z()*n.z());
   mv[3][3]= 1.0;
-  
+
   height=nearZ*tan(vfov*0.5*M_PI/180.0);
   u*=height;
   width=nearZ*tan(hfov*0.5*M_PI/180.0);
@@ -134,6 +150,7 @@
       Vector raydir(v*e.imageX+u*e.imageY+direction);
       raydir.normalize();
       e.ray.set(eye, raydir);
+      e.importance = 1.0;
     }
     rays.setFlag(RayPacket::NormalizedDirections);
   } else {
@@ -141,6 +158,7 @@
       RayPacket::Element& e = rays.get(i);
       Vector raydir(v*e.imageX+u*e.imageY+direction);
       e.ray.set(eye, raydir);
+      e.importance = 1.0;
     }
   }
 }
@@ -167,8 +185,9 @@
 
 void PinholeCamera::dolly(double scale)
 {
-  Vector dir = lookat - eye;
-  eye += dir*scale;
+  Vector d = (lookat - eye) * scale;
+  eye    += d;
+        // lookat += d; // Maybe we need two types of dolly. // Maybe not.
   setup();
 }
 
@@ -222,14 +241,46 @@
 
 Point PinholeCamera::project(const Point &point) const
 {
+// <<<<<<< .working
   Point p2(prodMat[0][0]*point.x() + prodMat[0][1]*point.y() + 
prodMat[0][2]*point.z() + prodMat[0][3],
            prodMat[1][0]*point.x() + prodMat[1][1]*point.y() + 
prodMat[1][2]*point.z() + prodMat[1][3],
            prodMat[2][0]*point.x() + prodMat[2][1]*point.y() + 
prodMat[2][2]*point.z() + prodMat[2][3]);
   double zval = prodMat[3][0]*point.x() + prodMat[3][1]*point.y() + 
prodMat[3][2]*point.z() + prodMat[3][3];
-  
+
+#if 0
+=======
+  // translate camera center to origin
+  Vector trans(-eye.x(), -eye.y(), -eye.z());
+  Point p1 = point + trans;
+
+>>>>>>> .merge-right.r556
+#endif
+
+// <<<<<<< .working
   return Point(((p2.x()/zval)+1.0)/2.0,  
                ((p2.y()/zval)+1.0)/2.0, 
-               ((p2.z()/zval)+1.0)/2.0); 
+               ((p2.z()/zval)+1.0)/2.0);
+#if 0
+=======
+  // rotate to align with camera axis
+  Point p2((uvn[0][0]*p1.x() + uvn[0][1]*p1.y() + uvn[0][2]*p1.z()),
+                 (uvn[1][0]*p1.x() + uvn[1][1]*p1.y() + uvn[1][2]*p1.z()),
+                 (uvn[2][0]*p1.x() + uvn[2][1]*p1.y() + uvn[2][2]*p1.z()));
+
+  // project the point to the image plane using simlar triangles
+  // the viewZ is just a ratio to tell whether point is valid or not
+  // if returned viewZ>1, it means that the point lied beyong the image plane
+  // and is visible to camera, else it is not
+  // It is not a sufficient condition though, the x and y coordinates should 
lie within the
+  // width and height of the image, so returned coordinates are in the 
normalized space [-1,1]
+  if(fabs(p2.z())<0.0001) // check for inconsistencies
+    return Point(0,0,0);
+  else
+    return Point((p2.x()*nearZ/p2.z())/(width/2.0),
+                 (p2.y()*nearZ/p2.z())/(height/2.0),
+                  p2.z()/nearZ);
+>>>>>>> .merge-right.r556
+#endif
 }
 
 void PinholeCamera::writeToFile(FILE *fp) const

Modified: branches/AFR/Model/Cameras/PinholeCamera.h
==============================================================================
--- branches/AFR/Model/Cameras/PinholeCamera.h  (original)
+++ branches/AFR/Model/Cameras/PinholeCamera.h  Mon Sep 19 03:34:20 2005
@@ -14,6 +14,8 @@
 
   class PinholeCamera : public Camera {
   public:
+               PinholeCamera( const Point &eye_, const Point &lookat_, const 
Vector &up_, Real fov_ ) :
+                       eye( eye_ ), lookat( lookat_ ), up( up_ ), hfov( fov_ 
) { setup(); }
     PinholeCamera(const vector<string>& args);
     virtual ~PinholeCamera();
     virtual void makeRays(RayPacket&) const;
@@ -24,9 +26,20 @@
     virtual void dolly(double);
     virtual void transform(AffineTransform t, TransformCenter);
     virtual void autoview(double fov);
+
     virtual Point project(const Point &point) const;  // project a 3D point 
to the camera image plane
     virtual void writeToFile(FILE *fp) const;
+               virtual void output( std::ostream &os );
+
     static Camera* create(const vector<string>& args);
+               
+               virtual Point getPosition() const { return eye; }
+               virtual Point getLookAt()   const { return lookat; };
+               virtual Vector getUp()       const { return up; };
+               
+               virtual void reset( const Point &eye_, const Vector &up_, 
const Point &lookat_ ) {
+                       eye = eye_; up = up_; lookat = lookat_; setup(); };
+               
   private:
     void setup();
     Point  eye;
@@ -40,6 +53,9 @@
     Vector direction;
     Vector u,v;
     double proj[4][4], mv[4][4], prodMat[4][4];
+
+    // for projection we maintain a uvn rotation matrix
+    double uvn[3][3];
   };
 }
 

Modified: branches/AFR/Model/Groups/CMakeLists.txt
==============================================================================
--- branches/AFR/Model/Groups/CMakeLists.txt    (original)
+++ branches/AFR/Model/Groups/CMakeLists.txt    Mon Sep 19 03:34:20 2005
@@ -1,6 +1,24 @@
 
 SET (Manta_Groups_SRCS
+     Groups/BVH.h
      Groups/BVH.cc
+     Groups/GriddedGroup.h
      Groups/GriddedGroup.cc
+     Groups/RealisticBvh.h
+     Groups/RealisticBvh.cc
+     Groups/Group.h
      Groups/Group.cc
+     Groups/KDTree.h
+     Groups/KDTree.cc
+     Groups/TransparentKDTree.h
+     Groups/TransparentKDTree.cc
+     Groups/KDTreeLoader.h
+     Groups/KDTreeLoader.cc
+     Groups/FrustumKDTree.h
+     Groups/FrustumKDTree.cc
+     Groups/PsiGammaTable.cc
+     Groups/PsiGammaTable.h
+     Groups/VolumeGrid.h
+     Groups/varray.h
+
 )

Copied: branches/AFR/Model/Intersections/Plane.h (from r556, 
branches/itanium2/Model/Intersections/Plane.h)
==============================================================================

Modified: branches/AFR/Model/Lights/CMakeLists.txt
==============================================================================
--- branches/AFR/Model/Lights/CMakeLists.txt    (original)
+++ branches/AFR/Model/Lights/CMakeLists.txt    Mon Sep 19 03:34:20 2005
@@ -1,3 +1,6 @@
 
 SET (Manta_Lights_SRCS
-     Lights/PointLight.cc)
+     Lights/PointLight.h
+     Lights/PointLight.cc
+     Lights/HeadLight.h
+     Lights/HeadLight.cc)

Modified: branches/AFR/Model/Lights/PointLight.cc
==============================================================================
--- branches/AFR/Model/Lights/PointLight.cc     (original)
+++ branches/AFR/Model/Lights/PointLight.cc     Mon Sep 19 03:34:20 2005
@@ -16,13 +16,13 @@
 {
 }
 
-const Point& PointLight::getCenter() const
-{
-  return position;
-}
+void PointLight::computeLight( Color &resultColor, Vector &lightDirection, 
const RenderContext &context, RayPacket::Element &e ) const {
 
-const Color& PointLight::getColor() const
-{
-  return color;
+       // Specify the color.
+       resultColor = color;
+       
+       // Compute the light direction.
+       lightDirection = (position - e.hitPosition);
+       
 }
 

Modified: branches/AFR/Model/Lights/PointLight.h
==============================================================================
--- branches/AFR/Model/Lights/PointLight.h      (original)
+++ branches/AFR/Model/Lights/PointLight.h      Mon Sep 19 03:34:20 2005
@@ -13,8 +13,10 @@
     virtual ~PointLight();
 
     virtual void preprocess(const PreprocessContext&);
-    virtual const Point& getCenter() const;
-    virtual const Color& getColor() const;
+    
+               virtual void computeLight( Color &resultColor, Vector 
&lightDirection,
+                                          const RenderContext &context, 
RayPacket::Element &e ) const;
+               
   private:
     Point position;
     Color color;

Modified: branches/AFR/Model/Materials/CMakeLists.txt
==============================================================================
--- branches/AFR/Model/Materials/CMakeLists.txt (original)
+++ branches/AFR/Model/Materials/CMakeLists.txt Mon Sep 19 03:34:20 2005
@@ -2,11 +2,26 @@
 
 
 SET (Manta_Materials_SRCS
+     Materials/Checker.h
      Materials/Checker.cc
+     Materials/Dielectric.h
      Materials/Dielectric.cc
+     Materials/Flat.h
      Materials/Flat.cc
+     Materials/Lambertian.h
      Materials/Lambertian.cc
+     Materials/LitMaterial.h
      Materials/LitMaterial.cc
+     Materials/MetalMaterial.h
      Materials/MetalMaterial.cc
+     Materials/Phong.h
      Materials/Phong.cc
+     Materials/LambertianAlt.h
+     Materials/LambertianAlt.cc
+     Materials/CopyColorMaterial.h
+     Materials/CopyColorMaterial.cc
+     Materials/NormalMaterial.h
+     Materials/NormalMaterial.cc # Shade the material using it's normal.
+     Materials/AmbientOcclusion.h
+     Materials/AmbientOcclusion.cc
      )

Modified: branches/AFR/Model/Materials/Dielectric.cc
==============================================================================
--- branches/AFR/Model/Materials/Dielectric.cc  (original)
+++ branches/AFR/Model/Materials/Dielectric.cc  Mon Sep 19 03:34:20 2005
@@ -1,3 +1,30 @@
+/*
+ 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.
+ */
 
 #include <Model/Materials/Dielectric.h>
 #include <Core/Math/ipow.h>
@@ -10,15 +37,13 @@
 #include <Interface/Renderer.h>
 #include <Interface/Scene.h>
 #include <Interface/ShadowAlgorithm.h>
-#include <Core/Util/NotFinished.h>
 
 using namespace Manta;
 
-Dielectric::Dielectric(const Color& diffuse, const Color& specular,
-                      int specpow, double n, double nt)
-  : diffuse(diffuse), specular(specular), specpow(specpow),
-    n(n), nt(nt)
+Dielectric::Dielectric(const Texture<Real>* n, const Texture<Real>* nt, 
const Texture<Color>* sigma_a)
+    : n(n), nt(nt), sigma_a(sigma_a)
 {
+
 }
 
 Dielectric::~Dielectric()
@@ -27,142 +52,199 @@
 
 void Dielectric::shade(const RenderContext& context, RayPacket& rays) const
 {
-  // Shade a bunch of rays.  We know that they all have the same intersected
-  // object and are all of the same material
-  
-  rays.normalizeDirections();
+  if(rays.getDepth() >= context.scene->getRenderParameters().maxDepth)
+  {
+      activeLights->getAmbientLight()->computeAmbient(context, rays);
+      for(int i=0;i<rays.getSize();i++)
+      {
+          RayPacket::Element& e = rays.get(i);
+          rays.setResult(i, e.ambientLight);
+      }
+      return;
+  }
+
 
-  // Compute normals
+  rays.computeHitPositions();
+  rays.normalizeDirections();
   rays.computeNormals(context);
+  if (!(rays.getFlags()  & rays.HaveUnitNormals))
+  {
+      // I would like to replace this with a call to
+      // rays.normalizeNormals() but need to add it.
+      fprintf(stderr, "Dielectric assumes unit normals\n");
+      exit(-1);
+  }
 
-  // Compute ambient contributions for all rays
-  activeLights->getAmbientLight()->computeAmbient(context, rays);
+  double n_values[RayPacket::MaxSize];
+  double nt_values[RayPacket::MaxSize];
+  Color sigma_a_values[RayPacket::MaxSize];
+
+  n->mapValues(context, rays, n_values);
+  nt->mapValues(context, rays, nt_values);
+  sigma_a->mapValues(context, rays, sigma_a_values);
+
+  Vector refl_dirs[RayPacket::MaxSize];
+  Vector refr_dirs[RayPacket::MaxSize];
+  float fresnel_coeffs[RayPacket::MaxSize]; // might be better to compute
+  Color beers_colors[RayPacket::MaxSize];
+  double beers_coeffs[RayPacket::MaxSize];
+  bool internally_reflected[RayPacket::MaxSize];
+  bool apply_beers[RayPacket::MaxSize];
+  bool kill_ray[RayPacket::MaxSize];
 
-  RayPacketData data;
-  int start = 0;
-  do {
-    RayPacket shadowRays(data, 0, rays.getDepth(), 0);
-    int end = context.shadowAlgorithm->computeShadows(context, activeLights,
-                                                     rays, start, 
shadowRays);
-    
-    if(shadowRays.getFlags() & RayPacket::NormalizedDirections){
-      for(int i=start;i<end;i++){
-       RayPacket::Element& e = rays.get(i);
-       Color totalDiffuse(e.ambientLight);
-       Color totalSpecular = Color::black();
-       for(int j=e.shadowBegin;j<e.shadowEnd;j++){
-         RayPacket::Element& s = shadowRays.get(j);
-         if(!s.hitInfo.wasHit()){
-           double cos_theta = Dot(s.ray.direction(), e.normal);
-           totalDiffuse += s.light*cos_theta;
-           Vector H = s.ray.direction()-e.ray.direction();
-           H.normalize();
-           double cos_alpha = Dot(H, e.normal);
-           if(cos_alpha > 0)
-             totalSpecular += s.light * ipow(cos_alpha, specpow);
-         }
-       }
-       rays.setResult(i, diffuse*totalDiffuse+specular*totalSpecular);
-      }
-    } else {
-      for(int i=start;i<end;i++){
-       RayPacket::Element& e = rays.get(i);
-       Color totalDiffuse(e.ambientLight);
-       Color totalSpecular = Color::black();
-       for(int j=e.shadowBegin;j<e.shadowEnd;j++){
-         RayPacket::Element& s = shadowRays.get(j);
-         if(!s.hitInfo.wasHit()){
-           s.ray.normalizeDirection();
-           double cos_theta = Dot(s.ray.direction(), e.normal);
-           totalDiffuse += s.light*cos_theta;
-           Vector H = s.ray.direction()-e.ray.direction();
-           H.normalize();
-           double cos_alpha = Dot(H, e.normal);
-           if(cos_alpha > 0)
-             totalSpecular += s.light * ipow(cos_alpha, specpow);
-         }
-       }
-       rays.setResult(i, diffuse*totalDiffuse+specular*totalSpecular);
-      }
-    }
-    start = end;
-  } while(start < rays.getSize());
-
-  
-  int maxdepth = 5;
-  if(rays.getDepth() < maxdepth) {
-    // Compute refractions
-    double *c = new double[rays.getSize()];
-    double *tst = new double[rays.getSize()];
-    Color *col = new Color[rays.getSize()];
-    RayPacketData rfdata;
-    RayPacket refr_rays(rfdata, rays.getSize(), rays.getDepth()+1,
-                       RayPacket::NormalizedDirections);
-    refr_rays.useLocalColors();
-    rays.computeHitPositions();
-    
-    for(int i=0;i<rays.getSize();i++){
+  int num_internal = 0;
+  int num_branch   = 0;
+
+  for(int i=0;i<rays.getSize();i++)
+  {
       RayPacket::Element& e = rays.get(i);
-      Vector d = e.ray.direction();
-      Vector norm = e.normal;
-      tst[i] = 1-((n*n*(1-Dot(d,e.normal)*Dot(d,e.normal)))/(nt*nt));
-      Vector refr_dir = ((n*(d-norm*Dot(d,norm)))/nt)-(norm*tst[i]);
-      RayPacket::Element& r = refr_rays.get(i);
-      double x = refr_dir.x()*0.00001-e.hitPosition.x();
-      double y = refr_dir.y()*0.00001-e.hitPosition.y();
-      double z = refr_dir.z()*0.00001-e.hitPosition.z();
-      r.ray.set(Point(x,y,z), refr_dir);
-
-      if(Dot(d,norm) < 0) {
-       c[i] = -Dot(e.ray.direction(), e.normal);
-       col[i] = Color::white();
-      }
-      else {
-       c[i] = Dot(refr_dir, e.normal);
-       double tmpt = e.hitInfo.minT();
-       col[i] = e.color->attenuate(-tmpt);
-      }
-    }
-          
-    // Compute reflections
-    RayPacketData rdata;
-    RayPacket refl_rays(rdata, rays.getSize(), rays.getDepth()+1,
-                       RayPacket::NormalizedDirections);
-    refl_rays.useLocalColors();
-    double *refl = new double[rays.getSize()];
-    for(int i=0;i<rays.getSize();i++) {
-      double R0 = ((n-1)*(n-1))/((n+1)*(n+1));
-      refl[i] = R0 + ((1-R0)*(1-c[i])*(1-c[i])*(1-c[i])*(1-c[i])*(1-c[i]));
+
+      if ( e.importance < 0.05 )
+      {
+          kill_ray[i] = true;
+          continue;
+      }
+      else
+      {
+          kill_ray[i] = false;
+      }
+
+      Vector N = e.normal;
+      double n_dot_v = Dot(N, e.ray.direction());
+      double eta_tmp;
+      double eta_tmp_inv;
+      bool was_incoming = ( n_dot_v < 0 );
+      if ( was_incoming )
+      {
+          eta_tmp = n_values[i]/nt_values[i];
+          eta_tmp_inv = 1.0 / eta_tmp;
+          n_dot_v = -n_dot_v;
+          apply_beers[i] = false;
+          beers_coeffs[i] = 1.0;// allows blind multiplication
+      }
+      else
+      {
+          N = -N;
+          eta_tmp = nt_values[i]/n_values[i];
+          eta_tmp_inv = 1.0 / eta_tmp;
+          apply_beers[i] = true;
+          beers_colors[i] = sigma_a_values[i].Pow(e.hitInfo.minT());
+          beers_coeffs[i] = beers_colors[i].Mean();
+      }
+
+      double cosine = 1.0 + (n_dot_v*n_dot_v - 
1.0)*(eta_tmp_inv*eta_tmp_inv);
+      if ( cosine <= 0.0 )
+      {
+          // total internal reflection
+          Vector refl_dir = e.ray.direction() + 2.0*n_dot_v*N;
+          internally_reflected[i] = true;
+          refl_dirs[i] = refl_dir;
+          num_internal++;
+      }
+      else
+      {
+          cosine = (cosine > 0) ? sqrt(cosine) : 0;
+          double cos_min = ( cosine > n_dot_v ) ? n_dot_v : cosine;
+          float k = 1 - cosine;
+          k*=k*k*k*k;
+
+          double r0 = (n_values[i] - nt_values[i]) / (n_values[i] + 
nt_values[i]);
+          r0 *= r0;
+          float R = r0*(1-k) + k;
+
+          Vector refr_dir = e.ray.direction()*eta_tmp_inv + 
(n_dot_v*eta_tmp_inv - cosine) * N;
+          Vector refl_dir = e.ray.direction() + 2.0*n_dot_v*N;
+
+          internally_reflected[i] = false;
+          num_branch++;
+          refl_dirs[i] = refl_dir;
+          refr_dirs[i] = refr_dir;
+          fresnel_coeffs[i] = R;
+      }
+  }
+
+  // okay we've got everything ready now
+
+  RayPacketData total_internal_data;
+  RayPacketData reflected_data;
+  RayPacketData refracted_data;
+
+  RayPacket internal_rays(total_internal_data, num_internal, 
rays.getDepth()+1, RayPacket::NormalizedDirections);
+  RayPacket reflected_rays(reflected_data, num_branch, rays.getDepth()+1, 
RayPacket::NormalizedDirections);
+  RayPacket refracted_rays(refracted_data, num_branch, rays.getDepth()+1, 
RayPacket::NormalizedDirections);
+
+  internal_rays.useLocalColors();
+  reflected_rays.useLocalColors();
+  refracted_rays.useLocalColors();
+
+  // for accessing ray packet elements between the 3 sets (or 2 pairs really)
+  int internal_counter = 0;
+  int branch_counter   = 0;
+  // fill in the raypackets
+  for (int i = 0; i < rays.getSize(); i++)
+  {
       RayPacket::Element& e = rays.get(i);
-      Vector refl_dir = e.ray.direction() - e.normal*(2*Dot(e.normal, 
e.ray.direction()));
-      RayPacket::Element& r = refl_rays.get(i);
-      double x = refl_dir.x()*0.00001+e.hitPosition.x();
-      double y = refl_dir.y()*0.00001+e.hitPosition.y();
-      double z = refl_dir.z()*0.00001+e.hitPosition.z();
-      r.ray.set(Point(x,y,z), refl_dir);
-    }
-    
-    // Store Color
-    refl_rays.resetHit();
-    refr_rays.resetHit();
-    context.renderer->traceRays(context, refl_rays);
-    context.renderer->traceRays(context, refr_rays);
-    for(int i=0;i<rays.getSize();i++){
+      if (kill_ray[i])
+          continue;
+
+      if (internally_reflected[i])
+      {
+          RayPacket::Element& r = internal_rays.get(internal_counter);
+          r.ray.set(e.hitPosition, refl_dirs[i]);
+          r.importance = e.importance * beers_coeffs[i];
+          internal_counter++;
+      }
+      else
+      {
+          RayPacket::Element& refl = reflected_rays.get(branch_counter);
+          refl.ray.set(e.hitPosition, refl_dirs[i]);
+          refl.importance = e.importance * fresnel_coeffs[i] * 
beers_coeffs[i];
+          RayPacket::Element& refr = refracted_rays.get(branch_counter);
+          refr.ray.set(e.hitPosition, refr_dirs[i]);
+          refr.importance = e.importance * (1. - fresnel_coeffs[i]) * 
beers_coeffs[i];
+          branch_counter++;
+      }
+  }
+
+  // fire them off
+  context.renderer->traceRays(context, reflected_rays);
+  context.renderer->traceRays(context, refracted_rays);
+  context.renderer->traceRays(context, internal_rays);
+
+  internal_counter = 0;
+  branch_counter   = 0;
+  // compute their results
+  for (int i = 0; i < rays.getSize(); i++)
+  {
       RayPacket::Element& e = rays.get(i);
-      RayPacket::Element& rl = refl_rays.get(i);
-      RayPacket::Element& rf = refr_rays.get(i);
-      if(tst[i] < 0) {
-       *e.color = col[i]*(*rl.color);
-      }
-      else {
-       *e.color = col[i]*(((*rl.color) * refl[i]) +
-                  ((*rf.color) * (1-refl[i])));
-      }
-    }
-    
-    delete [] c;
-    delete [] tst;
-    delete [] refl;
-    delete [] col;
+      if (kill_ray[i])
+      {
+          rays.setResult(i, Color::black());
+          continue;
+      }
+
+      if (internally_reflected[i])
+      {
+          RayPacket::Element& r = internal_rays.get(internal_counter);
+
+          rays.setResult(i, *r.color);
+          internal_counter++;
+      }
+      else
+      {
+          RayPacket::Element& refl = reflected_rays.get(branch_counter);
+          RayPacket::Element& refr = refracted_rays.get(branch_counter);
+
+          rays.setResult(i, (Color::white()*fresnel_coeffs[i])*(*refl.color) 
+
+                       (Color::white()*(1.-fresnel_coeffs[i]))*(*refr.color) 
);
+
+          branch_counter++;
+      }
+
+      if (apply_beers[i])
+      {
+          *e.color *= beers_colors[i];
+      }
   }
 }
+

Modified: branches/AFR/Model/Materials/Dielectric.h
==============================================================================
--- branches/AFR/Model/Materials/Dielectric.h   (original)
+++ branches/AFR/Model/Materials/Dielectric.h   Mon Sep 19 03:34:20 2005
@@ -2,24 +2,58 @@
 #ifndef Manta_Model_Dielectric_h
 #define Manta_Model_Dielectric_h
 
+/*
+ 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.
+ */
+
 #include <Model/Materials/LitMaterial.h>
 #include <Core/Color/Color.h>
+#include <Interface/Texture.h>
+#include <Model/Textures/Constant.h>
 
-namespace Manta{
+namespace Manta
+{
   class LightSet;
 
-  class Dielectric : public LitMaterial {
+  class Dielectric : public LitMaterial
+  {
   public:
-    Dielectric(const Color& diffuse, const Color& specular, int specpow,
-              double n, double nt);
-    virtual ~Dielectric();
+                       Dielectric(const Real &n, const Real &nt, const Color 
&sigma_a)
+                        : n(new Constant<Real>(n)), nt(new 
Constant<Real>(nt)), sigma_a(new Constant<Color>(sigma_a)) { }
+       
+      Dielectric(const Texture<Real>* n, const Texture<Real>* nt, const 
Texture<Color>* sigma_a);
+      ~Dielectric();
 
-    virtual void shade(const RenderContext& context, RayPacket& rays) const;
+      void shade(const RenderContext& context, RayPacket& rays) const;
+                       
   private:
-    Color diffuse;
-    Color specular;
-    int specpow;
-    double n, nt;
+      const Texture<double>* n;
+      const Texture<double>* nt;
+      const Texture<Color>* sigma_a;
   };
 }
 

Modified: branches/AFR/Model/Materials/Lambertian.cc
==============================================================================
--- branches/AFR/Model/Materials/Lambertian.cc  (original)
+++ branches/AFR/Model/Materials/Lambertian.cc  Mon Sep 19 03:34:20 2005
@@ -42,11 +42,11 @@
 
   RayPacketData data;
   int start = 0;
+  rays.normalizeDirections();
   do {
     RayPacket shadowRays(data, 0, rays.getDepth(), 0);
     int end = context.shadowAlgorithm->computeShadows(context, activeLights,
                                                      rays, start, 
shadowRays);
-    if(shadowRays.getFlags() & RayPacket::NormalizedDirections){
       for(int i=start;i<end;i++){
        RayPacket::Element& e = rays.get(i);
        Color totalLight(e.ambientLight);
@@ -59,21 +59,6 @@
        }
        rays.setResult(i, colors[i]*totalLight);
       }
-    } else {
-      for(int i=start;i<end;i++){
-       RayPacket::Element& e = rays.get(i);
-       Color totalLight(e.ambientLight);
-       for(int j=e.shadowBegin;j<e.shadowEnd;j++){
-         RayPacket::Element& s = shadowRays.get(j);
-         if(!s.hitInfo.wasHit()){
-           s.ray.normalizeDirection();
-           double cos_theta = Dot(s.ray.direction(), e.normal);
-           totalLight += s.light*cos_theta;
-         }
-       }
-       rays.setResult(i, colors[i]*totalLight);
-      }
-    }
     start = end;
   } while(start < rays.getSize());
 }

Modified: branches/AFR/Model/Materials/Lambertian.h
==============================================================================
--- branches/AFR/Model/Materials/Lambertian.h   (original)
+++ branches/AFR/Model/Materials/Lambertian.h   Mon Sep 19 03:34:20 2005
@@ -13,6 +13,7 @@
   public:
     Lambertian(const Color& color);
     Lambertian(const Texture<Color>* colorfn);
+               Lambertian() {  };
     virtual ~Lambertian();
 
     virtual void shade(const RenderContext& context, RayPacket& rays) const;

Modified: branches/AFR/Model/Materials/MetalMaterial.cc
==============================================================================
--- branches/AFR/Model/Materials/MetalMaterial.cc       (original)
+++ branches/AFR/Model/Materials/MetalMaterial.cc       Mon Sep 19 03:34:20 
2005
@@ -31,93 +31,42 @@
 
 void MetalMaterial::shade(const RenderContext& context, RayPacket& rays) 
const
 {
-  // Shade a bunch of rays.  We know that they all have the same intersected
-  // object and are all of the same material
-  
   rays.normalizeDirections();
-
-  // Compute normals
   rays.computeNormals(context);
-  
-  // Compute colors
   Color specular[RayPacket::MaxSize];
   specular_reflectance->mapValues(context, rays, specular);
   
-  RayPacketData data;
-  int start = 0;
-  do {
-    RayPacket shadowRays(data, 0, rays.getDepth(), 0);
-    int end = context.shadowAlgorithm->computeShadows(context, activeLights,
-                                                     rays, start, 
shadowRays);
-    
-    if(shadowRays.getFlags() & RayPacket::NormalizedDirections){
-      for(int i=start;i<end;i++){
-       RayPacket::Element& e = rays.get(i);
-       Color totalSpecular = Color::black();
-
-       // for the shadows
-       for(int j=e.shadowBegin;j<e.shadowEnd;j++){
-         RayPacket::Element& s = shadowRays.get(j);
-         if(!s.hitInfo.wasHit()){
-           Vector H = s.ray.direction()-e.ray.direction();
-           H.normalize();
-           double cos_alpha = Dot(H, e.normal);
-           if(cos_alpha > 0)
-             totalSpecular += s.light*ipow(cos_alpha, phong_exponent);
-         }
-       }
-       rays.setResult(i, specular[i]*totalSpecular);
-      }
-    } else {
-      for(int i=start;i<end;i++){
-       RayPacket::Element& e = rays.get(i);
-       Color totalSpecular = Color::black();
-       for(int j=e.shadowBegin;j<e.shadowEnd;j++){
-         RayPacket::Element& s = shadowRays.get(j);
-         if(!s.hitInfo.wasHit()){
-           s.ray.normalizeDirection();
-           Vector H = s.ray.direction()-e.ray.direction();
-           H.normalize();
-           double cos_alpha = Dot(H, e.normal);
-           if(cos_alpha > 0)
-             totalSpecular += s.light*ipow(cos_alpha, phong_exponent);
-         }
-       }
-       rays.setResult(i, specular[i]*totalSpecular);
-      }
-    }
-    start = end;
-  } while(start < rays.getSize());
-
   // Compute reflections
-  if(rays.getDepth() < context.scene->getRenderParameters().maxDepth){
+  if(rays.getDepth() < context.scene->getRenderParameters().maxDepth)
+  {
     rays.computeHitPositions();
     RayPacketData rdata;
     RayPacket refl_rays(rdata, rays.getSize(), rays.getDepth()+1,
                        RayPacket::NormalizedDirections);
     refl_rays.useLocalColors();
-    for(int i=0;i<rays.getSize();i++){
-      RayPacket::Element& e = rays.get(i);
-      Vector refl_dir = e.ray.direction() - e.normal*(2*Dot(e.normal, 
e.ray.direction()));
-      RayPacket::Element& r = refl_rays.get(i);
-      r.ray.set(e.hitPosition,  refl_dir);
+    for(int i=0;i<rays.getSize();i++)
+    {  
+         RayPacket::Element& e = rays.get(i);
+         Vector refl_dir = e.ray.direction() - e.normal*(2*Dot(e.normal, 
e.ray.direction()));
+         RayPacket::Element& r = refl_rays.get(i);
+         r.ray.set(e.hitPosition,  refl_dir);
     }
     
     refl_rays.resetHit();
     context.renderer->traceRays(context, refl_rays);
-    for(int i=0;i<rays.getSize();i++){
-      RayPacket::Element& e = rays.get(i);
-      RayPacket::Element& r = refl_rays.get(i);
-      double cosine = -Dot(e.normal, e.ray.direction());
-      if(cosine < 0)
-       cosine =-cosine;
-
-      float k = 1 - cosine;
-      k*=k*k*k*k;
+    for(int i=0;i<rays.getSize();i++) {
+       RayPacket::Element& e = rays.get(i);
+       RayPacket::Element& r = refl_rays.get(i);
+
+       // compute Schlick Fresnel approximation
+       double cosine = -Dot(e.normal, e.ray.direction());
+       if(cosine < 0) cosine =-cosine;
+       float k = 1 - cosine;
+       k*=k*k*k*k;
 
-      Color R = specular[i] * (1-k) + Color::white()*k;
+        Color R = specular[i] * (1-k) + Color::white()*k;
 
-      *e.color += R * *r.color;
+        *e.color = R * (*r.color);
     }
   }
 }

Modified: branches/AFR/Model/Materials/Phong.cc
==============================================================================
--- branches/AFR/Model/Materials/Phong.cc       (original)
+++ branches/AFR/Model/Materials/Phong.cc       Mon Sep 19 03:34:20 2005
@@ -68,8 +68,8 @@
     int end = context.shadowAlgorithm->computeShadows(context, activeLights,
                                                      rays, start, 
shadowRays);
     
-    if(shadowRays.getFlags() & RayPacket::NormalizedDirections){
-      for(int i=start;i<end;i++){
+    rays.normalizeDirections();
+    for(int i=start;i<end;i++){
        RayPacket::Element& e = rays.get(i);
        Color totalDiffuse(e.ambientLight);
        Color totalSpecular = Color::black();
@@ -88,28 +88,6 @@
        }
        rays.setResult(i, diffuse[i]*totalDiffuse+specular[i]*totalSpecular);
       }
-    } else {
-      for(int i=start;i<end;i++){
-       RayPacket::Element& e = rays.get(i);
-       Color totalDiffuse(e.ambientLight);
-       Color totalSpecular = Color::black();
-       for(int j=e.shadowBegin;j<e.shadowEnd;j++){
-         RayPacket::Element& s = shadowRays.get(j);
-         if(!s.hitInfo.wasHit()){
-           s.ray.normalizeDirection();
-           double cos_theta = Dot(s.ray.direction(), e.normal);
-           totalDiffuse += s.light*cos_theta;
-           Vector H = s.ray.direction()-e.ray.direction();
-           double cos_alpha = Dot(H, e.normal);
-           if(cos_alpha > 0){
-             double length = H.length();
-             totalSpecular += s.light * ipow(cos_alpha/length, specpow);
-           }
-         }
-       }
-       rays.setResult(i, diffuse[i]*totalDiffuse+specular[i]*totalSpecular);
-      }
-    }
     start = end;
   } while(start < rays.getSize());
 

Modified: branches/AFR/Model/Materials/Phong.h
==============================================================================
--- branches/AFR/Model/Materials/Phong.h        (original)
+++ branches/AFR/Model/Materials/Phong.h        Mon Sep 19 03:34:20 2005
@@ -11,10 +11,10 @@
 
   class Phong : public LitMaterial {
   public:
-    Phong(const Color& diffuse, const Color& specular, int specpow,
-         double refl);
-    Phong(const Texture<Color>* diffuse, const Texture<Color>* specular,
-         int specpow, const Texture<double>* refl);
+       
+               // Note if refl == 0 the phong shader won't cast a reflected 
ray.
+    Phong(const Color& diffuse, const Color& specular, int specpow, double 
refl = 0.0);
+    Phong(const Texture<Color>* diffuse, const Texture<Color>* specular, int 
specpow, const Texture<double>* refl);
     virtual ~Phong();
 
     virtual void shade(const RenderContext& context, RayPacket& rays) const;

Modified: branches/AFR/Model/MiscObjects/CMakeLists.txt
==============================================================================
--- branches/AFR/Model/MiscObjects/CMakeLists.txt       (original)
+++ branches/AFR/Model/MiscObjects/CMakeLists.txt       Mon Sep 19 03:34:20 
2005
@@ -1,4 +1,8 @@
 SET (Manta_MiscObjects_SRCS
+  MiscObjects/Difference.h
   MiscObjects/Difference.cc
+  MiscObjects/Intersection.h
   MiscObjects/Intersection.cc
+  MiscObjects/CuttingPlane.h
+  MiscObjects/CuttingPlane.cc
 )

Copied: branches/AFR/Model/MiscObjects/CuttingPlane.h (from r510, 
branches/itanium2/Model/MiscObjects/CuttingPlane.h)
==============================================================================
--- branches/itanium2/Model/MiscObjects/CuttingPlane.h  (original)
+++ branches/AFR/Model/MiscObjects/CuttingPlane.h       Mon Sep 19 03:34:20 
2005
@@ -8,51 +8,60 @@
 #include <Interface/RayPacket.h>
 
 
-// Cutting plane for intersections. 
+// Cutting plane for intersections.
 // Abe Stephens abe@sgi.com
 
 namespace Manta {
-       
+
   class CuttingPlane : public Object {
-       private:
-               BBox bounds;             // Bounds of the internal object.
-               Object *internal_object; // Object to be cut.
-               
-               Real   movement_scale;
-               Point  initial_point;
-               
-               Point  plane_point;
-               Vector plane_normal;
-               
-       public:
+  private:
+    BBox bounds;             // Bounds of the internal object.
+    Object *internal_object; // Object to be cut.
+
+    Real   movement_scale;
+    Point  initial_point;
+
+    Point  plane_point;
+    Vector plane_normal;
+
+  public:
     CuttingPlane( const Point &point_, const Vector &normal_, Object 
*internal_object_ ) :
-                       initial_point( point_ ), plane_point( point_ ), 
-                       plane_normal( normal_ ), internal_object( 
internal_object_ ),
-                       movement_scale( 1.0 ) {  }
-               
-               // Preprocess the internal object and compute its bounds.
+      initial_point( point_ ), plane_point( point_ ),
+      plane_normal( normal_ ), internal_object( internal_object_ ),
+      movement_scale( 1.0 ) {  }
+
+    // Preprocess the internal object and compute its bounds.
     void preprocess( const PreprocessContext &context );
-               
-               // Return the bounds of the object.
-    void computeBounds(const PreprocessContext& context, BBox& bbox) const { 
bbox.extendByBox( bounds ); };
-    
-               // Intersection method.
-               void intersect(const RenderContext& context, RayPacket& rays) 
const;
-               
-               // Accessors.
-               const BBox &getBounds() { return bounds; };
-               Object     *getObject() { return internal_object; };
-               void setObject( Object *object_ ) { internal_object = 
object_; };
-               
-               void  getPlanePoint ( Point &result ) { result = plane_point; 
};
-               void  getPlaneNormal( Vector &result ) { result = 
plane_normal; };
-  
-               void setPlanePoint ( const Point &plane_point_ )   { 
plane_point = plane_point_; };
-               void setPlaneNormal( const Vector &plane_normal_ ) { 
plane_normal = plane_normal_; };
-               
-               // Move the plane point a signed distance along the plane 
normal.
-               void movePlaneAlongNormal( Real distance );
-       };
+
+    // Return the bounds of the object.
+    void computeBounds(const PreprocessContext& context, BBox& bbox) const
+    {
+      bbox.extendByBox( bounds );
+    }
+
+    // Intersection method.
+    void intersect(const RenderContext& context, RayPacket& rays) const;
+
+    // Accessors.
+    const BBox &getBounds() { return bounds; };
+    Object     *getObject() { return internal_object; };
+    void setObject( Object *object_ ) { internal_object = object_; };
+
+    void  getPlanePoint ( Point &result ) { result = plane_point; };
+    void  getPlaneNormal( Vector &result ) { result = plane_normal; };
+
+    void setPlanePoint ( const Point &plane_point_ )
+    {
+      plane_point = plane_point_;
+    }
+    void setPlaneNormal( const Vector &plane_normal_ )
+    {
+      plane_normal = plane_normal_;
+    }
+
+    // Move the plane point a signed distance along the plane normal.
+    void movePlaneAlongNormal( Real distance );
+  };
 }
 
-#endif
\ No newline at end of file
+#endif

Modified: branches/AFR/Model/Primitives/CMakeLists.txt
==============================================================================
--- branches/AFR/Model/Primitives/CMakeLists.txt        (original)
+++ branches/AFR/Model/Primitives/CMakeLists.txt        Mon Sep 19 03:34:20 
2005
@@ -1,25 +1,32 @@
 
 SET (Manta_Primitives_SRCS
-     Primitives/Parallelogram.cc
+     Primitives/Parallelogram.h
+                Primitives/Parallelogram.cc
+     Primitives/PrimitiveCommon.h
      Primitives/PrimitiveCommon.cc
+     Primitives/Sphere.h
      Primitives/Sphere.cc
+     Primitives/SuperEllipsoid.h
      Primitives/SuperEllipsoid.cc
+     Primitives/Cube.h
      Primitives/Cube.cc
+     Primitives/Cone.h
      Primitives/Cone.cc
+     Primitives/Triangle.h
      Primitives/Triangle.cc
+     Primitives/HeavyTriangle.h
      Primitives/HeavyTriangle.cc
+     Primitives/TexTriangle.h
      Primitives/TexTriangle.cc
+     Primitives/VertexColoredTriangle.h
      Primitives/VertexColoredTriangle.cc
+     Primitives/Disk.h
      Primitives/Disk.cc
+     Primitives/Hemisphere.h
      Primitives/Hemisphere.cc
+     Primitives/Heightfield.h
      Primitives/Heightfield.cc
+     Primitives/BvhTriangleMesh.h
+     Primitives/BvhTriangleMesh.cc
 )
 
-# Should be include known broken objects?
-IF(BUILD_BROKEN)
-  SET (Manta_Primitives_SRCS
-        Manta_Primitives_SRCS
-        Primitives/Cube.cc
-        Primitives/Cone.cc
-        )
-ENDIF(BUILD_BROKEN)

Modified: branches/AFR/Model/Primitives/Cube.cc
==============================================================================
--- branches/AFR/Model/Primitives/Cube.cc       (original)
+++ branches/AFR/Model/Primitives/Cube.cc       Mon Sep 19 03:34:20 2005
@@ -4,30 +4,73 @@
 #include <Core/Math/MiscMath.h>
 #include <Core/Math/MinMax.h>
 
+#include <Model/Intersections/AxisAlignedBox.h>
+
 using namespace Manta;
 using namespace std;
 using SCIRun::Abs;
 
 Cube::Cube(Material* mat, const Point& anch, double w, double h, double d)
-  : PrimitiveCommon(mat), anchor(anch), w(w), h(h), d(d)
+  : PrimitiveCommon(mat)
 {
+
+  bbox[0] = anch;
+  bbox[1] = anch + Vector(w,h,d);
+#if 0
   xmin = anchor.x(); xmax = xmin + w;
   ymin = anchor.y(); ymax = ymin + h;
   zmin = anchor.z(); zmax = zmin + d;
+#endif
 }
 
 Cube::~Cube()
 {
 }
 
-void Cube::computeBounds(const PreprocessContext&, BBox& bbox) const
+void Cube::computeBounds(const PreprocessContext&, BBox& bbox_) const
 {
-  bbox.extendByPoint(Point(xmin, ymin, zmin));
-  bbox.extendByPoint(Point(xmax, ymax, zmax));
+  //  bbox.extendByPoint(Point(xmin, ymin, zmin));
+  //  bbox.extendByPoint(Point(xmax, ymax, zmax));
+  bbox_.extendByPoint( bbox[0] );
+  bbox_.extendByPoint( bbox[1] );
 }
 
 void Cube::intersect(const RenderContext&, RayPacket& rays) const
-{  
+{
+
+  // Intersection algorithm requires inverse directions computed.
+  rays.computeInverseDirections();
+
+  // Iterate over each ray.
+  for (int i=0;i<rays.getSize();++i) {
+
+    RayPacket::Element &e = rays.get(i);
+
+               Real tmin, tmax;
+       
+    // Check for an intersection.
+    if (Intersection::intersectAaBox( bbox,
+                                     tmin,
+                                     tmax,
+                                     e.ray,
+                                     e.signMask,
+                                     e.inverseDirection/*,
+                                                                             
                                                                   
e.hitInfo.minT()*/)) {
+
+      // Check to see if we are inside the box.
+      if (tmin > 0.0) {
+        e.hitInfo.hit( tmin, material, this, tex );
+      }
+
+      // And use the max intersection if we are.
+      else
+        e.hitInfo.hit( tmax, material, this, tex );
+    }
+                                 
+  }
+  
+
+#if 0
   using SCIRun::Max;
   using SCIRun::Min;
   rays.computeInverseDirections();
@@ -114,6 +157,8 @@
        e.hitInfo.hit(tnear, material, this, tex);
     }
   }
+
+#endif
 }
 
 
@@ -121,17 +166,24 @@
 {
   rays.computeHitPositions();
   for(int i=0; i<rays.getSize(); i++) {
+    
     RayPacket::Element& e = rays.get(i);
-    if (Abs(e.hitPosition.x() - xmin) < 0.0001)
+    
+    if (Abs(e.hitPosition.x() - bbox[0][0]) < 0.0001)
       e.normal =  Vector(-1, 0, 0 );
-    else if (Abs(e.hitPosition.x() - xmax) < 0.0001)
+    
+    else if (Abs(e.hitPosition.x() - bbox[1][0]) < 0.0001)
       e.normal =  Vector( 1, 0, 0 );
-    else if (Abs(e.hitPosition.y() - ymin) < 0.0001)
+    
+    else if (Abs(e.hitPosition.y() - bbox[0][1]) < 0.0001)
       e.normal =  Vector( 0,-1, 0 );
-    else if (Abs(e.hitPosition.y() - ymax) < 0.0001)
+    
+    else if (Abs(e.hitPosition.y() - bbox[1][1]) < 0.0001)
       e.normal =  Vector( 0, 1, 0 );
-    else if (Abs(e.hitPosition.z() - ymin) < 0.0001)
+    
+    else if (Abs(e.hitPosition.z() - bbox[0][2]) < 0.0001)
       e.normal =  Vector( 0, 0,-1 );
+    
     else 
       e.normal =  Vector( 0, 0, 1 );
   }

Modified: branches/AFR/Model/Primitives/Cube.h
==============================================================================
--- branches/AFR/Model/Primitives/Cube.h        (original)
+++ branches/AFR/Model/Primitives/Cube.h        Mon Sep 19 03:34:20 2005
@@ -4,6 +4,7 @@
 
 #include <Model/Primitives/PrimitiveCommon.h>
 #include <Core/Geometry/PointVector.h>
+#include <Core/Geometry/BBox.h>
 
 namespace Manta
 {
@@ -11,6 +12,8 @@
   class Cube : public PrimitiveCommon {
   public:
     Cube(Material* mat, const Point& anch, double w, double h, double d);
+    Cube(Material *mat, const Point &min_, const Point &max_ ) :
+      PrimitiveCommon( mat ), bbox( min_, max_ ) { }
     ~Cube();
     
     virtual void computeBounds(const PreprocessContext& context,
@@ -19,11 +22,14 @@
     virtual void computeNormal(const RenderContext& context, RayPacket 
&rays) const;    
     
   private:
+    BBox bbox;
+#if 0
     Point anchor;
     double w,h,d;
     double xmin, xmax;
     double ymin, ymax;
     double zmin, zmax;
+#endif
   };
 }
 

Modified: branches/AFR/Model/Primitives/PrimitiveCommon.h
==============================================================================
--- branches/AFR/Model/Primitives/PrimitiveCommon.h     (original)
+++ branches/AFR/Model/Primitives/PrimitiveCommon.h     Mon Sep 19 03:34:20 
2005
@@ -4,13 +4,16 @@
 
 #include <Interface/Primitive.h>
 
-namespace Manta{
+namespace Manta {
   class Material;
   class PrimitiveCommon : public Primitive {
   public:
     PrimitiveCommon(Material* material, const TexCoordMapper* tex = 0);
+               PrimitiveCommon() {  }; // Empty default constructor (used 
for an array of some primitive)
     virtual ~PrimitiveCommon();
 
+               // Note that this preprocess method sets up the activeLights 
for the associated
+               // material (not sure what happens for shared materials)
     virtual void preprocess(const PreprocessContext&);
     virtual void setTexCoordMapper(const TexCoordMapper* new_tex);
   protected:

Modified: branches/AFR/Model/Primitives/Sphere.cc
==============================================================================
--- branches/AFR/Model/Primitives/Sphere.cc     (original)
+++ branches/AFR/Model/Primitives/Sphere.cc     Mon Sep 19 03:34:20 2005
@@ -9,7 +9,7 @@
 using SCIRun::Clamp;
 
 Sphere::Sphere(Material* material, const Point& center, double radius)
-  : PrimitiveCommon(material, this), center(center), radius(radius)
+: PrimitiveCommon(material, this), center(center), radius(radius)
 {
   inv_radius = 1./radius;
 }
@@ -25,7 +25,7 @@
 
 void Sphere::intersect(const RenderContext&, RayPacket& rays) const
 {
-#if VERSION1
+       // #if VERSION1
   rays.normalizeDirections();
   for(int i = 0;i<rays.getSize();i++){
     RayPacket::Element& e = rays.get(i);
@@ -38,121 +38,123 @@
       double t2hc=rad2-l2oc+tca*tca;
       double thc=sqrt(t2hc);
       double t=tca+thc;
-      e.hitInfo.hit(material, this, t);
+      e.hitInfo.hit(t, material, this, tex);
     } else {
       if(tca < 0.0){
-       // Behind ray, no intersections...
+                               // Behind ray, no intersections...
       } else {
-       double t2hc=rad2-l2oc+tca*tca;
-       if(t2hc <= 0.0){
-         // Ray misses, no intersections
-       } else {
-         double thc=sqrt(t2hc);
-         e.hitInfo.hit(material, this, tca-thc);
-         e.hitInfo.hit(material, this, tca+thc);
-       }
+                               double t2hc=rad2-l2oc+tca*tca;
+                               if(t2hc <= 0.0){
+                                       // Ray misses, no intersections
+                               } else {
+                                       double thc=sqrt(t2hc);
+                                       e.hitInfo.hit(tca-thc, material, 
this, tex);
+                                       e.hitInfo.hit(tca+thc, material, 
this, tex);
+                               }
       }
     }
   }
-#endif
+       // #endif
+#if 0
   switch(rays.getFlags() & 
(RayPacket::ConstantOrigin|RayPacket::NormalizedDirections)){
-  case RayPacket::ConstantOrigin|RayPacket::NormalizedDirections:
+               case 
RayPacket::ConstantOrigin|RayPacket::NormalizedDirections:
     {
       // Rays of constant origin and normalized directions
       RayPacket::Element& e0 = rays.get(0);
       Vector O(e0.ray.origin()-center);
       double C = Dot(O, O) - radius*radius;
       for(int i = 0;i<rays.getSize();i++){
-       RayPacket::Element& e = rays.get(i);
-       const Vector& D(e.ray.direction());
-       double B = Dot(O, D);
-       double disc = B*B-C;
-       if(disc >= 0){
-         double r = sqrt(disc);
-         double t0 = -(r+B);
-         if(t0 > 0){
-           e.hitInfo.hit(t0, material, this, tex);
-         } else {
-           double t1 = r-B;
-           e.hitInfo.hit(t1, material, this, tex);
-         }
-       }
+                               RayPacket::Element& e = rays.get(i);
+                               const Vector& D(e.ray.direction());
+                               double B = Dot(O, D);
+                               double disc = B*B-C;
+                               if(disc >= 0){
+                                       double r = sqrt(disc);
+                                       double t0 = -(r+B);
+                                       if(t0 > 0){
+                                               e.hitInfo.hit(t0, material, 
this, tex);
+                                       } else {
+                                               double t1 = r-B;
+                                               e.hitInfo.hit(t1, material, 
this, tex);
+                                       }
+                               }
       }
     }
-  break;
-  case RayPacket::ConstantOrigin:
+                       break;
+               case RayPacket::ConstantOrigin:
     {
       // Rays of constant origin for not normalized directions
       RayPacket::Element& e0 = rays.get(0);
       Vector O(e0.ray.origin()-center);
       double C = Dot(O, O) - radius*radius;
       for(int i = 0;i<rays.getSize();i++){
-       RayPacket::Element& e = rays.get(i);
-       const Vector& D(e.ray.direction());
-       double A = Dot(D, D);
-       double B = Dot(O, D);
-       double disc = B*B-A*C;
-       if(disc >= 0){
-         double r = sqrt(disc);
-         double t0 = -(r+B)/A;
-         if(t0 > 0){
-           e.hitInfo.hit(t0, material, this, tex);
-         } else {
-           double t1 = (r-B)/A;
-           e.hitInfo.hit(t1, material, this, tex);
-         }
-       }
+                               RayPacket::Element& e = rays.get(i);
+                               const Vector& D(e.ray.direction());
+                               double A = Dot(D, D);
+                               double B = Dot(O, D);
+                               double disc = B*B-A*C;
+                               if(disc >= 0){
+                                       double r = sqrt(disc);
+                                       double t0 = -(r+B)/A;
+                                       if(t0 > 0){
+                                               e.hitInfo.hit(t0, material, 
this, tex);
+                                       } else {
+                                               double t1 = (r-B)/A;
+                                               e.hitInfo.hit(t1, material, 
this, tex);
+                                       }
+                               }
       }
     }
-    break;
-  case RayPacket::NormalizedDirections:
+                       break;
+               case RayPacket::NormalizedDirections:
     {
       // Rays of non-constant origin and normalized directions
       for(int i = 0;i<rays.getSize();i++){
-       RayPacket::Element& e = rays.get(i);
-       Vector O(e.ray.origin()-center);
-       const Vector& D(e.ray.direction());
-       double B = Dot(O, D);
-       double C = Dot(O, O) - radius*radius;
-       double disc = B*B-C;
-       if(disc >= 0){
-         double r = sqrt(disc);
-         double t0 = -(r+B);
-         if(t0 > 0){
-           e.hitInfo.hit(t0, material, this, tex);
-         } else {
-           double t1 = r-B;
-           e.hitInfo.hit(t1, material, this, tex);
-         }
-       }
+                               RayPacket::Element& e = rays.get(i);
+                               Vector O(e.ray.origin()-center);
+                               const Vector& D(e.ray.direction());
+                               double B = Dot(O, D);
+                               double C = Dot(O, O) - radius*radius;
+                               double disc = B*B-C;
+                               if(disc >= 0){
+                                       double r = sqrt(disc);
+                                       double t0 = -(r+B);
+                                       if(t0 > 0){
+                                               e.hitInfo.hit(t0, material, 
this, tex);
+                                       } else {
+                                               double t1 = r-B;
+                                               e.hitInfo.hit(t1, material, 
this, tex);
+                                       }
+                               }
       }
     }
-    break;
-  case 0:
+                       break;
+               case 0:
     {
       // Rays of non-constant origin and non-normalized directions
       for(int i = 0;i<rays.getSize();i++){
-       RayPacket::Element& e = rays.get(i);
-       Vector O(e.ray.origin()-center);
-       const Vector& D(e.ray.direction());
-       double A = Dot(D, D);
-       double B = Dot(O, D);
-       double C = Dot(O, O) - radius*radius;
-       double disc = B*B-A*C;
-       if(disc >= 0){
-         double r = sqrt(disc);
-         double t0 = -(r+B)/A;
-         if(t0 > 0){
-           e.hitInfo.hit(t0, material, this, tex);
-         } else {
-           double t1 = (r-B)/A;
-           e.hitInfo.hit(t1, material, this, tex);
-         }
-       }
+                               RayPacket::Element& e = rays.get(i);
+                               Vector O(e.ray.origin()-center);
+                               const Vector& D(e.ray.direction());
+                               double A = Dot(D, D);
+                               double B = Dot(O, D);
+                               double C = Dot(O, O) - radius*radius;
+                               double disc = B*B-A*C;
+                               if(disc >= 0){
+                                       double r = sqrt(disc);
+                                       double t0 = -(r+B)/A;
+                                       if(t0 > 0){
+                                               e.hitInfo.hit(t0, material, 
this, tex);
+                                       } else {
+                                               double t1 = (r-B)/A;
+                                               e.hitInfo.hit(t1, material, 
this, tex);
+                                       }
+                               }
       }
     }
-    break;
+                       break;
   }
+#endif
 }
 
 void Sphere::computeNormal(const RenderContext&, RayPacket& rays) const
@@ -166,7 +168,7 @@
 }
 
 void Sphere::computeTexCoords2(const RenderContext&,
-                              RayPacket& rays) const
+                                                                             
                                           RayPacket& rays) const
 {
   rays.computeHitPositions();
   for(int i = 0;i<rays.getSize();i++){
@@ -181,7 +183,7 @@
 }
 
 void Sphere::computeTexCoords3(const RenderContext&,
-                              RayPacket& rays) const
+                                                                             
                                           RayPacket& rays) const
 {
   rays.computeHitPositions();
   for(int i = 0;i<rays.getSize();i++){

Modified: branches/AFR/Model/Primitives/Triangle.cc
==============================================================================
--- branches/AFR/Model/Primitives/Triangle.cc   (original)
+++ branches/AFR/Model/Primitives/Triangle.cc   Mon Sep 19 03:34:20 2005
@@ -5,6 +5,8 @@
 #include <iostream>
 #include <sgi_stl_warnings_on.h>
 
+#include <Model/Intersections/TriangleEdge.h>
+
 using namespace Manta;
 using namespace std;
 
@@ -39,7 +41,8 @@
     RayPacket::Element& e = rays.get(i);
     const Vector& dir(e.ray.direction());
     Vector o(p1 - e.ray.origin());
-    

+       #if 0      
     double det=Dot(_n,dir);
     if(det>1.e-9 || det < -1.e-9) {
       double idet = 1./det;
@@ -50,14 +53,22 @@
        double B = Dot(DX, _e1)*idet;
        if(B>0.0 && A+B<1.0) {
          double t=Dot(_n, o)*idet;
-         if (e.hitInfo.hit(t, material, this, tex)){
+       #endif
+       
+               Real t, A, B;
+       
+               bool h = Intersection::intersectTriangleEdge( t, A, B, e.ray, 
_e1, _e2, p1 );
+       
+         if (h && e.hitInfo.hit(t, material, this, tex)){
              TriangleHit& th = e.hitInfo.scratchpad<TriangleHit>();
              th.a = A;
              th.b = B;
           }
+#if 0
        }
       }
     }
+#endif
   }
 }
 

Modified: branches/AFR/Model/Primitives/Triangle.h
==============================================================================
--- branches/AFR/Model/Primitives/Triangle.h    (original)
+++ branches/AFR/Model/Primitives/Triangle.h    Mon Sep 19 03:34:20 2005
@@ -14,6 +14,7 @@
       double a,b;
     };
 
+               Triangle() {  };
     Triangle(Material* mat, const Point& _p1, const Point& _p2, const Point& 
_p3);
     virtual ~Triangle();
     

Modified: branches/AFR/Model/Readers/CMakeLists.txt
==============================================================================
--- branches/AFR/Model/Readers/CMakeLists.txt   (original)
+++ branches/AFR/Model/Readers/CMakeLists.txt   Mon Sep 19 03:34:20 2005
@@ -1,4 +1,9 @@
 
 SET (Manta_Readers_SRCS
-     Readers/PlyReader.cc
-     Readers/rply/rply.c)
+     Readers/glm/glm.h
+     Readers/glm/glm.cc)
+
+# Apple places malloc.h in /usr/include/malloc/malloc.h
+IF (APPLE)
+   INCLUDE_DIRECTORIES(/usr/include/malloc/)
+ENDIF (APPLE)
\ No newline at end of file

Modified: branches/AFR/Model/TexCoordMappers/CMakeLists.txt
==============================================================================
--- branches/AFR/Model/TexCoordMappers/CMakeLists.txt   (original)
+++ branches/AFR/Model/TexCoordMappers/CMakeLists.txt   Mon Sep 19 03:34:20 
2005
@@ -1,6 +1,9 @@
 
 SET (Manta_TexCoordMappers_SRCS
+     TexCoordMappers/UniformMapper.h
      TexCoordMappers/UniformMapper.cc
+     TexCoordMappers/SphericalMapper.h
      TexCoordMappers/SphericalMapper.cc
+     TexCoordMappers/LinearMapper.h
      TexCoordMappers/LinearMapper.cc
 )

Modified: branches/AFR/Model/Textures/CheckerTexture.h
==============================================================================
--- branches/AFR/Model/Textures/CheckerTexture.h        (original)
+++ branches/AFR/Model/Textures/CheckerTexture.h        Mon Sep 19 03:34:20 
2005
@@ -3,6 +3,7 @@
 #define Manta_Model_CheckerTexture_h
 
 #include <Interface/Texture.h>
+#include <Core/Geometry/PointVector.h>
 
 namespace Manta {
   class RayPacket;

Modified: branches/AFR/Model/Textures/Constant.h
==============================================================================
--- branches/AFR/Model/Textures/Constant.h      (original)
+++ branches/AFR/Model/Textures/Constant.h      Mon Sep 19 03:34:20 2005
@@ -16,9 +16,9 @@
     virtual void mapValues(const RenderContext& context, RayPacket& rays,
                           ValueType results[]) const;
 
-    ValueType getValue() const {
-      return value;
-    }
+    ValueType getValue() const { return value; }
+               void setValue( const ValueType value_ ) { value = value_; }
+               
   private:
     Constant(const Constant&);
     Constant& operator=(const Constant&);

Modified: branches/AFR/Readers/CMakeLists.txt
==============================================================================
--- branches/AFR/Readers/CMakeLists.txt (original)
+++ branches/AFR/Readers/CMakeLists.txt Mon Sep 19 03:34:20 2005
@@ -1,4 +1,15 @@
 
+SET (READERS_DOUBLE_EAGLE 0 CACHE BOOL "Include Double Eagle Tanker 
Conversion Program")
+IF (READERS_DOUBLE_EAGLE) 
+   ADD_EXECUTABLE(vn2v3c1 DoubleEagle/vn2v3c1.cc)
+   TARGET_LINK_LIBRARIES(vn2v3c1 SCIRun_Core Manta_Core Manta_Model)
+   TARGET_LINK_LIBRARIES(vn2v3c1 ${CMAKE_THREAD_LIBS_INIT}                   
                
+                                 ${OPENGL_LIBRARIES}                         
                 
+                                 ${X11_LIBRARIES}                            
                 
+                                 -lm)  
+ENDIF(READERS_DOUBLE_EAGLE)
+
+
 SET (READERS_SOURCES)
 SET (READERS_SOURCES ${READERS_SOURCES}
      BART/animation.c
@@ -11,3 +22,4 @@
 ADD_LIBRARY (Manta_Readers ${READERS_SOURCES})
 
 TARGET_LINK_LIBRARIES(Manta_Readers SCIRun_Core Manta_Model)
+

Modified: branches/AFR/SCIRun/Core/CMakeLists.txt
==============================================================================
--- branches/AFR/SCIRun/Core/CMakeLists.txt     (original)
+++ branches/AFR/SCIRun/Core/CMakeLists.txt     Mon Sep 19 03:34:20 2005
@@ -1,4 +1,6 @@
 
+SET (CMAKE_VERBOSE_MAKEFILE TRUE)
+
 SET (SCIRUN_SOURCES)
 SET (SCIRUN_SOURCES ${SCIRUN_SOURCES}
      Containers/StringUtil.cc
@@ -21,12 +23,44 @@
      )
 
 SET (SCIRUN_SOURCES ${SCIRUN_SOURCES}
-     Thread/CleanupManager.cc
-     Thread/Runnable.cc 
-     Thread/Thread.cc
-     Thread/ThreadError.cc
-     Thread/ThreadGroup.cc
-     Thread/WorkQueue.cc
+
+    Thread/AtomicCounter.h
+    Thread/Barrier.h
+    Thread/CleanupManager.h
+    Thread/CleanupManager.cc
+    Thread/ConditionVariable.h
+    Thread/CrowdMonitor.h
+    Thread/FutureValue.h
+    Thread/Guard.h
+    Thread/Mailbox.h
+    Thread/Mutex.h
+    Thread/MutexPool.h
+    Thread/MutexPool.cc
+    Thread/Parallel.h
+    Thread/Parallel1.h
+    Thread/Parallel2.h
+    Thread/Parallel3.h
+    Thread/ParallelBase.h
+    Thread/ParallelBase.cc
+    Thread/RecursiveMutex.h
+    Thread/Reducer.h
+    Thread/Runnable.h
+    Thread/Runnable.cc
+    Thread/Semaphore.h
+    Thread/SimpleReducer.h
+    Thread/SimpleReducer.cc
+    Thread/Thread.h
+    Thread/Thread.cc
+    Thread/ThreadError.h
+    Thread/ThreadError.cc
+    Thread/ThreadGroup.h
+    Thread/ThreadGroup.cc
+    Thread/ThreadPool.h
+    Thread/Time.h
+    Thread/WorkQueue.h
+    Thread/WorkQueue.cc
+
+     
      )
 
 # If we are using SPROC on IRIX then add these files
@@ -44,13 +78,23 @@
   # MESSAGE("Using Pthreads")
   SET (SCIRUN_SOURCES ${SCIRUN_SOURCES}
       Thread/Thread_pthreads.cc
-      Thread/Thread_unix.cc
-      Thread/Time_unix.cc
-      )
+      Thread/Thread_unix.cc )
+
+  # Check to see if mmtimer is available.
+  IF(EXISTS /usr/include/sn/mmtimer.h)
+    SET(SCIRUN_SOURCES ${SCIRUN_SOURCES}
+                       Thread/Time_altix.cc)
+  ELSE(EXISTS /usr/include/sn/mmtimer.h)
+    SET(SCIRUN_SOURCES ${SCIRUN_SOURCES}
+                       Thread/Time_unix.cc)
+  ENDIF(EXISTS /usr/include/sn/mmtimer.h)
+
 ENDIF (CMAKE_USE_PTHREADS_INIT)
            
 SET (SCIRUN_SOURCES ${SCIRUN_SOURCES}
      Util/DebugStream.cc
+     Util/Timer.h
+     Util/Timer.cc
      )
 
 ADD_LIBRARY (SCIRun_Core ${SCIRUN_SOURCES})

Modified: branches/AFR/StandAlone/manta.cc
==============================================================================
--- branches/AFR/StandAlone/manta.cc    (original)
+++ branches/AFR/StandAlone/manta.cc    Mon Sep 19 03:34:20 2005
@@ -177,7 +177,7 @@
       if(arg == "-help"){
                                usage(rtrt);
       } else if(arg == "-bench"){
-#if 0
+        // #if 0
                                long numFrames = 100;
                                long warmup = 10;
                                if(getLongArg(i, args, numFrames)){
@@ -190,7 +190,8 @@
                                                                              
                                                   Callback::create(b, 
&BenchHelper::start));
                                
rtrt->addOneShotCallback(RTRTInterface::Absolute, warmup+numFrames,
                                                                              
                                                   Callback::create(b, 
&BenchHelper::stop));
-#endif
+        // #endif
+#if 0
         // Number of outer loops to measure after initialization.
         long outer_loops;
         
@@ -205,7 +206,7 @@
         // Check to see if all threads are initialized in 100 "frames"
         rtrt->addOneShotCallback(RTRTInterface::Relative, 10,
                                                                              
                                                   Callback::create(b, 
&Afr::BenchHelper::tryStart));
-
+#endif 
         
       } else if(arg == "-camera"){
                                string s;

Modified: branches/AFR/UserInterface/XWindowUI.h
==============================================================================
--- branches/AFR/UserInterface/XWindowUI.h      (original)
+++ branches/AFR/UserInterface/XWindowUI.h      Mon Sep 19 03:34:20 2005
@@ -69,6 +69,8 @@
     void prockey(unsigned int, unsigned long, int);
     void quitkey(unsigned int, unsigned long, int);
     void autoview(unsigned int, unsigned long, int);
+               
+               void output_camera(unsigned int, unsigned long, int);
 
     void mouse_fov(unsigned int, unsigned int, int, int, int, int);
     void mouse_translate(unsigned int, unsigned int, int, int, int, int);

Copied: branches/AFR/fox/CMakeLists.txt (from r556, 
branches/itanium2/fox/CMakeLists.txt)
==============================================================================
--- branches/itanium2/fox/CMakeLists.txt        (original)
+++ branches/AFR/fox/CMakeLists.txt     Mon Sep 19 03:34:20 2005
@@ -1,5 +1,10 @@
 
-SET(FOX_PATH "/store/rhodes/abe/build-tomahawk" CACHE PATH "")
+
+SET(FOX_PATH "/home/sci/abe/build-itanium" CACHE PATH "")  
+
+
+
+
 IF(FOX_PATH)
 
   SET(FOX_INCLUDE ${FOX_PATH}/include/fox-1.5 CACHE PATH "")

Copied: branches/AFR/fox/dm_demo.cc (from r556, 
branches/itanium2/fox/dm_demo.cc)
==============================================================================
--- branches/itanium2/fox/dm_demo.cc    (original)
+++ branches/AFR/fox/dm_demo.cc Mon Sep 19 03:34:20 2005
@@ -55,10 +55,14 @@
 using namespace Manta;
 using namespace std;
 
+#if 0
 #include <Model/Groups/KDTree.h>
 #include <Model/Groups/TransparentKDTree.h>
 #include <Model/Materials/CopyColorMaterial.h>
 using namespace Manta::Kdtree;
+#endif
+
+#if 0
 
 
//////////////////////////////////////////////////////////////////////////////
 
//////////////////////////////////////////////////////////////////////////////
@@ -175,6 +179,7 @@
 
 }
 
+#endif 
 
 
//////////////////////////////////////////////////////////////////////////////
 
//////////////////////////////////////////////////////////////////////////////
@@ -324,7 +329,9 @@
        
        // Check to see if the default scene was a kdtree.
        Object *root_object = manta_interface->getScene()->getObject();
-       
+
+#if 0
+  
        
/////////////////////////////////////////////////////////////////////////////
        // Create any necessary dialogs now since everything else should be 
initialized.
        KDTree *kdtree = 0;
@@ -341,7 +348,7 @@
                        new DmDemoDialog( &manta_window, kdtree, 
transparent_kdtree, "Digital Mockup Demo" ) );
                
        }
-       
+#endif 
        
        
/////////////////////////////////////////////////////////////////////////////
        // Start up manta.

Modified: branches/AFR/scenes/CMakeLists.txt
==============================================================================
--- branches/AFR/scenes/CMakeLists.txt  (original)
+++ branches/AFR/scenes/CMakeLists.txt  Mon Sep 19 03:34:20 2005
@@ -22,6 +22,13 @@
    TARGET_LINK_LIBRARIES(scene_0 ${manta_scene_link})
 ENDIF(SCENE_0)
 
+# Just a cube.
+SET(SCENE_CUBE 0 CACHE BOOL "Just a Cube")
+IF(SCENE_CUBE)
+   ADD_LIBRARY(scene_cube cube.cc)
+   TARGET_LINK_LIBRARIES(scene_cube ${manta_scene_link})
+ENDIF(SCENE_CUBE)
+
 # Read in a BART scene.
 SET(SCENE_BARTREADER 0 CACHE BOOL "BART Reader")
 IF(SCENE_BARTREADER)
@@ -36,5 +43,24 @@
    TARGET_LINK_LIBRARIES(scene_primtest ${manta_scene_link})
 ENDIF(SCENE_PRIMTEST)
 
-############################################################
+# Boeing 777 Test Scene.
+SET(SCENE_BOEING777 0 CACHE BOOL "Boeing 777 Test Scene")
+IF(SCENE_BOEING777)
+   ADD_LIBRARY(scene_boeing777 boeing777.cc)
+   TARGET_LINK_LIBRARIES(scene_boeing777 ${manta_scene_link})
+ENDIF(SCENE_BOEING777)
+
+# volume
+SET(SCENE_VOLUME 1 CACHE BOOL "volume rendering")
+IF(SCENE_VOLUME)
+   ADD_LIBRARY(scene_volume volume.cc)
+   TARGET_LINK_LIBRARIES(scene_volume ${manta_scene_link})
+ENDIF(SCENE_VOLUME)
+
+SET(SCENE_OBJVIEWER 0 CACHE BOOL "Wavefront Obj file viewer.")
+IF(SCENE_OBJVIEWER)
+   ADD_LIBRARY(scene_objviewer objviewer.cc)
+   TARGET_LINK_LIBRARIES(scene_objviewer ${manta_scene_link})
+ENDIF(SCENE_OBJVIEWER)
+
 




  • [MANTA] r557 - in branches/AFR: . Core Core/Color Core/Geometry Engine Engine/Control Engine/Display Engine/IdleModes Engine/ImageTraversers Engine/LoadBalancers Engine/PixelSamplers Engine/Renderers Engine/Shadows Image Interface Model Model/Cameras Model/Groups Model/Intersections Model/Lights Model/Materials Model/MiscObjects Model/Primitives Model/Readers Model/Readers/glm Model/TexCoordMappers Model/Textures Readers Readers/DoubleEagle SCIRun/Core StandAlone UserInterface fox glfw histx scenes, abe, 09/19/2005

Archive powered by MHonArc 2.6.16.

Top of page