Blender V2.61 - r43446

texture.h

Go to the documentation of this file.
00001 /*
00002  * texture_ext.h
00003  *
00004  *
00005  * ***** BEGIN GPL LICENSE BLOCK *****
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software Foundation,
00019  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00022  * All rights reserved.
00023  *
00024  * The Original Code is: all of this file.
00025  *
00026  * Contributor(s): none yet.
00027  *
00028  * ***** END GPL LICENSE BLOCK *****
00029  */
00030 
00036 #ifndef TEXTURE_EXT_H
00037 #define TEXTURE_EXT_H
00038 
00039 #define BRICONT                                                               \
00040     texres->tin= (texres->tin-0.5f) * tex->contrast+tex->bright-0.5f;         \
00041     if(texres->tin < 0.0f)      texres->tin= 0.0f;                            \
00042     else if(texres->tin > 1.0f) texres->tin= 1.0f;                            \
00043 
00044 #define BRICONTRGB                                                            \
00045     texres->tr= tex->rfac*((texres->tr-0.5f)*tex->contrast+tex->bright-0.5f); \
00046     if(texres->tr<0.0f) texres->tr= 0.0f;                                     \
00047     texres->tg= tex->gfac*((texres->tg-0.5f)*tex->contrast+tex->bright-0.5f); \
00048     if(texres->tg<0.0f) texres->tg= 0.0f;                                     \
00049     texres->tb= tex->bfac*((texres->tb-0.5f)*tex->contrast+tex->bright-0.5f); \
00050     if(texres->tb<0.0f) texres->tb= 0.0f;                                     \
00051     if(tex->saturation != 1.0f) {                                             \
00052         float _hsv[3];                                                        \
00053         rgb_to_hsv(texres->tr, texres->tg, texres->tb,                        \
00054                    _hsv, _hsv+1, _hsv+2);                                     \
00055         _hsv[1] *= tex->saturation;                                           \
00056         hsv_to_rgb(_hsv[0], _hsv[1], _hsv[2],                                 \
00057                    &texres->tr, &texres->tg, &texres->tb);                    \
00058     }                                                                         \
00059 
00060 #define RGBTOBW(r,g,b)  ( r*0.35f + g*0.45f + b*0.2f )      /* keep this in sync with gpu_shader_material.glsl:rgbtobw */
00061 
00062 struct HaloRen;
00063 struct ShadeInput;
00064 struct TexResult;
00065 struct Tex;
00066 struct Image;
00067 struct ImBuf;
00068 
00069 /* texture.h */
00070 
00071 void do_halo_tex(struct HaloRen *har, float xn, float yn, float col_r[4]);
00072 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);
00073 void do_material_tex(struct ShadeInput *shi, struct Render *re);
00074 void do_lamp_tex(LampRen *la, const float lavec[3], struct ShadeInput *shi, float col_r[3], int effect);
00075 void do_volume_tex(struct ShadeInput *shi, const float xyz[3], int mapto_flag, float col[3], float *val, struct Render *re);
00076 
00077 void init_render_textures(Render *re);
00078 void end_render_textures(Render *re);
00079 
00080 void render_realtime_texture(struct ShadeInput *shi, struct Image *ima);
00081 
00082 /* imagetexture.h */
00083 
00084 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);
00085 int imagewrap(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, const float texvec[3], struct TexResult *texres);
00086 void image_sample(struct Image *ima, float fx, float fy, float dx, float dy, float *result);
00087 
00088 #endif /* TEXTURE_EXT_H */
00089