コード例 #1
0
ファイル: Aimbot.cpp プロジェクト: blaquee/QLBot
pair<bool, idVec3> Aimbot::Predict( const IAimable * ent )
{
	double t = 0.0;
	idVec3 entAcc = !ent->IsOnGround() ? ent->Acceleration() : idVec3(0, 0, 0);
	float bulletSpeed = ImportExport::User->Weapon().BulletSpeed();
	if ( bulletSpeed > 0.0f )
	{
		idVec3 entVel = ent->Velocity();
		if(ent->IsOnGround())
		{
			entVel.x *= 0.825f;
			entVel.y *= 0.825f;
		}
		double times[4];
		SolveForTime( bulletSpeed, entAcc, entVel, ent->Origin(), _Muzzle, times );

		bool hasTime = false;
		double bestTime;
		for(unsigned i = 0; i < 4; ++i)
			if(times[i] > 0.0 && (!hasTime || bestTime > times[i]))
			{
				hasTime = true;
				bestTime = times[i];
			}

		if ( hasTime )
			t = bestTime;
		else
			return pair<bool, idVec3>(false, idVec3(0, 0, 0));
	}
	else
		entAcc /= 10.0f;
	return pair<bool, idVec3>(true,
		ent->TraceTo( ent->Origin() + EvaluatePath( entAcc, ent->Velocity(), static_cast<float> ( t + (Ping - (ImportExport::User->Weapon().BulletSpeed() > 0.0f ? 50.0 : 0.0f)) / 1000.0 ) ) ) - ent->Origin());
}
glm::vec3 BidirectionalIntegrator::TraceRay(Ray r, unsigned int depth)
{
    Intersection isx = intersection_engine->GetIntersection(r);
    if(isx.t < 0)
        return glm::vec3(0);
    else if(isx.object_hit->material->is_light_source)
    {
        return isx.object_hit->material->base_color * isx.texture_color;
    }

    glm::vec3 resultColor(0);

    for(Geometry* light : scene->lights)
    {
        std::vector<PathNode> eyePath = generateEyePath(r);
        std::vector<PathNode> lightPath = generateLightPath(light);

        if(!eyePath.empty() && !lightPath.empty())
        {
            PathNode* node = &lightPath[0];
            float lightPdf = light->RayPDF(node->isx,Ray(node->isx.point,node->dirIn_world));
            glm::vec3 Le(0);
            if(lightPdf != 0)
                Le = light->material->base_color * light->material->intensity / lightPdf;

            glm::vec3 directWt(1.0f);
            for(int i=1;i<=eyePath.size();i++)
            {
                node = &eyePath[i-1];

                Ray ray(light->transform.position(), - node->dirIn_world);
                resultColor += directWt * EstimateDirectLight(node->isx, ray, light) / WeightPath(i,0);
                directWt *= node->F * glm::abs(glm::dot(node->dirOut_world,node->isx.normal)) / node->pdf;

                for(int j=1;j<=lightPath.size();j++)
                {
                    resultColor += Le * EvaluatePath(eyePath,i,lightPath,j) / WeightPath(i,j);
                }
            }
        }
        else
        {
            continue;
        }

    }
    return resultColor;
}
コード例 #3
0
ファイル: volpath.cpp プロジェクト: BlueBrain/pbrt
Spectrum VolumePatIntegrator::Li_Multiple(const Scene *scene, const Renderer *renderer,
        const RayDifferential &r, const Sample *sample, RNG &rng,
        Spectrum *T, MemoryArena &arena) const {

    // Do eye and light random walks
    VolumeVertexList eyeVertexList;
    EyeRandomWalk(scene, r, eyeVertexList, rng);

    // Do multiple scattering
    Spectrum Li(0.f);
    for (uint64_t i = 0; i < eyeVertexList.size(); i++) {
        Li += EvaluatePath(scene, eyeVertexList, i, rng, renderer, arena);
    }

    return Li;
}
コード例 #4
0
ファイル: z_factory_controller.cpp プロジェクト: ziposoft/ac1
z_status z_factory_controller::select_obj_from_path(z_string& path)
{
	
	zf_obj selected=_selected;
	z_fact_obj_path obj_path;
	z_string feature;
	z_string feature_index;
	z_status status=EvaluatePath(path,selected,obj_path,feature,feature_index);
	if(status==zs_ok)
	{
		_selected=selected;
		_obj_path=obj_path;
	

	}
	return status;
}
コード例 #5
0
void AnyAngleAlgorithm::ReportStatistics(const std::vector<xyLocCont> &path, AnyAngleStatistics* stats, const bool validate_path)
{
    elapsed_time_ += timer_.EndTimer(); // Time passed since StartStatistics is called

    // Validate the path; does not increment line-of-sight checks.
    cost c = EvaluatePath(path, validate_path);

    // Report a failed search.
    if (!(c < INFINITE_COST)) {
        printf("Failed search from (%d, %d) to (%d, %d)\n", from_.x, from_.y, to_.x, to_.y);
    }

    // Report search statistics.
    stats->AddSearchData(elapsed_time_, c, num_expansions_, num_generated_, num_percolations_, num_los_checks_,
            num_heading_changes_, num_freespace_heading_changes_, num_taut_corner_heading_changes_, num_non_taut_corner_heading_changes_);

    timer_.StartTimer();    // Start the timer again in case we also want to report smoothing statistics.
}
コード例 #6
0
ファイル: Aimbot.cpp プロジェクト: blaquee/QLBot
idAngles Aimbot::Main( float fov, float ping, bool humanize, float smoothMultiplier, float smoothTransposition )
{
#define FRAME_TIME_SECONDS 0.008f
		Ping = ping;
	FOV = fov;
	_Muzzle = ImportExport::User->EyePosition() + ImportExport::User->ViewAngles().ToMat3()[0]*14.0f + EvaluatePath(idVec3(0,0,0), 
		ImportExport::User->Velocity(), FRAME_TIME_SECONDS);
	if ( ScanForTarget() )
	{
		idAngles angles = AimAt( TargetOrigin() );
		return humanize ? Humanize( smoothMultiplier, smoothTransposition, angles ) : angles;
	}
	return idAngles(0, 0, 0);
}