|
Blender
V2.59
|
00001 /* 00002 * $Id: zbuf.h 35233 2011-02-27 19:31:27Z jesterking $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00021 * All rights reserved. 00022 * 00023 * Full recode: 2004-2006 Blender Foundation 00024 * 00025 * Contributor(s): none yet. 00026 * 00027 * ***** END GPL/BL DUAL LICENSE BLOCK ***** 00028 */ 00029 00035 #ifndef ZBUF_H 00036 #define ZBUF_H 00037 00038 struct RenderPart; 00039 struct RenderLayer; 00040 struct LampRen; 00041 struct VlakRen; 00042 struct ListBase; 00043 struct ZSpan; 00044 struct APixstrand; 00045 struct APixstr; 00046 struct StrandShadeCache; 00047 00048 void fillrect(int *rect, int x, int y, int val); 00049 00054 void projectvert(float *v1, float winmat[][4], float *adr); 00055 void projectverto(float *v1, float winmat[][4], float *adr); 00056 int testclip(float *v); 00057 00058 void zbuffer_shadow(struct Render *re, float winmat[][4], struct LampRen *lar, int *rectz, int size, float jitx, float jity); 00059 void zbuffer_abuf_shadow(struct Render *re, struct LampRen *lar, float winmat[][4], struct APixstr *APixbuf, struct APixstrand *apixbuf, struct ListBase *apsmbase, int size, int samples, float (*jit)[2]); 00060 void zbuffer_solid(struct RenderPart *pa, struct RenderLayer *rl, void (*fillfunc)(struct RenderPart*, struct ZSpan*, int, void*), void *data); 00061 00062 unsigned short *zbuffer_transp_shade(struct RenderPart *pa, struct RenderLayer *rl, float *pass, struct ListBase *psmlist); 00063 void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(void*, int, int, int, int, int)); 00064 int zbuffer_strands_abuf(struct Render *re, struct RenderPart *pa, struct APixstrand *apixbuf, struct ListBase *apsmbase, unsigned int lay, int negzmask, float winmat[][4], int winx, int winy, int sample, float (*jit)[2], float clipcrop, int shadow, struct StrandShadeCache *cache); 00065 00066 typedef struct APixstr { 00067 unsigned short mask[4]; /* jitter mask */ 00068 int z[4]; /* distance */ 00069 int p[4]; /* index */ 00070 int obi[4]; /* object instance */ 00071 short shadfac[4]; /* optimize storage for irregular shadow */ 00072 struct APixstr *next; 00073 } APixstr; 00074 00075 typedef struct APixstrand { 00076 unsigned short mask[4]; /* jitter mask */ 00077 int z[4]; /* distance */ 00078 int p[4]; /* index */ 00079 int obi[4]; /* object instance */ 00080 int seg[4]; /* for strands, segment number */ 00081 float u[4], v[4]; /* for strands, u,v coordinate in segment */ 00082 struct APixstrand *next; 00083 } APixstrand; 00084 00085 typedef struct APixstrMain 00086 { 00087 struct APixstrMain *next, *prev; 00088 void *ps; 00089 } APixstrMain; 00090 00091 /* span fill in method, is also used to localize data for zbuffering */ 00092 typedef struct ZSpan { 00093 int rectx, recty; /* range for clipping */ 00094 00095 int miny1, maxy1, miny2, maxy2; /* actual filled in range */ 00096 float *minp1, *maxp1, *minp2, *maxp2; /* vertex pointers detect min/max range in */ 00097 float *span1, *span2; 00098 00099 float zmulx, zmuly, zofsx, zofsy; /* transform from hoco to zbuf co */ 00100 00101 int *rectz, *arectz; /* zbuffers, arectz is for transparant */ 00102 int *rectz1; /* seconday z buffer for shadowbuffer (2nd closest z) */ 00103 int *rectp; /* polygon index buffer */ 00104 int *recto; /* object buffer */ 00105 int *rectmask; /* negative zmask buffer */ 00106 APixstr *apixbuf, *curpstr; /* apixbuf for transparent */ 00107 APixstrand *curpstrand; /* same for strands */ 00108 struct ListBase *apsmbase; 00109 00110 int polygon_offset; /* offset in Z */ 00111 float shad_alpha; /* copy from material, used by irregular shadbuf */ 00112 int mask, apsmcounter; /* in use by apixbuf */ 00113 int apstrandmcounter; 00114 00115 float clipcrop; /* for shadow, was in R global before */ 00116 00117 void *sss_handle; /* used by sss */ 00118 void (*sss_func)(void *, int, int, int, int, int); 00119 00120 void (*zbuffunc)(struct ZSpan *, int, int, float *, float *, float *, float *); 00121 void (*zbuflinefunc)(struct ZSpan *, int, int, float *, float *); 00122 00123 } ZSpan; 00124 00125 /* exported to shadbuf.c */ 00126 void zbufclip4(struct ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3, float *f4, int c1, int c2, int c3, int c4); 00127 void zbuf_free_span(struct ZSpan *zspan); 00128 void freepsA(struct ListBase *lb); 00129 00130 /* to rendercore.c */ 00131 void zspan_scanconvert(struct ZSpan *zpan, void *handle, float *v1, float *v2, float *v3, void (*func)(void *, int, int, float, float) ); 00132 00133 /* exported to edge render... */ 00134 void zbufclip(struct ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3, int c1, int c2, int c3); 00135 void zbuf_alloc_span(struct ZSpan *zspan, int rectx, int recty, float clipcrop); 00136 void zbufclipwire(struct ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *ho2, float *ho3, float *ho4, int c1, int c2, int c3, int c4); 00137 00138 /* exported to shadeinput.c */ 00139 void zbuf_make_winmat(Render *re, float winmat[][4]); 00140 void zbuf_render_project(float winmat[][4], float *co, float *ho); 00141 00142 #endif 00143