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


C++ ConfigSet::get方法代码示例

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


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

示例1: 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();
}
开发者ID:yaroslav-tarasov,项目名称:anki-3d-engine,代码行数:49,代码来源:Pps.cpp

示例2: initInternal

//==============================================================================
void Pps::initInternal(const ConfigSet& initializer)
{
	m_enabled = initializer.get("pps.enabled");
	if(!m_enabled)
	{
		return;
	}

	ANKI_ASSERT("Initializing PPS");

	m_ssao.init(initializer);
	m_hdr.init(initializer);
	m_lf.init(initializer);
	m_sslr.init(initializer);

	// FBO
	GlDevice& gl = GlDeviceSingleton::get();
	GlCommandBufferHandle jobs(&gl);

	m_r->createRenderTarget(m_r->getWidth(), m_r->getHeight(), GL_RGB8, GL_RGB,
		GL_UNSIGNED_BYTE, 1, m_rt);

	m_fb = GlFramebufferHandle(jobs, {{m_rt, GL_COLOR_ATTACHMENT0}});

	// SProg
	std::stringstream pps;

	pps << "#define SSAO_ENABLED " << (U)m_ssao.getEnabled() << "\n"
		<< "#define HDR_ENABLED " << (U)m_hdr.getEnabled() << "\n"
		<< "#define SHARPEN_ENABLED " << (U)initializer.get("pps.sharpen") 
			<< "\n"
		<< "#define GAMMA_CORRECTION_ENABLED " 
			<< (U)initializer.get("pps.gammaCorrection") << "\n"
		<< "#define FBO_WIDTH " << (U)m_r->getWidth() << "\n"
		<< "#define FBO_HEIGHT " << (U)m_r->getHeight() << "\n";

	m_frag.load(ProgramResource::createSrcCodeToCache(
		"shaders/Pps.frag.glsl", pps.str().c_str(), "r_").c_str());

	m_ppline = m_r->createDrawQuadProgramPipeline(m_frag->getGlProgram());

	jobs.finish();
}
开发者ID:ezhangle,项目名称:anki-3d-engine,代码行数:44,代码来源:Pps.cpp

示例3: init

//==============================================================================
void Renderer::init(const ConfigSet& initializer)
{
	// Set from the initializer
	m_width = initializer.get("width");
	m_height = initializer.get("height");
	m_lodDistance = initializer.get("lodDistance");
	m_framesNum = 0;
	m_samples = initializer.get("samples");
	m_isOffscreen = initializer.get("offscreen");
	m_renderingQuality = initializer.get("renderingQuality");
	m_tilesCount.x() = initializer.get("tilesXCount");
	m_tilesCount.y() = initializer.get("tilesYCount");

	m_tessellation = initializer.get("tessellation");

	// A few sanity checks
	if(m_samples != 1 && m_samples != 4 && m_samples != 8 && m_samples != 16
		&& m_samples != 32)
	{
		throw ANKI_EXCEPTION("Incorrect samples");
	}

	if(m_width < 10 || m_height < 10)
	{
		throw ANKI_EXCEPTION("Incorrect sizes");
	}

	// quad setup
	static const F32 quadVertCoords[][2] = {{1.0, 1.0}, {-1.0, 1.0}, 
		{1.0, -1.0}, {-1.0, -1.0}};

	GlDevice& gl = GlDeviceSingleton::get();
	GlCommandBufferHandle jobs(&gl);

	GlClientBufferHandle tmpBuff = GlClientBufferHandle(jobs, 
		sizeof(quadVertCoords), (void*)&quadVertCoords[0][0]);

	m_quadPositionsBuff = GlBufferHandle(jobs, GL_ARRAY_BUFFER, 
		tmpBuff, 0);

	m_drawQuadVert.load("shaders/Quad.vert.glsl");

	// Init the stages. Careful with the order!!!!!!!!!!
	m_tiler.init(this);

	m_ms.init(initializer);;
	m_is.init(initializer);
	m_bs.init(initializer);
	m_pps.init(initializer);
	m_dbg.init(initializer);

	// Init the shaderPostProcessorString
	std::stringstream ss;
	ss << "#define RENDERING_WIDTH " << m_width << "\n"
		<< "#define RENDERING_HEIGHT " << m_height << "\n";

	m_shaderPostProcessorString = ss.str();

	// Default FB
	m_defaultFb = GlFramebufferHandle(jobs, {});

	jobs.finish();
}
开发者ID:ezhangle,项目名称:anki-3d-engine,代码行数:64,代码来源:Renderer.cpp

示例4: initInternal

