• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetDirection函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: FSphere

FSphere USpotLightComponent::GetBoundingSphere() const
{
	float ClampedInnerConeAngle = FMath::Clamp(InnerConeAngle,0.0f,89.0f) * (float)PI / 180.0f;
	float ClampedOuterConeAngle = FMath::Clamp(OuterConeAngle * (float)PI / 180.0f,ClampedInnerConeAngle + 0.001f,89.0f * (float)PI / 180.0f + 0.001f);

	float CosOuterCone = FMath::Cos(ClampedOuterConeAngle);

	// Use the law of cosines to find the distance to the furthest edge of the spotlight cone from a position that is halfway down the spotlight direction
	const float BoundsRadius = FMath::Sqrt(1.25f * AttenuationRadius * AttenuationRadius - AttenuationRadius * AttenuationRadius * CosOuterCone);
	return FSphere(ComponentToWorld.GetLocation() + .5f * GetDirection() * AttenuationRadius, BoundsRadius);
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:11,代码来源:SpotLightComponent.cpp


示例17: FxIntTurnStart

func FxIntTurnStart(pTarget, effect, fTmp)
{
	if(fTmp) return;
	effect.dir = GetDirection();
	var iTurnPos = 0;
	if(effect.dir == COMD_Right) iTurnPos = 1;

	effect.curr_rot = 24;
	effect.rot = 25;
	effect.turn_type = -1;
	SetTurnType(0);
}
开发者ID:farad91,项目名称:openclonk,代码行数:12,代码来源:Script.c


示例18: GetDirectDistance

char M::SearchPathForAnt(Ant* ant, Bot* bot)
{			
	vector<Cell> closedCells, openCells, neighborCells;
	Cell start;	
	start.col = ant->location.col;
	start.row = ant->location.row;
	start.gScore = 0;
	start.hScore = GetDirectDistance(ant->location.row, ant->location.col, ant->destination.row, ant->destination.col);
	start.fScore = start.gScore + start.hScore;
	openCells.push_back(start);	
	while(!openCells.empty())
	{
		vector<Cell>::iterator cellIt = openCells.begin();
		for(auto it = openCells.begin(); it != openCells.end(); it++)
			if ((*it).fScore <= cellIt->fScore)
				cellIt = it;
		Cell *cell = new Cell((*cellIt).row, (*cellIt).col, (*cellIt).gScore,(*cellIt).hScore, 
							  (*cellIt).fScore, (*cellIt).parent);		
		if (SearchPathIsComplete(cell, ant) || cell->gScore > DIST_TO_TARGET)
		{
			Cell *currentCell = cell;	
			if(cell->gScore > DIST_TO_TARGET)
			{
				ant->destination.row = cell->row;
				ant->destination.col = cell->col;
			}
			if(currentCell->parent)
			while(currentCell->parent->parent != NULL)
			{
				currentCell = currentCell->parent;
			}				
			ant->direction = GetDirection(currentCell->row, currentCell->col, ant->location.row, ant->location.col);
			return ant->direction;			
		}
		closedCells.push_back(*cell);
		openCells.erase(cellIt);
		GetNeighborCells(cell, &neighborCells, bot->water);		
		for (auto it = neighborCells.begin(); it != neighborCells.end(); it++)
		{
			if (find(closedCells.begin(), closedCells.end(), *it) != closedCells.end())
				continue;
			int neighborGScore = cell->gScore + GetDistance(cell->row, cell->col, (*it).row, (*it).col);
			if(find(openCells.begin(), openCells.end(), *it) == openCells.end())
			{
				int gScore = neighborGScore;
				float hScore = (*it).hScore = 
					GetDirectDistance((*it).row, (*it).col, ant->destination.row, ant->destination.col);
				float fScore = neighborGScore + hScore;
				openCells.push_back(Cell((*it).row, (*it).col, gScore, hScore, fScore, cell));
			}	
		}		
	}
}
开发者ID:Katkevich,项目名称:Ants,代码行数:53,代码来源:Movement.cpp


示例19: XRC_MAKE_INSTANCE

wxObject * MaxBannerWindowXmlHandler::DoCreateResource()
{
    XRC_MAKE_INSTANCE(banner, MaxBannerWindow)

    banner->Create(m_parentAsWindow,
                   GetID(),
                   GetDirection(wxS("direction")),
                   GetPosition(),
                   GetSize(),
                   GetStyle(wxS("style")),
                   GetName());

	banner->MaxBind(CB_PREF(wx_wxbannerwindow_wxBannerWindow__xrcNew)(banner));

    SetupWindow(banner);

    const wxColour colStart = GetColour(wxS("gradient-start"));
    const wxColour colEnd = GetColour(wxS("gradient-end"));
    if ( colStart.IsOk() || colEnd.IsOk() )
    {
        if ( !colStart.IsOk() || !colEnd.IsOk() )
        {
            ReportError
            (
                "Both start and end gradient colours must be "
                "specified if either one is."
            );
        }
        else
        {
            banner->SetGradient(colStart, colEnd);
        }
    }

    wxBitmap bitmap = GetBitmap();
    if ( bitmap.IsOk() )
    {
        if ( colStart.IsOk() || colEnd.IsOk() )
        {
            ReportError
            (
                "Gradient colours are ignored by wxBannerWindow "
                "if the background bitmap is specified."
            );
        }

        banner->SetBitmap(bitmap);
    }

    banner->SetText(GetText(wxS("title")), GetText(wxS("message")));

    return banner;
}
开发者ID:maxmods,项目名称:wx.mod,代码行数:53,代码来源:glue.cpp


示例20: GetGlobalTimeMS

void ZActor::PostBasicInfo()
{
	DWORD nNowTime = GetGlobalTimeMS();
	if (GetInitialized() == false) return;

	if(IsDie() && ZGetGame()->GetTime() - GetDeadTime()>5.f) return;
	int nMoveTick = (ZGetGameClient()->GetAllowTunneling() == false) ? PEERMOVE_TICK : PEERMOVE_AGENT_TICK;

	if ((int)(nNowTime - m_nLastTime[ACTOR_LASTTIME_BASICINFO]) >= nMoveTick)
	{
		m_nLastTime[ACTOR_LASTTIME_BASICINFO] = nNowTime;

		ZACTOR_BASICINFO pbi;
		pbi.fTime = ZGetGame()->GetTime();
		pbi.uidNPC = GetUID();

		pbi.posx = m_Position.x;
		pbi.posy = m_Position.y;
		pbi.posz = m_Position.z;

		pbi.velx = GetVelocity().x;
		pbi.vely = GetVelocity().y;
		pbi.velz = GetVelocity().z;

		pbi.dirx = GetDirection().x*32000.0f;
		pbi.diry = GetDirection().y*32000.0f;
		pbi.dirz = GetDirection().z*32000.0f;

		pbi.anistate = GetCurrAni();

		ZPOSTCMD1(MC_QUEST_PEER_NPC_BASICINFO, MCommandParameterBlob(&pbi,sizeof(ZACTOR_BASICINFO)));

		ZBasicInfoItem Item;
		Item.info.position = m_Position;
		Item.info.direction = GetDirection();
		Item.info.velocity = GetVelocity();
		Item.fSendTime = Item.fReceivedTime = ZGetGame()->GetTime();
		AddToHistory(Item);
	}
}
开发者ID:Asunaya,项目名称:RefinedGunz,代码行数:40,代码来源:ZActor.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetDiskFreeSpace函数代码示例发布时间:2022-05-30
下一篇:
C++ GetDim函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap