Profile Editor Tool for T3D's MeshRoad
by Ryan Mounts · 11/20/2009 (4:26 pm) · 32 comments
This resource is based on the T3D 1.1 Alpha codebase. It extends the original MeshRoad by changing the sides of the road mesh into a user-defined profile spline that is extruded along the road. You can use this tool to create guardrails for your road, tunnels, I-beams, or just a sloped shoulder to blend your road into the terrain... use your imagination. :) Read the included PDF for installation and useage instructions. Patches (in Unified format) are provided to update your C++ files using your preferred Diff program.
Download: http://www.mediafire.com/file/jldu15gm3ty/MeshRoad Profile Editor.zip
Features:
- Move profile nodes to form complex shapes by simply clicking and dragging a profile node
- Add new profile nodes to profile by ctrl-clicking a profile segment
- Delete nodes by alt-clicking a profile node
- Toggle between flat and smooth shading by shift-clicking a profile node
- Toggle profile segment material between Top/Side/Bottom materials by shift-clicking a profile segment
- Select multiple profile nodes by ctrl-clicking the desired profile nodes
- Ability to move, delete, or toggle shading on all nodes in selection group
- Reset the profile by double-clicking the start node
- Complete undo/redo capabilities
- Profile saves to mission file with other MeshRoad data
- Original MeshRoad functionality remains the same, so existing roads will still work
Updated 2/26/2013. Now works with Torque 3D Open Source 2.0.
www.mediafire.com/file/whxgioo5hmapys6/MeshRoad_Profile_Editor_2.0.zip

Download: http://www.mediafire.com/file/jldu15gm3ty/MeshRoad Profile Editor.zip
Features:
- Move profile nodes to form complex shapes by simply clicking and dragging a profile node
- Add new profile nodes to profile by ctrl-clicking a profile segment
- Delete nodes by alt-clicking a profile node
- Toggle between flat and smooth shading by shift-clicking a profile node
- Toggle profile segment material between Top/Side/Bottom materials by shift-clicking a profile segment
- Select multiple profile nodes by ctrl-clicking the desired profile nodes
- Ability to move, delete, or toggle shading on all nodes in selection group
- Reset the profile by double-clicking the start node
- Complete undo/redo capabilities
- Profile saves to mission file with other MeshRoad data
- Original MeshRoad functionality remains the same, so existing roads will still work
Updated 2/26/2013. Now works with Torque 3D Open Source 2.0.
www.mediafire.com/file/whxgioo5hmapys6/MeshRoad_Profile_Editor_2.0.zip

About the author
#3
11/21/2009 (2:32 am)
Nice work! Something I was planning for my own mesh-road sort of system ;)
#4
I'm such a noob, but learning! <*sigh*>
Please explain how to merge the "meshRoad.cpp.patch" file in with the original "meshRoad.cpp" file. Can't figure out how to get VS-2008 to merge the files....or is it just simply a matter of copy & paste?
11/21/2009 (7:58 pm)
Ryan...this is a tool I've been waiting for...thank you!I'm such a noob, but learning! <*sigh*>
Please explain how to merge the "meshRoad.cpp.patch" file in with the original "meshRoad.cpp" file. Can't figure out how to get VS-2008 to merge the files....or is it just simply a matter of copy & paste?
#5
I bet there are some programmers around here that are more familiar patching that could recommend some more good patching freeware.
FYI, the patches were created with WinMerge, but oddly it cannot apply patches.
11/21/2009 (8:43 pm)
Jim, I used TortoiseSVN to test the patch files (it's free). With Tortoise, I just right-clicked the patch file, and selected "patch" from the TortoiseSVN context menu. You tell it the folder where the original file is located and it automatically finds it and patches it. I believe there is another free program called UDiff that would work, but I've never used it. Don't feel bad, I just learned about creating patch files a few days ago! These were my first ones!I bet there are some programmers around here that are more familiar patching that could recommend some more good patching freeware.
FYI, the patches were created with WinMerge, but oddly it cannot apply patches.
#6
Yeah, I tried to use WinMerge with no results..
Thanks again, appreciate you getting back to me so quick...will try TortoiseSVN.
11/21/2009 (10:31 pm)
Thanks Ryan!Yeah, I tried to use WinMerge with no results..
Thanks again, appreciate you getting back to me so quick...will try TortoiseSVN.
#7
Great program (referring to your piece of programming). I can think of all sorts of things I can build with this little gem.
11/21/2009 (11:09 pm)
Ryan - Yep! That did the trick....Thank you.Great program (referring to your piece of programming). I can think of all sorts of things I can build with this little gem.
#8
i.e. 2 splines one for each side of the road.
I find myself needing a road with a curb only at one side.
2nd question, how hard would it be to have multiple splines, one for each segment? This may be out of the scope of the road tool am not sure, like I said I haven't even looked at the code and this may be a big change.
keep up the good work Ryan :-D
12/10/2009 (7:26 am)
Hi, Love this resource, haven't looked at the code but how difficult would it be to modify it so the 2 sides of the road aren't symetrical?i.e. 2 splines one for each side of the road.
I find myself needing a road with a curb only at one side.
2nd question, how hard would it be to have multiple splines, one for each segment? This may be out of the scope of the road tool am not sure, like I said I haven't even looked at the code and this may be a big change.
keep up the good work Ryan :-D
#9
1. Adding a different spline for the other side of the road does not seem too difficult, since all the core functionality is already there. It would take some effort to mirror the spline behavior and integrating it into the geometry creation code in _generateVerts(), but it seems very doable. I'm busy with some personal projects at the moment, but I might take a look at incorporating this feature in the future.
2. Adding splines to each segment is also doable but would more difficult and less practical, in my opinion. I considered pursuing this feature at the beginning, but opted to go the simpler route. It seemed like an "overkill" feature (if you have 50 segments in a long road, how many people are going to hand manipulate all those segments?). Also, I thought it would be difficult for the end-user to get a pleasing result with no interpolation between adjacent profiles and the ease with which tris could get mangled between highly differing profiles. These issues are solvable but not trivial.
12/10/2009 (2:01 pm)
Hi David, thanks for the kind words!1. Adding a different spline for the other side of the road does not seem too difficult, since all the core functionality is already there. It would take some effort to mirror the spline behavior and integrating it into the geometry creation code in _generateVerts(), but it seems very doable. I'm busy with some personal projects at the moment, but I might take a look at incorporating this feature in the future.
2. Adding splines to each segment is also doable but would more difficult and less practical, in my opinion. I considered pursuing this feature at the beginning, but opted to go the simpler route. It seemed like an "overkill" feature (if you have 50 segments in a long road, how many people are going to hand manipulate all those segments?). Also, I thought it would be difficult for the end-user to get a pleasing result with no interpolation between adjacent profiles and the ease with which tris could get mangled between highly differing profiles. These issues are solvable but not trivial.
#10
good to hear you may add more features at a later date, in my oppinion this should be incorporated into the core, great addition :-)
the only reason I asked about case 2 wasfor these 2 cases,
1. I make a nice road then join another road into it, if I have a curb on the road I have to stop my road, join another road into the side, and start my road again after, if that road also has a curb I have to stop both roads as the curbs meet and create a small road piece to join the 2 roads together. I may not have explained myself too clearly there but I hope you get the idea?
2. Castle walls. create your base wall with only 1 raised side, select progressive pairs of segmants, lower to desired height.
both these could be done quickly with the ability to edit individual segments splines, so long as you could multiple select the nodes to edit that is.
Of course saying they could be done quickly isn't counting the hours you would have spent coding to get these functions in there in the first place and if you never do another thing with this resource it's still a great resource. I Love it ;-)
12/10/2009 (2:53 pm)
Hi Ryan,good to hear you may add more features at a later date, in my oppinion this should be incorporated into the core, great addition :-)
the only reason I asked about case 2 wasfor these 2 cases,
1. I make a nice road then join another road into it, if I have a curb on the road I have to stop my road, join another road into the side, and start my road again after, if that road also has a curb I have to stop both roads as the curbs meet and create a small road piece to join the 2 roads together. I may not have explained myself too clearly there but I hope you get the idea?
2. Castle walls. create your base wall with only 1 raised side, select progressive pairs of segmants, lower to desired height.
both these could be done quickly with the ability to edit individual segments splines, so long as you could multiple select the nodes to edit that is.
Of course saying they could be done quickly isn't counting the hours you would have spent coding to get these functions in there in the first place and if you never do another thing with this resource it's still a great resource. I Love it ;-)
#11
01/14/2010 (12:40 am)
Nice resource, added it to without issue to my latest project.
#12
02/07/2010 (3:06 pm)
I added this and after the mission was saved, only the first segment of each road has collision. Any ideas?
#13
03/02/2010 (8:47 am)
I looked at it in 1.0.1 and didn't have that problem (don't have 1.1A installed at the moment and haven't tried porting to 1.1B). What version are you using? Does the player fall through the road? Can you shoot the segments and leave a decal?
#14
03/02/2010 (8:53 am)
This was happening on 1.01. It seems that the collision only happens at the very beginning of the road and after about 1-2 meters, the player just falls right through. The road I have is fairly long so would that cause any issues?
#15
03/02/2010 (11:27 am)
Hmmm, I'm not sure. You might turn on Player Collision Visibility and see if the collsion geometry is getting created. The figure below shows the collision geometry in purple (the player is standing on the road in the middle of the purple lines). I haven't been able to recreate your issue. Are you doing something "out of the ordinary" like rotating/scaling individual segments in extreme ways?
#16
after 5 hours long try still i failed to make it work.
those patch file useless as 2.0 have manyt new lines:
meshRoad.cpp
meshRoad.h
guiMeshRoadEditorCtrl.h
guiMeshRoadEditorCtrl.cpp
can someone post updated version or those file?
02/03/2013 (6:51 pm)
i was trying to apply it on t3d 2.0after 5 hours long try still i failed to make it work.
those patch file useless as 2.0 have manyt new lines:
meshRoad.cpp
meshRoad.h
guiMeshRoadEditorCtrl.h
guiMeshRoadEditorCtrl.cpp
can someone post updated version or those file?
#17
"Error 1 error LNK2001: unresolved external symbol "bool gPolysoupOverride" (?gPolysoupOverride@@3_NA "
this is the line from (sourceT3DtsStatic.cpp) is causing the problem:
"extern bool gPolysoupOverride;"
where "gPolysoupOverride" is defined?
02/06/2013 (1:23 pm)
i am having error:"Error 1 error LNK2001: unresolved external symbol "bool gPolysoupOverride" (?gPolysoupOverride@@3_NA "
this is the line from (sourceT3DtsStatic.cpp) is causing the problem:
"extern bool gPolysoupOverride;"
where "gPolysoupOverride" is defined?
#18
02/26/2013 (6:54 am)
Hey ahsan, I've been watching the migration to open source from the sidelines for a while now and thought that now might be a good time to get back into Torque a little bit. So my first task was to port the MeshoRoad Profile Editor over to Torque 3D Open Source 2.0, which was completed last night. I plan to upload the changes here soon. Sorry you've had to spend so much time fighting with porting it over.
#19
not a good port.crashes sometimes.
+there are issues with "triangle++.lib" and "triangle++_DEBUG.lib".
those file does not work with vs2010.
i have tried to recompile them from their own source.but failed.
compiled file size is too small and vs2010 did not recognize them.
yes,it killed lots of time.and i was tired to post them here.
but i have learned many things during porting.
whatever,
i will wait for your perfect port.
one question:
what is the purpose of "gPolysoupOverride" ?
i think it relates to collision.but failed to figure out how it is interacting with t3ds physics!
02/26/2013 (11:54 am)
i have ported "MeshoRoad Profile Editor " and mesh room for t3d 2.0not a good port.crashes sometimes.
+there are issues with "triangle++.lib" and "triangle++_DEBUG.lib".
those file does not work with vs2010.
i have tried to recompile them from their own source.but failed.
compiled file size is too small and vs2010 did not recognize them.
yes,it killed lots of time.and i was tired to post them here.
but i have learned many things during porting.
whatever,
i will wait for your perfect port.
one question:
what is the purpose of "gPolysoupOverride" ?
i think it relates to collision.but failed to figure out how it is interacting with t3ds physics!
#20
Your questions about the Triangle++ library and the gPolysoupOverride flag are related to my old RoomBuilder code. If I remember correctly, the Triangle++ library that was included with that old code was slightly modified from the original, because I couldn't get it to compile under VS2008 either. I just remember it was a real pain to get it compiled correctly (seems like there were a bunch of different preprocessor directives that had to be set).
The gPolysoupOverride flag is defined in the "archEditor.h" file included with RoomBuilder, right near the top. The "tsStatic.cpp" file was modified in its "TSStatic::castRayRendered" method to switch between ray-casting against the opcode collision meshes (default) or against the rendered mesh (gPolysoupOverride = true). It was used like this to temporarily deviate from the default behavior:
02/26/2013 (12:46 pm)
Well, I can't promise any perfect ports... I don't have alot of time to play with Torque anymore.Your questions about the Triangle++ library and the gPolysoupOverride flag are related to my old RoomBuilder code. If I remember correctly, the Triangle++ library that was included with that old code was slightly modified from the original, because I couldn't get it to compile under VS2008 either. I just remember it was a real pain to get it compiled correctly (seems like there were a bunch of different preprocessor directives that had to be set).
The gPolysoupOverride flag is defined in the "archEditor.h" file included with RoomBuilder, right near the top. The "tsStatic.cpp" file was modified in its "TSStatic::castRayRendered" method to switch between ray-casting against the opcode collision meshes (default) or against the rendered mesh (gPolysoupOverride = true). It was used like this to temporarily deviate from the default behavior:
gPolysoupOverride = true; bool hit = gClientContainer.castRayRendered(startPnt, endPnt, 0xFFFFFFFF, &ri); gPolysoupOverride = false;

Torque Owner Robert Rice
Default Studio Name