コード例 #1
0
ファイル: MmOptimiseTool.cpp プロジェクト: xubingyue/Ogitor
	//------------------------------------------------------------------------
	void OptimiseTool::doInvoke(const OptionList& toolOptions,
		const Ogre::StringVector& inFileNames, const Ogre::StringVector& outFileNamesArg)
	{
		// Name count has to match, else we have no way to figure out how to apply output
		// names to input files.
		if (!(outFileNamesArg.empty() || inFileNames.size() == outFileNamesArg.size()))
		{
			fail("number of output files must match number of input files.");
		}

		mPosTolerance = mNormTolerance = mUVTolerance = 1e-06f;
		mKeepIdentityTracks = OptionsUtil::isOptionSet(toolOptions, "keep-identity-tracks");
		for (OptionList::const_iterator it = toolOptions.begin(); it != toolOptions.end(); ++it)
		{
			if (it->first == "tolerance")
			{
				mPosTolerance = mNormTolerance = mUVTolerance = static_cast<float>(any_cast<Real>(it->second));
			}
			else if (it->first == "pos_tolerance")
			{
				mPosTolerance = static_cast<float>(any_cast<Real>(it->second));
			}
			else if (it->first == "norm_tolerance")
			{
				mNormTolerance = static_cast<float>(any_cast<Real>(it->second));
			}
			else if (it->first == "uv_tolerance")
			{
				mUVTolerance = static_cast<float>(any_cast<Real>(it->second));
			}
		}


		StringVector outFileNames = outFileNamesArg.empty() ? inFileNames : outFileNamesArg;

		// Process the meshes
		for (size_t i = 0, end = inFileNames.size(); i < end; ++i)
		{
			if (StringUtil::endsWith(inFileNames[i], ".mesh", true))
			{
				processMeshFile(inFileNames[i], outFileNames[i]);
			}
			else if (StringUtil::endsWith(inFileNames[i], ".skeleton", true))
			{
				processSkeletonFile(inFileNames[i], outFileNames[i]);
			}
			else
			{
				warn("unrecognised name ending for file " + inFileNames[i]);
				warn("file skipped.");
			}
		}
	}
