当前位置: 首页>>代码示例>>C++>>正文


C++ Any::verify方法代码示例

本文整理汇总了C++中Any::verify方法的典型用法代码示例。如果您正苦于以下问题:C++ Any::verify方法的具体用法?C++ Any::verify怎么用?C++ Any::verify使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Any的用法示例。


在下文中一共展示了Any::verify方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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");
    }
}
开发者ID:Akenyshka,项目名称:MythCore,代码行数:30,代码来源:Matrix4.cpp

示例2: switch

ArticulatedModel::Instruction::Identifier::Identifier(const Any& a) {
    switch (a.type()) {
    case Any::NUMBER:
        id = ID(iRound(a.number()));
        a.verify(id >= 0, "Illegal ID");
        break;

    case Any::STRING:
        name = a.string();
        break;

    case Any::ARRAY:
        a.verifySize(0);
        if (a.name() == "root") {
            *this = root();
        } else if (a.name() == "all") {
            *this = all();
        } else {
            a.verify(false, "Illegal function call: " + a.name());
        }
        break;

    default:
        a.verify(false, "Expected a name, integer ID, root(), or all()");
    }
}
开发者ID:A7med-Shoukry,项目名称:g3d,代码行数:26,代码来源:ArticulatedModel_serialize.cpp

示例3: toLower

PhysicsFrame::PhysicsFrame(const Any& a) {
    const std::string& n = toLower(a.name());
    *this = PhysicsFrame();

    if (beginsWith(n, "vector3")) {
        *this = PhysicsFrame(Vector3(a));
    } else if (beginsWith(n, "matrix3")) {        
        *this = PhysicsFrame(Matrix3(a));
    } else if (beginsWith(n, "cframe") || beginsWith(n, "coordinateframe")) {        
        *this = PhysicsFrame(CoordinateFrame(a));
    } else if (beginsWith(n, "pframe") || beginsWith(n, "physicsframe")) {
        if (a.type() == Any::ARRAY) {
            a.verifySize(2);
            rotation    = a[0];
            translation = a[1];
        } else {
            for (Any::AnyTable::Iterator it = a.table().begin(); it.hasMore(); ++it) {
                const std::string& n = toLower(it->key);
                if (n == "translation") {
                    translation = it->value;
                } else if (n == "rotation") {
                    rotation = it->value;
                } else {
                    a.verify(false, "Illegal table key: " + it->key);
                }
            }
        }
    }
}
开发者ID:Sandshroud,项目名称:Sandshroud-Prodigy,代码行数:29,代码来源:PhysicsFrame.cpp

示例4: r

Sampler::Sampler(const Any& any) {
    *this = Sampler::defaults();
    any.verifyNameBeginsWith("Sampler");
    if (any.type() == Any::TABLE) {
        AnyTableReader r(any);
        r.getIfPresent("maxAnisotropy", maxAnisotropy);
        r.getIfPresent("maxMipMap", maxMipMap);
        r.getIfPresent("minMipMap", minMipMap);
        r.getIfPresent("mipBias", mipBias);
        r.getIfPresent("xWrapMode", xWrapMode);
        if (! r.getIfPresent("yWrapMode", yWrapMode)) {
            yWrapMode = xWrapMode;
        }
        r.getIfPresent("depthReadMode", depthReadMode);
        r.getIfPresent("interpolateMode", interpolateMode);
        r.verifyDone();
    } else {
        any.verifySize(0);
        const String& n = any.name();
        if (n == "Sampler::defaults") {
            // Done!
        } else if (n == "Sampler::buffer") {
            *this = Sampler::buffer();
        } else if (n == "Sampler::cubeMap") {
            *this = Sampler::cubeMap();
        } else if (n == "Sampler::shadow") {
            *this = Sampler::shadow();
        } else if (n == "Sampler::video") {
            *this = Sampler::video();
        } else {
            any.verify(false, "Unrecognized name for Sampler constructor or factory method.");
        }
    }
}
开发者ID:elfprince13,项目名称:G3D10,代码行数:34,代码来源:Sampler.cpp

示例5: if

Matrix4::Matrix4(const Any& any) {
    any.verifyNameBeginsWith("Matrix4", "CFrame", "CoordinateFrame");
    any.verifyType(Any::ARRAY);

    const std::string& name = 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].floatValue());
        } 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::rollDegrees") {
        any.verifySize(1);
        *this = rollDegrees(any[0].floatValue());
    } else if (name == "Matrix4::yawDegrees") {
        any.verifySize(1);
        *this = yawDegrees(any[0].floatValue());
    } else if (name == "Matrix4::pitchDegrees") {
        any.verifySize(1);
        *this = pitchDegrees(any[0].floatValue());
    } else if (name == "Matrix4::translation") {
        if (any.size() == 3) {
            *this = translation(any[0], any[1], any[2]);
        } else {
            any.verify(false, "Matrix4::translation() requires 3 arguments");
        }    
    } else if (name == "Matrix4::diagonal") {
        any.verifySize(4);
        *this = diagonal(any[0], any[1], any[2], any[3]);
    } else if (name == "Matrix4::identity") {
        *this = identity();
    } else if (beginsWith(name, "CFrame") || beginsWith(name, "CoordinateFrame")) {
        *this = CFrame(any);
    } else {
        any.verify(false, "Expected Matrix4 constructor");
    }
}
开发者ID:93RNounen,项目名称:mangosbot,代码行数:47,代码来源:Matrix4.cpp

