Ejemplo n.º 1
0
Signature TextureProxy::MakeSignature(const Proxy<res::Image> &image, vid::opengl::TextureFormat format, vid::opengl::TextureFlags flags, const math::Vector<2, bool> &clamp)
{
    std::ostringstream ss(image.GetSignature());
    switch (format)
    {
    case vid::opengl::defaultTextureFormat:
        break;
    case vid::opengl::alphaTextureFormat:
        ss << ":alpha";
        break;
    case vid::opengl::luminanceTextureFormat:
        ss << ":luminance";
        break;
    default:
        assert(!"invalid texture format");
    }
    if (flags & vid::opengl::filterTextureFlag) ss << ":filter";
    if (flags & vid::opengl::mipmapTextureFlag) ss << ":mipmap";
    if (Any(clamp))
    {
        ss << ":clamp";
        if      (!clamp.x) ss << ".y";
        else if (!clamp.y) ss << ".x";
    }
    return Signature("OpenGL texture", ss.str());
}