コード例 #2
0
bool SoundScriptTemplate::setParameter(Ogre::StringVector vec)
{
    if (vec.empty())
        return false;

    if (vec[0] == String("trigger_source"))
    {
        if (vec.size() < 2)
            return false;
        if (vec[1] == String("engine"))
        {
            trigger_source = SS_TRIG_ENGINE;
            return true;
        };
        if (vec[1] == String("aeroengine1"))
        {
            trigger_source = SS_TRIG_AEROENGINE1;
            return true;
        };
        if (vec[1] == String("aeroengine2"))
        {
            trigger_source = SS_TRIG_AEROENGINE2;
            return true;
        };
        if (vec[1] == String("aeroengine3"))
        {
            trigger_source = SS_TRIG_AEROENGINE3;
            return true;
        };
        if (vec[1] == String("aeroengine4"))
        {
            trigger_source = SS_TRIG_AEROENGINE4;
            return true;
        };
        if (vec[1] == String("aeroengine5"))
        {
            trigger_source = SS_TRIG_AEROENGINE5;
            return true;
        };
        if (vec[1] == String("aeroengine6"))
        {
            trigger_source = SS_TRIG_AEROENGINE6;
            return true;
        };
        if (vec[1] == String("aeroengine7"))
        {
            trigger_source = SS_TRIG_AEROENGINE7;
            return true;
        };
        if (vec[1] == String("aeroengine8"))
        {
            trigger_source = SS_TRIG_AEROENGINE8;
            return true;
        };
        if (vec[1] == String("horn"))
        {
            trigger_source = SS_TRIG_HORN;
            return true;
        };
        if (vec[1] == String("brake"))
        {
            trigger_source = SS_TRIG_BRAKE;
            return true;
        };
        if (vec[1] == String("pump"))
        {
            trigger_source = SS_TRIG_PUMP;
            return true;
        };
        if (vec[1] == String("starter"))
        {
            trigger_source = SS_TRIG_STARTER;
            return true;
        };
        if (vec[1] == String("turbo_BOV"))
        {
            trigger_source = SS_TRIG_TURBOBOV;
            return true;
        };
        if (vec[1] == String("turbo_waste_gate"))
        {
            trigger_source = SS_TRIG_TURBOWASTEGATE;
            return true;
        };
        if (vec[1] == String("turbo_back_fire"))
        {
            trigger_source = SS_TRIG_TURBOBACKFIRE;
            return true;
        };
        if (vec[1] == String("always_on"))
        {
            trigger_source = SS_TRIG_ALWAYSON;
            return true;
        };
        if (vec[1] == String("repair"))
        {
            trigger_source = SS_TRIG_REPAIR;
            return true;
        };
        if (vec[1] == String("air"))
        {
            trigger_source = SS_TRIG_AIR;
            return true;
        };
        if (vec[1] == String("gpws_ap_disconnect"))
        {
            trigger_source = SS_TRIG_GPWS_APDISCONNECT;
            return true;
        };
        if (vec[1] == String("gpws_10"))
        {
            trigger_source = SS_TRIG_GPWS_10;
            return true;
        };
        if (vec[1] == String("gpws_20"))
        {
            trigger_source = SS_TRIG_GPWS_20;
            return true;
        };
        if (vec[1] == String("gpws_30"))
        {
            trigger_source = SS_TRIG_GPWS_30;
            return true;
        };
        if (vec[1] == String("gpws_40"))
        {
            trigger_source = SS_TRIG_GPWS_40;
            return true;
        };
        if (vec[1] == String("gpws_50"))
        {
            trigger_source = SS_TRIG_GPWS_50;
            return true;
        };
        if (vec[1] == String("gpws_100"))
        {
            trigger_source = SS_TRIG_GPWS_100;
            return true;
        };
        if (vec[1] == String("gpws_pull_up"))
        {
            trigger_source = SS_TRIG_GPWS_PULLUP;
            return true;
        };
        if (vec[1] == String("gpws_minimums"))
        {
            trigger_source = SS_TRIG_GPWS_MINIMUMS;
            return true;
        };
        if (vec[1] == String("air_purge"))
        {
            trigger_source = SS_TRIG_AIR_PURGE;
            return true;
        };
        if (vec[1] == String("shift"))
        {
            trigger_source = SS_TRIG_SHIFT;
            return true;
        };
        if (vec[1] == String("gear_slide"))
        {
            trigger_source = SS_TRIG_GEARSLIDE;
            return true;
        };
        if (vec[1] == String("creak") && App::audio_enable_creak.GetActive())
        {
            trigger_source = SS_TRIG_CREAK;
            return true;
        };
        if (vec[1] == String("break"))
        {
            trigger_source = SS_TRIG_BREAK;
            return true;
        };
        if (vec[1] == String("screetch"))
        {
            trigger_source = SS_TRIG_SCREETCH;
            return true;
        };
        if (vec[1] == String("parking_brake"))
        {
            trigger_source = SS_TRIG_PARK;
            return true;
        };
        if (vec[1] == String("antilock"))
        {
            trigger_source = SS_TRIG_ALB_ACTIVE;
            return true;
        };
        if (vec[1] == String("tractioncontrol"))
        {
            trigger_source = SS_TRIG_TC_ACTIVE;
            return true;
        };
        if (vec[1] == String("afterburner1"))
        {
            trigger_source = SS_TRIG_AFTERBURNER1;
            return true;
        };
        if (vec[1] == String("afterburner2"))
        {
            trigger_source = SS_TRIG_AFTERBURNER2;
            return true;
        };
        if (vec[1] == String("afterburner3"))
        {
            trigger_source = SS_TRIG_AFTERBURNER3;
            return true;
        };
        if (vec[1] == String("afterburner4"))
        {
            trigger_source = SS_TRIG_AFTERBURNER4;
            return true;
        };
        if (vec[1] == String("afterburner5"))
        {
            trigger_source = SS_TRIG_AFTERBURNER5;
            return true;
        };
        if (vec[1] == String("afterburner6"))
        {
            trigger_source = SS_TRIG_AFTERBURNER6;
            return true;
        };
        if (vec[1] == String("afterburner7"))
        {
            trigger_source = SS_TRIG_AFTERBURNER7;
            return true;
        };
        if (vec[1] == String("afterburner8"))
        {
            trigger_source = SS_TRIG_AFTERBURNER8;
            return true;
        };
        if (vec[1] == String("avionic_chat_01"))
        {
            trigger_source = SS_TRIG_AVICHAT01;
            return true;
        };
        if (vec[1] == String("avionic_chat_02"))
        {
            trigger_source = SS_TRIG_AVICHAT02;
            return true;
        };
        if (vec[1] == String("avionic_chat_03"))
        {
            trigger_source = SS_TRIG_AVICHAT03;
            return true;
        };
        if (vec[1] == String("avionic_chat_04"))
        {
            trigger_source = SS_TRIG_AVICHAT04;
            return true;
        };
        if (vec[1] == String("avionic_chat_05"))
        {
            trigger_source = SS_TRIG_AVICHAT05;
            return true;
        };
        if (vec[1] == String("avionic_chat_06"))
        {
            trigger_source = SS_TRIG_AVICHAT06;
            return true;
        };
        if (vec[1] == String("avionic_chat_07"))
        {
            trigger_source = SS_TRIG_AVICHAT07;
            return true;
        };
        if (vec[1] == String("avionic_chat_08"))
        {
            trigger_source = SS_TRIG_AVICHAT08;
            return true;
        };
        if (vec[1] == String("avionic_chat_09"))
        {
            trigger_source = SS_TRIG_AVICHAT09;
            return true;
        };
        if (vec[1] == String("avionic_chat_10"))
        {
            trigger_source = SS_TRIG_AVICHAT10;
            return true;
        };
        if (vec[1] == String("avionic_chat_11"))
        {
            trigger_source = SS_TRIG_AVICHAT11;
            return true;
        };
        if (vec[1] == String("avionic_chat_12"))
        {
            trigger_source = SS_TRIG_AVICHAT12;
            return true;
        };
        if (vec[1] == String("avionic_chat_13"))
        {
            trigger_source = SS_TRIG_AVICHAT13;
            return true;
        };
        if (vec[1] == String("aoa_horn"))
        {
            trigger_source = SS_TRIG_AOA;
            return true;
        };
        if (vec[1] == String("ignition"))
        {
            trigger_source = SS_TRIG_IGNITION;
            return true;
        };
        if (vec[1] == String("reverse_gear"))
        {
            trigger_source = SS_TRIG_REVERSE_GEAR;
            return true;
        };
        if (vec[1] == String("turn_signal"))
        {
            trigger_source = SS_TRIG_TURN_SIGNAL;
            return true;
        };
        if (vec[1] == String("turn_signal_tick"))
        {
            trigger_source = SS_TRIG_TURN_SIGNAL_TICK;
            return true;
        };
        if (vec[1] == String("turn_signal_warn_tick"))
        {
            trigger_source = SS_TRIG_TURN_SIGNAL_WARN_TICK;
            return true;
        };
        if (vec[1] == String("linked_command"))
        {
            trigger_source = SS_TRIG_LINKED_COMMAND;
            return true;
        };
        if (vec[1] == String("main_menu"))
        {
            trigger_source = SS_TRIG_MAIN_MENU;
            return true;
        };

        return false;
    }

    if (vec[0] == String("pitch_source"))
    {
        if (vec.size() < 2)
            return false;
        int mod = parseModulation(vec[1]);
        if (mod >= 0)
        {
            pitch_source = mod;
            return true;
        }
        return false;
    }

    if (vec[0] == String("pitch_factors"))
    {
        if (vec.size() < 3)
            return false;
        pitch_offset = StringConverter::parseReal(vec[1]);
        pitch_multiplier = StringConverter::parseReal(vec[2]);
        if (vec.size() == 4)
        {
            pitch_square = StringConverter::parseReal(vec[3]);
        }
        return true;
    }

    if (vec[0] == String("gain_source"))
    {
        if (vec.size() < 2)
            return false;
        int mod = parseModulation(vec[1]);
        if (mod >= 0)
        {
            gain_source = mod;
            return true;
        }
        return false;
    }

    if (vec[0] == String("gain_factors"))
    {
        if (vec.size() < 3)
            return false;
        gain_offset = StringConverter::parseReal(vec[1]);
        gain_multiplier = StringConverter::parseReal(vec[2]);
        if (vec.size() == 4)
        {
            gain_square = StringConverter::parseReal(vec[3]);
        }
        return true;
    }

    if (vec[0] == String("start_sound"))
    {
        if (vec.size() < 3)
            return false;
        start_sound_pitch = StringConverter::parseReal(vec[1]); // unparsable (e.g. "unpitched") will result in value 0.0
        start_sound_name = vec[2];
        has_start_sound = true;
        return true;
    }

    if (vec[0] == String("stop_sound"))
    {
        if (vec.size() < 3)
            return false;
        stop_sound_pitch = StringConverter::parseReal(vec[1]); // unparsable (e.g. "unpitched") will result in value 0.0
        stop_sound_name = vec[2];
        has_stop_sound = true;
        return true;
    }

    if (vec[0] == String("sound"))
    {
        if (vec.size() < 3)
            return false;
        if (free_sound >= MAX_SOUNDS_PER_SCRIPT)
        {
            LOG("SoundScriptManager: Reached MAX_SOUNDS_PER_SCRIPT limit (" + TOSTRING(MAX_SOUNDS_PER_SCRIPT) + ")");
            return false;
        }
        sound_pitches[free_sound] = StringConverter::parseReal(vec[1]); // unparsable (e.g. "unpitched") will result in value 0.0
        if (sound_pitches[free_sound] == 0)
        {
            unpitchable = true;
        }
        if (free_sound > 0 && !unpitchable && sound_pitches[free_sound] <= sound_pitches[free_sound - 1])
        {
            return false;
        }
        sound_names[free_sound] = vec[2];
        free_sound++;
        return true;
    }

    return false;
}