Text archives Help
- From: bigler@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r484 - in trunk: Engine/ImageTraversers Interface
- Date: Fri, 19 Aug 2005 15:57:51 -0600 (MDT)
Author: bigler
Date: Fri Aug 19 15:57:50 2005
New Revision: 484
Modified:
trunk/Engine/ImageTraversers/DissolveTiledImageTraverser.cc
trunk/Interface/Fragment.h
Log:
Engine/ImageTraversers/DissolveTiledImageTraverser.cc
Fragments are now filled as much as they can be rather than on a
scanline by scanline basis.
Interface/Fragment.h
Removed addItem function, as it was dead code. Use addElement
instead.
Added testSetWhichEye and testSetConsecutiveX which run through the
Fragment and attemp to set flags based on the contents of the
fragments.
Modified: trunk/Engine/ImageTraversers/DissolveTiledImageTraverser.cc
==============================================================================
--- trunk/Engine/ImageTraversers/DissolveTiledImageTraverser.cc (original)
+++ trunk/Engine/ImageTraversers/DissolveTiledImageTraverser.cc Fri Aug 19
15:57:50 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: trunk/Interface/Fragment.h
==============================================================================
--- trunk/Interface/Fragment.h (original)
+++ trunk/Interface/Fragment.h Fri Aug 19 15:57:50 2005
@@ -76,15 +76,6 @@
}
}
- // 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 +98,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] r484 - in trunk: Engine/ImageTraversers Interface, bigler, 08/19/2005
Archive powered by MHonArc 2.6.16.