code cleanup: minor edit - replace memset() with zero initialization, remove unneeded...
[blender.git] / source / blender / render / intern / include / texture.h
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19  * All rights reserved.
20  *
21  * The Original Code is: all of this file.
22  *
23  * Contributor(s): none yet.
24  *
25  * ***** END GPL LICENSE BLOCK *****
26  */
27
28 /** \file blender/render/intern/include/texture.h
29  *  \ingroup render
30  */
31
32
33 #ifndef __TEXTURE_H__
34 #define __TEXTURE_H__
35
36 #define BRICONT                                                               \
37         texres->tin= (texres->tin-0.5f) * tex->contrast+tex->bright-0.5f;         \
38         if(texres->tin < 0.0f)      texres->tin= 0.0f;                            \
39         else if(texres->tin > 1.0f) texres->tin= 1.0f;                            \
40
41 #define BRICONTRGB                                                            \
42         texres->tr= tex->rfac*((texres->tr-0.5f)*tex->contrast+tex->bright-0.5f); \
43         if(texres->tr<0.0f) texres->tr= 0.0f;                                     \
44         texres->tg= tex->gfac*((texres->tg-0.5f)*tex->contrast+tex->bright-0.5f); \
45         if(texres->tg<0.0f) texres->tg= 0.0f;                                     \
46         texres->tb= tex->bfac*((texres->tb-0.5f)*tex->contrast+tex->bright-0.5f); \
47         if(texres->tb<0.0f) texres->tb= 0.0f;                                     \
48         if(tex->saturation != 1.0f) {                                             \
49                 float _hsv[3];                                                        \
50                 rgb_to_hsv(texres->tr, texres->tg, texres->tb,                        \
51                            _hsv, _hsv+1, _hsv+2);                                     \
52                 _hsv[1] *= tex->saturation;                                           \
53                 hsv_to_rgb(_hsv[0], _hsv[1], _hsv[2],                                 \
54                            &texres->tr, &texres->tg, &texres->tb);                    \
55         }                                                                         \
56
57 struct HaloRen;
58 struct ShadeInput;
59 struct TexResult;
60 struct Tex;
61 struct Image;
62 struct ImBuf;
63
64 /* texture.h */
65
66 void do_halo_tex(struct HaloRen *har, float xn, float yn, float col_r[4]);
67 void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float hor[3], float zen[3], float *blend, int skyflag, short thread);
68 void do_material_tex(struct ShadeInput *shi, struct Render *re);
69 void do_lamp_tex(LampRen *la, const float lavec[3], struct ShadeInput *shi, float col_r[3], int effect);
70 void do_volume_tex(struct ShadeInput *shi, const float xyz[3], int mapto_flag, float col_r[3], float *val, struct Render *re);
71
72 void init_render_textures(Render *re);
73 void end_render_textures(Render *re);
74
75 void render_realtime_texture(struct ShadeInput *shi, struct Image *ima);
76
77 /* imagetexture.h */
78
79 int imagewraposa(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, const float texvec[3], const float dxt[3], const float dyt[3], struct TexResult *texres);
80 int imagewrap(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, const float texvec[3], struct TexResult *texres);
81 void image_sample(struct Image *ima, float fx, float fy, float dx, float dy, float result[4]);
82
83 #endif /* __TEXTURE_H__ */
84