Results 1 to 10 of 20

Thread: Spline Editor

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Holidays are great for that: work work work work work! Loving it so far... About 1400 lines down, an estimated 2500 more to go. At this rate, I can have 1 or 2 days for school work and still have 4-5 days R&R, so its looking good. Hate weeks for that because once you finish school, do work, chill for 5 mins, play some black ops and etc, you only end up with enough time to open up your IDE, check out where you were and close it again

    I assume its all based on the bezier curve am I right? Although the GUI might not be exactly my area of interest, the algorithm and implementation would definitely be handy, an porting required to get it over to OpenGL or is it written in OGL from the start?

    cheers,
    code_glitch
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  2. #2
    I separated the spline from the rendering part (like everyone else should do!), so you can fetch my spline class and just get a list of line segments out of that. I also have other spline code for different kinds such as Catmull-rom and Hermite splines, if you're interested. I won't use them in the editor though.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  3. #3
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    Nice! Glad to see you working on your engine/designer again.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  4. #4
    Things have taken slightly longer than I expected, but still... new update.

    As said, the view menu is fully functional. You can also use the list of anchors to quickly select an anchor and see it's properties. Also, the red plus-signs allow you to insert new spline-anchors to make more complex splines, like this one.



    The main things that I still need to do are: import/export functionality, add upvector support, make those properties work (bottom-left) and fix a bunch of small buggies.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  5. #5
    Nice! Looking good chief

    cheers,
    Paul

  6. #6
    Just did a little work on this one again. Manual editing (entering coordinates) of anchor positions and tangents is now possible. I will release the whole thing once I've made the export/import functionality work.

    I'm stuck with one problem though. I want to support "upvectors". These are vectors that show which direction is "up", if you were to travel along the spline. This vector will always be perpedicular to the spline, and can therefore be described by an angle (with respect to the Y axis, which conventionally points to the sky of the world). But how can I design an interface for editing this angle for each anchor?

    One thing I will do is let the user enter this angle manually. It would be good to have some WYSIWYG-way of editing this. However, I feel that this may become rather awkward if not done right. If I were to create a new handle for this, it would be constrained to rotate around the spline and have a fixed length. I'm not sure what to do here.

    I'll probably leave it out in the first version (or give some visual feedback at best). Still, any ideas about this are appreciated!
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  7. #7
    Ok, getting closer and closer... My program now produces this:

    Code:
    <?xml version="1.0"?>
    <Spline Closed="True">
      <Anchor ID="0">
        <Position x="-20,000" y="0,000" z="-20,000"/>
        <Tangent x="15,000" y="0,000" z="-15,000"/>
        <Upvector x="0,000" y="0,000" z="1,000"/>
      </Anchor>
      <Anchor ID="1">
        <Position x="30,000" y="-3,000" z="-25,000"/>
        <Tangent x="15,000" y="0,000" z="5,000"/>
        <Upvector x="0,000" y="0,000" z="1,000"/>
      </Anchor>
      etc....
    </Spline>
    Working with XML in Lazarus is suprisingly easy.

    Update: Almost done with this project. Loading/Saving splines is now possible. I only have to work out the "upvector" thingy and then I can release it.
    Last edited by chronozphere; 01-05-2011 at 04:25 PM.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •