示例#1
0
void SphericalMapping2D::sphere(const Point &p, float *s, float *t) const {
    Vector vec = Normalize(WorldToTexture(p) - Point(0,0,0));
    float theta = SphericalTheta(vec);
    float phi = SphericalPhi(vec);
    *s = theta * INV_PI;
    *t = phi * INV_TWOPI;
}
示例#2
0
void CylindricalMapping2D::cylinder(const Point &p,
		float *s, float *t) const {
	Vector vec =
		Normalize(WorldToTexture(p) - Point(0,0,0));
	*s = (M_PI + atan2f(vec.y, vec.x)) / (2.f * M_PI);
	*t = vec.z;
}
示例#3
0
Point IdentityMapping3D::Map(const DifferentialGeometry &dg,
                             Vector *dpdx, Vector *dpdy) const {
    *dpdx = WorldToTexture(dg.dpdx);
    *dpdy = WorldToTexture(dg.dpdy);
    return WorldToTexture(dg.p);
}
示例#4
0
Point3f IdentityMapping3D::Map(const SurfaceInteraction &isect, Vector3f *dpdx,
                               Vector3f *dpdy) const {
    *dpdx = WorldToTexture(isect.dpdx);
    *dpdy = WorldToTexture(isect.dpdy);
    return WorldToTexture(isect.p);
}
示例#5
0
Point2f SphericalMapping2D::sphere(const Point3f &p) const {
    Vector3f vec = Normalize(WorldToTexture(p) - Point3f(0, 0, 0));
    Float theta = SphericalTheta(vec), phi = SphericalPhi(vec);
    return Point2f(theta * InvPi, phi * Inv2Pi);
}