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

C++ Viewpoint类代码示例

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

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



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

示例1: IsVisible

/*
 * Returns true if the given point is visible from the given viewpoint.
 *
 * A point is visible if it will be on screen, and if it is not occluded by
 * other objects.
 *
 * Input:
 *   point: The point whose visibility we want to check.
 *   viewpoint: The viewpoint to check from.
 *
 * Returns: True if the point is visible from the viewpoint.
 */
bool VisibilityChecker::IsVisible(const Ogre::Vector3& point,
                                  const Viewpoint& viewpoint) {
  float screen_x;
  float screen_y;
  auto old_position = camera_->getPosition();
  auto old_direction = camera_->getDirection();
  camera_->setPosition(viewpoint.position());
  camera_->lookAt(viewpoint.focus());
  GetScreenPosition(point, &screen_x, &screen_y);
  bool result = false;
  if (IsOnScreen(screen_x, screen_y)) {
    Ogre::Ray ray;
    camera_->getCameraToViewportRay(screen_x, screen_y, &ray);
    Ogre::Vector3 hit;
    if (RaycastAABB(ray, &hit)) {
      auto dist = point.distance(hit);
      if (dist < kOcclusionThreshold) {
        result = true;
      } else { // Hit something, but too far away from the target.
        result = false;
      }
    } else {
      // No hits. The ray should hit the target, but if it doesn't, that usually
      // indicates visibility. This is because if the target is occluded, the
      // ray is likely to have hit the occluding object.
      result = true;
    }
  } else { // Not on screen
    result= false;
  }
  camera_->setPosition(old_position);
  camera_->setDirection(old_direction);
  return result;
}
开发者ID:jstnhuang,项目名称:autocp,代码行数:46,代码来源:visibility.cpp


示例2: setScale

void RGLView::setScale(double* src)
{
    Viewpoint* viewpoint = scene->getViewpoint();

    viewpoint->setScale(src);

    View::update();
}
开发者ID:jefferis,项目名称:rgl,代码行数:8,代码来源:rglview.cpp


示例3: setUserMatrix

void RGLView::setUserMatrix(double* src)
{
    Viewpoint* viewpoint = scene->getViewpoint();

    viewpoint->setUserMatrix(src);

    View::update();
}
开发者ID:jefferis,项目名称:rgl,代码行数:8,代码来源:rglview.cpp


示例4: polarBegin

void RGLView::polarBegin(int mouseX, int mouseY)
{
    Viewpoint* viewpoint = scene->getViewpoint();

    camBase = viewpoint->getPosition();

    dragBase = screenToPolar(width,height,mouseX,height-mouseY);

}
开发者ID:jefferis,项目名称:rgl,代码行数:9,代码来源:rglview.cpp


示例5: find_map_rect

SDL_Rect find_map_rect(Idevice& input, Viewpoint& camera)
{
    SDL_Rect tilerect;
    int tilex, tiley;
    tilex = (input.get_x() + camera.get_x()) / TILEW;
    tiley = (input.get_y() + camera.get_y()) / TILEH;
    tilerect.x = tilex * TILEW; tilerect.y = tiley * TILEH;
    tilerect.w = TILEW; tilerect.h = TILEH;
    return tilerect;
}
开发者ID:calebsmith,项目名称:Dungeon-Epic,代码行数:10,代码来源:logic.cpp


示例6: buttonPress

void RGLView::buttonPress(int button, int mouseX, int mouseY)
{
    Viewpoint* viewpoint = scene->getViewpoint();
    if ( viewpoint->isInteractive() ) {
        if (!drag) {
            drag = button;
            windowImpl->captureMouse(this);
            (this->*ButtonBeginFunc[button-1])(mouseX,mouseY);
        }
    }
}
开发者ID:jefferis,项目名称:rgl,代码行数:11,代码来源:rglview.cpp


示例7: oneAxisUpdate

void RGLView::oneAxisUpdate(int mouseX, int mouseY)
{
	Viewpoint* viewpoint = scene->getViewpoint();

  	rotCurrent = screenToVector(width,height,mouseX,height/2);

	windowImpl->beginGL();
	viewpoint->mouseOneAxis(rotBase,rotCurrent,axis[drag-1]);
	windowImpl->endGL();

	View::update();
}
开发者ID:jefferis,项目名称:rgl,代码行数:12,代码来源:rglview.cpp


示例8: trackballUpdate

void RGLView::trackballUpdate(int mouseX, int mouseY)
{
	Viewpoint* viewpoint = scene->getViewpoint();

  	rotCurrent = screenToVector(width,height,mouseX,height-mouseY);

	windowImpl->beginGL();
	viewpoint->updateMouseMatrix(rotBase,rotCurrent);
	windowImpl->endGL();

	View::update();
}
开发者ID:jefferis,项目名称:rgl,代码行数:12,代码来源:rglview.cpp


