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