Exemple #1
0
void COligofarCfg::PrintFullHelp( ostream& o )
{
    o << "usage:\n";
    pair<int,int> colw(0,0);
    for( int section = 0; section < eSection_END; ++section ) {
        if( section != eSection_passopt ) 
            PrintFullHelp( EConfigSection( section ), colw, 0, 0 );
    }
    PrintFullHelp( eSection_passopt, colw, 0, 0 );
    if( GetPassCount() > 1 ) {
        PrintFullHelp( eSection_passopt, colw, 0, 1 );
    }
    for( int section = 0; section < eSection_END; ++section ) {
        if( section != eSection_passopt ) 
            PrintFullHelp( EConfigSection( section ), colw, &o, 0 );
    }
    if( GetPassCount() > 1 ) o << "Initial pass parameters are:\n";
    PrintFullHelp( eSection_passopt, colw, &o, 0 );
    if( GetPassCount() > 1 ) {
        o << "Refining pass parameters are:\n";
        PrintFullHelp( eSection_passopt, colw, &o, 1 );
    }
    o
        << "\nRelative orientation flags recognized:\n"
        << "     p|centripetal|inside|pcr|solexa       reads are oriented so that vectors 5'->3' pointing to each other\n"
        << "     f|centrifugal|outside                 reads are oriented so that vectors 5'->3' are pointing outside\n"
        << "     i|incr|incremental|solid              reads are on same strand, first preceeds second on this strand\n"
        << "     d|decr|decremental                    reads are on same strand, first succeeds second on this strand\n"
        << "\nOutput flags (for -O):\n"
        << "     -   reset all flags\n"
        << "     h   report all hits before ranking\n"
        << "     u   report unmapped reads\n"
        << "     x   indicate that there are more reads of this rank\n"
        << "     m   indicate that there are more reads of lower ranks\n"
        << "     t   indicate that there were no more hits\n"
        << "     d   report differences between query and subject\n"
        << "     e   print empty line after all hits of the read are reported\n"
        << "     r   print raw scores rather then relative scores\n"
        << "     z   output in SAM 1.2 format (clears flag Z)\n"
        << "     Z   output in native format (clears flag z)\n"
        << "     p   print unpaired hits only if there are no paired\n"
        << "   Only 'p' and 'u' flags work in SAM 1.2 format output\n"
        << "Read file data options may be used only in combinations:\n"
        << "     1. with column file:\n"
        << "        -q0 -i input.col -c no \n"
        << "        -q1 -i input.col -c no \n"
        << "        -q0 -i input.col -c yes\n"
        << "     2. with fasta or fastq files:\n"
        << "        -q0 -1 reads1.fa  [-2 reads2.fa]  -c yes|no\n"
        << "        -q1 -1 reads1.faq [-2 reads2.faq] -c no\n"
        << "     3. with Solexa 4-channel data\n"
        << "        -q4 -i input.id -1 reads1.prb [-2 reads2.prb] -c no\n"
        << "\nNB: although -L flag is optional, it is strongly recommended to use it!\n" ;
}
void CBspMapResourceProvider::LoadTextures(const CBspFile& bspFile, CPakFile& pakFile)
{
	const Bsp::TextureArray& textures(bspFile.GetTextures());
	m_materials.resize(textures.size());
	for(uint32 i = 0; i < textures.size(); i++)
	{
		const Bsp::TEXTURE& texture(textures[i]);

		auto resultMaterial = BspMapMaterialPtr(new CBspMapMaterial());
		m_materials[i] = resultMaterial;

		ShaderMap::const_iterator shaderIterator = m_shaders.find(texture.name);
		if(shaderIterator == m_shaders.end())
		{
			//Create a basic material with this texture
			std::string fullName;
			if(!pakFile.TryCompleteFileName(texture.name, fullName))
			{
				continue;
			}

			LoadTexture(fullName.c_str(), pakFile);

			{
				auto pass = BspMapPassPtr(new CBspMapPass());
				pass->SetTexture(GetTexture(fullName.c_str()));
				pass->SetTextureSource(CBspMapPass::TEXTURE_SOURCE_DIFFUSE);
				pass->SetBlendingFunction(Palleon::TEXTURE_COMBINE_MODULATE);
				resultMaterial->AddPass(pass);
			}

			{
				auto pass = BspMapPassPtr(new CBspMapPass());
				pass->SetTextureSource(CBspMapPass::TEXTURE_SOURCE_LIGHTMAP);
				pass->SetBlendingFunction(Palleon::TEXTURE_COMBINE_MODULATE);
				resultMaterial->AddPass(pass);
			}
		}
		else
		{
			const QUAKE_SHADER& shader = shaderIterator->second;

			resultMaterial->SetIsSky(shader.isSky);

			for(QuakeShaderPassArray::const_iterator passIterator(shader.passes.begin());
				passIterator != shader.passes.end(); passIterator++)
			{
				const QUAKE_SHADER_PASS& passData(*passIterator);
				if(passData.mapName.length() < 4) continue;

				auto pass = BspMapPassPtr(new CBspMapPass());

				{
					Palleon::TEXTURE_COMBINE_MODE blendingFunction = Palleon::TEXTURE_COMBINE_MODULATE;
					switch(passData.blendFunc)
					{
					case QUAKE_SHADER_BLEND_BLEND:
						blendingFunction = Palleon::TEXTURE_COMBINE_LERP;
						break;
					case QUAKE_SHADER_BLEND_ADD:
						blendingFunction = Palleon::TEXTURE_COMBINE_ADD;
						break;
					case QUAKE_SHADER_BLEND_FILTER:
						blendingFunction = Palleon::TEXTURE_COMBINE_MODULATE;
						break;
					}
					pass->SetBlendingFunction(blendingFunction);
				}

				if(passData.mapName == "$lightmap")
				{
					pass->SetTextureSource(CBspMapPass::TEXTURE_SOURCE_LIGHTMAP);
				}
				else
				{
					std::string fileName(passData.mapName.begin(), passData.mapName.begin() + passData.mapName.length() - 4);
					
					std::string fullName;
					if(!pakFile.TryCompleteFileName(fileName.c_str(), fullName))
					{
						continue;
					}

					LoadTexture(fullName.c_str(), pakFile);
					pass->SetTexture(GetTexture(fullName.c_str()));
					pass->SetTextureSource(CBspMapPass::TEXTURE_SOURCE_DIFFUSE);
				}

				for(unsigned int i = 0; i < passData.tcMods.size(); i++)
				{
					const QUAKE_SHADER_TCMOD& tcMod(passData.tcMods[i]);
					BspMapTcModPtr result;
					switch(tcMod.type)
					{
					case QUAKE_SHADER_TCMOD_SCROLL:
						result = BspMapTcModPtr(new CBspMapTcMod_Scroll(
									tcMod.params[0],
									tcMod.params[1]));
						break;
					case QUAKE_SHADER_TCMOD_SCALE:
						result = BspMapTcModPtr(new CBspMapTcMod_Scale(
									tcMod.params[0],
									tcMod.params[1]));
						break;
					case QUAKE_SHADER_TCMOD_ROTATE:
						result = BspMapTcModPtr(new CBspMapTcMod_Rotate(
									tcMod.params[0]));
						break;
					case QUAKE_SHADER_TCMOD_TURB:
						result = BspMapTcModPtr(new CBspMapTcMod_Turb(
									tcMod.params[1],
									tcMod.params[3]));
						break;
					case QUAKE_SHADER_TCMOD_STRETCH:
						{
							BSPMAPWAVEPARAMS wave;
							wave.type		= BSPMAPWAVEPARAMS::WAVE_SIN;
							wave.base		= tcMod.params[0];
							wave.amplitude	= tcMod.params[1];
							wave.phase		= tcMod.params[2];
							wave.freq		= tcMod.params[3];
							result = BspMapTcModPtr(new CBspMapTcMod_Stretch(wave));
						}
						break;
					default:
						continue;
						break;
					}
					pass->AddTcMod(result);
				}

				resultMaterial->AddPass(pass);

				if(resultMaterial->GetPassCount() == CBspMapMaterial::MAX_PASS)
				{
					break;
				}
			}
		}
	}
}