示例9: getValue

void
KML_Feature::build( xml_node<>* node, KMLContext& cx, osg::Node* working )
{
    KML_Object::build(node, cx, working);

    // subclass feature is built; now add feature level data if available
    if ( working )
    {
        // parse the visibility to show/hide the item by default:
		std::string visibility = getValue(node, "visibility");
        if ( !visibility.empty() )
            working->setNodeMask( as<int>(visibility, 1) == 1 ? ~0 : 0 );

        // parse a "LookAt" element (stores a viewpoint)
        AnnotationData* anno = getOrCreateAnnotationData(working);
        
        anno->setName( getValue(node, "name") );
        anno->setDescription( getValue(node, "description") );

        xml_node<>* lookat = node->first_node("lookat", 0, false);
        if ( lookat )
        {
            Viewpoint vp;

            vp.focalPoint() = GeoPoint(
                cx._srs.get(),
				as<double>(getValue(lookat, "longitude"), 0.0),
				as<double>(getValue(lookat, "latitude"), 0.0),
				as<double>(getValue(lookat, "altitude"), 0.0),
                ALTMODE_ABSOLUTE );

            vp.heading() =  as<double>(getValue(lookat, "heading"), 0.0);
            vp.pitch()   = -as<double>(getValue(lookat, "tilt"), 45.0),
            vp.range()   =  as<double>(getValue(lookat, "range"), 10000.0);

            anno->setViewpoint( vp );
        }

        xml_node<>* extdata = node->first_node("extendeddata", 0, false);
        if ( extdata )
        {
            xml_node<>* data = extdata->first_node("data", 0, false);
            if ( data )
            {
			    for (xml_node<>* n = data->first_node(); n; n = n->next_sibling())
			    {
    				working->setUserValue(getValue(n, "name"), getValue(n, "value"));
			    }
            }
        }
    }
}
开发者ID:Brucezhou1979,项目名称:osgearth,代码行数:52,代码来源:KML_Feature.cpp


示例10: polarUpdate

void RGLView::polarUpdate(int mouseX, int mouseY)
{
    Viewpoint* viewpoint = scene->getViewpoint();

    dragCurrent = screenToPolar(width,height,mouseX,height-mouseY);

    PolarCoord newpos = camBase - ( dragCurrent - dragBase );

    newpos.phi = clamp( newpos.phi, -90.0f, 90.0f );

    viewpoint->setPosition( newpos );
    View::update();
}
开发者ID:jefferis,项目名称:rgl,代码行数:13,代码来源:rglview.cpp


示例11: adjustZoomUpdate

void RGLView::adjustZoomUpdate(int mouseX, int mouseY)
{
    Viewpoint* viewpoint = scene->getViewpoint();

    int dy = mouseY - zoomBaseY;

    float zoom = clamp ( viewpoint->getZoom() * exp(-dy*ZOOM_PIXELLOGSTEP), ZOOM_MIN, ZOOM_MAX);
    viewpoint->setZoom(zoom);

    View::update();

    zoomBaseY = mouseY;
}
开发者ID:jefferis,项目名称:rgl,代码行数:13,代码来源:rglview.cpp


示例12: adjustFOVUpdate

void RGLView::adjustFOVUpdate(int mouseX, int mouseY)
{
    Viewpoint* viewpoint = scene->getViewpoint();

    int dy = mouseY - fovBaseY;

    float py = ((float)dy/(float)height) * 180.0f;

    viewpoint->setFOV( viewpoint->getFOV() + py );

    View::update();

    fovBaseY = mouseY;
}
开发者ID:jefferis,项目名称:rgl,代码行数:14,代码来源:rglview.cpp


示例13: vp0

void ViewpointProvider::flyTo()
{
	if ( m_refManipulator == NULL )
	{
		return;
	}

	Viewpoint currentVP = m_refManipulator->getViewpoint();
	osgEarth::GeoPoint vp0( currentVP.getSRS(), currentVP.getFocalPoint(), osgEarth::ALTMODE_ABSOLUTE );
	osgEarth::GeoPoint vp1( this->getSRS(), this->getFocalPoint(), osgEarth::ALTMODE_ABSOLUTE );
	double distance = vp0.distanceTo( vp1 );
	double duration = osg::clampBetween( distance / VP_METERS_PER_SECOND, VP_MIN_DURATION, VP_MAX_DURATION );
	m_refManipulator->setViewpoint( *this, duration );
}
开发者ID:dlsyaim,项目名称:osgEarthX,代码行数:14,代码来源:ViewpointProvider.cpp


