Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Modifyable shapes... — Gideros Forum

Modifyable shapes...

katzekatze Member
edited April 2012 in Suggestions & requests
Hey, i really like the shape stuff =)

But when i want to have animated lines it seems like i need to recreate the shape every frame completly new (clear and rebuild)
(tell me if not so)
this produces alot of code and i thing also some garbage trashing i think.

so thats why i would like to do this suggest:
shape:moveTo()
and
shape:lineTo()

should return a kind of id (like a vertex id if its a GL_LINESTRIP or something)

and then it should be able to modify this "edge" with something like:
shape:setEdgePosition(id,x,y)
or something

this would not destroy old functionality but would give a nice advantage for animating shapes, and connect sprite with shapes and all similar stuff.

Comments

  • ar2rsawseenar2rsawseen Maintainer
    Well it all depends on what exactly you need. You can draw new path starting from point of last path to, for example, extend shapes, to draw something to it.
  • katzekatze Member
    edited April 2012
    yea i saw that :)
    but i think this could be helpfull in some situations to rearange edges after creating them.
    specially on complexer shapes.

    a baloon with a string fixed to ground on one site and on the baloon on other side (no need to recreate the shape all time, just set the edge to its new position on baloon side)

    or what i just did, a bow where the path simulates the bowstring at the end of the arrow,
    its somewhat strange to me to recreate the whole shape all the time when using the bow, instead of just set the middle edge position just to the arrow end.
  • atilimatilim Maintainer
    edited April 2012
    @katze on the other hand, unfortunately providing an API as you suggested doesn't effect the performance a lot. (Although your suggestion simplifies some cases)

    We're not using GL_LINESTRIPs and instead we're triangulating our own geometry even for the line shapes. Therefore, changing a position of a single vertex would result in retriangulation of the whole shape.
  • katzekatze Member
    oh okay, worth a try :)
  • I thought about this as well, I think shape:clear() is the function you need, it'll clear the shape of all values and allow you to re-generate the geometry. There probably is a bit of overhead re the GC but it'll be a lot less than creating a new shape every frame.
    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
Sign In or Register to comment.