Hello, there is a file missing : BKE_dsm.h<br><br>Regards.<br><br><div><span class="gmail_quote">2007/7/2, Joseph Eagar &lt;<a href="mailto:joeedh@gmail.com">joeedh@gmail.com</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Revision: 11140<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&amp;root=bf-blender&amp;revision=11140">http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&amp;root=bf-blender&amp;revision=11140
</a><br>Author:&nbsp;&nbsp; joeedh<br>Date:&nbsp;&nbsp;&nbsp;&nbsp; 2007-07-02 09:42:18 +0200 (Mon, 02 Jul 2007)<br><br>Log Message:<br>-----------<br>This commit is because my harddrive is being a little<br>weird (or perhaps notepad2 was acting up, or window&#39;s
<br>disk cache was being quirky, I&#39;m not sure).<br><br>This has the initial tile cache interface.&nbsp;&nbsp;The tile<br>system is fully generic, and includes an API for<br>manipulating both files and memory buffers.&nbsp;&nbsp;This API<br>
nearly completely duplicates the stdlib file library.<br><br>The tiling system does not work yet, though.&nbsp;&nbsp;In<br>fact DSM in general is now broken by this.&nbsp;&nbsp;So don&#39;t<br>update until I get things working again. :)<br><br>
Modified Paths:<br>--------------<br>&nbsp;&nbsp;&nbsp;&nbsp;branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h<br>&nbsp;&nbsp;&nbsp;&nbsp;branches/soc-2007-joeedh/source/blender/render/intern/include/shadbuf.h<br>&nbsp;&nbsp;&nbsp;&nbsp;branches/soc-2007-joeedh/source/blender/render/intern/source/convertblender.c
<br>&nbsp;&nbsp;&nbsp;&nbsp;branches/soc-2007-joeedh/source/blender/render/intern/source/shadbuf.c<br>&nbsp;&nbsp;&nbsp;&nbsp;branches/soc-2007-joeedh/source/blender/render/intern/source/zbuf.c<br><br>Added Paths:<br>-----------<br>&nbsp;&nbsp;&nbsp;&nbsp;branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c
<br>&nbsp;&nbsp;&nbsp;&nbsp;branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_dsm.c<br>&nbsp;&nbsp;&nbsp;&nbsp;branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_file.c<br>&nbsp;&nbsp;&nbsp;&nbsp;branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_image.c
<br><br>Removed Paths:<br>-------------<br>&nbsp;&nbsp;&nbsp;&nbsp;branches/soc-2007-joeedh/source/blender/blenkernel/intern/cache.c<br><br>Modified: branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h<br>===================================================================
<br>--- branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2007-07-01 14:12:10 UTC (rev 11139)<br>+++ branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2007-07-02 07:42:18 UTC (rev 11140)
<br>@@ -71,17 +71,18 @@<br> typedef struct TCS_File {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;struct TCS_File *next, *prev;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int is_mem;<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int error_occured;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;void *ptr; /*can be either a FILE handle or a piece of memory.*/
<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char filename[256];<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*remember to make sure these are updated, even if using<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a real FILE file instead of a memory block!*/<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned long length, cursor;<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned long length, cursor, totallocated;
<br> } TCS_File;<br><br> typedef struct TCS_Tile {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;struct TCS_Tile *next, *prev;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void (*loadFromCache)(struct TCS_Tile *self, TCS_File *file,<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned long start);<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void (*loadFromCache)(struct TCS_Tile *self, TCS_File *file);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*should free client data after writing to disk, but not free<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the TCS_Tile itself.<br>@@ -91,57 +92,70 @@<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unsigned int (*saveToCache)(struct TCS_Tile *self, TCS_File *file,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unsigned long current_position);<br><br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*returns amount of memory the tile is using, in bytes*/<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned int (*getTileMem)(struct TCS_Tile *self);<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void *(*getTilePixel)(struct TCS_Tile *self, int x, int y, int z);
<br>+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int is_cached; /*is 1 if either (or both) is_compressed or is_written is 1.*/<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-privae variables, do not touch!-*/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int is_compressed, is_written, mem_used;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TCS_File *file;
<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int filepos;<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TCS_File *file, *compressed_memfile;<br>+<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*filepos is the cached tile position.&nbsp;&nbsp;this must *never* be messed up!*/<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int filepos, len; /*len is for caching the tile len, to avoid constantly recalculating the size*/
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;struct TCS_TilePool *pool;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;struct TCS_TileBuffer *buffer; /*parent buffer*/<br>&nbsp;&nbsp;} TCS_Tile;<br><br>-/*List of files used by a tile pool*/<br>-typedef struct TCS_FileList {<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ListBase open_files; /*open files*/
<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned long long len; /*length of all files, in bytes.*/<br>-} TCS_FileList;<br>-<br> /*pools manage tiles, but the the tiles themselves belong to TCS_TileBuffers.<br>&nbsp;&nbsp; This is a generic container structure, so it can hold any tile from
<br>&nbsp;&nbsp; any buffer, of any buffer type.*/<br> typedef struct TCS_TilePool {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;struct TCS_TilePool *next, *prev;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ListBase tiles;<br>+<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ListBase open_files; /*open files*/<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned long long len; /*length of all files, in bytes.*/
<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int totfiles, curid; /*curid is used for naming files.*/<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int max_file_len;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*tiles which have been compressed, but not written to disk yet.*/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ListBase compressed_tiles;<br>
<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned int tottiles;<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //unsigned int tottiles;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unsigned long maxmem;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unsigned long memused; /*total amount of memory used at the moment.*/<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned long grace_period; /*margin, used to (hopefully) cache tiles in groups instead
<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; of one at a time.*/<br>&nbsp;&nbsp;} TCS_TilePool;<br><br>&nbsp;&nbsp;typedef struct TCS_TileBuffer {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;struct TCS_TileBuffer *next, *prev;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;struct TCS_TileBuffer *(*newBuffer)(int tilesizex, int tilesizey,
<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int sizex, int sizey);<br>-<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*should make sure tiles reference cachepool.*/<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void (*makeTiles)(struct TCS_TileBuffer *self, TCS_TilePool *cachepool);<br>
-<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int sizex, int sizey, void *data);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*only frees direct data*/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;void (*freeBuffer)(struct TCS_TileBuffer *self);<br>-<br>+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*as may dimensions can be used as needed, others can just be passed in
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; as 0.*/<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void (*getTile)(struct TCS_TileBuffer *self, int x, int y);<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void *(*getTile)(struct TCS_TileBuffer *self, int x, int y, int z);<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int (*getTileSizeX)(struct TCS_TileBuffer *self);
<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int (*getTileSizeY)(struct TCS_TileBuffer *self);<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int (*getSizeX)(struct TCS_TileBuffer *self);<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int (*getSizeY)(struct TCS_TileBuffer *self);<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned int flags;<br><br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*should be set by TCS_MakePool, not the newBuffer funcion*/
<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*should be set by TCS_MakePool, not the newBuffer function*/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TCS_TilePool *pool;<br>&nbsp;&nbsp;} TCS_TileBuffer;<br><br>+/*TCS_TileBuffer .flags member flags*/<br>+/*Read only buffer means once a tile is written once, we
<br>+&nbsp;&nbsp;never have to write it to disk again.*/<br>+#define TCS_READONLY&nbsp;&nbsp; 1<br>+<br> /*buffer type templates*/<br><br> /*I imagine these next three should each use a common set of implementation<br>@@ -159,11 +173,12 @@<br>
 TCS_TilePool *TCS_MakePool(unsigned long max_mem_bytes);<br> void TCS_FreePool(TCS_TilePool *pool);<br><br>-TCS_TileBuffer *TCS_MakeBuffer(TCS_TileBuffer *type, void *data);<br>-void TCS_FreeBuffer(TCS_TileBuffer *type);
