Revision: 15580
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15580
Author:   joeedh
Date:     2008-07-15 04:06:05 +0200 (Tue, 15 Jul 2008)

Log Message:
-----------
Texture map evaluation support now pretty much works.

YAY!!!!!

finally!

There may be other things in this commit, not sure, been trying to get this to 
work for a long time.  with this working, a merge with trunk may finally
come to pass.  though I'll be moving in the next month, so who knows.

Modified Paths:
--------------
    branches/soc-2007-joeedh/source/blender/blenkernel/BKE_dsm.h
    branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h
    branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c
    branches/soc-2007-joeedh/source/blender/render/intern/include/render_types.h
    
branches/soc-2007-joeedh/source/blender/render/intern/source/convertblender.c
    branches/soc-2007-joeedh/source/blender/render/intern/source/dsm.c
    branches/soc-2007-joeedh/source/blender/render/intern/source/envmap.c
    
branches/soc-2007-joeedh/source/blender/render/intern/source/renderdatabase.c
    branches/soc-2007-joeedh/source/blender/render/intern/source/shadbuf.c
    branches/soc-2007-joeedh/source/blender/render/intern/source/shadeoutput.c

Modified: branches/soc-2007-joeedh/source/blender/blenkernel/BKE_dsm.h
===================================================================
--- branches/soc-2007-joeedh/source/blender/blenkernel/BKE_dsm.h        
2008-07-15 01:23:56 UTC (rev 15579)
+++ branches/soc-2007-joeedh/source/blender/blenkernel/BKE_dsm.h        
2008-07-15 02:06:05 UTC (rev 15580)
@@ -105,6 +105,10 @@
 
 #define DSM_SAMPLEMERGE_LIMIT  (0x7FFFFFFF) //20000000
 
+#define DSM_LINEAR     0
+#define DSM_SOFT       0
+//#define DOQMCDEBUG
+
 /*little bit smaller memarena buffer size for the final diced
   32x32 tiles*/
 #define DSM_TILE_FINALMEMARENASIZE (1<<16)

Modified: branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h
===================================================================
--- branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h       
2008-07-15 01:23:56 UTC (rev 15579)
+++ branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h       
2008-07-15 02:06:05 UTC (rev 15580)
@@ -288,6 +288,6 @@
 
 /*a non-fatal warning assertion.  it just prints into the console.*/
 #define BASSERT(eval)  if (!(eval)) printf("\nassert \"%s\" in file:\n%s\n on 
line %d failed.\n\n", #eval, __FILE__, __LINE__)
-#define BASSERT(eval)
+//#define BASSERT(eval)
 
 #endif /* BKE_TILE_H */

Modified: branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c       
2008-07-15 01:23:56 UTC (rev 15579)
+++ branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c       
2008-07-15 02:06:05 UTC (rev 15580)
@@ -176,19 +176,8 @@
        TCS_Tile *tile;
        int tx=0, ty=0;
        
-       BASSERT(vbuf);
-       for (ty=0; ty<buf->getSizeY(buf)/buf->getTileSizeY(buf); ty++) {
-               for (tx=0; tx<buf->getSizeX(buf)/buf->getTileSizeX(buf); tx++) {
-                       tile = buf->getTile(buf, tx, ty, 0);
-                       if (!tile->pool) {
-                               printf("tile lacks pool!\n");
-                               continue;
-                       }
-                       BASSERT(tile);
-                       if (tile->is_compressed && ! tile->is_written) 
BLI_remlink(&tile->pool->compressed_tiles, tile);
-                       else if (tile->is_compressed == 0 && tile->is_written 
== 0) BLI_remlink(&tile->pool->tiles, tile);
-               }
-       }
+       BASSERT(buf);
+
        buf->freeBuffer(buf);
        MEM_freeN(buf);
 }

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    
    2008-07-15 01:23:56 UTC (rev 15579)
+++ 
branches/soc-2007-joeedh/source/blender/render/intern/include/render_types.h    
    2008-07-15 02:06:05 UTC (rev 15580)
@@ -232,8 +232,10 @@
        float persmat[4][4];
        float viewmat[4][4];
        float winmat[4][4];
+       float viewmat_uncorrected[4][4];
        float *jit, *weight;
        float d, clipend, clipsta, pixsize, soft;
+       float spotsize;
        int co[3];
        int size, bias;
        ListBase buffers;
@@ -416,8 +418,10 @@
        float r, g, b, k;
        float energy, haint;
        int lay;