示例6: if

Texture::Preprocess::Preprocess(const Any& any) {
    *this = Preprocess::defaults();
    any.verifyNameBeginsWith("Texture::Preprocess");
    if (any.type() == Any::TABLE) {
        for (Any::AnyTable::Iterator it = any.table().begin(); it.isValid(); ++it) {
            const String& key = it->key;
            if (key == "modulate") {
                modulate = Color4(it->value);
            } else if (key == "gammaAdjust") {
                gammaAdjust = it->value;
            } else if (key == "scaleFactor") {
                scaleFactor = it->value;
            } else if (key == "computeMinMaxMean") {
                computeMinMaxMean = it->value;
            } else if (key == "computeNormalMap") {
                computeNormalMap = it->value;
            } else if (key == "convertToPremultipliedAlpha") {
                convertToPremultipliedAlpha = it->value;
            } else if (key == "bumpMapPreprocess") {
                bumpMapPreprocess = it->value;
            } else {
                any.verify(false, "Illegal key: " + it->key);
            }
        }
    } else {
        const String& n = any.name();
        if (n == "Texture::Preprocess::defaults") {
            any.verifySize(0);
        } else if (n == "Texture::Preprocess::gamma") {
            any.verifySize(1);
            *this = Texture::Preprocess::gamma(any[0]);
        } else if (n == "Texture::preprocess::none") {
            any.verifySize(0);
            *this = Texture::Preprocess::none();
        } else if (n == "Texture::Preprocess::quake") {
            any.verifySize(0);
            *this = Texture::Preprocess::quake();
        } else if (n == "Texture::Preprocess::normalMap") {
            any.verifySize(0);
            *this = Texture::Preprocess::normalMap();
        } else {
            any.verify(false, "Unrecognized name for Texture::Preprocess constructor or factory method.");
        }
    }
}
开发者ID:elfprince13,项目名称:G3D10,代码行数:45,代码来源:Texture_Preprocess.cpp

示例7: r

ParticleSystemModel::Emitter::Specification::Specification(const Any& a) {
    a.verifyNameBeginsWith("ParticleSystemModel::Emitter");
    *this = Specification();
    AnyTableReader r(a);
    r.getIfPresent("location", location);
    r.getIfPresent("noisePower", noisePower);
    r.getIfPresent("initialDensity", initialDensity);
    r.getIfPresent("rateCurve", rateCurve);
    r.getIfPresent("coverageFadeInTime", coverageFadeInTime);
    r.getIfPresent("coverageFadeOutTime", coverageFadeOutTime);
    r.getIfPresent("particleLifetimeMean", particleLifetimeMean);
    r.getIfPresent("particleLifetimeVariance", particleLifetimeVariance);
    r.getIfPresent("angularVelocityMean", angularVelocityMean);
    r.getIfPresent("angularVelocityVariance", angularVelocityVariance);
    r.getIfPresent("material", material);
    r.getIfPresent("radiusMean", radiusMean);
    r.getIfPresent("radiusVariance", radiusVariance);
    r.getIfPresent("particleMassDensity", particleMassDensity);
    r.getIfPresent("dragCoefficient", dragCoefficient);

    shapeType = Shape::Type::NONE;
    Any shape;
    if (r.getIfPresent("shape", shape)) {
        if (shape.nameBeginsWith("ArticulatedModel") || (shape.type() == Any::STRING)) {
            shapeType = Shape::Type::MESH;
        } else {
            shapeType = Shape::Type(toUpper(shape.name()));
        }

        switch (shapeType) {
        case Shape::Type::BOX:
            box = Box(shape);
            break;

        case Shape::Type::CYLINDER:
            cylinder = Cylinder(shape);
            break;

        case Shape::Type::SPHERE:
            sphere = Sphere(shape);
            break;

        case Shape::Type::MESH:
            mesh = shape;
            break;

        default:
            shape.verify(false, "Shape must be a Box, Cylinder, Sphere, or ArticulatedModel specification");
        }
    }

    r.getIfPresent("velocityDirectionMean", velocityDirectionMean);
    r.getIfPresent("velocityConeAngleDegrees", velocityConeAngleDegrees);
    r.getIfPresent("velocityMagnitudeMean", velocityMagnitudeMean);
    r.getIfPresent("velocityMagnitudeVariance", velocityMagnitudeVariance);
    r.verifyDone();
}
开发者ID:lieff,项目名称:g3d,代码行数:57,代码来源:ParticleSystemModel.cpp

示例8: debugPrintf

