Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r882 - trunk/fox/disco_demo/Engine/Shaders


Chronological Thread 
  • From: bigler@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r882 - trunk/fox/disco_demo/Engine/Shaders
  • Date: Thu, 2 Feb 2006 22:19:01 -0700 (MST)

Author: bigler
Date: Thu Feb  2 22:19:00 2006
New Revision: 882

Modified:
   trunk/fox/disco_demo/Engine/Shaders/AOShader.cc
Log:

Fixed weird edge problem.  TilePackets are index from zero, while
RayPackets are index from ::begin().

Fixed GCC compile having problems with goto to a middle of a loop.


Modified: trunk/fox/disco_demo/Engine/Shaders/AOShader.cc
==============================================================================
--- trunk/fox/disco_demo/Engine/Shaders/AOShader.cc     (original)
+++ trunk/fox/disco_demo/Engine/Shaders/AOShader.cc     Thu Feb  2 22:19:00 
2006
@@ -219,8 +219,8 @@
       ((p.tilex+overlap)%kernel_width) +
       ((p.tiley+overlap)%kernel_width) * kernel_width;
       
-    int d     = task*task_size;
-    int d_end = d+task_size;
+    int d     = static_cast<int>(task*task_size);
+    int d_end = static_cast<int>(d+task_size);
 
     // Iterate across directions.
     for (;d<d_end;++d) {
@@ -247,22 +247,20 @@
       // Check to see if the packet is filled.
       if (secondary_size == RayPacket::MaxSize) {
 
-      send_secondary_packet:
-        
         // Send the packet.
         secondary_packet.resize( secondary_size );
-        secondary_packet.resetHits();        
+        secondary_packet.resetHits();
 
         // Send the ray packet.
         context.scene->getObject()->intersect( context, secondary_packet );
-        
+
         // Count how many hit.
         for (int j=secondary_packet.begin();j<secondary_packet.end();++j) {
           if (secondary_packet.wasHit(j)) {
             total_hits[secondary_map[j]]++;
           }
         }
-        
+
         // Reset the secondary packet.
         secondary_packet.setAllFlags( 0 );
         secondary_packet.resize( 0 );
@@ -273,14 +271,26 @@
 
   // Check to see if any additional secondary rays need to be sent.
   if (secondary_size) {
-    goto send_secondary_packet;
+    // Send the packet.
+    secondary_packet.resize( secondary_size );
+    secondary_packet.resetHits();
+
+    // Send the ray packet.
+    context.scene->getObject()->intersect( context, secondary_packet );
+
+    // Count how many hit.
+    for (int j=secondary_packet.begin();j<secondary_packet.end();++j) {
+      if (secondary_packet.wasHit(j)) {
+        total_hits[secondary_map[j]]++;
+      }
+    }
   }
   
   ////////////////////////////////////////////////////////////////////////
   // Determine hit ratio.
   for (int i=ray_packet.begin();i<ray_packet.end();++i) {
 
-    TilePacket::Element &p = tile_packet.get( i );
+    TilePacket::Element &p = tile_packet.get( i - ray_packet.begin());
     
     p.illuminance = ( (Real)total_hits[i] / (Real)task_size );
     




  • [MANTA] r882 - trunk/fox/disco_demo/Engine/Shaders, bigler, 02/02/2006

Archive powered by MHonArc 2.6.16.

Top of page