-       float spotsi,spotbl;
-       float vec[3];
+       
+       /*the cosine of the spot size angle*/
+       float spotsi;
+       float spotbl, vec[3];
        float xsp, ysp, distkw, inpr;
        float halokw, halo;
        

Modified: 
branches/soc-2007-joeedh/source/blender/render/intern/source/convertblender.c
===================================================================
--- 
branches/soc-2007-joeedh/source/blender/render/intern/source/convertblender.c   
    2008-07-15 01:23:56 UTC (rev 15579)
+++ 
branches/soc-2007-joeedh/source/blender/render/intern/source/convertblender.c   
    2008-07-15 02:06:05 UTC (rev 15580)
@@ -3262,11 +3262,20 @@
        MTC_Mat4Ortho(mat);
        MTC_Mat4Invert(shb->winmat, mat);       /* winmat is temp */
        
-       /* matrix: combination of inverse view and lampmat */
+       /* matrix: combination of inverse view and lampmat.  this is because
+          the render scene is already transformed into camera space.*/
        /* calculate again: the ortho-render has no correct viewinv */
        MTC_Mat4Invert(viewinv, re->viewmat);
-       MTC_Mat4MulMat4(shb->viewmat, viewinv, shb->winmat);
        
+       /*deep shadow maps don't need to compensate for render transform,
+         as they retransform the scene itself.*/
+       //if (lar->buftype != LA_SHADBUF_DEEP) {
+               MTC_Mat4MulMat4(shb->viewmat, viewinv, shb->winmat);
+       //} else {
+               Mat4CpyMat4(shb->viewmat_uncorrected, shb->winmat);
+               //memcpy(shb->viewmat_uncorrected, shb->winmat, 
sizeof(float)*4*4);
+       //}
+
        /* projection */
        shb->d= lar->clipsta;
        shb->clipend= lar->clipend;

