Texture::Visualization::Visualization(const Any& a) {
    *this = Visualization();
    if (a.type() == Any::ARRAY) {
        if (a.nameEquals("bumpInAlpha")) {
            *this = bumpInAlpha();
        } else if (a.nameEquals("defaults")) {
            *this = defaults();
        } else if (a.nameEquals("linearRGB")) {
            *this = linearRGB();
        } else if (a.nameEquals("depthBuffer")) {
            *this = depthBuffer();
        } else if (a.nameEquals("packedUnitVector")) {
            *this = packedUnitVector();
        } else if (a.nameEquals("radiance")) {
            *this = radiance();
        } else if (a.nameEquals("reflectivity")) {
            *this = reflectivity();
        } else if (a.nameEquals("sRGB")) {
            *this = sRGB();
        } else if (a.nameEquals("unitVector")) {
            *this = unitVector();
        } else {
            a.verify(false, "Unrecognized Visualization factory method");
        }
    } else {
        a.verifyName("Texture::Visualization", "Visualization");

        AnyTableReader r(a);
        String c;

        if (r.getIfPresent("channels", c)) {
            channels = toChannels(c);
        }

        r.getIfPresent("documentGamma", documentGamma);
        r.getIfPresent("invertIntensity", invertIntensity);
        r.getIfPresent("max", max);
        r.getIfPresent("min", min);
        r.getIfPresent("layer", layer);
        r.getIfPresent("mipLevel", mipLevel);

        r.verifyDone();
    }
}
示例#2
0
文件: Matrix2.cpp 项目: lieff/g3d
Matrix2::Matrix2(const Any& any) {
    any.verifyName("Matrix2");
    any.verifyType(Any::ARRAY);

    if (any.nameEquals("Matrix2::identity")) {
        *this = identity();
    } else {
        any.verifySize(4);

        for (int r = 0; r < 3; ++r) {
            for (int c = 0; c < 3; ++c) {
                data[r][c] = any[r * 2 + c];
            }
        }
    }
}