Blender V2.61 - r43446
Classes | Typedefs | Functions | Variables

render_texture.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_texture_types.h"
#include "DNA_object_types.h"
#include "DNA_lamp_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_material_types.h"
#include "DNA_image_types.h"
#include "DNA_node_types.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "BKE_colortools.h"
#include "BKE_image.h"
#include "BKE_node.h"
#include "BKE_plugin_types.h"
#include "BKE_animsys.h"
#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_scene.h"
#include "BKE_library.h"
#include "BKE_texture.h"
#include "BKE_key.h"
#include "BKE_ipo.h"
#include "MEM_guardedalloc.h"
#include "envmap.h"
#include "pointdensity.h"
#include "voxeldata.h"
#include "renderpipeline.h"
#include "render_types.h"
#include "rendercore.h"
#include "shading.h"
#include "texture.h"
#include "texture_ocean.h"
#include "renderdatabase.h"

Go to the source code of this file.

Classes

struct  CompatibleBump
struct  NTapBump

Typedefs

typedef struct CompatibleBump CompatibleBump
typedef struct NTapBump NTapBump

Functions

static void init_render_texture (Render *re, Tex *tex)
void init_render_textures (Render *re)
static void end_render_texture (Tex *tex)
void end_render_textures (Render *re)
static void tex_normal_derivate (Tex *tex, TexResult *texres)
static int blend (Tex *tex, float *texvec, TexResult *texres)
static int clouds (Tex *tex, float *texvec, TexResult *texres)
static float tex_sin (float a)
static float tex_saw (float a)
static float tex_tri (float a)
static float wood_int (Tex *tex, float x, float y, float z)
static int wood (Tex *tex, float *texvec, TexResult *texres)
static float marble_int (Tex *tex, float x, float y, float z)
static int marble (Tex *tex, float *texvec, TexResult *texres)
static int magic (Tex *tex, float *texvec, TexResult *texres)
static int stucci (Tex *tex, float *texvec, TexResult *texres)
static float mg_mFractalOrfBmTex (Tex *tex, float *texvec, TexResult *texres)
static float mg_ridgedOrHybridMFTex (Tex *tex, float *texvec, TexResult *texres)
static float mg_HTerrainTex (Tex *tex, float *texvec, TexResult *texres)
static float mg_distNoiseTex (Tex *tex, float *texvec, TexResult *texres)
static float voronoiTex (Tex *tex, float *texvec, TexResult *texres)
static int texnoise (Tex *tex, TexResult *texres)
static int plugintex (Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres)
static int cubemap_glob (float *n, float x, float y, float z, float *adr1, float *adr2)
static int cubemap (MTex *mtex, VlakRen *vlr, float *n, float x, float y, float z, float *adr1, float *adr2)
static int cubemap_ob (Object *ob, float *n, float x, float y, float z, float *adr1, float *adr2)
static void do_2d_mapping (MTex *mtex, float *t, VlakRen *vlr, float *n, float *dxt, float *dyt)
static int multitex (Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres, short thread, short which_output)
int multitex_nodes (Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres, short thread, short which_output, ShadeInput *shi, MTex *mtex)
int multitex_mtex (ShadeInput *shi, MTex *mtex, float *texvec, float *dxt, float *dyt, TexResult *texres)
int multitex_ext (Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres)
int multitex_ext_safe (Tex *tex, float *texvec, TexResult *texres)
void texture_rgb_blend (float in[3], const float tex[3], const float out[3], float fact, float facg, int blendtype)
float texture_value_blend (float tex, float out, float fact, float facg, int blendtype)
static void texco_mapping (ShadeInput *shi, Tex *tex, MTex *mtex, float *co, float *dx, float *dy, float *texvec, float *dxt, float *dyt)
static void compatible_bump_init (CompatibleBump *compat_bump)
static void compatible_bump_uv_derivs (CompatibleBump *compat_bump, ShadeInput *shi, MTex *mtex, int i)
static int compatible_bump_compute (CompatibleBump *compat_bump, ShadeInput *shi, MTex *mtex, Tex *tex, TexResult *texres, float Tnor, float *co, float *dx, float *dy, float *texvec, float *dxt, float *dyt)
static void ntap_bump_init (NTapBump *ntap_bump)
static int ntap_bump_compute (NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, Tex *tex, TexResult *texres, float Tnor, float *co, float *dx, float *dy, float *texvec, float *dxt, float *dyt)
void do_material_tex (ShadeInput *shi, Render *re)
void do_volume_tex (ShadeInput *shi, const float *xyz, int mapto_flag, float *col, float *val, Render *re)
void do_halo_tex (HaloRen *har, float xn, float yn, float col_r[4])
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)
void do_lamp_tex (LampRen *la, const float lavec[3], ShadeInput *shi, float col_r[3], int effect)
int externtex (MTex *mtex, const float vec[3], float *tin, float *tr, float *tg, float *tb, float *ta, const int thread)
void render_realtime_texture (ShadeInput *shi, Image *ima)
static void textured_face_generate_uv (float *uv, float *normal, float *hit, float *v1, float *v2, float *v3)
MaterialRE_init_sample_material (Material *orig_mat, Scene *scene)
void RE_free_sample_material (Material *mat)
void RE_sample_material_color (Material *mat, float color[3], float *alpha, const float volume_co[3], const float surface_co[3], int face_index, short hit_quad, DerivedMesh *orcoDm, Object *ob)

