简体   繁体   English

Iphone + OpenGL ES + Blender 模型:触摸旋转

[英]Iphone + OpenGL ES + Blender Model: Rotation by Touch

I'd like to have a 3d object inside an iPhone UIView that can be rotated by using the touching events (swipe with a finger maybe).我想在 iPhone UIView 中有一个 3d 对象,可以通过使用触摸事件(可能用手指滑动)来旋转。 Where shall I start looking at?我该从哪里开始看? I guess OpenGL ES might be useful to do this, but I know nothing about it and I do not wanat to go deep inside OpenGL Programming ( studiying physics, rotations, quaternions etc) so maybe that is not what I need.我想 OpenGL ES 可能对做到这一点很有用,但我对此一无所知,我不想深入了解 OpenGL 编程(研究物理、旋转、四元数等),所以也许这不是我需要的。 I can create very basic 3d models in Blender so I'd like to use those in the app (I saw there are scripts that can parse and convert obj files in arrays of vertexes etc) Shall I rely upon a graphic engine like Irrlicht?我可以在 Blender 中创建非常基本的 3d 模型,所以我想在应用程序中使用它们(我看到有一些脚本可以解析和转换顶点数组中的 obj 文件等)我应该依赖像 Irrlicht 这样的图形引擎吗? Any suggestion is welcomed欢迎任何建议

That is something I've done a few months ago.这是我几个月前所做的事情。 A friend that is a proper Objective-C developer said I should try the SIO2 engine.一个合适的 Objective-C 开发者的朋友说我应该尝试SIO2引擎。

Tutorial2 covers exactly what you are after. Tutorial2完全涵盖了您所追求的内容。

替代文字
(source: sio2interactive.com ) (来源: sio2interactive.com

Basically you build your scene in Blender and there is an exporter to get that in the SIO2 Game Engine on the IPhone , how awesome is that ?基本上你在Blender 中构建你的场景,并且有一个导出器可以在iPhone上的 SIO2 游戏引擎中获取它,这有多棒? :) :)

To break it down:分解:

  1. Open up the xcodeproject from Tutorial02从 Tutorial02 打开 xcodeproject
  2. Open up Blender (with a mesh)打开搅拌机(带网格)
  3. Run the Exporter(select the TextEditor in a Window, open sio2_exporter.py from SIO2_SDK/exporter and run)运行导出器(在窗口中选择 TextEditor,从 SIO2_SDK/exporter 打开 sio2_exporter.py 并运行)
  4. Select your mesh and hit export.选择您的网格并点击导出。 You could backup tutorial02.sio and export a new one.您可以备份 tutorial02.sio 并导出一个新的。
  5. In template.mm find the templateScreenTouchMove() method (towards the bottom) and update the mesh name在 template.mm 中找到 templateScreenTouchMove() 方法(朝底部)并更新网格名称

eg change例如改变

SIO2object *_SIO2object = ( SIO2object * )sio2ResourceGetObject( sio2->_SIO2resource,
                                                                         "object/Suzanne" );

to

SIO2object *_SIO2object = ( SIO2object * )sio2ResourceGetObject( sio2->_SIO2resource,
                                                                         "object/YourMeshName" );

It's all explained in the video tutorial as well.这一切也在视频教程中进行了解释。

Good luck!祝你好运!

you can look at a few things.你可以看看几件事。 Cocos2d-iphone is a good framework for 2d stuff. Cocos2d-iphone是一个很好的 2d 框架。 the templates they use are pretty good and set everything up.他们使用的模板非常好,并且设置了所有内容。 in cocos2d-iphone you can still draw opengl primatives (in the draw method) but also have the power of cocos2d to do things like sprites and other elements.在 cocos2d-iphone 中,您仍然可以绘制 opengl 原语(在 draw 方法中),但也可以使用 cocos2d 的功能来执行诸如精灵和其他元素之类的事情。

otherwise here is a quick guide for bringing in blender objects into an iphone project.否则, 这里是将搅拌机对象引入 iphone 项目的快速指南。

one thing that i noticed was with blender 2.5 alpha, i couldnt get the script to integrate properly so you just have to do that part manually.我注意到的一件事是使用 Blender 2.5 alpha,我无法正确集成脚本,因此您只需手动完成该部分。 Just remember to convert your quads to triangles because thats what the iphone takes in.请记住将您的四边形转换为三角形,因为这就是 iphone 所接受的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM