Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2005-03-04 22:44:29 +0300
committerTon Roosendaal <ton@blender.org>2005-03-04 22:44:29 +0300
commit611c38d0f96afa9524ed8067101e0bee80b96347 (patch)
treebd9d07ca6c80a57f71049bd48a7db68d5c16e573 /source
parentc3f44c0713e7c58fe39ecb7a634859db07061096 (diff)
Bug fix #2289
Environment maps type "Load" don't need to have an "Ob" object set to render. Without object it renders applied envmaps like reflection maps. Please note that envmaps then still "mirror" realistic, provided the original object the envmap was rendered with was not rotated.
Diffstat (limited to 'source')
-rw-r--r--source/blender/render/intern/source/envmap.c21
-rw-r--r--source/blender/src/buttons_shading.c17
2 files changed, 23 insertions, 15 deletions
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c
index a2783c669e3..64b48a4cee0 100644
--- a/source/blender/render/intern/source/envmap.c
+++ b/source/blender/render/intern/source/envmap.c
@@ -641,14 +641,14 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
int face, face1;
env= tex->env;
- if(env==0 || env->object==0) {
+ if(env==NULL || (env->stype!=ENV_LOAD && env->object==NULL)) {
texres->tin= 0.0;
return 0;
}
if(env->stype==ENV_LOAD) {
env->ima= tex->ima;
if(env->ima && env->ima->ok) {
- if(env->ima->ibuf==0) ima_ibuf_is_nul(tex);
+ if(env->ima->ibuf==NULL) ima_ibuf_is_nul(tex);
if(env->ima->ok && env->ok==0) envmap_split_ima(env);
}
}
@@ -659,18 +659,23 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
return 0;
}
- /* rotate to envmap space */
+ /* rotate to envmap space, if object is set */
VECCOPY(vec, texvec);
- MTC_Mat4Mul3Vecfl(env->object->imat, vec);
+ if(env->object) MTC_Mat4Mul3Vecfl(env->object->imat, vec);
+ else MTC_Mat4Mul3Vecfl(R.viewinv, vec);
face= envcube_isect(vec, sco);
tex->ima= env->cube[face];
if(osatex) {
-
- MTC_Mat4Mul3Vecfl(env->object->imat, dxt);
- MTC_Mat4Mul3Vecfl(env->object->imat, dyt);
-
+ if(env->object) {
+ MTC_Mat4Mul3Vecfl(env->object->imat, dxt);
+ MTC_Mat4Mul3Vecfl(env->object->imat, dyt);
+ }
+ else {
+ MTC_Mat4Mul3Vecfl(R.viewinv, dxt);
+ MTC_Mat4Mul3Vecfl(R.viewinv, dyt);
+ }
set_dxtdyt(dxts, dyts, dxt, dyt, face);
imagewraposa(tex, sco, dxts, dyts, texres);
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
index 2885112b5b9..9b8c10b39ff 100644
--- a/source/blender/src/buttons_shading.c
+++ b/source/blender/src/buttons_shading.c
@@ -777,7 +777,7 @@ void do_texbuts(unsigned short event)
BIF_all_preview_changed();
if ELEM(tex->env->object->type, OB_CAMERA, OB_LAMP) {
error("Camera or Lamp not allowed");
- tex->env->object= 0;
+ tex->env->object= NULL;
}
}
break;
@@ -882,10 +882,13 @@ static void texture_panel_wood(Tex *tex)
uiDefButS(block, ROW, B_TEXPRV, "Bands", 10, 180, 75, 18, &tex->stype, 2.0, 0.0, 0, 0, "Uses standard wood texture in bands");
uiDefButS(block, ROW, B_TEXPRV, "Rings", 85, 180, 75, 18, &tex->stype, 2.0, 1.0, 0, 0, "Uses wood texture in rings");
uiDefButS(block, ROW, B_TEXPRV, "BandNoise", 160, 180, 75, 18, &tex->stype, 2.0, 2.0, 0, 0, "Adds noise to standard wood");
- uiDefButS(block, ROW, B_TEXPRV, "RingNoise", 235, 180, 75, 18, &tex->stype, 2.0, 3.0, 0, 0, "Adds noise to rings");
-
- uiDefButS(block, ROW, B_TEXPRV, "Soft noise", 10, 160, 150, 19, &tex->noisetype, 12.0, 0.0, 0, 0, "Generates soft noise");
- uiDefButS(block, ROW, B_TEXPRV, "Hard noise", 160, 160, 150, 19, &tex->noisetype, 12.0, 1.0, 0, 0, "Generates hard noise");
+ uiDefButS(block, ROW, B_TEXPRV, "RingNoise", 235, 180, 75, 18, &tex->stype, 2.0, 3.0, 0, 0, "Adds noise to rings");
+
+ uiDefButS(block, ROW, B_TEXPRV, "Sin", 10, 160, 50, 19, &tex->noisebasis2, 8.0, 0.0, 0, 0, "Uses a sine wave to produce bands.");
+ uiDefButS(block, ROW, B_TEXPRV, "Saw", 60, 160, 50, 19, &tex->noisebasis2, 8.0, 1.0, 0, 0, "Uses a saw wave to produce bands.");
+ uiDefButS(block, ROW, B_TEXPRV, "Tri", 110, 160, 50, 19, &tex->noisebasis2, 8.0, 2.0, 0, 0, "Uses a triangle wave to produce bands.");
+ uiDefButS(block, ROW, B_TEXPRV, "Soft noise", 160, 160, 75, 19, &tex->noisetype, 12.0, 0.0, 0, 0, "Generates soft noise");
+ uiDefButS(block, ROW, B_TEXPRV, "Hard noise", 235, 160, 75, 19, &tex->noisetype, 12.0, 1.0, 0, 0, "Generates hard noise");
uiBlockBeginAlign(block);
uiDefButF(block, NUM, B_TEXPRV, "NoiseSize :", 10, 130, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Sets scaling for noise input");
@@ -1104,7 +1107,7 @@ static void texture_panel_envmap(Tex *tex)
if(uiNewPanel(curarea, block, "Envmap", "Texture", 640, 0, 318, 204)==0) return;
uiSetButLock(tex->id.lib!=0, "Can't edit library data");
- if(tex->env==0) {
+ if(tex->env==NULL) {
tex->env= RE_add_envmap();
tex->env->object= OBACT;
}
@@ -2600,7 +2603,7 @@ static void material_panel_map_to(Material *ma)
uiDefButS(block, TOG|BIT|0, B_MATPRV, "Col", 10,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect basic colour of the material");
uiDefButS(block, TOG3|BIT|1, B_MATPRV, "Nor", 50,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the rendered normal");
uiDefButS(block, TOG|BIT|2, B_MATPRV, "Csp", 90,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the specularity colour");
- uiDefButS(block, TOG|BIT|3, B_MATPRV, "Cmir", 130,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affext the mirror colour");
+ uiDefButS(block, TOG|BIT|3, B_MATPRV, "Cmir", 130,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the mirror colour");
uiDefButS(block, TOG3|BIT|4, B_MATPRV, "Ref", 180,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of the materials reflectivity");
uiDefButS(block, TOG3|BIT|5, B_MATPRV, "Spec", 220,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of specularity");
uiDefButS(block, TOG3|BIT|11, B_MATPRV, "Amb", 270,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of ambient");