Variables

struct Render R

Detailed Description

Definition in file render_texture.c.


Typedef Documentation

typedef struct NTapBump NTapBump

Function Documentation

static int blend ( Tex tex,
float *  texvec,
TexResult texres 
) [static]
static int clouds ( Tex tex,
float *  texvec,
TexResult texres 
) [static]
static int compatible_bump_compute ( CompatibleBump compat_bump,
ShadeInput shi,
MTex mtex,
Tex tex,
TexResult texres,
float  Tnor,
float *  co,
float *  dx,
float *  dy,
float *  texvec,
float *  dxt,
float *  dyt 
) [static]
static void compatible_bump_init ( CompatibleBump compat_bump) [static]

Definition at line 1689 of file render_texture.c.

References CompatibleBump::dudnu, and CompatibleBump::dvdnv.

Referenced by do_material_tex().

static void compatible_bump_uv_derivs ( CompatibleBump compat_bump,
ShadeInput shi,
MTex mtex,
int  i 
) [static]
static int cubemap ( MTex mtex,
VlakRen vlr,
float *  n,
float  x,
float  y,
float  z,
float *  adr1,
float *  adr2 
) [static]
static int cubemap_glob ( float *  n,
float  x,
float  y,
float  z,
float *  adr1,
float *  adr2 
) [static]

Definition at line 818 of file render_texture.c.

References copy_v3_v3(), fabs(), mul_mat3_m4_v3(), NULL, and R.

Referenced by cubemap(), and do_2d_mapping().

static int cubemap_ob ( Object ob,
float *  n,
float  x,
float  y,
float  z,
float *  adr1,
float *  adr2 
) [static]

Definition at line 914 of file render_texture.c.

References copy_v3_v3(), fabs(), Object::imat, mul_mat3_m4_v3(), and NULL.

Referenced by do_2d_mapping().

static void do_2d_mapping ( MTex mtex,
float *  t,
VlakRen vlr,
float *  n,
float *  dxt,
float *  dyt 
) [static]
void do_halo_tex ( HaloRen har,
float  xn,
float  yn,
float  col_r[4] 
)
void do_lamp_tex ( LampRen la,
const float  lavec[3],
ShadeInput shi,
float  col_r[3],
int  effect 
)
void do_material_tex ( ShadeInput shi,
Render re 
)

Definition at line 2163 of file render_texture.c.

