aboutsummaryrefslogtreecommitdiff
path: root/stereo-blender.patch
blob: 289d7eb2b905e0228ea4f13b802e8ad06a13ddf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/SConstruct ./SConstruct
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/SConstruct	2006-03-17 17:38:38.000000000 +0100
+++ ./SConstruct	2010-09-14 15:58:27.431789452 +0200
@@ -161,6 +161,8 @@
 
 #check for additional debug libnames
 
+env.Append(LIBPATH='/usr/local/lib32')
+
 if env.has_key('BF_DEBUG_LIBS'):
 	B.quickdebug += env['BF_DEBUG_LIBS']
 
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/config/linux2-config.py ./config/linux2-config.py
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/config/linux2-config.py	2006-04-06 22:11:06.000000000 +0200
+++ ./config/linux2-config.py	2010-09-20 16:57:27.889591638 +0200
@@ -1,17 +1,18 @@
 LCGDIR = '../lib/linux2'
-BF_PYTHON = '/usr'
+
+BF_PYTHON = '/usr/local'
 BF_PYTHON_VERSION = '2.4'
 BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
 BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
 BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}' #BF_PYTHON+'/lib/python'+BF_PYTHON_VERSION+'/config/libpython'+BF_PYTHON_VERSION+'.a'
 
-WITH_BF_OPENAL = 'true'
-BF_OPENAL = '/usr'
+WITH_BF_OPENAL = 'false'
+BF_OPENAL = '/usr/local'
 BF_OPENAL_INC = '${BF_OPENAL}/include'
-BF_OPENAL_LIB = 'openal'
+BF_OPENAL_LIB = 'openal alut'
 
-WITH_BF_SDL = 'true'
-BF_SDL = '/usr' #$(shell sdl-config --prefix)
+WITH_BF_SDL = 'false'
+BF_SDL = '/usr/local' #$(shell sdl-config --prefix)
 BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
 BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
 
@@ -19,29 +20,36 @@
 BF_FMOD = LCGDIR + '/fmod'
 
 WITH_BF_OPENEXR = 'true'
-BF_OPENEXR = '/usr'
-BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR'
-BF_OPENEXR_LIB = 'Half IlmImf Iex Imath '
+BF_OPENEXR = '/usr/local/'
+BF_OPENEXR_INC = ['${BF_OPENEXR}/include/OpenEXR', '${BF_OPENEXR}/include']
+BF_OPENEXR_LIB = 'Half IlmImf Iex Imath IlmThread'
+BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib32'
 
 WITH_BF_JPEG = 'true'
-BF_JPEG = '/usr'
+BF_JPEG = '/usr/local'
 BF_JPEG_INC = '${BF_JPEG}/include'
 BF_JPEG_LIB = 'jpeg'
+BF_JPEG_LIBPATH = '${BF_JPEG}/lib32'
 
 WITH_BF_PNG = 'true'
-BF_PNG = '/usr'
+BF_PNG = '/usr/local'
 BF_PNG_INC = '${BF_PNG}/include'
 BF_PNG_LIB = 'png'
+BF_PNG_LIBPATH = '${BF_PNG}/lib32'
 
-BF_TIFF = '/usr'
+BF_TIFF = 'true'
+BF_TIFF = '/usr/local'
 BF_TIFF_INC = '${BF_TIFF}/include'
+BF_TIFF_LIB = 'tiff'
+BF_TIFF_LIBPATH = '${BF_TIFF}/lib32'
 
 WITH_BF_ZLIB = 'true'
-BF_ZLIB = '/usr'
+BF_ZLIB = '/usr/local'
 BF_ZLIB_INC = '${BF_ZLIB}/include'
+BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib32'
 BF_ZLIB_LIB = 'z'
 
-WITH_BF_INTERNATIONAL = 'true'
+WITH_BF_INTERNATIONAL = 'false'
 
 BF_GETTEXT = '/usr'
 BF_GETTEXT_INC = '${BF_GETTEXT}/include'
@@ -53,7 +61,7 @@
 BF_FTGL_INC = '${BF_FTGL}/include'
 BF_FTGL_LIB = 'extern_ftgl'
 
-WITH_BF_GAMEENGINE='true'
+WITH_BF_GAMEENGINE='false'
 
 WITH_BF_ODE = 'false'
 BF_ODE = LCGDIR + '/ode'
@@ -87,9 +95,10 @@
 #BF_PARANOID = 'true'
 
 # enable freetype2 support for text objects
-BF_FREETYPE = '/usr'
+BF_FREETYPE = '/usr/local'
 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
 BF_FREETYPE_LIB = 'freetype'
+BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib32'
 
 WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
 BF_QUICKTIME = '/usr/local'
@@ -97,22 +106,27 @@
 
 # Mesa Libs should go here if your using them as well....
 WITH_BF_STATICOPENGL = 'false'
-BF_OPENGL = '/usr/lib'
+BF_OPENGL = '/usr/local'
 BF_OPENGL_INC = '${BF_OPENGL}/include'
-BF_OPENGL_LIB = 'GL GLU X11 Xi'
-BF_OPENGL_LIBPATH = '/usr/X11R6/lib'
-BF_OPENGL_LIB_STATIC = '${BF_OPENGL}/libGL.a ${BF_OPENGL}/libGLU.a ${BF_OPENGL}/libXxf86vm.a ${BF_OPENGL}/libX11.a ${BF_OPENGL}/libXi.a ${BF_OPENGL}/libXext.a ${BF_OPENGL}/libXxf86vm.a'
+BF_OPENGL_LIB = 'GL GLU X11 Xi Xext Xdmcp Xau' #+ ' Xxf86vm Xdamage Xfixes X11-xcb xcb-glx xcb drm Xau Xdmcp'
+BF_OPENGL_LIBPATH = '${BF_OPENGL}/lib32'
+BF_OPENGL_LIB_STATIC = '${BF_OPENGL_LIBPATH}/libGL.a ${BF_OPENGL_LIBPATH}/libGLU.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a ${BF_OPENGL_LIBPATH}/libX11.a ${BF_OPENGL_LIBPATH}/libXi.a ${BF_OPENGL_LIBPATH}/libXext.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a'
 
 ##
-CC = 'gcc'
-CXX = 'g++'
+CC = 'i686-pc-linux-gnu-gcc'
+CXX = 'i686-pc-linux-gnu-g++'
 ##ifeq ($CPU),alpha)
 ##   CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing -mieee
 
-CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
+CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-g3', '-mno-mmx', '-mno-sse', '-mno-sse2', '-mno-sse3', '-mno-sse4', '-mno-3dnow']
+# CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-g3']
+CXXFLAGS = CCFLAGS
+
+# CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing', '-march=core2', '-mmmx', '-msse', '-msse2']
+# CXXFLAGS = CCFLAGS # ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing', '-march=core2']
+
+CPPFLAGS = ['-DXP_UNIX', '-DSTEREO_RENDER_SHIFTINCONVERSION']
 
-CPPFLAGS = ['-DXP_UNIX']
-CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
 REL_CFLAGS = ['-O2']
 REL_CCFLAGS = ['-O2']
 ##BF_DEPEND = 'true'
@@ -121,9 +135,10 @@
 ##ARFLAGS = ruv
 ##ARFLAGSQUIET = ru
 ##
-C_WARN = '-Wall -Wno-char-subscripts'
+## C_WARN = '-Wall -Wno-char-subscripts -Werror=conversion -Werror=implicit -Werror=pointer-arith -Werror=type-limits'
+C_WARN = '-Wall -Wno-char-subscripts -Wno-deprecated -Wwrite-strings'
 
-CC_WARN = '-Wall'
+CC_WARN = '-Wall -Wno-deprecated -Wwrite-strings'
 
 ##FIX_STUBS_WARNINGS = -Wno-unused
 
@@ -134,7 +149,7 @@
 BF_PROFILE_FLAGS = ['-pg','-g']
 BF_PROFILE = 'false'
 
