patch [#28094] New equirectangular world texture mapping option

This commit is contained in:
2011-12-19 23:52:17 +00:00
parent a7bae8474b
commit 71ce197bbb
3 changed files with 8 additions and 0 deletions

View File

@@ -181,6 +181,7 @@ typedef struct World {
#define TEXCO_ANGMAP 64
#define TEXCO_H_SPHEREMAP 256
#define TEXCO_H_TUBEMAP 1024
#define TEXCO_EQUIRECTMAP 2048
/* mapto */
#define WOMAP_BLEND 1

View File

@@ -143,6 +143,7 @@ static void rna_def_world_mtex(BlenderRNA *brna)
{TEXCO_GLOB, "GLOBAL", 0, "Global", "Use global coordinates for the texture coordinates (interior mist)"},
{TEXCO_ANGMAP, "ANGMAP", 0, "AngMap", "Use 360 degree angular coordinates, e.g. for spherical light probes"},
{TEXCO_H_SPHEREMAP, "SPHERE", 0, "Sphere", "For 360 degree panorama sky, spherical mapped, only top half"},
{TEXCO_EQUIRECTMAP, "EQUIRECT", 0, "Equirectangular", "For 360 degree panorama sky, equirectangular mapping"},
{TEXCO_H_TUBEMAP, "TUBE", 0, "Tube", "For 360 degree panorama sky, cylindrical mapped, only top half"},
{TEXCO_OBJECT, "OBJECT", 0, "Object", "Use linked object's coordinates for texture coordinates"},
{0, NULL, 0, NULL, NULL}};

View File

@@ -3083,6 +3083,12 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
continue;
}
break;
case TEXCO_EQUIRECTMAP:
tempvec[0]= atan2f(lo[0], lo[2]) / (float)M_PI;
tempvec[1]= 1.0f - 2.0f*saacos(lo[1]) / (float)M_PI;
tempvec[2]= 0.0f;
co= tempvec;
break;
case TEXCO_OBJECT:
if(mtex->object) {
copy_v3_v3(tempvec, lo);