diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-08 09:10:35 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-08 09:10:35 +0300 |
commit | 908b6960c01ffb1665af56ff6f03aaa3eac5366a (patch) | |
tree | db609864fbe601073212b4c37541a7965ea96ea5 /source/blender/render/intern/include | |
parent | d352a0adc5dadd0bfdc3b1b1ac76d92be689966b (diff) | |
parent | a25c11fd8d602236f36c34c342453149bdc1d909 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/render/intern/include')
-rw-r--r-- | source/blender/render/intern/include/envmap.h | 54 | ||||
-rw-r--r-- | source/blender/render/intern/include/initrender.h | 2 | ||||
-rw-r--r-- | source/blender/render/intern/include/pixelblending.h | 65 | ||||
-rw-r--r-- | source/blender/render/intern/include/pixelshading.h | 62 | ||||
-rw-r--r-- | source/blender/render/intern/include/pointdensity.h | 51 | ||||
-rw-r--r-- | source/blender/render/intern/include/raycounter.h | 74 | ||||
-rw-r--r-- | source/blender/render/intern/include/rayintersection.h | 136 | ||||
-rw-r--r-- | source/blender/render/intern/include/render_types.h | 34 | ||||
-rw-r--r-- | source/blender/render/intern/include/rendercore.h | 105 | ||||
-rw-r--r-- | source/blender/render/intern/include/shading.h | 105 | ||||
-rw-r--r-- | source/blender/render/intern/include/strand.h | 99 | ||||
-rw-r--r-- | source/blender/render/intern/include/sunsky.h | 81 | ||||
-rw-r--r-- | source/blender/render/intern/include/texture_ocean.h | 35 | ||||
-rw-r--r-- | source/blender/render/intern/include/voxeldata.h | 47 | ||||
-rw-r--r-- | source/blender/render/intern/include/zbuf.h | 2 |
15 files changed, 933 insertions, 19 deletions
diff --git a/source/blender/render/intern/include/envmap.h b/source/blender/render/intern/include/envmap.h new file mode 100644 index 00000000000..c66427ae788 --- /dev/null +++ b/source/blender/render/intern/include/envmap.h @@ -0,0 +1,54 @@ +/* + * envmap_ext.h + * + * + * ***** BEGIN GPL 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. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/render/intern/include/envmap.h + * \ingroup render + */ + + +#ifndef __ENVMAP_H__ +#define __ENVMAP_H__ + +/** + * Make environment maps for all objects in the scene that have an + * environment map as texture. + * (initrender.c) + */ + +struct Render; +struct TexResult; +struct ImagePool; + +void make_envmaps(struct Render *re); +int envmaptex(struct Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres, struct ImagePool *pool, const bool skip_image_load); +void env_rotate_scene(struct Render *re, float mat[4][4], int do_rotate); + +#endif /* __ENVMAP_H__ */ + diff --git a/source/blender/render/intern/include/initrender.h b/source/blender/render/intern/include/initrender.h index e7ff3c7097c..b8732e7cc5c 100644 --- a/source/blender/render/intern/include/initrender.h +++ b/source/blender/render/intern/include/initrender.h @@ -31,7 +31,7 @@ #ifndef __INITRENDER_H__ -#define __INITRENDER_H__ +#define __INITRENDER_H__ /* Functions */ diff --git a/source/blender/render/intern/include/pixelblending.h b/source/blender/render/intern/include/pixelblending.h new file mode 100644 index 00000000000..022510c7132 --- /dev/null +++ b/source/blender/render/intern/include/pixelblending.h @@ -0,0 +1,65 @@ +/* + * ***** BEGIN GPL 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. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * Contributor(s): 2004-2006 Blender Foundation, full recode + * + * ***** END GPL/BL DUAL LICENSE BLOCK ***** + */ + +/** \file blender/render/intern/include/pixelblending.h + * \ingroup render + */ + + +#ifndef __PIXELBLENDING_H__ +#define __PIXELBLENDING_H__ + + +/** + * add 1 pixel to into filtered three lines + * (float vecs to float vec) + */ +void add_filt_fmask(unsigned int mask, const float col[4], float *rowbuf, int row_w); +void add_filt_fmask_pixsize(unsigned int mask, float *in, float *rowbuf, int row_w, int pixsize); +void add_filt_fmask_coord(float filt[3][3], const float col[4], float *rowbuf, int row_stride, int x, int y, rcti *mask); +void mask_array(unsigned int mask, float filt[3][3]); + +/** + * Alpha-over blending for floats. + */ +void addAlphaOverFloat(float dest[4], const float source[4]); + +/** + * Alpha-under blending for floats. + */ +void addAlphaUnderFloat(float dest[4], const float source[4]); + + +/** + * Same for floats + */ +void addalphaAddfacFloat(float dest[4], const float source[4], char addfac); + +/** + * dest = dest + source + */ +void addalphaAddFloat(float dest[4], const float source[4]); + +#endif /* __PIXELBLENDING_H__ */ diff --git a/source/blender/render/intern/include/pixelshading.h b/source/blender/render/intern/include/pixelshading.h new file mode 100644 index 00000000000..0e630eda475 --- /dev/null +++ b/source/blender/render/intern/include/pixelshading.h @@ -0,0 +1,62 @@ +/* + * ***** BEGIN GPL 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. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * Contributor(s): 2004-2006, Blender Foundation, full recode + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/render/intern/include/pixelshading.h + * \ingroup render + * + * These functions determine what actual color a pixel will have. + */ + +#ifndef __PIXELSHADING_H__ +#define __PIXELSHADING_H__ + + +/** + * Render the pixel at (x,y) for object ap. Apply the jitter mask. + * Output is given in float collector[4]. The type vector: + * t[0] - min. distance + * t[1] - face/halo index + * t[2] - jitter mask + * t[3] - type ZB_POLY or ZB_HALO + * t[4] - max. distance + * mask is pixel coverage in bits + * \return pointer to the object + */ +int shadeHaloFloat(HaloRen *har, + float *col, int zz, + float dist, float xn, + float yn, short flarec); + +/** + * Render the sky at pixel (x, y). + */ +void shadeSkyPixel(float collector[4], float fx, float fy, short thread); +void shadeSkyView(float col_r[3], const float rco[3], const float view[3], const float dxyview[2], short thread); +void shadeAtmPixel(struct SunSky *sunsky, float *collector, float fx, float fy, float distance); +void shadeSunView(float col_r[3], const float view[3]); +/* ------------------------------------------------------------------------- */ + +#endif + diff --git a/source/blender/render/intern/include/pointdensity.h b/source/blender/render/intern/include/pointdensity.h new file mode 100644 index 00000000000..eadf714c1ba --- /dev/null +++ b/source/blender/render/intern/include/pointdensity.h @@ -0,0 +1,51 @@ +/* + * ***** BEGIN GPL 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. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Matt Ebb + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/render/intern/include/pointdensity.h + * \ingroup render + */ + + +#ifndef __POINTDENSITY_H__ +#define __POINTDENSITY_H__ + +/** + * Make point density kd-trees for all point density textures in the scene + */ + +struct PointDensity; +struct Render; +struct TexResult; + +void free_pointdensity(struct PointDensity *pd); +void cache_pointdensity(struct Render *re, struct PointDensity *pd); +void make_pointdensities(struct Render *re); +void free_pointdensities(struct Render *re); +int pointdensitytex(struct Tex *tex, const float texvec[3], struct TexResult *texres); + +#endif /* __POINTDENSITY_H__ */ + diff --git a/source/blender/render/intern/include/raycounter.h b/source/blender/render/intern/include/raycounter.h new file mode 100644 index 00000000000..e16c6e13c7e --- /dev/null +++ b/source/blender/render/intern/include/raycounter.h @@ -0,0 +1,74 @@ +/* + * ***** BEGIN GPL 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. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2009 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): André Pinto. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/render/intern/include/raycounter.h + * \ingroup render + */ + + +#ifndef __RAYCOUNTER_H__ +#define __RAYCOUNTER_H__ + +//#define RE_RAYCOUNTER /* enable counters per ray, useful for measuring raytrace structures performance */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef RE_RAYCOUNTER + +/* ray counter functions */ + +typedef struct RayCounter { + struct { + unsigned long long test, hit; + } faces, bb, simd_bb, raycast, raytrace_hint, rayshadow_last_hit; +} RayCounter; + +#define RE_RC_INIT(isec, shi) (isec).raycounter = &((shi).shading.raycounter) +void RE_RC_INFO(RayCounter *rc); +void RE_RC_MERGE(RayCounter *rc, RayCounter *tmp); +#define RE_RC_COUNT(var) (var)++ + +extern RayCounter re_rc_counter[]; + +#else + +/* ray counter stubs */ + +#define RE_RC_INIT(isec,shi) +#define RE_RC_INFO(rc) +#define RE_RC_MERGE(dest,src) +#define RE_RC_COUNT(var) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/source/blender/render/intern/include/rayintersection.h b/source/blender/render/intern/include/rayintersection.h new file mode 100644 index 00000000000..a303301ad3b --- /dev/null +++ b/source/blender/render/intern/include/rayintersection.h @@ -0,0 +1,136 @@ +/* + * ***** BEGIN GPL 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. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2007 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): André Pinto. + * + * ***** END GPL LICENSE BLOCK ***** + * RE_raytrace.h: ray tracing api, can be used independently from the renderer. + */ + +/** \file blender/render/intern/include/rayintersection.h + * \ingroup render + */ + + +#ifndef __RAYINTERSECTION_H__ +#define __RAYINTERSECTION_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "BLI_math_geom.h" + +struct RayObject; + +/* Ray Hints */ + +#define RE_RAY_LCTS_MAX_SIZE 256 +#define RT_USE_LAST_HIT /* last shadow hit is reused before raycasting on whole tree */ +//#define RT_USE_HINT /* last hit object is reused before raycasting on whole tree */ + +typedef struct LCTSHint { + int size; + struct RayObject *stack[RE_RAY_LCTS_MAX_SIZE]; +} LCTSHint; + +typedef struct RayHint { + union { LCTSHint lcts; } data; +} RayHint; + +/* Ray Intersection */ + +typedef struct Isect { + /* ray start, direction (normalized vector), and max distance. on hit, + * the distance is modified to be the distance to the hit point. */ + float start[3]; + float dir[3]; + float dist; + + /* for envmap and incremental view update renders */ + float origstart[3]; + float origdir[3]; + + /* precomputed values to accelerate bounding box intersection */ + int bv_index[6]; + float idot_axis[3]; + + /* intersection options */ + int mode; /* RE_RAY_SHADOW, RE_RAY_MIRROR, RE_RAY_SHADOW_TRA */ + int lay; /* -1 default, set for layer lamps */ + int skip; /* skip flags */ + int check; /* check flags */ + void *userdata; /* used by bake check */ + + /* hit information */ + float u, v; + int isect; /* which half of quad */ + + struct { + void *ob; + void *face; + } hit, orig; + + /* last hit optimization */ + struct RayObject *last_hit; + + /* hints */ +#ifdef RT_USE_HINT + RayTraceHint *hint, *hit_hint; +#endif + RayHint *hint; + + /* ray counter */ +#ifdef RE_RAYCOUNTER + RayCounter *raycounter; +#endif + + /* Precalculated coefficients for watertight intersection check. */ + struct IsectRayPrecalc isect_precalc; +} Isect; + +/* ray types */ +#define RE_RAY_SHADOW 0 +#define RE_RAY_MIRROR 1 +#define RE_RAY_SHADOW_TRA 2 + +/* skip options */ +#define RE_SKIP_CULLFACE (1 << 0) +/* if using this flag then *face should be a pointer to a VlakRen */ +#define RE_SKIP_VLR_NEIGHBOUR (1 << 1) + +/* check options */ +#define RE_CHECK_VLR_NONE 0 +#define RE_CHECK_VLR_RENDER 1 +#define RE_CHECK_VLR_NON_SOLID_MATERIAL 2 +#define RE_CHECK_VLR_BAKE 3 + +/* arbitrary, but can't use e.g. FLT_MAX because of precision issues */ +#define RE_RAYTRACE_MAXDIST 1e15f +#define RE_RAYTRACE_EPSILON 0.0f + +#ifdef __cplusplus +} +#endif + +#endif /* __RAYINTERSECTION_H__ */ + diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 8308b5e76e4..fd24f4eb053 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -52,10 +52,10 @@ struct Main; /* this is handed over to threaded hiding/passes/shading engine */ typedef struct RenderPart { struct RenderPart *next, *prev; - + RenderResult *result; /* result of part rendering */ ListBase fullresult; /* optional full sample buffers */ - + rcti disprect; /* part coordinates within total picture */ int rectx, recty; /* the size */ int nr; /* nr is partnr */ @@ -74,10 +74,10 @@ struct Render { struct Render *next, *prev; char name[RE_MAXNAME]; int slot; - + /* state settings */ short flag, ok, result_ok; - + /* result of rendering */ RenderResult *result; /* if render with single-layer option, other rendered layers are stored here */ @@ -88,29 +88,29 @@ struct Render { * write lock, all external code must use a read lock. internal code is assumed * to not conflict with writes, so no lock used for that */ ThreadRWMutex resultmutex; - + /* window size, display rect, viewplane */ int winx, winy; /* buffer width and height with percentage applied * without border & crop. convert to long before multiplying together to avoid overflow. */ rcti disprect; /* part within winx winy */ rctf viewplane; /* mapped on winx winy */ - + /* final picture width and height (within disprect) */ int rectx, recty; - - /* real maximum size of parts after correction for minimum + + /* real maximum size of parts after correction for minimum * partx*xparts can be larger than rectx, in that case last part is smaller */ int partx, party; - + /* Camera transform, only used by Freestyle. */ float viewmat[4][4], viewinv[4][4]; float viewmat_orig[4][4]; /* for incremental render */ float winmat[4][4]; - + /* clippping */ float clipsta; float clipend; - + /* main, scene, and its full copy of renderdata and world */ struct Main *main; Scene *scene; @@ -119,13 +119,13 @@ struct Render { int active_view_layer; struct Object *camera_override; unsigned int lay, layer_override; - + ThreadRWMutex partsmutex; ListBase parts; - + /* render engine */ struct RenderEngine *engine; - + #ifdef WITH_FREESTYLE struct Main *freestyle_bmain; ListBase freestyle_renders; @@ -140,17 +140,17 @@ struct Render { void *duh; void (*current_scene_update)(void *handle, struct Scene *scene); void *suh; - + void (*stats_draw)(void *handle, RenderStats *ri); void *sdh; void (*progress)(void *handle, float i); void *prh; - + void (*draw_lock)(void *handle, int i); void *dlh; int (*test_break)(void *handle); void *tbh; - + RenderStats i; struct ReportList *reports; diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h new file mode 100644 index 00000000000..aa3efca9e5b --- /dev/null +++ b/source/blender/render/intern/include/rendercore.h @@ -0,0 +1,105 @@ +/* + * ***** BEGIN GPL 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. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __RENDERCORE_H__ +#define __RENDERCORE_H__ + +/** \file blender/render/intern/include/rendercore.h + * \ingroup render + */ + +#include "render_types.h" + +#include "RE_engine.h" + +#include "DNA_node_types.h" + +#include "NOD_composite.h" + +struct ShadeInput; +struct ShadeResult; +struct World; +struct RenderPart; +struct RenderLayer; +struct RayObject; + +/* ------------------------------------------------------------------------- */ + +typedef struct PixStr { + struct PixStr *next; + int obi, facenr, z, maskz; + unsigned short mask; + short shadfac; +} PixStr; + +typedef struct PixStrMain { + struct PixStrMain *next, *prev; + struct PixStr *ps; + int counter; +} PixStrMain; + +/* ------------------------------------------------------------------------- */ + + +void calc_view_vector(float view[3], float x, float y); +float mistfactor(float zcor, const float co[3]); /* dist and height, return alpha */ + +void renderspothalo(struct ShadeInput *shi, float col[4], float alpha); +void add_halo_flare(Render *re); + +void calc_renderco_zbuf(float co[3], const float view[3], int z); +void calc_renderco_ortho(float co[3], float x, float y, int z); + +int count_mask(unsigned short mask); + +void zbufshade_tile(struct RenderPart *pa); +void zbufshadeDA_tile(struct RenderPart *pa); + +void zbufshade_sss_tile(struct RenderPart *pa); + +int get_sample_layers(struct RenderPart *pa, struct RenderLayer *rl, struct RenderLayer **rlpp); + +void render_internal_update_passes(struct RenderEngine *engine, struct Scene *scene, struct SceneRenderLayer *srl); + + +/* -------- ray.c ------- */ + +struct RayObject *RE_rayobject_create(int type, int size, int octree_resolution); + +extern void freeraytree(Render *re); +extern void makeraytree(Render *re); +struct RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi); + +extern void ray_shadow(ShadeInput *shi, LampRen *lar, float shadfac[4]); +extern void ray_trace(ShadeInput *shi, ShadeResult *); +extern void ray_ao(ShadeInput *shi, float ao[3], float env[3]); +extern void init_jitter_plane(LampRen *lar); +extern void init_ao_sphere(Render *re, struct World *wrld); +extern void init_render_qmcsampler(Render *re); +extern void free_render_qmcsampler(Render *re); + +#endif /* __RENDERCORE_H__ */ diff --git a/source/blender/render/intern/include/shading.h b/source/blender/render/intern/include/shading.h new file mode 100644 index 00000000000..e306c3c075c --- /dev/null +++ b/source/blender/render/intern/include/shading.h @@ -0,0 +1,105 @@ +/* + * ***** BEGIN GPL 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. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation + * All rights reserved. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/render/intern/include/shading.h + * \ingroup render + */ + + +struct ShadeInput; +struct ShadeResult; +struct RenderPart; +struct RenderLayer; +struct PixStr; +struct LampRen; +struct VlakRen; +struct StrandPoint; +struct ObjectInstanceRen; +struct Isect; + +/* shadeinput.c */ + +#define RE_MAX_OSA 16 + +/* needed to calculate shadow and AO for an entire pixel */ +typedef struct ShadeSample { + int tot; /* amount of shi in use, can be 1 for not FULL_OSA */ + + RenderLayer *rlpp[RE_MAX_OSA]; /* fast lookup from sample to renderlayer (fullsample buf) */ + + /* could be malloced once */ + ShadeInput shi[RE_MAX_OSA]; + ShadeResult shr[RE_MAX_OSA]; +} 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 ObjectInstanceRen *obi, struct VlakRen *vlr, short i1, short i2, short i3); +void shade_input_set_triangle(struct ShadeInput *shi, int obi, int facenr, int normal_flip); +void shade_input_copy_triangle(struct ShadeInput *shi, struct ShadeInput *from); +void shade_input_calc_viewco(struct ShadeInput *shi, float x, float y, float z, float view[3], float dxyview[2], float co[3], float dxco[3], float dyco[3]); +void shade_input_set_viewco(struct ShadeInput *shi, float x, float y, float sx, float sy, float z); +void shade_input_set_uv(struct ShadeInput *shi); +void shade_input_set_normals(struct ShadeInput *shi); +void shade_input_set_vertex_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); +void shade_input_do_shade(struct ShadeInput *shi, struct ShadeResult *shr); + +void shade_input_init_material(struct ShadeInput *shi); +void shade_input_initialize(struct ShadeInput *shi, struct RenderPart *pa, struct RenderLayer *rl, int sample); + +void shade_sample_initialize(struct ShadeSample *ssamp, struct RenderPart *pa, struct RenderLayer *rl); +void shade_samples_do_AO(struct ShadeSample *ssamp); +void shade_samples_fill_with_ps(struct ShadeSample *ssamp, struct PixStr *ps, int x, int y); +int shade_samples(struct ShadeSample *ssamp, struct PixStr *ps, int x, int y); + +void vlr_set_uv_indices(struct VlakRen *vlr, int *i1, int *i2, int *i3); + +void calc_R_ref(struct ShadeInput *shi); + +void barycentric_differentials_from_position( + const float co[3], const float v1[3], const float v2[3], const float v3[3], + const float dxco[3], const float dyco[3], const float facenor[3], const bool differentials, + float *u, float *v, float *dx_u, float *dx_v, float *dy_u, float *dy_v); + +/* shadeoutput. */ +void shade_lamp_loop(struct ShadeInput *shi, struct ShadeResult *shr); + +void shade_color(struct ShadeInput *shi, ShadeResult *shr); + +void ambient_occlusion(struct ShadeInput *shi); +void environment_lighting_apply(struct ShadeInput *shi, struct ShadeResult *shr); + +ListBase *get_lights(struct ShadeInput *shi); +float lamp_get_visibility(struct LampRen *lar, const float co[3], float lv[3], float *dist); +void lamp_get_shadow(struct LampRen *lar, ShadeInput *shi, float inp, float shadfac[4], int do_real); + +float fresnel_fac(const float view[3], const float vn[3], float fresnel, float fac); + +/* rayshade.c */ +extern void shade_ray(struct Isect *is, struct ShadeInput *shi, struct ShadeResult *shr); diff --git a/source/blender/render/intern/include/strand.h b/source/blender/render/intern/include/strand.h new file mode 100644 index 00000000000..f4e22c78b42 --- /dev/null +++ b/source/blender/render/intern/include/strand.h @@ -0,0 +1,99 @@ +/* + * ***** BEGIN GPL 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. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Brecht Van Lommel. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/render/intern/include/strand.h + * \ingroup render + */ + + +#ifndef __STRAND_H__ +#define __STRAND_H__ + +struct StrandVert; +struct StrandRen; +struct StrandBuffer; +struct ShadeSample; +struct StrandPart; +struct Render; +struct ZSpan; +struct ObjectInstanceRen; +struct StrandSurface; +struct DerivedMesh; +struct ObjectRen; + +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]; + int clip1, clip2; + + /* screen space */ + float hoco[4]; + float x, y; + + /* simplification */ + float alpha; +} StrandPoint; + +typedef struct StrandSegment { + struct StrandVert *v[4]; + struct StrandRen *strand; + struct StrandBuffer *buffer; + struct ObjectInstanceRen *obi; + float sqadaptcos; + + StrandPoint point1, point2; + int shaded; +} StrandSegment; + +struct StrandShadeCache; +typedef struct StrandShadeCache StrandShadeCache; + +void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint); +void render_strand_segment(struct Render *re, float winmat[4][4], struct StrandPart *spart, struct ZSpan *zspan, int totzspan, StrandSegment *sseg); +void strand_minmax(struct StrandRen *strand, float min[3], float max[3], const float width); + +struct StrandSurface *cache_strand_surface(struct Render *re, struct ObjectRen *obr, struct DerivedMesh *dm, float mat[4][4], int timeoffset); +void free_strand_surface(struct Render *re); + +struct StrandShadeCache *strand_shade_cache_create(void); +void strand_shade_cache_free(struct StrandShadeCache *cache); +void strand_shade_segment(struct Render *re, struct StrandShadeCache *cache, struct StrandSegment *sseg, struct ShadeSample *ssamp, float t, float s, int addpassflag); +void strand_shade_unref(struct StrandShadeCache *cache, struct ObjectInstanceRen *obi, struct StrandVert *svert); + +#endif + diff --git a/source/blender/render/intern/include/sunsky.h b/source/blender/render/intern/include/sunsky.h new file mode 100644 index 00000000000..c608f9fc48c --- /dev/null +++ b/source/blender/render/intern/include/sunsky.h @@ -0,0 +1,81 @@ +/* + * ***** BEGIN GPL 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. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): zaghaghi + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/render/intern/include/sunsky.h + * \ingroup render + */ + +#ifndef __SUNSKY_H__ +#define __SUNSKY_H__ + +// #define SPECTRUM_MAX_COMPONENTS 100 + +typedef struct SunSky { + short effect_type, skyblendtype, sky_colorspace; + float turbidity; + float theta, phi; + + float toSun[3]; + + /*float sunSpectralRaddata[SPECTRUM_MAX_COMPONENTS];*/ + float sunSolidAngle; + + float zenith_Y, zenith_x, zenith_y; + + float perez_Y[5], perez_x[5], perez_y[5]; + + /* suggested by glome in patch [#8063] */ + float horizon_brightness; + float spread; + float sun_brightness; + float sun_size; + float backscattered_light; + float skyblendfac; + float sky_exposure; + + float atm_HGg; + + float atm_SunIntensity; + float atm_InscatteringMultiplier; + float atm_ExtinctionMultiplier; + float atm_BetaRayMultiplier; + float atm_BetaMieMultiplier; + float atm_DistanceMultiplier; + + float atm_BetaRay[3]; + float atm_BetaDashRay[3]; + float atm_BetaMie[3]; + float atm_BetaDashMie[3]; + float atm_BetaRM[3]; +} SunSky; + +void InitSunSky(struct SunSky *sunsky, float turb, const float toSun[3], float horizon_brightness, + float spread, float sun_brightness, float sun_size, float back_scatter, + float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace); + +void GetSkyXYZRadiance(struct SunSky *sunsky, float theta, float phi, float color_out[3]); +void GetSkyXYZRadiancef(struct SunSky *sunsky, const float varg[3], float color_out[3]); +void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float rayf, float inscattf, float extincf, float disf); +void AtmospherePixleShader(struct SunSky *sunSky, float view[3], float s, float rgb[3]); +void ClipColor(float c[3]); + +#endif /*__SUNSKY_H__*/ diff --git a/source/blender/render/intern/include/texture_ocean.h b/source/blender/render/intern/include/texture_ocean.h new file mode 100644 index 00000000000..6d7bc6fe7b0 --- /dev/null +++ b/source/blender/render/intern/include/texture_ocean.h @@ -0,0 +1,35 @@ +/* + * ***** BEGIN GPL 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. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * Contributors: Matt Ebb + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __TEXTURE_OCEAN_H__ +#define __TEXTURE_OCEAN_H__ + +/** \file blender/render/intern/include/texture_ocean.h + * \ingroup render + */ + +int ocean_texture(struct Tex *tex, const float texvec[2], struct TexResult *texres); + +#endif /* __TEXTURE_OCEAN_H__ */ diff --git a/source/blender/render/intern/include/voxeldata.h b/source/blender/render/intern/include/voxeldata.h new file mode 100644 index 00000000000..041ca78a799 --- /dev/null +++ b/source/blender/render/intern/include/voxeldata.h @@ -0,0 +1,47 @@ +/* + * ***** BEGIN GPL 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. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Raul Fernandez Hernandez (Farsthary), Matt Ebb. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/render/intern/include/voxeldata.h + * \ingroup render + */ + +#ifndef __VOXELDATA_H__ +#define __VOXELDATA_H__ + +struct Render; +struct TexResult; + +typedef struct VoxelDataHeader { + int resolX, resolY, resolZ; + int frames; +} VoxelDataHeader; + +void cache_voxeldata(Tex *tex, int scene_frame); +void make_voxeldata(struct Render *re); +int voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texres); + +#endif /* __VOXELDATA_H__ */ diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h index 3dfcbc355c4..0654a4f8df6 100644 --- a/source/blender/render/intern/include/zbuf.h +++ b/source/blender/render/intern/include/zbuf.h @@ -36,7 +36,7 @@ /* span fill in method, is also used to localize data for zbuffering */ typedef struct ZSpan { int rectx, recty; /* range for clipping */ - + int miny1, maxy1, miny2, maxy2; /* actual filled in range */ const float *minp1, *maxp1, *minp2, *maxp2; /* vertex pointers detect min/max range in */ float *span1, *span2; |