-BF_DEBUG = 'false'
+BF_DEBUG = 'true'
 BF_DEBUG_FLAGS = ''
 
 BF_BUILDDIR = '../build/linux2'
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/blenkernel/intern/ipo.c ./source/blender/blenkernel/intern/ipo.c
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/blenkernel/intern/ipo.c	2006-03-26 23:36:42.000000000 +0200
+++ ./source/blender/blenkernel/intern/ipo.c	2010-09-13 00:57:42.550443256 +0200
@@ -163,8 +163,9 @@
 };
 
 /* yafray: aperture & focal distance curves added */
+/* stereo mode: distance and base added */
 int cam_ar[CAM_TOTIPO]= {
-	CAM_LENS, CAM_STA, CAM_END, CAM_YF_APERT, CAM_YF_FDIST
+	CAM_LENS, CAM_STA, CAM_END, CAM_YF_APERT, CAM_YF_FDIST, CAM_STEREO_DIST, CAM_STEREO_BASE
 };
 
 int snd_ar[SND_TOTIPO]= {
@@ -1460,6 +1461,11 @@
 			poin= &(ca->YF_aperture); break;
 		case CAM_YF_FDIST:
 			poin= &(ca->YF_dofdist); break;
+		case CAM_STEREO_DIST:
+			poin= &(ca->stereo_conv_dist); break;
+		case CAM_STEREO_BASE:
+			poin= &(ca->stereo_base_width); break;
+			
 		}
 	}
 	else if(GS(id->name)==ID_SO) {
@@ -1741,6 +1747,15 @@
 		case CAM_YF_FDIST:
 			icu->ymin = 0.0;
 			icu->ymax = 5000.0;
+			break;
+		case CAM_STEREO_DIST:
+			icu->ymin = 0.0;
+			icu->ymax = 5000.0;
+			break;
+		case CAM_STEREO_BASE:
+			icu->ymin = 0.0;
+			icu->ymax = 1000.0;
+			break;
 		}
 	}
 	else if(icu->blocktype==ID_SO) {
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/makesdna/DNA_camera_types.h ./source/blender/makesdna/DNA_camera_types.h
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/makesdna/DNA_camera_types.h	2005-11-16 17:03:00.000000000 +0100
+++ ./source/blender/makesdna/DNA_camera_types.h	2010-09-13 23:00:07.996524440 +0200
@@ -27,7 +27,10 @@
  *
  * The Original Code is: all of this file.
  *
- * Contributor(s): none yet.
+ * Contributor(s):
+ * -- Wolfgang Draxinger 
+ *    blenderdev@wolfgang-draxinger.net
+ *    - 2010: Stereo Rendering
  *
  * ***** END GPL/BL DUAL LICENSE BLOCK *****
  */
@@ -47,6 +50,7 @@
 	ID id;
 	
 	short type, flag;
+
 	float passepartalpha, pad1;
 	float clipsta, clipend;
 	float lens, ortho_scale, drawsize;
@@ -59,6 +63,10 @@
 	struct Ipo *ipo;
 	
 	ScriptLink scriptlink;
+	
+	short stereo_flags;
+	char pad[6];
+	float stereo_conv_dist, stereo_base_width;
 } Camera;
 
 /* **************** CAMERA ********************* */
@@ -74,6 +82,11 @@
 #define CAM_SHOWTITLESAFE	8
 #define CAM_SHOWNAME		16
 
+/*stereo flags*/
+#define CAM_STEREO			1
+#define CAM_STEREO_DRAWCONVERGENCE	2
+#define CAM_STEREO_ABSOLUTEBASE		128
+
 /* yafray: dof sampling switch */
 #define CAM_YF_NO_QMC	512
 
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/makesdna/DNA_ipo_types.h ./source/blender/makesdna/DNA_ipo_types.h
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/makesdna/DNA_ipo_types.h	2006-02-27 12:45:42.000000000 +0100
+++ ./source/blender/makesdna/DNA_ipo_types.h	2010-09-13 00:57:43.522443256 +0200
@@ -272,8 +272,8 @@
 /* ******************** */
 
 /* yafray: totipo & totnam +2 because of added curves */
-#define CAM_TOTIPO	5
-#define CAM_TOTNAM	5
+#define CAM_TOTIPO	7
+#define CAM_TOTNAM	7
 
 #define CAM_LENS	1
 #define CAM_STA		2
@@ -281,6 +281,9 @@
 /* yafray aperture & focal distance curves */
 #define CAM_YF_APERT	4
 #define CAM_YF_FDIST	5
+/* stereo mode settings */
+#define CAM_STEREO_DIST 6
+#define CAM_STEREO_BASE 7
 
 /* ******************** */
 
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/makesdna/DNA_scene_types.h ./source/blender/makesdna/DNA_scene_types.h
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/makesdna/DNA_scene_types.h	2006-03-14 22:29:42.000000000 +0100
+++ ./source/blender/makesdna/DNA_scene_types.h	2010-09-13 00:57:43.530443256 +0200
@@ -160,6 +160,16 @@
 
 	short stereomode;	/* standalone player stereo settings */
 	
+	/**
+	 * Flags for stereo settings. Use bit-masking to access the settings.
+	 * The bits have these meanings:
+	 * no bits set: no stereo
+	 * 1: render left eye
+	 * 2: render right eye
+	 */
+	short renderstereo;
+	char ___pad2[2];
+	
 	short dimensionspreset;		/* for the dimensions presets menu */
  	
  	short filtertype;	/* filter is box, tent, gauss, mitch, etc */
@@ -287,6 +297,7 @@
 	float YF_gamma, YF_exposure, YF_raybias, YF_AApixelsize, YF_AAthreshold;
 
 	char backbuf[160], pic[160], ftype[160];
+	char ___pad4[4];
 
 } RenderData;
 
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/python/api2_2x/Camera.c ./source/blender/python/api2_2x/Camera.c
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/python/api2_2x/Camera.c	2005-10-10 20:05:29.000000000 +0200
+++ ./source/blender/python/api2_2x/Camera.c	2010-09-13 00:57:43.758443256 +0200
@@ -105,6 +105,8 @@
 static PyObject *Camera_getClipStart( BPy_Camera * self );
 static PyObject *Camera_getClipEnd( BPy_Camera * self );
 static PyObject *Camera_getDrawSize( BPy_Camera * self );
+static PyObject *Camera_getStereoDist( BPy_Camera * self );
+static PyObject *Camera_getStereoBase( BPy_Camera * self );
 static PyObject *Camera_getScale( BPy_Camera * self );
 static PyObject *Camera_setIpo( BPy_Camera * self, PyObject * args );
 static PyObject *Camera_clearIpo( BPy_Camera * self );
@@ -117,6 +119,8 @@
 static PyObject *Camera_setClipStart( BPy_Camera * self, PyObject * args );
 static PyObject *Camera_setClipEnd( BPy_Camera * self, PyObject * args );
 static PyObject *Camera_setDrawSize( BPy_Camera * self, PyObject * args );
+static PyObject *Camera_setStereoDist( BPy_Camera * self, PyObject * args );
+static PyObject *Camera_setStereoBase( BPy_Camera * self, PyObject * args );
 static PyObject *Camera_setScale( BPy_Camera * self, PyObject * args );
 static PyObject *Camera_getScriptLinks( BPy_Camera * self, PyObject * args );
 static PyObject *Camera_addScriptLink( BPy_Camera * self, PyObject * args );
@@ -150,6 +154,10 @@
 	 "() - Return Camera clip end value"},
 	{"getDrawSize", ( PyCFunction ) Camera_getDrawSize, METH_NOARGS,
 	 "() - Return Camera draw size value"},
+	{"getStereoDist", ( PyCFunction ) Camera_getStereoDist, METH_NOARGS,
+	 "() - Return Camera stereo convergence distance value"},
+	{"getStereoBase", ( PyCFunction ) Camera_getStereoBase, METH_NOARGS,
+	 "() - Return Camera stereo base value"},
 	{"setIpo", ( PyCFunction ) Camera_setIpo, METH_VARARGS,
 	 "(Blender Ipo) - Set Camera Ipo"},
 	{"clearIpo", ( PyCFunction ) Camera_clearIpo, METH_NOARGS,
@@ -172,6 +180,10 @@
 	 "(f) - Set Camera clip end value"},
 	{"setDrawSize", ( PyCFunction ) Camera_setDrawSize, METH_VARARGS,
 	 "(f) - Set Camera draw size value"},