References ShadeInput::actuv, add_v3_v3v3(), ShadeInput::alpha, MTex::alphafac, ShadeInput::amb, World::ambb, ShadeInput::ambb, MTex::ambfac, World::ambg, ShadeInput::ambg, World::ambr, ShadeInput::ambr, B, MTex::b, BKE_image_get_ibuf(), MTex::blendtype, calc_R_ref(), ShadeInput::co, co, MTex::colfac, RenderData::color_mgt_flag, MTex::colspecfac, compatible_bump_compute(), compatible_bump_init(), compatible_bump_uv_derivs(), copy_v3_v3(), cos(), cross_v3_v3v3(), MTex::def_var, MTex::difffac, MTex::dispfac, ShadeInput::displace, dot(), dot_v3v3(), ShadeInput::duplilo, ObjectInstanceRen::duplitexmat, ShadeInput::dupliuv, ShadeInput::dxco, ShadeInput::dxgl, ShadeInput::dxlo, ShadeInput::dxno, ShadeInput::dxref, ShadeInput::dxsticky, ShadeInput::dxstrand, ShadeInputUV::dxuv, ShadeInput::dxwin, ShadeInput::dyco, ShadeInput::dygl, ShadeInput::dylo, ShadeInput::dyno, ShadeInput::dyref, ShadeInput::dysticky, ShadeInput::dystrand, ShadeInputUV::dyuv, ShadeInput::dywin, ShadeInput::emit, MTex::emitfac, fabsf, MTex::g, ShadeInput::gl, ShadeInput::har, MTex::hardfac, i, Tex::ima, Tex::imaflag, Object::imat_ren, Tex::iuser, len(), ShadeInput::lo, MA_TANGENT_V, madd_v3_v3fl(), MAP_ALPHA, MAP_AMB, MAP_COL, MAP_COLMIR, MAP_COLSPEC, MAP_DISPLACE, MAP_EMIT, MAP_HAR, MAP_NORM, MAP_RAYMIRR, MAP_REF, MAP_SPEC, MAP_TRANSLU, MAP_VARS, MAP_WARP, MTex::mapto, ShadeInput::mat, MAX_MTEX, ShadeInput::mirr, MTex::mirrfac, Material::mode, Material::mtex, MTEX_3TAP_BUMP, MTEX_5TAP_BUMP, MTEX_BICUBIC_BUMP, MTEX_BLEND, MTEX_COMPAT_BUMP, MTEX_DUPLI_MAPTO, MTEX_MUL, MTEX_NEGATIVE, MTEX_NSPACE_CAMERA, MTEX_NSPACE_OBJECT, MTEX_NSPACE_TANGENT, MTEX_NSPACE_WORLD, MTEX_OB_DUPLI_ORIG, MTEX_RGBTOINT, MTEX_STENCIL, MTEX_SUB, MTEX_VIEWSPACE, mul_m4_v3(), mul_mat3_m4_v3(), mul_v3_fl(), multitex_mtex(), ShadeInputUV::name, ShadeInput::nmapnorm, ShadeInput::nmaptang, Tex::nodetree, TexResult::nor, MTex::norfac, normalize_v3(), MTex::normapspace, ntap_bump_compute(), ntap_bump_init(), NULL, ObjectRen::ob, ShadeInput::obi, MTex::object, Object::obmat, ShadeInput::obr, ShadeInput::orn, ShadeInput::osatex, ShadeInput::r, MTex::r, Render::r, R_COLOR_MANAGEMENT, R_NO_TEX, ShadeInput::ray_mirror, MTex::raymirrfac, ImBuf::rect_float, ShadeInput::ref, ShadeInput::refcol, ShadeInput::refl, RenderData::scemode, Material::septex, si, sin(), ShadeInput::spec, MTex::specfac, ShadeInput::specr, srgb_to_linearrgb_v3_v3(), ShadeInput::sticky, ShadeInput::strandco, ShadeInput::stress, TexResult::ta, TexResult::talpha, ShadeInput::tang, TexResult::tb, MTex::tex, TEX_DERIVATIVEMAP, TEX_ENVMAP, TEX_IMAGE, TEX_NOR, TEX_NORMALMAP, TEX_OCEAN, TEX_RGB, MTex::texco, TEXCO_GLOB, texco_mapping(), TEXCO_NORM, TEXCO_OBJECT, TEXCO_ORCO, TEXCO_REFL, TEXCO_STICKY, TEXCO_STRAND, TEXCO_STRESS, TEXCO_TANGENT, TEXCO_UV, TEXCO_WINDOW, MTex::texflag, texture_rgb_blend(), texture_value_blend(), TexResult::tg, TexResult::tin, ShadeInput::totuv, TexResult::tr, MTex::translfac, ShadeInput::translucency, Tex::type, Tex::use_nodes, ShadeInputUV::uv, ShadeInput::uv, MTex::uvname, Render::viewmat, ShadeInput::vlr, ShadeInput::vn, MTex::warpfac, ShadeInput::winco, and Render::wrld.

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 
)
void do_volume_tex ( ShadeInput shi,
const float *  xyz,
int  mapto_flag,
float *  col,
float *  val,
Render re 
)
static void end_render_texture ( Tex tex) [static]
void end_render_textures ( Render re)

Definition at line 155 of file render_texture.c.

References end_render_texture(), ListBase::first, Tex::id, Render::main, ID::next, Main::tex, and ID::us.

Referenced by RE_Database_Free().

