69 texres->
tin = (1.0f +
x) / 2.0f;
72 texres->
tin = (1.0f +
x) / 2.0f;
73 if (texres->
tin < 0.0f) {
77 texres->
tin *= texres->
tin;
81 texres->
tin = (1.0f +
x) / 2.0f;
82 if (texres->
tin <= 0.0f) {
85 else if (texres->
tin >= 1.0f) {
89 t = texres->
tin * texres->
tin;
90 texres->
tin = (3.0f * t - 2.0f * t * texres->
tin);
94 texres->
tin = (2.0f +
x +
y) / 4.0f;
100 texres->
tin = 1.0f -
sqrtf(
x *
x +
y *
y + texvec[2] * texvec[2]);
101 texres->
tin = std::max(texres->
tin, 0.0f);
103 texres->
tin *= texres->
tin;
146 texres->
trgba[3] = 1.0;
158 a = 0.5f + 0.5f *
sinf(a);
166 const float b = 2 *
M_PI;
179 const float b = 2 *
M_PI;
180 const float rmax = 1.0;
182 a = rmax - 2.0f *
fabsf(
floorf((a * (1.0f /
b)) + 0.5f) - (a * (1.0f /
b)));
194 short wt = tex->
stype;
206 wi = waveform[wf]((
x +
y +
z) * 10.0f);
209 wi = waveform[wf](
sqrtf(
x *
x +
y *
y +
z *
z) * 20.0f);
215 wi = waveform[wf]((
x +
y +
z) * 10.0f + wi);
221 wi = waveform[wf](
sqrtf(
x *
x +
y *
y +
z *
z) * 20.0f + wi);
231 texres->
tin =
wood_int(tex, texvec[0], texvec[1], texvec[2]);
243 short mt = tex->
stype;
254 n = 5.0f * (
x +
y +
z);
265 mi = waveform[wf](mi);
281 texres->
tin =
marble_int(tex, texvec[0], texvec[1], texvec[2]);
298 x =
sinf((texvec[0] + texvec[1] + texvec[2]) * 5.0f);
299 y =
cosf((-texvec[0] + texvec[1] - texvec[2]) * 5.0f);
300 z = -
cosf((-texvec[0] - texvec[1] + texvec[2]) * 5.0f);
351 texres->
trgba[0] = 0.5f -
x;
352 texres->
trgba[1] = 0.5f -
y;
353 texres->
trgba[2] = 0.5f -
z;
355 texres->
tin = (1.0f / 3.0f) * (texres->
trgba[0] + texres->
trgba[1] + texres->
trgba[2]);
358 texres->
trgba[3] = 1.0f;
378 ofs = tex->
turbul / 200.0f;
392 texres->
tin = 1.0f - texres->
tin;
395 texres->
tin = std::max(texres->
tin, 0.0f);
499 float sc = (aw1 + aw2 + aw3 + aw4);
511 texres->
trgba[0] = aw1 * ca[0];
512 texres->
trgba[1] = aw1 * ca[1];
513 texres->
trgba[2] = aw1 * ca[2];
515 texres->
trgba[0] += aw2 * ca[0];
516 texres->
trgba[1] += aw2 * ca[1];
517 texres->
trgba[2] += aw2 * ca[2];
519 texres->
trgba[0] += aw3 * ca[0];
520 texres->
trgba[1] += aw3 * ca[1];
521 texres->
trgba[2] += aw3 * ca[2];
523 texres->
trgba[0] += aw4 * ca[0];
524 texres->
trgba[1] += aw4 * ca[1];
525 texres->
trgba[2] += aw4 * ca[2];
527 float t1 = (da[1] - da[0]) * 10;
528 t1 = std::min<float>(t1, 1);
535 texres->
trgba[0] *= t1;
536 texres->
trgba[1] *= t1;
537 texres->
trgba[2] *= t1;
540 texres->
trgba[0] *= sc;
541 texres->
trgba[1] *= sc;
542 texres->
trgba[2] *= sc;
548 texres->
trgba[3] = 1.0;
562 int val, ran, loop, shift = 29;
569 val = ((ran >> shift) & 3);
573 val *= ((ran >> shift) & 3);
585static int cubemap_glob(
const float n[3],
float x,
float y,
float z,
float *adr1,
float *adr2)
587 float x1, y1, z1, nor[3];
603 if (z1 >= x1 && z1 >= y1) {
604 *adr1 = (
x + 1.0f) / 2.0f;
605 *adr2 = (
y + 1.0f) / 2.0f;
608 else if (y1 >= x1 && y1 >= z1) {
609 *adr1 = (
x + 1.0f) / 2.0f;
610 *adr2 = (
z + 1.0f) / 2.0f;
614 *adr1 = (
y + 1.0f) / 2.0f;
615 *adr2 = (
z + 1.0f) / 2.0f;
636 fx = (texvec[0] + 1.0f) / 2.0f;
637 fy = (texvec[1] + 1.0f) / 2.0f;
640 map_to_tube(&fx, &fy, texvec[0], texvec[1], texvec[2]);
646 cubemap_glob(n, texvec[0], texvec[1], texvec[2], &fx, &fy);
652 float origf = fx *= tex->
xrepeat;
657 else if (fx < 0.0f) {
662 int orig = int(
floor(origf));
669 float origf = fy *= tex->
yrepeat;
674 else if (fy < 0.0f) {
679 int orig = int(
floor(origf));
704 const float texvec[3],
707 const short which_output,
709 const bool skip_load_image,
710 const bool texnode_preview,
711 const bool use_nodes)
719 const float cfra = 1.0f;
721 tex->
nodetree, texres, texvec,
thread, tex, which_output, cfra, texnode_preview,
nullptr);
730 retval =
clouds(tex, texvec, texres);
733 retval =
wood(tex, texvec, texres);
736 retval =
marble(tex, texvec, texres);
739 retval =
magic(tex, texvec, texres);
742 retval =
blend(tex, texvec, texres);
745 retval =
stucci(tex, texvec, texres);
751 retval =
imagewrap(tex, tex->
ima, texvec, texres, pool, skip_load_image);
761 switch (tex->
stype) {
807 const float texvec[3],
813 const bool scene_color_manage,
814 const bool skip_load_image,
815 const bool texnode_preview,
816 const bool use_nodes)
818 if (tex ==
nullptr) {
866 localmtex.
object =
nullptr;
912 const float texvec[3],
920 tex, texvec, texres,
thread, which_output, mtex, pool,
true,
false,
false,
true);
924 const float texvec[3],
928 bool scene_color_manage,
929 const bool skip_load_image)
945 const float texvec[3],
948 bool scene_color_manage,
949 const bool skip_load_image)
952 tex, texvec, texres, 0, 0,
nullptr, pool, scene_color_manage, skip_load_image,
false,
false);
959 float in = 0.0, facm, scf;
960 int flip = (facg < 0.0f);
967 std::swap(fact, facm);
972 in = fact * tex + facm *
out;
977 in = (facm + fact * tex) *
out;
982 in = 1.0f - (facm + fact * (1.0f - tex)) * (1.0f -
out);
988 in =
out * (facm + 2.0f * fact * tex);
991 in = 1.0f - (facm + 2.0f * fact * (1.0f - tex)) * (1.0f -
out);
999 in = fact * tex +
out;
1004 in = facm *
out + fact *
out / tex;
1021 scf = 1.0f - (1.0f - tex) * (1.0f -
out);
1022 in = facm *
out + fact * ((1.0f -
out) * tex *
out) + (
out * scf);
1027 in =
out + fact * (2.0f * (tex - 0.5f));
1030 in =
out + fact * (2.0f * tex - 1.0f);
1044 const bool skip_load_image,
1045 const bool texnode_preview,
1056 if (tex ==
nullptr) {
1062 texvec[0] = mtex->
size[0] * (vec[mtex->
projx - 1] + mtex->
ofs[0]);
1065 texvec[0] = mtex->
size[0] * (mtex->
ofs[0]);
1069 texvec[1] = mtex->
size[1] * (vec[mtex->
projy - 1] + mtex->
ofs[1]);
1072 texvec[1] = mtex->
size[1] * (mtex->
ofs[1]);
1076 texvec[2] = mtex->
size[2] * (vec[mtex->
projz - 1] + mtex->
ofs[2]);
1079 texvec[2] = mtex->
size[2] * (mtex->
ofs[2]);
1104 *r_intensity = texr.
tin;
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
BLI_INLINE Texture * wrap(MTLTexture *texture)
float texture_value_blend(float tex, float out, float fact, float facg, int blendtype)
MINLINE float min_ff(float a, float b)
static int multitex_nodes_intern(Tex *tex, const float texvec[3], 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)
float BLI_noise_generic_turbulence(float noisesize, float x, float y, float z, int oct, bool hard, int noisebasis)
static int stucci(const Tex *tex, const float texvec[3], TexResult *texres)
bool map_to_tube(float *r_u, float *r_v, float x, float y, float z)
float BLI_noise_mg_ridged_multi_fractal(float x, float y, float z, float H, float lacunarity, float octaves, float offset, float gain, int noisebasis)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void RE_texture_rng_init()
int multitex_ext(Tex *tex, const float texvec[3], TexResult *texres, const short thread, ImagePool *pool, bool scene_color_manage, const bool skip_load_image)
static void do_2d_mapping(const MTex *mtex, float texvec[3], const float n[3])
static float marble_int(const Tex *tex, float x, float y, float z)
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)
float BLI_noise_generic_noise(float noisesize, float x, float y, float z, bool hard, int noisebasis)
float BLI_noise_mg_hybrid_multi_fractal(float x, float y, float z, float H, float lacunarity, float octaves, float offset, float gain, int noisebasis)
static int mg_mFractalOrfBmTex(const Tex *tex, const float texvec[3], TexResult *texres)
bool BKE_colorband_evaluate(const ColorBand *coba, float in, float out[4])
static float tex_tri(float a)
void RE_texture_rng_exit()
bool map_to_sphere(float *r_u, float *r_v, float x, float y, float z)
float BLI_noise_mg_multi_fractal(float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis)
static float wood_int(const Tex *tex, float x, float y, float z)
int BLI_rng_thread_rand(RNG_THREAD_ARRAY *rngarr, int thread) ATTR_WARN_UNUSED_RESULT
float BLI_noise_mg_hetero_terrain(float x, float y, float z, float H, float lacunarity, float octaves, float offset, int noisebasis)
MINLINE void mul_v3_fl(float r[3], float f)
static int marble(const Tex *tex, const float texvec[3], TexResult *texres)
void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3], const ColorSpace *colorspace)
static int mg_distNoiseTex(const Tex *tex, const float texvec[3], TexResult *texres)
void BLI_noise_voronoi(float x, float y, float z, float *da, float *pa, float me, int dtype)
float BLI_noise_mg_fbm(float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis)
static int cubemap_glob(const float n[3], float x, float y, float z, float *adr1, float *adr2)
static int mg_ridgedOrHybridMFTex(const Tex *tex, const float texvec[3], TexResult *texres)
static float tex_sin(float a)
float BLI_noise_mg_variable_lacunarity(float x, float y, float z, float distortion, int nbas1, int nbas2)
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])
static float tex_saw(float a)
static int magic(const Tex *tex, const float texvec[3], TexResult *texres)
BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3])
RNG_THREAD_ARRAY * BLI_rng_threaded_new()
MINLINE void copy_v3_fl3(float v[3], float x, float y, float z)
int ntreeTexExecTree(struct bNodeTree *ntree, struct TexResult *target, const float co[3], short thread, const struct Tex *tex, short which_output, int cfra, int preview, struct MTex *mtex)
static int mg_HTerrainTex(const Tex *tex, const float texvec[3], TexResult *texres)
int multitex_nodes(Tex *tex, const float texvec[3], TexResult *texres, const short thread, short which_output, const MTex *mtex, ImagePool *pool)
int multitex_ext_safe(Tex *tex, const float texvec[3], TexResult *texres, ImagePool *pool, bool scene_color_manage, const bool skip_load_image)
MINLINE float max_ff(float a, float b)
static RNG_THREAD_ARRAY * random_tex_array
void BLI_rng_threaded_free(struct RNG_THREAD_ARRAY *rngarr) ATTR_NONNULL(1)
MINLINE float dot_v4v4(const float a[4], const float b[4]) ATTR_WARN_UNUSED_RESULT
void BLI_noise_cell_v3(float x, float y, float z, float r_ca[3])
static int clouds(const Tex *tex, const float texvec[3], TexResult *texres)
MINLINE void copy_v4_v4(float r[4], const float a[4])
static float turb(float x, float y, float z, int oct, int hard, int nb, float ampscale, float freqscale)
static int texnoise(const Tex *tex, TexResult *texres, int thread)
static int wood(const Tex *tex, const float texvec[3], TexResult *texres)
ImBuf * BKE_image_pool_acquire_ibuf(Image *ima, ImageUser *iuser, ImagePool *pool)
static int multitex(Tex *tex, const float texvec[3], 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 voronoiTex(const Tex *tex, const float texvec[3], TexResult *texres)
void BKE_image_pool_release_ibuf(Image *ima, ImBuf *ibuf, ImagePool *pool)
int imagewrap(struct Tex *tex, struct Image *ima, const float texvec[3], struct TexResult *texres, struct ImagePool *pool, bool skip_load_image)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
const ColorSpace * colorspace
ImBufByteBuffer byte_buffer
const float * float_data() const
eTex_VoronoiDistMetric vn_distm
eTex_VoronoiColType vn_coltype
struct bNodeTree * nodetree
eTex_NoiseBasis noisebasis
eTex_NoiseBasis noisebasis2