本文整理汇总了C++中Frame::GetNonRotFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ Frame::GetNonRotFrame方法的具体用法?C++ Frame::GetNonRotFrame怎么用?C++ Frame::GetNonRotFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Frame
的用法示例。
在下文中一共展示了Frame::GetNonRotFrame方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PutBody
void SystemView::PutBody(const SystemBody *b, const vector3d &offset, const matrix4x4f &trans)
{
if (b->type == SystemBody::TYPE_STARPORT_SURFACE) return;
if (b->type != SystemBody::TYPE_GRAVPOINT) {
if (!m_bodyIcon) {
m_bodyIcon.reset(new Graphics::Drawables::Disk(m_renderer, Color::WHITE, 1.0f));
}
const double radius = b->GetRadius() * m_zoom;
matrix4x4f invRot = trans;
invRot.ClearToRotOnly();
invRot = invRot.InverseOf();
matrix4x4f bodyTrans = trans;
bodyTrans.Translate(vector3f(offset));
bodyTrans.Scale(radius);
m_renderer->SetTransform(bodyTrans * invRot);
m_bodyIcon->Draw(m_renderer);
m_renderer->SetTransform(trans);
PutLabel(b, offset);
}
Frame *frame = Pi::player->GetFrame();
if(frame->IsRotFrame()) frame = frame->GetNonRotFrame();
if(frame->GetSystemBody() == b && frame->GetSystemBody()->GetMass() > 0) {
const double t0 = Pi::game->GetTime();
Orbit playerOrbit = Pi::player->ComputeOrbit();
PutOrbit(&playerOrbit, offset, Color::RED, b->GetRadius());
PutSelectionBox(offset + playerOrbit.OrbitalPosAtTime(m_time - t0)* double(m_zoom), Color::RED);
}
if (b->children.size()) {
for(std::vector<SystemBody*>::const_iterator kid = b->children.begin(); kid != b->children.end(); ++kid) {
if (is_zero_general((*kid)->orbit.GetSemiMajorAxis())) continue;
if ((*kid)->orbit.GetSemiMajorAxis() * m_zoom < ROUGH_SIZE_OF_TURD) {
PutOrbit(&((*kid)->orbit), offset, Color(0, 255, 0, 255));
}
// not using current time yet
vector3d pos = (*kid)->orbit.OrbitalPosAtTime(m_time);
pos *= double(m_zoom);
PutBody(*kid, offset + pos, trans);
}
}
}
示例2: ResetStartTime
void TransferPlanner::ResetStartTime() {
m_startTime = 0;
Frame *frame = Pi::player->GetFrame();
if(!frame || GetOffsetVel().ExactlyEqual(vector3d(0., 0. , 0.)))
{
m_position = vector3d(0., 0., 0.);
m_velocity = vector3d(0. , 0., 0.);
}
else
{
frame = frame->GetNonRotFrame();
m_position = Pi::player->GetPositionRelTo(frame);
m_velocity = Pi::player->GetVelocityRelTo(frame);
}
}
示例3: PutBody
void SystemView::PutBody(const SystemBody *b, const vector3d &offset, const matrix4x4f &trans)
{
if (b->GetType() == SystemBody::TYPE_STARPORT_SURFACE)
return;
if (b->GetType() != SystemBody::TYPE_GRAVPOINT)
{
if (!m_bodyIcon)
{
Graphics::RenderStateDesc rsd;
auto solidState = m_renderer->CreateRenderState(rsd);
m_bodyIcon.reset(new Graphics::Drawables::Disk(m_renderer, solidState, Color::WHITE, 1.0f));
}
const double radius = b->GetRadius() * m_zoom;
matrix4x4f invRot = trans;
invRot.ClearToRotOnly();
invRot = invRot.Inverse();
matrix4x4f bodyTrans = trans;
bodyTrans.Translate(vector3f(offset));
bodyTrans.Scale(radius);
m_renderer->SetTransform(bodyTrans * invRot);
m_bodyIcon->Draw(m_renderer);
m_renderer->SetTransform(trans);
PutLabel(b, offset);
}
Frame *frame = Pi::player->GetFrame();
if(frame->IsRotFrame())
frame = frame->GetNonRotFrame();
// display the players orbit(?)
if(frame->GetSystemBody() == b && frame->GetSystemBody()->GetMass() > 0)
{
const double t0 = m_game->GetTime();
Orbit playerOrbit = Pi::player->ComputeOrbit();
PutOrbit(&playerOrbit, offset, Color::RED, b->GetRadius());
const double plannerStartTime = m_planner->GetStartTime();
if(!m_planner->GetPosition().ExactlyEqual(vector3d(0,0,0)))
{
Orbit plannedOrbit = Orbit::FromBodyState(m_planner->GetPosition(),
m_planner->GetVel(),
frame->GetSystemBody()->GetMass());
PutOrbit(&plannedOrbit, offset, Color::STEELBLUE, b->GetRadius());
if(std::fabs(m_time - t0) > 1. && (m_time - plannerStartTime) > 0.)
PutSelectionBox(offset + plannedOrbit.OrbitalPosAtTime(m_time - plannerStartTime) * static_cast<double>(m_zoom), Color::STEELBLUE);
else
PutSelectionBox(offset + m_planner->GetPosition() * static_cast<double>(m_zoom), Color::STEELBLUE);
}
PutSelectionBox(offset + playerOrbit.OrbitalPosAtTime(m_time - t0)* double(m_zoom), Color::RED);
}
// display all child bodies and their orbits
if (b->HasChildren())
{
for(const SystemBody* kid : b->GetChildren())
{
if (is_zero_general(kid->GetOrbit().GetSemiMajorAxis()))
continue;
const double axisZoom = kid->GetOrbit().GetSemiMajorAxis() * m_zoom;
if (axisZoom < DEFAULT_VIEW_DISTANCE)
{
const SystemBody::BodySuperType bst = kid->GetSuperType();
const bool showLagrange = (bst == SystemBody::SUPERTYPE_ROCKY_PLANET || bst == SystemBody::SUPERTYPE_GAS_GIANT);
PutOrbit(&(kid->GetOrbit()), offset, Color::GREEN, 0.0, showLagrange);
}
// not using current time yet
const vector3d pos = kid->GetOrbit().OrbitalPosAtTime(m_time) * double(m_zoom);
PutBody(kid, offset + pos, trans);
}
}
}