Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r315 - in trunk: . Engine/Control Engine/Shadows Model/Cameras


Chronological Thread 
  • From: aek@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r315 - in trunk: . Engine/Control Engine/Shadows Model/Cameras
  • Date: Fri, 13 May 2005 16:44:32 -0600 (MDT)

Author: aek
Date: Fri May 13 16:44:32 2005
New Revision: 315

Added:
   trunk/Engine/Shadows/BeamShadows.cc
   trunk/Engine/Shadows/BeamShadows.h
Modified:
   trunk/CMakeLists.txt
   trunk/Engine/Control/RTRT_register.cc
   trunk/Engine/Shadows/CMakeLists.txt
   trunk/Model/Cameras/OrthogonalCamera.cc
   trunk/Model/Cameras/OrthogonalCamera.h
Log:
* Fixed CMakeList.txt optimization flags for OS X 10.3.
* Initial try at Pete's "beam-traced" shadows. (Doesn't work yet)
* Small improvement to OrthogonalCamera config code



Modified: trunk/CMakeLists.txt
==============================================================================
--- trunk/CMakeLists.txt        (original)
+++ trunk/CMakeLists.txt        Fri May 13 16:44:32 2005
@@ -25,7 +25,7 @@
 
 
 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 
-malign-natural -ffast-math -freorder-blocks -finline-floor -mpowerpc-gpopt 
-force_cpusubtype_ALL -mtune=G5 -mcpu=G5 -mpowerpc64 -maltivec -mabi=altivec 
-mpowerpc-gfxopt" CACHE STRING "Optimized Flags" FORCE)
+  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)
 
 IF (OPENGL_INCLUDE_PATH)

Modified: trunk/Engine/Control/RTRT_register.cc
==============================================================================
--- trunk/Engine/Control/RTRT_register.cc       (original)
+++ trunk/Engine/Control/RTRT_register.cc       Fri May 13 16:44:32 2005
@@ -20,6 +20,7 @@
 #include <Engine/Renderers/Moire.h>
 #include <Engine/Renderers/NullRenderer.h>
 #include <Engine/Renderers/Raytracer.h>
+#include <Engine/Shadows/BeamShadows.h>
 #include <Engine/Shadows/HardShadows.h>
 #include <Engine/Shadows/NoShadows.h>
 #include <Image/Pixel.h>
@@ -84,6 +85,7 @@
     // Register shadow algorithms
     rtrt->registerComponent("noshadows", &NoShadows::create);
     rtrt->registerComponent("hard", &HardShadows::create);
+    rtrt->registerComponent("beam", &BeamShadows::create);
 
     // Idle modes
     rtrt->registerComponent("zoom", &ZoomIdleMode::create);

Added: trunk/Engine/Shadows/BeamShadows.cc
==============================================================================
--- (empty file)
+++ trunk/Engine/Shadows/BeamShadows.cc Fri May 13 16:44:32 2005
@@ -0,0 +1,110 @@
+
+#include <Engine/Shadows/BeamShadows.h>
+#include <Interface/Context.h>
+#include <Interface/Light.h>
+#include <Interface/LightSet.h>
+#include <Interface/Object.h>
+#include <Interface/RayPacket.h>
+#include <Interface/Scene.h>
+#include <Core/Util/Args.h>
+#include <Core/Exceptions/IllegalArgument.h>
+
+using namespace Manta;
+
+ShadowAlgorithm* BeamShadows::create(const vector<string>& args)
+{
+  return new BeamShadows(args);
+}
+
+BeamShadows::BeamShadows(const vector<string>& args)
+{
+  bool gotRadius = false;
+  int argc = static_cast<int>(args.size());
+  for(int i=0; i< argc; i++){
+    string arg = args[i];
+    if(arg == "-radius"){
+      if(!getDoubleArg(i, args, radius))
+        throw IllegalArgument("BeamShadows -radius", i, args);
+      gotRadius = true;
+    } else {
+      throw IllegalArgument("BeamShadows", i, args);
+    }
+  }
+  if(!gotRadius)
+    throw IllegalArgument("BeamShadows needs -radius", 0, args);
+}
+
+BeamShadows::~BeamShadows()
+{
+}
+
+int BeamShadows::computeShadows(const RenderContext& context,
+                              const LightSet* lights, RayPacket& rays,
+                              int start, RayPacket& shadowRays)
+{
+  int nlights = lights->numLights();
+  rays.computeHitPositions();
+
+  int sidx = 0;
+  int end = start;
+  while(end < rays.getSize() && sidx+nlights <= RayPacket::MaxSize){
+    RayPacket::Element& e = rays.get(end++);
+    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] * 0.25;
+        s.hitInfo.reset(length);
+      }
+
+      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(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(0,0,radius+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;
+  }
+
+  
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;
+}
+
+string BeamShadows::getName() const {
+  return "beam";
+}
+
+string BeamShadows::getSpecs() const {
+  return "none";
+}
+

