Blender  V2.59
shadbuf.h
Go to the documentation of this file.
00001 /*
00002  * shadbuf_ext.h
00003  *
00004  * $Id: shadbuf.h 35233 2011-02-27 19:31:27Z jesterking $
00005  *
00006  * ***** BEGIN GPL LICENSE BLOCK *****
00007  *
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License
00010  * as published by the Free Software Foundation; either version 2
00011  * of the License, or (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software Foundation,
00020  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00021  *
00022  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00023  * All rights reserved.
00024  *
00025  * The Original Code is: all of this file.
00026  *
00027  * Contributor(s): none yet.
00028  *
00029  * ***** END GPL LICENSE BLOCK *****
00030  */
00031 
00037 #ifndef SHADBUF_EXT_H
00038 #define SHADBUF_EXT_H
00039 
00040 #include "render_types.h"
00041 
00042 struct ObjectRen;
00043 
00048 void makeshadowbuf(struct Render *re, LampRen *lar);
00049 void freeshadowbuf(struct LampRen *lar);
00050 
00051 void threaded_makeshadowbufs(struct Render *re);
00052 
00062 float testshadowbuf(struct Render *re, struct ShadBuf *shb, float *rco, float *dxco, float *dyco, float inp, float mat_bias);   
00063 
00068 float shadow_halo(LampRen *lar, float *p1, float *p2);
00069 
00074 struct MemArena;
00075 struct APixstr;
00076 
00077 void ISB_create(RenderPart *pa, struct APixstr *apixbuf);
00078 void ISB_free(RenderPart *pa);
00079 float ISB_getshadow(ShadeInput *shi, ShadBuf *shb);
00080 
00081 /* data structures have to be accessible both in camview(x, y) as in lampview(x, y) */
00082 /* since they're created per tile rendered, speed goes over memory requirements */
00083 
00084 
00085 /* buffer samples, allocated in camera buffer and pointed to in lampbuffer nodes */
00086 typedef struct ISBSample {
00087         float zco[3];                   /* coordinate in lampview projection */
00088         short *shadfac;                 /* initialized zero = full lighted */
00089         int obi;                                /* object for face lookup */
00090         int facenr;                             /* index in faces list */       
00091 } ISBSample;
00092 
00093 /* transparent version of buffer sample */
00094 typedef struct ISBSampleA {
00095         float zco[3];                           /* coordinate in lampview projection */
00096         short *shadfac;                         /* NULL = full lighted */
00097         int obi;                                        /* object for face lookup */
00098         int facenr;                                     /* index in faces list */       
00099         struct ISBSampleA *next;        /* in end, we want the first items to align with ISBSample */
00100 } ISBSampleA;
00101 
00102 /* used for transparent storage only */
00103 typedef struct ISBShadfacA {
00104         struct ISBShadfacA *next;
00105         int obi;
00106         int facenr;
00107         float shadfac;
00108 } ISBShadfacA;
00109 
00110 /* What needs to be stored to evaluate shadow, for each thread in ShadBuf */
00111 typedef struct ISBData {
00112         short *shadfacs;                                /* simple storage for solid only */
00113         ISBShadfacA **shadfaca;
00114         struct MemArena *memarena;
00115         int minx, miny, rectx, recty;   /* copy from part disprect */
00116 } ISBData;
00117 
00118 #endif /* SHADBUF_EXT_H */
00119