Rotating Images
Posted: Mon Apr 04, 2005 01:03
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.
* 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.