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


C++ GetDirection函数代码示例

本文整理汇总了C++中GetDirection函数的典型用法代码示例。如果您正苦于以下问题:C++ GetDirection函数的具体用法?C++ GetDirection怎么用?C++ GetDirection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: GetDirection

void CFPSCameraController::UpdateCameraValues(CCamera *Camera) const
{
	Vect3f l_Direction = GetDirection();
	Camera->SetPosition(m_Position);
	Camera->SetLookAt(m_Position + l_Direction);
	Camera->SetUp(GetUp());
	Camera->SetMatrixs();
}
开发者ID:rcrmn,项目名称:mastervj-basic-engine,代码行数:8,代码来源:FPSCameraController.cpp

示例2: a

void Epsilon5Tests::GetDirectionTests() {
    {
        QPointF a(0, 0);
        QPointF b(1, 0);
        QCOMPARE(GetDirection(a, b), QPointF(1, 0));
    }
    {
        QPointF a(2, 1);
        QPointF b(1, 1);
        QCOMPARE(GetDirection(a, b), QPointF(-1, 0));
    }
    {
        QPointF a(-2, 0);
        QPointF b(-3, 0);
        QCOMPARE(GetDirection(a, b), QPointF(-1, 0));
    }
}
开发者ID:bakwc,项目名称:Epsilon5,代码行数:17,代码来源:epsilon5tests.cpp

示例3: PunkException

	const Math::vec3 Source::GetDirection() const
	{
	    #ifdef HAS_AUDIO_SOURCE
		return impl->GetDirection();
		#else
		throw System::PunkException(L"Audio source is not available");
		#endif
	}
开发者ID:Mikalai,项目名称:punk_project_a,代码行数:8,代码来源:audio_source.cpp

示例4: GetDirection

bool
GfRay::Intersect(const GfRange3d &box,
		 double *enterDistance, double *exitDistance) const
{
    if (box.IsEmpty())
	return false;

    // Compute the intersection distance of all 6 planes of the
    // box. Save the largest near-plane intersection and the smallest
    // far-plane intersection.
    double maxNearest = -DBL_MAX, minFarthest = DBL_MAX;
    for (size_t i = 0; i < 3; i++) {

        // Skip dimensions almost parallel to the ray.
        double d = GetDirection()[i];
        if (GfAbs(d) < GF_MIN_VECTOR_LENGTH) {
            // ray is parallel to this set of planes.
            // If origin is not between them, no intersection.
            if (GetStartPoint()[i] < box.GetMin()[i] ||
                GetStartPoint()[i] > box.GetMax()[i]) {
                return false;
            } else {
                continue;
            }
        }

        d = 1.0 / d;
        double t1 = d * (box.GetMin()[i] - GetStartPoint()[i]);
        double t2 = d * (box.GetMax()[i] - GetStartPoint()[i]);

        // Make sure t1 is the nearer one
        if (t1 > t2) {
            double tmp = t1;
            t1 = t2;
            t2 = tmp;
        }

        // Update the min and max
        if (t1 > maxNearest)
            maxNearest = t1;
        if (t2 < minFarthest)
            minFarthest = t2;
    }

    // If the largest near-plane intersection is after the smallest
    // far-plane intersection, the ray's line misses the box. Also
    // check if both intersections are completely outside the near/far
    // bounds.
    if (maxNearest  >  minFarthest ||
        minFarthest < 0.0)
        return false;
        
    if (enterDistance)
	*enterDistance = maxNearest;
    if (exitDistance)
        *exitDistance = minFarthest;
    return true;
}
开发者ID:JT-a,项目名称:USD,代码行数:58,代码来源:ray.cpp

示例5: GetDirection

bool Game_Player::CheckEventTriggerThere(const std::vector<int>& triggers, bool triggered_by_decision_key) {
	if ( Game_Map::GetInterpreter().IsRunning() ) return false;

	bool result = false;

	int front_x = Game_Map::XwithDirection(GetX(), GetDirection());
	int front_y = Game_Map::YwithDirection(GetY(), GetDirection());

	std::vector<Game_Event*> events;
	Game_Map::GetEventsXY(events, front_x, front_y);

	for (const auto& ev : events) {
		if ( ev->GetLayer() == RPG::EventPage::Layers_same &&
			std::find(triggers.begin(), triggers.end(), ev->GetTrigger() ) != triggers.end()
		)
		{
			if (!ev->GetList().empty()) {
				ev->StartTalkToHero();
			}
			ev->Start(triggered_by_decision_key);
			result = true;
		}
	}

	if ( !result && Game_Map::IsCounter(front_x, front_y) ) {
		front_x = Game_Map::XwithDirection(front_x, GetDirection());
		front_y = Game_Map::YwithDirection(front_y, GetDirection());

		Game_Map::GetEventsXY(events, front_x, front_y);

		for (const auto& ev : events) {
			if ( ev->GetLayer() == 1 &&
				std::find(triggers.begin(), triggers.end(), ev->GetTrigger() ) != triggers.end()
			)
			{
				if (!ev->GetList().empty()) {
					ev->StartTalkToHero();
				}
				ev->Start(triggered_by_decision_key);
				result = true;
			}
		}
	}
	return result;
}
开发者ID:rohkea,项目名称:Player,代码行数:45,代码来源:game_player.cpp

示例6: debug

//=============================================================================
// GetDirection - need the startPoint
//=============================================================================
StatusCode HTBlob::GetDirection( Minerva::IDBlob *idBlob ) const
{
    debug() << " HTtool::GetDirection " << endmsg;

    Gaudi::XYZPoint vertex = idBlob->startPoint();
    GetDirection( idBlob, vertex );
    return StatusCode::SUCCESS;

}
开发者ID:oaltinok,项目名称:Minerva_Neutrino,代码行数:12,代码来源:HTBlob.cpp

