Text archives Help
- From: abe@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r485 - in branches/itanium2: Engine/ImageTraversers Interface
- Date: Fri, 19 Aug 2005 17:27:54 -0600 (MDT)
Author: abe
Date: Fri Aug 19 17:27:53 2005
New Revision: 485
Modified:
branches/itanium2/Engine/ImageTraversers/DissolveTiledImageTraverser.cc
branches/itanium2/Interface/Fragment.h
Log:
Fixed out of bounds in createRandom, integrated changes from trunk/
Modified:
branches/itanium2/Engine/ImageTraversers/DissolveTiledImageTraverser.cc
==============================================================================
--- branches/itanium2/Engine/ImageTraversers/DissolveTiledImageTraverser.cc
(original)
+++ branches/itanium2/Engine/ImageTraversers/DissolveTiledImageTraverser.cc
Fri Aug 19 17:27:53 2005
@@ -156,6 +156,10 @@
ChannelContext& cdata =
per_thread_data[context.proc].channel_data[context.channelIndex];
unsigned int next_tile = cdata.next_tile;
+
+ Fragment frag;
+ frag.setFlags(Fragment::ConstantEye);
+
// Loop over all the assignments. tc stands for tile count.
for(unsigned int tc = 0; tc < cdata.tiles_per_pass; ++tc) {
// Get the next assignment.
@@ -171,16 +175,25 @@
int yend = (ytile+1) * ytilesize;
if(yend > yres)
yend = yres;
- for(int y = ystart; y<yend; y++){
- for(int x = xstart; x<xend; x+= Fragment::MaxFragmentSize){
- // Create a Fragment that is consecutive in X pixels
- Fragment frag(0, x, xend, y);
- context.pixelSampler->renderFragment(context, frag);
- image->set(frag);
+ for(int y = ystart; y<yend; ++y) {
+ for(int x = xstart; x<xend; ++x) {
+ // Add the fragment
+ frag.addElement(x, y, 0);
if(stereo){
- Fragment frag(1, x, xend, y);
+ // I'm not sure you want to do stereo
+ }
+ // Check to see if your fragment is full. If it is, then render it.
+ if (frag.getSize() == Fragment::MaxFragmentSize) {
+// // It might be useful to check for ConsecutiveX, but only if
+// // certain conditions exist.
+// if ((xend-xstart) == Fragment::MaxFragmentSize)
+// frag.testSetConsecutiveX();
+ // Render the fragments
context.pixelSampler->renderFragment(context, frag);
image->set(frag);
+ // Reset the Fragment, so we can start filling it up again.
+ frag.resetSize();
+ frag.setFlags(Fragment::ConstantEye);
}
}
} // end looping over the tile
@@ -191,6 +204,11 @@
computeNextSample(next_tile, cdata.rng_mask);
} while (next_tile > cdata.numTiles);
+ }
+ // Pick up strays
+ if (frag.getSize()) {
+ context.pixelSampler->renderFragment(context, frag);
+ image->set(frag);
}
// Save the next tile for the next iteration.
cdata.next_tile = next_tile;
Modified: branches/itanium2/Interface/Fragment.h
==============================================================================
--- branches/itanium2/Interface/Fragment.h (original)
+++ branches/itanium2/Interface/Fragment.h Fri Aug 19 17:27:53 2005
@@ -72,19 +72,14 @@
{
data[i].x = (int)(xstart+myRandomNumber.genfrand()*(xend - xstart));
data[i].y = (int)(ystart+myRandomNumber.genfrand()*(yend - ystart));
+
+ if (data[i].x >= xend) data[i].x = (xend - 1);
+ if (data[i].y >= yend) data[i].y = (yend - 1);
+
data[i].which_eye = which_eye;
}
}
- // Add a sample location to the fragment and return if fragment
- // has more space left or not.
- bool addItem(const int x, const int y, const int which_eye, int index) {
- data[index].x = x;
- data[index].y = y;
- data[index].which_eye = which_eye;
- if(index+1>=size) return false; else return true;
- }
-
int getFlags() const {
return flags;
}
@@ -107,6 +102,33 @@
flags = 0;
}
+ // You should really only call these functions if size > 0.
+ // Otherwise you will set the flag to be true.
+ void testSetWhichEye() {
+ // This will be true if size is <= 1.
+ int test_passed = ConstantEye;
+ for(int i = 1; i < size; ++i)
+ if (data[i-1].which_eye != data[i].which_eye) {
+ test_passed = 0;
+ break;
+ }
+ // This will turn off the flag and then turn it back on if
+ // test_passed is "true".
+ flags = test_passed | (flags & ~ConstantEye);
+ }
+ void testSetConsecutiveX() {
+ int test_passed = ConsecutiveX;
+ for(int i = 1; i < size; ++i)
+ // Test to see if the y's are the same as well as X being
+ // consecutive.
+ if (data[i].y != data[i-1].y &&
+ (data[i].x - data[i-1].x) == 1) {
+ test_passed = 0;
+ break;
+ }
+ flags = test_passed | (flags & ~ConsecutiveX);
+ }
+
void setColor(int which, const Color& color) {
data[which].color = color;
}
- [MANTA] r485 - in branches/itanium2: Engine/ImageTraversers Interface, abe, 08/19/2005
Archive powered by MHonArc 2.6.16.