Blender V2.61 - r43446

shadbuf.h

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