示例7: GetDirection

void UNIT::MoveUnit(INTPOINT to)
{
	m_lastWP = m_pTerrain->GetWorldPos(m_mappos);
	m_rotation = GetDirection(m_mappos, to);

	m_mappos = to;		//New mappos
	m_movePrc = 0.0f;
	m_nextWP = m_pTerrain->GetWorldPos(m_mappos);
}
开发者ID:Alriightyman,项目名称:RTS,代码行数:9,代码来源:unit.cpp

示例8: GetDirection

void clSpaceShip::Fire()
{
	if ( m_FireTime > 0.0f ) { return; }

	const float FireCooldown = 1.0f; // seconds

	m_FireTime = FireCooldown;

	g_Game->FireRocket( m_Pos, m_Vel * Math::RandomInRange( 1.1f, 1.5f ) + GetDirection() );
}
开发者ID:adarash,项目名称:Mastering-Android-NDK,代码行数:10,代码来源:Actors.cpp

示例9: ResGetKeyVal

static int ResGetKeyVal(int num, USHORT id)
{
    int val;
    char *res = lib_msprintf("KeySet%d%s", num ? 1 : 2, GetDirection(id));

    resources_get_int(res, &val);
    lib_free (res);

    return val;
}
开发者ID:AreaScout,项目名称:vice,代码行数:10,代码来源:dlg-joystick.c

示例10: GetDirection

bool Game_Player::GetOffVehicle() {
	if (!InAirship()) {
		int front_x = Game_Map::XwithDirection(GetX(), GetDirection());
		int front_y = Game_Map::YwithDirection(GetY(), GetDirection());
		if (!CanWalk(front_x, front_y))
			return false;
	}

	GetVehicle()->GetOff();
	if (!InAirship()) {
		location.unboarding = true;
		Unboard();
		through = true;
		MoveForward();
		through = false;
	}

	return true;
}
开发者ID:Uladox,项目名称:Player,代码行数:19,代码来源:game_player.cpp

示例11:

    void SegmentShape2D::SetDirection(Vector2 value)
    {
        if (value != Vector2::Zero)
            value.Normalize();

        if (GetDirection() != value)
        {
            direction = value;
            revision = -1;
        }
    }
开发者ID:Darkttd,项目名称:Bibim,代码行数:11,代码来源:SegmentShape2D.cpp

示例12: SetSpriteName

void Game_Event::Setup(RPG::EventPage* new_page) {
	page = new_page;

	// Free resources if needed
	if (interpreter) {
		interpreter->Clear();
		Game_Map::ReserveInterpreterDeletion(interpreter);
		interpreter.reset();
	}

	if (page == NULL) {
		tile_id = 0;
		SetSpriteName("");
		SetSpriteIndex(0);
		SetDirection(RPG::EventPage::Direction_down);
		//move_type = 0;
		trigger = -1;
		list.clear();
		return;
	}
	SetSpriteName(page->character_name);
	SetSpriteIndex(page->character_index);

	tile_id = page->character_name.empty() ? page->character_index : 0;

	if (GetDirection() != page->character_direction) {
		SetDirection(page->character_direction);
		SetSpriteDirection(page->character_direction);
	}

	if (original_pattern != page->character_pattern) {
		pattern = page->character_pattern;
		original_pattern = pattern;
	}
	
	move_type = page->move_type;
	SetMoveSpeed(page->move_speed);
	SetMoveFrequency(page->move_frequency);
	max_stop_count = (GetMoveFrequency() > 7) ? 0 : pow(2.0, 8 - GetMoveFrequency());
	original_move_frequency = page->move_frequency;
	original_move_route = page->move_route;
	SetOriginalMoveRouteIndex(0);
	animation_type = page->animation_type;
	SetOpacity(page->translucent ? 160 : 255);

	SetLayer(page->layer);
	trigger = page->trigger;
	list = page->event_commands;

	if (trigger == RPG::EventPage::Trigger_parallel) {
		interpreter.reset(new Game_Interpreter_Map());
	}
	CheckEventTriggerAuto();
}
开发者ID:Uladox,项目名称:Player,代码行数:54,代码来源:game_event.cpp

示例13: GetDirection

void CSphericalCameraController::SetCamera(CCamera *Camera) const
{
	Vect3f l_Direction = GetDirection();

	Camera->SetLookAt(m_Position);

	Camera->SetPosition(m_Position-l_Direction);

	Camera->SetUp(GetUp());
	Camera->SetMatrixs();
}
开发者ID:JContrerasPereira,项目名称:MasterUAB,代码行数:11,代码来源:SphericalCameraController.cpp

示例14: GetPosition

bool ZActor::CanSee(ZObject* pTarget)
{
	rvector vTargetDir = pTarget->GetPosition() - GetPosition();
	rvector vBodyDir = GetDirection();
	vBodyDir.z = vTargetDir.z = 0.0f;

	float angle = fabs(GetAngleOfVectors(vTargetDir, vBodyDir));
	if (angle <= m_pNPCInfo->fViewAngle) return true;

	return false;
}
开发者ID:Asunaya,项目名称:RefinedGunz,代码行数:11,代码来源:ZActor.cpp

示例15: TurnEngineOff

bool CCar::TurnEngineOff()
{
	bool isOnNeutralGear = (m_gear == CCar::Gear::Neutral);
	bool isOnZeroSpeed = (GetDirection() == CCar::Direction::StandStill);
	if (m_isEngineOn && isOnNeutralGear && isOnZeroSpeed)
	{
		m_isEngineOn = false;
		return true;
	}
	return false;
}
开发者ID:dervesp,项目名称:cpp_lab_3,代码行数:11,代码来源:car.cpp


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