示例#1
0
Mesh::VisualPtr AnyModelsSystem::load(const Transfer::RemoteFileMetadata& metadata, const Transfer::Fingerprint& fp,
    Transfer::DenseDataPtr data) {
    Mesh::VisualPtr result;
    for(SystemsMap::iterator it = mModelsSystems.begin(); it != mModelsSystems.end(); it++) {
        ModelsSystem* ms = it->second;
        if (ms->canLoad(data)) {
            result = ms->load(metadata, fp, data);
            if (result) return result;
        }
    }
    SILOG(AnyModelsSystem,error,"Couldn't find parser for " << metadata.getURI());
    return result;
}
示例#2
0
Mesh::VisualPtr BillboardSystem::load(const Transfer::RemoteFileMetadata& metadata, const Transfer::Fingerprint& fp,
    Transfer::DenseDataPtr data) {

    json::Value parsed;
    bool success = json::read(data->asString(), parsed);
    if (!success) return Mesh::VisualPtr();

    String url = parsed.getString("url", "");
    float32 aspect = parsed.getReal("aspect", -1.f);
    String type = parsed.getString("facing", String("camera"));

    Mesh::BillboardPtr result(new Mesh::Billboard());
    result->uri = metadata.getURI().toString();
    result->hash = fp;
    result->image = url;
    result->aspectRatio = aspect;
    result->facing = (type == "fixed") ? Mesh::Billboard::FACING_FIXED : Mesh::Billboard::FACING_CAMERA;
    return result;
}