Blender V2.61 - r43446

strand.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: none of this file.
00022  *
00023  * Contributor(s): Brecht Van Lommel.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00033 #ifndef STRAND_H
00034 #define STRAND_H 
00035 
00036 struct StrandVert;
00037 struct StrandRen;
00038 struct StrandBuffer;
00039 struct ShadeSample;
00040 struct StrandPart;
00041 struct Render;
00042 struct RenderPart;
00043 struct RenderBuckets;
00044 struct RenderPrimitiveIterator;
00045 struct ZSpan;
00046 struct ObjectInstanceRen;
00047 struct StrandSurface;
00048 struct DerivedMesh;
00049 struct ObjectRen;
00050 
00051 typedef struct StrandPoint {
00052     /* position within segment */
00053     float t;
00054 
00055     /* camera space */
00056     float co[3];
00057     float nor[3];
00058     float tan[3];
00059     float strandco;
00060     float width;
00061 
00062     /* derivatives */
00063     float dtco[3], dsco[3];
00064     float dtstrandco;
00065 
00066     /* outer points */
00067     float co1[3], co2[3];
00068     float hoco1[4], hoco2[4];
00069     float zco1[3], zco2[3];
00070     int clip1, clip2;
00071 
00072     /* screen space */
00073     float hoco[4];
00074     float x, y;
00075 
00076     /* simplification */
00077     float alpha;
00078 } StrandPoint;
00079 
00080 typedef struct StrandSegment {
00081     struct StrandVert *v[4];
00082     struct StrandRen *strand;
00083     struct StrandBuffer *buffer;
00084     struct ObjectInstanceRen *obi;
00085     float sqadaptcos;
00086 
00087     StrandPoint point1, point2;
00088     int shaded;
00089 } StrandSegment;
00090 
00091 struct StrandShadeCache;
00092 typedef struct StrandShadeCache StrandShadeCache;
00093 
00094 void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint);
00095 void render_strand_segment(struct Render *re, float winmat[][4], struct StrandPart *spart, struct ZSpan *zspan, int totzspan, StrandSegment *sseg);
00096 void strand_minmax(struct StrandRen *strand, float *min, float *max, float width);
00097 
00098 struct StrandSurface *cache_strand_surface(struct Render *re, struct ObjectRen *obr, struct DerivedMesh *dm, float mat[][4], int timeoffset);
00099 void free_strand_surface(struct Render *re);
00100 
00101 struct StrandShadeCache *strand_shade_cache_create(void);
00102 void strand_shade_cache_free(struct StrandShadeCache *cache);
00103 void strand_shade_segment(struct Render *re, struct StrandShadeCache *cache, struct StrandSegment *sseg, struct ShadeSample *ssamp, float t, float s, int addpassflag);
00104 void strand_shade_unref(struct StrandShadeCache *cache, struct StrandVert *svert);
00105 
00106 struct RenderBuckets *init_buckets(struct Render *re);
00107 void add_buckets_primitive(struct RenderBuckets *buckets, float *min, float *max, void *prim);
00108 void free_buckets(struct RenderBuckets *buckets);
00109 void project_hoco_to_bucket(struct RenderBuckets *buckets, float *hoco, float *bucketco);
00110 
00111 struct RenderPrimitiveIterator *init_primitive_iterator(struct Render *re, struct RenderBuckets *buckets, struct RenderPart *pa);
00112 void *next_primitive_iterator(struct RenderPrimitiveIterator *iter);
00113 void free_primitive_iterator(struct RenderPrimitiveIterator *iter);
00114 
00115 #endif
00116