Ogre屏幕坐标的几种方式

本文介绍了Ogre引擎中的三种屏幕坐标系统:屏幕绝对坐标系、屏幕相对坐标系和屏幕单位化绝对坐标系,并详细解析了它们的特点和转换方法,帮助开发者更好地理解和使用Camera::getCameraToViewportBoxVolume等函数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在使用Camera::getCameraToViewportBoxVolume (Real screenLeft,Real screenTop, Real screenRight, Real screenBottom, boolincludeFarPlane=false)时,不清楚这几个值到底该怎么设置呢?跟我用的屏幕坐标mousePointxy)有什么不一样呢?接 下来总结一下。

常见的Ogre中的屏幕坐标有以下三种方式:

1. 屏幕绝对坐标系。

度量为像素。如左上角为(00), 右下角为(800 600. 这些值分别表示在屏幕宽度和高度上的像素位置。经常也表示为2D的数据,分别表示x方向和y方向。

2. 屏幕相对坐标系。

左下角为(-1,-1),右上角为(1,1)Rectangle2D::setCorners(Real left, Real top,Real right, Real bottom,bool updateAABB = true )用的就是就这个坐标系。 其中left Left position in screen relative coordinates, -1 = left edge, 1.0 =right edge top Top positionin screen relative coordinates, 1 = top edge, -1 = bottom edge right Right position in screen relativecoordinates bottom Bottomposition in screen relative coordinates

3. 屏幕单位化绝对坐标系。

左上角为(0,0),右下角为(1,1)Camera::getCameraToViewportBoxVolume (Real screenLeft, RealscreenTop, Real screenRight, Real screenBottom, bool includeFarPlane=false)就是用的这个坐标系。 screenLeft,screenTop,screenRight,screenBottom The bounds of theon-screen rectangle, expressed in normalised screen coordinates [0,1]

由此,13之间 是可以相互转化的。不过要首先获取到屏幕的宽度和高度,可以在绝对坐标系和单位话绝对坐标系之间游刃有余了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值