void VisibleEntity::init
   (AnyTableReader&    propertyTable,
    const ModelTable&  modelTable) {

    bool visible = true;
    propertyTable.getIfPresent("visible", visible);

    ArticulatedModel::Pose artPose;
    propertyTable.getIfPresent("articulatedModelPose", artPose);

    ArticulatedModel::PoseSpline artPoseSpline;
    propertyTable.getIfPresent("poseSpline", artPoseSpline);

	MD3Model::PoseSequence md3PoseSequence;
	propertyTable.getIfPresent("md3Pose", md3PoseSequence);

    Surface::ExpressiveLightScatteringProperties expressiveLightScatteringProperties;
    propertyTable.getIfPresent("expressiveLightScatteringProperties", expressiveLightScatteringProperties);
    
    if (propertyTable.getIfPresent("castsShadows", expressiveLightScatteringProperties.castsShadows)) {
        debugPrintf("Warning: castsShadows field is deprecated.  Use expressiveLightScatteringProperties");
    }    

    const lazy_ptr<Model>* model = NULL;
    Any modelNameAny;
    if (propertyTable.getIfPresent("model", modelNameAny)) {
        const String& modelName     = modelNameAny.string();
    
        modelNameAny.verify(modelTable.containsKey(modelName), 
                        "Can't instantiate undefined model named " + modelName + ".");
        model = modelTable.getPointer(modelName);
    }

    Any ignore;
    if (propertyTable.getIfPresent("materialTable", ignore)) {
        ignore.verify(false, "'materialTable' is deprecated. Specify materials on the articulatedModelPose field of VisibleEntity.");
    }

    init(notNull(model) ? model->resolve() : shared_ptr<Model>(), visible, expressiveLightScatteringProperties, artPoseSpline, md3PoseSequence, artPose);
}
开发者ID:elfprince13,项目名称:G3D10,代码行数:40,代码来源:VisibleEntity.cpp

示例9: toLower

BumpMapPreprocess::BumpMapPreprocess(const Any& any) {
    *this = BumpMapPreprocess();
    for (Any::AnyTable::Iterator it = any.table().begin(); it.hasMore(); ++it) {
        const std::string& key = toLower(it->key);
        if (key == "lowpassfilter") {
            lowPassFilter = it->value;
        } else if (key == "zextentpixels") {
            zExtentPixels = it->value;
        } else if (key == "scalezbynz") {
            scaleZByNz = it->value;
        } else {
            any.verify(false, "Illegal key: " + it->key);
        }
    }
}
开发者ID:BuloZB,项目名称:StrawberryEMU,代码行数:15,代码来源:BumpMapPreprocess.cpp

示例10: if

shared_ptr<Model> Scene::createModel(const Any& v, const std::string& name) {
    shared_ptr<Model> m;

    v.verify(! m_modelTable.containsKey(name), "A model named '" + name + "' already exists in this scene.");

    if ((v.type() == Any::STRING) || v.nameBeginsWith("ArticulatedModel")) {
        m = ArticulatedModel::create(v, name);

    } else if (v.nameBeginsWith("MD2Model")) {
        m = MD2Model::create(v, name);
    } else if (v.nameBeginsWith("MD3Model")) {
        m = MD3Model::create(v, name);
    } else if (v.nameBeginsWith("HeightfieldModel")) {
        m = HeightfieldModel::create(v, name);
    }

    if (isNull(m)) {
        v.verify(false, "Unrecognized model type: " + v.name());
    }

    m_modelTable.set(name, m);

    return m;
}
开发者ID:jackpoz,项目名称:G3D-backup,代码行数:24,代码来源:Scene.cpp

示例11: 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);
        }
    }
}
开发者ID:luaman,项目名称:g3d-cvs,代码行数:16,代码来源:BumpMap.cpp

示例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();
}
开发者ID:elfprince13,项目名称:G3D10,代码行数:17,代码来源:ParseOBJ.cpp

示例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();
    }
}
开发者ID:elfprince13,项目名称:G3D10,代码行数:44,代码来源:Texture_Visualization.cpp

示例14: createEntity

void Scene::createEntity(const std::string& entityType, const std::string& name, const Any& any) {
    AnyTableReader propertyTable(any);

    if (entityType == "VisibleEntity") {
        insert(VisibleEntity::create(name, this, propertyTable, m_modelTable));
    } else if (entityType == "Light") {
        insert(Light::create(name, this, propertyTable));
    } else if (entityType == "Camera") {
        insert(Camera::create(name, this, propertyTable));
    } else if (entityType == "MarkerEntity") {
        insert(MarkerEntity::create(name, this, propertyTable));
    } else if (entityType == "Skybox") {
        insert(Skybox::create(name, this, propertyTable));
    } else {
        any.verify(false, std::string("Unrecognized Entity type: \"") + entityType + "\"");
    }
        
    m_lastStructuralChangeTime = System::time();
}
开发者ID:jackpoz,项目名称:G3D-backup,代码行数:19,代码来源:Scene.cpp

示例15: 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);
    }
}
开发者ID:Akenyshka,项目名称:MythCore,代码行数:42,代码来源:CoordinateFrame.cpp


注:本文中的Any::verify方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。