int externtex ( MTex mtex,
const float  vec[3],
float *  tin,
float *  tr,
float *  tg,
float *  tb,
float *  ta,
const int  thread 
)
static void init_render_texture ( Render re,
Tex tex 
) [static]
void init_render_textures ( Render re)
static int magic ( Tex tex,
float *  texvec,
TexResult texres 
) [static]
static int marble ( Tex tex,
float *  texvec,
TexResult texres 
) [static]
static float marble_int ( Tex tex,
float  x,
float  y,
float  z 
) [static]
static float mg_distNoiseTex ( Tex tex,
float *  texvec,
TexResult texres 
) [static]
static float mg_HTerrainTex ( Tex tex,
float *  texvec,
TexResult texres 
) [static]
static float mg_mFractalOrfBmTex ( Tex tex,
float *  texvec,
TexResult texres 
) [static]
static float mg_ridgedOrHybridMFTex ( Tex tex,
float *  texvec,
TexResult texres 
) [static]
static int multitex ( Tex tex,
float *  texvec,
float *  dxt,
float *  dyt,
int  osatex,
TexResult texres,
short  thread,
short  which_output 
) [static]
int multitex_ext ( Tex tex,
float *  texvec,
float *  dxt,
float *  dyt,
int  osatex,
TexResult texres 
)
int multitex_ext_safe ( Tex tex,
float *  texvec,
TexResult texres 
)

Definition at line 1367 of file render_texture.c.

References multitex_nodes(), NULL, and Tex::use_nodes.

Referenced by dynamicPaint_setInitialColor(), and get_texture_value().

int multitex_mtex ( ShadeInput shi,
MTex mtex,
float *  texvec,
float *  dxt,
float *  dyt,
TexResult texres 
)
int multitex_nodes ( Tex tex,
float *  texvec,
float *  dxt,
float *  dyt,
int  osatex,
TexResult texres,
short  thread,
short  which_output,
ShadeInput shi,
MTex mtex 
)
static int ntap_bump_compute ( NTapBump ntap_bump,
ShadeInput shi,
MTex mtex,
Tex tex,
TexResult texres,
float  Tnor,
float *  co,
float *  dx,
float *  dy,
float *  texvec,
float *  dxt,
float *  dyt 
) [static]
static void ntap_bump_init ( NTapBump ntap_bump) [static]

Definition at line 1903 of file render_texture.c.

Referenced by do_material_tex().

static int plugintex ( Tex tex,
float *  texvec,
float *  dxt,
float *  dyt,
int  osatex,
TexResult texres 
) [static]
void RE_free_sample_material ( Material mat)
Material* RE_init_sample_material ( Material orig_mat,
Scene scene 
) [read]
void RE_sample_material_color ( Material mat,
float  color[3],
float *  alpha,
const float  volume_co[3],
const float  surface_co[3],
int  face_index,
short  hit_quad,
DerivedMesh orcoDm,
Object ob 
)
void render_realtime_texture ( ShadeInput shi,
Image ima 
)
static int stucci ( Tex tex,
float *  texvec,
TexResult texres 
) [static]
static void tex_normal_derivate ( Tex tex,
TexResult texres 
) [static]
static float tex_saw ( float  a) [static]

Definition at line 290 of file render_texture.c.

References M_PI.

Referenced by marble_int(), and wood_int().

static float tex_sin ( float  a) [static]

Definition at line 282 of file render_texture.c.

References sin().

Referenced by marble_int(), and wood_int().

static float tex_tri ( float  a) [static]

Definition at line 301 of file render_texture.c.

References fabsf, floorf, and M_PI.

Referenced by marble_int(), and wood_int().

static void texco_mapping ( ShadeInput shi,
Tex tex,
MTex mtex,
float *  co,
float *  dx,
float *  dy,
float *  texvec,
float *  dxt,
float *  dyt 
) [static]
static int texnoise ( Tex tex,
TexResult texres 
) [static]

Definition at line 727 of file render_texture.c.

References BLI_rand(), BRICONT, div, Tex::noisedepth, TEX_INT, TexResult::tin, and simple_enum_gen::val.

Referenced by multitex().

void texture_rgb_blend ( float  in[3],
const float  tex[3],
const float  out[3],
float  fact,
float  facg,
int  blendtype 
)
float texture_value_blend ( float  tex,
float  out,
float  fact,
float  facg,
int  blendtype 
)
static void textured_face_generate_uv ( float *  uv,
float *  normal,
float *  hit,
float *  v1,
float *  v2,
float *  v3 
) [static]

Definition at line 3511 of file render_texture.c.

References axis_dominant_v3(), and CLAMP().

Referenced by RE_sample_material_color().

static float voronoiTex ( Tex tex,
float *  texvec,
TexResult texres 
) [static]
static int wood ( Tex tex,
float *  texvec,
TexResult texres 
) [static]
static float wood_int ( Tex tex,
float  x,
float  y,
float  z 
) [static]

Variable Documentation

struct Render R

Definition at line 127 of file pipeline.c.