本文整理汇总了C++中ConfigSet类的典型用法代码示例。如果您正苦于以下问题:C++ ConfigSet类的具体用法?C++ ConfigSet怎么用?C++ ConfigSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initScratch
Error ShadowMapping::initScratch(const ConfigSet& cfg)
{
// Init the shadowmaps and FBs
{
m_scratchTileCountX = cfg.getNumber("r.shadowMapping.scratchTileCountX");
m_scratchTileCountY = cfg.getNumber("r.shadowMapping.scratchTileCountY");
m_scratchTileResolution = cfg.getNumber("r.shadowMapping.tileResolution");
// RT
m_scratchRtDescr = m_r->create2DRenderTargetDescription(m_scratchTileResolution * m_scratchTileCountX,
m_scratchTileResolution * m_scratchTileCountY,
SHADOW_DEPTH_PIXEL_FORMAT,
"Scratch ShadMap");
m_scratchRtDescr.bake();
// FB
m_scratchFbDescr.m_depthStencilAttachment.m_loadOperation = AttachmentLoadOperation::CLEAR;
m_scratchFbDescr.m_depthStencilAttachment.m_clearValue.m_depthStencil.m_depth = 1.0f;
m_scratchFbDescr.m_depthStencilAttachment.m_aspect = DepthStencilAspectBit::DEPTH;
m_scratchFbDescr.bake();
}
m_scratchTileAlloc.init(getAllocator(), m_scratchTileCountX, m_scratchTileCountY, m_lodCount, false);
return Error::NONE;
}
示例2: LOG_IF
void CExternalChannel::CFrontEnd::MParseDemands(const NSHARE::CConfig& aConf)
{
const ConfigSet _dems = aConf.MChildren(DEMAND);
LOG_IF(WARNING,_dems.empty()) << "No demands ";
if (!_dems.empty())
{
ConfigSet::const_iterator _it = _dems.begin();
for (; _it != _dems.end(); ++_it)
{
VLOG(2) << "dem info " << *_it;
demand_dg_t _dem(*_it);
_dem.FHandler = 0;
LOG_IF(ERROR,!_dem.MIsValid()) << "Cannot create demands from "
<< _it->MToJSON(true);
if (_dem.MIsValid())
{
LOG(INFO)<<"Demand "<<_dem;
FDemands.push_back(_dem);
FSendProtocol.insert(_dem.FProtocol);
}
}
}
if (aConf.MIsChild(RECV_PROTOCOL))
{
VLOG(2) << "There is exit protocol";
FReceiveProtocol=aConf.MChild(RECV_PROTOCOL).MValue();
LOG_IF(FATAL,!FReceiveProtocol.empty() && !CParserFactory::sMGetInstance().MIsFactoryPresent(FReceiveProtocol))
<< "The protocol handler is not exist."<<FReceiveProtocol;
}
}
示例3: children
const ConfigSet Config::children( const std::string& key ) const {
ConfigSet r;
for(ConfigSet::const_iterator i = _children.begin(); i != _children.end(); i++ ) {
if ( (i)->key() == key )
r.push_back( *i );
}
return r;
}
示例4: URIContext
void
KML_Model::parseStyle(const Config& conf, KMLContext& cx, Style& style)
{
ModelSymbol* model = 0L;
std::string url = KMLUtils::parseLink(conf);
if ( !url.empty() )
{
if ( !model ) model = style.getOrCreate<ModelSymbol>();
model->url()->setLiteral( url );
model->url()->setURIContext( URIContext(conf.referrer()) );
}
Config scale = conf.child("scale");
if (!scale.empty())
{
if ( !model ) model = style.getOrCreate<ModelSymbol>();
//TODO: Support XYZ scale instead of single value
model->scale() = scale.value("x", 1.0);
}
Config orientation = conf.child("orientation");
if (!orientation.empty())
{
if ( !model ) model = style.getOrCreate<ModelSymbol>();
double h = orientation.value("heading", 0);
if ( !osg::equivalent(h, 0.0) )
model->heading() = NumericExpression( h );
double p = orientation.value("tilt", 0);
if ( !osg::equivalent(p, 0.0) )
model->pitch() = NumericExpression( p );
double r = orientation.value("roll", 0);
if ( !osg::equivalent(r, 0.0) )
model->roll() = NumericExpression( r );
}
// Read and store file path aliases from a KML ResourceMap.
Config resource_map = conf.child("resourcemap");
if ( !resource_map.empty() )
{
const ConfigSet aliases = resource_map.children("alias");
for( ConfigSet::const_iterator i = aliases.begin(); i != aliases.end(); ++i )
{
std::string source = i->value("sourcehref");
std::string target = i->value("targethref");
if ( !source.empty() || !target.empty() )
{
if ( !model ) model = style.getOrCreate<ModelSymbol>();
model->uriAliasMap()->insert( source, target );
}
}
}
KML_Geometry::parseStyle(conf, cx, style);
}
示例5: addLevel
void
FeatureDisplayLayout::fromConfig( const Config& conf )
{
conf.getIfSet( "tile_size_factor", _tileSizeFactor );
conf.getIfSet( "crop_features", _cropFeatures );
ConfigSet children = conf.children( "level" );
for( ConfigSet::const_iterator i = children.begin(); i != children.end(); ++i )
addLevel( FeatureLevel( *i ) );
}
示例6: LandCoverValueMapping
void
LandCoverCoverageLayerOptions::fromConfig(const Config& conf)
{
ConfigSet mappings = conf.child("land_cover_mappings").children("mapping");
for (ConfigSet::const_iterator i = mappings.begin(); i != mappings.end(); ++i)
{
osg::ref_ptr<LandCoverValueMapping> mapping = new LandCoverValueMapping(*i);
_valueMappings.push_back(mapping.get());
}
conf.get("warp", _warp);
}
示例7: addResource
void
ResourceLibrary::mergeConfig( const Config& conf )
{
// read skins
const ConfigSet skins = conf.children( "skin" );
for( ConfigSet::const_iterator i = skins.begin(); i != skins.end(); ++i )
{
addResource( new SkinResource(*i) );
}
//todo: other types later..
}
示例8: glCreateRenderer
bool Display::initialize()
{
if (isInitialized())
{
return true;
}
mRenderer = glCreateRenderer(this, mDisplayId, mRequestedDisplayType);
if (!mRenderer)
{
terminate();
return error(EGL_NOT_INITIALIZED, false);
}
EGLint minSwapInterval = mRenderer->getMinSwapInterval();
EGLint maxSwapInterval = mRenderer->getMaxSwapInterval();
EGLint maxTextureSize = mRenderer->getRendererCaps().max2DTextureSize;
rx::ConfigDesc *descList;
int numConfigs = mRenderer->generateConfigs(&descList);
ConfigSet configSet;
for (int i = 0; i < numConfigs; ++i)
{
configSet.add(descList[i], minSwapInterval, maxSwapInterval, maxTextureSize, maxTextureSize);
}
// Give the sorted configs a unique ID and store them internally
EGLint index = 1;
for (ConfigSet::Iterator config = configSet.mSet.begin(); config != configSet.mSet.end(); config++)
{
Config configuration = *config;
configuration.mConfigID = index;
index++;
mConfigSet.mSet.insert(configuration);
}
mRenderer->deleteConfigs(descList);
descList = NULL;
if (!isInitialized())
{
terminate();
return false;
}
initDisplayExtensionString();
initVendorString();
return true;
}
示例9: uri
void
ShaderOptions::fromConfig(const Config& conf)
{
_code = conf.value();
_samplers.clear();
ConfigSet s = conf.children("sampler");
for (ConfigSet::const_iterator i = s.begin(); i != s.end(); ++i) {
_samplers.push_back(Sampler());
_samplers.back()._name = i->value("name");
const Config* urlarray = i->find("array");
if (urlarray) {
ConfigSet uris = urlarray->children("url");
for (ConfigSet::const_iterator j = uris.begin(); j != uris.end(); ++j) {
URI uri(j->value(), URIContext(conf.referrer()));
_samplers.back()._uris.push_back(uri);
}
}
else {
optional<URI> uri;
i->get("url", uri);
if (uri.isSet())
_samplers.back()._uris.push_back(uri.get());
}
}
s = conf.children("uniform");
for (ConfigSet::const_iterator i = s.begin(); i != s.end(); ++i) {
_uniforms.push_back(Uniform());
_uniforms.back()._name = i->value("name");
i->get("value", _uniforms.back()._value);
}
}
示例10:
void
URI::mergeConfig(const Config& conf)
{
conf.get("option_string", _optionString);
const ConfigSet headers = conf.child("headers").children();
for (ConfigSet::const_iterator i = headers.begin(); i != headers.end(); ++i)
{
const Config& header = *i;
if (!header.key().empty() && !header.value().empty())
{
_context.addHeader(header.key(), header.value());
}
}
}
示例11: addLevel
void
FeatureDisplayLayout::fromConfig( const Config& conf )
{
conf.getIfSet( "tile_size", _tileSize );
conf.getIfSet( "tile_size_factor", _tileSizeFactor );
conf.getIfSet( "crop_features", _cropFeatures );
conf.getIfSet( "priority_offset", _priorityOffset );
conf.getIfSet( "priority_scale", _priorityScale );
conf.getIfSet( "min_expiry_time", _minExpiryTime );
conf.getIfSet( "min_range", _minRange );
conf.getIfSet( "max_range", _maxRange );
ConfigSet children = conf.children( "level" );
for( ConfigSet::const_iterator i = children.begin(); i != children.end(); ++i )
addLevel( FeatureLevel( *i ) );
}
示例12: initInternal
//==============================================================================
void Pps::initInternal(const ConfigSet& config)
{
m_enabled = config.get("pps.enabled");
if(!m_enabled)
{
return;
}
ANKI_ASSERT("Initializing PPS");
m_ssao.init(config);
m_hdr.init(config);
m_lf.init(config);
m_sslr.init(config);
// FBO
GlCommandBufferHandle cmdBuff;
cmdBuff.create(&getGlDevice());
m_r->createRenderTarget(m_r->getWidth(), m_r->getHeight(), GL_RGB8, GL_RGB,
GL_UNSIGNED_BYTE, 1, m_rt);
m_fb.create(cmdBuff, {{m_rt, GL_COLOR_ATTACHMENT0}});
// SProg
String pps(getAllocator());
pps.sprintf(
"#define SSAO_ENABLED %u\n"
"#define HDR_ENABLED %u\n"
"#define SHARPEN_ENABLED %u\n"
"#define GAMMA_CORRECTION_ENABLED %u\n"
"#define FBO_WIDTH %u\n"
"#define FBO_HEIGHT %u\n",
m_ssao.getEnabled(),
m_hdr.getEnabled(),
static_cast<U>(config.get("pps.sharpen")),
static_cast<U>(config.get("pps.gammaCorrection")),
m_r->getWidth(),
m_r->getHeight());
m_frag.loadToCache(&getResourceManager(),
"shaders/Pps.frag.glsl", pps.toCString(), "r_");
m_ppline = m_r->createDrawQuadProgramPipeline(m_frag->getGlProgram());
cmdBuff.finish();
}
示例13: StyleSelector
void
FeatureLevel::fromConfig( const Config& conf )
{
if ( conf.hasValue( "min_range" ) )
_minRange = conf.value( "min_range", 0.0f );
if ( conf.hasValue( "max_range" ) )
_maxRange = conf.value( "max_range", FLT_MAX );
conf.getIfSet( "lod", _lod );
const ConfigSet selectorsConf = conf.children( "selector" );
for( ConfigSet::const_iterator i = selectorsConf.begin(); i != selectorsConf.end(); ++i )
{
_selectors.push_back( StyleSelector(*i) );
}
}
示例14: initInternal
Error FinalComposite::initInternal(const ConfigSet& config)
{
ANKI_ASSERT("Initializing PPS");
ANKI_CHECK(loadColorGradingTexture("engine_data/DefaultLut.ankitex"));
m_fbDescr.m_colorAttachmentCount = 1;
m_fbDescr.m_colorAttachments[0].m_loadOperation = AttachmentLoadOperation::DONT_CARE;
m_fbDescr.bake();
ANKI_CHECK(getResourceManager().loadResource("engine_data/BlueNoiseLdrRgb64x64.ankitex", m_blueNoise));
// Progs
ANKI_CHECK(getResourceManager().loadResource("shaders/FinalComposite.glslp", m_prog));
ShaderProgramResourceMutationInitList<3> mutations(m_prog);
mutations.add("BLUE_NOISE", 1).add("BLOOM_ENABLED", 1).add("DBG_ENABLED", 0);
ShaderProgramResourceConstantValueInitList<3> consts(m_prog);
consts.add("LUT_SIZE", U32(LUT_SIZE))
.add("FB_SIZE", UVec2(m_r->getWidth(), m_r->getHeight()))
.add("MOTION_BLUR_SAMPLES", U32(config.getNumber("r.final.motionBlurSamples")));
const ShaderProgramResourceVariant* variant;
m_prog->getOrCreateVariant(mutations.get(), consts.get(), variant);
m_grProgs[0] = variant->getProgram();
mutations[2].m_value = 1;
m_prog->getOrCreateVariant(mutations.get(), consts.get(), variant);
m_grProgs[1] = variant->getProgram();
return Error::NONE;
}
示例15:
void
TextureSplatter::mergeConfig(const Config& conf)
{
conf.getIfSet( "start_lod", _startLOD );
conf.getIfSet( "intensity", _intensity );
conf.getIfSet( "scale", _scale );
conf.getIfSet( "attenuation_distance", _attenuationDistance );
conf.getIfSet( "mask_layer", _maskLayerName );
ConfigSet textures = conf.child("textures").children("texture");
for(ConfigSet::iterator i = textures.begin(); i != textures.end(); ++i)
{
_textures.push_back(TextureSource());
_textures.back()._tag = i->value("tag");
_textures.back()._url = i->value("url");
}
}