Fix T43427: Particle system children sometimes not generated on reload
The issue was caused by the conflict between preview render which would set R_NO_IMAGE_LOAD flag on the renderer and texture samplers called outside of the render pipeline trying to use this flag. Now the sampler functions accepts extra argument so render pipeline can still skip image load, but calls outside of the pipeline will nicely load all the images. Not cleanest change in the world but good enough to unlock gooseberry team, and assuming we already had pool passed all over the place it should be all fine. Will need to reshuffle arguments into SamplerOptions structure later.
This commit is contained in:
@@ -1103,7 +1103,7 @@ static void do_2d_mapping(MTex *mtex, float texvec[3], VlakRen *vlr, const float
|
||||
|
||||
/* ************************************** */
|
||||
|
||||
static int multitex(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, const short thread, short which_output, struct ImagePool *pool)
|
||||
static int multitex(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, const short thread, short which_output, struct ImagePool *pool, const bool skip_load_image)
|
||||
{
|
||||
float tmpvec[3];
|
||||
int retval = 0; /* return value, int:0, col:1, nor:2, everything:3 */
|
||||
@@ -1141,14 +1141,14 @@ static int multitex(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int o
|
||||
retval = texnoise(tex, texres, thread);
|
||||
break;
|
||||
case TEX_IMAGE:
|
||||
if (osatex) retval = imagewraposa(tex, tex->ima, NULL, texvec, dxt, dyt, texres, pool);
|
||||
else retval = imagewrap(tex, tex->ima, NULL, texvec, texres, pool);
|
||||
if (osatex) retval = imagewraposa(tex, tex->ima, NULL, texvec, dxt, dyt, texres, pool, skip_load_image);
|
||||
else retval = imagewrap(tex, tex->ima, NULL, texvec, texres, pool, skip_load_image);
|
||||
if (tex->ima) {
|
||||
BKE_image_tag_time(tex->ima);
|
||||
}
|
||||
break;
|
||||
case TEX_ENVMAP:
|
||||
retval = envmaptex(tex, texvec, dxt, dyt, osatex, texres, pool);
|
||||
retval = envmaptex(tex, texvec, dxt, dyt, osatex, texres, pool, skip_load_image);
|
||||
break;
|
||||
case TEX_MUSGRAVE:
|
||||
/* newnoise: musgrave types */
|
||||
@@ -1220,7 +1220,7 @@ static int multitex(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int o
|
||||
|
||||
static int multitex_nodes_intern(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres,
|
||||
const short thread, short which_output, ShadeInput *shi, MTex *mtex, struct ImagePool *pool,
|
||||
bool scene_color_manage)
|
||||
bool scene_color_manage, const bool skip_load_image)
|
||||
{
|
||||
if (tex==NULL) {
|
||||
memset(texres, 0, sizeof(TexResult));
|
||||
@@ -1236,7 +1236,7 @@ static int multitex_nodes_intern(Tex *tex, float texvec[3], float dxt[3], float
|
||||
if (mtex) {
|
||||
/* we have mtex, use it for 2d mapping images only */
|
||||
do_2d_mapping(mtex, texvec, shi->vlr, shi->facenor, dxt, dyt);
|
||||
rgbnor = multitex(tex, texvec, dxt, dyt, osatex, texres, thread, which_output, pool);
|
||||
rgbnor = multitex(tex, texvec, dxt, dyt, osatex, texres, thread, which_output, pool, skip_load_image);
|
||||
|
||||
if (mtex->mapto & (MAP_COL+MAP_COLSPEC+MAP_COLMIR)) {
|
||||
ImBuf *ibuf = BKE_image_pool_acquire_ibuf(tex->ima, &tex->iuser, pool);
|
||||
@@ -1269,7 +1269,7 @@ static int multitex_nodes_intern(Tex *tex, float texvec[3], float dxt[3], float
|
||||
}
|
||||
|
||||
do_2d_mapping(&localmtex, texvec_l, NULL, NULL, dxt_l, dyt_l);
|
||||
rgbnor = multitex(tex, texvec_l, dxt_l, dyt_l, osatex, texres, thread, which_output, pool);
|
||||
rgbnor = multitex(tex, texvec_l, dxt_l, dyt_l, osatex, texres, thread, which_output, pool, skip_load_image);
|
||||
|
||||
{
|
||||
ImBuf *ibuf = BKE_image_pool_acquire_ibuf(tex->ima, &tex->iuser, pool);
|
||||
@@ -1285,7 +1285,7 @@ static int multitex_nodes_intern(Tex *tex, float texvec[3], float dxt[3], float
|
||||
return rgbnor;
|
||||
}
|
||||
else {
|
||||
return multitex(tex, texvec, dxt, dyt, osatex, texres, thread, which_output, pool);
|
||||
return multitex(tex, texvec, dxt, dyt, osatex, texres, thread, which_output, pool, skip_load_image);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1296,11 +1296,12 @@ int multitex_nodes(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int os
|
||||
const short thread, short which_output, ShadeInput *shi, MTex *mtex, struct ImagePool *pool)
|
||||
{
|
||||
return multitex_nodes_intern(tex, texvec, dxt, dyt, osatex, texres,
|
||||
thread, which_output, shi, mtex, pool, R.scene_color_manage);
|
||||
thread, which_output, shi, mtex, pool, R.scene_color_manage,
|
||||
(R.r.scemode & R_NO_IMAGE_LOAD) != 0);
|
||||
}
|
||||
|
||||
/* this is called for surface shading */
|
||||
static int multitex_mtex(ShadeInput *shi, MTex *mtex, float texvec[3], float dxt[3], float dyt[3], TexResult *texres, struct ImagePool *pool)
|
||||
static int multitex_mtex(ShadeInput *shi, MTex *mtex, float texvec[3], float dxt[3], float dyt[3], TexResult *texres, struct ImagePool *pool, const bool skip_load_image)
|
||||
{
|
||||
Tex *tex = mtex->tex;
|
||||
|
||||
@@ -1311,7 +1312,7 @@ static int multitex_mtex(ShadeInput *shi, MTex *mtex, float texvec[3], float dxt
|
||||
tex, mtex->which_output, R.r.cfra, (R.r.scemode & R_TEXNODE_PREVIEW) != 0, shi, mtex);
|
||||
}
|
||||
else {
|
||||
return multitex(mtex->tex, texvec, dxt, dyt, shi->osatex, texres, shi->thread, mtex->which_output, pool);
|
||||
return multitex(mtex->tex, texvec, dxt, dyt, shi->osatex, texres, shi->thread, mtex->which_output, pool, skip_load_image);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1320,21 +1321,21 @@ static int multitex_mtex(ShadeInput *shi, MTex *mtex, float texvec[3], float dxt
|
||||
*
|
||||
* Use it for stuff which is out of render pipeline.
|
||||
*/
|
||||
int multitex_ext(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, struct ImagePool *pool, bool scene_color_manage)
|
||||
int multitex_ext(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, struct ImagePool *pool, bool scene_color_manage, const bool skip_load_image)
|
||||
{
|
||||
return multitex_nodes_intern(tex, texvec, dxt, dyt, osatex, texres, 0, 0, NULL, NULL, pool, scene_color_manage);
|
||||
return multitex_nodes_intern(tex, texvec, dxt, dyt, osatex, texres, 0, 0, NULL, NULL, pool, scene_color_manage, skip_load_image);
|
||||
}
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
int multitex_ext_safe(Tex *tex, float texvec[3], TexResult *texres, struct ImagePool *pool, bool scene_color_manage)
|
||||
int multitex_ext_safe(Tex *tex, float texvec[3], TexResult *texres, struct ImagePool *pool, bool scene_color_manage, const bool skip_load_image)
|
||||
{
|
||||
int use_nodes= tex->use_nodes, retval;
|
||||
|
||||
tex->use_nodes = false;
|
||||
retval= multitex_nodes_intern(tex, texvec, NULL, NULL, 0, texres, 0, 0, NULL, NULL, pool, scene_color_manage);
|
||||
retval= multitex_nodes_intern(tex, texvec, NULL, NULL, 0, texres, 0, 0, NULL, NULL, pool, scene_color_manage, skip_load_image);
|
||||
tex->use_nodes= use_nodes;
|
||||
|
||||
return retval;
|
||||
@@ -1718,7 +1719,7 @@ static void compatible_bump_uv_derivs(CompatibleBump *compat_bump, ShadeInput *s
|
||||
|
||||
static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi, MTex *mtex, Tex *tex, TexResult *texres,
|
||||
float Tnor, const float co[3], const float dx[3], const float dy[3], float texvec[3], float dxt[3], float dyt[3],
|
||||
struct ImagePool *pool)
|
||||
struct ImagePool *pool, const bool skip_load_image)
|
||||
{
|
||||
TexResult ttexr = {0, 0, 0, 0, 0, texres->talpha, NULL}; /* temp TexResult */
|
||||
float tco[3], texv[3], cd, ud, vd, du, dv, idu, idv;
|
||||
@@ -1771,7 +1772,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
|
||||
|
||||
/* center, main return value */
|
||||
texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt);
|
||||
rgbnor = multitex_mtex(shi, mtex, texvec, dxt, dyt, texres, pool);
|
||||
rgbnor = multitex_mtex(shi, mtex, texvec, dxt, dyt, texres, pool, skip_load_image);
|
||||
cd = fromrgb ? (texres->tr + texres->tg + texres->tb) / 3.0f : texres->tin;
|
||||
|
||||
if (mtex->texco == TEXCO_UV) {
|
||||
@@ -1785,7 +1786,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
|
||||
tco[1] = co[1] + compat_bump->dvdnu*du;
|
||||
tco[2] = 0.f;
|
||||
texco_mapping(shi, tex, mtex, tco, dx, dy, texv, dxt, dyt);
|
||||
multitex_mtex(shi, mtex, texv, dxt, dyt, &ttexr, pool);
|
||||
multitex_mtex(shi, mtex, texv, dxt, dyt, &ttexr, pool, skip_load_image);
|
||||
ud = idu*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb) / 3.0f : ttexr.tin));
|
||||
|
||||
/* +v val */
|
||||
@@ -1793,7 +1794,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
|
||||
tco[1] = co[1] + compat_bump->dvdnv*du;
|
||||
tco[2] = 0.f;
|
||||
texco_mapping(shi, tex, mtex, tco, dx, dy, texv, dxt, dyt);
|
||||
multitex_mtex(shi, mtex, texv, dxt, dyt, &ttexr, pool);
|
||||
multitex_mtex(shi, mtex, texv, dxt, dyt, &ttexr, pool, skip_load_image);
|
||||
vd = idu*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb) / 3.0f : ttexr.tin));
|
||||
}
|
||||
else {
|
||||
@@ -1827,7 +1828,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
|
||||
tco[1] = co[1] + tu[1]*du;
|
||||
tco[2] = co[2] + tu[2]*du;
|
||||
texco_mapping(shi, tex, mtex, tco, dx, dy, texv, dxt, dyt);
|
||||
multitex_mtex(shi, mtex, texv, dxt, dyt, &ttexr, pool);
|
||||
multitex_mtex(shi, mtex, texv, dxt, dyt, &ttexr, pool, skip_load_image);
|
||||
ud = idu*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb) / 3.0f : ttexr.tin));
|
||||
|
||||
/* +v val */
|
||||
@@ -1835,7 +1836,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
|
||||
tco[1] = co[1] + tv[1]*dv;
|
||||
tco[2] = co[2] + tv[2]*dv;
|
||||
texco_mapping(shi, tex, mtex, tco, dx, dy, texv, dxt, dyt);
|
||||
multitex_mtex(shi, mtex, texv, dxt, dyt, &ttexr, pool);
|
||||
multitex_mtex(shi, mtex, texv, dxt, dyt, &ttexr, pool, skip_load_image);
|
||||
vd = idv*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb) / 3.0f : ttexr.tin));
|
||||
}
|
||||
|
||||
@@ -1877,7 +1878,8 @@ 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, const float co[3], const float dx[3], const float dy[3],
|
||||
float texvec[3], float dxt[3], float dyt[3], struct ImagePool *pool)
|
||||
float texvec[3], float dxt[3], float dyt[3], struct ImagePool *pool,
|
||||
const bool skip_load_image)
|
||||
{
|
||||
TexResult ttexr = {0, 0, 0, 0, 0, texres->talpha, NULL}; /* temp TexResult */
|
||||
|
||||
@@ -1937,7 +1939,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
|
||||
float dBdu, dBdv, auto_bump = 1.0f;
|
||||
float s = 1; /* negate this if flipped texture coordinate */
|
||||
texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt);
|
||||
rgbnor = multitex_mtex(shi, mtex, texvec, dxt, dyt, texres, pool);
|
||||
rgbnor = multitex_mtex(shi, mtex, texvec, dxt, dyt, texres, pool, skip_load_image);
|
||||
|
||||
if (shi->obr->ob->derivedFinal) {
|
||||
auto_bump = shi->obr->ob->derivedFinal->auto_bump_scale;
|
||||
@@ -1979,14 +1981,14 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
|
||||
}
|
||||
|
||||
/* use texres for the center sample, set rgbnor */
|
||||
rgbnor = multitex_mtex(shi, mtex, STll, dxt, dyt, texres, pool);
|
||||
rgbnor = multitex_mtex(shi, mtex, STll, dxt, dyt, texres, pool, skip_load_image);
|
||||
Hll = (fromrgb) ? rgb_to_grayscale(&texres->tr) : texres->tin;
|
||||
|
||||
/* use ttexr for the other 2 taps */
|
||||
multitex_mtex(shi, mtex, STlr, dxt, dyt, &ttexr, pool);
|
||||
multitex_mtex(shi, mtex, STlr, dxt, dyt, &ttexr, pool, skip_load_image);
|
||||
Hlr = (fromrgb) ? rgb_to_grayscale(&ttexr.tr) : ttexr.tin;
|
||||
|
||||
multitex_mtex(shi, mtex, STul, dxt, dyt, &ttexr, pool);
|
||||
multitex_mtex(shi, mtex, STul, dxt, dyt, &ttexr, pool, skip_load_image);
|
||||
Hul = (fromrgb) ? rgb_to_grayscale(&ttexr.tr) : ttexr.tin;
|
||||
|
||||
dHdx = Hscale*(Hlr - Hll);
|
||||
@@ -2017,17 +2019,17 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
|
||||
}
|
||||
|
||||
/* use texres for the center sample, set rgbnor */
|
||||
rgbnor = multitex_mtex(shi, mtex, STc, dxt, dyt, texres, pool);
|
||||
rgbnor = multitex_mtex(shi, mtex, STc, dxt, dyt, texres, pool, skip_load_image);
|
||||
/* Hc = (fromrgb) ? rgb_to_grayscale(&texres->tr) : texres->tin; */ /* UNUSED */
|
||||
|
||||
/* use ttexr for the other taps */
|
||||
multitex_mtex(shi, mtex, STl, dxt, dyt, &ttexr, pool);
|
||||
multitex_mtex(shi, mtex, STl, dxt, dyt, &ttexr, pool, skip_load_image);
|
||||
Hl = (fromrgb) ? rgb_to_grayscale(&ttexr.tr) : ttexr.tin;
|
||||
multitex_mtex(shi, mtex, STr, dxt, dyt, &ttexr, pool);
|
||||
multitex_mtex(shi, mtex, STr, dxt, dyt, &ttexr, pool, skip_load_image);
|
||||
Hr = (fromrgb) ? rgb_to_grayscale(&ttexr.tr) : ttexr.tin;
|
||||
multitex_mtex(shi, mtex, STd, dxt, dyt, &ttexr, pool);
|
||||
multitex_mtex(shi, mtex, STd, dxt, dyt, &ttexr, pool, skip_load_image);
|
||||
Hd = (fromrgb) ? rgb_to_grayscale(&ttexr.tr) : ttexr.tin;
|
||||
multitex_mtex(shi, mtex, STu, dxt, dyt, &ttexr, pool);
|
||||
multitex_mtex(shi, mtex, STu, dxt, dyt, &ttexr, pool, skip_load_image);
|
||||
Hu = (fromrgb) ? rgb_to_grayscale(&ttexr.tr) : ttexr.tin;
|
||||
|
||||
dHdx = Hscale*(Hr - Hl);
|
||||
@@ -2137,6 +2139,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
|
||||
|
||||
void do_material_tex(ShadeInput *shi, Render *re)
|
||||
{
|
||||
const bool skip_load_image = (R.r.scemode & R_NO_IMAGE_LOAD) != 0;
|
||||
CompatibleBump compat_bump;
|
||||
NTapBump ntap_bump;
|
||||
MTex *mtex;
|
||||
@@ -2305,21 +2308,21 @@ void do_material_tex(ShadeInput *shi, Render *re)
|
||||
if (use_compat_bump) {
|
||||
rgbnor = compatible_bump_compute(&compat_bump, shi, mtex, tex,
|
||||
&texres, Tnor*stencilTin, co, dx, dy, texvec, dxt, dyt,
|
||||
re->pool);
|
||||
re->pool, skip_load_image);
|
||||
}
|
||||
else if (use_ntap_bump) {
|
||||
rgbnor = ntap_bump_compute(&ntap_bump, shi, mtex, tex,
|
||||
&texres, Tnor*stencilTin, co, dx, dy, texvec, dxt, dyt,
|
||||
re->pool);
|
||||
re->pool, skip_load_image);
|
||||
}
|
||||
else {
|
||||
texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt);
|
||||
rgbnor = multitex_mtex(shi, mtex, texvec, dxt, dyt, &texres, re->pool);
|
||||
rgbnor = multitex_mtex(shi, mtex, texvec, dxt, dyt, &texres, re->pool, skip_load_image);
|
||||
}
|
||||
}
|
||||
else {
|
||||
texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt);
|
||||
rgbnor = multitex_mtex(shi, mtex, texvec, dxt, dyt, &texres, re->pool);
|
||||
rgbnor = multitex_mtex(shi, mtex, texvec, dxt, dyt, &texres, re->pool, skip_load_image);
|
||||
}
|
||||
|
||||
/* texture output */
|
||||
@@ -2671,6 +2674,7 @@ void do_material_tex(ShadeInput *shi, Render *re)
|
||||
|
||||
void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float col_r[3], float *val, Render *re)
|
||||
{
|
||||
const bool skip_load_image = (re->r.scemode & R_NO_IMAGE_LOAD) != 0;
|
||||
MTex *mtex;
|
||||
Tex *tex;
|
||||
TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
|
||||
@@ -2758,7 +2762,7 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float col_
|
||||
else texvec[2]= mtex->size[2]*(mtex->ofs[2]);
|
||||
}
|
||||
|
||||
rgbnor = multitex(tex, texvec, NULL, NULL, 0, &texres, shi->thread, mtex->which_output, re->pool); /* NULL = dxt/dyt, 0 = shi->osatex - not supported */
|
||||
rgbnor = multitex(tex, texvec, NULL, NULL, 0, &texres, shi->thread, mtex->which_output, re->pool, skip_load_image); /* NULL = dxt/dyt, 0 = shi->osatex - not supported */
|
||||
|
||||
/* texture output */
|
||||
|
||||
@@ -2869,6 +2873,7 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float col_
|
||||
|
||||
void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
|
||||
{
|
||||
const bool skip_load_image = har->skip_load_image;
|
||||
MTex *mtex;
|
||||
TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
|
||||
float texvec[3], dxt[3], dyt[3], fact, facm, dx;
|
||||
@@ -2925,7 +2930,7 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
|
||||
|
||||
if (mtex->tex->type==TEX_IMAGE) do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
|
||||
|
||||
rgb = multitex(mtex->tex, texvec, dxt, dyt, osatex, &texres, 0, mtex->which_output, har->pool);
|
||||
rgb = multitex(mtex->tex, texvec, dxt, dyt, osatex, &texres, 0, mtex->which_output, har->pool, skip_load_image);
|
||||
|
||||
/* texture output */
|
||||
if (rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
||||
@@ -3014,6 +3019,7 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
|
||||
/* hor and zen are RGB vectors, blend is 1 float, should all be initialized */
|
||||
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)
|
||||
{
|
||||
const bool skip_load_image = (R.r.scemode & R_NO_IMAGE_LOAD) != 0;
|
||||
MTex *mtex;
|
||||
Tex *tex;
|
||||
TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
|
||||
@@ -3130,7 +3136,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
|
||||
/* texture */
|
||||
if (tex->type==TEX_IMAGE) do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
|
||||
|
||||
rgb = multitex(mtex->tex, texvec, dxt, dyt, R.osa, &texres, thread, mtex->which_output, R.pool);
|
||||
rgb = multitex(mtex->tex, texvec, dxt, dyt, R.osa, &texres, thread, mtex->which_output, R.pool, skip_load_image);
|
||||
|
||||
/* texture output */
|
||||
if (rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
||||
@@ -3222,6 +3228,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
|
||||
|
||||
void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r[3], int effect)
|
||||
{
|
||||
const bool skip_load_image = (R.r.scemode & R_NO_IMAGE_LOAD) != 0;
|
||||
Object *ob;
|
||||
MTex *mtex;
|
||||
Tex *tex;
|
||||
@@ -3345,7 +3352,7 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
|
||||
do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
|
||||
}
|
||||
|
||||
rgb = multitex(tex, texvec, dxt, dyt, shi->osatex, &texres, shi->thread, mtex->which_output, R.pool);
|
||||
rgb = multitex(tex, texvec, dxt, dyt, shi->osatex, &texres, shi->thread, mtex->which_output, R.pool, skip_load_image);
|
||||
|
||||
/* texture output */
|
||||
if (rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
||||
@@ -3419,7 +3426,7 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
int externtex(MTex *mtex, const float vec[3], float *tin, float *tr, float *tg, float *tb, float *ta, const int thread, struct ImagePool *pool)
|
||||
int externtex(MTex *mtex, const float vec[3], float *tin, float *tr, float *tg, float *tb, float *ta, const int thread, struct ImagePool *pool, const bool skip_load_image)
|
||||
{
|
||||
Tex *tex;
|
||||
TexResult texr;
|
||||
@@ -3445,7 +3452,7 @@ int externtex(MTex *mtex, const float vec[3], float *tin, float *tr, float *tg,
|
||||
do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
|
||||
}
|
||||
|
||||
rgb = multitex(tex, texvec, dxt, dyt, 0, &texr, thread, mtex->which_output, pool);
|
||||
rgb = multitex(tex, texvec, dxt, dyt, 0, &texr, thread, mtex->which_output, pool, skip_load_image);
|
||||
|
||||
if (rgb) {
|
||||
texr.tin = rgb_to_bw(&texr.tr);
|
||||
@@ -3470,6 +3477,7 @@ int externtex(MTex *mtex, const float vec[3], float *tin, float *tr, float *tg,
|
||||
|
||||
void render_realtime_texture(ShadeInput *shi, Image *ima)
|
||||
{
|
||||
const bool skip_load_image = (R.r.scemode & R_NO_IMAGE_LOAD) != 0;
|
||||
TexResult texr;
|
||||
static Tex imatex[BLENDER_MAX_THREADS]; /* threadsafe */
|
||||
static int firsttime= 1;
|
||||
@@ -3510,8 +3518,8 @@ void render_realtime_texture(ShadeInput *shi, Image *ima)
|
||||
|
||||
texr.nor= NULL;
|
||||
|
||||
if (shi->osatex) imagewraposa(tex, ima, NULL, texvec, dx, dy, &texr, R.pool);
|
||||
else imagewrap(tex, ima, NULL, texvec, &texr, R.pool);
|
||||
if (shi->osatex) imagewraposa(tex, ima, NULL, texvec, dx, dy, &texr, R.pool, skip_load_image);
|
||||
else imagewrap(tex, ima, NULL, texvec, &texr, R.pool, skip_load_image);
|
||||
|
||||
shi->vcol[0]*= texr.tr;
|
||||
shi->vcol[1]*= texr.tg;
|
||||
|
||||
Reference in New Issue
Block a user