Modified: branches/soc-2007-joeedh/source/blender/render/intern/source/dsm.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/render/intern/source/dsm.c  
2008-07-15 01:23:56 UTC (rev 15579)
+++ branches/soc-2007-joeedh/source/blender/render/intern/source/dsm.c  
2008-07-15 02:06:05 UTC (rev 15580)
@@ -1,2496 +1,2750 @@
-/**
- * $Id: dsm.c 12209 2007-10-04 21:41:36Z joeedh $
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2007 by the Blender Foundation.
- * All rights reserved.  Copyright is specifically transferred to
- * the blender foundation by Joseph Eagar.
- *
- * Contributors: Joseph Eagar
-  *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <math.h>
-#include <float.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <string.h>
-
-#include "BLI_arithb.h"
-#include "MTC_matrixops.h"
-#include "BLI_blenlib.h"
-#include "BLI_threads.h"
-#include "BLI_jitter.h"
-#include "BLI_memarena.h"
-
-#include "BKE_tile.h"
-#include "BKE_dsm.h"
-#include "BKE_bucketbuffer.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-
-#include "DNA_material_types.h"
-#include "DNA_object_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_curve_types.h"
-
-#include "RE_render_ext.h"
-#include "RE_shader_ext.h"
-
-#include "gammaCorrectionTables.h"
-#include "pixelblending.h"
-#include "render_types.h"
-#include "renderpipeline.h"
-#include "renderdatabase.h"
-#include "rendercore.h"
-#include "shadbuf.h"
-#include "shading.h"
-#include "sss.h"
-#include "zbuf.h"
-#include "qmc.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BIF_space.h"
-#include "BIF_editview.h"
-
-#include "PIL_time.h"
-
-extern Render R;
-static TCS_TilePool *deepbuffer_pool = NULL;
-
-/* prototypes */
-struct _ClrEntry;
-void DSM_DoTile(Render *re1, float projmat[4][4], ShadBuf *shb, DSMTile *tile, 
-                               DSMBuffer *dbuf, RE_BucketTile *btile, int 
threadnr);
-
-int zbuffer_dsm(Render *re, RenderPart *pa, float winmat[4][4], APixstr 
**lastbuf, 
-                               APixstr **lastbufstrand, APixstr *APixbuf, 
APixstr *APixbufstrand, 
-                               ListBase *apsmbase, unsigned int lay, ShadBuf 
*shb, 
-                               RE_BucketTile *buckettile);
-
-static APixstr *addpsmainA(ListBase *lb);
-static void freepsA(ListBase *lb);
-static APixstr *addpsA(ZSpan *zspan);
-
-/* Modified zbufclipwire from zbuf.c
-  v1 and v2 are in homogenous coordinates.  returns true if 
-  drawing should happen.  v1 and v2 are modified (clipped).*/
-int DSM_zbufclipwire(float clipsta, float clipend, int rectx, int recty, float 
*v1, float *v2);
-
-#define DSM_NONE                       0
-#define DSM_FACE                       1
-#define DSM_FACE_STEP          2
-#define DSM_STRAND                     3
-#define DSM_STRAND_STEP                4
-
-/*internal structures*/
-typedef struct _ClrEntry {
-       struct _ClrEntry *next, *prev;
-       ListBase *srclist;
-       int depth;
-       int p;
-       int mask;
-       int obi;
-       int type;
-       int samplenr;
-       float value;
-       int index; /* color component index */
-} _ClrEntry;
-
-void DSM_MakeTilePool(int maxbytes)
-{
-       deepbuffer_pool = TCS_MakePool(maxbytes, "dsm");
-}
-
-void DSM_FreeTilePool(void)
-{
-       if (deepbuffer_pool) TCS_FreePool(deepbuffer_pool);
-       deepbuffer_pool = NULL;
-}
-
-/*doesn't actually free the DSMBuffer struct, only direct data*/
-void DSM_FreeBuffer(DSMBuffer *dbuf)
-{
-       int i;
-
-       for (i=0; i<dbuf->tilex*dbuf->tiley; i++) {
-               TCS_FreeTile(&dbuf->vfunc_rect[i]);
-               if (dbuf->vfunc_rect[i].arena) 
BLI_memarena_free(dbuf->vfunc_rect[i].arena);
-               if (dbuf->vfunc_rect[i].funcarray) 
MEM_freeN(dbuf->vfunc_rect[i].funcarray);
-       }
-       MEM_freeN(dbuf->vfunc_rect);
-}
-
-typedef struct DeepThreadTile {
-       struct DeepThreadTile *next, *prev;
-       DSMTile *tile;
-       int ready, assigned;
-} DeepThreadTile;
-
-typedef struct DeepThreadData {
-       ListBase *tiles;
-       int threadnr;
-       DSMBuffer *dbuf;
-       float *projmat;
-       RE_BucketBuffer *bucketbuf;
-       Render *re;
-       ShadBuf *shb;
-} DeepThreadData;
-
-void *do_dsmshadow_thread(void *vdata)
-{
-       DeepThreadData *data = vdata;
-       DeepThreadTile *tilet;
-       RE_BucketTile *buckettile;
-       DSMTile *tile;
-       int i;
-
-       for (tilet=data->tiles->first; tilet; tilet=tilet->next) {
-               if (data->re->test_break()) break;
-               if (tilet->assigned) continue;
-
-               BLI_lock_thread(LOCK_CUSTOM1);
-               if (tilet->assigned==0) {
-                       tilet->assigned = 1;
-                       BLI_unlock_thread(LOCK_CUSTOM1);
-                       
-                       tile = tilet->tile;
-                       
-                       tile->funcarray_len = tile->funcarray_buffer = 0;
-
-                       tile->arena = BLI_memarena_new(DSM_TILE_MEMARENASIZE); 
/*FIXMEGREP: tweak this to find optimal value.*/
-                       BLI_memarena_use_mapalloc(tile->arena);
-                       tile->r_rect = BLI_memarena_alloc(tile->arena, 
sizeof(short)*tile->sizex*tile->sizey);
-                       tile->g_rect = BLI_memarena_alloc(tile->arena, 
sizeof(short)*tile->sizex*tile->sizey);
-                       tile->b_rect = BLI_memarena_alloc(tile->arena, 
sizeof(short)*tile->sizex*tile->sizey);
-                       
-                       /*set all the pixels in each *_rect to -1,
-                         signafying that there's no data here.*/
-                       for (i=0; i<tile->sizex*tile->sizey; i++) {
-                               tile->r_rect[i] = tile->g_rect[i] = 
tile->b_rect[i] = -1;
-                       }
-
-                       printf("Rendering a dsm shadow tile! Tile %d of %d\n", 
tile->y*data->dbuf->tilex+tile->x, data->dbuf->tilex*data->dbuf->tiley);
-                       memset(data->dbuf->lastbuf[data->threadnr], 0, 
sizeof(void*)*tile->sizex*tile->sizey);
-                       memset(data->dbuf->lastbufstrand[data->threadnr], 0, 
sizeof(void*)*tile->sizex*tile->sizey);
-

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to