Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2007-12-15 23:41:45 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2007-12-15 23:41:45 +0300
commit460dd7a7bbd43526e684bde96fcb6098676afdc8 (patch)
tree84f48511c9fbc9cf3bef84e139b22191cd581e1f /source/blender/render/intern/include
parentdbc8e1e883c136ffa69e7216370bc5100fad5970 (diff)
Render Instancing
================= Big commit, but little user visible changes. - Dupliverts and duplifaces are now rendered as instances, instead of storing all of the geometry for each dupli, now an instance is created with a matrix transform refering to the source object. This should allow us to render tree leaves more memory efficient. - Radiosity and to some degree raytracing of such objects is not really efficient still. For radiosity this is fundamentally hard to solve, but raytracing an octree could be created for each object, but the current octree code with it's fixed size doesn't allow this efficiently. - The regression tests survived, but with I expect that some bugs will pop up .. hopefully not too many :). Implementation Notes ==================== - Dupligroups and linked meshes are not rendered as instances yet, since they can in fact be different due to various reasons, instancing of these types of duplis that are the same can be added for them at a later point. - Each ObjectRen now stores it's own database, instead of there being one big databases of faces, verts, .. . Which objects that are actually rendered are defined by the list of ObjectRenInstances, which all refer to an ObjectRen. - Homogeneous coordinatess and clipping is now not stored in vertices anymore, but instead computed on the fly. This couldn't work for instances. That does mean some extra computation has to be done, but memory lookups can be slow too, and this saves some memory. Overall I didn't find a significant speed impact. - OSA rendering for solid and ztransp now is different. Instead of e.g. going 8 times over the databases times and rendering the z-buffer, it now goes over the database once and renders each polygon 8 times. That was necessary to keep instances efficient, and can also give some performance improvement without instances. - There was already instancing support in the yafray export code, now it uses Blender's render instances for export. - UV and color layer storage in the render was a bit messy before, now should be easier to understand. - convertblender.c was reorganized somewhat. Regular render, speedvector and baking now use a single function to create the database, previously there was code duplicated for it. - Some of these changes were done with future multithreading of scene and shadow buffer creation in mind, though especially for scene creation much work remains to be done to make it threadsafe, since it also involves a lot of code from blenkernel, and there is an ugly conflict with the way dupli groups work here .. though in the render code itself it's almost there.
Diffstat (limited to 'source/blender/render/intern/include')
-rw-r--r--source/blender/render/intern/include/render_types.h77
-rw-r--r--source/blender/render/intern/include/rendercore.h3
-rw-r--r--source/blender/render/intern/include/renderdatabase.h85
-rw-r--r--source/blender/render/intern/include/shadbuf.h5
-rw-r--r--source/blender/render/intern/include/shading.h6
-rw-r--r--source/blender/render/intern/include/strand.h100
-rw-r--r--source/blender/render/intern/include/zbuf.h35
7 files changed, 126 insertions, 185 deletions
diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h
index f7f2222e98d..84230bd4f6d 100644
--- a/source/blender/render/intern/include/render_types.h
+++ b/source/blender/render/intern/include/render_types.h
@@ -49,6 +49,7 @@ struct VertTableNode;
struct VlakTableNode;
struct GHash;
struct RenderBuckets;
+struct ObjectInstanceRen;
#define TABLEINITSIZE 1024
#define LAMPINITSIZE 256
@@ -81,13 +82,15 @@ typedef struct RenderPart
/* result of part rendering */
RenderResult *result;
+ int *recto; /* object table for objects */
int *rectp; /* polygon index table */
int *rectz; /* zbuffer */
long *rectdaps; /* delta acum buffer for pixel structs */
+ int *rectbacko; /* object table for backside sss */
int *rectbackp; /* polygon index table for backside sss */
int *rectbackz; /* zbuffer for backside sss */
long *rectall; /* buffer for all faces for sss */
-
+
rcti disprect; /* part coordinates within total picture */
int rectx, recty; /* the size */
short crop, ready; /* crop is amount of pixels we crop, for filter */
@@ -161,21 +164,19 @@ struct Render
/* render database */
int totvlak, totvert, tothalo, totstrand, totlamp;
+ struct HaloRen **sortedhalos;
+
ListBase lights; /* GroupObject pointers */
ListBase lampren; /* storage, for free */
- int vertnodeslen;
- struct VertTableNode *vertnodes;
- int vlaknodeslen;
- struct VlakTableNode *vlaknodes;
- int strandnodeslen;
- struct StrandTableNode *strandnodes;
- int blohalen;
- struct HaloRen **bloha;
ListBase objecttable;
- ListBase strandbufs;
struct RenderBuckets *strandbuckets;
+ struct ObjectInstanceRen *objectinstance;
+ ListBase instancetable;
+ struct GHash *objecthash;
+ int totinstance;
+
struct Image *backbuf, *bakebuf;
struct GHash *orco_hash;
@@ -235,23 +236,48 @@ typedef struct ShadBuf {
} ShadBuf;
/* ------------------------------------------------------------------------- */
-/* lookup of objects in database */
+
typedef struct ObjectRen {
struct ObjectRen *next, *prev;
struct Object *ob, *par;
- int index, startvert, endvert, startface, endface, startstrand, endstrand;
- float *vectors;
+ struct Scene *sce;
+ int index, psysindex;
+
+ int totvert, totvlak, totstrand, tothalo;
+ int vertnodeslen, vlaknodeslen, strandnodeslen, blohalen;
+ struct VertTableNode *vertnodes;
+ struct VlakTableNode *vlaknodes;
+ struct StrandTableNode *strandnodes;
+ struct HaloRen **bloha;
+ ListBase strandbufs;
+
+ char (*mtface)[32];
+ char (*mcol)[32];
+ int actmtface, actmcol;
} ObjectRen;
+typedef struct ObjectInstanceRen {
+ struct ObjectInstanceRen *next, *prev;
+
+ ObjectRen *obr;
+ Object *ob, *par;
+ int index, psysindex;
+
+ float mat[4][4], imat[3][3];
+ short flag;
+
+ float *vectors;
+ int totvector;
+} ObjectInstanceRen;
+
/* ------------------------------------------------------------------------- */
typedef struct VertRen
{
float co[3];
float n[3];
- float ho[4];
float *orco;
- short clip;
+ short clip;
unsigned short flag; /* in use for clipping zbuffer parts, temp setting stuff in convertblender.c */
float accum; /* accum for radio weighting, and for strand texco static particles */
int index; /* index allows extending vertren with any property */
@@ -279,10 +305,10 @@ typedef struct VlakRen {
unsigned int lay;
float n[3];
struct Material *mat;
- char noflag, puno;
+ char puno;
char flag, ec;
RadFace *radface;
- Object *ob;
+ ObjectRen *obr;
int index;
} VlakRen;
@@ -312,7 +338,7 @@ typedef struct StrandBuffer {
struct StrandVert *vert;
int totvert;
- struct Object *ob;
+ struct ObjectRen *obr;
struct Material *ma;
unsigned int lay;
int overrideuv;
@@ -393,7 +419,7 @@ typedef struct LampRen {
short xold[BLENDER_MAX_THREADS], yold[BLENDER_MAX_THREADS]; /* last jitter table for area lights */
float area_size, area_sizey, area_sizez;
float adapt_thresh;
-
+
struct ShadBuf *shb;
float *jitter;
QMCSampler *qsa;
@@ -417,6 +443,7 @@ typedef struct LampRen {
/* ray optim */
VlakRen *vlr_last[BLENDER_MAX_THREADS];
+ ObjectInstanceRen *obi_last[BLENDER_MAX_THREADS];
struct MTex *mtex[MAX_MTEX];
} LampRen;
@@ -435,7 +462,7 @@ typedef struct LampRen {
/* vlakren->flag (vlak = face in dutch) char!!! */
#define R_SMOOTH 1
-#define R_VISIBLE 2
+#define R_HIDDEN 2
/* strand flag, means special handling */
#define R_STRAND 4
#define R_NOPUNOFLIP 8
@@ -446,16 +473,14 @@ typedef struct LampRen {
/* vertex normals are tangent or view-corrected vector, for hair strands */
#define R_TANGENT 128
-/* vlakren->noflag (char) */
-#define R_SNPROJ_X 1
-#define R_SNPROJ_Y 2
-#define R_SNPROJ_Z 4
-#define R_FLIPPED_NO 8
-
/* strandbuffer->flag */
#define R_STRAND_BSPLINE 1
#define R_STRAND_B_UNITS 2
+/* objectinstance->flag */
+#define R_DUPLI_TRANSFORMED 1
+#define R_ENV_TRANSFORMED 2
+#define R_TRANSFORMED (1|2)
#endif /* RENDER_TYPES_H */
diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h
index 0d807d56180..600ece8ad50 100644
--- a/source/blender/render/intern/include/rendercore.h
+++ b/source/blender/render/intern/include/rendercore.h
@@ -49,13 +49,14 @@ struct ShadeResult;
struct World;
struct RenderPart;
struct RenderLayer;
+struct ObjectRen;
/* ------------------------------------------------------------------------- */
typedef struct PixStr
{
struct PixStr *next;
- int facenr, z;
+ int obi, facenr, z;
unsigned short mask;
short shadfac;
} PixStr;
diff --git a/source/blender/render/intern/include/renderdatabase.h b/source/blender/render/intern/include/renderdatabase.h
index febf90d9d6e..0346f2d6413 100644
--- a/source/blender/render/intern/include/renderdatabase.h
+++ b/source/blender/render/intern/include/renderdatabase.h
@@ -41,6 +41,7 @@ struct MTFace;
struct CustomData;
struct StrandBuffer;
struct StrandRen;
+struct ObjectInstanceRen;
#define RE_QUAD_MASK 0x7FFFFFF
#define RE_QUAD_OFFS 0x8000000
@@ -58,71 +59,65 @@ typedef struct VertTableNode {
typedef struct VlakTableNode {
struct VlakRen *vlak;
- struct MTFace **mtface;
- struct MCol **mcol;
+ struct MTFace *mtface;
+ struct MCol *mcol;
int totmtface, totmcol;
float *surfnor;
- struct CustomDataNames **names;
} VlakTableNode;
typedef struct StrandTableNode {
struct StrandRen *strand;
float *winspeed;
float *surfnor;
- struct MCol **mcol;
- float **uv;
+ struct MCol *mcol;
+ float *uv;
int totuv, totmcol;
- struct CustomDataNames **names;
} StrandTableNode;
-typedef struct CustomDataNames{
- struct CustomDataNames *next, *prev;
-
- char (*mtface)[32];
- char (*mcol)[32];
-} CustomDataNames;
-
/* renderdatabase.c */
void free_renderdata_tables(struct Render *re);
void free_renderdata_vertnodes(struct VertTableNode *vertnodes);
void free_renderdata_vlaknodes(struct VlakTableNode *vlaknodes);
-void set_normalflags(Render *re);
+void set_normalflags(struct Render *re, struct ObjectRen *obr);
void project_renderdata(struct Render *re, void (*projectfunc)(float *, float mat[][4], float *), int do_pano, float xoffs, int do_buckets);
/* functions are not exported... so wrong names */
-struct VlakRen *RE_findOrAddVlak(struct Render *re, int nr);
-struct VertRen *RE_findOrAddVert(struct Render *re, int nr);
-struct StrandRen *RE_findOrAddStrand(struct Render *re, int nr);
-struct HaloRen *RE_findOrAddHalo(struct Render *re, int nr);
-struct HaloRen *RE_inithalo(struct Render *re, struct Material *ma, float *vec, float *vec1, float *orco, float hasize,
- float vectsize, int seed);
-struct HaloRen *RE_inithalo_particle(struct Render *re, struct DerivedMesh *dm, struct Material *ma, float *vec, float *vec1,
- float *orco, float *uvco, float hasize, float vectsize, int seed);
-void RE_addRenderObject(struct Render *re, struct Object *ob, struct Object *par, int index, int sve, int eve, int sfa, int efa, int sst, int est);
-struct StrandBuffer *RE_addStrandBuffer(struct Render *re, struct Object *ob, int totvert);
-
-float *RE_vertren_get_sticky(struct Render *re, struct VertRen *ver, int verify);
-float *RE_vertren_get_stress(struct Render *re, struct VertRen *ver, int verify);
-float *RE_vertren_get_rad(struct Render *re, struct VertRen *ver, int verify);
-float *RE_vertren_get_strand(struct Render *re, struct VertRen *ver, int verify);
-float *RE_vertren_get_tangent(struct Render *re, struct VertRen *ver, int verify);
-float *RE_vertren_get_winspeed(struct Render *re, struct VertRen *ver, int verify);
-
-struct MTFace *RE_vlakren_get_tface(struct Render *re, VlakRen *ren, int n, char **name, int verify);
-struct MCol *RE_vlakren_get_mcol(struct Render *re, VlakRen *ren, int n, char **name, int verify);
-float *RE_vlakren_get_surfnor(struct Render *re, VlakRen *ren, int verify);
-
-float *RE_strandren_get_winspeed(struct Render *re, struct StrandRen *strand, int verify);
-float *RE_strandren_get_surfnor(struct Render *re, struct StrandRen *strand, int verify);
-float *RE_strandren_get_uv(struct Render *re, struct StrandRen *strand, int n, char **name, int verify);
-struct MCol *RE_strandren_get_mcol(struct Render *re, struct StrandRen *strand, int n, char **name, int verify);
-
-struct VertRen *RE_vertren_copy(struct Render *re, struct VertRen *ver);
-struct VlakRen *RE_vlakren_copy(struct Render *re, struct VlakRen *vlr);
-
-void RE_vlakren_set_customdata_names(struct Render *re, struct CustomData *data);
+struct VlakRen *RE_findOrAddVlak(struct ObjectRen *obr, int nr);
+struct VertRen *RE_findOrAddVert(struct ObjectRen *obr, int nr);
+struct StrandRen *RE_findOrAddStrand(struct ObjectRen *obr, int nr);
+struct HaloRen *RE_findOrAddHalo(struct ObjectRen *obr, int nr);
+struct HaloRen *RE_inithalo(struct Render *re, struct ObjectRen *obr, struct Material *ma, float *vec, float *vec1, float *orco, float hasize, float vectsize, int seed);
+struct HaloRen *RE_inithalo_particle(struct Render *re, struct ObjectRen *obr, struct DerivedMesh *dm, struct Material *ma, float *vec, float *vec1, float *orco, float *uvco, float hasize, float vectsize, int seed);
+struct StrandBuffer *RE_addStrandBuffer(struct ObjectRen *obr, int totvert);
+
+struct ObjectRen *RE_addRenderObject(struct Render *re, struct Object *ob, struct Object *par, int index, int psysindex);
+void RE_addRenderInstance(struct Render *re, struct ObjectRen *obr, struct Object *ob, struct Object *par, int index, int psysindex, float mat[][4]);
+void RE_makeRenderInstances(struct Render *re);
+void RE_instanceTransformNormal(struct ObjectInstanceRen *obi, float *nor, float *tnor);
+
+float *RE_vertren_get_sticky(struct ObjectRen *obr, struct VertRen *ver, int verify);
+float *RE_vertren_get_stress(struct ObjectRen *obr, struct VertRen *ver, int verify);
+float *RE_vertren_get_rad(struct ObjectRen *obr, struct VertRen *ver, int verify);
+float *RE_vertren_get_strand(struct ObjectRen *obr, struct VertRen *ver, int verify);
+float *RE_vertren_get_tangent(struct ObjectRen *obr, struct VertRen *ver, int verify);
+float *RE_vertren_get_winspeed(struct ObjectInstanceRen *obi, struct VertRen *ver, int verify);
+
+struct MTFace *RE_vlakren_get_tface(struct ObjectRen *obr, VlakRen *ren, int n, char **name, int verify);
+struct MCol *RE_vlakren_get_mcol(struct ObjectRen *obr, VlakRen *ren, int n, char **name, int verify);
+float *RE_vlakren_get_surfnor(struct ObjectRen *obr, VlakRen *ren, int verify);
+int RE_vlakren_get_normal(struct Render *re, struct ObjectInstanceRen *obi, struct VlakRen *vlr, float *nor);
+
+float *RE_strandren_get_surfnor(struct ObjectRen *obr, struct StrandRen *strand, int verify);
+float *RE_strandren_get_uv(struct ObjectRen *obr, struct StrandRen *strand, int n, char **name, int verify);
+struct MCol *RE_strandren_get_mcol(struct ObjectRen *obr, struct StrandRen *strand, int n, char **name, int verify);
+float *RE_strandren_get_winspeed(struct ObjectInstanceRen *obi, struct StrandRen *strand, int verify);
+
+struct VertRen *RE_vertren_copy(struct ObjectRen *obr, struct VertRen *ver);
+struct VlakRen *RE_vlakren_copy(struct ObjectRen *obr, struct VlakRen *vlr);
+
+void RE_set_customdata_names(struct ObjectRen *obr, struct CustomData *data);
/* haloren->type: flags */
#define HA_ONLYSKY 1
diff --git a/source/blender/render/intern/include/shadbuf.h b/source/blender/render/intern/include/shadbuf.h
index 8b786c6e098..b4f196a89fa 100644
--- a/source/blender/render/intern/include/shadbuf.h
+++ b/source/blender/render/intern/include/shadbuf.h
@@ -37,6 +37,8 @@
#include "render_types.h"
+struct ObjectRen;
+
/**
* Calculates shadowbuffers for a vector of shadow-giving lamps
* @param lar The vector of lamps
@@ -80,6 +82,7 @@ float ISB_getshadow(ShadeInput *shi, ShadBuf *shb);
typedef struct ISBSample {
float zco[3]; /* coordinate in lampview projection */
short *shadfac; /* initialized zero = full lighted */
+ int obi; /* object for face lookup */
int facenr; /* index in faces list */
} ISBSample;
@@ -87,6 +90,7 @@ typedef struct ISBSample {
typedef struct ISBSampleA {
float zco[3]; /* coordinate in lampview projection */
short *shadfac; /* NULL = full lighted */
+ int obi; /* object for face lookup */
int facenr; /* index in faces list */
struct ISBSampleA *next; /* in end, we want the first items to align with ISBSample */
} ISBSampleA;
@@ -94,6 +98,7 @@ typedef struct ISBSampleA {
/* used for transparent storage only */
typedef struct ISBShadfacA {
struct ISBShadfacA *next;
+ int obi;
int facenr;
float shadfac;
} ISBShadfacA;
diff --git a/source/blender/render/intern/include/shading.h b/source/blender/render/intern/include/shading.h
index 3390c32ebfe..6ca63a2976d 100644
--- a/source/blender/render/intern/include/shading.h
+++ b/source/blender/render/intern/include/shading.h
@@ -32,6 +32,7 @@ struct LampRen;
struct VlakRen;
struct StrandSegment;
struct StrandPoint;
+struct ObjectInstanceRen obi;
/* shadeinput.c */
@@ -52,12 +53,13 @@ typedef struct ShadeSample {
/* also the node shader callback */
void shade_material_loop(struct ShadeInput *shi, struct ShadeResult *shr);
-void shade_input_set_triangle_i(struct ShadeInput *shi, struct VlakRen *vlr, short i1, short i2, short i3);
-void shade_input_set_triangle(struct ShadeInput *shi, volatile int facenr, int normal_flip);
+void shade_input_set_triangle_i(struct ShadeInput *shi, struct ObjectInstanceRen *obi, struct VlakRen *vlr, short i1, short i2, short i3);
+void shade_input_set_triangle(struct ShadeInput *shi, volatile int obi, volatile int facenr, int normal_flip);
void shade_input_copy_triangle(struct ShadeInput *shi, struct ShadeInput *from);
void shade_input_set_viewco(struct ShadeInput *shi, float x, float y, float z);
void shade_input_set_uv(struct ShadeInput *shi);
void shade_input_set_normals(struct ShadeInput *shi);
+void shade_input_flip_normals(struct ShadeInput *shi);
void shade_input_set_shade_texco(struct ShadeInput *shi);
void shade_input_set_strand(struct ShadeInput *shi, struct StrandRen *strand, struct StrandPoint *spoint);
void shade_input_set_strand_texco(struct ShadeInput *shi, struct StrandRen *strand, struct StrandVert *svert, struct StrandPoint *spoint);
diff --git a/source/blender/render/intern/include/strand.h b/source/blender/render/intern/include/strand.h
index 55c789de764..7f37317d4d5 100644
--- a/source/blender/render/intern/include/strand.h
+++ b/source/blender/render/intern/include/strand.h
@@ -43,6 +43,7 @@ struct RenderPart;
struct RenderBuckets;
struct RenderPrimitiveIterator;
struct ZSpan;
+struct ObjectInstanceRen;
typedef struct StrandPoint {
/* position within segment */
@@ -73,6 +74,7 @@ typedef struct StrandSegment {
struct StrandVert *v[4];
struct StrandRen *strand;
struct StrandBuffer *buffer;
+ struct ObjectInstanceRen *obi;
float sqadaptcos;
StrandPoint point1, point2;
@@ -80,103 +82,7 @@ typedef struct StrandSegment {
} StrandSegment;
void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint);
-void render_strand_segment(struct Render *re, struct StrandPart *spart, struct ZSpan *zspan, StrandSegment *sseg);
-void project_strands(Render *re, void (*projectfunc)(float *, float mat[][4], float *), int do_pano, int do_buckets);
-
-struct RenderBuckets *init_buckets(struct Render *re);
-void add_buckets_primitive(struct RenderBuckets *buckets, float *min, float *max, void *prim);
-void free_buckets(struct RenderBuckets *buckets);
-void project_hoco_to_bucket(struct RenderBuckets *buckets, float *hoco, float *bucketco);
-
-struct RenderPrimitiveIterator *init_primitive_iterator(struct Render *re, struct RenderBuckets *buckets, struct RenderPart *pa);
-void *next_primitive_iterator(struct RenderPrimitiveIterator *iter);
-void free_primitive_iterator(struct RenderPrimitiveIterator *iter);
-
-#endif
-
-/*
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: none of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifndef STRAND_H
-#define STRAND_H
-
-struct StrandVert;
-struct StrandRen;
-struct StrandBuffer;
-struct ShadeSample;
-struct StrandPart;
-struct Render;
-struct RenderPart;
-struct RenderBuckets;
-struct RenderPrimitiveIterator;
-struct ZSpan;
-
-typedef struct StrandPoint {
- /* position within segment */
- float t;
-
- /* camera space */
- float co[3];
- float nor[3];
- float tan[3];
- float strandco;
- float width;
-
- /* derivatives */
- float dtco[3], dsco[3];
- float dtstrandco;
-
- /* outer points */
- float co1[3], co2[3];
- float hoco1[4], hoco2[4];
- float zco1[3], zco2[3];
-
- /* screen space */
- float hoco[4];
- float x, y;
-} StrandPoint;
-
-typedef struct StrandSegment {
- struct StrandVert *v[4];
- struct StrandRen *strand;
- struct StrandBuffer *buffer;
- float sqadaptcos;
-
- StrandPoint point1, point2;
- int shaded;
-} StrandSegment;
-
-void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint);
-void render_strand_segment(struct Render *re, struct StrandPart *spart, struct ZSpan *zspan, StrandSegment *sseg);
+void render_strand_segment(struct Render *re, float winmat[][4], struct StrandPart *spart, struct ZSpan *zspan, StrandSegment *sseg);
void project_strands(Render *re, void (*projectfunc)(float *, float mat[][4], float *), int do_pano, int do_buckets);
struct RenderBuckets *init_buckets(struct Render *re);
diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h
index 0d88d40e7ac..5f1aa5679bf 100644
--- a/source/blender/render/intern/include/zbuf.h
+++ b/source/blender/render/intern/include/zbuf.h
@@ -35,6 +35,7 @@ struct RenderLayer;
struct LampRen;
struct VlakRen;
struct ListBase;
+struct ZSpan;
void fillrect(int *rect, int x, int y, int val);
@@ -46,19 +47,20 @@ void projectvert(float *v1, float winmat[][4], float *adr);
void projectverto(float *v1, float winmat[][4], float *adr);
int testclip(float *v);
-void set_part_zbuf_clipflag(struct RenderPart *pa);
-void zbuffer_shadow(struct Render *re, struct LampRen *lar, int *rectz, int size, float jitx, float jity);
-void zbuffer_solid(struct RenderPart *pa, unsigned int layer, short layflag);
+void zbuffer_shadow(struct Render *re, float winmat[][4], struct LampRen *lar, int *rectz, int size, float jitx, float jity);
+void zbuffer_solid(struct RenderPart *pa, unsigned int layer, short layflag, void (*fillfunc)(struct RenderPart*, struct ZSpan*, int, void*), void *data);
+
unsigned short *zbuffer_transp_shade(struct RenderPart *pa, struct RenderLayer *rl, float *pass);
unsigned short *zbuffer_strands_shade(struct Render *re, struct RenderPart *pa, struct RenderLayer *rl, float *pass);
void convert_zbuf_to_distbuf(struct RenderPart *pa, struct RenderLayer *rl);
-void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(void *, int, int, int, int));
+void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(void*, int, int, int, int, int));
typedef struct APixstr {
- unsigned short mask[4]; /* jitter mask */
- int z[4]; /* distance */
- int p[4]; /* index */
- short shadfac[4]; /* optimize storage for irregular shadow */
+ unsigned short mask[4]; /* jitter mask */
+ int z[4]; /* distance */
+ int p[4]; /* index */
+ int obi[4]; /* object instance */
+ short shadfac[4]; /* optimize storage for irregular shadow */
struct APixstr *next;
} APixstr;
@@ -81,6 +83,7 @@ typedef struct ZSpan {
int *rectz, *arectz; /* zbuffers, arectz is for transparant */
int *rectz1; /* seconday z buffer for shadowbuffer (2nd closest z) */
int *rectp; /* polygon index buffer */
+ int *recto; /* object buffer */
APixstr *apixbuf, *curpstr; /* apixbuf for transparent */
struct ListBase *apsmbase;
@@ -89,24 +92,28 @@ typedef struct ZSpan {
int mask, apsmcounter; /* in use by apixbuf */
void *sss_handle; /* used by sss */
- void (*sss_func)(void *, int, int, int, int);
+ void (*sss_func)(void *, int, int, int, int, int);
- void (*zbuffunc)(struct ZSpan *, int, float *, float *, float *, float *);
- void (*zbuflinefunc)(struct ZSpan *, int, float *, float *);
+ void (*zbuffunc)(struct ZSpan *, int, int, float *, float *, float *, float *);
+ void (*zbuflinefunc)(struct ZSpan *, int, int, float *, float *);
} ZSpan;
/* exported to shadbuf.c */
-void zbufclip4(struct ZSpan *zspan, int zvlnr, float *f1, float *f2, float *f3, float *f4, int c1, int c2, int c3, int c4);
+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);
void zbuf_free_span(struct ZSpan *zspan);
/* to rendercore.c */
void zspan_scanconvert(struct ZSpan *zpan, void *handle, float *v1, float *v2, float *v3, void (*func)(void *, int, int, float, float) );
/* exported to edge render... */
-void zbufclip(struct ZSpan *zspan, int zvlnr, float *f1, float *f2, float *f3, int c1, int c2, int c3);
+void zbufclip(struct ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3, int c1, int c2, int c3);
void zbuf_alloc_span(struct ZSpan *zspan, int rectx, int recty);
-void zbufclipwire(struct ZSpan *zspan, int zvlnr, struct VlakRen *vlr);
+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);
+
+/* exported to shadeinput.c */
+void zbuf_make_winmat(Render *re, float duplimat[][4], float winmat[][4]);
+void zbuf_render_project(float winmat[][4], float *co, float *ho);
#endif