Blender  V3.3
Functions | Variables
texture_procedural.c File Reference
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "BLI_math.h"
#include "BLI_noise.h"
#include "BLI_rand.h"
#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_image_types.h"
#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_texture_types.h"
#include "IMB_colormanagement.h"
#include "IMB_imbuf_types.h"
#include "BKE_colorband.h"
#include "BKE_image.h"
#include "BKE_material.h"
#include "BKE_node.h"
#include "BKE_scene.h"
#include "BKE_texture.h"
#include "NOD_texture.h"
#include "MEM_guardedalloc.h"
#include "render_types.h"
#include "texture_common.h"
#include "RE_texture.h"

Go to the source code of this file.

Functions

void RE_texture_rng_init (void)
 
void RE_texture_rng_exit (void)
 
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, struct 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, MTex *mtex, struct 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, MTex *mtex, struct ImagePool *pool)
 
int multitex_ext (Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, const short thread, struct ImagePool *pool, bool scene_color_manage, const bool skip_load_image)
 
int multitex_ext_safe (Tex *tex, const float texvec[3], TexResult *texres, struct 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, struct 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 599 of file texture_procedural.c.

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

Referenced by do_2d_mapping().

◆ do_2d_mapping()

static void do_2d_mapping ( const MTex mtex,
float  texvec[3],
const float  n[3],
float  dxt[3],
float  dyt[3] 
)
static

◆ magic()

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

◆ marble()

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

Definition at line 288 of file texture_procedural.c.

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

Referenced by multitex().

◆ marble_int()

static float marble_int ( const Tex tex,
float  x,
float  y,
float  z 
)
static

◆ 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()

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

◆ multitex()

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,
struct ImagePool pool,
const bool  skip_load_image,
const bool  texnode_preview,
const bool  use_nodes 
)
static

◆ multitex_ext()

int multitex_ext ( struct Tex tex,
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
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 - Campbell

Use it for stuff which is out of render pipeline.

Definition at line 1161 of file texture_procedural.c.

References multitex_nodes_intern(), NULL, blender::compositor::pool, and tex.

Referenced by do_texture_effector(), blender::compositor::TextureBaseOperation::execute_pixel_sampled(), 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 1188 of file texture_procedural.c.

References multitex_nodes_intern(), NULL, blender::compositor::pool, and tex.

Referenced by BKE_texture_get_value_ex(), and dynamic_paint_set_init_color_tex_to_imseq_cb().

◆ multitex_nodes()

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

Only for internal node usage.

this is called from the shader and texture nodes Use it from render pipeline only!

Definition at line 1134 of file texture_procedural.c.

References multitex_nodes_intern(), blender::compositor::pool, and tex.

Referenced by 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,
MTex mtex,
struct 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,
struct 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 53 of file texture_procedural.c.

References BLI_rng_threaded_free(), NULL, and random_tex_array.

Referenced by BKE_blender_free().

◆ RE_texture_rng_init()

void RE_texture_rng_init ( void  )

Definition at line 48 of file texture_procedural.c.

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 175 of file texture_procedural.c.

References Freestyle::a, usdtokens::b(), and M_PI.

Referenced by marble_int(), and wood_int().

◆ tex_sin()

static float tex_sin ( float  a)
static

Definition at line 167 of file texture_procedural.c.

References Freestyle::a, and sinf.

Referenced by marble_int(), and wood_int().

◆ tex_tri()

static float tex_tri ( float  a)
static

Definition at line 188 of file texture_procedural.c.

References Freestyle::a, usdtokens::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 1213 of file texture_procedural.c.

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, usdtokens::out(), SWAP, and tex.

Referenced by get_cpa_texture(), and psys_get_texture().

◆ voronoiTex()

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

◆ wood()

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

Definition at line 238 of file texture_procedural.c.

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

Referenced by multitex().

◆ wood_int()

static float wood_int ( const Tex tex,
float  x,
float  y,
float  z 
)
static

Variable Documentation

◆ random_tex_array

RNG_THREAD_ARRAY* random_tex_array
static

Definition at line 46 of file texture_procedural.c.

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