diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-12-04 16:57:28 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-12-04 16:57:28 +0300 |
commit | 32a8b4f8e686938ec2f0f95e6acc2eb3c25ebfdf (patch) | |
tree | ff232d89da0b2f0db1da4becb1980af513ea2274 /source/blender/render/intern/include | |
parent | ebfedd20b290e356f35eb1fcbcb5ddfb8e8bf0a9 (diff) |
Particles
=========
- Fix crash in particle transform with the particle system not editable.
- Particle child distribution and caching is now multithreaded.
- Child particles now have a separate Render Amount next to the existing
Amount. The render amount particles are now only distributed and cached
at render time, which should make editing with child particles faster.
- Two new options for diffuse strand shading:
- Surface Diffuse: computes the strand normal taking the normal at
the surface into account.
- Blending Distance: the distance in Blender units over which to
blend in the normal at the surface.
- Special strand rendering for more memory efficient and faster hair and
grass. This is a work in progress, and has a number of known issues,
don't report bugs to me for this feature yet.
More info:
http://www.blender.org/development/current-projects/changes-since-244/particles/
Diffstat (limited to 'source/blender/render/intern/include')
-rw-r--r-- | source/blender/render/intern/include/render_types.h | 42 | ||||
-rw-r--r-- | source/blender/render/intern/include/renderdatabase.h | 25 | ||||
-rw-r--r-- | source/blender/render/intern/include/shading.h | 5 | ||||
-rw-r--r-- | source/blender/render/intern/include/strand.h | 192 | ||||
-rw-r--r-- | source/blender/render/intern/include/zbuf.h | 1 |
5 files changed, 261 insertions, 4 deletions
diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index c20d27bfcdc..f7f2222e98d 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -48,6 +48,7 @@ struct MemArena; struct VertTableNode; struct VlakTableNode; struct GHash; +struct RenderBuckets; #define TABLEINITSIZE 1024 #define LAMPINITSIZE 256 @@ -159,7 +160,7 @@ struct Render float cfra; /* render database */ - int totvlak, totvert, tothalo, totlamp; + int totvlak, totvert, tothalo, totstrand, totlamp; ListBase lights; /* GroupObject pointers */ ListBase lampren; /* storage, for free */ @@ -167,9 +168,13 @@ struct Render 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 Image *backbuf, *bakebuf; @@ -234,7 +239,7 @@ typedef struct ShadBuf { typedef struct ObjectRen { struct ObjectRen *next, *prev; struct Object *ob, *par; - int index, startvert, endvert, startface, endface; + int index, startvert, endvert, startface, endface, startstrand, endstrand; float *vectors; } ObjectRen; @@ -297,6 +302,36 @@ typedef struct HaloRen struct Material *mat; } HaloRen; +typedef struct StrandVert { + float co[3]; + float strandco; +} StrandVert; + +typedef struct StrandBuffer { + struct StrandBuffer *next, *prev; + struct StrandVert *vert; + int totvert; + + struct Object *ob; + struct Material *ma; + unsigned int lay; + int overrideuv; + int flag, maxdepth; + float adaptcos; + + float winmat[4][4]; + int winx, winy; +} StrandBuffer; + +typedef struct StrandRen { + StrandVert *vert; + StrandBuffer *buffer; + int totvert, flag; + int clip, index; + float orco[3]; +} StrandRen; + + struct LampRen; struct MTex; @@ -417,6 +452,9 @@ typedef struct LampRen { #define R_SNPROJ_Z 4 #define R_FLIPPED_NO 8 +/* strandbuffer->flag */ +#define R_STRAND_BSPLINE 1 +#define R_STRAND_B_UNITS 2 #endif /* RENDER_TYPES_H */ diff --git a/source/blender/render/intern/include/renderdatabase.h b/source/blender/render/intern/include/renderdatabase.h index dc70ade25ae..febf90d9d6e 100644 --- a/source/blender/render/intern/include/renderdatabase.h +++ b/source/blender/render/intern/include/renderdatabase.h @@ -39,6 +39,8 @@ struct Render; struct MCol; struct MTFace; struct CustomData; +struct StrandBuffer; +struct StrandRen; #define RE_QUAD_MASK 0x7FFFFFF #define RE_QUAD_OFFS 0x8000000 @@ -59,9 +61,20 @@ typedef struct VlakTableNode { 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; + int totuv, totmcol; + struct CustomDataNames **names; +} StrandTableNode; + typedef struct CustomDataNames{ struct CustomDataNames *next, *prev; @@ -75,18 +88,20 @@ void free_renderdata_vertnodes(struct VertTableNode *vertnodes); void free_renderdata_vlaknodes(struct VlakTableNode *vlaknodes); void set_normalflags(Render *re); -void project_renderdata(struct Render *re, void (*projectfunc)(float *, float mat[][4], float *), int do_pano, float xoffs); +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); +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); @@ -97,6 +112,12 @@ float *RE_vertren_get_winspeed(struct Render *re, struct VertRen *ver, int verif 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); diff --git a/source/blender/render/intern/include/shading.h b/source/blender/render/intern/include/shading.h index 902899bce94..3390c32ebfe 100644 --- a/source/blender/render/intern/include/shading.h +++ b/source/blender/render/intern/include/shading.h @@ -29,6 +29,9 @@ struct RenderPart; struct RenderLayer; struct PixStr; struct LampRen; +struct VlakRen; +struct StrandSegment; +struct StrandPoint; /* shadeinput.c */ @@ -56,6 +59,8 @@ 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_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); void shade_input_do_shade(struct ShadeInput *shi, struct ShadeResult *shr); void shade_input_initialize(struct ShadeInput *shi, struct RenderPart *pa, struct RenderLayer *rl, int sample); diff --git a/source/blender/render/intern/include/strand.h b/source/blender/render/intern/include/strand.h new file mode 100644 index 00000000000..55c789de764 --- /dev/null +++ b/source/blender/render/intern/include/strand.h @@ -0,0 +1,192 @@ +/* + * $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 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 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 + diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h index ed3f93adfdd..0d88d40e7ac 100644 --- a/source/blender/render/intern/include/zbuf.h +++ b/source/blender/render/intern/include/zbuf.h @@ -50,6 +50,7 @@ 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); 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)); |