方法执行操作处理的3D视图 [英] Ways to implement manipulation handles in 3d view

查看:185
本文介绍了方法执行操作处理的3D视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建一个简单的实体建模应用程序。用户需要能够操纵对象在两个正交和透视图。例如,当有一个框在屏幕和用户点击它,选择它,它需要得到'把手'在边角和中央,使得用户可以将鼠标移动到这样一个手柄,将其拖到放大或移动框。

I'm building a simple solid modeling application. Users need to be able to manipulate object in both orthogonal and perspective views. For example, when there's a box in the screen and the user clicks on it to select it, it needs to get 'handles' at the corners and in the center so that the user can move the mouse over such a handle and drag it to enlarge or move the box.

有什么策略有做到这一点,哪一个是最好的?我能想到的两个明显的:

What strategies are there to do this, and which one is the best one? I can think of two obvious ones:

1)将所手柄,3D对象。即对于一个盒子,在主框的角加小箱子到现场。问题:这不会在立体视图中工作,我需要确定的相对于当前的变焦级别的框的大小(手柄需要具有相同的尺寸不管多远用户放大/缩小)

1) Treat the handles as 3d objects. I.e. for a box, add small boxes to the scene at the corners of the 'main' box. Problems: this won't work in perspective view, I'd need to determine the size of the boxes relative to the current zoom level (the handles need to have the same size no matter how far the user is zoomed in/out)

2)添加了手柄的场面被渲染后。渲染到屏幕外的缓冲区,确定的角落2D位置以某种方式与使用普通的2D绘图技术来绘制句柄。问题:如何将我hittesting?我需要做一个两阶段hittesting方式,为好;我该如何绘制2D在3D渲染的图像?回落到GDI?

2) Add the handles after the scene has been rendered. Render to an offscreen buffer, determine the 2d locations of the corners somehow and use regular 2d drawing techniques to draw the handles. Problems: how will I do hittesting? I'd need to do a two-stage hittesting approach, as well; how do I draw in 2d on a 3d rendered image? Fall back to GDI?

有可能更多的问题,这两种方法。是否有解决这个问题的一个行业标准的方式?

There are probably more problems with both approaches. Is there an industry-standard way of tackling this problem?

我使用OpenGL,如果有差别。

I'm using OpenGL, if that makes a difference.

推荐答案

我会像对待的手柄,3D对象。这提供了许多优点 - 它更一致的,他们表现得很好,命中测试很容易,等

I would treat the handles as 3D objects. This provides many advantages - it's more consistant, they behave well, hit testing is easy, etc.

如果您希望手柄是一个固定的大小,你仍然可以把他们当作3D对象,但是你必须要扩展其大小根据离相机的距离为宜。这是一个有点麻烦,但因为通常只有几把,而这些通常都是小物件,它应该是性能优良明智的。

If you want the handles to be a constant size, you can still treat them as 3D objects, but you will have to scale their size as appropriate based off the distance to camera. This is a bit of a hassle, but since there are typically only a few handles, and these are usually small objects, it should be fine performance wise.

不过,我居然说让手柄比例与场景。只要你选择一个渲染风格,使他们脱颖而出的手柄(即:明亮的橙色盒等),透视效果(小在后台处理)实际上使他们的工作更容易为最终用户在很多方面。它是很难得到的深度从一个3D场景感 - 的手柄的透视效果有助于提供更多的视觉线索,如何深手柄是到屏幕

However, I'd actually say let the handles scale with the scene. As long as you pick a rendering style for the handle that makes them stand out (ie: bright orange boxes, etc), the perspective effects (smaller handles in the background) actually makes working with them easier for the end-user in many ways. It is difficult to get a sense of depth from a 3D scene - the perspective effects on the handles help provide more visual clues as to how "deep" the handle is into the screen.

这篇关于方法执行操作处理的3D视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