<br>-<br>+TCS_TileBuffer *TCS_MakeBuffer(TCS_TileBuffer *type, int tilesizex, int tilesizey,<br>+&nbsp;&nbsp; int sizex, int sizey, void *data);<br>+void TCS_InitBuffer(TCS_TileBuffer *type, void *buffer);<br>+void TCS_FreeBuffer(void *buf);
<br> /*as may dimensions can be used as needed, others can just be passed in as 0.*/<br>-void *TCS_GetTile(TCS_TileBuffer *type, int x, int y, int z);<br>+void *TCS_GetTile(void *buf, int x, int y, int z);<br><br> /*hrm, not sure if this next one will be needed, its possible it can
<br>&nbsp;&nbsp; all be done from within TCS_GetTile(), perhaps even progressively*/<br>@@ -174,17 +189,28 @@<br><br> /*all these file functions (other then TCS_wrapmem) have the same interface<br>&nbsp;&nbsp; as their stdlib stdio counterparts.*/
<br>-void TCS_fread(void *ptr, unsigned long size, unsigned long count,<br>+<br>+int TCS_fread(void *ptr, unsigned long size, unsigned long count,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TCS_File *file);<br>-void TCS_fwrite(void *ptr, unsigned long size, unsigned long count,
<br>+int TCS_fwrite(void *ptr, unsigned long size, unsigned long count,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TCS_File *file);<br><br> /*these are actually private functions, never use them in cache implementations!*/<br>+<br>+/*closes a file, then deletes it if its a disk file.&nbsp;&nbsp;like TCS_fclose it frees file*/
<br>+void TCS_fdelete(TCS_File *file);<br>+<br>+TCS_File *TCS_openmemfile(int initial_size);<br> TCS_File *TCS_fopen(const char *path, const char *mode);<br>-TCS_File *TCS_fclose(const char *path, const char *mode);<br>+<br>
+/*closes a file and frees file (and memory buffers if its a mem file)*/<br>+void TCS_fclose(TCS_File *file);<br> TCS_File *TCS_wrapmem(void *mem, int len);<br> unsigned int TCS_ftell(TCS_File *file);<br> void TCS_rewind(TCS_File *file);
<br> void TCS_fseek(TCS_File *file, unsigned long offset, int origin);<br>+void TCS_fflush(TCS_File *file);<br><br>- #endif /* BKE_TILE_H */<br>+#define BASSERT(eval)&nbsp;&nbsp;if (!(eval)) printf(&quot;\nassert \&quot;%s\&quot; in file:\n%s\n on line %d failed.\n\n&quot;, #eval, __FILE__, __LINE__)
<br>+<br>+#endif /* BKE_TILE_H */<br><br>Deleted: branches/soc-2007-joeedh/source/blender/blenkernel/intern/cache.c<br>===================================================================<br>--- branches/soc-2007-joeedh/source/blender/blenkernel/intern/cache.c&nbsp;&nbsp; 2007-07-01 14:12:10 UTC (rev 11139)
<br>+++ branches/soc-2007-joeedh/source/blender/blenkernel/intern/cache.c&nbsp;&nbsp; 2007-07-02 07:42:18 UTC (rev 11140)<br>@@ -1,214 +0,0 @@<br>-#if 0<br>-/**<br>- * $Id: cache.c 10648 2007-05-03 21:37:52Z blendix $<br>- *<br>- * ***** BEGIN GPL LICENSE BLOCK *****
<br>- *<br>- * This program is free software; you can redistribute it and/or<br>- * modify it under the terms of the GNU General Public License<br>- * as published by the Free Software Foundation; either version 2<br>- * of the License, or (at your option) any later version.
<br>- *<br>- * This program is distributed in the hope that it will be useful,<br>- * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.&nbsp;&nbsp;See the<br>
- * GNU General Public License for more details.<br>- *<br>- * You should have received a copy of the GNU General Public License<br>- * along with this program; if not, write to the Free Software Foundation,<br>- * Inc., 59 Temple Place - Suite 330, Boston, MA&nbsp;&nbsp;02111-1307, USA.
<br>- *<br>- * The Original Code is Copyright (C) 2001-2002 by Joseph Eagar.<br>- *<br>- * Contributor(s): Joseph Eagar<br>- *<br>- * ***** END GPL/BL DUAL LICENSE BLOCK *****<br>- */<br>-<br>-#include &quot;BKE_global.h&quot;
<br>-#include &quot;BKE_main.h&quot;<br>-#include &quot;BKE_tile.h&quot;<br>-<br>-#include &lt;stdio.h&gt;<br>-#include &lt;stdlib.h&gt;<br>-#include &lt;string.h&gt;<br>-<br>-/*Deep shadow buffer cache implementation*/<br>
-typedef struct DSMBuf {<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TCS_TileBuffer buf;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int tottilex, tottiley;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int tilesizex, tilesizey;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int sizex, sizey;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DSMTile *tiles;<br>-} DSMBuf;<br>-<br>-typedef struct DSMTile {
<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TCS_Tile tile;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void *dsmdata;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int x, y;<br>-} DSMTile;<br>-<br>-static void dsm_loadtile(TCS_Tile *self, FILE *file, unsigned long start)<br>-{<br>-}<br>-<br>-static void dsm_savetile(TCS_Tile *self, FILE *file, unsigned long curpos)
<br>-{<br>-}<br>-<br>-static void dsm_maketiles(TCS_TileBuffer *self, TCS_TilePool *pool)<br>-{<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DSMTile *tile;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DSMBuf *buf = (DSMBuf*)self;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int i;<br>-<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (i=0, tile=buf-&gt;tiles; i&lt;buf-&gt;tottilex*buf-&gt;tottiley; buf++, i++) {
<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf-&gt;tile.loadFromCache = dsm_loadtile;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf-&gt;tile.saveToCache = dsm_savetile;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf-&gt;pool = pool;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf-&gt;buffer = self;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-}<br>-<br>-static void dsm_freebuffer(TCS_TileBuffer *self)<br>-{<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DSMBuf *buf = (DSMBuf*)self;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MEM_freeN(buf-&gt;tiles);<br>-<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*FIXMEGREP: ToDo: figure out if actual deep shadow map data<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; should be freed here or not<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/<br>-}<br>-<br>-static void dsm_gettile(TCS_TileBuffer *self, int x, int y)<br>-{<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DSMBuf *buf = (DSMBuf*)self;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return buf-&gt;tiles[y*buf-&gt;sizex+x];
<br>-}<br>-<br>-static struct TCS_TileBuffer *dsm_newbuffer(int tsizex, tsizey, sizex, sizey)<br>-{<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DSMBuf *buf = MEM_callocN(sizeof(DSMBuf), &quot;DSMBuf&quot;);<br>-<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf-&gt;tottilex = sizex / tsizex;
<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf-&gt;tottiley = sizey / tsizey;<br>-<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf-&gt;tilesizex = tsizex;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf-&gt;tilesizey = tsizey;<br>-<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf-&gt;sizex = sizex;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf-&gt;sizey = sizey;<br>-<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf-&gt;tiles = MEM_callocN(sizeof(DSMTile)*buf-&gt;tottilex*buf-&gt;tottiley, &quot;DSMTile array&quot;);
<br>-}<br>-<br>-TCS_TileBuffer TCS_DeepShadowBuffer = {<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL, NULL,<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dsm_newbuffer,<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dsm_maketiles,<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dsm_freebuffer,<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dsm_gettile,<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>-};<br>-<br>-/*Image buffer implementation*/
<br>-<br>-#define TYPE_UBYTE1&nbsp;&nbsp;&nbsp;&nbsp;0<br>-#define TYPE_UBYTE3&nbsp;&nbsp;&nbsp;&nbsp;1<br>-#define TYPE_UBYTE4&nbsp;&nbsp;&nbsp;&nbsp;2<br>-#define TYPE_FLOAT1&nbsp;&nbsp;&nbsp;&nbsp;3<br>-#define TYPE_FLOAT3&nbsp;&nbsp;&nbsp;&nbsp;4<br>-#define TYPE_FLOAT4&nbsp;&nbsp;&nbsp;&nbsp;5<br>-<br>-int type_totchannels[] = {<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1,
<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3,<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4,<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1,<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3,<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4<br>-};<br>-<br>-int type_sizes[] = {<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1,<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3,<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4,<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sizeof(float),<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sizeof(float)*3,<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sizeof(float)*4)
<br>-};<br>-<br>-#define GETARRAY_PIXPTR(width, x, y, arr, type, channels) ((type*)&amp;((char*)arr)[(sizeof(type)*y*sizex+sizeof(type)*x)*sizeof(type)*channels])<br>-<br>-/*<br>-&nbsp;&nbsp; Utility inline function to fetch a pixel from any image buffer type,
<br>-&nbsp;&nbsp; convert it to a float if necassary, then copy the result into a float<br>-&nbsp;&nbsp; array called varname.&nbsp;&nbsp;Note that the code limits what&#39;s copied to<br>-&nbsp;&nbsp; sizeof(varname).<br>-<br>-&nbsp;&nbsp;heh, this would make a wonderful inline function, I&#39;m sure, but I have no idea how
<br><br>@@ Diff output truncated at 10240 characters. @@<br><br>_______________________________________________<br>Bf-blender-cvs mailing list<br><a href="mailto:Bf-blender-cvs@blender.org">Bf-blender-cvs@blender.org</a><br>
<a href="http://lists.blender.org/mailman/listinfo/bf-blender-cvs">http://lists.blender.org/mailman/listinfo/bf-blender-cvs</a><br></blockquote></div><br>