Added: trunk/Engine/Shadows/BeamShadows.h
==============================================================================
--- (empty file)
+++ trunk/Engine/Shadows/BeamShadows.h  Fri May 13 16:44:32 2005
@@ -0,0 +1,34 @@
+
+#ifndef Manta_Engine_BeamShadows_h
+#define Manta_Engine_BeamShadows_h
+
+#include <Interface/ShadowAlgorithm.h>
+#include <sgi_stl_warnings_off.h>
+#include <vector>
+#include <string>
+#include <sgi_stl_warnings_on.h>
+
+namespace Manta {
+  using namespace std;
+  class BeamShadows : public ShadowAlgorithm {
+  public:
+    BeamShadows(const vector<string>& args);
+    virtual ~BeamShadows();
+
+    virtual int computeShadows(const RenderContext& context, const LightSet* 
lights,
+                              RayPacket&, int start, RayPacket&);
+
+    static ShadowAlgorithm* create(const vector<string>& args);
+
+    virtual string getName() const;
+    virtual string getSpecs() const;
+
+  private:
+    BeamShadows(const BeamShadows&);
+    BeamShadows& operator=(const BeamShadows&);
+
+    double radius;
+  };
+}
+
+#endif

Modified: trunk/Engine/Shadows/CMakeLists.txt
==============================================================================
--- trunk/Engine/Shadows/CMakeLists.txt (original)
+++ trunk/Engine/Shadows/CMakeLists.txt Fri May 13 16:44:32 2005
@@ -2,4 +2,5 @@
 SET (Manta_Shadows_SRCS
      Shadows/NoShadows.cc
      Shadows/HardShadows.cc
+     Shadows/BeamShadows.cc
      )

Modified: trunk/Model/Cameras/OrthogonalCamera.cc
==============================================================================
--- trunk/Model/Cameras/OrthogonalCamera.cc     (original)
+++ trunk/Model/Cameras/OrthogonalCamera.cc     Fri May 13 16:44:32 2005
@@ -19,7 +19,6 @@
   bool gotLookat = false;
   bool gotScale = false;
   bool gotUp = false;
-  normalizeRays = false;
   int argc = static_cast<int>(args.size());
   for(int i=0; i< argc; i++){
     string arg = args[i];
@@ -39,8 +38,6 @@
       if(!getDoubleArg(i, args, hscale))
        throw IllegalArgument("OrthogonalCamera -scale", i, args);
       gotScale = true;
-    } else if(arg == "-normalizeRays"){
-      normalizeRays = true;
     } else {
       throw IllegalArgument("OrthogonalCamera", i, args);
     }

Modified: trunk/Model/Cameras/OrthogonalCamera.h
==============================================================================
--- trunk/Model/Cameras/OrthogonalCamera.h      (original)
+++ trunk/Model/Cameras/OrthogonalCamera.h      Fri May 13 16:44:32 2005
@@ -31,7 +31,6 @@
     Point lookat;
     Vector up;
     double hscale, vscale;
-    bool normalizeRays;
 
     Vector direction;
     Vector u,v;




  • [MANTA] r315 - in trunk: . Engine/Control Engine/Shadows Model/Cameras, aek, 05/13/2005

Archive powered by MHonArc 2.6.16.

Top of page