Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Leveleditor box modeling?

Author
Message
enderleit
19
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 31st Jan 2011 20:39 Edited at: 31st Jan 2011 20:43
So, I'm working on this 3D level editor that I want to make free and OpenSource. (since there are no good free ones left that is maintained)

You're supposed to be able to select edges/faces and extrude them to kind of shape the level, I believe it's called box-modeling.
Think of the workflow kind of like a very simple Blender modeler.

I have been bending my mind as to how I would represent the level/object(s) in code and have a few ideas, but they all have either one flaw or another. I could simply use built-in commands and modify vertexdata, although this would probably get very complex.
Another way would be to make my own polygon/vertex structures, which would probably make modifying them easier, but would make displaying them and exporting them into a dbpro game more difficult. (especially if I want the editor to show the level as it will look in the final game, with shaders and everything)

I made a short video showing a very early prototype I have put together, where you can see me select 4 vertices(a face) and at the end I make a movement in the direction I want to extrude the face. Now this would then create 4 new faces. (the selected face would be pulled out or deleted, so we don't have useless faces inside the geometry)



Anyone have any suggestions, or maybe a completely different idea about how I could implement something like this?


Here's another video of the Spark Editor for Natural Selection 2, which has the same kind of workflow I'm going for, so you can better see what I am aiming for...


baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 2nd Feb 2011 13:13 Edited at: 2nd Feb 2011 13:14
I think you'll have to add four new vertices using the vertex data commands then edit the index data to remove the two triangles that represent the end face and add the 10 new faces...

Assuming you know which four vertices are on the face to be extruded you can remove the two triangles that represent that face by checking each group of three indexes, if a group contains only vertices from our set of four then you can delete that triangle.

Adding the new vertices is just a case of copying the vertex positions of the old 'face' to the new position.

Adding the index data for the 10 new triangles is slightly more complicated as I think the triangles need to be specified in an anti-clockwise / clockwise order...

Hope this quick sketch helps:


Yodaman Jer
User Banned
Posted: 2nd Feb 2011 19:40
Heh, that sounds a little complicated but completely possible.

I'm actually looking to do something similar in a future level editor of mine, so I'll be keeping tabs on this thread.

Login to post a reply

Server time is: 2026-07-18 02:09:14
Your offset time is: 2026-07-18 02:09:14