[Bf-blender-cvs] [737e70e] multiview: All anaglyph stereo output modes working =)
Dalai Felinto
noreply at git.blender.org
Fri Aug 8 17:40:25 CEST 2014
Commit: 737e70e4f393066b4bb9ba48c76c305851458193
Author: Dalai Felinto
Date: Fri Aug 8 16:30:14 2014 +0200
Branches: multiview
https://developer.blender.org/rB737e70e4f393066b4bb9ba48c76c305851458193
All anaglyph stereo output modes working =)
===================================================================
M source/blender/imbuf/intern/stereoimbuf.c
===================================================================
diff --git a/source/blender/imbuf/intern/stereoimbuf.c b/source/blender/imbuf/intern/stereoimbuf.c
index 7bb2ebb..ffdbe3b 100644
--- a/source/blender/imbuf/intern/stereoimbuf.c
+++ b/source/blender/imbuf/intern/stereoimbuf.c
@@ -55,7 +55,7 @@
#include "DNA_userdef_types.h"
#include "DNA_scene_types.h"
-static void imb_stereo_anaglyph(enum eStereoAnaglyphType UNUSED(mode), ImBuf *left, ImBuf *right, bool is_float, ImBuf *r_ibuf)
+static void imb_stereo_anaglyph(enum eStereoAnaglyphType mode, ImBuf *left, ImBuf *right, bool is_float, ImBuf *r_ibuf)
{
int x, y;
size_t width = r_ibuf->x;
@@ -64,41 +64,57 @@ static void imb_stereo_anaglyph(enum eStereoAnaglyphType UNUSED(mode), ImBuf *le
const int stride_from = width;
const int stride_to = width;
+ int anaglyph_encoding[3][3] = {
+ {0,1,1},
+ {1,0,1},
+ {0,0,1},
+ };
+
+ int r, g, b;
+
+ r = anaglyph_encoding[mode][0];
+ g = anaglyph_encoding[mode][1];
+ b = anaglyph_encoding[mode][2];
+
if (is_float){
+ float *rect_to = r_ibuf->rect_float;
const float *rect_left = left->rect_float;
const float *rect_right= right->rect_float;
- float *rect_to = r_ibuf->rect_float;
/* always RGBA input/output */
for (y = 0; y < height; y++) {
float *to = rect_to + stride_to * y * 4;
- const float *from_left = rect_left + stride_from * y * 4;
- const float*from_right = rect_right + stride_from * y * 4;
-
- for (x = 0; x < width; x++, from_left += 4, from_right += 4, to += 4) {
- to[0] = from_left[0];
- to[1] = from_right[1];
- to[2] = from_right[2];
- to[3] = from_right[3];
+ const float *from[2] = {
+ rect_left + stride_from * y * 4,
+ rect_right + stride_from * y * 4,
+ };
+
+ for (x = 0; x < width; x++, from[0] += 4, from[1] += 4, to += 4) {
+ to[0] = from[r][0];
+ to[1] = from[g][1];
+ to[2] = from[b][2];
+ to[3] = MAX2(from[0][2], from[0][2]);
}
}
}
else {
+ uchar *rect_to = (uchar *)r_ibuf->rect;
const uchar *rect_left = (uchar *)left->rect;
const uchar *rect_right= (uchar *)right->rect;
- uchar *rect_to = (uchar *)r_ibuf->rect;
/* always RGBA input/output */
for (y = 0; y < height; y++) {
uchar *to = rect_to + stride_to * y * 4;
- uchar *from_left = rect_left + stride_from * y * 4;
- uchar *from_right = rect_right + stride_from * y * 4;
-
- for (x = 0; x < width; x++, from_left += 4, from_right += 4, to += 4) {
- to[0] = from_left[0];
- to[1] = from_right[1];
- to[2] = from_right[2];
- to[3] = from_right[3];
+ uchar *from[2] = {
+ rect_left + stride_from * y * 4,
+ rect_right + stride_from * y * 4,
+ };
+
+ for (x = 0; x < width; x++, from[0] += 4, from[1] += 4, to += 4) {
+ to[0] = from[r][0];
+ to[1] = from[g][1];
+ to[2] = from[b][2];
+ to[3] = MAX2(from[0][2], from[0][2]);
}
}
}
More information about the Bf-blender-cvs
mailing list