Blender V4.3
texture_procedural.cc File Reference
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "BLI_math_geom.h"
#include "BLI_noise.h"
#include "BLI_rand.h"
#include "BLI_utildefines.h"
#include "DNA_image_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_texture_types.h"
#include "IMB_colormanagement.hh"
#include "IMB_imbuf_types.hh"
#include "BKE_colorband.hh"
#include "BKE_image.hh"
#include "NOD_texture.h"
#include "MEM_guardedalloc.h"
#include "texture_common.h"
#include "RE_texture.h"

Go to the source code of this file.

Functions

void RE_texture_rng_init ()
 
void RE_texture_rng_exit ()
 
static int blend (const Tex *tex, const float texvec[3], TexResult *texres)
 
static int clouds (const Tex *tex, const float texvec[3], TexResult *texres)
 
static float tex_sin (float a)
 
static float tex_saw (float a)
 
static float tex_tri (float a)
 
static float wood_int (const Tex *tex, float x, float y, float z)
 
static int wood (const Tex *tex, const float texvec[3], TexResult *texres)
 
static float marble_int (const Tex *tex, float x, float y, float z)
 
static int marble (const Tex *tex, const float texvec[3], TexResult *texres)
 
static int magic (const Tex *tex, const float texvec[3], TexResult *texres)
 
static int stucci (const Tex *tex, const float texvec[3], TexResult *texres)
 
static int mg_mFractalOrfBmTex (const Tex *tex, const float texvec[3], TexResult *texres)
 
static int mg_ridgedOrHybridMFTex (const Tex *tex, const float texvec[3], TexResult *texres)
 
static int mg_HTerrainTex (const Tex *tex, const float texvec[3], TexResult *texres)
 
static int mg_distNoiseTex (const Tex *tex, const float texvec[3], TexResult *texres)
 
static int voronoiTex (const Tex *tex, const float texvec[3], TexResult *texres)
 
static int texnoise (const Tex *tex, TexResult *texres, int thread)
 
static int cubemap_glob (const float n[3], float x, float y, float z, float *adr1, float *adr2)
 
static void do_2d_mapping (const MTex *mtex, float texvec[3], const float n[3], float dxt[3], float dyt[3])
 
static int multitex (Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, const short thread, const short which_output, ImagePool *pool, const bool skip_load_image, const bool texnode_preview, const bool use_nodes)
 
static int multitex_nodes_intern (Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, const short thread, short which_output, const MTex *mtex, ImagePool *pool, const bool scene_color_manage, const bool skip_load_image, const bool texnode_preview, const bool use_nodes)
 
int multitex_nodes (Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, const short thread, short which_output, const MTex *mtex, ImagePool *pool)
 
int multitex_ext (Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, const short thread, ImagePool *pool, bool scene_color_manage, const bool skip_load_image)
 
int multitex_ext_safe (Tex *tex, const float texvec[3], TexResult *texres, ImagePool *pool, bool scene_color_manage, const bool skip_load_image)
 
float texture_value_blend (float tex, float out, float fact, float facg, int blendtype)
 
bool RE_texture_evaluate (const MTex *mtex, const float vec[3], const int thread, ImagePool *pool, const bool skip_load_image, const bool texnode_preview, float *r_intensity, float r_rgba[4])
 

Variables

static RNG_THREAD_ARRAYrandom_tex_array
 

Function Documentation

◆ blend()

static int blend ( const Tex * tex,
const float texvec[3],
TexResult * texres )
static

◆ clouds()

static int clouds ( const Tex * tex,
const float texvec[3],
TexResult * texres )
static

◆ cubemap_glob()

static int cubemap_glob ( const float n[3],
float x,
float y,
float z,
float * adr1,
float * adr2 )
static

Definition at line 592 of file texture_procedural.cc.

References copy_v3_v3(), fabsf, nor, ret, x, y, and z().

Referenced by do_2d_mapping().

◆ do_2d_mapping()

◆ magic()

◆ marble()

static int marble ( const Tex * tex,
const float texvec[3],
TexResult * texres )
static

Definition at line 280 of file texture_procedural.cc.

References BRICONT, marble_int(), tex, TEX_INT, and TexResult::tin.

◆ marble_int()

◆ mg_distNoiseTex()

static int mg_distNoiseTex ( const Tex * tex,
const float texvec[3],
TexResult * texres )
static

◆ mg_HTerrainTex()

static int mg_HTerrainTex ( const Tex * tex,
const float texvec[3],
TexResult * texres )
static

◆ mg_mFractalOrfBmTex()

static int mg_mFractalOrfBmTex ( const Tex * tex,
const float texvec[3],
TexResult * texres )
static

◆ mg_ridgedOrHybridMFTex()

◆ multitex()

◆ multitex_ext()

