00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "stdafx.h"
00027 #include "textures/uv.h"
00028
00029
00030 Texture<float> *CreateUVFloatTexture(const Transform &tex2world,
00031 const TextureParams &tp) {
00032 return NULL;
00033 }
00034
00035
00036
00037 UVTexture *CreateUVSpectrumTexture(const Transform &tex2world,
00038 const TextureParams &tp) {
00039
00040 TextureMapping2D *map = NULL;
00041 string type = tp.FindString("mapping", "uv");
00042 if (type == "uv") {
00043 float su = tp.FindFloat("uscale", 1.);
00044 float sv = tp.FindFloat("vscale", 1.);
00045 float du = tp.FindFloat("udelta", 0.);
00046 float dv = tp.FindFloat("vdelta", 0.);
00047 map = new UVMapping2D(su, sv, du, dv);
00048 }
00049 else if (type == "spherical") map = new SphericalMapping2D(Inverse(tex2world));
00050 else if (type == "cylindrical") map = new CylindricalMapping2D(Inverse(tex2world));
00051 else if (type == "planar")
00052 map = new PlanarMapping2D(tp.FindVector("v1", Vector(1,0,0)),
00053 tp.FindVector("v2", Vector(0,1,0)),
00054 tp.FindFloat("udelta", 0.f), tp.FindFloat("vdelta", 0.f));
00055 else {
00056 Error("2D texture mapping \"%s\" unknown", type.c_str());
00057 map = new UVMapping2D;
00058 }
00059 return new UVTexture(map);
00060 }
00061
00062