Anyone interested in a GuiBitmapCtrl that rotates ?
by Orion Elenzil · in Torque Game Engine · 11/10/2007 (2:16 pm) · 16 replies
I implemented a GuiBitmapCtrl which primitively supports rotating the bitmap.
anyone interested in a resource of that ?
significant caveats:
* doesn't work with Wrapping
* the clip-region of the bitmap is unaffected, which means that parts of the bitmap may be clipped
* has no effect on hit-region for mouse events etc
* rotation isn't passed on to children
basically, this is useful where you have a bitmap the important parts of which fit in a circle.
for example a compass.
for those who're into deets,
the core is changing dglDrawBitmapStretchSR() to take optional degree & center params,
then loading a matrix in there before drawing the triangle fan.
orion
anyone interested in a resource of that ?
significant caveats:
* doesn't work with Wrapping
* the clip-region of the bitmap is unaffected, which means that parts of the bitmap may be clipped
* has no effect on hit-region for mouse events etc
* rotation isn't passed on to children
basically, this is useful where you have a bitmap the important parts of which fit in a circle.
for example a compass.
for those who're into deets,
the core is changing dglDrawBitmapStretchSR() to take optional degree & center params,
then loading a matrix in there before drawing the triangle fan.
orion
About the author
#2
11/10/2007 (3:34 pm)
YES! We were just looking into making this type of control.
#3
11/10/2007 (7:20 pm)
Sweet! i'll try to get it up tomorrow. .. that sounded not so good, but you know what i mean.
#4
11/10/2007 (8:23 pm)
Sounds like a pretty useful resource to me. :-)
#5
11/11/2007 (6:32 am)
This does sound interesting. :)
#6
11/12/2007 (7:39 am)
I really like the sound of this! I'd be interested in it!
#7
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=13844
11/12/2007 (10:07 am)
As-yet unapproved resource:www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=13844
#8
the trouble with that is that i think dglSetClipRect() is a little pricy.
11/12/2007 (10:20 am)
I wonder if it would make sense to automatically update the clip region to accomodate the four rotated corners.the trouble with that is that i think dglSetClipRect() is a little pricy.
#9
11/12/2007 (11:08 am)
You should rotate the whole quad and not just the tex coords Phil C actually posted a proper solution for this years ago
#10
from the resource:
the issue is that dglSetClipRect(childClip) has already been called from the parent control.
.. which seems nuts to me.
why should the parent set the clipRect for each child, instead of having each child set its own.
the child *can* reset the clipRect, and it works fine, it's just sort of untidy.
do you have a link to Phil C's thing ?
edit: ah, here it is.
11/12/2007 (11:15 am)
I am rotating the whole quad.from the resource:
Quote:
GuiBitmapCtrl renders its bitmap as a textured quad,
and this resource simply rotates that quad.
the issue is that dglSetClipRect(childClip) has already been called from the parent control.
.. which seems nuts to me.
why should the parent set the clipRect for each child, instead of having each child set its own.
the child *can* reset the clipRect, and it works fine, it's just sort of untidy.
do you have a link to Phil C's thing ?
edit: ah, here it is.
#11
11/12/2007 (1:20 pm)
The clip region is workable, just make your clip area larger than the circumference of any image in side (as in add transparent areas). Thoe, it would be nice.
#12
you could even rotate from a point outside the image,
which would displace it quite a lot.
11/12/2007 (1:46 pm)
That's assuming you're rotating from the center.you could even rotate from a point outside the image,
which would displace it quite a lot.
#13
I don't see problems setting "your own" clipRect while overwriting the "parent" one.
I'm doing it at some places and don't see anything "bad" on it.
11/12/2007 (2:48 pm)
This one is a good one :)Quote:the issue is that dglSetClipRect(childClip) has already been called from the parent control.If you "let the child to set it's own clipRect", then... what will happen if you have guiControl that lacks the clipRect code??
.. which seems nuts to me.
why should the parent set the clipRect for each child, instead of having each child set its own.
I don't see problems setting "your own" clipRect while overwriting the "parent" one.
I'm doing it at some places and don't see anything "bad" on it.
#14
Yeah, the child can set its own clip rect, and it works fine,
i just feel bad from a design point of view doing that because it's also done in the parent.
11/12/2007 (2:54 pm)
DglSetClipRect() is used in GuiControl, so child classes of that will have it as well.Yeah, the child can set its own clip rect, and it works fine,
i just feel bad from a design point of view doing that because it's also done in the parent.
#15
I too don't see the need of setting clipRect from parent (or in child if it's set by parent, but uhh...) :)
11/12/2007 (2:59 pm)
Ohh.. then, it's a different story..I too don't see the need of setting clipRect from parent (or in child if it's set by parent, but uhh...) :)
#16
i changed it around a bit to also include animating the rotation, i will post my code changes soon once it get them polished
11/17/2007 (6:32 am)
Hey guys..nice rotating bitmap resourcei changed it around a bit to also include animating the rotation, i will post my code changes soon once it get them polished
Torque 3D Owner Novack
CyberianSoftware