示例14: rgl_getFOV

void rgl_getFOV(int* successptr, double* fov)
{
  int success = RGL_FAIL;
  Device* device = deviceManager->getAnyDevice();

  if ( device ) {
    RGLView* rglview = device->getRGLView();
    Scene* scene = rglview->getScene();
    Viewpoint* viewpoint = scene->getViewpoint();
    *fov = viewpoint->getFOV();
    success = RGL_SUCCESS;
  }
  *successptr = success;
}
开发者ID:jefferis,项目名称:rgl,代码行数:14,代码来源:api.cpp


示例15: rgl_getZoom

void rgl_getZoom(int* successptr, double* zoom)
{
  int success = RGL_FAIL;
  Device* device;

  if (deviceManager && (device = deviceManager->getAnyDevice())) {

    RGLView* rglview = device->getRGLView();
    Scene* scene = rglview->getScene();
    Viewpoint* viewpoint = scene->getViewpoint();
    *zoom = viewpoint->getZoom();
    success = RGL_SUCCESS;
  }
  *successptr = success;
}
开发者ID:jefferis,项目名称:rgl,代码行数:15,代码来源:api.cpp


示例16: rgl_setZoom

void rgl_setZoom(int* successptr, double* zoom)
{
  int success = RGL_FAIL;
  Device* device = deviceManager->getAnyDevice();

  if ( device ) {
    RGLView* rglview = device->getRGLView();
    Scene* scene = rglview->getScene();
    Viewpoint* viewpoint = scene->getViewpoint();
    viewpoint->setZoom((*zoom - 1.0f)/((float)(VIEWPOINT_MAX_ZOOM-1)));
    rglview->update();
    success = RGL_SUCCESS;
  }
  *successptr = success;
}
开发者ID:jefferis,项目名称:rgl,代码行数:15,代码来源:api.cpp


示例17: Render

void Mesh::Render(const Viewpoint &viewpoint) {
  static float m[16];
  glPushMatrix();
  viewpoint.FillTransformationMatrix(m);
  glMultMatrixf(m);
  Render();
  glPopMatrix();
}
开发者ID:zorbathut,项目名称:glop,代码行数:8,代码来源:Mesh.cpp


示例18: rgl_setFOV

void rgl_setFOV(int* successptr, double* fov)
{
  int success = RGL_FAIL;
  Device* device;

  if (deviceManager && (device = deviceManager->getAnyDevice())) {

    RGLView* rglview = device->getRGLView();
    Scene* scene = rglview->getScene();
    Viewpoint* viewpoint = scene->getViewpoint();
    viewpoint->setFOV(*fov);
    rglview->update();
    success = RGL_SUCCESS;
  }
  CHECKGLERROR;
  *successptr = success;
}
开发者ID:jefferis,项目名称:rgl,代码行数:17,代码来源:api.cpp


示例19: newCam

/*!
  \brief Zooms the current \l Esri::ArcGISRuntime::GeoView to the current input position.
 */
void CoordinateConversionController::zoomTo()
{
  if (m_sceneView)
  {
    const Camera currentCam = m_sceneView->currentViewpointCamera();
    constexpr double targetDistance = 1500.0;
    const Camera newCam(m_pointToConvert, targetDistance, currentCam.heading(), currentCam.pitch(), currentCam.roll());

    m_sceneView->setViewpointCamera(newCam, 1.0);
  }
  else if (m_mapView)
  {
    const Viewpoint currVP = m_mapView->currentViewpoint(ViewpointType::CenterAndScale);
    const Viewpoint newViewPoint(m_pointToConvert, currVP.targetScale());

    m_mapView->setViewpoint(newViewPoint, 1.0);
  }
}
开发者ID:Esri,项目名称:arcgis-runtime-toolkit-qt,代码行数:21,代码来源:CoordinateConversionController.cpp


示例20: applyOnlyRotation

void Light::applyOnlyRotation(int projection_nb)
{
	if(m_type == OMNI)
		return;
	if(m_type == SUN)
	{
#ifdef MERGEFORSUN
		return;
#endif
		Viewpoint* targetVp = RENDER_MANAGER.getRenderPassInfo()->lod_viewpoint;
		targetVp->applyOnlyRotation(projection_nb);
		return;
	}

	Transformf trans(node()->getGlobalTransform());
	Matrix3d rotation = trans.getRotation();
	Transformf transform(rotation.getInverse(),Vector3f(),Vector3f(1,1,1));
	transform.glMultd();
}
开发者ID:smatcher,项目名称:S5old,代码行数:19,代码来源:light.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ Viewport类代码示例发布时间:2022-05-31
下一篇:
C++ ViewerNodePtr类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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