XNA Creators Club Online
Page 1 of 1 (2 items)
Sort Posts: Previous Next

Implementing a "dancing Ants" line algorithm

Last post 05-03-2008 11:32 AM by shinkowski. 1 replies.
  • 05-03-2008 10:56 AM

    Implementing a "dancing Ants" line algorithm

    I've been reading the posts on the different methods of drawing lines in XNA, and from what I've seen my options are

    1. Use an n sized 2d textures and blit them over and over from point 1 to point 2
    2. Use 3d vertex objects to draw lines from vertex to vertex (I've used this in the past)

    Does anybody have any advice on what would be the best approach for implementing a "dancing ants" line algorithm (like what you would see when you select a portion of an image in photoshop, or when you select a series of cells in excel and hit ctrl-c to copy them). I have some ideas that I will list below, would like some advice on which one might be best, or if I'm going down the wrong "rabbit hole", (in which case what would be a better approach?) 

    I'm also looking at wanting to implement this for any line (not just the horizontal/vertical lines that the examples use)

    I had some ideas, the first would be to create many small 3d lines (where I'd generalize the process to the point where control would be made through using a starting offset, a line segement distance value (how long to draw each dash) and a margin (distance between line segements). 

    The pros are that this would not be that hard to implement based off the codebase I've already worked with and created.  The other potential pro is that this would also let me add a "thermometer effect" to the line (where the line gradually changes from one color to another)  The potential con would be in performance issues? 

    The other idea I had was to use the 2d textures and blit them from point 1 to point 2, and then use a stencil buffer to give the effect of "erasing" a portion of the textures....and then modifying the offset on which I start applying the stencil buffer.

     

    Cheers,

    --Art

     

     

  • 05-03-2008 11:32 AM In reply to

    Re: Implementing a "dancing Ants" line algorithm

    There are probably many ways to do this.
    I would use a texture and move it, by passing the time to the shader.
Page 1 of 1 (2 items) Previous Next