[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13958] trunk/blender/source/blender:
Brecht Van Lommel
brechtvanlommel at pandora.be
Mon Mar 3 17:38:27 CET 2008
Revision: 13958
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13958
Author: blendix
Date: 2008-03-03 17:38:27 +0100 (Mon, 03 Mar 2008)
Log Message:
-----------
Fix for bug #8366, render color sampling bugs and inconsistencies:
- renderwindow didn't show values of previous buffer correct.
- renderwindow only showed floats and no char values like image editor.
- renderwindow didn't show x,y values.
- image editor didn't show z values.
Patch to fix these problems provided by Rob Hausauer, thanks!
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/image.c
trunk/blender/source/blender/src/renderwin.c
Modified: trunk/blender/source/blender/blenkernel/intern/image.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/image.c 2008-03-03 15:56:05 UTC (rev 13957)
+++ trunk/blender/source/blender/blenkernel/intern/image.c 2008-03-03 16:38:27 UTC (rev 13958)
@@ -1770,6 +1770,8 @@
ibuf->rect_float= rectf;
ibuf->flags |= IB_rectfloat;
ibuf->channels= channels;
+ ibuf->zbuf_float= rres.rectz;
+ ibuf->flags |= IB_zbuffloat;
ima->ok= IMA_OK_LOADED;
return ibuf;
Modified: trunk/blender/source/blender/src/renderwin.c
===================================================================
--- trunk/blender/source/blender/src/renderwin.c 2008-03-03 15:56:05 UTC (rev 13957)
+++ trunk/blender/source/blender/src/renderwin.c 2008-03-03 16:38:27 UTC (rev 13958)
@@ -352,6 +352,7 @@
rres.recty= rspare->ibuf->y;
rres.rect32= (int *)rspare->ibuf->rect;
rres.rectf= rspare->ibuf->rect_float;
+ rres.rectz= rspare->ibuf->zbuf_float;
}
else
memset(&rres, 0, sizeof(rres));
@@ -429,11 +430,26 @@
renderwin_queue_redraw(rw);
}
+#define FTOCHAR(val) val<=0.0f? 0 : (val>=(1.0f-0.5f/255.0f)? 255 :(char)((255.0f*val)+0.5f))
+
static void renderwin_mouse_moved(RenderWin *rw)
{
RenderResult rres;
-
- RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
+ RenderSpare *rspare= render_spare;
+
+ if(rspare && rspare->showspare) {
+ if(rspare->ibuf) {
+ rres.rectx= rspare->ibuf->x;
+ rres.recty= rspare->ibuf->y;
+ rres.rect32= (int *)rspare->ibuf->rect;
+ rres.rectf= rspare->ibuf->rect_float;
+ rres.rectz= rspare->ibuf->zbuf_float;
+ }
+ else
+ memset(&rres, 0, sizeof(rres));
+ }
+ else
+ RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
if (rw->flags & RW_FLAGS_PIXEL_EXAMINING) {
int imgco[2], ofs=0;
@@ -441,12 +457,16 @@
char *pxl;
if (renderwin_win_to_image_co(rw, rw->lmouse, imgco)) {
+ ofs= sprintf(buf, "X: %d Y: %d ", imgco[0], imgco[1]);
if (rres.rect32) {
pxl= (char*) &rres.rect32[rres.rectx*imgco[1] + imgco[0]];
- ofs= sprintf(buf, "R: %d G: %d B: %d A: %d", pxl[0], pxl[1], pxl[2], pxl[3]);
+ ofs+= sprintf(buf+ofs, " | R: %d G: %d B: %d A: %d", pxl[0], pxl[1], pxl[2], pxl[3]);
}
if (rres.rectf) {
float *pxlf= rres.rectf + 4*(rres.rectx*imgco[1] + imgco[0]);
+ if(!rres.rect32){
+ ofs+= sprintf(buf+ofs, " | R: %d G: %d B: %d A: %d", FTOCHAR(pxlf[0]), FTOCHAR(pxlf[1]), FTOCHAR(pxlf[2]), FTOCHAR(pxlf[3]));
+ }
ofs+= sprintf(buf+ofs, " | R: %.3f G: %.3f B: %.3f A: %.3f ", pxlf[0], pxlf[1], pxlf[2], pxlf[3]);
}
if (rres.rectz) {
@@ -1159,11 +1179,16 @@
rspare->ibuf->flags |= IB_rect;
rspare->ibuf->mall |= IB_rect;
}
- else if(rres.rectf) {
+ if(rres.rectf) {
rspare->ibuf->rect_float= MEM_dupallocN(rres.rectf);
rspare->ibuf->flags |= IB_rectfloat;
rspare->ibuf->mall |= IB_rectfloat;
}
+ if(rres.rectz) {
+ rspare->ibuf->zbuf_float= MEM_dupallocN(rres.rectz);
+ rspare->ibuf->flags |= IB_zbuffloat;
+ rspare->ibuf->mall |= IB_zbuffloat;
+ }
return 1;
}
More information about the Bf-blender-cvs
mailing list