Changeset View
Changeset View
Standalone View
Standalone View
source/blender/render/intern/source/envmap.c
| Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
| #include "DNA_lamp_types.h" | #include "DNA_lamp_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_texture_types.h" | #include "DNA_texture_types.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_image.h" /* BKE_imbuf_write */ | #include "BKE_image.h" /* BKE_imbuf_write */ | ||||
| #include "BKE_texture.h" | #include "BKE_texture.h" | ||||
| #include "BKE_scene.h" | |||||
| /* this module */ | /* this module */ | ||||
| #include "render_types.h" | #include "render_types.h" | ||||
| #include "envmap.h" | #include "envmap.h" | ||||
| #include "renderdatabase.h" | #include "renderdatabase.h" | ||||
| #include "renderpipeline.h" | #include "renderpipeline.h" | ||||
| #include "texture.h" | #include "texture.h" | ||||
| #include "zbuf.h" | #include "zbuf.h" | ||||
| ▲ Show 20 Lines • Show All 669 Lines • ▼ Show 20 Lines | 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) | ||||
| if (env->ok == 0) { | if (env->ok == 0) { | ||||
| texres->tin = 0.0; | texres->tin = 0.0; | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| /* rotate to envmap space, if object is set */ | /* rotate to envmap space, if object is set */ | ||||
| copy_v3_v3(vec, texvec); | copy_v3_v3(vec, texvec); | ||||
| if (env->object) mul_m3_v3(env->obimat, vec); | |||||
| else mul_mat3_m4_v3(R.viewinv, vec); | |||||
| face = envcube_isect(env, vec, sco); | |||||
| ibuf = env->cube[face]; | |||||
| if (osatex) { | |||||
| if (env->object) { | if (env->object) { | ||||
| mul_m3_v3(env->obimat, vec); | |||||
| if (osatex) { | |||||
| mul_m3_v3(env->obimat, dxt); | mul_m3_v3(env->obimat, dxt); | ||||
| mul_m3_v3(env->obimat, dyt); | mul_m3_v3(env->obimat, dyt); | ||||
| } | } | ||||
| } | |||||
| else { | else { | ||||
| if (!BKE_scene_use_world_space_shading(R.scene)) { | |||||
campbellbarton: *picky*, Blender code uses space after if/switch/for... etc. Another case below. | |||||
| // texvec is in view space | |||||
| mul_mat3_m4_v3(R.viewinv, vec); | |||||
| if (osatex) { | |||||
| mul_mat3_m4_v3(R.viewinv, dxt); | mul_mat3_m4_v3(R.viewinv, dxt); | ||||
| mul_mat3_m4_v3(R.viewinv, dyt); | mul_mat3_m4_v3(R.viewinv, dyt); | ||||
| } | } | ||||
| } | |||||
| } | |||||
| face = envcube_isect(env, vec, sco); | |||||
| ibuf = env->cube[face]; | |||||
| if (osatex) { | |||||
| set_dxtdyt(dxts, dyts, dxt, dyt, face); | set_dxtdyt(dxts, dyts, dxt, dyt, face); | ||||
| imagewraposa(tex, NULL, ibuf, sco, dxts, dyts, texres, pool, skip_load_image); | imagewraposa(tex, NULL, ibuf, sco, dxts, dyts, texres, pool, skip_load_image); | ||||
| /* edges? */ | /* edges? */ | ||||
| if (texres->ta < 1.0f) { | if (texres->ta < 1.0f) { | ||||
| TexResult texr1, texr2; | TexResult texr1, texr2; | ||||
| ▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines | |||||
*picky*, Blender code uses space after if/switch/for... etc. Another case below.