+	{"setStereoDist", ( PyCFunction ) Camera_setStereoDist, METH_VARARGS,
+	 "(f) - Set Camera stereo convergence distance value"},
+	{"setStereoBase", ( PyCFunction ) Camera_setStereoBase, METH_VARARGS,
+	 "(f) - Set Camera stereo base value"},
 	{"getScriptLinks", ( PyCFunction ) Camera_getScriptLinks, METH_VARARGS,
 	 "(eventname) - Get a list of this camera's scriptlinks (Text names) "
 	 "of the given type\n"
@@ -520,7 +532,27 @@
 				      "couldn't get Camera.drawSize attribute" );
 }
 
+static PyObject *Camera_getStereoDist( BPy_Camera * self )
+{
+	PyObject *attr = PyFloat_FromDouble( self->camera->stereo_conv_dist );
+
+	if( attr )
+		return attr;
+
+	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+				      "couldn't get Camera.stereoDist attribute" );
+}
+
+static PyObject *Camera_getStereoBase( BPy_Camera * self )
+{
+	PyObject *attr = PyFloat_FromDouble( self->camera->stereo_base_width );
 
+	if( attr )
+		return attr;
+
+	return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+				      "couldn't get Camera.stereoBase attribute" );
+}
 
 static PyObject *Camera_setIpo( BPy_Camera * self, PyObject * args )
 {
@@ -772,6 +804,38 @@
 	return Py_None;
 }
 
+static PyObject *Camera_setStereoDist( BPy_Camera * self, PyObject * args )
+{
+	float value;
+
+	if( !PyArg_ParseTuple( args, "f", &value ) )
+		return EXPP_ReturnPyObjError( PyExc_TypeError,
+					      "expected a float number as argument" );
+
+	self->camera->stereo_conv_dist = EXPP_ClampFloat( value,
+						  EXPP_CAM_STEREODIST_MIN,
+						  EXPP_CAM_STEREODIST_MAX );
+
+	Py_INCREF( Py_None );
+	return Py_None;
+}
+
+static PyObject *Camera_setStereoBase( BPy_Camera * self, PyObject * args )
+{
+	float value;
+
+	if( !PyArg_ParseTuple( args, "f", &value ) )
+		return EXPP_ReturnPyObjError( PyExc_TypeError,
+					      "expected a float number as argument" );
+
+	self->camera->stereo_base_width = EXPP_ClampFloat( value,
+						  EXPP_CAM_STEREOBASE_MIN,
+						  EXPP_CAM_STEREOBASE_MAX );
+
+	Py_INCREF( Py_None );
+	return Py_None;
+}
+
 /* cam.addScriptLink */
 static PyObject *Camera_addScriptLink( BPy_Camera * self, PyObject * args )
 {
@@ -836,6 +900,10 @@
 		attr = PyFloat_FromDouble( self->camera->clipend );
 	else if( strcmp( name, "drawSize" ) == 0 )
 		attr = PyFloat_FromDouble( self->camera->drawsize );
+	else if( strcmp( name, "stereoDist" ) == 0 )
+		attr = PyFloat_FromDouble( self->camera->stereo_conv_dist );
+	else if( strcmp( name, "stereoBase" ) == 0 )
+		attr = PyFloat_FromDouble( self->camera->stereo_base_width );
 	else if( strcmp( name, "users" ) == 0 )
 		attr = PyInt_FromLong( self->camera->id.us );
 	else if( strcmp( name, "ipo" ) == 0 )
@@ -857,7 +925,8 @@
 		attr = Py_BuildValue( "[s,s,s,s,s,s,s,s,s,s,s,s]",
 				      "name", "type", "mode", "lens", "scale",
 				      "clipStart", "ipo", "clipEnd",
-				      "drawSize", "Types", "Modes", "users" );
+				      "drawSize", "stereoDist", "stereoBase",
+				      "Types", "Modes", "users" );
 	}
 
 	if( !attr )
@@ -906,6 +975,10 @@
 		error = Camera_setClipEnd( self, valtuple );
 	else if( strcmp( name, "drawSize" ) == 0 )
 		error = Camera_setDrawSize( self, valtuple );
+	else if( strcmp( name, "stereoDist" ) == 0 )
+		error = Camera_setStereoDist( self, valtuple );
+	else if( strcmp( name, "stereoBase" ) == 0 )
+		error = Camera_setStereoBase( self, valtuple );
 
 	else {			/* Error */
 		Py_DECREF( valtuple );
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/python/api2_2x/Camera.h ./source/blender/python/api2_2x/Camera.h
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/python/api2_2x/Camera.h	2005-07-18 05:50:36.000000000 +0200
+++ ./source/blender/python/api2_2x/Camera.h	2010-09-13 00:57:43.758443256 +0200
@@ -64,16 +64,20 @@
 
 /* Camera MIN, MAX values */
 
-#define EXPP_CAM_LENS_MIN         1.0
-#define EXPP_CAM_LENS_MAX       250.0
-#define EXPP_CAM_SCALE_MIN        0.01f
-#define EXPP_CAM_SCALE_MAX     1000.0
-#define EXPP_CAM_CLIPSTART_MIN    0.0
-#define EXPP_CAM_CLIPSTART_MAX  100.0
-#define EXPP_CAM_CLIPEND_MIN      1.0
-#define EXPP_CAM_CLIPEND_MAX   5000.0
-#define EXPP_CAM_DRAWSIZE_MIN     0.1f
-#define EXPP_CAM_DRAWSIZE_MAX    10.0
+#define EXPP_CAM_LENS_MIN          1.0
+#define EXPP_CAM_LENS_MAX        250.0
+#define EXPP_CAM_SCALE_MIN         0.01
+#define EXPP_CAM_SCALE_MAX      1000.0
+#define EXPP_CAM_CLIPSTART_MIN     0.0
+#define EXPP_CAM_CLIPSTART_MAX   100.0
+#define EXPP_CAM_CLIPEND_MIN       1.0
+#define EXPP_CAM_CLIPEND_MAX    5000.0
+#define EXPP_CAM_DRAWSIZE_MIN      0.1
+#define EXPP_CAM_DRAWSIZE_MAX     10.0
+#define EXPP_CAM_STEREODIST_MIN    0.0
+#define EXPP_CAM_STEREODIST_MAX 5000.0
+#define EXPP_CAM_STEREOBASE_MIN    0.0
+#define EXPP_CAM_STEREOBASE_MAX 1000.0
 
 PyObject *Camera_Init( void );
 PyObject *Camera_CreatePyObject( Camera * cam );
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/render/intern/include/renderdatabase.h ./source/blender/render/intern/include/renderdatabase.h
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/render/intern/include/renderdatabase.h	2006-02-27 13:39:35.000000000 +0100
+++ ./source/blender/render/intern/include/renderdatabase.h	2010-09-14 18:04:04.177823389 +0200
@@ -56,7 +56,7 @@
 void free_renderdata_vertnodes(struct VertTableNode *vertnodes);
 
 void set_normalflags(Render *re);
-void project_renderdata(struct Render *re, void (*projectfunc)(float *, float mat[][4], float *),  int do_pano, float xoffs);
+void project_renderdata(struct Render *re, void (*projectfunc)(float *, float mat[][4], float *),  int do_pano, float xoffs, int disable_stereo);
 
 /* functions are not exported... so wrong names */
 
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/render/intern/source/convertblender.c ./source/blender/render/intern/source/convertblender.c
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/render/intern/source/convertblender.c	2006-04-10 20:27:51.000000000 +0200
+++ ./source/blender/render/intern/source/convertblender.c	2010-09-16 12:48:37.033065002 +0200
@@ -2978,8 +2978,43 @@
 	float mat[4][4];
 	unsigned int lay;
 
+	float stereo_base_width = 0.;
+
 	re->scene= scene;
 	
+#ifdef STEREO_RENDER_SHIFTINCONVERSION
+	if(re->scene->camera->type==OB_CAMERA) {
+		Camera *cam = re->scene->camera->data;		
+		int stereo_flags = cam->stereo_flags;
+
+		if(stereo_flags & CAM_STEREO) {
+			if(stereo_flags & CAM_STEREO_ABSOLUTEBASE) {
+				/* In absolute base width mode the stereo width is just that */
+				stereo_base_width = cam->stereo_base_width;
+			} else {
+				/* In relative base width mode, the stereo base is 1/10 the half width
+				 * of the convergence frame multiplied by the set base width factor.
+				 * Those values are empiric and give good results. If you need larger
+				 * relative stereo width, change limits in editbuttons.
+				 *
+				 * 32 is a magic factor, don't ask me why and where it comes from
+				 * it's just something from the bowels of the renderer.
+				 *
+				 * ANY CHANGE MADE HERE MUST ALSO BE REFLECTED IN
+				 * initrender.c
+				 *
+				 * ***This really should be done in a central function***
+				 **/
+				float const conv_frame_width = cam->stereo_conv_dist * 32./cam->lens;
+				stereo_base_width = cam->stereo_base_width * 0.05 * conv_frame_width;
+			}
+		}
+		
+		if(re->scene->r.renderstereo & 1) {
+			stereo_base_width = -stereo_base_width;
+		}
+	}
+#endif
 	/* per second, per object, stats print this */
 	re->i.infostr= "Preparing Scene data";
 
@@ -3000,12 +3035,21 @@
 		scene_update_for_newframe(re->scene, lay);
 	
 	/* if no camera, viewmat should have been set! */
+	/* Camera position is applied to modelviewworld matrix here !!! */
 	if(use_camera_view && re->scene->camera) {
+		float mat_inv_cam[4][4];
+		float mat_shift[4][4];
 		Mat4Ortho(re->scene->camera->obmat);
-		Mat4Invert(mat, re->scene->camera->obmat);
+		Mat4Invert(mat_inv_cam, re->scene->camera->obmat);
+
+		ident_m4(mat_shift);
+		i_translate(-stereo_base_width, 0, 0, mat_shift);
+	
+		Mat4MulMat4(mat, mat_inv_cam, mat_shift);
+
 		RE_SetView(re, mat);
 	}
-	
+
 	init_render_world(re);	/* do first, because of ambient. also requires re->osa set correct */
 	if( (re->wrld.mode & WO_AMB_OCC) && (re->r.mode & R_RAYTRACE) ) {
 		re->wrld.aosphere= MEM_mallocN(2*3*re->wrld.aosamp*re->wrld.aosamp*sizeof(float), "AO sphere");
@@ -3164,8 +3208,9 @@
 				make_envmaps(re);
 		}
 		
-		if(!re->test_break())
-			project_renderdata(re, projectverto, re->r.mode & R_PANORAMA, 0);
+		if(!re->test_break()) {
+			project_renderdata(re, projectverto, re->r.mode & R_PANORAMA, 0, 0);
+		}
 	}
 	
 	if(re->test_break())
