本文整理汇总了C++中Any::verifyName方法的典型用法代码示例。如果您正苦于以下问题:C++ Any::verifyName方法的具体用法?C++ Any::verifyName怎么用?C++ Any::verifyName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Any
的用法示例。
在下文中一共展示了Any::verifyName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/** \param any Must either Rect2D::xywh(#, #, #, #) or Rect2D::xyxy(#, #, #, #)*/
Rect2D::Rect2D(const Any& any) {
any.verifyName("Rect2D");
any.verifyType(Any::ARRAY);
any.verifySize(4);
if (toUpper(any.name()) == "RECT2D::XYWH") {
*this = Rect2D::xywh(any[0], any[1], any[2], any[3]);
} else {
any.verifyName("Rect2D::xyxy");
*this = Rect2D::xyxy(any[0], any[1], any[2], any[3]);
}
}
示例2: toLower
Matrix4::Matrix4(const Any& any) {
any.verifyName("Matrix4");
any.verifyType(Any::ARRAY);
const std::string& name = toLower(any.name());
if (name == "matrix4") {
any.verifySize(16);
for (int r = 0; r < 4; ++r) {
for (int c = 0; c < 4; ++c) {
elt[r][c] = any[r * 4 + c];
}
}
} else if (name == "matrix4::scale") {
if (any.size() == 1) {
*this = scale(any[0].number());
} else if (any.size() == 3) {
*this = scale(any[0], any[1], any[2]);
} else {
any.verify(false, "Matrix4::scale() takes either 1 or 3 arguments");
}
} else if (name == "matrix4::translation") {
if (any.size() == 3) {
*this = translation(any[0], any[1], any[2]);
} else {
any.verify(false, "Matrix4::translation() takes either 1 or 3 arguments");
} } else {
any.verify(false, "Expected Matrix4 constructor");
}
}
示例3: r
DeepGBufferRadiositySettings::DeepGBufferRadiositySettings(const Any& a) {
*this = DeepGBufferRadiositySettings();
a.verifyName("DeepGBufferRadiositySettings");
AnyTableReader r(a);
r.getIfPresent("enabled", enabled);
r.getIfPresent("radius", radius);
r.getIfPresent("bias", bias);
r.getIfPresent("numSamples", numSamples);
r.getIfPresent("edgeSharpness", edgeSharpness);
r.getIfPresent("blurStepSize", blurStepSize);
r.getIfPresent("blurRadius", blurRadius);
r.getIfPresent("monotonicallyDecreasingBilateralWeights", monotonicallyDecreasingBilateralWeights);
r.getIfPresent("useDepthPeelBuffer", useDepthPeelBuffer);
r.getIfPresent("depthPeelSeparationHint", depthPeelSeparationHint);
r.getIfPresent("temporalFilterSettings", temporalFilterSettings);
r.getIfPresent("temporallyVarySamples", temporallyVarySamples);
r.getIfPresent("computePeeledLayer", computePeeledLayer);
r.getIfPresent("unsaturatedBoost", unsaturatedBoost);
r.getIfPresent("saturatedBoost", saturatedBoost);
r.getIfPresent("useMipMaps", useMipMaps);
r.getIfPresent("numBounces", numBounces);
r.getIfPresent("propagationDamping", propagationDamping);
r.getIfPresent("useTapNormal", useTapNormal);
r.getIfPresent("useOct16", useOct16);
r.getIfPresent("minMipLevel", minMipLevel);
r.getIfPresent("useHalfPrecisionColors", useHalfPrecisionColors);
r.getIfPresent("computeGuardBandFraction", computeGuardBandFraction);
r.verifyDone();
}
示例4:
UprightFrame::UprightFrame(const Any& any) {
any.verifyName("UprightFrame");
any.verifyType(Any::TABLE);
translation = any["translation"];
pitch = any["pitch"];
yaw = any["yaw"];
}
示例5: castsShadows
ArticulatedModel::PoseSpline::PoseSpline(const Any& any) : castsShadows(true) {
any.verifyName("ArticulatedModel::PoseSpline");
for (Any::AnyTable::Iterator it = any.table().begin(); it.isValid(); ++it) {
if (it->key == "castsShadows") {
castsShadows = it->value;
} else {
partSpline.getCreate(it->key) = it->value;
}
}
}
示例6: r
shared_ptr<SpriteSheet> SpriteSheet::create(const Any& a, Table<ModelID, shared_ptr<Model> >& modelTable) {
a.verifyName("SpriteSheet");
const shared_ptr<SpriteSheet>& s = shared_ptr<SpriteSheet>(new SpriteSheet());
s->m_source = a.source();
AnyTableReader r(a);
// Read the textures
Texture::Specification spec;
if (r.getIfPresent("emissive", spec)) {
spec.generateMipMaps = false;
spec.encoding.format = ImageFormat::RGBA_DXT5();
s->m_emissive = Texture::create(spec);
} else {
s->m_emissive = Texture::opaqueBlack();
}
if (r.getIfPresent("color", spec)) {
spec.generateMipMaps = false;
spec.encoding.format = ImageFormat::RGBA_DXT5();
s->m_color = Texture::create(spec);
} else {
s->m_color = Texture::createColor(Color4unorm8(Color4::zero()));
}
String bumpFilename;
spec = Texture::Specification("<white>");
if (r.getFilenameIfPresent("bump", bumpFilename)) {
spec.filename = bumpFilename;
}
spec.generateMipMaps = false;
spec.preprocess = Texture::Preprocess::normalMap();
spec.encoding.format = ImageFormat::RGBA8();
spec.encoding.readMultiplyFirst = Color3(2.0f);
spec.encoding.readAddSecond = Color3(-1.0f);
s->m_normal = Texture::create(spec);
// Read the animation table
Table<String, Any> tbl;
r.getIfPresent("modelTable", tbl);
for (Table<String, Any>::Iterator it = tbl.begin(); it.hasMore(); ++it) {
if (modelTable.containsKey(it.key())) {
String msg = format("Two models with the same name, '%s': ", it.key().c_str());
msg += format("the first %s:%d and ", modelTable[it.key()]->source().filename.c_str(), modelTable[it.key()]->source().line);
msg += format("and the second from %s:%d.", it.value().source().filename.c_str(), it.value().source().line);
report(msg, ReportLevel::ERROR);
} else {
modelTable.set(it.key(), Model::create(s, it.key(), it.value()));
}
}
r.verifyDone();
return s;
}
示例7: r
TemporalFilter::Settings::Settings(const Any& a) {
*this = Settings();
a.verifyName("TemporalFilter::Settings");
AnyTableReader r(a);
r.getIfPresent("hysteresis", hysteresis);
r.getIfPresent("falloffStartDistance", falloffStartDistance);
r.getIfPresent("falloffEndDistance", falloffEndDistance);
r.verifyDone();
}
示例8:
Vector2int32::Vector2int32(const Any& any) {
any.verifyName("Vector2int32", "Point2int32");
any.verifyType(Any::TABLE, Any::ARRAY);
any.verifySize(2);
if (any.type() == Any::ARRAY) {
x = any[0];
y = any[1];
} else {
// Table
x = any["x"];
y = any["y"];
}
}
示例9:
Vector3::Vector3(const Any& any) {
any.verifyName("Vector3");
any.verifyType(Any::TABLE, Any::ARRAY);
any.verifySize(3);
if (any.type() == Any::ARRAY) {
x = any[0];
y = any[1];
z = any[2];
} else {
// Table
x = any["x"];
y = any["y"];
z = any["z"];
}
}
示例10: toLower
BumpMap::Settings::Settings(const Any& any) {
*this = Settings();
any.verifyName("BumpMap::Settings");
for (Any::AnyTable::Iterator it = any.table().begin(); it.hasMore(); ++it) {
const std::string& key = toLower(it->key);
if (key == "iterations") {
iterations = iMax(0, iRound(it->value.number()));
} else if (key == "scale") {
scale = it->value;
} else if (key == "bias") {
bias = it->value;
} else {
any.verify(false, "Illegal key: " + it->key);
}
}
}
示例11:
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];
}
}
}
}
示例12: r
ParseOBJ::Options::Options(const Any& a) {
*this = Options();
a.verifyName("OBJOptions");
AnyTableReader r(a);
String s;
if (r.getIfPresent("texCoord1Mode", s)) {
if (s == "NONE") { texCoord1Mode = NONE; }
else if (s == "UNPACK_FROM_TEXCOORD0_Z") { texCoord1Mode = UNPACK_FROM_TEXCOORD0_Z; }
else if (s == "TEXCOORD0_ZW") { texCoord1Mode = TEXCOORD0_ZW; }
else { a.verify(false, "Unexpected value for texCoord3DMode"); }
}
r.getIfPresent("stripRefraction", stripRefraction);
// r.getIfPresent("sampler", sampler);
r.verifyDone();
}
示例13: r
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();
}
}
示例14: toUpper
CoordinateFrame::CoordinateFrame(const Any& any) {
*this = CFrame();
const std::string& n = toUpper(any.name());
if (beginsWith(n, "VECTOR3")) {
translation = any;
} else if (beginsWith(n, "MATRIX3")) {
rotation = any;
} else if ((n == "CFRAME") || (n == "COORDINATEFRAME")) {
any.verifyType(Any::TABLE, Any::ARRAY);
if (any.type() == Any::ARRAY) {
any.verifySize(2);
rotation = any[0];
translation = any[1];
} else {
for (Any::AnyTable::Iterator it = any.table().begin(); it.hasMore(); ++it) {
const std::string& n = toLower(it->key);
if (n == "translation") {
translation = Vector3(it->value);
} else if (n == "rotation") {
rotation = Matrix3(it->value);
} else {
any.verify(false, "Illegal table key: " + it->key);
}
}
}
} else if (beginsWith(n, "PHYSICSFRAME") || beginsWith(n, "PFRAME")) {
*this = PhysicsFrame(any);
} else {
any.verifyName("CFrame::fromXYZYPRDegrees", "CoordinateFrame::fromXYZYPRDegrees");
any.verifyType(Any::ARRAY);
any.verifySize(3, 6);
int s = any.size();
*this = fromXYZYPRDegrees(any[0], any[1], any[2],
(s > 3) ? any[3].number() : 0.0f,
(s > 4) ? any[4].number() : 0.0f,
(s > 5) ? any[5].number() : 0.0f);
}
}
示例15: r
CoordinateFrame::CoordinateFrame(const Any& any) {
*this = CFrame();
const String& n = toUpper(any.name());
if (beginsWith(n, "VECTOR3") || beginsWith(n, "POINT3")) {
translation = Point3(any);
} else if (beginsWith(n, "MATRIX3")) {
rotation = Matrix3(any);
} else if (beginsWith(n, "MATRIX4")) {
*this = Matrix4(any).approxCoordinateFrame();
} else if ((n == "CFRAME") || (n == "COORDINATEFRAME")) {
any.verifyType(Any::TABLE, Any::ARRAY);
if (any.type() == Any::ARRAY) {
any.verifySize(2);
rotation = any[0];
translation = any[1];
} else {
AnyTableReader r(any);
r.getIfPresent("translation", translation);
r.getIfPresent("rotation", rotation);
r.verifyDone();
}
} else if (beginsWith(n, "PHYSICSFRAME") || beginsWith(n, "PFRAME")) {
*this = PhysicsFrame(any);
// } else if (beginsWith(n, "UPRIGHTFRAME") || beginsWith(n, "UFRAME")) {
// *this = UprightFrame(any);
} else {
any.verifyName("CFrame::fromXYZYPRDegrees", "CoordinateFrame::fromXYZYPRDegrees");
any.verifyType(Any::ARRAY);
any.verifySize(3, 6);
int s = any.size();
*this = fromXYZYPRDegrees(any[0], any[1], any[2],
(s > 3) ? (float)any[3].number() : 0.0f,
(s > 4) ? (float)any[4].number() : 0.0f,
(s > 5) ? (float)any[5].number() : 0.0f);
}
}