Exemple #1
0
pal::string_t fx_muxer_t::resolve_fx_dir(const pal::string_t& muxer_dir, runtime_config_t* runtime)
{
    trace::verbose(_X("--- Resolving FX directory from muxer dir [%s]"), muxer_dir.c_str());
    const auto fx_name = runtime->get_fx_name();
    const auto fx_ver = runtime->get_fx_version();
    const auto roll_fwd = runtime->get_fx_roll_fwd();

    fx_ver_t specified(-1, -1, -1);
    if (!fx_ver_t::parse(fx_ver, &specified, false))
    {
        trace::error(_X("The specified runtimeconfig.json version [%s] could not be parsed"), fx_ver.c_str());
        return pal::string_t();
    }

    auto fx_dir = muxer_dir;
    append_path(&fx_dir, _X("shared"));
    append_path(&fx_dir, fx_name.c_str());

    // If not roll forward or if pre-release, just return.
    if (!roll_fwd || specified.is_prerelease())
    {
        trace::verbose(_X("Did not roll forward because rollfwd=%d and [%s] is prerelease=%d"),
                roll_fwd, fx_ver.c_str(), specified.is_prerelease());
        append_path(&fx_dir, fx_ver.c_str());
    }
    else
    {
        trace::verbose(_X("Attempting production FX roll forward starting from [%s]"), fx_ver.c_str());

        std::vector<pal::string_t> list;
        pal::readdir(fx_dir, &list);
        fx_ver_t max_specified = specified;
        for (const auto& version : list)
        {
            trace::verbose(_X("Inspecting version... [%s]"), version.c_str());
            fx_ver_t ver(-1, -1, -1);
            if (fx_ver_t::parse(version, &ver, true) &&
                ver.get_major() == max_specified.get_major() &&
                ver.get_minor() == max_specified.get_minor())
            {
                max_specified.set_patch(std::max(ver.get_patch(), max_specified.get_patch()));
            }
        }
        pal::string_t max_specified_str = max_specified.as_str();
        append_path(&fx_dir, max_specified_str.c_str());
    }

    trace::verbose(_X("Chose FX version [%s]"), fx_dir.c_str());
    return fx_dir;
}
Exemple #2
0
// Compute the maximum (absolute) cos value of between vector deris[i](t) 
// and vector this->TP(i)(t) for i=0,1,2,3, where t is a common
// parameter of the data point obtained from deris[i]'s knot vector.
//Function's return value is the max out of cosmax[.].
double MGSBRepVecTP::get_perimeters_max_cos(
	const MGPvector<MGLBRep>& deris,
	double taumax[4],
	double cosmax[4]
)const{
	assert(deris.size() == 4);
	MGVector N(3), T(3);
	MGNDDArray tau;
	double max=0.;
	for(int i = 0; i < 4; i++){
		if(!specified(i)){
			taumax[i] = deris[i]->param_s();
			cosmax[i] = 0.;
			continue;
		}

		tau.update_from_knot(deris[i]->knot_vector());
		double taus=tau[0];
		double cmi=0.;
		double tmi = taus;
		if(eval(i,taus,T)){
			N = deris[i]->eval(taus);
			cmi = fabs(N.cangle(T));
			tmi = taus;
		}

		int ntau=tau.length();
		for(int j = 1; j < ntau; j++){
			double tauj=tau[j];
			double tmid = (tau[j-1]+tauj)*.5;
			double cm;
			if(eval(i,tmid,T)){
				N = deris[i]->eval(tmid);
				cm = fabs(N.cangle(T));
				if(cmi<cm){	cmi = cm; tmi = tmid;}
			}

			if(!eval(i,tauj,T)) continue;
			N = deris[i]->eval(tauj);
			cm = fabs(N.cangle(T));
			if(cmi<cm){cmi = cm; tmi = tauj;}
		}
		taumax[i] = tmi;
		cosmax[i] = cmi;
		if(max<cmi) max=cmi;
	}
	return max;
}
Exemple #3
0
double Animation::calculateTimeToEffectChange(double localTime, double timeToNextIteration) const
{
    const double activeStartTime = startTime() + specified().startDelay;
    switch (phase()) {
    case PhaseBefore:
        return activeStartTime - localTime;
    case PhaseActive:
        if (hasActiveAnimationsOnCompositor()) {
            // Need service to apply fill / fire events.
            const double activeEndTime = activeStartTime + activeDuration();
            return std::min(activeEndTime - localTime, timeToNextIteration);
        }
        return 0;
    case PhaseAfter:
        // If this Animation is still in effect then it will need to update
        // when its parent goes out of effect. We have no way of knowing when
        // that will be, however, so the parent will need to supply it.
        return std::numeric_limits<double>::infinity();
    case PhaseNone:
    default:
        ASSERT_NOT_REACHED();
        return 0;
    }
}
Exemple #4
0
pal::string_t fx_muxer_t::resolve_fx_dir(host_mode_t mode, const pal::string_t& own_dir, const runtime_config_t& config, const pal::string_t& specified_fx_version)
{
    // No FX resolution for standalone apps.
    assert(mode != host_mode_t::standalone);

    // If invoking using FX dotnet.exe, use own directory.
    if (mode == host_mode_t::split_fx)
    {
        return own_dir;
    }
    assert(mode == host_mode_t::muxer);

    trace::verbose(_X("--- Resolving FX directory from muxer dir '%s', specified '%s'"), own_dir.c_str(), specified_fx_version.c_str());
    const auto fx_name = config.get_fx_name();
    const auto fx_ver = specified_fx_version.empty() ? config.get_fx_version() : specified_fx_version;

    fx_ver_t specified(-1, -1, -1);
    if (!fx_ver_t::parse(fx_ver, &specified, false))
    {
        trace::error(_X("The specified framework version '%s' could not be parsed"), fx_ver.c_str());
        return pal::string_t();
    }

    auto fx_dir = own_dir;
    append_path(&fx_dir, _X("shared"));
    append_path(&fx_dir, fx_name.c_str());

    bool do_roll_forward = false;
    if (specified_fx_version.empty())
    {
        if (!specified.is_prerelease())
        {
            // If production and no roll forward use given version.
            do_roll_forward = config.get_patch_roll_fwd();
        }
        else
        {
            // Prerelease, but roll forward only if version doesn't exist.
            pal::string_t ver_dir = fx_dir;
            append_path(&ver_dir, fx_ver.c_str());
            do_roll_forward = !pal::directory_exists(ver_dir);
        }
    }

    if (!do_roll_forward)
    {
        trace::verbose(_X("Did not roll forward because specified version='%s', patch_roll_fwd=%d, chose [%s]"), specified_fx_version.c_str(), config.get_patch_roll_fwd(), fx_ver.c_str());
        append_path(&fx_dir, fx_ver.c_str());
    }
    else
    {
        trace::verbose(_X("Attempting FX roll forward starting from [%s]"), fx_ver.c_str());

        std::vector<pal::string_t> list;
        pal::readdir(fx_dir, &list);
        fx_ver_t most_compatible = specified;
        for (const auto& version : list)
        {
            trace::verbose(_X("Inspecting version... [%s]"), version.c_str());
            fx_ver_t ver(-1, -1, -1);
            if (!specified.is_prerelease() && fx_ver_t::parse(version, &ver, true) && // true -- only prod. prevents roll forward to prerelease.
                ver.get_major() == specified.get_major() &&
                ver.get_minor() == specified.get_minor())
            {
                // Pick the greatest production that differs only in patch.
                most_compatible = std::max(ver, most_compatible);
            }
            if (specified.is_prerelease() && fx_ver_t::parse(version, &ver, false) && // false -- implies both production and prerelease.
                ver.is_prerelease() && // prevent roll forward to production.
                ver.get_major() == specified.get_major() &&
                ver.get_minor() == specified.get_minor() &&
                ver.get_patch() == specified.get_patch() &&
                ver > specified)
            {
                // Pick the smallest prerelease that is greater than specified.
                most_compatible = (most_compatible == specified) ? ver : std::min(ver, most_compatible);
            }
        }
        pal::string_t most_compatible_str = most_compatible.as_str();
        append_path(&fx_dir, most_compatible_str.c_str());
    }

    trace::verbose(_X("Chose FX version [%s]"), fx_dir.c_str());
    return fx_dir;
}
Exemple #5
0
bool Animation::maybeStartAnimationOnCompositor()
{
    ASSERT(!hasActiveAnimationsOnCompositor());
    if (!isCandidateForAnimationOnCompositor())
        return false;
    if (!CompositorAnimations::instance()->canStartAnimationOnCompositor(*m_target.get()))
        return false;
    if (!CompositorAnimations::instance()->startAnimationOnCompositor(*m_target.get(), specified(), *effect(), m_compositorAnimationIds))
        return false;
    ASSERT(!m_compositorAnimationIds.isEmpty());
    return true;
}
Exemple #6
0
bool Animation::isCandidateForAnimationOnCompositor() const
{
    if (!effect() || !m_target)
        return false;
    return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor(specified(), *effect());
}
Exemple #7
0
// Compute the maximum (absolute) sin value of between vector srf.normal(uv(t))
// and vector this->TP(i)(t) for i=0,1,2,3, where perim[i] is 
// the same as srf.perimeter_curve(i), and t is a common parameter
// of deris[i] and TP(i).
double MGSBRepVecTP::get_perimeters_max_sin(
	const MGSurface& srf,
	double         taumax[4],
	double         sinmax[4],
	bool*          evalf	//indicates perimeters to evalate if evalf!=null
			//When evalf[i] is true, perimeter i is evaluated for 0<=i<=3.
)const{
	MGVector N(3), T(3);
	MGPosition uv(2);
	MGNDDArray tau;
	double max=0.;
	for(int i = 0; i < 4; i++){
		if(!specified(i) || (evalf && !evalf[i])){
			taumax[i] = (i % 2 == 0) ? srf.param_s_u() : srf.param_s_v();
			sinmax[i] = 0.;
			continue;
		}

		int id = i%2;
		switch(i){
		case 0:
			uv(1) = srf.param_s_v();
			tau.update_from_knot(srf.knot_vector_u());
			break;
		case 1:
			uv(0) = srf.param_e_u();
			tau.update_from_knot(srf.knot_vector_v());
			break;
		case 2:
			uv(1) = srf.param_e_v();
			tau.update_from_knot(srf.knot_vector_u());
			break;
		case 3:
			uv(0) = srf.param_s_u();
			tau.update_from_knot(srf.knot_vector_v());
			break;
		};
		//std::cout<<tau<<std::endl;
		double taus=tau[0];
		uv(id) = taus;

		double cmi=0.;
		double tmi = taus;
		if(eval(i,taus,T)){
			N = srf.normal(uv);
			cmi = fabs(N.sangle(T));
			tmi = uv(id);
		}

		int ntau=tau.length();
		for(int j = 1; j < ntau; j++){
			double tauj=tau[j];
			double tmid = (tau[j-1]+tauj)*.5;
			uv(id) = tmid;
			if(eval(i,tmid,T)){
				N = srf.normal(uv);
				double cm = fabs(N.sangle(T));
				if(cmi<cm){cmi = cm; tmi = tmid;}
			}

			uv(id) = tauj;
			if(eval(i,tauj,T)){
				N = srf.normal(uv);
				double cm = fabs(N.sangle(T));
				if(cmi<cm){	cmi = cm; tmi = tauj;}
			}
		}
		taumax[i] = tmi;
		sinmax[i] = cmi;
		if(max<cmi) max=cmi;
	}
	return max;
}
Exemple #8
0
	bool compatible(IrqConfiguration other) {
		assert(specified());
		return trigger == other.trigger
				&& polarity == other.polarity;
	}