[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49410] branches/soc-2011-tomato/intern/ cycles/render: Tomato Cycles: use the same order of parts as Blender Internal
Sergey Sharybin
sergey.vfx at gmail.com
Tue Jul 31 15:15:53 CEST 2012
Revision: 49410
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49410
Author: nazgul
Date: 2012-07-31 13:15:53 +0000 (Tue, 31 Jul 2012)
Log Message:
-----------
Tomato Cycles: use the same order of parts as Blender Internal
Modified Paths:
--------------
branches/soc-2011-tomato/intern/cycles/render/tile.cpp
branches/soc-2011-tomato/intern/cycles/render/tile.h
Modified: branches/soc-2011-tomato/intern/cycles/render/tile.cpp
===================================================================
--- branches/soc-2011-tomato/intern/cycles/render/tile.cpp 2012-07-31 12:36:08 UTC (rev 49409)
+++ branches/soc-2011-tomato/intern/cycles/render/tile.cpp 2012-07-31 13:15:53 UTC (rev 49410)
@@ -113,16 +113,56 @@
bool TileManager::next_tile(Tile& tile, int device)
{
- list<Tile>::iterator iter;
+ list<Tile>::iterator iter, best = state.tiles.end();
+ int resolution = state.resolution;
+ int image_w = max(1, params.width/resolution);
+ int image_h = max(1, params.height/resolution);
+
+ int num = min(image_h, num_devices);
+
+ int device_y = (image_h / num) * device;
+ int device_h = (device == num - 1) ? image_h - device * (image_h / num) : image_h / num;
+
+ long long int centx = image_w / 2, centy = device_h / 2, tot = 1;
+ long long int mindist = (long long int) image_w * (long long int) device_h;
+
+ /* find center of rendering tiles, image center counts for 1 too */
for(iter = state.tiles.begin(); iter != state.tiles.end(); iter++) {
- if(iter->device == device) {
- tile = *iter;
- state.tiles.erase(iter);
- return true;
+ if(iter->device == device && iter->rendering) {
+ Tile &cur_tile = *iter;
+ centx += cur_tile.x + cur_tile.w / 2;
+ centy += cur_tile.y + cur_tile.h / 2;
+ tot++;
}
}
+ centx /= tot;
+ centy /= tot;
+
+ /* closest of the non-rendering tiles */
+ for(iter = state.tiles.begin(); iter != state.tiles.end(); iter++) {
+ if(iter->device == device && iter->rendering == false) {
+ Tile &cur_tile = *iter;
+
+ long long int distx = centx - (cur_tile.x + cur_tile.w / 2);
+ long long int disty = centy - (cur_tile.y + cur_tile.h / 2);
+ distx = (long long int) sqrt(distx * distx + disty * disty);
+
+ if (distx < mindist) {
+ best = iter;
+ mindist = distx;
+ }
+ }
+ }
+
+ if (best != state.tiles.end()) {
+ best->rendering = true;
+ tile = *best;
+
+ return true;
+ }
+
return false;
}
Modified: branches/soc-2011-tomato/intern/cycles/render/tile.h
===================================================================
--- branches/soc-2011-tomato/intern/cycles/render/tile.h 2012-07-31 12:36:08 UTC (rev 49409)
+++ branches/soc-2011-tomato/intern/cycles/render/tile.h 2012-07-31 13:15:53 UTC (rev 49410)
@@ -32,12 +32,13 @@
public:
int x, y, w, h;
int device;
+ bool rendering;
Tile()
{}
Tile(int x_, int y_, int w_, int h_, int device_)
- : x(x_), y(y_), w(w_), h(h_), device(device_) {}
+ : x(x_), y(y_), w(w_), h(h_), device(device_), rendering(false) {}
};
/* Tile Manager */
More information about the Bf-blender-cvs
mailing list