PBRT_V2 总结记录 <47> TextureMapping3D 和 IdentityMapping3D

TextureMapping3D  类

class TextureMapping3D {
public:
    // TextureMapping3D Interface
    virtual ~TextureMapping3D() { }
    virtual Point Map(const DifferentialGeometry &dg,
                      Vector *dpdx, Vector *dpdy) const = 0;
};

类的作用:

(计算 3D 纹理坐标)

We will also define a TextureMapping3D class that defines the interface for generating
three-dimensional texture coordinates.

 

 

IdentityMapping3D 类

class IdentityMapping3D : public TextureMapping3D {
public:
    IdentityMapping3D(const Transform &x)
        : WorldToTexture(x) { }
    Point Map(const DifferentialGeometry &dg, Vector *dpdx,
              Vector *dpdy) const;
private:
    Transform WorldToTexture;
};


Point IdentityMapping3D::Map(const DifferentialGeometry &dg,
                             Vector *dpdx, Vector *dpdy) const {
    *dpdx = WorldToTexture(dg.dpdx);
    *dpdy = WorldToTexture(dg.dpdy);
    return WorldToTexture(dg.p);
}



作用:

()

The natural three-dimensional mapping just takes the world space coordinate of the
point and applies a linear transformation to it. This will often be a transformation that
takes the point back to the primitive’s object space.

Because a linear mapping is used, the differential change in texture coordinates can be
found by applying the same mapping to the partial derivatives of position.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值