starbugs / icedcoffee

A lightweight OpenGL user interface framework written in Objective-C
BSD 3-Clause "New" or "Revised" License
47 stars 7 forks source link

icedcoffe as base for vector 2D/3d engine #1

Closed ghost closed 12 years ago

ghost commented 12 years ago

I am struggling to find a vector based 2D/2D framework for iOS, I was intrigued by icedcoffe's visitor pattern and support for custom geometry.

Do you think icedcoffe would be suitable to form the bases of a 2D/3D vector based engine, I'm thinking primitive shapes/volumes plus 2D/3D composite spline/mesh shapes/volumes?

TIA

starbugs commented 12 years ago

Hey!

Thanks! Great to hear that you like it!

Funny that you're bringing this up. A complete vector-based approach is actually one of the long-term goals for the framework and we have started working on exactly that. However, we are focussing on 2D first (bezier paths, font contours and basic shapes) and it will take us lots of time to make that happen holistically.

But to answer your question: yes, it's perfectly suited for this purpose and it has been designed to be open for things like that. If you start to use icedcoffee, please let me know if you run into issues or need help. The project is very young and we do not have good documentation online yet. Not even a mailing list or so. But we will kick these things off soon.

Tobias

On 03.08.2012, at 14:24, march44 wrote:

I am struggling to find a vector based 2D/2D framework for iOS, I was intrigued by icedcoffe's visitor pattern and support for custom geometry.

Do you think icedcoffe would be suitable to form the bases of a 2D/3D vector based engine, I'm thinking primitive shapes/volumes plus 2D/3D composite spline/mesh shapes/volumes?

TIA


Reply to this email directly or view it on GitHub: https://github.com/starbugs/icedcoffee/issues/1

ghost commented 12 years ago

Tobias

Hi, I think I will incorporate iced coffee into my project and see where it leads, I have a couple of follow up questions.

I want to do 3D UI in my project, in its simplest form similar to adobe scaleform where 2D layers can be rendered at different Z-depths, I see that you use a perspective camera that lets you scale to any screen resolution, could this be replaced easily with other camera projections, I'm not sure if it would cause problems or could be used to provide a parallax effect by changing the camera position based on accelerometer to provide a glasses less 3D effect?

I would also like to do full multi layerd 3D UI's (layers can overlap in z-depth and UI elements can be 3D objects), I know what needs to be done (in theory) to implement this. But implementation is beyond my current opengl knowledge so a steep learning curve ahead.

One requirement is to render to a 3D resterised volume (voxel canvas?) I'm thinking an efficient way to store this volume as it is being drawn into is to use a sparse octree, wrapped in a 3D buffer object, then use the octree to render to the screen.

Do you think this is crazy or could fit with icedcoffee conceptually?

Andy

starbugs commented 12 years ago

Hi Andy,

The camera can be replaced easily. Currently, there is ICCamera (a generic camera) and ICUICamera (perspective UI rendering). You may build upon ICCamera or ICUICamera by subclassing and overriding setupScreen. The camera essentially computes the projection and model-view matrices in that method, so this most likely is what you want to adapt first. For ICUICamera, it's important to note that we invert the Y-axis so that the left-top corner equals [0,0,0] in world coordinates by default. This means that IcedCoffee UI world coordinates are top-down, while the OpenGL framebuffer coordinates (which are also the input coordinates for the camera's matrices) are still bottom-up. However, this is mostly important for touch and mouse event handling. If you run into problems with that, please create another issue -- we'll be able to quickly fix it.

Regarding the multi layered 3D UIs, IcedCoffee fully supports depth buffering even for picking and render textures. Nodes have a 3D position and an implicit order. The order is simply defined by a node's children array. If you render semi-transparent objects you may need to ensure correct order. Otherwise depth testing will do everything for you. Look into the depth buffer test for an example of setting up a host view + host view controlller with depth buffer support. It's important that you explicitly enable it, otherwise no depth testing will be performed. I don't see anything very complicated with rendering multi layered UIs with 3D objects in them. The only thing missing in IC is a 3D model loader, but it should be easy to integrate one. Another sidenote: IcedCoffee creates a 24-bit depth buffer with a combined 8-bit stencil buffer by default, and this is a requirement for some parts of the framework to work. Having only a 32-bit depth buffer is not possible currently, at least not easily.

For the 3D volume: I don't know what exactly you aim for, but if you really require such complexity for your project, it doesn't sound crazy. IcedCoffee is agnostic of the way you handle your drawing. You may use 3D textures or whatever you like. An octree can be integrated nicely by creating a custom drawing visitor. This is also the way I would implement any visibility detection in a large scene. So, yes, conceptually this would also fit with the framework.

Tobias