int multitex_ext ( struct Tex * tex,
const float texvec[3],
float dxt[3],
float dyt[3],
int osatex,
struct TexResult * texres,
short thread,
struct ImagePool * pool,
bool scene_color_manage,
bool skip_load_image )

WARNING(@ideasman42): if the texres's values are not declared zero, check the return value to be sure the color values are set before using the r/g/b values, otherwise you may use uninitialized values.

Use it for stuff which is out of render pipeline.

Definition at line 1160 of file texture_procedural.cc.

References multitex_nodes_intern(), and tex.

Referenced by do_texture_effector(), and blender::compositor::TextureBaseOperation::update_memory_buffer_partial().

◆ multitex_ext_safe()

int multitex_ext_safe ( struct Tex * tex,
const float texvec[3],
struct TexResult * texres,
struct ImagePool * pool,
bool scene_color_manage,
bool skip_load_image )

Nodes disabled. extern-tex doesn't support nodes (#ntreeBeginExec() can't be called when rendering is going on).

Use it for stuff which is out of render pipeline.

Definition at line 1187 of file texture_procedural.cc.

References multitex_nodes_intern(), and tex.

Referenced by BKE_texture_get_value_ex(), dynamic_paint_set_init_color_tex_to_imseq_cb(), and dynamic_paint_set_init_color_tex_to_vcol_cb().

◆ multitex_nodes()

int multitex_nodes ( Tex * tex,
const float texvec[3],
float dxt[3],
float dyt[3],
int osatex,
TexResult * texres,
const short thread,
short which_output,
const MTex * mtex,
ImagePool * pool )

Definition at line 1133 of file texture_procedural.cc.

References multitex_nodes_intern(), and tex.

Referenced by colorfn(), and do_proc().

◆ multitex_nodes_intern()

static int multitex_nodes_intern ( Tex * tex,
const float texvec[3],
float dxt[3],
float dyt[3],
int osatex,
TexResult * texres,
const short thread,
short which_output,
const MTex * mtex,
ImagePool * pool,
const bool scene_color_manage,
const bool skip_load_image,
const bool texnode_preview,
const bool use_nodes )
static

◆ RE_texture_evaluate()

bool RE_texture_evaluate ( const MTex * mtex,
const float vec[3],
const int thread,
ImagePool * pool,
const bool skip_load_image,
const bool texnode_preview,
float * r_intensity,
float r_rgba[4] )

◆ RE_texture_rng_exit()

void RE_texture_rng_exit ( void )

Definition at line 45 of file texture_procedural.cc.

References BLI_rng_threaded_free(), and random_tex_array.

Referenced by BKE_blender_free().

◆ RE_texture_rng_init()

void RE_texture_rng_init ( void )

Definition at line 40 of file texture_procedural.cc.

References BLI_rng_threaded_new(), and random_tex_array.

Referenced by main().

◆ stucci()

static int stucci ( const Tex * tex,
const float texvec[3],
TexResult * texres )
static

◆ tex_saw()

static float tex_saw ( float a)
static

Definition at line 167 of file texture_procedural.cc.

References b, int, and M_PI.

Referenced by marble_int(), and wood_int().

◆ tex_sin()

static float tex_sin ( float a)
static

Definition at line 159 of file texture_procedural.cc.

References sinf.

Referenced by marble_int(), and wood_int().

◆ tex_tri()

static float tex_tri ( float a)
static

Definition at line 180 of file texture_procedural.cc.

References b, fabsf, floorf, and M_PI.

Referenced by marble_int(), and wood_int().

◆ texnoise()

static int texnoise ( const Tex * tex,
TexResult * texres,
int thread )
static

◆ texture_value_blend()

float texture_value_blend ( float tex,
float out,
float fact,
float facg,
int blendtype )
Parameters
inDestination
texTexture.
outPrevious color.
factTexture strength.
facgButton strength value.

Definition at line 1212 of file texture_procedural.cc.

References ATTR_FALLTHROUGH, col, fabsf, min_ff(), MTEX_ADD, MTEX_BLEND, MTEX_DARK, MTEX_DIFF, MTEX_DIV, MTEX_LIGHT, MTEX_LIN_LIGHT, MTEX_MUL, MTEX_OVERLAY, MTEX_SCREEN, MTEX_SOFT_LIGHT, MTEX_SUB, and tex.

Referenced by get_cpa_texture(), and psys_get_texture().

◆ voronoiTex()

◆ wood()

static int wood ( const Tex * tex,
const float texvec[3],
TexResult * texres )
static

Definition at line 230 of file texture_procedural.cc.

References BRICONT, tex, TEX_INT, TexResult::tin, and wood_int().

◆ wood_int()

Variable Documentation

◆ random_tex_array

RNG_THREAD_ARRAY* random_tex_array
static

Definition at line 38 of file texture_procedural.cc.

Referenced by RE_texture_rng_exit(), RE_texture_rng_init(), and texnoise().