//==============================================================================
void Hdr::initInternal(const ConfigSet& initializer)
{
	m_enabled = initializer.get("pps.hdr.enabled");

	if(!m_enabled)
	{
		return;
	}

	const F32 renderingQuality = initializer.get("pps.hdr.renderingQuality");

	m_width = renderingQuality * (F32)m_r->getWidth();
	alignRoundDown(16, m_width);
	m_height = renderingQuality * (F32)m_r->getHeight();
	alignRoundDown(16, m_height);

	m_exposure = initializer.get("pps.hdr.exposure");
	m_blurringDist = initializer.get("pps.hdr.blurringDist");
	m_blurringIterationsCount = 
		initializer.get("pps.hdr.blurringIterationsCount");

	initFb(m_hblurFb, m_hblurRt);
	initFb(m_vblurFb, m_vblurRt);

	// init shaders
	GlDevice& gl = getGlDevice();
	GlCommandBufferHandle jobs(&gl);

	m_commonBuff = GlBufferHandle(jobs, GL_SHADER_STORAGE_BUFFER, 
		sizeof(Vec4), GL_DYNAMIC_STORAGE_BIT);

	updateDefaultBlock(jobs);

	jobs.flush();

	m_toneFrag.load("shaders/PpsHdr.frag.glsl", &getResourceManager());

	m_tonePpline = 
		m_r->createDrawQuadProgramPipeline(m_toneFrag->getGlProgram());

	const char* SHADER_FILENAME = 
		"shaders/VariableSamplingBlurGeneric.frag.glsl";

	String pps(getAllocator());
	pps.sprintf("#define HPASS\n"
		"#define COL_RGB\n"
		"#define BLURRING_DIST float(%f)\n"
		"#define IMG_DIMENSION %u\n"
		"#define SAMPLES %u\n",
		m_blurringDist, m_height, 
		static_cast<U>(initializer.get("pps.hdr.samples")));

	m_hblurFrag.load(ProgramResource::createSourceToCache(
		SHADER_FILENAME, pps.toCString(), "r_", 
		getResourceManager()).toCString(),
		&getResourceManager());

	m_hblurPpline = 
		m_r->createDrawQuadProgramPipeline(m_hblurFrag->getGlProgram());

	pps.sprintf("#define VPASS\n"
		"#define COL_RGB\n"
		"#define BLURRING_DIST float(%f)\n"
		"#define IMG_DIMENSION %u\n"
		"#define SAMPLES %u\n",
		m_blurringDist, m_width, 
		static_cast<U>(initializer.get("pps.hdr.samples")));

	m_vblurFrag.load(ProgramResource::createSourceToCache(
		SHADER_FILENAME, pps.toCString(), "r_",
		getResourceManager()).toCString(),
		&getResourceManager());

	m_vblurPpline = 
		m_r->createDrawQuadProgramPipeline(m_vblurFrag->getGlProgram());

	// Set timestamps
	m_parameterUpdateTimestamp = getGlobTimestamp();
	m_commonUboUpdateTimestamp = getGlobTimestamp();
}
开发者ID:ezhangle,项目名称:anki-3d-engine,代码行数:81,代码来源:Hdr.cpp

示例5: initInternal

//==============================================================================
void Ssao::initInternal(const ConfigSet& config)
{
	m_enabled = config.get("pps.ssao.enabled");

	if(!m_enabled)
	{
		return;
	}

	m_blurringIterationsCount = 
		config.get("pps.ssao.blurringIterationsCount");

	//
	// Init the widths/heights
	//
	const F32 quality = config.get("pps.ssao.renderingQuality");

	m_width = quality * (F32)m_r->getWidth();
	alignRoundUp(16, m_width);
	m_height = quality * (F32)m_r->getHeight();
	alignRoundUp(16, m_height);

	//
	// create FBOs
	//
	createFb(m_hblurFb, m_hblurRt);
	createFb(m_vblurFb, m_vblurRt);

	//
	// noise texture
	//
	GlCommandBufferHandle cmdb;
	cmdb.create(&getGlDevice());

	GlClientBufferHandle noise;
	noise.create(
		cmdb, sizeof(Vec3) * NOISE_TEX_SIZE * NOISE_TEX_SIZE, nullptr);

	genNoise((Vec3*)noise.getBaseAddress(), 
		(Vec3*)((U8*)noise.getBaseAddress() + noise.getSize()));

	GlTextureHandle::Initializer tinit;

	tinit.m_width = tinit.m_height = NOISE_TEX_SIZE;
	tinit.m_target = GL_TEXTURE_2D;
	tinit.m_internalFormat = GL_RGB32F;
	tinit.m_format = GL_RGB;
	tinit.m_type = GL_FLOAT;
	tinit.m_filterType = GlTextureHandle::Filter::NEAREST;
	tinit.m_repeat = true;
	tinit.m_mipmapsCount = 1;
	tinit.m_data[0][0] = noise;

	m_noiseTex.create(cmdb, tinit);

	//
	// Kernel
	//
	String kernelStr(getAllocator());
	Array<Vec3, KERNEL_SIZE> kernel;

	genKernel(kernel.begin(), kernel.end());
	kernelStr = "vec3[](";
	for(U i = 0; i < kernel.size(); i++)
	{
		String tmp(getAllocator());

		tmp.sprintf("vec3(%f, %f, %f) %s",
			kernel[i].x(), kernel[i].y(), kernel[i].z(),
			(i != kernel.size() - 1) ? ", " : ")");

		kernelStr += tmp;
	}

	//
	// Shaders
	//
	m_uniformsBuff.create(cmdb, GL_SHADER_STORAGE_BUFFER, 
		sizeof(ShaderCommonUniforms), GL_DYNAMIC_STORAGE_BIT);

	String pps(getAllocator());

	// main pass prog
	pps.sprintf(
		"#define NOISE_MAP_SIZE %u\n"
		"#define WIDTH %u\n"
		"#define HEIGHT %u\n"
		"#define KERNEL_SIZE %u\n"
		"#define KERNEL_ARRAY %s\n",
		NOISE_TEX_SIZE, m_width, m_height, KERNEL_SIZE, &kernelStr[0]);

	m_ssaoFrag.loadToCache(&getResourceManager(),
		"shaders/PpsSsao.frag.glsl", pps.toCString(), "r_");


	m_ssaoPpline = m_r->createDrawQuadProgramPipeline(
		m_ssaoFrag->getGlProgram());

	// blurring progs
//.........这里部分代码省略.........
开发者ID:yaroslav-tarasov,项目名称:anki-3d-engine,代码行数:101,代码来源:Ssao.cpp


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