[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10939] branches/soc-2007-joeedh/source/ blender: Vising family for next three weeks tomorrow, so I'm committing

Joseph Eagar joeedh at gmail.com
Sat Jun 16 03:10:54 CEST 2007


Revision: 10939
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10939
Author:   joeedh
Date:     2007-06-16 03:10:53 +0200 (Sat, 16 Jun 2007)

Log Message:
-----------
Vising family for next three weeks tomorrow, so I'm committing
so I can pull the source on my laptop to continue working there.

Nothing works btw.

Modified Paths:
--------------
    branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h
    branches/soc-2007-joeedh/source/blender/blenlib/intern/util.c
    branches/soc-2007-joeedh/source/blender/makesdna/DNA_lamp_types.h
    branches/soc-2007-joeedh/source/blender/python/api2_2x/IDProp.c
    branches/soc-2007-joeedh/source/blender/render/intern/include/render_types.h
    branches/soc-2007-joeedh/source/blender/render/intern/include/shadbuf.h
    branches/soc-2007-joeedh/source/blender/render/intern/source/convertblender.c
    branches/soc-2007-joeedh/source/blender/render/intern/source/shadbuf.c
    branches/soc-2007-joeedh/source/blender/render/intern/source/shadeoutput.c
    branches/soc-2007-joeedh/source/blender/render/intern/source/zbuf.c
    branches/soc-2007-joeedh/source/blender/src/buttons_shading.c

Modified: branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h
===================================================================
--- branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h	2007-06-15 23:22:25 UTC (rev 10938)
+++ branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h	2007-06-16 01:10:53 UTC (rev 10939)
@@ -32,11 +32,13 @@
  *
  * ***** END GPL/BL DUAL LICENSE BLOCK *****
  */
- #ifndef BKE_TILE_H
- #define BKE_TILE_H
+#ifndef BKE_TILE_H
+#define BKE_TILE_H
  
- #include "DNA_listBase.h"
+#include "DNA_listBase.h"
  
+#include <stdio.h> /* needed for FILE typedef */
+
  /*Tile caching interface.  Tile caches are  grouped in "pools", which can
    contain generic tiles of any tile cache type.  Tiles are generic data
    holding structures.  Module prefix is TCS, for Tile Cache System*/
@@ -44,13 +46,13 @@
 struct TCS_Tile;
 struct TCS_TilePool;
 struct TCS_TileBuffer;
- 
+
 typedef struct TCS_Tile {
 	struct TCS_Tile *next, *prev;
-	void (*loadFromCache)(struct TCS_Tile *self, struct FILE *file, unsigned long start);
+	void (*loadFromCache)(struct TCS_Tile *self, FILE *file, unsigned long start);
 	
 	/*returns length*/
-	unsigned int (*saveToCache(struct TCS_Tile *self, struct FILE *file, unsigned long current_position);
+	unsigned int (*saveToCache)(struct TCS_Tile *self, FILE *file, unsigned long current_position);
 	int is_cached;
 	struct TCS_TilePool *pool;
 	struct TCS_TileBuffer *buffer; /*parent buffer*/
@@ -68,20 +70,22 @@
  
  typedef struct TCS_TileBuffer {
 	struct TCS_TileBuffer *next, *prev;
-	void (*makeTiles)(TCS_TileBuffer *self, TCS_TilePool *cachepool);
-	void (*freeBuffer)(TCS_TileBuffer *self);
+	void (*makeTiles)(struct TCS_TileBuffer *self, TCS_TilePool *cachepool);
+	void (*freeBuffer)(struct TCS_TileBuffer *self);
 
 	/*as may dimensions can be used as needed, others can just be passed in as 0.*/
-	void (*getTile)(TCS_TileBuffer *self, int x, int y, int z);
-	void (*getTileMemUsage)(TCS_TileBuffer *self, int x, int y, int z);
+	void (*getTile)(struct TCS_TileBuffer *self, int x, int y, int z);
+	void (*getTileMemUsage)(struct TCS_TileBuffer *self, int x, int y, int z);
 	TCS_TilePool *pool;
  } TCS_TileBuffer;
 
 /*buffer type templates*/
 extern TCS_TileBuffer	TCS_FloatImageBuffer;
 extern TCS_TileBuffer	TCS_UByteImageBuffer;
-extern TCS_TileBuffer	TCS_IrregularBufferCell;
 
+/*remember to use this name!*/
+extern TCS_TileBuffer	TCS_DeepShadowBuffer;
+
 TCS_TilePool *TCS_MakePool(unsigned long max_mem_bytes);
 void TCS_FreePool(TCS_TilePool *pool);
 TCS_TileBuffer *TCS_MakeBuffer(TCS_TileBuffer *type, void *data);
@@ -93,7 +97,7 @@
 /*hrm, not sure if this next one will be needed, its possible it can
   all be done from within TCS_GetTile()*/
 void TCS_RunCacher(TCS_TilePool *pool);
-void TCS_SetCacheLimit(TCS_TilePoolt *pool, unsigned long max_mem_bytes);
+void TCS_SetCacheLimit(TCS_TilePool *pool, unsigned long max_mem_bytes);
 
 
- #endif /* BKE_TILE_H */
\ No newline at end of file
+ #endif /* BKE_TILE_H */

Modified: branches/soc-2007-joeedh/source/blender/blenlib/intern/util.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/blenlib/intern/util.c	2007-06-15 23:22:25 UTC (rev 10938)
+++ branches/soc-2007-joeedh/source/blender/blenlib/intern/util.c	2007-06-16 01:10:53 UTC (rev 10939)
@@ -1342,7 +1342,7 @@
 
 void BLI_where_am_i(char *fullname, char *name)
 {
-	char filename[FILE_MAXDIR+FILE_MAXFILE];
+	char filename[FILE_MAXDIR+FILE_MAXFILE+1];
 	char *path, *temp;
 	int len;
 #ifdef _WIN32

Modified: branches/soc-2007-joeedh/source/blender/makesdna/DNA_lamp_types.h
===================================================================
--- branches/soc-2007-joeedh/source/blender/makesdna/DNA_lamp_types.h	2007-06-15 23:22:25 UTC (rev 10938)
+++ branches/soc-2007-joeedh/source/blender/makesdna/DNA_lamp_types.h	2007-06-16 01:10:53 UTC (rev 10939)
@@ -116,6 +116,7 @@
 #define LA_SHADBUF_REGULAR		0
 #define LA_SHADBUF_IRREGULAR	1
 #define LA_SHADBUF_HALFWAY		2
+#define LA_SHADBUF_DEEP			3
 
 /* bufflag, auto clipping */
 #define LA_SHADBUF_AUTO_START	1

Modified: branches/soc-2007-joeedh/source/blender/python/api2_2x/IDProp.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/python/api2_2x/IDProp.c	2007-06-15 23:22:25 UTC (rev 10938)
+++ branches/soc-2007-joeedh/source/blender/python/api2_2x/IDProp.c	2007-06-16 01:10:53 UTC (rev 10939)
@@ -664,7 +664,7 @@
 
 int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *val)
 {
-	int i;
+	long long i;
 	float f;
 
 	if (index < 0 || index >= self->prop->len)
@@ -686,7 +686,7 @@
 		case IDP_INT:
 			if (!PyNumber_Check(val)) return EXPP_ReturnIntError( PyExc_TypeError,
 				"expected an int");
-			val = PyNumber_Int(val);
+			val = PyNumber_Long(val);
 			if (!val) return EXPP_ReturnIntError( PyExc_TypeError,
 				"expected an int");
 

Modified: branches/soc-2007-joeedh/source/blender/render/intern/include/render_types.h
===================================================================
--- branches/soc-2007-joeedh/source/blender/render/intern/include/render_types.h	2007-06-15 23:22:25 UTC (rev 10938)
+++ branches/soc-2007-joeedh/source/blender/render/intern/include/render_types.h	2007-06-16 01:10:53 UTC (rev 10939)
@@ -201,6 +201,7 @@
 /* ------------------------------------------------------------------------- */
 
 struct ISBData;
+struct DSMBuffer;
 
 typedef struct ShadSampleBuf {
 	struct ShadSampleBuf *next, *prev;
@@ -220,6 +221,7 @@
 	int size, bias;
 	ListBase buffers;
 	
+	struct DSMBuffer *dsmbuffer;
 	/* irregular shadowbufer, result stored per thread */
 	struct ISBData *isb_result[BLENDER_MAX_THREADS];
 } ShadBuf;

Modified: branches/soc-2007-joeedh/source/blender/render/intern/include/shadbuf.h
===================================================================
--- branches/soc-2007-joeedh/source/blender/render/intern/include/shadbuf.h	2007-06-15 23:22:25 UTC (rev 10938)
+++ branches/soc-2007-joeedh/source/blender/render/intern/include/shadbuf.h	2007-06-16 01:10:53 UTC (rev 10939)
@@ -36,7 +36,12 @@
 #define SHADBUF_EXT_H
 
 #include "render_types.h"
+#include "BKE_tile.h"
 
+struct ShadeInput;
+struct ShadBuf;
+struct Render;
+
 /**
  * Calculates shadowbuffers for a vector of shadow-giving lamps
  * @param lar The vector of lamps
@@ -61,13 +66,55 @@
  */
 float shadow_halo(LampRen *lar, float *p1, float *p2);
 
+struct MemArena;
+struct APixstr;
+
 /**
+ * Deep Shadow Buffer
+ */
+
+/*Each tile has its own memarena to work better with caching.*/
+typedef struct DSMTile {
+	TCS_Tile tile;
+	
+	/*the first element of the arrays pointed to by
+	  depth_rect is the length of the pixel depth
+	  array, and is 1/4th the size of the pixel color array (since it
+	  stores rgba colors of course)*/
+	float **color_rect; /* includes alpha */
+	unsigned int **depth_rect;
+
+	/*tile coordinates inside poly_rect.
+	  Note: this is *not* in image space units!
+	  Multiple by the parent buffer's tsizex/y
+	  to get the tile position in image space.*/
+	int x, y;
+	int sizex, sizey;
+	struct MemArena *arena;
+} DSMTile;
+
+typedef struct DSMBuffer {
+	TCS_TileBuffer buffer;
+	
+	DSMTile *poly_rect;
+	int sizex, sizey;
+	int tilex, tiley; /*total number of tiles in x and y dimensions.*/
+
+	/*tile dimensions, isn't necassarily true for 100% of th tiles.
+	 this is because the image might not be divisible into equally sized tiles of
+	 a user-definable size.*/
+	int tsizex, tsizey;
+	int max_depth; /*the maximum number of samples in a single pixel*/
+} DSMBuffer;
+
+float DSM_getShadow(ShadBuf *buf, float *rco, float *dxco, float *dyco, float inp);
+void DSM_CreateBuffer(Render *re, ShadBuf *buf, int tilesize);
+void DSM_FreeBuffer(DSMBuffer *dbuf);
+
+/**
  * Irregular shadowbuffer
  */
 
-struct MemArena;
-struct APixstr;
-
 void ISB_create(RenderPart *pa, struct APixstr *apixbuf);
 void ISB_free(RenderPart *pa);
 float ISB_getshadow(ShadeInput *shi, ShadBuf *shb);
@@ -107,4 +154,3 @@
 } ISBData;
 
 #endif /* SHADBUF_EXT_H */
-

Modified: branches/soc-2007-joeedh/source/blender/render/intern/source/convertblender.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/render/intern/source/convertblender.c	2007-06-15 23:22:25 UTC (rev 10938)
+++ branches/soc-2007-joeedh/source/blender/render/intern/source/convertblender.c	2007-06-16 01:10:53 UTC (rev 10939)
@@ -3452,15 +3452,6 @@
 		re->i.infostr= "Creating Shadowbuffers";
 		re->stats_draw(&re->i);
 
-		/* SHADOW BUFFER */
-		for(lar=re->lampren.first; lar; lar= lar->next) {
-			if(re->test_break()) break;
-			if(lar->shb) {
-				/* if type is irregular, this only sets the perspective matrix and autoclips */
-				makeshadowbuf(re, lar);
-			}
-		}
-		
 		/* yafray: 'direct' radiosity, environment maps and octree init not needed for yafray render */
 		/* although radio mode could be useful at some point, later */
 		if (re->r.renderer==R_INTERN) {
@@ -3479,6 +3470,17 @@
 				make_envmaps(re);
 		}
 		
+		/* SHADOW BUFFER */
+		for(lar=re->lampren.first; lar; lar= lar->next) {
+			if(re->test_break()) break;
+
+			/*deep shadow buffers might need to be initilzied in another place*/
+			if(lar->shb && lar->buftype) { // != LA_SHADBUF_DEEP) {
+				/* if type is irregular, this only sets the perspective matrix and autoclips */
+				makeshadowbuf(re, lar);
+			}
+		}
+
 		if(!re->test_break())
 			project_renderdata(re, projectverto, re->r.mode & R_PANORAMA, 0);
 

Modified: branches/soc-2007-joeedh/source/blender/render/intern/source/shadbuf.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/render/intern/source/shadbuf.c	2007-06-15 23:22:25 UTC (rev 10938)
+++ branches/soc-2007-joeedh/source/blender/render/intern/source/shadbuf.c	2007-06-16 01:10:53 UTC (rev 10939)
@@ -420,6 +420,18 @@
 		MTC_Mat4SwapMat4(shb->persmat, re->winmat);
 
 		/* printf("lampbuf %d\n", sizeoflampbuf(shb)); */
+	} else if (lar->buftype == LA_SHADBUF_DEEP) {
+		/* temp, will be restored */
+		MTC_Mat4SwapMat4(shb->persmat, re->winmat);
+
+		project_renderdata(re, projectvert, 0, 0);
+
+		DSM_CreateBuffer(re, shb, 128); /*FIXMEGREP: tilesize is hard-coded here, for now*/
+		
+		/* old matrix back */
+		MTC_Mat4SwapMat4(shb->persmat, re->winmat);
+
+		project_renderdata(re, projectvert, 0, 0);
 	}
 }
 
@@ -430,6 +442,15 @@
 		ShadSampleBuf *shsample;

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list