@@ -3185,7 +3230,42 @@
 	Scene *sce;
 	float mat[4][4];
 	unsigned int lay;
-	
+
+	float stereo_base_width = 0. ;
+
+#ifdef STEREO_RENDER_SHIFTINCONVERSION
+	if(re->scene->camera->type==OB_CAMERA) {
+		Camera *cam = re->scene->camera->data;		
+		int stereo_flags = cam->stereo_flags;
+
+		if(stereo_flags & CAM_STEREO ) {
+			if(stereo_flags & CAM_STEREO_ABSOLUTEBASE) {
+				/* In absolute base width mode the stereo width is just that */
+				stereo_base_width = cam->stereo_base_width;
+			} else {
+				/* In relative base width mode, the stereo base is 1/10 the half width
+				 * of the convergence frame multiplied by the set base width factor.
+				 * Those values are empiric and give good results. If you need larger
+				 * relative stereo width, change limits in editbuttons.
+				 *
+				 * 32 is a magic factor, don't ask me why and where it comes from
+				 * it's just something from the bowels of the renderer.
+				 *
+				 * ANY CHANGE MADE HERE MUST ALSO BE REFLECTED IN
+				 * initrender.c
+				 *
+				 * ***This really should be done in a central function***
+				 **/
+				float const conv_frame_width = cam->stereo_conv_dist * 32./cam->lens;
+				stereo_base_width = cam->stereo_base_width * 0.05 * conv_frame_width;
+			}
+		}
+		
+		if(re->scene->r.renderstereo & 1) {
+			stereo_base_width = -stereo_base_width;
+		}
+	}
+#endif
 	re->scene= scene;
 	
 	/* XXX add test if dbase was filled already? */
@@ -3207,11 +3287,19 @@
 	
 	/* if no camera, viewmat should have been set! */
 	if(re->scene->camera) {
+		float mat_inv_cam[4][4];
+		float mat_shift[4][4];
 		Mat4Ortho(re->scene->camera->obmat);
-		Mat4Invert(mat, re->scene->camera->obmat);
+		Mat4Invert(mat_inv_cam, re->scene->camera->obmat);
+
+		ident_m4(mat_shift);
+		i_translate(-stereo_base_width, 0, 0, mat_shift);
+	
+		Mat4MulMat4(mat, mat_inv_cam, mat_shift);
+
 		RE_SetView(re, mat);
 	}
-	
+
 	for(SETLOOPER(re->scene, base)) {
 		ob= base->object;
 		/* imat objects has to be done here, since displace can have texture using Object map-input */
@@ -3266,8 +3354,9 @@
 		if(re->test_break()) break;
 	}
 	
-	if(!re->test_break())
-		project_renderdata(re, projectverto, re->r.mode & R_PANORAMA, 0);
+	if(!re->test_break()) {
+		project_renderdata(re, projectverto, re->r.mode & R_PANORAMA, 0, 0);
+	}
 
 	/* do this in end, particles for example need cfra */
 	G.scene->r.cfra-=timeoffset;
@@ -3583,7 +3672,7 @@
 /* exported call to recalculate hoco for vertices, when winmat changed */
 void RE_DataBase_ApplyWindow(Render *re)
 {
-	project_renderdata(re, projectverto, 0, 0);
+	project_renderdata(re, projectverto, 0, 0, 0);
 }
 
 /* **************************************************************** */
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/render/intern/source/envmap.c ./source/blender/render/intern/source/envmap.c
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/render/intern/source/envmap.c	2006-03-19 18:50:52.000000000 +0100
+++ ./source/blender/render/intern/source/envmap.c	2010-09-14 18:03:47.129823388 +0200
@@ -397,7 +397,7 @@
 		
 		env_rotate_scene(envre, tmat, 1);
 		init_render_world(envre);
-		project_renderdata(envre, projectverto, 0, 0);
+		project_renderdata(envre, projectverto, 0, 0, 1);
 		env_layerflags(envre, env->notlay);
 		env_hideobject(envre, env->object);
 		env_set_imats(envre);
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/render/intern/source/initrender.c ./source/blender/render/intern/source/initrender.c
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/render/intern/source/initrender.c	2006-03-19 18:50:52.000000000 +0100
+++ ./source/blender/render/intern/source/initrender.c	2010-09-15 02:37:11.329484629 +0200
@@ -461,11 +461,13 @@
 	float lens;
 	float xd, yd;
 	int blursample= 0;	/* make new call for that */
+	float stereo_shift = 0.;
 	
 	/* question mark */
 	re->ycor= ( (float)re->r.yasp)/( (float)re->r.xasp);
 	
 	if(camera->type==OB_CAMERA) {
+		float stereo_base_width = 0.;
 		cam= camera->data;
 		
 		if(cam->type==CAM_ORTHO) re->r.mode |= R_ORTHO;
@@ -479,8 +481,40 @@
 
 		clipsta= cam->clipsta;
 		clipend= cam->clipend;
-	}
-	else if(camera->type==OB_LAMP) {
+	
+		if(cam->stereo_flags & CAM_STEREO_ABSOLUTEBASE) {
+			/* In absolute base width mode the stereo width is just that */
+			stereo_base_width = cam->stereo_base_width;
+		} else {
+			/* In relative base width mode, the stereo base is 1/10 the half width
+			 * of the convergence frame multiplied by the set base width factor.
+			 * Those values are empiric and give good results. If you need larger
+			 * relative stereo width, change limits in editbuttons.
+			 *
+			 * 32 is a magic factor, don't ask me why and where it comes from
+			 * it's just something from the bowels of the renderer.
+			 *
+			 * ANY CHANGE MADE HERE MUST ALSO BE REFLECTED IN
+			 * renderdatabase.c
+			 *
+			 * ***This really should be done in a central function***
+			 **/
+			float const conv_frame_width = cam->stereo_conv_dist * 32./cam->lens;
+			stereo_base_width = cam->stereo_base_width * 0.05 * conv_frame_width;
+		}
+
+
+		if( cam->stereo_flags & CAM_STEREO && 
+		    re->scene && 
+		    re->scene->r.renderstereo ) {
+			stereo_shift = stereo_base_width * (clipsta / cam->stereo_conv_dist) ; // * (lens/32.);
+			if(re->scene->r.renderstereo & 1) {
+				stereo_shift = -stereo_shift;
+			}
+		} else {
+			stereo_shift = 0.0;
+		}
+	} else if(camera->type==OB_LAMP) {
 		/* fac= cos( PI*((float)(256- la->spsi))/512.0 ); */
 
 		/* phi= acos(fac); */
@@ -490,8 +524,7 @@
 			lens= 35.0;
 		clipsta= 0.1;
 		clipend= 1000.0;
-	}
-	else {	/* envmap exception... */
+	} else {	/* envmap exception... */
 		lens= re->lens;
 		if(lens==0.0f)
 			lens= 16.0;
@@ -527,9 +560,9 @@
 	}
 	
 	/* viewplane fully centered, zbuffer fills in jittered between -.5 and +.5 */
-	viewplane.xmin= -0.5f*(float)re->winx; 
+	viewplane.xmin= -0.5*(float)re->winx; 
 	viewplane.ymin= -0.5f*re->ycor*(float)re->winy; 
-	viewplane.xmax=  0.5f*(float)re->winx; 
+	viewplane.xmax=  0.5*(float)re->winx; 
 	viewplane.ymax=  0.5f*re->ycor*(float)re->winy; 
 
 	if(re->flag & R_SEC_FIELD) {
@@ -550,8 +583,15 @@
 	}
 	else re->bluroffsx=re->bluroffsy= 0.0f;
 
-	viewplane.xmin= pixsize*(viewplane.xmin+xd);
-	viewplane.xmax= pixsize*(viewplane.xmax+xd);
+/*
+ * viewplane defines the extents of the near clip in eye coordinates
+ * shifting for stereo:
+ *   1) Offset the camera based on lens length and stereo intensity
+ *   2) Add shift to near plane so that interception at convergence depth matches
+ */
+
+	viewplane.xmin= pixsize*(viewplane.xmin+xd) - stereo_shift;
+	viewplane.xmax= pixsize*(viewplane.xmax+xd) - stereo_shift;
 	viewplane.ymin= pixsize*(viewplane.ymin+yd);
 	viewplane.ymax= pixsize*(viewplane.ymax+yd);
 	
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/render/intern/source/pipeline.c ./source/blender/render/intern/source/pipeline.c
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/render/intern/source/pipeline.c	2006-04-01 11:36:18.000000000 +0200
+++ ./source/blender/render/intern/source/pipeline.c	2010-09-14 20:01:42.710391788 +0200
@@ -35,6 +35,7 @@
 #include "DNA_node_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
+#include "DNA_camera_types.h"
 #include "DNA_userdef_types.h"
 
 #include "BKE_global.h"
@@ -1004,9 +1005,9 @@
 		R.viewplane.xmax = viewplane->xmax + R.panodxv;
 		RE_SetWindow(re, &R.viewplane, R.clipsta, R.clipend);
 		Mat4CpyMat4(R.winmat, re->winmat);
-		
+
 		/* rotate database according to part coordinates */
-		project_renderdata(re, projectverto, 1, -R.panodxp*phi);
+		project_renderdata(re, projectverto, 1, -R.panodxp*phi, 0);
 		R.panosi= sin(R.panodxp*phi);
 		R.panoco= cos(R.panodxp*phi);
 	}
@@ -1051,6 +1052,7 @@
 			}
 		}
 	}
+
 	return best;
 }
 
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/render/intern/source/rendercore.c ./source/blender/render/intern/source/rendercore.c
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/render/intern/source/rendercore.c	2006-04-08 19:36:27.000000000 +0200
+++ ./source/blender/render/intern/source/rendercore.c	2010-09-14 19:59:32.471543790 +0200
@@ -3458,7 +3458,7 @@
 //	R.yend= R.ystart+R.recty-1;
 
 //	RE_setwindowclip(1,-1); /*  no jit:(-1) */
-	project_renderdata(&R, projectverto, 0, 0);
+	project_renderdata(&R, projectverto, 0, 0, 1);
 	
 	for(a=0; a<R.tothalo; a++) {
 		if((a & 255)==0) har= R.bloha[a>>8];
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/render/intern/source/renderdatabase.c ./source/blender/render/intern/source/renderdatabase.c
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/render/intern/source/renderdatabase.c	2006-03-02 17:09:30.000000000 +0100
+++ ./source/blender/render/intern/source/renderdatabase.c	2010-09-14 23:40:48.172785220 +0200
@@ -67,6 +67,7 @@
 #include "DNA_mesh_types.h" 
 #include "DNA_meshdata_types.h" 
 #include "DNA_texture_types.h" 
+#include "DNA_camera_types.h"
 
 #include "BKE_texture.h" 
 
@@ -207,7 +208,7 @@
 		if(temp) memcpy(re->vertnodes, temp, re->vertnodeslen*sizeof(VertTableNode));
 		memset(re->vertnodes+re->vertnodeslen, 0, TABLEINITSIZE*sizeof(VertTableNode));
 		
-		re->vertnodeslen+=TABLEINITSIZE; 
+re->vertnodeslen+=TABLEINITSIZE; 
 		if(temp) MEM_freeN(temp);	
 	}
 	
@@ -516,13 +517,17 @@
   - shadow buffering (shadbuf.c)
 */
 
