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:
@@ -542,7 +542,7 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br,
|
||||
/* Get strength by feeding the vertex
|
||||
* location directly into a texture */
|
||||
hasrgb = externtex(mtex, point, &intensity,
|
||||
rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool);
|
||||
rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false);
|
||||
}
|
||||
else if (mtex->brush_map_mode == MTEX_MAP_MODE_STENCIL) {
|
||||
float rotation = -mtex->rot;
|
||||
@@ -573,7 +573,7 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br,
|
||||
co[2] = 0.0f;
|
||||
|
||||
hasrgb = externtex(mtex, co, &intensity,
|
||||
rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool);
|
||||
rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false);
|
||||
}
|
||||
else {
|
||||
float rotation = -mtex->rot;
|
||||
@@ -630,7 +630,7 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br,
|
||||
co[2] = 0.0f;
|
||||
|
||||
hasrgb = externtex(mtex, co, &intensity,
|
||||
rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool);
|
||||
rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false);
|
||||
}
|
||||
|
||||
intensity += br->texture_sample_bias;
|
||||
@@ -690,7 +690,7 @@ float BKE_brush_sample_masktex(const Scene *scene, Brush *br,
|
||||
co[2] = 0.0f;
|
||||
|
||||
externtex(mtex, co, &intensity,
|
||||
rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool);
|
||||
rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false);
|
||||
}
|
||||
else {
|
||||
float rotation = -mtex->rot;
|
||||
@@ -747,7 +747,7 @@ float BKE_brush_sample_masktex(const Scene *scene, Brush *br,
|
||||
co[2] = 0.0f;
|
||||
|
||||
externtex(mtex, co, &intensity,
|
||||
rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool);
|
||||
rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false);
|
||||
}
|
||||
|
||||
CLAMP(intensity, 0.0f, 1.0f);
|
||||
@@ -1007,7 +1007,7 @@ unsigned int *BKE_brush_gen_texture_cache(Brush *br, int half_side, bool use_sec
|
||||
/* This is copied from displace modifier code */
|
||||
/* TODO(sergey): brush are always cacheing with CM enabled for now. */
|
||||
externtex(mtex, co, &intensity,
|
||||
rgba, rgba + 1, rgba + 2, rgba + 3, 0, NULL);
|
||||
rgba, rgba + 1, rgba + 2, rgba + 3, 0, NULL, false);
|
||||
|
||||
((char *)texcache)[(iy * side + ix) * 4] =
|
||||
((char *)texcache)[(iy * side + ix) * 4 + 1] =
|
||||
|
||||
@@ -1502,7 +1502,7 @@ static void dynamicPaint_setInitialColor(Scene *scene, DynamicPaintSurface *surf
|
||||
uv[0] = tface[i].uv[j][0] * 2.0f - 1.0f;
|
||||
uv[1] = tface[i].uv[j][1] * 2.0f - 1.0f;
|
||||
|
||||
multitex_ext_safe(tex, uv, &texres, pool, scene_color_manage);
|
||||
multitex_ext_safe(tex, uv, &texres, pool, scene_color_manage, false);
|
||||
|
||||
if (texres.tin > pPoint[*vert].alpha) {
|
||||
copy_v3_v3(pPoint[*vert].color, &texres.tr);
|
||||
@@ -1536,7 +1536,7 @@ static void dynamicPaint_setInitialColor(Scene *scene, DynamicPaintSurface *surf
|
||||
uv_final[0] = uv_final[0] * 2.0f - 1.0f;
|
||||
uv_final[1] = uv_final[1] * 2.0f - 1.0f;
|
||||
|
||||
multitex_ext_safe(tex, uv_final, &texres, NULL, scene_color_manage);
|
||||
multitex_ext_safe(tex, uv_final, &texres, NULL, scene_color_manage, false);
|
||||
|
||||
/* apply color */
|
||||
copy_v3_v3(pPoint[i].color, &texres.tr);
|
||||
|
||||
@@ -757,7 +757,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
|
||||
|
||||
scene_color_manage = BKE_scene_check_color_management_enabled(eff->scene);
|
||||
|
||||
hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result, NULL, scene_color_manage);
|
||||
hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result, NULL, scene_color_manage, false);
|
||||
|
||||
if (hasrgb && mode==PFIELD_TEX_RGB) {
|
||||
force[0] = (0.5f - result->tr) * strength;
|
||||
@@ -768,15 +768,15 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
|
||||
strength/=nabla;
|
||||
|
||||
tex_co[0] += nabla;
|
||||
multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+1, NULL, scene_color_manage);
|
||||
multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+1, NULL, scene_color_manage, false);
|
||||
|
||||
tex_co[0] -= nabla;
|
||||
tex_co[1] += nabla;
|
||||
multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+2, NULL, scene_color_manage);
|
||||
multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+2, NULL, scene_color_manage, false);
|
||||
|
||||
tex_co[1] -= nabla;
|
||||
tex_co[2] += nabla;
|
||||
multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+3, NULL, scene_color_manage);
|
||||
multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+3, NULL, scene_color_manage, false);
|
||||
|
||||
if (mode == PFIELD_TEX_GRAD || !hasrgb) { /* if we don't have rgb fall back to grad */
|
||||
/* generate intensity if texture only has rgb value */
|
||||
|
||||
@@ -3410,7 +3410,7 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
|
||||
break;
|
||||
}
|
||||
|
||||
externtex(mtex, texvec, &value, rgba, rgba + 1, rgba + 2, rgba + 3, 0, NULL);
|
||||
externtex(mtex, texvec, &value, rgba, rgba + 1, rgba + 2, rgba + 3, 0, NULL, false);
|
||||
|
||||
if ((event & mtex->mapto) & PAMAP_ROUGH)
|
||||
ptex->rough1 = ptex->rough2 = ptex->roughe = texture_value_blend(def, ptex->rough1, value, mtex->roughfac, blend);
|
||||
@@ -3493,7 +3493,7 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
|
||||
break;
|
||||
}
|
||||
|
||||
externtex(mtex, texvec, &value, rgba, rgba + 1, rgba + 2, rgba + 3, 0, NULL);
|
||||
externtex(mtex, texvec, &value, rgba, rgba + 1, rgba + 2, rgba + 3, 0, NULL, false);
|
||||
|
||||
if ((event & mtex->mapto) & PAMAP_TIME) {
|
||||
/* the first time has to set the base value for time regardless of blend mode */
|
||||
|
||||
@@ -1634,7 +1634,7 @@ void BKE_texture_get_value(Scene *scene, Tex *texture, float *tex_co, TexResult
|
||||
}
|
||||
|
||||
/* no node textures for now */
|
||||
result_type = multitex_ext_safe(texture, tex_co, texres, NULL, do_color_manage);
|
||||
result_type = multitex_ext_safe(texture, tex_co, texres, NULL, do_color_manage, false);
|
||||
|
||||
/* if the texture gave an RGB value, we assume it didn't give a valid
|
||||
* intensity, since this is in the context of modifiers don't use perceptual color conversion.
|
||||
|
||||
@@ -100,7 +100,7 @@ void TextureBaseOperation::executePixelSampled(float output[4], float x, float y
|
||||
vec[1] = textureSize[1] * (v + textureOffset[1]);
|
||||
vec[2] = textureSize[2] * textureOffset[2];
|
||||
|
||||
retval = multitex_ext(this->m_texture, vec, NULL, NULL, 0, &texres, m_pool, m_sceneColorManage);
|
||||
retval = multitex_ext(this->m_texture, vec, NULL, NULL, 0, &texres, m_pool, m_sceneColorManage, false);
|
||||
|
||||
if (texres.talpha)
|
||||
output[3] = texres.ta;
|
||||
|
||||
@@ -4541,7 +4541,7 @@ static int edbm_noise_exec(bContext *C, wmOperator *op)
|
||||
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
|
||||
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
|
||||
float tin, dum;
|
||||
externtex(ma->mtex[0], eve->co, &tin, &dum, &dum, &dum, &dum, 0, NULL);
|
||||
externtex(ma->mtex[0], eve->co, &tin, &dum, &dum, &dum, &dum, 0, NULL, false);
|
||||
eve->co[2] += fac * tin;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ float paint_get_tex_pixel(MTex *mtex, float u, float v, struct ImagePool *pool,
|
||||
float co[3] = {u, v, 0.0f};
|
||||
|
||||
externtex(mtex, co, &intensity,
|
||||
rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool);
|
||||
rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false);
|
||||
|
||||
return intensity;
|
||||
}
|
||||
@@ -189,7 +189,7 @@ void paint_get_tex_pixel_col(MTex *mtex, float u, float v, float rgba[4], struct
|
||||
float intensity;
|
||||
|
||||
hasrgb = externtex(mtex, co, &intensity,
|
||||
rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool);
|
||||
rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool, false);
|
||||
if (!hasrgb) {
|
||||
rgba[0] = intensity;
|
||||
rgba[1] = intensity;
|
||||
|
||||
@@ -74,7 +74,7 @@ static void texture_evaluate(struct Tex *tex, float value[3], float r_color[4])
|
||||
TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
|
||||
|
||||
/* TODO(sergey): always use color management now. */
|
||||
multitex_ext(tex, value, NULL, NULL, 1, &texres, NULL, true);
|
||||
multitex_ext(tex, value, NULL, NULL, 1, &texres, NULL, true, false);
|
||||
|
||||
r_color[0] = texres.tr;
|
||||
r_color[1] = texres.tg;
|
||||
|
||||
@@ -45,7 +45,7 @@ struct Scene;
|
||||
struct View3D;
|
||||
|
||||
/* particle.c, effect.c, editmesh_modes.c and brush.c, returns 1 if rgb, 0 otherwise */
|
||||
int externtex(struct MTex *mtex, const float vec[3], float *tin, float *tr, float *tg, float *tb, float *ta, const int thread, struct ImagePool *pool);
|
||||
int externtex(struct 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);
|
||||
|
||||
/* particle.c */
|
||||
void texture_rgb_blend(float in[3], const float tex[3], const float out[3], float fact, float facg, int blendtype);
|
||||
|
||||
@@ -198,9 +198,9 @@ struct ImagePool;
|
||||
struct Object;
|
||||
|
||||
/* this one uses nodes */
|
||||
int multitex_ext(struct Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres, struct ImagePool *pool, bool scene_color_manage);
|
||||
int multitex_ext(struct Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres, struct ImagePool *pool, bool scene_color_manage, const bool skip_load_image);
|
||||
/* nodes disabled */
|
||||
int multitex_ext_safe(struct Tex *tex, float texvec[3], struct TexResult *texres, struct ImagePool *pool, bool scene_color_manage);
|
||||
int multitex_ext_safe(struct Tex *tex, float texvec[3], struct TexResult *texres, struct ImagePool *pool, bool scene_color_manage, const bool skip_load_image);
|
||||
/* only for internal node usage */
|
||||
int multitex_nodes(struct Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres,
|
||||
const short thread, short which_output, struct ShadeInput *shi, struct MTex *mtex,
|
||||
|
||||
@@ -47,7 +47,7 @@ struct TexResult;
|
||||
struct ImagePool;
|
||||
|
||||
void make_envmaps(struct Render *re);
|
||||
int envmaptex(struct Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres, struct ImagePool *pool);
|
||||
int envmaptex(struct Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres, struct ImagePool *pool, const bool skip_image_load);
|
||||
void env_rotate_scene(struct Render *re, float mat[4][4], int do_rotate);
|
||||
|
||||
#endif /* __ENVMAP_H__ */
|
||||
|
||||
@@ -424,6 +424,7 @@ typedef struct HaloRen {
|
||||
unsigned int lay;
|
||||
struct Material *mat;
|
||||
struct ImagePool *pool;
|
||||
bool skip_load_image;
|
||||
} HaloRen;
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
@@ -81,8 +81,8 @@ void render_realtime_texture(struct ShadeInput *shi, struct Image *ima);
|
||||
|
||||
/* imagetexture.h */
|
||||
|
||||
int imagewraposa(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, const float texvec[3], const float dxt[2], const float dyt[2], struct TexResult *texres, struct ImagePool *pool);
|
||||
int imagewrap(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, const float texvec[3], struct TexResult *texres, struct ImagePool *pool);
|
||||
int imagewraposa(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, const float texvec[3], const float dxt[2], const float dyt[2], struct TexResult *texres, struct ImagePool *pool, const bool skip_load_image);
|
||||
int imagewrap(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, const float texvec[3], struct TexResult *texres, struct ImagePool *pool, const bool skip_load_image);
|
||||
void image_sample(struct Image *ima, float fx, float fy, float dx, float dy, float result[4], struct ImagePool *pool);
|
||||
|
||||
#endif /* __TEXTURE_H__ */
|
||||
|
||||
@@ -694,7 +694,7 @@ static void set_dxtdyt(float r_dxt[3], float r_dyt[3], const float dxt[3], const
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
int envmaptex(Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, struct ImagePool *pool)
|
||||
int envmaptex(Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, struct ImagePool *pool, const bool skip_load_image)
|
||||
{
|
||||
extern Render R; /* only in this call */
|
||||
/* texvec should be the already reflected normal */
|
||||
@@ -750,7 +750,7 @@ int envmaptex(Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int o
|
||||
mul_mat3_m4_v3(R.viewinv, dyt);
|
||||
}
|
||||
set_dxtdyt(dxts, dyts, dxt, dyt, face);
|
||||
imagewraposa(tex, NULL, ibuf, sco, dxts, dyts, texres, pool);
|
||||
imagewraposa(tex, NULL, ibuf, sco, dxts, dyts, texres, pool, skip_load_image);
|
||||
|
||||
/* edges? */
|
||||
|
||||
@@ -767,7 +767,7 @@ int envmaptex(Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int o
|
||||
if (face != face1) {
|
||||
ibuf = env->cube[face1];
|
||||
set_dxtdyt(dxts, dyts, dxt, dyt, face1);
|
||||
imagewraposa(tex, NULL, ibuf, sco, dxts, dyts, &texr1, pool);
|
||||
imagewraposa(tex, NULL, ibuf, sco, dxts, dyts, &texr1, pool, skip_load_image);
|
||||
}
|
||||
else texr1.tr = texr1.tg = texr1.tb = texr1.ta = 0.0;
|
||||
|
||||
@@ -780,7 +780,7 @@ int envmaptex(Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int o
|
||||
if (face != face1) {
|
||||
ibuf = env->cube[face1];
|
||||
set_dxtdyt(dxts, dyts, dxt, dyt, face1);
|
||||
imagewraposa(tex, NULL, ibuf, sco, dxts, dyts, &texr2, pool);
|
||||
imagewraposa(tex, NULL, ibuf, sco, dxts, dyts, &texr2, pool, skip_load_image);
|
||||
}
|
||||
else texr2.tr = texr2.tg = texr2.tb = texr2.ta = 0.0;
|
||||
|
||||
@@ -796,7 +796,7 @@ int envmaptex(Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int o
|
||||
}
|
||||
}
|
||||
else {
|
||||
imagewrap(tex, NULL, ibuf, sco, texres, pool);
|
||||
imagewrap(tex, NULL, ibuf, sco, texres, pool, skip_load_image);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -103,7 +103,7 @@ static void ibuf_get_color(float col[4], struct ImBuf *ibuf, int x, int y)
|
||||
}
|
||||
}
|
||||
|
||||
int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResult *texres, struct ImagePool *pool)
|
||||
int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResult *texres, struct ImagePool *pool, const bool skip_load_image)
|
||||
{
|
||||
float fx, fy, val1, val2, val3;
|
||||
int x, y, retval;
|
||||
@@ -120,7 +120,7 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
|
||||
if (ima) {
|
||||
|
||||
/* hack for icon render */
|
||||
if ((R.r.scemode & R_NO_IMAGE_LOAD) && !BKE_image_has_loaded_ibuf(ima))
|
||||
if (skip_load_image && !BKE_image_has_loaded_ibuf(ima))
|
||||
return retval;
|
||||
|
||||
ibuf = BKE_image_pool_acquire_ibuf(ima, &tex->iuser, pool);
|
||||
@@ -912,7 +912,7 @@ static void image_mipmap_test(Tex *tex, ImBuf *ibuf)
|
||||
|
||||
}
|
||||
|
||||
static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], float dxt[2], float dyt[2], TexResult *texres, struct ImagePool *pool)
|
||||
static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], float dxt[2], float dyt[2], TexResult *texres, struct ImagePool *pool, const bool skip_load_image)
|
||||
{
|
||||
TexResult texr;
|
||||
float fx, fy, minx, maxx, miny, maxy;
|
||||
@@ -942,7 +942,7 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
|
||||
if (ibuf==NULL && ima==NULL) return retval;
|
||||
|
||||
if (ima) { /* hack for icon render */
|
||||
if ((R.r.scemode & R_NO_IMAGE_LOAD) && !BKE_image_has_loaded_ibuf(ima)) {
|
||||
if (skip_load_image && !BKE_image_has_loaded_ibuf(ima)) {
|
||||
return retval;
|
||||
}
|
||||
ibuf = BKE_image_pool_acquire_ibuf(ima, &tex->iuser, pool);
|
||||
@@ -1338,7 +1338,7 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
|
||||
}
|
||||
|
||||
|
||||
int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const float DXT[2], const float DYT[2], TexResult *texres, struct ImagePool *pool)
|
||||
int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const float DXT[2], const float DYT[2], TexResult *texres, struct ImagePool *pool, const bool skip_load_image)
|
||||
{
|
||||
TexResult texr;
|
||||
float fx, fy, minx, maxx, miny, maxy, dx, dy, dxt[2], dyt[2];
|
||||
@@ -1352,7 +1352,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
|
||||
|
||||
/* anisotropic filtering */
|
||||
if (tex->texfilter != TXF_BOX)
|
||||
return imagewraposa_aniso(tex, ima, ibuf, texvec, dxt, dyt, texres, pool);
|
||||
return imagewraposa_aniso(tex, ima, ibuf, texvec, dxt, dyt, texres, pool, skip_load_image);
|
||||
|
||||
texres->tin= texres->ta= texres->tr= texres->tg= texres->tb= 0.0f;
|
||||
|
||||
@@ -1365,7 +1365,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
|
||||
if (ima) {
|
||||
|
||||
/* hack for icon render */
|
||||
if ((R.r.scemode & R_NO_IMAGE_LOAD) && !BKE_image_has_loaded_ibuf(ima))
|
||||
if (skip_load_image && !BKE_image_has_loaded_ibuf(ima))
|
||||
return retval;
|
||||
|
||||
ibuf = BKE_image_pool_acquire_ibuf(ima, &tex->iuser, pool);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -954,6 +954,7 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma,
|
||||
const float vec[3], const float vec1[3],
|
||||
const float *orco, float hasize, float vectsize, int seed)
|
||||
{
|
||||
const bool skip_load_image = (re->r.scemode & R_NO_IMAGE_LOAD) != 0;
|
||||
HaloRen *har;
|
||||
MTex *mtex;
|
||||
float tin, tr, tg, tb, ta;
|
||||
@@ -1045,7 +1046,7 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma,
|
||||
}
|
||||
}
|
||||
|
||||
externtex(mtex, texvec, &tin, &tr, &tg, &tb, &ta, 0, re->pool);
|
||||
externtex(mtex, texvec, &tin, &tr, &tg, &tb, &ta, 0, re->pool, skip_load_image);
|
||||
|
||||
yn= tin*mtex->colfac;
|
||||
//zn= tin*mtex->alphafac;
|
||||
@@ -1065,6 +1066,7 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma,
|
||||
}
|
||||
|
||||
har->pool = re->pool;
|
||||
har->skip_load_image = (re->r.scemode & R_NO_IMAGE_LOAD) != 0;
|
||||
|
||||
return har;
|
||||
}
|
||||
@@ -1073,6 +1075,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
|
||||
const float vec[3], const float vec1[3],
|
||||
const float *orco, const float *uvco, float hasize, float vectsize, int seed, const float pa_co[3])
|
||||
{
|
||||
const bool skip_load_image = (re->r.scemode & R_NO_IMAGE_LOAD) != 0;
|
||||
HaloRen *har;
|
||||
MTex *mtex;
|
||||
float tin, tr, tg, tb, ta;
|
||||
@@ -1176,7 +1179,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
|
||||
copy_v3_v3(texvec, orco);
|
||||
}
|
||||
|
||||
hasrgb = externtex(mtex, texvec, &tin, &tr, &tg, &tb, &ta, 0, re->pool);
|
||||
hasrgb = externtex(mtex, texvec, &tin, &tr, &tg, &tb, &ta, 0, re->pool, skip_load_image);
|
||||
|
||||
//yn= tin*mtex->colfac;
|
||||
//zn= tin*mtex->alphafac;
|
||||
@@ -1220,6 +1223,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
|
||||
}
|
||||
|
||||
har->pool = re->pool;
|
||||
har->skip_load_image = (re->r.scemode & R_NO_IMAGE_LOAD) != 0;
|
||||
|
||||
return har;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user