本文整理汇总了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();
}
示例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));
}
}
示例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
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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() );
}
示例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;
}
示例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;
}
示例11:
void SegmentShape2D::SetDirection(Vector2 value)
{
if (value != Vector2::Zero)
value.Normalize();
if (GetDirection() != value)
{
direction = value;
revision = -1;
}
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}