-void project_renderdata(Render *re, void (*projectfunc)(float *, float mat[][4], float *),  int do_pano, float xoffs)
+void project_renderdata(Render *re, void (*projectfunc)(float *, float mat[][4], float *),  int do_pano, float xoffs, int disable_stereo)
 {
 	VlakRen *vlr = NULL;
 	VertRen *ver = NULL;
 	HaloRen *har = NULL;
 	float zn, vec[3], hoco[4];
 	int a;
+
+#ifdef STEREO_RENDER_SHIFTINPROJECTION
+	float stereo_base_width = 0.;
+#endif
 	
 	if(do_pano) {
 		float panophi= xoffs;
@@ -530,7 +535,40 @@
 		re->panosi= sin(panophi);
 		re->panoco= cos(panophi);
 	}
+
+#ifdef STEREO_RENDER_SHIFTINPROJECTION
+	if(!disable_stereo && re->scene->camera->type==OB_CAMERA) {
+		Camera *cam = re->scene->camera->data;		
+		int stereo_flags = cam->stereo_flags;
+
+		if(stereo_flags & CAM_STEREO_ABSOLUTEBASE) {
+			/* In absolute base width mode the stereo width is just that */
+			stereo_base_width = cam->stereo_base_width;
+		} else {
+			/* In relative base width mode, the stereo base is 1/10 the half width
+			 * of the convergence frame multiplied by the set base width factor.
+			 * Those values are empiric and give good results. If you need larger
+			 * relative stereo width, change limits in editbuttons.
+			 *
+			 * 32 is a magic factor, don't ask me why and where it comes from
+			 * it's just something from the bowels of the renderer.
+			 *
+			 * ANY CHANGE MADE HERE MUST ALSO BE REFLECTED IN
+			 * initrender.c
+			 *
+			 * ***This really should be done in a central function***
+			 **/
+			float const conv_frame_width = cam->stereo_conv_dist * 32./cam->lens;
+			stereo_base_width = cam->stereo_base_width * 0.05 * conv_frame_width;
+		}
+		
+		if(re->scene->r.renderstereo & 1) {
+			stereo_base_width *= -1;
+		}
+	}
+#endif
 	
+
    /* calculate view coordinates (and zbuffer value) */
 	for(a=0; a< re->totvert;a++) {
 		if((a & 255)==0) ver= RE_findOrAddVert(re, a);
@@ -544,6 +582,10 @@
 		else {
 			VECCOPY(vec, ver->co);
 		}
+
+#ifdef STEREO_RENDER_SHIFTINPROJECTION
+		vec[0] -= stereo_base_width;
+#endif
 		/* Go from wcs to hcs ... */
 		projectfunc(vec, re->winmat, ver->ho);
 		/* ... and clip in that system. */
@@ -568,6 +610,10 @@
 			VECCOPY(vec, har->co);
 		}
 
+#ifdef STEREO_RENDER_SHIFTINPROJECTION
+		vec[0] -= stereo_base_width;
+#endif
+
 		projectfunc(vec, re->winmat, hoco);
 		
 		/* we clip halos less critical, but not for the Z */
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/render/intern/source/shadbuf.c ./source/blender/render/intern/source/shadbuf.c
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/render/intern/source/shadbuf.c	2006-02-16 18:51:39.000000000 +0100
+++ ./source/blender/render/intern/source/shadbuf.c	2010-09-14 18:03:33.957823389 +0200
@@ -292,7 +292,7 @@
 	/* zbuffering */
  	rectz= MEM_mapallocN(sizeof(int)*shb->size*shb->size, "makeshadbuf");
 
-	project_renderdata(re, projectvert, 0, 0);
+	project_renderdata(re, projectvert, 0, 0, 1);
 	
 	for(samples=0; samples<shb->totbuf; samples++) {
 		zbuffer_shadow(re, lar, rectz, shb->size, jitbuf[2*samples], jitbuf[2*samples+1]);
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/src/buttons_editing.c ./source/blender/src/buttons_editing.c
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/src/buttons_editing.c	2006-04-05 02:53:07.000000000 +0200
+++ ./source/blender/src/buttons_editing.c	2010-09-13 22:19:49.002806435 +0200
@@ -2425,7 +2425,7 @@
 	block= uiNewBlock(&curarea->uiblocks, "editing_panel_camera_type", UI_EMBOSS, UI_HELV, curarea->win);
 	if(uiNewPanel(curarea, block, "Camera", "Editing", 320, 0, 318, 204)==0) return;
 
-if(cam->type==CAM_ORTHO) {
+	if(cam->type==CAM_ORTHO) {
 		uiDefButF(block, NUM,REDRAWVIEW3D, "Scale:",
 				  0, 145, 150, 20, &cam->ortho_scale, 0.01, 1000.0, 50, 0, "Specify the ortho scaling of the used camera");
 	} else {
@@ -2471,7 +2471,24 @@
 			160, 25, 150, 20, &cam->passepartalpha, 0.0, 1.0, 0, 0, "The opacity (darkness) of the passepartout");
 	uiBlockEndAlign(block);
 
+	uiDefButS(block, TOG|BIT|0, REDRAWVIEW3D, "Stereo",
+		0, 0, 150, 20,
+		&cam->stereo_flags, 0.0, 0.0, 0, 0, "Enable Stereoscopy");
+	if(cam->stereo_flags & 1) {
+		uiDefButS(block, TOG|BIT|7, REDRAWVIEW3D, "Abs Base",
+			160, 0, 150, 20,
+			&cam->stereo_flags, 0.0, 0.0, 0, 0, "Define stereo base in absolute units");
+		uiDefButF(block, NUM, REDRAWVIEW3D, "Conv:",
+			0, -20, 150, 20,
+			&cam->stereo_conv_dist, cam->clipsta, cam->clipend*10, 10, 0,
+			"The distance of the stereo convergence plane");
+		uiDefButF(block, NUMSLI, REDRAWVIEW3D, "Base:",
+			160, -20, 150, 20,
+			&cam->stereo_base_width, 0.0, (cam->stereo_flags & 128) ? 10.0*cam->drawsize : 2.0, 1, 0,
+			"The stereo base width (eye distance)");
+	}
 
+	
 }
 
 /* yafray: extra camera panel to set Depth-of-Field parameters */
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/src/buttons_scene.c ./source/blender/src/buttons_scene.c
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/src/buttons_scene.c	2006-03-14 22:29:42.000000000 +0100
+++ ./source/blender/src/buttons_scene.c	2010-09-13 00:57:45.778443255 +0200
@@ -1368,6 +1368,24 @@
 	uiBlockEndAlign(block);
 }
 
+static void render_panel_stereo(void)
+{
+	uiBlock *block;
+	short xco, yco;
+
+
+	block= uiNewBlock(&curarea->uiblocks, "render_panel_stereo", UI_EMBOSS, UI_HELV, curarea->win);
+	if(uiNewPanel(curarea, block, "Stereo", "Format", 640, 0, 318, 204)==0) return;
+
+	uiBlockBeginAlign(block);
+	uiDefButS(block, ROW, 0, "No Stereo", xco=10, yco=100, 88, 19, &(G.scene->r.renderstereo), 9464.0, 0.0, 0, 0, "Disables stereo");
+	uiDefButS(block, ROW, 0, "Left Eye", xco+=90, yco, 88, 19, &(G.scene->r.renderstereo), 9464.0, 1.0, 0, 0, "Render Left Eye");
+	uiDefButS(block, ROW, 0, "Right Eye", xco+=90, yco, 88, 19, &(G.scene->r.renderstereo), 9464.0, 2.0, 0, 0, "Render Right Eye");
+	uiBlockEndAlign(block);
+
+	uiBlockSetDirection(block, UI_TOP);
+}
+
 #ifdef WITH_FFMPEG
 static void render_panel_ffmpeg_video(void)
 {
@@ -1539,10 +1557,10 @@
 						   "Display game framing settings"); */
 
 	uiBlockBeginAlign(block);
-	uiDefButS(block, NUM,REDRAWVIEWCAM,"SizeX:",	892 ,136,112,27, &G.scene->r.xsch, 4.0, 10000.0, 0, 0, "The image width in pixels");
-	uiDefButS(block, NUM,REDRAWVIEWCAM,"SizeY:",	1007,136,112,27, &G.scene->r.ysch, 4.0,10000.0, 0, 0, "The image height in scanlines");
-	uiDefButS(block, NUM,REDRAWVIEWCAM,"AspX:",	892 ,114,112,20, &G.scene->r.xasp, 1.0,200.0, 0, 0, "The horizontal aspect ratio");
-	uiDefButS(block, NUM,REDRAWVIEWCAM,"AspY:",	1007,114,112,20, &G.scene->r.yasp, 1.0,200.0, 0, 0, "The vertical aspect ratio");
+	uiDefButS(block, NUM,REDRAWVIEWCAM | REDRAWVIEW3D ,"SizeX:",	892 ,136,112,27, &G.scene->r.xsch, 4.0, 10000.0, 0, 0, "The image width in pixels");
+	uiDefButS(block, NUM,REDRAWVIEWCAM | REDRAWVIEW3D ,"SizeY:",	1007,136,112,27, &G.scene->r.ysch, 4.0,10000.0, 0, 0, "The image height in scanlines");
+	uiDefButS(block, NUM,REDRAWVIEWCAM | REDRAWVIEW3D ,"AspX:",	892 ,114,112,20, &G.scene->r.xasp, 1.0,200.0, 0, 0, "The horizontal aspect ratio");
+	uiDefButS(block, NUM,REDRAWVIEWCAM | REDRAWVIEW3D ,"AspY:",	1007,114,112,20, &G.scene->r.yasp, 1.0,200.0, 0, 0, "The vertical aspect ratio");
 	uiBlockEndAlign(block);
 
 	yofs = 54;
@@ -1903,6 +1921,7 @@
 	render_panel_layers();
 	render_panel_render();
 	render_panel_anim();
+	render_panel_stereo();
 #ifdef WITH_FFMPEG
        if (G.scene->r.imtype == R_FFMPEG) {
                render_panel_ffmpeg_video();
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/src/drawobject.c ./source/blender/src/drawobject.c
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/src/drawobject.c	2006-04-08 17:58:49.000000000 +0200
+++ ./source/blender/src/drawobject.c	2010-09-14 02:46:48.065699071 +0200
@@ -830,23 +830,66 @@
 	glEnd();
 }
 
+static GLubyte conv_plane_stipple[128] = 
+{
+	0x44,0x44,0x44,0x44,0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x00,0x11,0x11,0x11,
+	0x11,0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x44,0x44,
+	0x44,0x44,0x00,0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x11,0x11,0x11,0x11,0x00,
+	0x00,0x00,0x00,0x11,0x11,0x11,0x11,0x88,0x88,0x88,0x88,0x00,0x00,0x00,0x00,
+	0x44,0x44,0x44,0x44,0x88,0x88,0x88,0x88,0x00,0x00,0x00,0x00,0x22,0x22,0x22,
+	0x22,0x11,0x11,0x11,0x11,0x00,0x00,0x00,0x00,0x22,0x22,0x22,0x22,0x44,0x44,
+	0x44,0x44,0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x22,0x22,0x22,0x22,0x00,
+	0x00,0x00,0x00,0x11,0x11,0x11,0x11,0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x00,
+	0x88,0x88,0x88,0x88,0x44,0x44,0x44,0x44
+};
+
+static void draw_stereo_conv_plane(float conv_dist, float dx, float dy)
+{
+	GLfloat v[4][4] = {
+		{-dx*conv_dist, -dy*conv_dist, -conv_dist},
+		{ dx*conv_dist, -dy*conv_dist, -conv_dist},
+		{ dx*conv_dist,  dy*conv_dist, -conv_dist},
+		{-dx*conv_dist,  dy*conv_dist, -conv_dist}
+	};
+
+	glBegin(GL_LINE_LOOP);
+		glVertex3fv(v[0]);
+		glVertex3fv(v[1]);
+		glVertex3fv(v[2]);
+		glVertex3fv(v[3]);
+		glVertex3fv(v[0]);
+	glEnd();
+
+	glEnable(GL_POLYGON_STIPPLE);
+	glPolygonStipple(conv_plane_stipple);
+	glBegin(GL_QUADS);
+		glVertex3fv(v[0]);
+		glVertex3fv(v[1]);
+		glVertex3fv(v[2]);
+		glVertex3fv(v[3]);
+	glEnd();
+	glDisable(GL_POLYGON_STIPPLE);
+}
+
 /* flag similar to draw_object() */
 static void drawcamera(Object *ob, int flag)
 {
 	/* a standing up pyramid with (0,0,0) as top */
 	Camera *cam;
 	World *wrld;
-	float vec[8][4], tmat[4][4], fac, facx, facy, depth;
+	float vec[8][4], tmat[4][4], fac, facx, facy, depth, aspect;
 	int i;
 
 	cam= ob->data;
 	
 	glDisable(GL_LIGHTING);
 	glDisable(GL_CULL_FACE);
-	
+
+	aspect = (float) (G.scene->r.xsch*G.scene->r.xasp)/(G.scene->r.ysch*G.scene->r.yasp);
+
 	if(G.vd->persp>=2 && cam->type==CAM_ORTHO && ob==G.vd->camera) {
 		facx= 0.5*cam->ortho_scale*1.28;
-		facy= 0.5*cam->ortho_scale*1.024;
+		facy= 0.5*cam->ortho_scale*1.28/aspect;
 		depth= -cam->clipsta-0.1;
 	}
 	else {
@@ -854,8 +897,9 @@
 		if(G.vd->persp>=2 && ob==G.vd->camera) fac= cam->clipsta+0.1; /* that way it's always visible */
 		
 		depth= - fac*cam->lens/16.0;
+
 		facx= fac*1.28;
-		facy= fac*1.024;
+		facy= fac*1.28/aspect;
 	}
 	
 	vec[0][0]= 0.0; vec[0][1]= 0.0; vec[0][2]= 0.001;	/* GLBUG: for picking at iris Entry (well thats old!) */
@@ -896,22 +940,27 @@
 		else if (i==1 && (ob == G.vd->camera)) glBegin(GL_TRIANGLES);
 		else break;
 		
-		vec[0][0]= -0.7*cam->drawsize;
-		vec[0][1]= 1.1*cam->drawsize;
+		vec[0][0]= -0.7*facy;
+		vec[0][1]= 1.1*facy;
 		glVertex3fv(vec[0]);
 		
 		vec[0][0]= 0.0; 
-		vec[0][1]= 1.8*cam->drawsize;
+		vec[0][1]= 1.8*facy;
 		glVertex3fv(vec[0]);
 		
-		vec[0][0]= 0.7*cam->drawsize; 
-		vec[0][1]= 1.1*cam->drawsize;
+		vec[0][0]= 0.7*facy; 
+		vec[0][1]= 1.1*facy;
 		glVertex3fv(vec[0]);
 	
 		glEnd();
 	}
 
 	if(flag==0) {
+		if(cam->stereo_flags & CAM_STEREO) {
+			float lfac = 16./cam->lens;
+			draw_stereo_conv_plane(cam->stereo_conv_dist, lfac, lfac/aspect);
+		}
+
 		if(cam->flag & (CAM_SHOWLIMITS+CAM_SHOWMIST)) {
 			myloadmatrix(G.vd->viewmat);
 			Mat4CpyMat4(vec, ob->obmat);
@@ -933,6 +982,7 @@
 				
 			MTC_Mat4SwapMat4(G.vd->persmat, tmat);
 		}
+
 	}
 }
 
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/src/editipo.c ./source/blender/src/editipo.c
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/src/editipo.c	2006-03-26 23:36:42.000000000 +0200
+++ ./source/blender/src/editipo.c	2010-09-13 00:59:16.130443255 +0200
@@ -2460,10 +2460,11 @@
 				id= G.buts->lockpoin;
 				if(id) {
 					/* yafray: insert key extended with aperture and focal distance */
-					if (G.scene->r.renderer==R_INTERN)
-						event= pupmenu("Insert Key %t|Lens%x0|Clipping%x1");
-					else
-						event= pupmenu("Insert Key %t|Lens%x0|Clipping%x1|Aperture%x2|FocalDistance%x3");
+					if (G.scene->r.renderer==R_INTERN){
+						event= pupmenu("Insert Key %t|Lens%x0|Clipping%x1|Stereo Distance%x4|Stereo Base%x5");
+					} else {
+						event= pupmenu("Insert Key %t|Lens%x0|Clipping%x1|Aperture%x2|FocalDistance%x3|Stereo Distance%x4|Stereo Base%x5");
+					}
 					if(event== -1) return;
 
 					if(event==0) {
@@ -2479,6 +2480,12 @@
 					else if(event==3) {
 						insertkey(id, ID_CA, NULL, NULL, CAM_YF_FDIST);
 					}
+					else if(event==4) {
+						insertkey(id, ID_CA, NULL, NULL, CAM_STEREO_DIST);
+					}
+					else if(event==5) {
+						insertkey(id, ID_CA, NULL, NULL, CAM_STEREO_BASE);
+					}
 				}
 			}
 		}
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/src/editipo_lib.c ./source/blender/src/editipo_lib.c
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/src/editipo_lib.c	2006-02-27 12:45:42.000000000 +0100
+++ ./source/blender/src/editipo_lib.c	2010-09-13 00:59:16.130443255 +0200
@@ -88,7 +88,7 @@
 char *la_ic_names[LA_TOTNAM] = { "Energ", "R", "G", "B", "Dist", "SpoSi", "SpoBl",
 	"Quad1", "Quad2", "HaInt" };
 /* yafray: two curve names added, 'Apert' for aperture, and 'FDist' for focal distance */
-char *cam_ic_names[CAM_TOTNAM] = { "Lens", "ClSta", "ClEnd", "Apert", "FDist" };
+char *cam_ic_names[CAM_TOTNAM] = { "Lens", "ClSta", "ClEnd", "Apert", "FDist", "StDist", "StBase" };
 char *snd_ic_names[SND_TOTNAM] = { "Vol", "Pitch", "Pan", "Atten" };
 char *ac_ic_names[AC_TOTNAM] = {"LocX", "LocY", "LocZ", "SizeX", "SizeY",
 	"SizeZ", "QuatW", "QuatX", "QuatY", "QuatZ"};
@@ -189,7 +189,7 @@
 {
 	/* yafray: curves extended to CAM_YF_FDIST */
 	//if(nr>=CAM_LENS && nr<=CAM_END) return cam_ic_names[nr-1];
-	if(nr>=CAM_LENS && nr<=CAM_YF_FDIST) return cam_ic_names[nr-1];
+	if(nr>=CAM_LENS && nr<=CAM_STEREO_BASE) return cam_ic_names[nr-1];
 	return ic_name_empty[0];
 }
 
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/yafray/intern/export_File.cpp ./source/blender/yafray/intern/export_File.cpp
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/yafray/intern/export_File.cpp	2006-01-28 19:33:23.000000000 +0100
+++ ./source/blender/yafray/intern/export_File.cpp	2010-09-13 00:59:16.474443256 +0200
@@ -1,5 +1,6 @@
 #include "export_File.h"
 
