• entries
    743
  • comments
    1924
  • views
    579576

Adding vertices and creating faces

Sign in to follow this  
Aardvajk

353 views

opus.jpg

So Delete now works, along with Move, Add Vertex and face creation, so it is finally possible to construct some very rudimentary models now. All the new features are integrated properly into the Undo/Redo system as per last post (cheers for the feature, by the way Drew) and seems to be working okay.

Delete involved a bit of a rewrite of the model storage code. Previously I was referencing faces to vertices and vice versa using indices, but this proved highly problematic when trying to implement undo/redo for deletion of vertices or triangles.

Now, each vertex is assigned a ID that is unique for the duration of the program running. Faces store a list of IDs as well as indices and when vertices are removed (or added by Redo), the faces are stitched to the vertices via IDs. There is then a method that is run when required that gathers the current index of the vertex by ID and caches it in the triangle to avoid having to keep looking up by ID every frame.

This has vastly simplified the code, at the cost of an unsigned member in the vertex structure and three unsigned members in the triangle structure, which is more than acceptable.

Obviously still miles and miles to go before this starts being a useful program. I need to get Rotate, Scale and Extrude working next, then finish off the Add Primitive tool to support triangles, planes, cubes, spheres etc. At that point, I'll probably start thinking about the skeleton system rather than leave it too late in the project and push forward with the animation system. Might be worth getting grouping working first.

At that point, we are not far off MilkShape-level of functionality at which point anything I can implement that improves on MilkShape is a bonus. Plus, of course, I'll release this project for free which is an automatic bonus over MilkShape. Not that MilkShape's licence is unfairly priced but frankly MilkShape's UI is quite basic and bodged in my opinion and the world deserves a prettier low-poly editor.

[LATER]

Image1.jpg

Just finished working on this little control. It's for manually entering values for moving, and also allows you to lock axes for mouse-drag movement.

It's all one control as I'm going to want almost identical controls for the Rotate and Scale tools, so it has been written in isolation. There is just a function that returns a HWND to the AxisControl and you can control the text on the button, send it messages to retrieve the axis filter and the values, and its parent control gets a WM_COMMAND with a BN_CLICKED when the button is pressed.

Looks quite professional I think. But then I am biased.

Starving. Must eat.
Sign in to follow this  


2 Comments


Recommended Comments

Which windowing toolkit/framework are you using? Is it written in C++ or in one of the managed languages? It does indeed seem like it is starting to come together - don't forget to add some form of a plugin system for users to create and contribute new functions to the system later on.

Share this comment


Link to comment
Pure Win32 API. I'm a masochist with a lot of time on my hands. :)

Joking aside, I don't find Win32 API as bad as people say to work with and I actually really enjoy it, probably just because I've been using it for more years than I care to remember and I have a great deal of my previous code to draw upon. I wouldn't want to work with it in C though. RAII is your best friend when working with this library.

I still design properly - no globals anywhere in this project. I tend to use the GWLP_USERDATA section of the GetWindowLongPtr() et al to ferry state around. It's a total myth that you are forced into old-fashioned design paradigms by Win32.

Yeah, plugin system has been flitting around in my head. I'm probably going to go down the scripting route rather than the DLL route. Certainly at a minimum I'll need scriptable importer/exporter system, but it would be nice to have real-time scriptable tools that interact with the interface like the built-in tools rather than the MilkShape system of launching in a new window.

Thanks for the input.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now