Page 1 of 1

Rotating Images

Posted: Mon Apr 04, 2005 01:03
by gcarlton
I'm going to add support for static images that are displayed with a rotation. This involves:

* StaticImage::setRotation(float) new function
* RenderableElement::draw() with extra rotation argument
* RenderableElement::draw_impl() with extra rotation argument
* Image::draw() with extra rotation argument
* ImageSet::draw() with extra rotation argument
* Renderer::addQuad() with extra rotation argument
* Rect helper function to get rotated corner points
* D3D9 render to support rotated quads

This is a big list of lots of small changes! Also, I'm only going to support the renderer I actually use, but if others are interested I'm hoping we can get this supported across the board.

The actual guts of it is simple, instead of rendering a quad with the rect's TL/TR/BL/BR, you ask the rect to give you 4 corner points for a given rotation value. Clipping is more problematic, since you wouldn't be rendering simple quads anymore (I'm not going to worry about it for now).

Another point is that this indirection is a maintenance headache, so it might be better to pass a DrawInfo struct around, which can have arguments added in a nicer way. However, I probably wont do this, as its just making a large change even larger.

Re: Rotating Images

Posted: Mon Apr 04, 2005 14:55
by lindquist
I think this sounds like a great feature...

spinning icons would be cool :P

As I see it, clipping is'nt that big a problem. The feature is so specialized that the widgets using it could easily calculate bounding rects, and I don't think true diagonal clipping will be needed!

Re: Rotating Images

Posted: Mon Apr 04, 2005 23:40
by gcarlton
I've done the change and it works fine. I'm not sure what to do about a patch file though - I've made one up, however my d3d renderer has lots of extra code in there (I've been experimenting with a custom stl allocator for the quadlist), so that class is a bit of a mess.

If anybody is interested I can submit the patch anyway, and anyone who wants to use will have to remove the extra stl allocator class in d3drenderer after applying the patch. Alternatively, I could try snipping those changes out of the patch file, but I've probably invalidate the file since its all interwoven there.

Re: Rotating Images

Posted: Tue Apr 05, 2005 00:22
by lindquist
why dont you just get a fresh copy from CVS.
apply the changes there and make the patch?

Re: Rotating Images

Posted: Tue Apr 05, 2005 02:12
by gcarlton
Yeah that would work. :)

Mainly because its done now, and my first priority is to get the gui working as I need for my project. As such I have made lots of changes which make it easier for myself but aren't a good idea in general.

As such I don't really want to get a clean copy of cvs, make changes there, submit a clean patch, and then somehow merge it in with my other changes.

Anyway, I put the patch up (changes plus d3d9 mess), but I don't know what use it will be. :oops:

Re: Rotating Images

Posted: Tue Apr 05, 2005 13:09
by lindquist
I took it back!

Re: Rotating Images

Posted: Wed Apr 06, 2005 23:58
by gcarlton
Well ok! However I agree that a patch with the extra code is a bit useless. If I have some time (which I don't, at the moment), I can clean it up and resubmit it.

Note that I think a custom allocator for the d3d9 renderer is a good idea, it just needs some cleaning up.

Re: Rotating Images

Posted: Sat Dec 03, 2005 00:08
by tgraupmann
Does StaticImage rotation work yet?

Re: Rotating Images

Posted: Tue Dec 13, 2005 22:55
by gcarlton
I did the changes to a clean copy from cvs and submitted a new patch, that was a few months ago.

It hasn't been merged in by the team, and Falagard has quite a few changes so it may be end up being problematic for them to do so, I'm not sure. However the patch file is there if anybody wants to use it.

Posted: Mon Jun 12, 2006 22:02
by arkos
I was just wondering if there was going to be any native support in CEGUI for rotating images, anytime soon?