+#include <string.h>
 #include <math.h>
 
 using namespace std;
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/yafray/intern/export_Plugin.cpp ./source/blender/yafray/intern/export_Plugin.cpp
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/yafray/intern/export_Plugin.cpp	2006-01-28 19:33:28.000000000 +0100
+++ ./source/blender/yafray/intern/export_Plugin.cpp	2010-09-13 00:59:16.474443256 +0200
@@ -1,5 +1,6 @@
 #include "export_Plugin.h"
 
+#include <string.h>
 #include <math.h>
 using namespace std;
 
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/yafray/intern/yafray_Render.cpp ./source/blender/yafray/intern/yafray_Render.cpp
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/blender/yafray/intern/yafray_Render.cpp	2005-05-27 19:52:53.000000000 +0200
+++ ./source/blender/yafray/intern/yafray_Render.cpp	2010-09-13 00:59:16.482443255 +0200
@@ -6,6 +6,7 @@
 
 #include "yafray_Render.h"
 
+#include <string.h>
 #include <math.h>
 
 using namespace std;
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/creator/creator.c ./source/creator/creator.c
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/creator/creator.c	2006-03-20 17:24:00.000000000 +0100
+++ ./source/creator/creator.c	2010-09-13 00:59:16.482443255 +0200
@@ -181,6 +181,10 @@
 	printf ("    (formats that can be compiled into blender, not available on all systems)\n");
 	printf ("    \tHDR TIFF EXR MPEG AVICODEC QUICKTIME CINEON DPX\n");
 	printf ("    -x <bool>\tSet option to add the file extension to the end of the file.\n");
+	printf ("\n  --nostereo\tDisable Stereo Rendering.\n");
+	printf ("  --lefteye\tEnable stereo rendering of left eye.\n");
+	printf ("  --righteye\tEnable stereo rendering of right eye.\n");
+
 	printf ("\nAnimation options:\n");
 	printf ("  -a <file(s)>\tPlayback <file(s)>\n");
 	printf ("    -p <sx> <sy>\tOpen with lower left corner at <sx>, <sy>\n");
@@ -493,6 +497,19 @@
 	for(a=1; a<argc; a++) {
 		if (G.afbreek==1) break;
 
+		if(!strcmp(argv[a], "--nostereo")){
+			G.scene->r.renderstereo = 0;
+			continue;
+		}
+		if(!strcmp(argv[a], "--lefteye")){
+			G.scene->r.renderstereo = 1;
+			continue;
+		}
+		if(!strcmp(argv[a], "--righteye")){
+			G.scene->r.renderstereo = 2;
+			continue;
+		}
+
 		if(argv[a][0] == '-') {
 			switch(argv[a][1]) {
 			case 'p':	/* prefsize */
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/gameengine/Ketsji/KX_RayCast.cpp ./source/gameengine/Ketsji/KX_RayCast.cpp
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/source/gameengine/Ketsji/KX_RayCast.cpp	2005-08-05 19:00:31.000000000 +0200
+++ ./source/gameengine/Ketsji/KX_RayCast.cpp	2010-09-13 00:59:17.454443254 +0200
@@ -32,6 +32,7 @@
  */
 
 #include <stdlib.h>
+#include <stdio.h>
 
 #include "KX_RayCast.h"
 
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/tools/Blender.py ./tools/Blender.py
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/tools/Blender.py	2006-03-17 17:38:39.000000000 +0100
+++ ./tools/Blender.py	2010-09-14 15:53:01.151789452 +0200
@@ -109,14 +109,15 @@
         #here libs for static linking
     ]
     libincs = [
-        '/usr/lib',
         lenv['BF_PYTHON_LIBPATH'],
         lenv['BF_OPENGL_LIBPATH'],
         lenv['BF_SDL_LIBPATH'],
         lenv['BF_JPEG_LIBPATH'],
         lenv['BF_PNG_LIBPATH'],
         lenv['BF_ZLIB_LIBPATH'],
-        lenv['BF_ICONV_LIBPATH']
+	lenv['BF_TIFF_LIBPATH'],
+        lenv['BF_ICONV_LIBPATH'],
+        '/usr/lib32'
         ]
     libincs += Split(lenv['BF_OPENEXR_LIBPATH'])
 
@@ -139,7 +140,8 @@
         lenv['BF_PYTHON_LIB'],
         lenv['BF_JPEG_LIB'],
         lenv['BF_PNG_LIB'],
-        lenv['BF_ZLIB_LIB']
+        lenv['BF_ZLIB_LIB'],
+	lenv['BF_TIFF_LIB'],
         ]
     if lenv['WITH_BF_INTERNATIONAL']:
         syslibs += Split(lenv['BF_FREETYPE_LIB'])
diff -r -x CVS -x cscope.out -u -d /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/tools/btools.py ./tools/btools.py
--- /home/wolfgangd/downloads/bf_blender/bf_blender/bf-blender/blender/tools/btools.py	2006-03-17 17:38:39.000000000 +0100
+++ ./tools/btools.py	2010-09-13 11:30:41.022430747 +0200
@@ -24,7 +24,7 @@
             'WITH_BF_FFMPEG', 'BF_FFMPEG_LIB', 
             'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH',
             'WITH_BF_PNG', 'BF_PNG', 'BF_PNG_INC', 'BF_PNG_LIB', 'BF_PNG_LIBPATH',
-            'BF_TIFF', 'BF_TIFF_INC',
+            'WITH_BF_TIFF', 'BF_TIFF', 'BF_TIFF_INC', 'BF_TIFF_LIB', 'BF_TIFF_LIBPATH',
             'WITH_BF_ZLIB', 'BF_ZLIB', 'BF_ZLIB_INC', 'BF_ZLIB_LIB', 'BF_ZLIB_LIBPATH',
             'WITH_BF_INTERNATIONAL',
             'BF_GETTEXT', 'BF_GETTEXT_INC', 'BF_GETTEXT_LIB', 'BF_GETTEXT_LIBPATH',
@@ -160,8 +160,11 @@
         ('BF_PNG_LIB', 'PNG library', ''),
         ('BF_PNG_LIBPATH', 'PNG library path', ''),
 
+	(BoolOption('WITH_BF_TIFF', 'User TIFF if true', 'true')),
         ('BF_TIFF', 'TIFF base path', ''),
         ('BF_TIFF_INC', 'TIFF include path', ''),
+	('BF_TIFF_LIB', 'TIFF library', ''),
+	('BF_TIFF_LIBPATH', 'TIFF library path', ''),
 
         (BoolOption('WITH_BF_ZLIB', 'Use ZLib if true', 'true')),
         ('BF_ZLIB', 'ZLib base path', ''),